Fix touch event menu bar detection
* src/xterm.c (handle_one_event): Don't drop menu bar touch events.
This commit is contained in:
parent
a5509a2a5e
commit
513fe2d6ff
1 changed files with 42 additions and 34 deletions
76
src/xterm.c
76
src/xterm.c
|
@ -10878,6 +10878,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
case XI_TouchBegin:
|
||||
{
|
||||
struct xi_device_t *device;
|
||||
bool menu_bar_p = false;
|
||||
device = xi_device_from_id (dpyinfo, xev->deviceid);
|
||||
x_display_set_last_user_time (dpyinfo, xev->time);
|
||||
|
||||
|
@ -10889,47 +10890,54 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
|||
|
||||
f = x_any_window_to_frame (dpyinfo, xev->event);
|
||||
|
||||
if (f && device->direct_p)
|
||||
{
|
||||
*finish = X_EVENT_DROP;
|
||||
x_catch_errors (dpyinfo->display);
|
||||
XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
|
||||
xev->detail, xev->event, XIAcceptTouch);
|
||||
if (!x_had_errors_p (dpyinfo->display))
|
||||
{
|
||||
xi_link_touch_point (device, xev->detail, xev->event_x,
|
||||
xev->event_y);
|
||||
|
||||
#ifdef HAVE_GTK3
|
||||
if (FRAME_X_OUTPUT (f)->menubar_widget
|
||||
&& xg_event_is_for_menubar (f, event))
|
||||
{
|
||||
bool was_waiting_for_input = waiting_for_input;
|
||||
/* This hack was adopted from the NS port. Whether
|
||||
or not it is actually safe is a different story
|
||||
altogether. */
|
||||
if (waiting_for_input)
|
||||
waiting_for_input = 0;
|
||||
set_frame_menubar (f, true);
|
||||
waiting_for_input = was_waiting_for_input;
|
||||
}
|
||||
menu_bar_p = (FRAME_X_OUTPUT (f)->menubar_widget
|
||||
&& xg_event_is_for_menubar (f, event));
|
||||
#endif
|
||||
|
||||
inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
|
||||
inev.ie.timestamp = xev->time;
|
||||
XSETFRAME (inev.ie.frame_or_window, f);
|
||||
XSETINT (inev.ie.x, lrint (xev->event_x));
|
||||
XSETINT (inev.ie.y, lrint (xev->event_y));
|
||||
XSETINT (inev.ie.arg, xev->detail);
|
||||
if (!menu_bar_p)
|
||||
{
|
||||
if (f && device->direct_p)
|
||||
{
|
||||
*finish = X_EVENT_DROP;
|
||||
x_catch_errors (dpyinfo->display);
|
||||
XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
|
||||
xev->detail, xev->event, XIAcceptTouch);
|
||||
if (!x_had_errors_p (dpyinfo->display))
|
||||
{
|
||||
xi_link_touch_point (device, xev->detail, xev->event_x,
|
||||
xev->event_y);
|
||||
|
||||
inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
|
||||
inev.ie.timestamp = xev->time;
|
||||
XSETFRAME (inev.ie.frame_or_window, f);
|
||||
XSETINT (inev.ie.x, lrint (xev->event_x));
|
||||
XSETINT (inev.ie.y, lrint (xev->event_y));
|
||||
XSETINT (inev.ie.arg, xev->detail);
|
||||
}
|
||||
x_uncatch_errors_after_check ();
|
||||
}
|
||||
x_uncatch_errors_after_check ();
|
||||
else
|
||||
{
|
||||
x_catch_errors (dpyinfo->display);
|
||||
XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
|
||||
xev->detail, xev->event, XIRejectTouch);
|
||||
x_uncatch_errors ();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
x_catch_errors (dpyinfo->display);
|
||||
XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
|
||||
xev->detail, xev->event, XIRejectTouch);
|
||||
x_uncatch_errors ();
|
||||
#ifdef HAVE_GTK3
|
||||
bool was_waiting_for_input = waiting_for_input;
|
||||
/* This hack was adopted from the NS port. Whether
|
||||
or not it is actually safe is a different story
|
||||
altogether. */
|
||||
if (waiting_for_input)
|
||||
waiting_for_input = 0;
|
||||
set_frame_menubar (f, true);
|
||||
waiting_for_input = was_waiting_for_input;
|
||||
#endif
|
||||
}
|
||||
|
||||
goto XI_OTHER;
|
||||
|
|
Loading…
Add table
Reference in a new issue