Fixes to mouse mode confined and captured
These modes will work on Linux in the same way as Windows.
This commit is contained in:
parent
a1b578562a
commit
7d6364d431
1 changed files with 12 additions and 5 deletions
|
@ -742,12 +742,15 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
|
|||
ERR_PRINT("NO GRAB");
|
||||
}
|
||||
|
||||
center.x = current_videomode.width / 2;
|
||||
center.y = current_videomode.height / 2;
|
||||
XWarpPointer(x11_display, None, x11_window,
|
||||
0, 0, 0, 0, (int)center.x, (int)center.y);
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
||||
center.x = current_videomode.width / 2;
|
||||
center.y = current_videomode.height / 2;
|
||||
|
||||
input->set_mouse_position(center);
|
||||
XWarpPointer(x11_display, None, x11_window,
|
||||
0, 0, 0, 0, (int)center.x, (int)center.y);
|
||||
|
||||
input->set_mouse_position(center);
|
||||
}
|
||||
} else {
|
||||
do_mouse_warp = false;
|
||||
}
|
||||
|
@ -2044,6 +2047,10 @@ void OS_X11::process_xevents() {
|
|||
|
||||
Point2i rel = pos - last_mouse_pos;
|
||||
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
||||
pos = Point2i(current_videomode.width / 2, current_videomode.height / 2);
|
||||
}
|
||||
|
||||
Ref<InputEventMouseMotion> mm;
|
||||
mm.instance();
|
||||
|
||||
|
|
Loading…
Reference in a new issue