Fix reporting of wheel events on top of GTK scroll bars
* src/gtkutil.c (xg_update_scrollbar_pos): (xg_update_horizontal_scrollbar_pos): Stop ensuring the window is native. (xg_event_is_for_scrollbar): New variable `for_valuator'. All callers changed. * src/gtkutil.h: Update prototypes. * src/xterm.c (handle_one_xevent): Drop all valuator change events destined for scroll bars.
This commit is contained in:
parent
3447f365b1
commit
ad0fb40ae6
4 changed files with 17 additions and 25 deletions
|
@ -4637,11 +4637,6 @@ xg_update_scrollbar_pos (struct frame *f,
|
|||
gtk_widget_set_size_request (wscroll, width, height);
|
||||
}
|
||||
|
||||
#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
|
||||
if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll)))
|
||||
emacs_abort ();
|
||||
#endif
|
||||
|
||||
if (oldx != -1 && oldw > 0 && oldh > 0)
|
||||
{
|
||||
/* Clear under old scroll bar position. */
|
||||
|
@ -4741,11 +4736,6 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
|
|||
pgtk_clear_area (f, oldx, oldy, oldw, oldh);
|
||||
#endif
|
||||
|
||||
#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
|
||||
if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll)))
|
||||
emacs_abort ();
|
||||
#endif
|
||||
|
||||
/* GTK does not redraw until the main loop is entered again, but
|
||||
if there are no X events pending we will not enter it. So we sync
|
||||
here to get some events. */
|
||||
|
@ -4911,7 +4901,8 @@ xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
frame. This function does additional checks. */
|
||||
|
||||
bool
|
||||
xg_event_is_for_scrollbar (struct frame *f, const EVENT *event)
|
||||
xg_event_is_for_scrollbar (struct frame *f, const EVENT *event,
|
||||
bool for_valuator)
|
||||
{
|
||||
bool retval = 0;
|
||||
|
||||
|
@ -4924,7 +4915,8 @@ xg_event_is_for_scrollbar (struct frame *f, const EVENT *event)
|
|||
&& (event->xgeneric.evtype == XI_ButtonPress
|
||||
&& xev->detail < 4))
|
||||
|| (event->type == ButtonPress
|
||||
&& event->xbutton.button < 4)))
|
||||
&& event->xbutton.button < 4)
|
||||
|| for_valuator))
|
||||
#else
|
||||
if (f
|
||||
#ifndef HAVE_PGTK
|
||||
|
|
|
@ -148,7 +148,8 @@ extern void xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
|
|||
int portion,
|
||||
int position,
|
||||
int whole);
|
||||
extern bool xg_event_is_for_scrollbar (struct frame *, const EVENT *);
|
||||
extern bool xg_event_is_for_scrollbar (struct frame *, const EVENT *,
|
||||
bool for_valuator);
|
||||
extern int xg_get_default_scrollbar_width (struct frame *f);
|
||||
extern int xg_get_default_scrollbar_height (struct frame *f);
|
||||
|
||||
|
|
|
@ -5957,7 +5957,7 @@ motion_notify_event (GtkWidget * widget, GdkEvent * event,
|
|||
clear_mouse_face (hlinfo);
|
||||
}
|
||||
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
if (f && xg_event_is_for_scrollbar (f, event, false))
|
||||
f = 0;
|
||||
if (f)
|
||||
{
|
||||
|
|
21
src/xterm.c
21
src/xterm.c
|
@ -10899,7 +10899,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
f = mouse_or_wdesc_frame (dpyinfo, event->xmotion.window);
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
if (f && xg_event_is_for_scrollbar (f, event, false))
|
||||
f = 0;
|
||||
#endif
|
||||
#ifdef HAVE_XWIDGETS
|
||||
|
@ -11203,7 +11203,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
memset (&compose_status, 0, sizeof (compose_status));
|
||||
dpyinfo->last_mouse_glyph_frame = NULL;
|
||||
|
||||
f = mouse_or_wdesc_frame (dpyinfo, event->xmotion.window);
|
||||
f = mouse_or_wdesc_frame (dpyinfo, event->xbutton.window);
|
||||
if (f && event->xbutton.type == ButtonPress
|
||||
&& !popup_activated ()
|
||||
&& !x_window_to_scroll_bar (event->xbutton.display,
|
||||
|
@ -11228,7 +11228,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
}
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
if (f && xg_event_is_for_scrollbar (f, event, false))
|
||||
f = 0;
|
||||
#endif
|
||||
if (f)
|
||||
|
@ -11733,7 +11733,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
int scroll_height;
|
||||
Lisp_Object window;
|
||||
|
||||
|
||||
/* See the comment on top of
|
||||
x_init_master_valuators for more details on how
|
||||
scroll wheel movement is reported on XInput 2. */
|
||||
|
@ -11763,6 +11762,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event, true))
|
||||
*finish = X_EVENT_DROP;
|
||||
#endif
|
||||
|
||||
if (FRAME_X_WINDOW (f) != xev->event)
|
||||
XTranslateCoordinates (dpyinfo->display,
|
||||
xev->event, FRAME_X_WINDOW (f),
|
||||
|
@ -11882,11 +11886,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
inev.ie.arg = list3 (Qnil,
|
||||
make_float (total_x),
|
||||
make_float (total_y));
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
*finish = X_EVENT_DROP;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -11953,7 +11952,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
f = mouse_or_wdesc_frame (dpyinfo, xev->event);
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
if (f && xg_event_is_for_scrollbar (f, event, false))
|
||||
f = 0;
|
||||
#endif
|
||||
if (f)
|
||||
|
@ -12138,7 +12137,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
}
|
||||
|
||||
#ifdef USE_GTK
|
||||
if (f && xg_event_is_for_scrollbar (f, event))
|
||||
if (f && xg_event_is_for_scrollbar (f, event, false))
|
||||
f = 0;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue