From 4a6a748561028ef637a5d899565d8b8c5123da27 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg
Date: Sun, 3 May 2009 22:59:50 +0200
Subject: [PATCH] Bugfix: Reconfigure bar window when changing resolutions
(Thanks Mirko)
---
src/xinerama.c | 17 +++++++++++++++++
website/downloads/index.html | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/src/xinerama.c b/src/xinerama.c
index 4926dfbd..3a1b19a7 100644
--- a/src/xinerama.c
+++ b/src/xinerama.c
@@ -163,6 +163,11 @@ static void query_screens(xcb_connection_t *conn, struct screens_head *screenlis
}
free(reply);
+
+ if (num_screens == 0) {
+ LOG("No screens found. This is weird.\n");
+ exit(1);
+ }
}
static void initialize_screen(xcb_connection_t *conn, i3Screen *screen, Workspace *workspace) {
@@ -232,6 +237,8 @@ void initialize_xinerama(xcb_connection_t *conn) {
*
*/
void xinerama_requery_screens(xcb_connection_t *conn) {
+ i3Font *font = load_font(conn, config.font);
+
/* POSSIBLE PROBLEM: Is the order of the Xinerama screens always constant? That is, can
it change when I move the --right-of video projector to --left-of? */
@@ -267,6 +274,16 @@ void xinerama_requery_screens(xcb_connection_t *conn) {
screen->bar = workspaces[c].screen->bar;
screen->bargc = workspaces[c].screen->bargc;
+ Rect bar_rect = {screen->rect.x,
+ screen->rect.height - (font->height + 6),
+ screen->rect.x + screen->rect.width,
+ font->height + 6};
+
+ xcb_configure_window(conn, screen->bar, XCB_CONFIG_WINDOW_X |
+ XCB_CONFIG_WINDOW_Y |
+ XCB_CONFIG_WINDOW_WIDTH |
+ XCB_CONFIG_WINDOW_HEIGHT, &(bar_rect.x));
+
/* Copy the list head for the dock clients */
screen->dock_clients = workspaces[c].screen->dock_clients;
diff --git a/website/downloads/index.html b/website/downloads/index.html
index 65c28727..b7b0dab3 100644
--- a/website/downloads/index.html
+++ b/website/downloads/index.html
@@ -88,6 +88,11 @@ li {