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.
/* 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 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
}
+#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.
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
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
{
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)
{
return finish;
}
+#endif
/* Read events coming from the X server.
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 *,