Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowX11.cpp
| Show First 20 Lines • Show All 1,520 Lines • ▼ Show 20 Lines | |||||
| #ifdef GHOST_X11_GRAB | #ifdef GHOST_X11_GRAB | ||||
| XGrabPointer(m_display, m_window, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, | XGrabPointer(m_display, m_window, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, | ||||
| GrabModeAsync, GrabModeAsync, None, None, CurrentTime); | GrabModeAsync, GrabModeAsync, None, None, CurrentTime); | ||||
| #endif | #endif | ||||
| } | } | ||||
| else { | else { | ||||
| if (m_cursorGrab == GHOST_kGrabHide) { | if (m_cursorGrab == GHOST_kGrabHide) { | ||||
| m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]); | m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]); | ||||
| setWindowCursorVisibility(true); | |||||
| } | } | ||||
| if (m_cursorGrab != GHOST_kGrabNormal) { | if (m_cursorGrab != GHOST_kGrabNormal) { | ||||
| /* use to generate a mouse move event, otherwise the last event | /* use to generate a mouse move event, otherwise the last event | ||||
| * blender gets can be outside the screen causing menus not to show | * blender gets can be outside the screen causing menus not to show | ||||
| * properly unless the user moves the mouse */ | * properly unless the user moves the mouse */ | ||||
| #ifdef WITH_X11_XINPUT | #ifdef WITH_X11_XINPUT | ||||
| if ((m_system->m_xinput_version.present) && | if ((m_system->m_xinput_version.present) && | ||||
| (m_system->m_xinput_version.major_version >= 2)) | (m_system->m_xinput_version.major_version >= 2)) | ||||
| { | { | ||||
| int device_id; | int device_id; | ||||
| if (XIGetClientPointer(m_display, None, &device_id) != False) { | if (XIGetClientPointer(m_display, None, &device_id) != False) { | ||||
| XIWarpPointer(m_display, device_id, None, None, 0, 0, 0, 0, 0, 0); | XIWarpPointer(m_display, device_id, None, None, 0, 0, 0, 0, 0, 0); | ||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| { | { | ||||
| XWarpPointer(m_display, None, None, 0, 0, 0, 0, 0, 0); | XWarpPointer(m_display, None, None, 0, 0, 0, 0, 0, 0); | ||||
| } | } | ||||
| } | } | ||||
| /* Perform this last so to workaround XWayland bug, see: T53004. */ | |||||
| if (m_cursorGrab == GHOST_kGrabHide) { | |||||
| setWindowCursorVisibility(true); | |||||
| } | |||||
| /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */ | /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */ | ||||
| setCursorGrabAccum(0, 0); | setCursorGrabAccum(0, 0); | ||||
| m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */ | m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */ | ||||
| #ifdef GHOST_X11_GRAB | #ifdef GHOST_X11_GRAB | ||||
| XUngrabPointer(m_display, CurrentTime); | XUngrabPointer(m_display, CurrentTime); | ||||
| #endif | #endif | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines | |||||