Skip to content

Commit 2e256bf

Browse files
deepin-ci-robotmhduiy
authored andcommitted
sync: from linuxdeepin/dtkwidget
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#704
1 parent 1e0270e commit 2e256bf

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/widgets/private/startupnotifications/startupnotificationmonitor.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,22 @@ StartupNotificationMonitor::StartupNotificationMonitor() :
7777
return;
7878

7979
int screen = 0;
80-
8180
xcb_screen_t *s = xcb_aux_get_screen (QX11Info::connection(), screen);
82-
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
83-
xcb_change_window_attributes (QX11Info::connection(), s->root, XCB_CW_EVENT_MASK,
84-
select_input_val);
81+
xcb_get_window_attributes_cookie_t attr_cookie = xcb_get_window_attributes (QX11Info::connection(), s->root);
82+
xcb_get_window_attributes_reply_t *attr_reply = xcb_get_window_attributes_reply (QX11Info::connection(), attr_cookie, NULL);
83+
84+
if (attr_reply) {
85+
uint32_t old_event_mask = attr_reply->your_event_mask;
86+
if (!(old_event_mask & XCB_EVENT_MASK_PROPERTY_CHANGE)) {
87+
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE | old_event_mask };
88+
89+
xcb_change_window_attributes (QX11Info::connection(), s->root, XCB_CW_EVENT_MASK,
90+
select_input_val);
91+
}
92+
free(attr_reply);
93+
} else {
94+
qWarning() << "can not get xcb window attributes reply";
95+
}
8596

8697
display = sn_xcb_display_new (QX11Info::connection(), NULL, NULL);
8798

0 commit comments

Comments
 (0)