mirror of
https://github.com/Raymo111/i3lock-color.git
synced 2025-02-24 16:06:26 -05:00
Raise the i3lock window upon visibility notifies
This commit is contained in:
parent
9d19a8bb53
commit
4e5c203cd9
2 changed files with 28 additions and 1 deletions
24
i3lock.c
24
i3lock.c
|
@ -163,6 +163,25 @@ static void handle_key_press(xcb_key_press_event_t *event) {
|
||||||
printf("current password = %s\n", password);
|
printf("current password = %s\n", password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A visibility notify event will be received when the visibility (= can the
|
||||||
|
* user view the complete window) changes, so for example when a popup overlays
|
||||||
|
* some area of the i3lock window.
|
||||||
|
*
|
||||||
|
* In this case, we raise our window on top so that the popup (or whatever is
|
||||||
|
* hiding us) gets hidden.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
|
||||||
|
printf("visibility notify (window 0x%08x, state %d)\n", event->window, event->state);
|
||||||
|
if (event->state != XCB_VISIBILITY_UNOBSCURED) {
|
||||||
|
printf("window is obscured (not fully visible), raising\n");
|
||||||
|
uint32_t values[] = { XCB_STACK_MODE_ABOVE };
|
||||||
|
xcb_configure_window(conn, event->window, XCB_CONFIG_WINDOW_STACK_MODE, values);
|
||||||
|
xcb_flush(conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback function for PAM. We only react on password request callbacks.
|
* Callback function for PAM. We only react on password request callbacks.
|
||||||
*
|
*
|
||||||
|
@ -351,6 +370,11 @@ int main(int argc, char *argv[]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == XCB_VISIBILITY_NOTIFY) {
|
||||||
|
handle_visibility_notify((xcb_visibility_notify_event_t*)event);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
printf("WARNING: unhandled event of type %d\n", type);
|
printf("WARNING: unhandled event of type %d\n", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
xcb.c
5
xcb.c
|
@ -62,7 +62,10 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
|
||||||
values[1] = 1;
|
values[1] = 1;
|
||||||
|
|
||||||
mask |= XCB_CW_EVENT_MASK;
|
mask |= XCB_CW_EVENT_MASK;
|
||||||
values[2] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE;
|
values[2] = XCB_EVENT_MASK_EXPOSURE |
|
||||||
|
XCB_EVENT_MASK_KEY_PRESS |
|
||||||
|
XCB_EVENT_MASK_KEY_RELEASE |
|
||||||
|
XCB_EVENT_MASK_VISIBILITY_CHANGE;
|
||||||
|
|
||||||
xcb_create_window(conn,
|
xcb_create_window(conn,
|
||||||
24,
|
24,
|
||||||
|
|
Loading…
Add table
Reference in a new issue