Skip to content

Commit

Permalink
Bugfix: Correctly center unlock indicator after reconfiguring screens…
Browse files Browse the repository at this point in the history
… (Thanks xn)

Fixes: #712
  • Loading branch information
stapelberg committed May 19, 2012
1 parent f9416f6 commit 9b29ae7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions i3lock.c
Expand Up @@ -431,6 +431,9 @@ void handle_screen_resize(void) {
uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
xcb_configure_window(conn, win, mask, last_resolution);
xcb_flush(conn);

xinerama_query_screens();
redraw_screen();
}

/*
Expand Down Expand Up @@ -683,6 +686,8 @@ int main(int argc, char *argv[]) {
last_resolution[0] = screen->width_in_pixels;
last_resolution[1] = screen->height_in_pixels;

xcb_change_window_attributes(conn, screen->root, XCB_CW_EVENT_MASK,
(uint32_t[]){ XCB_EVENT_MASK_STRUCTURE_NOTIFY });

#ifndef NOLIBCAIRO
if (image_path) {
Expand Down
2 changes: 1 addition & 1 deletion unlock_indicator.c
Expand Up @@ -277,7 +277,7 @@ void redraw_screen(void) {
xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[1]){ bg_pixmap });
/* XXX: Possible optimization: Only update the area in the middle of the
* screen instead of the whole screen. */
xcb_clear_area(conn, 0, win, 0, 0, screen->width_in_pixels, screen->height_in_pixels);
xcb_clear_area(conn, 0, win, 0, 0, last_resolution[0], last_resolution[1]);
xcb_free_pixmap(conn, bg_pixmap);
xcb_flush(conn);
}
Expand Down

0 comments on commit 9b29ae7

Please sign in to comment.