#ifdef USE_X_TOOLKIT
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not NO_EDITRES */
/* Include toolkit specific headers for the scroll bar widget. */
/* The application context for Xt use. */
XtAppContext Xt_app_con;
static String Xt_default_resources[] = {0};
-#endif /* USE_X_TOOLKIT */
/* Non-zero means user is interacting with a toolkit scroll bar. */
static int toolkit_scroll_bar_interaction;
+#endif /* USE_X_TOOLKIT */
/* Non-zero timeout value means ignore next mouse click if it arrives
before that timeout elapses (i.e. as part of the same sequence of
static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
static void x_set_window_size_1 (struct frame *, int, int, int);
+static void x_raise_frame (struct frame *);
+static void x_lower_frame (struct frame *);
static const XColor *x_color_cells (Display *, int *);
static void x_update_window_end (struct window *, int, int);
static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
enum scroll_bar_part *,
Lisp_Object *, Lisp_Object *,
- unsigned long *);
+ Time *);
static void x_handle_net_wm_state (struct frame *, XPropertyEvent *);
static void x_check_fullscreen (struct frame *);
static void x_check_expected_move (struct frame *, int, int);
static void x_sync_with_move (struct frame *, int, int, int);
static int handle_one_xevent (struct x_display_info *, XEvent *,
int *, struct input_event *);
+#ifdef USE_GTK
+static int x_dispatch_event (XEvent *, Display *);
+#endif
/* Don't declare this NO_RETURN because we want no
interference with debugging failing X calls. */
-static SIGTYPE x_connection_closed (Display *, const char *);
+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_initialize (void);
/* Flush display of frame F, or of all frames if F is null. */
double alpha_min = 1.0;
unsigned long opac;
- if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc)
- /* Since the WM decoration lies under the FRAME_OUTER_WINDOW,
- we must treat the former instead of the latter. */
- win = FRAME_X_OUTPUT (f)->parent_desc;
-
if (dpyinfo->x_highlight_frame == f)
alpha = f->alpha[0];
else
if (sb_width > 0)
{
- int left = WINDOW_SCROLL_BAR_AREA_X (w);
- int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
- * FRAME_COLUMN_WIDTH (f));
+ int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w);
+ int bar_area_width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
+ * FRAME_COLUMN_WIDTH (f));
if (bx < 0)
{
/* Bitmap fills the fringe. */
- if (left + width == p->x)
- bx = left + sb_width;
- else if (p->x + p->wd == left)
- bx = left;
+ if (bar_area_x + bar_area_width == p->x)
+ bx = bar_area_x + sb_width;
+ else if (p->x + p->wd == bar_area_x)
+ bx = bar_area_x;
if (bx >= 0)
{
int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
- nx = width - sb_width;
+ nx = bar_area_width - sb_width;
by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
row->y));
ny = row->visible_height;
}
else
{
- if (left + width == bx)
+ if (bar_area_x + bar_area_width == bx)
{
- bx = left + sb_width;
- nx += width - sb_width;
+ bx = bar_area_x + sb_width;
+ nx += bar_area_width - sb_width;
}
- else if (bx + nx == left)
- nx += width - sb_width;
+ else if (bx + nx == bar_area_x)
+ nx += bar_area_width - sb_width;
}
}
}
Faces to use in the mode line have already been computed when the
matrix was built, so there isn't much to do, here. */
-static INLINE void
+static inline void
x_set_mode_line_face_gc (struct glyph_string *s)
{
s->gc = s->face->gc;
S->stippled_p to a non-zero value if the face of S has a stipple
pattern. */
-static INLINE void
+static inline void
x_set_glyph_string_gc (struct glyph_string *s)
{
PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
/* Set clipping for output of glyph string S. S may be part of a mode
line or menu if we don't have X toolkit support. */
-static INLINE void
+static inline void
x_set_glyph_string_clipping (struct glyph_string *s)
{
XRectangle *r = s->clip;
/* Fill rectangle X, Y, W, H with background color of glyph string S. */
-static INLINE void
+static inline void
x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
{
XGCValues xgcv;
}
-/* Allocate the color COLOR->pixel on the screen and display of
- widget WIDGET in colormap CMAP. If an exact match cannot be
- allocated, try the nearest color available. Value is non-zero
- if successful. This is called from lwlib. */
-
-int
-x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
-{
- struct frame *f = x_frame_of_widget (widget);
- return x_alloc_nearest_color (f, cmap, color);
-}
-
+#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.
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. */
/* We don't set the output cursor here because there will always
follow an explicit cursor_to. */
BLOCK_INPUT;
- XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
- /* We have to clear the scroll bars, too. If we have changed
- colors or something like that, then they should be notified. */
+ /* The following call is commented out because it does not seem to accomplish
+ anything, apart from causing flickering during window resize. */
+ /* XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); */
+
+ /* We have to clear the scroll bars. If we have changed colors or
+ something like that, then they should be notified. */
x_scroll_bar_clear (f);
#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
fringe of W. */
window_box (w, -1, &x, &y, &width, &height);
+#ifdef USE_TOOLKIT_SCROLL_BARS
+ /* If the fringe is adjacent to the left (right) scroll bar of a
+ leftmost (rightmost, respectively) window, then extend its
+ background to the gap between the fringe and the bar. */
+ if ((WINDOW_LEFTMOST_P (w)
+ && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
+ || (WINDOW_RIGHTMOST_P (w)
+ && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
+ {
+ int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
+
+ if (sb_width > 0)
+ {
+ int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w);
+ int bar_area_width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
+ * FRAME_COLUMN_WIDTH (f));
+
+ if (bar_area_x + bar_area_width == x)
+ {
+ x = bar_area_x + sb_width;
+ width += bar_area_width - sb_width;
+ }
+ else if (x + width == bar_area_x)
+ width += bar_area_width - sb_width;
+ }
+ }
+#endif
+
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
bottom_y = y + height;
}
+#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
/* Handle an event saying the mouse has moved out of an Emacs frame. */
void
{
x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
}
+#endif
/* The focus has changed, or we have redirected a frame's focus to
another frame (this happens when a frame uses a surrogate
/* Convert between the modifier bits X uses and the modifier bits
Emacs uses. */
-unsigned int
-x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state)
+EMACS_INT
+x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state)
{
- EMACS_UINT mod_meta = meta_modifier;
- EMACS_UINT mod_alt = alt_modifier;
- EMACS_UINT mod_hyper = hyper_modifier;
- EMACS_UINT mod_super = super_modifier;
+ EMACS_INT mod_meta = meta_modifier;
+ EMACS_INT mod_alt = alt_modifier;
+ EMACS_INT mod_hyper = hyper_modifier;
+ EMACS_INT mod_super = super_modifier;
Lisp_Object tem;
tem = Fget (Vx_alt_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
+ if (INTEGERP (tem)) mod_alt = XINT (tem);
tem = Fget (Vx_meta_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_meta = XUINT (tem);
+ if (INTEGERP (tem)) mod_meta = XINT (tem);
tem = Fget (Vx_hyper_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem);
+ if (INTEGERP (tem)) mod_hyper = XINT (tem);
tem = Fget (Vx_super_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_super = XUINT (tem);
+ if (INTEGERP (tem)) mod_super = XINT (tem);
return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
| ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0));
}
-static unsigned int
-x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state)
+static int
+x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state)
{
- EMACS_UINT mod_meta = meta_modifier;
- EMACS_UINT mod_alt = alt_modifier;
- EMACS_UINT mod_hyper = hyper_modifier;
- EMACS_UINT mod_super = super_modifier;
+ int mod_meta = meta_modifier;
+ int mod_alt = alt_modifier;
+ int mod_hyper = hyper_modifier;
+ int mod_super = super_modifier;
Lisp_Object tem;
tem = Fget (Vx_alt_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
+ if (INTEGERP (tem)) mod_alt = XINT (tem);
tem = Fget (Vx_meta_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_meta = XUINT (tem);
+ if (INTEGERP (tem)) mod_meta = XINT (tem);
tem = Fget (Vx_hyper_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem);
+ if (INTEGERP (tem)) mod_hyper = XINT (tem);
tem = Fget (Vx_super_keysym, Qmodifier_value);
- if (! EQ (tem, Qnil)) mod_super = XUINT (tem);
+ if (INTEGERP (tem)) mod_super = XINT (tem);
return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0)
static void
XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
- long unsigned int *timestamp)
+ Time *timestamp)
{
FRAME_PTR f1;
return XSCROLL_BAR (bar);
}
- return 0;
+ return NULL;
}
x_send_scroll_bar_event and x_scroll_bar_to_input_event. */
static struct window **scroll_bar_windows;
-static int scroll_bar_windows_size;
+static size_t scroll_bar_windows_size;
/* Send a client message with message type Xatom_Scrollbar for a
XClientMessageEvent *ev = (XClientMessageEvent *) &event;
struct window *w = XWINDOW (window);
struct frame *f = XFRAME (w->frame);
- int i;
+ size_t i;
BLOCK_INPUT;
if (i == scroll_bar_windows_size)
{
- int new_size = max (10, 2 * scroll_bar_windows_size);
+ size_t new_size = max (10, 2 * scroll_bar_windows_size);
size_t nbytes = new_size * sizeof *scroll_bar_windows;
size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows;
+ if ((size_t) -1 / sizeof *scroll_bar_windows < new_size)
+ memory_full (SIZE_MAX);
scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
nbytes);
memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
ev->data.l[4] = (long) whole;
/* Make Xt timeouts work while the scroll bar is active. */
- toolkit_scroll_bar_interaction = 1;
#ifdef USE_X_TOOLKIT
+ toolkit_scroll_bar_interaction = 1;
x_activate_timeout_atimer ();
#endif
{
XClientMessageEvent *ev = (XClientMessageEvent *) event;
Lisp_Object window;
- struct frame *f;
struct window *w;
w = scroll_bar_windows[ev->data.l[0]];
scroll_bar_windows[ev->data.l[0]] = NULL;
XSETWINDOW (window, w);
- f = XFRAME (w->frame);
ievent->kind = SCROLL_BAR_CLICK_EVENT;
ievent->frame_or_window = window;
#ifdef USE_GTK
ievent->timestamp = CurrentTime;
#else
- ievent->timestamp = XtLastTimestampProcessed (FRAME_X_DISPLAY (f));
+ ievent->timestamp =
+ XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (w->frame)));
#endif
ievent->part = ev->data.l[1];
ievent->code = ev->data.l[2];
Widget widget;
Arg av[20];
int ac = 0;
- char *scroll_bar_name = SCROLL_BAR_NAME;
+ char const *scroll_bar_name = SCROLL_BAR_NAME;
unsigned long pixel;
BLOCK_INPUT;
f->output_data.x->edit_widget, av, ac);
{
- char *initial = "";
- char *val = initial;
+ char const *initial = "";
+ char const *val = initial;
XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val,
#ifdef XtNarrowScrollbars
XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll,
static void
x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x,
- Lisp_Object *y, long unsigned int *timestamp)
+ Lisp_Object *y, Time *timestamp)
{
struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
Window w = bar->x_window;
/* Set this to nonzero to fake an "X I/O error"
on a particular display. */
-struct x_display_info *XTread_socket_fake_io_error;
+static struct x_display_info *XTread_socket_fake_io_error;
/* When we find no input here, we occasionally do a no-op command
to verify that the X server is still running and we can still talk with it.
static struct x_display_info *next_noop_dpyinfo;
+#if defined USE_X_TOOLKIT || defined USE_GTK
#define SET_SAVED_BUTTON_EVENT \
do \
{ \
XSETFRAME (inev.ie.frame_or_window, f); \
} \
while (0)
+#endif
enum
{
#endif /* USE_GTK */
-static void xembed_send_message (struct frame *f, Time time,
- enum xembed_message message,
+static void xembed_send_message (struct frame *f, Time,
+ enum xembed_message,
long detail, long data1, long data2);
/* Handles the XEvent EVENT on display DPYINFO.
goto OTHER;
#endif /* USE_X_TOOLKIT */
{
- XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event;
+ XSelectionClearEvent *eventp = &(event.xselectionclear);
inev.ie.kind = SELECTION_CLEAR_EVENT;
SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
goto OTHER;
#endif /* USE_X_TOOLKIT */
{
- XSelectionRequestEvent *eventp
- = (XSelectionRequestEvent *) &event;
+ XSelectionRequestEvent *eventp = &(event.xselectionrequest);
inev.ie.kind = SELECTION_REQUEST_EVENT;
SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
return count;
}
+#if defined USE_GTK || defined USE_X_TOOLKIT
/* Handles the XEvent EVENT on display DISPLAY.
This is used for event loops outside the normal event handling,
return finish;
}
+#endif
/* Read events coming from the X server.
Calling x_uncatch_errors resumes the normal error handling. */
-void x_check_errors (Display *dpy, const char *format);
-
void
x_catch_errors (Display *dpy)
{
SIGPIPE will fail, causing Xlib to invoke the X IO error handler,
which will do the appropriate cleanup for us. */
-static SIGTYPE
+static void
x_connection_signal (int signalnum) /* If we don't have an argument, */
/* some compilers complain in signal calls. */
{
/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
the text of an error message that lead to the connection loss. */
-static SIGTYPE
+static void
x_connection_closed (Display *dpy, const char *error_message)
{
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
/* Lower frame F. */
-void
+static void
x_lower_frame (struct frame *f)
{
if (f->async_visible)
unknown reason, the call to XtMapWidget is completely ignored.
Mapping the widget a second time works. */
- if (!FRAME_VISIBLE_P (f) && --retry_count > 0)
+ if (!FRAME_VISIBLE_P (f) && --retry_count != 0)
goto retry;
}
}
/* Destroy the X window of frame F. */
-void
+static void
x_destroy_window (struct frame *f)
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
/* Used for IconicState or NormalState */
-void
+static void
x_wm_set_window_state (struct frame *f, int state)
{
#ifdef USE_X_TOOLKIT
#endif /* not USE_X_TOOLKIT */
}
-void
+static void
x_wm_set_icon_pixmap (struct frame *f, int pixmap_id)
{
Pixmap icon_pixmap, icon_mask;
for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
{
if (*name1 == ':')
- seen_colon++;
+ seen_colon = 1;
if (seen_colon && *name1 == '.')
return 1;
}
{ "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
{ "TARGETS", &dpyinfo->Xatom_TARGETS },
{ "NULL", &dpyinfo->Xatom_NULL },
+ { "ATOM", &dpyinfo->Xatom_ATOM },
{ "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
+ { "CLIPBOARD_MANAGER", &dpyinfo->Xatom_CLIPBOARD_MANAGER },
{ "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
/* For properties of font. */
{ "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
#ifdef USE_LUCID
{
- Display *dpy = dpyinfo->display;
XrmValue d, fr, to;
Font font;
+ dpy = dpyinfo->display;
d.addr = (XPointer)&dpy;
d.size = sizeof (Display *);
fr.addr = XtDefaultFont;
/* Get rid of display DPYINFO, deleting all frames on it,
and without sending any more commands to the X server. */
-void
+static void
x_delete_display (struct x_display_info *dpyinfo)
{
struct terminal *t;