From 17beb4028318dd009e36ae8ce8c5f7a1f23cbe44 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sun, 18 Dec 2016 11:34:22 +0100 Subject: [PATCH] Handle primary_monitor_first correctly at startup (issue #613) --- src/server.c | 5 +++++ src/server.h | 1 + src/tint.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/server.c b/src/server.c index d95a444..f71502d 100644 --- a/src/server.c +++ b/src/server.c @@ -302,6 +302,11 @@ int monitor_includes_monitor(const void *monitor1, const void *monitor2) } } +void sort_monitors() +{ + qsort(server.monitors, server.num_monitors, sizeof(Monitor), compare_monitor_pos); +} + void get_monitors() { if (XineramaIsActive(server.display)) { diff --git a/src/server.h b/src/server.h index 22c0095..3ee9f0f 100644 --- a/src/server.h +++ b/src/server.h @@ -159,6 +159,7 @@ void get_root_pixmap(); // detect monitors and desktops void get_monitors(); +void sort_monitors(); void print_monitors(); void get_desktops(); void server_get_number_of_desktops(); diff --git a/src/tint.c b/src/tint.c index 2adc305..ee32635 100644 --- a/src/tint.c +++ b/src/tint.c @@ -547,6 +547,9 @@ void init_X11_pre_config() void init_X11_post_config() { + if (primary_monitor_first) + sort_monitors(); + server_init_visual(); gboolean need_sigchld = FALSE;