interference with debugging failing X calls. */
static void x_connection_closed (Display *, const char *);
static void x_wm_set_window_state (struct frame *, int);
-static void x_wm_set_icon_pixmap (struct frame *, int);
+static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
static void x_initialize (void);
}
+#ifdef USE_LUCID
+
/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
or DELTA. Try a color with RGB values multiplied by FACTOR first.
If this produces the same color as PIXEL, try a color where all RGB
return x_alloc_lighter_color (f, display, cmap, pixel, factor, delta);
}
+#endif
+
/* Structure specifying which arguments should be passed by Xt to
cvt_string_to_pixel. We want the widget's screen and colormap. */
a least-squares matching, which is what X uses for closest
color matching with StaticColor visuals. */
int nearest, i;
- unsigned long nearest_delta = ~ (unsigned long) 0;
+ int max_color_delta = 255;
+ int max_delta = 3 * max_color_delta;
+ int nearest_delta = max_delta + 1;
int ncells;
const XColor *cells = x_color_cells (dpy, &ncells);
for (nearest = i = 0; i < ncells; ++i)
{
- long dred = (color->red >> 8) - (cells[i].red >> 8);
- long dgreen = (color->green >> 8) - (cells[i].green >> 8);
- long dblue = (color->blue >> 8) - (cells[i].blue >> 8);
- unsigned long delta = dred * dred + dgreen * dgreen + dblue * dblue;
+ int dred = (color->red >> 8) - (cells[i].red >> 8);
+ int dgreen = (color->green >> 8) - (cells[i].green >> 8);
+ int dblue = (color->blue >> 8) - (cells[i].blue >> 8);
+ int delta = dred * dred + dgreen * dgreen + dblue * dblue;
if (delta < nearest_delta)
{
keys". It seems there's no cleaner way.
Test IsModifierKey to avoid handling
mode_switch incorrectly. */
- || ((unsigned) (keysym) >= XK_Select
- && (unsigned)(keysym) < XK_KP_Space)
+ || (XK_Select <= keysym && keysym < XK_KP_Space)
#endif
#ifdef XK_dead_circumflex
|| orig_keysym == XK_dead_circumflex
should be treated similarly to
Mode_switch by Emacs. */
#if defined XK_ISO_Lock && defined XK_ISO_Last_Group_Lock
- || ((unsigned)(orig_keysym)
- >= XK_ISO_Lock
- && (unsigned)(orig_keysym)
- <= XK_ISO_Last_Group_Lock)
+ || (XK_ISO_Lock <= orig_keysym
+ && orig_keysym <= XK_ISO_Last_Group_Lock)
#endif
))
{
int
x_bitmap_icon (struct frame *f, Lisp_Object file)
{
- int bitmap_id;
+ ptrdiff_t bitmap_id;
if (FRAME_X_WINDOW (f) == 0)
return 1;
/* Create the GNU bitmap and mask if necessary. */
if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0)
{
- int rc = -1;
+ ptrdiff_t rc = -1;
#ifdef USE_GTK
{
#ifdef HAVE_X11R6_XIM
struct xim_inst_t *xim_inst;
- int len;
+ ptrdiff_t len;
xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
dpyinfo->xim_callback_data = xim_inst;
}
static void
-x_wm_set_icon_pixmap (struct frame *f, int pixmap_id)
+x_wm_set_icon_pixmap (struct frame *f, ptrdiff_t pixmap_id)
{
Pixmap icon_pixmap, icon_mask;
static void
x_check_font (struct frame *f, struct font *font)
{
- Lisp_Object frame;
-
xassert (font != NULL && ! NILP (font->props[FONT_TYPE_INDEX]));
if (font->driver->check)
xassert (font->driver->check (f, font) == 0);
{
int seen_colon = 0;
const char *system_name = SSDATA (Vsystem_name);
- int system_name_length = strlen (system_name);
- int length_until_period = 0;
+ ptrdiff_t system_name_length = SBYTES (Vsystem_name);
+ ptrdiff_t length_until_period = 0;
while (system_name[length_until_period] != 0
&& system_name[length_until_period] != '.')
= XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
gray_bitmap_bits,
gray_bitmap_width, gray_bitmap_height,
- (unsigned long) 1, (unsigned long) 0, 1);
+ 1, 0, 1);
}
#ifdef HAVE_X_I18N
staticpro (&last_mouse_scroll_bar);
last_mouse_scroll_bar = Qnil;
- staticpro (&Qvendor_specific_keysyms);
- Qvendor_specific_keysyms = intern_c_string ("vendor-specific-keysyms");
-
- staticpro (&Qlatin_1);
- Qlatin_1 = intern_c_string ("latin-1");
+ DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
+ DEFSYM (Qlatin_1, "latin-1");
staticpro (&last_mouse_press_frame);
last_mouse_press_frame = Qnil;
xg_default_icon_file = make_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
staticpro (&xg_default_icon_file);
- Qx_gtk_map_stock = intern_c_string ("x-gtk-map-stock");
- staticpro (&Qx_gtk_map_stock);
+ DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
#endif
DEFVAR_BOOL ("x-use-underline-position-properties",