| 921 | } |
| 922 | |
| 923 | void XServer::mouseMove(S32 x, S32 y, bool relative) { |
| 924 | if (isGrabbed) { |
| 925 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(grabbedMutex); |
| 926 | XWindowPtr grabbed = getWindow(grabbedId); |
| 927 | DisplayDataPtr grabbedDisplay = getDisplayDataById(grabbedDisplayId); |
| 928 | |
| 929 | if (grabbed && grabbedDisplay) { |
| 930 | if ((grabbedDisplay->getInput2Mask(root->id) & XI_RawMotionMask) && KSystem::forceRelativeMouse) { |
| 931 | KNativeInputPtr input = KNativeSystem::getCurrentInput(); |
| 932 | S32 midX = input->screenWidth() / 2; |
| 933 | S32 midY = input->screenHeight() / 2; |
| 934 | x = x - midX; |
| 935 | y = y - midY; |
| 936 | KNativeSystem::warpMouse(midX, midY); |
| 937 | // :TODO: I'm not really sure how realitive mouse is supposed to work, it was just trial and error with vkQuake |
| 938 | grabbed->input2Notify(grabbedDisplay, x, y, XI_RawMotion); |
| 939 | return; |
| 940 | } |
| 941 | if (!(grabbedMask & PointerMotionMask)) { |
| 942 | return; |
| 943 | } |
| 944 | if (fakeFullScreenWnd) { |
| 945 | fakeFullScreenWnd->windowToScreen(x, y); |
| 946 | } |
| 947 | grabbed->motionNotify(grabbedDisplay, x, y); |
| 948 | return; |
| 949 | } else { |
| 950 | ungrabPointer(0); |
| 951 | } |
| 952 | } |
| 953 | if (root) { // might not be set at the very start |
| 954 | XWindowPtr wnd = root->getWindowFromPoint(x, y); |
| 955 | if (wnd) { |
| 956 | if (fakeFullScreenWnd) { |
| 957 | fakeFullScreenWnd->windowToScreen(x, y); |
| 958 | } |
| 959 | if (wnd != pointerWindow) { |
| 960 | pointerMoved(pointerWindow, wnd, x, y, NotifyNormal); |
| 961 | pointerWindow = wnd; |
| 962 | KNativeSystem::getScreen()->setCursor(wnd->getCursor()); |
| 963 | } |
| 964 | while (wnd && !wnd->mouseMoveScreenCoords(x, y)) { |
| 965 | wnd = wnd->parent; |
| 966 | } |
| 967 | } |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | void XServer::mouseButton(U32 button, S32 x, S32 y, bool pressed) { |
| 972 | if (fakeFullScreenWnd) { |
no test coverage detected