Bugfix: correctly recognize assigned windows as urgent (Thanks jookia)
fixes #1086
This commit is contained in:
@ -883,24 +883,13 @@ static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_
|
||||
return false;
|
||||
}
|
||||
|
||||
xcb_icccm_wm_hints_t hints;
|
||||
|
||||
bool urgency_hint;
|
||||
if (reply == NULL)
|
||||
if (!(reply = xcb_get_property_reply(conn, xcb_icccm_get_wm_hints(conn, window), NULL)))
|
||||
return false;
|
||||
|
||||
if (!xcb_icccm_get_wm_hints_from_reply(&hints, reply))
|
||||
return false;
|
||||
|
||||
/* Update the flag on the client directly */
|
||||
bool hint_urgent = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
|
||||
con_set_urgency(con, hint_urgent);
|
||||
|
||||
reply = xcb_get_property_reply(conn, xcb_icccm_get_wm_hints(conn, window), NULL);
|
||||
window_update_hints(con->window, reply, &urgency_hint);
|
||||
con_set_urgency(con, urgency_hint);
|
||||
tree_render();
|
||||
|
||||
if (con->window)
|
||||
window_update_hints(con->window, reply);
|
||||
else free(reply);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||
window_update_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL));
|
||||
window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL));
|
||||
window_update_role(cwindow, xcb_get_property_reply(conn, role_cookie, NULL), true);
|
||||
window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL));
|
||||
bool urgency_hint;
|
||||
window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint);
|
||||
|
||||
xcb_get_property_reply_t *startup_id_reply;
|
||||
startup_id_reply = xcb_get_property_reply(conn, startup_id_cookie, NULL);
|
||||
@ -469,6 +470,12 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||
/* Send an event about window creation */
|
||||
ipc_send_window_new_event(nc);
|
||||
|
||||
/* Windows might get managed with the urgency hint already set (Pidgin is
|
||||
* known to do that), so check for that and handle the hint accordingly.
|
||||
* This code needs to be in this part of manage_window() because the window
|
||||
* needs to be on the final workspace first. */
|
||||
con_set_urgency(nc, urgency_hint);
|
||||
|
||||
geom_out:
|
||||
free(geom);
|
||||
out:
|
||||
|
@ -228,7 +228,10 @@ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool befo
|
||||
* Updates the WM_HINTS (we only care about the input focus handling part).
|
||||
*
|
||||
*/
|
||||
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop) {
|
||||
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint) {
|
||||
if (urgency_hint != NULL)
|
||||
*urgency_hint = false;
|
||||
|
||||
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
|
||||
DLOG("WM_HINTS not set.\n");
|
||||
FREE(prop);
|
||||
@ -246,5 +249,8 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop) {
|
||||
win->doesnt_accept_focus = !hints.input;
|
||||
LOG("WM_HINTS.input changed to \"%d\"\n", hints.input);
|
||||
|
||||
if (urgency_hint != NULL)
|
||||
*urgency_hint = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
|
||||
|
||||
free(prop);
|
||||
}
|
||||
|
Reference in New Issue
Block a user