summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/os_x11.cpp13
-rw-r--r--platform/x11/os_x11.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index e0dc594441..4c45fcfaaf 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -461,6 +461,19 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
}
+void OS_X11::warp_mouse_pos(const Point2& p_to) {
+
+ if (mouse_mode==MOUSE_MODE_CAPTURED) {
+
+ last_mouse_pos=p_to;
+ } else {
+
+ XWarpPointer(x11_display, None, x11_window,
+ 0,0,0,0, (int)p_to.x, (int)p_to.y);
+ }
+
+}
+
OS::MouseMode OS_X11::get_mouse_mode() const {
return mouse_mode;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index fedf41ad0f..2ffca0e042 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -179,6 +179,7 @@ public:
void set_mouse_mode(MouseMode p_mode);
MouseMode get_mouse_mode() const;
+ virtual void warp_mouse_pos(const Point2& p_to);
virtual Point2 get_mouse_pos() const;
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String& p_title);