+ DEBUG("current password = %s\n", password);
+
+ unlock_state = STATE_KEY_ACTIVE;
+ redraw_screen();
+ unlock_state = STATE_KEY_PRESSED;
+
+ struct ev_timer *timeout = calloc(sizeof(struct ev_timer), 1);
+ if (timeout) {
+ ev_timer_init(timeout, redraw_timeout, 0.25, 0.);
+ ev_timer_start(main_loop, timeout);
+ }
+
+ stop_clear_indicator_timeout();
+}
+
+/*
+ * 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.
+ *
+ */
+static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
+ if (event->state != XCB_VISIBILITY_UNOBSCURED) {
+ uint32_t values[] = { XCB_STACK_MODE_ABOVE };
+ xcb_configure_window(conn, event->window, XCB_CONFIG_WINDOW_STACK_MODE, values);
+ xcb_flush(conn);
+ }
+}
+
+/*
+ * Called when the keyboard mapping changes. We update our symbols.
+ *
+ */
+static void handle_mapping_notify(xcb_mapping_notify_event_t *event) {
+ xcb_refresh_keyboard_mapping(symbols, event);
+
+ numlockmask = get_mod_mask(conn, symbols, XK_Num_Lock);
+}
+
+/*
+ * Called when the properties on the root window change, e.g. when the screen
+ * resolution changes. If so we update the window to cover the whole screen
+ * and also redraw the image, if any.
+ *
+ */
+void handle_screen_resize() {
+ xcb_get_geometry_cookie_t geomc;
+ xcb_get_geometry_reply_t *geom;
+ geomc = xcb_get_geometry(conn, screen->root);
+ if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL)
+ return;
+
+ if (last_resolution[0] == geom->width &&
+ last_resolution[1] == geom->height) {
+ free(geom);
+ return;
+ }
+
+ last_resolution[0] = geom->width;
+ last_resolution[1] = geom->height;
+
+ free(geom);
+
+#ifndef NOLIBCAIRO
+ redraw_screen();
+#endif
+
+ uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ xcb_configure_window(conn, win, mask, last_resolution);
+ xcb_flush(conn);