]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve MPX interaction with xwidgets and drag-and-drop
authorPo Lu <luangruo@yahoo.com>
Wed, 10 Aug 2022 02:33:43 +0000 (10:33 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 10 Aug 2022 02:33:43 +0000 (10:33 +0800)
* src/xterm.c (handle_one_xevent): Handle focus interaction in
more places.

src/xterm.c

index ab43a8ec517aa3652bd3ddd9de8bc5f27e24650d..41537ade15591530d83e77526e416e39b236160d 100644 (file)
@@ -21333,6 +21333,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                    }
 #endif
 
+                 if (f && device)
+                   xi_handle_interaction (dpyinfo, f, device,
+                                          xev->time);
+
                  if (xev->evtype == XI_ButtonPress
                      && x_dnd_last_seen_window != None)
                    {
@@ -21579,11 +21583,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                                              xev->send_event);
 
              source = xi_device_from_id (dpyinfo, xev->sourceid);
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
 
 #ifdef HAVE_XWIDGETS
              xvw = xwidget_view_from_window (xev->event);
              if (xvw)
                {
+                 /* If the user interacts with a frame that's focused
+                    on another device, but not the current focus
+                    frame, make it the focus frame.  */
+                 if (device)
+                   xi_handle_interaction (dpyinfo, xvw->frame,
+                                          device, xev->time);
+
                  xwidget_button (xvw, xev->evtype == XI_ButtonPress,
                                  lrint (xev->event_x), lrint (xev->event_y),
                                  xev->detail, xi_convert_event_state (xev),
@@ -21603,8 +21615,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                }
 #endif
 
-             device = xi_device_from_id (dpyinfo, xev->deviceid);
-
              if (!device)
                goto XI_OTHER;