| 1014 | } |
| 1015 | |
| 1016 | U32 XServer::grabPointer(const DisplayDataPtr& display, const XWindowPtr& grabbed, XWindowPtr confined, U32 mask, U32 time) { |
| 1017 | if (!time) { |
| 1018 | time = KSystem::getMilliesSinceStart(); |
| 1019 | } |
| 1020 | bool updateCursor = false; |
| 1021 | { |
| 1022 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(grabbedMutex); |
| 1023 | |
| 1024 | this->grabbedId = grabbed->id; |
| 1025 | if (confined) { |
| 1026 | this->grabbedConfinedId = confined->id; |
| 1027 | } |
| 1028 | this->grabbedMask = mask; |
| 1029 | this->grabbedTime = time; |
| 1030 | this->grabbedDisplayId = display->displayId; |
| 1031 | this->isGrabbed = true; |
| 1032 | |
| 1033 | if (pointerWindow->id != grabbed->id) { |
| 1034 | S32 x = 0; |
| 1035 | S32 y = 0; |
| 1036 | KNativeSystem::getCurrentInput()->getMousePos(&x, &y); |
| 1037 | pointerMoved(pointerWindow, grabbed, x, y, NotifyGrab); |
| 1038 | pointerWindow = grabbed; |
| 1039 | updateCursor = true; |
| 1040 | } |
| 1041 | } |
| 1042 | if (updateCursor) { |
| 1043 | // don't call this with grabbedMutex locked |
| 1044 | KNativeSystem::getScreen()->setCursor(pointerWindow->getCursor()); |
| 1045 | } |
| 1046 | return GrabSuccess; |
| 1047 | } |
| 1048 | |
| 1049 | // https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#requests:UngrabPointer |
| 1050 | U32 XServer::ungrabPointer(U32 time) { |
no test coverage detected