Commit 098db9dd authored by Paul Eggert's avatar Paul Eggert

* xterm.c: Fix problems found by static analysis with other toolkits.

(toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
(x_dispatch_event): Declare static only if !USE_GTK && USE_X_TOOLKIT.
Define if USE_GTK || (HAVE_MENUS && USE_X_TOOLKIT); USE_MOTIF need
not be part of this test.
(SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
* xterm.h (x_dispatch_event): Use USE_GTK, not USE_MOTIF, when testing
whether to declare.
* xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
parent eb18f6cc
2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
* xterm.c: Fix problems found by static analysis with other toolkits.
(toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
(x_dispatch_event): Declare static only if !USE_GTK && USE_X_TOOLKIT.
Define if USE_GTK || (HAVE_MENUS && USE_X_TOOLKIT); USE_MOTIF need
not be part of this test.
(SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
* xterm.h (x_dispatch_event): Use USE_GTK, not USE_MOTIF, when testing
whether to declare.
* xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
* xmenu.c (menu_help_callback): Pointer type fixes.
Use const pointers when pointing at readonly data. Avoid pointer
signedness clashes.
......
......@@ -187,11 +187,11 @@ static struct {
/* 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
......@@ -349,7 +349,7 @@ 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 *);
#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
#if !defined USE_GTK && defined USE_X_TOOLKIT
static int x_dispatch_event (XEvent *, Display *);
#endif
/* Don't declare this NO_RETURN because we want no
......@@ -3446,6 +3446,16 @@ x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct inp
}
#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_mouse_leave (struct x_display_info *dpyinfo)
{
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
mini-buffer frame). Shift the highlight as appropriate.
......@@ -4208,8 +4218,8 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
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
......@@ -5655,6 +5665,7 @@ static struct x_display_info *XTread_socket_fake_io_error;
static struct x_display_info *next_noop_dpyinfo;
#if defined USE_X_TOOLKIT || defined USE_GTK
#define SET_SAVED_BUTTON_EVENT \
do \
{ \
......@@ -5666,6 +5677,7 @@ static struct x_display_info *next_noop_dpyinfo;
XSETFRAME (inev.ie.frame_or_window, f); \
} \
while (0)
#endif
enum
{
......@@ -6965,15 +6977,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
return count;
}
#if defined USE_GTK || (defined HAVE_MENUS && defined USE_X_TOOLKIT)
/* Handles the XEvent EVENT on display DISPLAY.
This is used for event loops outside the normal event handling,
i.e. looping while a popup menu or a dialog is posted.
Returns the value handle_one_xevent sets in the finish argument. */
#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
static
#endif
int
x_dispatch_event (XEvent *event, Display *display)
{
......@@ -6987,6 +6997,7 @@ x_dispatch_event (XEvent *event, Display *display)
return finish;
}
#endif
/* Read events coming from the X server.
......
......@@ -982,11 +982,11 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
extern void x_query_colors (struct frame *f, XColor *, int);
extern void x_query_color (struct frame *f, XColor *);
extern void x_clear_area (Display *, Window, int, int, int, int, int);
#ifdef WINDOWSNT
#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
extern void x_mouse_leave (struct x_display_info *);
#endif
#if defined USE_MOTIF || defined USE_X_TOOLKIT
#if defined USE_GTK || defined USE_X_TOOLKIT
extern int x_dispatch_event (XEvent *, Display *);
#endif
extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment