83 lines
2.7 KiB
Diff
83 lines
2.7 KiB
Diff
|
diff -up emacs-23.1/src/gtkutil.c.scroll emacs-23.1/src/gtkutil.c
|
|||
|
--- emacs-23.1/src/gtkutil.c.scroll 2009-06-21 06:38:15.000000000 +0200
|
|||
|
+++ emacs-23.1/src/gtkutil.c 2009-12-02 17:10:08.000000000 +0100
|
|||
|
@@ -3401,6 +3401,38 @@ xg_set_toolkit_scroll_bar_thumb (bar, po
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
+/* Return non-zero if EVENT is for a scroll bar in frame F.
|
|||
|
+ When the same X window is used for several Gtk+ widgets, we cannot
|
|||
|
+ say for sure based on the X window alone if an event is for the
|
|||
|
+ frame. This function does additional checks.
|
|||
|
+
|
|||
|
+ Return non-zero if the event is for a scroll bar, zero otherwise. */
|
|||
|
+
|
|||
|
+int
|
|||
|
+xg_event_is_for_scrollbar (f, event)
|
|||
|
+ FRAME_PTR f;
|
|||
|
+ XEvent *event;
|
|||
|
+{
|
|||
|
+ int retval = 0;
|
|||
|
+
|
|||
|
+ if (f && event->type == ButtonPress)
|
|||
|
+ {
|
|||
|
+ /* Check if press occurred outside the edit widget. */
|
|||
|
+ GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
|
|||
|
+ retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL)
|
|||
|
+ != f->output_data.x->edit_widget->window;
|
|||
|
+ }
|
|||
|
+ else if (f && (event->type != ButtonRelease || event->type != MotionNotify))
|
|||
|
+ {
|
|||
|
+ /* If we are releasing or moving the scroll bar, it has the grab. */
|
|||
|
+ retval = gtk_grab_get_current () != 0
|
|||
|
+ && gtk_grab_get_current () != f->output_data.x->edit_widget;
|
|||
|
+ }
|
|||
|
+
|
|||
|
+ return retval;
|
|||
|
+}
|
|||
|
+
|
|||
|
+
|
|||
|
|
|||
|
/***********************************************************************
|
|||
|
Tool bar functions
|
|||
|
diff -up emacs-23.1/src/gtkutil.h.scroll emacs-23.1/src/gtkutil.h
|
|||
|
--- emacs-23.1/src/gtkutil.h.scroll 2009-06-21 06:38:15.000000000 +0200
|
|||
|
+++ emacs-23.1/src/gtkutil.h 2009-12-02 17:10:08.000000000 +0100
|
|||
|
@@ -180,6 +180,8 @@ extern void xg_set_toolkit_scroll_bar_th
|
|||
|
int position,
|
|||
|
int whole));
|
|||
|
|
|||
|
+extern int xg_event_is_for_scrollbar P_ ((FRAME_PTR f, XEvent *event));
|
|||
|
+
|
|||
|
|
|||
|
extern void update_frame_tool_bar P_ ((FRAME_PTR f));
|
|||
|
extern void free_frame_tool_bar P_ ((FRAME_PTR f));
|
|||
|
diff -up emacs-23.1/src/xterm.c.scroll emacs-23.1/src/xterm.c
|
|||
|
--- emacs-23.1/src/xterm.c.scroll 2009-06-21 06:38:20.000000000 +0200
|
|||
|
+++ emacs-23.1/src/xterm.c 2009-12-02 17:13:24.000000000 +0100
|
|||
|
@@ -6743,6 +6743,12 @@ handle_one_xevent (dpyinfo, eventp, fini
|
|||
|
clear_mouse_face (dpyinfo);
|
|||
|
}
|
|||
|
|
|||
|
+
|
|||
|
+#ifdef USE_GTK
|
|||
|
+ if (f && xg_event_is_for_scrollbar (f, &event))
|
|||
|
+ f = 0;
|
|||
|
+#endif
|
|||
|
+
|
|||
|
if (f)
|
|||
|
{
|
|||
|
|
|||
|
@@ -6899,6 +6905,11 @@ handle_one_xevent (dpyinfo, eventp, fini
|
|||
|
else
|
|||
|
f = x_window_to_frame (dpyinfo, event.xbutton.window);
|
|||
|
|
|||
|
+#ifdef USE_GTK
|
|||
|
+ if (f && xg_event_is_for_scrollbar (f, &event))
|
|||
|
+ f = 0;
|
|||
|
+#endif
|
|||
|
+
|
|||
|
if (f)
|
|||
|
{
|
|||
|
/* Is this in the tool-bar? */
|