With UnderMouse-placement active, new windows created will appear on the primary display instead of the current, ONLY if the current is left of the primary display. Screens right of the primary display receive correct window placement.
Example:
A | B | C
B is the primary display, A left-of, C right-of.
Hovering on C and creating a window will make that window appear on C,
hovering on A will create it on B at the leftmost edge, hoever.
This behaviour was introduced with commit a9f2b2c681cd7028398ef62513dec003376bda6b in version 3.4.3.
This patch fixes it for normal windows, diffed against master HEAD for 3.4.5.
The behaviour is toolkit-independent.
diff --git a/openbox/client.c b/openbox/client.c
index d0fed54..80e7f05 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -1012,15 +1012,10 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
for (i = 0; i < screen_num_monitors; ++i) {
Rect *a;
- if (!screen_physical_area_monitor_contains(i, &desired)) {
- if (i < screen_num_monitors - 1)
+ if (!screen_physical_area_monitor_contains(i, &desired))
continue;
- /* the window is not inside any monitor! so just use the first
- one */
- a = screen_area(self->desktop, 0, NULL);
- } else
- a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired);
+ a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired);
/* This makes sure windows aren't entirely outside of the screen so you
can't see them at all.
i'm trying, but i can't reproduce this with our xinerama test-code (i.e. pretend the x server reported two monitors, and split the single one into two parts)
with a window focused on either monitor, new windows appear under my mouse cursor. how are you launching them? i have tried with a keybinding, and with an openbox menu
ok, i have tracked it down, you can disregard previous questions i think. and if you'd like to try it out and let me know, that'd be appreciated. here is the diff (commit 6a3ac55):
diff --git a/openbox/client.c b/openbox/client.c
index 8169048..a0ba343 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -993,6 +993,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
gint fw, fh;
Rect desired;
guint i;
+ gboolean found_mon;
RECT_SET(desired, *x, *y, w, h);
frame_rect_to_frame(self->frame, &desired);
@@ -1042,18 +1043,26 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
rudeb = TRUE;
}
+ /* we iterate through every monitor that the window is at least partially
+ on, to make sure it is obeying the rules on them all
+
+ if the window does not appear on any monitors, then use the first one
+ */
+ found_mon = FALSE;
for (i = 0; i < screen_num_monitors; ++i) {
Rect *a;
if (!screen_physical_area_monitor_contains(i, &desired)) {
- if (i < screen_num_monitors - 1)
+ if (i < screen_num_monitors - 1 || found_mon)
continue;
/* the window is not inside any monitor! so just use the first
one */
a = screen_area(self->desktop, 0, NULL);
- } else
+ } else {
+ found_mon = TRUE;
a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired);
+ }
/* This makes sure windows aren't entirely outside of the screen so you
can't see them at all.
With UnderMouse-placement active, new windows created will appear on the primary display instead of the current, ONLY if the current is left of the primary display. Screens right of the primary display receive correct window placement. Example: A | B | C B is the primary display, A left-of, C right-of. Hovering on C and creating a window will make that window appear on C, hovering on A will create it on B at the leftmost edge, hoever. This behaviour was introduced with commit a9f2b2c681cd7028398ef62513dec003376bda6b in version 3.4.3. This patch fixes it for normal windows, diffed against master HEAD for 3.4.5. The behaviour is toolkit-independent. diff --git a/openbox/client.c b/openbox/client.c index d0fed54..80e7f05 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1012,15 +1012,10 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, for (i = 0; i < screen_num_monitors; ++i) { Rect *a; - if (!screen_physical_area_monitor_contains(i, &desired)) { - if (i < screen_num_monitors - 1) + if (!screen_physical_area_monitor_contains(i, &desired)) continue; - /* the window is not inside any monitor! so just use the first - one */ - a = screen_area(self->desktop, 0, NULL); - } else - a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired); + a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired); /* This makes sure windows aren't entirely outside of the screen so you can't see them at all.ok, i have tracked it down, you can disregard previous questions i think. and if you'd like to try it out and let me know, that'd be appreciated. here is the diff (commit 6a3ac55): diff --git a/openbox/client.c b/openbox/client.c index 8169048..a0ba343 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -993,6 +993,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, gint fw, fh; Rect desired; guint i; + gboolean found_mon; RECT_SET(desired, *x, *y, w, h); frame_rect_to_frame(self->frame, &desired); @@ -1042,18 +1043,26 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, rudeb = TRUE; } + /* we iterate through every monitor that the window is at least partially + on, to make sure it is obeying the rules on them all + + if the window does not appear on any monitors, then use the first one + */ + found_mon = FALSE; for (i = 0; i < screen_num_monitors; ++i) { Rect *a; if (!screen_physical_area_monitor_contains(i, &desired)) { - if (i < screen_num_monitors - 1) + if (i < screen_num_monitors - 1 || found_mon) continue; /* the window is not inside any monitor! so just use the first one */ a = screen_area(self->desktop, 0, NULL); - } else + } else { + found_mon = TRUE; a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &desired); + } /* This makes sure windows aren't entirely outside of the screen so you can't see them at all.