Skip to content

Commit

Permalink
fix: DApplication初始化过程中会覆盖原有事件掩码,导致丢失事件
Browse files Browse the repository at this point in the history
Log: DApplication应用初始化时通过设置xcb窗口属性,设置了XCB_EVENT_MASK_PROPERTY_CHANGE事件掩码,此时Xorg会对发送给客户端的事件根据事件掩码来过滤,例如关闭文件选择对话框时发送的类型为focusIn的clientMessageEvent就不会发送给客户端。修改为先判断当前事件掩码是否含有XCB_EVENT_MASK_PROPERTY_CHANGE掩码,有的话不进行处理,没有的话在原有掩码上追加该掩码

Bug: https://pms.uniontech.com/bug-view-220369.html
  • Loading branch information
LiHua000 committed Nov 9, 2023
1 parent 371cc12 commit acb2c00
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,22 @@ StartupNotificationMonitor::StartupNotificationMonitor() :
return;

int screen = 0;

xcb_screen_t *s = xcb_aux_get_screen (QX11Info::connection(), screen);
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
xcb_change_window_attributes (QX11Info::connection(), s->root, XCB_CW_EVENT_MASK,
select_input_val);
xcb_get_window_attributes_cookie_t attr_cookie = xcb_get_window_attributes (QX11Info::connection(), s->root);
xcb_get_window_attributes_reply_t *attr_reply = xcb_get_window_attributes_reply (QX11Info::connection(), attr_cookie, NULL);

if (attr_reply) {
uint32_t old_event_mask = attr_reply->your_event_mask;
if (!(old_event_mask & XCB_EVENT_MASK_PROPERTY_CHANGE)) {
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE | old_event_mask };

xcb_change_window_attributes (QX11Info::connection(), s->root, XCB_CW_EVENT_MASK,
select_input_val);
}
free(attr_reply);
} else {
qWarning() << "can not get xcb window attributes reply";
}

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

Expand Down

0 comments on commit acb2c00

Please sign in to comment.