aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/gtkutil.c32
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/xterm.c8
4 files changed, 50 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2e913ff30b9..29387dac5ec 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12009-11-06 Jan Djärv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (xg_event_is_for_scrollbar): New function (bug#4870).
4
5 * gtkutil.h: Declare xg_event_is_for_scrollbar (bug#4870).
6
7 * xterm.c (handle_one_xevent): Call xg_event_is_for_scrollbar for
8 ButtonPressRelease and MotionNotify (bug#4870).
9
12009-11-06 Dan Nicolaescu <dann@ics.uci.edu> 102009-11-06 Dan Nicolaescu <dann@ics.uci.edu>
2 11
3 * keymap.c (syms_of_keymap): Construct exclude_keys in pure memory. 12 * keymap.c (syms_of_keymap): Construct exclude_keys in pure memory.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index e95601c7fdd..543b868448d 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3371,6 +3371,38 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
3371 } 3371 }
3372} 3372}
3373 3373
3374/* Return non-zero if EVENT is for a scroll bar in frame F.
3375 When the same X window is used for several Gtk+ widgets, we cannot
3376 say for sure based on the X window alone if an event is for the
3377 frame. This function does additional checks.
3378
3379 Return non-zero if the event is for a scroll bar, zero otherwise. */
3380
3381int
3382xg_event_is_for_scrollbar (f, event)
3383 FRAME_PTR f;
3384 XEvent *event;
3385{
3386 int retval = 0;
3387
3388 if (f && event->type == ButtonPress)
3389 {
3390 /* Check if press occurred outside the edit widget. */
3391 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
3392 retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL)
3393 != f->output_data.x->edit_widget->window;
3394 }
3395 else if (f && (event->type != ButtonRelease || event->type != MotionNotify))
3396 {
3397 /* If we are releasing or moving the scroll bar, it has the grab. */
3398 retval = gtk_grab_get_current () != 0
3399 && gtk_grab_get_current () != f->output_data.x->edit_widget;
3400 }
3401
3402 return retval;
3403}
3404
3405
3374 3406
3375/*********************************************************************** 3407/***********************************************************************
3376 Tool bar functions 3408 Tool bar functions
diff --git a/src/gtkutil.h b/src/gtkutil.h
index faf5395fdbe..6d9f6da2699 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -179,7 +179,7 @@ extern void xg_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *bar,
179 int portion, 179 int portion,
180 int position, 180 int position,
181 int whole)); 181 int whole));
182 182extern int xg_event_is_for_scrollbar P_ ((FRAME_PTR f, XEvent *event));
183 183
184extern void update_frame_tool_bar P_ ((FRAME_PTR f)); 184extern void update_frame_tool_bar P_ ((FRAME_PTR f));
185extern void free_frame_tool_bar P_ ((FRAME_PTR f)); 185extern void free_frame_tool_bar P_ ((FRAME_PTR f));
diff --git a/src/xterm.c b/src/xterm.c
index 1ba367c9989..545f3a5254d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6688,6 +6688,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6688 clear_mouse_face (dpyinfo); 6688 clear_mouse_face (dpyinfo);
6689 } 6689 }
6690 6690
6691#ifdef USE_GTK
6692 if (f && xg_event_is_for_scrollbar (f, &event))
6693 f = 0;
6694#endif
6691 if (f) 6695 if (f)
6692 { 6696 {
6693 6697
@@ -6824,6 +6828,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6824 else 6828 else
6825 f = x_window_to_frame (dpyinfo, event.xbutton.window); 6829 f = x_window_to_frame (dpyinfo, event.xbutton.window);
6826 6830
6831#ifdef USE_GTK
6832 if (f && xg_event_is_for_scrollbar (f, &event))
6833 f = 0;
6834#endif
6827 if (f) 6835 if (f)
6828 { 6836 {
6829 /* Is this in the tool-bar? */ 6837 /* Is this in the tool-bar? */