Woraround possible broken cursor when creating mouse interception window
The xcb_cursor_t returned by xcb-cursor library might be broken. If we set such a broken cursor directly in the create window call it will fail with a BadCursor value causing effects to break. This change works around this problem by creating just the window and moving the possible breaking call into a change window call. That will still fail, but the window is working. In addition it performs a safety check by only installing the cursor if it's not XCB_CURSOR_NONE. BUG: 344006 REVIEW: 123025
This commit is contained in:
parent
3aa4c8d635
commit
e2c422dcb5
1 changed files with 7 additions and 4 deletions
11
effects.cpp
11
effects.cpp
|
@ -684,13 +684,13 @@ void EffectsHandlerImpl::startMouseInterception(Effect *effect, Qt::CursorShape
|
|||
if (!m_mouseInterceptionWindow.isValid()) {
|
||||
const QSize &s = screens()->size();
|
||||
const QRect geo(0, 0, s.width(), s.height());
|
||||
const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_CURSOR;
|
||||
const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
|
||||
const uint32_t values[] = {
|
||||
true,
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION,
|
||||
Cursor::x11Cursor(shape)
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION
|
||||
};
|
||||
m_mouseInterceptionWindow.reset(Xcb::createInputWindow(geo, mask, values));
|
||||
defineCursor(shape);
|
||||
} else {
|
||||
defineCursor(shape);
|
||||
}
|
||||
|
@ -1177,7 +1177,10 @@ void EffectsHandlerImpl::defineCursor(Qt::CursorShape shape)
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
m_mouseInterceptionWindow.defineCursor(Cursor::x11Cursor(shape));
|
||||
const xcb_cursor_t c = Cursor::x11Cursor(shape);
|
||||
if (c != XCB_CURSOR_NONE) {
|
||||
m_mouseInterceptionWindow.defineCursor(c);
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectsHandlerImpl::checkInputWindowEvent(xcb_button_press_event_t *e)
|
||||
|
|
Loading…
Reference in a new issue