aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-16 08:24:20 -0700
committerPaul Eggert2011-04-16 08:24:20 -0700
commit098db9dd8b385f13ab74a37046a4cd98c8b314d6 (patch)
tree0d0d70bc5b76f328d3b274d8df0205341e341f9b /src
parenteb18f6cc6644a9e43204e5062f9fd45fdad8141f (diff)
downloademacs-098db9dd8b385f13ab74a37046a4cd98c8b314d6.tar.gz
emacs-098db9dd8b385f13ab74a37046a4cd98c8b314d6.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/xterm.c23
-rw-r--r--src/xterm.h4
3 files changed, 30 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8eedcae2d8b..c009a8fadee 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu> 12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xterm.c: Fix problems found by static analysis with other toolkits.
4 (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
5 (x_dispatch_event): Declare static only if !USE_GTK && USE_X_TOOLKIT.
6 Define if USE_GTK || (HAVE_MENUS && USE_X_TOOLKIT); USE_MOTIF need
7 not be part of this test.
8 (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
9 * xterm.h (x_dispatch_event): Use USE_GTK, not USE_MOTIF, when testing
10 whether to declare.
11 * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
12 defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
13
3 * xmenu.c (menu_help_callback): Pointer type fixes. 14 * xmenu.c (menu_help_callback): Pointer type fixes.
4 Use const pointers when pointing at readonly data. Avoid pointer 15 Use const pointers when pointing at readonly data. Avoid pointer
5 signedness clashes. 16 signedness clashes.
diff --git a/src/xterm.c b/src/xterm.c
index 121ac22c72f..74eff795ee4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -187,11 +187,11 @@ static struct {
187/* The application context for Xt use. */ 187/* The application context for Xt use. */
188XtAppContext Xt_app_con; 188XtAppContext Xt_app_con;
189static String Xt_default_resources[] = {0}; 189static String Xt_default_resources[] = {0};
190#endif /* USE_X_TOOLKIT */
191 190
192/* Non-zero means user is interacting with a toolkit scroll bar. */ 191/* Non-zero means user is interacting with a toolkit scroll bar. */
193 192
194static int toolkit_scroll_bar_interaction; 193static int toolkit_scroll_bar_interaction;
194#endif /* USE_X_TOOLKIT */
195 195
196/* Non-zero timeout value means ignore next mouse click if it arrives 196/* Non-zero timeout value means ignore next mouse click if it arrives
197 before that timeout elapses (i.e. as part of the same sequence of 197 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);
349static void x_sync_with_move (struct frame *, int, int, int); 349static void x_sync_with_move (struct frame *, int, int, int);
350static int handle_one_xevent (struct x_display_info *, XEvent *, 350static int handle_one_xevent (struct x_display_info *, XEvent *,
351 int *, struct input_event *); 351 int *, struct input_event *);
352#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT) 352#if !defined USE_GTK && defined USE_X_TOOLKIT
353static int x_dispatch_event (XEvent *, Display *); 353static int x_dispatch_event (XEvent *, Display *);
354#endif 354#endif
355/* Don't declare this NO_RETURN because we want no 355/* 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
3446} 3446}
3447 3447
3448 3448
3449#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
3450/* Handle an event saying the mouse has moved out of an Emacs frame. */
3451
3452void
3453x_mouse_leave (struct x_display_info *dpyinfo)
3454{
3455 x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
3456}
3457#endif
3458
3449/* The focus has changed, or we have redirected a frame's focus to 3459/* The focus has changed, or we have redirected a frame's focus to
3450 another frame (this happens when a frame uses a surrogate 3460 another frame (this happens when a frame uses a surrogate
3451 mini-buffer frame). Shift the highlight as appropriate. 3461 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)
4208 ev->data.l[4] = (long) whole; 4218 ev->data.l[4] = (long) whole;
4209 4219
4210 /* Make Xt timeouts work while the scroll bar is active. */ 4220 /* Make Xt timeouts work while the scroll bar is active. */
4211 toolkit_scroll_bar_interaction = 1;
4212#ifdef USE_X_TOOLKIT 4221#ifdef USE_X_TOOLKIT
4222 toolkit_scroll_bar_interaction = 1;
4213 x_activate_timeout_atimer (); 4223 x_activate_timeout_atimer ();
4214#endif 4224#endif
4215 4225
@@ -5655,6 +5665,7 @@ static struct x_display_info *XTread_socket_fake_io_error;
5655 5665
5656static struct x_display_info *next_noop_dpyinfo; 5666static struct x_display_info *next_noop_dpyinfo;
5657 5667
5668#if defined USE_X_TOOLKIT || defined USE_GTK
5658#define SET_SAVED_BUTTON_EVENT \ 5669#define SET_SAVED_BUTTON_EVENT \
5659 do \ 5670 do \
5660 { \ 5671 { \
@@ -5666,6 +5677,7 @@ static struct x_display_info *next_noop_dpyinfo;
5666 XSETFRAME (inev.ie.frame_or_window, f); \ 5677 XSETFRAME (inev.ie.frame_or_window, f); \
5667 } \ 5678 } \
5668 while (0) 5679 while (0)
5680#endif
5669 5681
5670enum 5682enum
5671{ 5683{
@@ -6965,15 +6977,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6965 return count; 6977 return count;
6966} 6978}
6967 6979
6980#if defined USE_GTK || (defined HAVE_MENUS && defined USE_X_TOOLKIT)
6968 6981
6969/* Handles the XEvent EVENT on display DISPLAY. 6982/* Handles the XEvent EVENT on display DISPLAY.
6970 This is used for event loops outside the normal event handling, 6983 This is used for event loops outside the normal event handling,
6971 i.e. looping while a popup menu or a dialog is posted. 6984 i.e. looping while a popup menu or a dialog is posted.
6972 6985
6973 Returns the value handle_one_xevent sets in the finish argument. */ 6986 Returns the value handle_one_xevent sets in the finish argument. */
6974#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
6975static
6976#endif
6977int 6987int
6978x_dispatch_event (XEvent *event, Display *display) 6988x_dispatch_event (XEvent *event, Display *display)
6979{ 6989{
@@ -6987,6 +6997,7 @@ x_dispatch_event (XEvent *event, Display *display)
6987 6997
6988 return finish; 6998 return finish;
6989} 6999}
7000#endif
6990 7001
6991 7002
6992/* Read events coming from the X server. 7003/* Read events coming from the X server.
diff --git a/src/xterm.h b/src/xterm.h
index bd5cf2dbd31..787dd41ec4a 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -982,11 +982,11 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
982extern void x_query_colors (struct frame *f, XColor *, int); 982extern void x_query_colors (struct frame *f, XColor *, int);
983extern void x_query_color (struct frame *f, XColor *); 983extern void x_query_color (struct frame *f, XColor *);
984extern void x_clear_area (Display *, Window, int, int, int, int, int); 984extern void x_clear_area (Display *, Window, int, int, int, int, int);
985#ifdef WINDOWSNT 985#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
986extern void x_mouse_leave (struct x_display_info *); 986extern void x_mouse_leave (struct x_display_info *);
987#endif 987#endif
988 988
989#if defined USE_MOTIF || defined USE_X_TOOLKIT 989#if defined USE_GTK || defined USE_X_TOOLKIT
990extern int x_dispatch_event (XEvent *, Display *); 990extern int x_dispatch_event (XEvent *, Display *);
991#endif 991#endif
992extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, 992extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *,