瀏覽代碼

fix lookaround task for linux

David Rose 17 年之前
父節點
當前提交
d99674833c
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 5 2
      panda/src/glxdisplay/glxGraphicsWindow.cxx
  2. 5 2
      panda/src/tinydisplay/tinyXGraphicsWindow.cxx

+ 5 - 2
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -111,8 +111,11 @@ move_pointer(int device, int x, int y) {
       return false;
       return false;
     }
     }
 
 
-    XWarpPointer(_display, None, _xwindow, 0, 0, 0, 0, x, y);
-    _input_devices[0].set_pointer_in_window(x, y);
+    const MouseData &md = _input_devices[0].get_pointer();
+    if (!md.get_in_window() || md.get_x() != x || md.get_y() != y) {
+      XWarpPointer(_display, None, _xwindow, 0, 0, 0, 0, x, y);
+      _input_devices[0].set_pointer_in_window(x, y);
+    }
     return true;
     return true;
   } else {
   } else {
     // Move a raw mouse.
     // Move a raw mouse.

+ 5 - 2
panda/src/tinydisplay/tinyXGraphicsWindow.cxx

@@ -120,8 +120,11 @@ move_pointer(int device, int x, int y) {
       return false;
       return false;
     }
     }
 
 
-    XWarpPointer(_display, None, _xwindow, 0, 0, 0, 0, x, y);
-    _input_devices[0].set_pointer_in_window(x, y);
+    const MouseData &md = _input_devices[0].get_pointer();
+    if (!md.get_in_window() || md.get_x() != x || md.get_y() != y) {
+      XWarpPointer(_display, None, _xwindow, 0, 0, 0, 0, x, y);
+      _input_devices[0].set_pointer_in_window(x, y);
+    }
     return true;
     return true;
   } else {
   } else {
     // Move a raw mouse.
     // Move a raw mouse.