Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions systray.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ systray_init(void)
static void
systray_register(void)
{
xcb_client_message_event_t ev;
xcb_screen_t *xscreen = globalconf.screen;

if(globalconf.systray.registered)
Expand All @@ -85,15 +84,18 @@ systray_register(void)
globalconf.systray.registered = true;

/* Fill event */
p_clear(&ev, 1);
ev.response_type = XCB_CLIENT_MESSAGE;
ev.window = xscreen->root;
ev.format = 32;
ev.type = MANAGER;
ev.data.data32[0] = globalconf.timestamp;
ev.data.data32[1] = globalconf.systray.atom;
ev.data.data32[2] = globalconf.systray.window;
ev.data.data32[3] = ev.data.data32[4] = 0;
xcb_client_message_event_t ev = {
.response_type = XCB_CLIENT_MESSAGE,
.window = xscreen->root,
.format = 32,
.type = MANAGER,
.data = {
.data32 = {
globalconf.timestamp,
globalconf.systray.atom,
globalconf.systray.window,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a NULL, NULL here to be like the old code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, when using an initializer, fields that are not specified for initialization will be set to 0, which is NULL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Elv13 do you mean to explicitly populate every slot, since the field is defined as uint32_t data32[5] by xcb? I would second this, as a general good practice for code maintainability.

} }
};

xcb_set_selection_owner(globalconf.connection,
globalconf.systray.window,
Expand Down
Loading