[gnome-shell/wip/carlosg/cleanup-gtk-usage: 5/12] overview: Do not warp pointer to fake crossing event



commit cf8c9d743eac23d0e8428c85c8f0c19241f558db
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 27 13:36:26 2018 +0100

    overview: Do not warp pointer to fake crossing event
    
    This is actually papering over bugs in toolkits. On X11 the Xserver will
    send crossing events when the stage input shape changes. As those go
    end up ignored in GTK+, this warp call aims (and randomly manages) to send
    a motion event that wouldn't go unlistened by the drag source window (the
    one holding the grab).
    
    This bug actually manifests in other ways, eg. by changing the window
    beneath the pointer with alt-tab while DnDing. This should be fixed
    altogether in the client side.

 js/ui/overview.js | 20 --------------------
 1 file changed, 20 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 35f5927a0..dfa377e2f 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -2,14 +2,12 @@
 
 const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const Meta = imports.gi.Meta;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
 const Lang = imports.lang;
 const St = imports.gi.St;
 const Shell = imports.gi.Shell;
-const Gdk = imports.gi.Gdk;
 
 const Background = imports.ui.background;
 const DND = imports.ui.dnd;
@@ -163,7 +161,6 @@ var Overview = new Lang.Class({
         this._windowSwitchTimestamp = 0;
         this._lastActiveWorkspaceIndex = -1;
         this._lastHoveredWindow = null;
-        this._needsFakePointerEvent = false;
 
         if (this._initCalled)
             this.init();
@@ -311,19 +308,9 @@ var Overview = new Lang.Class({
         if (this._windowSwitchTimeoutId != 0) {
             Mainloop.source_remove(this._windowSwitchTimeoutId);
             this._windowSwitchTimeoutId = 0;
-            this._needsFakePointerEvent = false;
         }
     },
 
-    _fakePointerEvent() {
-        let display = Gdk.Display.get_default();
-        let deviceManager = display.get_device_manager();
-        let pointer = deviceManager.get_client_pointer();
-        let [gdkScreen, pointerX, pointerY] = pointer.get_position();
-
-        pointer.warp(gdkScreen, pointerX, pointerY);
-    },
-
     _onDragMotion(dragEvent) {
         let targetIsWindow = dragEvent.targetActor &&
                              dragEvent.targetActor._delegate &&
@@ -345,7 +332,6 @@ var Overview = new Lang.Class({
             this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
                 () => {
                     this._windowSwitchTimeoutId = 0;
-                    this._needsFakePointerEvent = true;
                     Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
                                         this._windowSwitchTimestamp);
                     this.hide();
@@ -652,12 +638,6 @@ var Overview = new Lang.Class({
             Main.layoutManager.hideOverview();
 
         this._syncGrab();
-
-        // Fake a pointer event if requested
-        if (this._needsFakePointerEvent) {
-            this._fakePointerEvent();
-            this._needsFakePointerEvent = false;
-        }
     },
 
     toggle() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]