[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f9f6c67181: Initialize time inside motion and button events conve
From: |
Po Lu |
Subject: |
master f9f6c67181: Initialize time inside motion and button events converted from XI events |
Date: |
Fri, 4 Mar 2022 05:35:08 -0500 (EST) |
branch: master
commit f9f6c67181584cdf8334610031486baf1d9ad203
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Initialize time inside motion and button events converted from XI events
* src/xterm.c (handle_one_xevent): Make sure time is initialized
in artificial events passed to functions that use it.
---
src/xterm.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 2c6289a9cb..764638d5b8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11507,9 +11507,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
if (!dpyinfo->supports_xi2)
goto OTHER;
+
if (event->xgeneric.extension != dpyinfo->xi2_opcode)
/* Not an XI2 event. */
goto OTHER;
+
bool must_free_data = false;
XIEvent *xi_event = (XIEvent *) event->xcookie.data;
/* Sometimes the event is already claimed by GTK, which
@@ -11521,16 +11523,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
XIDeviceEvent *xev = (XIDeviceEvent *) xi_event;
-#ifdef HAVE_XINPUT2_1
- XIValuatorState *states;
- double *values;
- bool found_valuator = false;
-#endif
-
- /* A fake XMotionEvent for x_note_mouse_movement. */
- XMotionEvent ev;
- /* A fake XButtonEvent for x_construct_mouse_click. */
- XButtonEvent bv;
if (!xi_event)
{
@@ -11588,11 +11580,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
case XI_Enter:
{
XIEnterEvent *enter = (XIEnterEvent *) xi_event;
+ XMotionEvent ev;
any = x_top_window_to_frame (dpyinfo, enter->event);
ev.x = lrint (enter->event_x);
ev.y = lrint (enter->event_y);
ev.window = enter->event;
+ ev.time = enter->time;
+
x_display_set_last_user_time (dpyinfo, xi_event->time);
#ifdef USE_MOTIF
@@ -11668,10 +11663,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
case XI_Leave:
{
XILeaveEvent *leave = (XILeaveEvent *) xi_event;
+#ifdef USE_GTK
+ XMotionEvent ev;
ev.x = lrint (leave->event_x);
ev.y = lrint (leave->event_y);
ev.window = leave->event;
+ ev.time = leave->time;
+#endif
+
any = x_top_window_to_frame (dpyinfo, leave->event);
/* This allows us to catch LeaveNotify events generated by
@@ -11784,6 +11784,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
case XI_Motion:
{
struct xi_device_t *device;
+#ifdef HAVE_XINPUT2_1
+ XIValuatorState *states;
+ double *values;
+ bool found_valuator = false;
+#endif
+ /* A fake XMotionEvent for x_note_mouse_movement. */
+ XMotionEvent ev;
#ifdef HAVE_XINPUT2_1
states = &xev->valuators;
@@ -12122,6 +12129,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
#ifdef HAVE_XWIDGETS
struct xwidget_view *xvw;
#endif
+ /* A fake XButtonEvent for x_construct_mouse_click. */
+ XButtonEvent bv;
#ifdef USE_MOTIF
#ifdef USE_TOOLKIT_SCROLL_BARS
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f9f6c67181: Initialize time inside motion and button events converted from XI events,
Po Lu <=