Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/windowselector.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 88 | { | |||
---|---|---|---|---|---|
89 | xcb_cursor_t cursor = createCursor(cursorName); | 89 | xcb_cursor_t cursor = createCursor(cursorName); | ||
90 | 90 | | |||
91 | xcb_connection_t *c = connection(); | 91 | xcb_connection_t *c = connection(); | ||
92 | ScopedCPointer<xcb_grab_pointer_reply_t> grabPointer(xcb_grab_pointer_reply(c, xcb_grab_pointer_unchecked(c, false, rootWindow(), | 92 | ScopedCPointer<xcb_grab_pointer_reply_t> grabPointer(xcb_grab_pointer_reply(c, xcb_grab_pointer_unchecked(c, false, rootWindow(), | ||
93 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | | 93 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | | ||
94 | XCB_EVENT_MASK_POINTER_MOTION | | 94 | XCB_EVENT_MASK_POINTER_MOTION | | ||
95 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | 95 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | ||
96 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE, | 96 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE, | ||
97 | cursor, XCB_TIME_CURRENT_TIME), NULL)); | 97 | cursor, XCB_TIME_CURRENT_TIME), nullptr)); | ||
98 | if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) { | 98 | if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) { | ||
99 | return false; | 99 | return false; | ||
100 | } | 100 | } | ||
101 | const bool grabbed = grabXKeyboard(); | 101 | const bool grabbed = grabXKeyboard(); | ||
102 | if (grabbed) { | 102 | if (grabbed) { | ||
103 | grabXServer(); | 103 | grabXServer(); | ||
104 | } else { | 104 | } else { | ||
105 | xcb_ungrab_pointer(connection(), XCB_TIME_CURRENT_TIME); | 105 | xcb_ungrab_pointer(connection(), XCB_TIME_CURRENT_TIME); | ||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | |||||
236 | 236 | | |||
237 | void WindowSelector::selectWindowId(xcb_window_t window_to_select) | 237 | void WindowSelector::selectWindowId(xcb_window_t window_to_select) | ||
238 | { | 238 | { | ||
239 | if (window_to_select == XCB_WINDOW_NONE) { | 239 | if (window_to_select == XCB_WINDOW_NONE) { | ||
240 | m_callback(nullptr); | 240 | m_callback(nullptr); | ||
241 | return; | 241 | return; | ||
242 | } | 242 | } | ||
243 | xcb_window_t window = window_to_select; | 243 | xcb_window_t window = window_to_select; | ||
244 | Client* client = NULL; | 244 | Client* client = nullptr; | ||
245 | while (true) { | 245 | while (true) { | ||
246 | client = Workspace::self()->findClient(Predicate::FrameIdMatch, window); | 246 | client = Workspace::self()->findClient(Predicate::FrameIdMatch, window); | ||
247 | if (client) { | 247 | if (client) { | ||
248 | break; // Found the client | 248 | break; // Found the client | ||
249 | } | 249 | } | ||
250 | Xcb::Tree tree(window); | 250 | Xcb::Tree tree(window); | ||
251 | if (window == tree->root) { | 251 | if (window == tree->root) { | ||
252 | // We didn't find the client, probably an override-redirect window | 252 | // We didn't find the client, probably an override-redirect window | ||
Show All 21 Lines |