summaryrefslogtreecommitdiff
path: root/i3lock.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2010-07-20 20:30:44 +0200
committerMichael Stapelberg <michael@stapelberg.de>2010-07-20 20:30:44 +0200
commit4e5c203cd937348f45dffe901deb11bb939a794b (patch)
tree473498a5005fdbdf245444fde637f6dae5945d88 /i3lock.c
parent9d19a8bb53d7285ba352004e47e76474f20ab7c2 (diff)
Raise the i3lock window upon visibility notifies
Diffstat (limited to 'i3lock.c')
-rw-r--r--i3lock.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/i3lock.c b/i3lock.c
index cb671d5..6e45c59 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -164,6 +164,25 @@ static void handle_key_press(xcb_key_press_event_t *event) {
}
/*
+ * 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.
*
*/
@@ -351,6 +370,11 @@ int main(int argc, char *argv[]) {
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);
}