summaryrefslogtreecommitdiff
path: root/openbox/openbox-multihead.patch
blob: e7a1a5dde694fb52e3714e0bd3241d7097885db2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
diff -ura openbox-3.6.1/openbox/client.c openbox-3.6.1-multihead/openbox/client.c
--- openbox-3.6.1/openbox/client.c	2018-11-15 12:11:21.211662798 +0300
+++ openbox-3.6.1-multihead/openbox/client.c	2018-11-15 12:11:34.088329218 +0300
@@ -324,8 +324,8 @@
         (user_time != 0) &&
         /* this checks for focus=false for the window */
         settings->focus != 0 &&
-        focus_valid_target(self, self->desktop,
-                           FALSE, FALSE, TRUE, TRUE, FALSE, FALSE,
+        focus_valid_target(self, self->desktop, 0,
+                           FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE,
                            settings->focus == 1))
     {
         try_activate = TRUE;
diff -ura openbox-3.6.1/openbox/client_list_combined_menu.c openbox-3.6.1-multihead/openbox/client_list_combined_menu.c
--- openbox-3.6.1/openbox/client_list_combined_menu.c	2014-11-05 18:19:42.000000000 +0300
+++ openbox-3.6.1-multihead/openbox/client_list_combined_menu.c	2018-11-15 12:11:34.088329218 +0300
@@ -58,9 +58,9 @@
         menu_add_separator(menu, SEPARATOR, screen_desktop_names[desktop]);
         for (it = focus_order; it; it = g_list_next(it)) {
             ObClient *c = it->data;
-            if (focus_valid_target(c, desktop,
+            if (focus_valid_target(c, desktop, 0,
                                    TRUE, TRUE,
-                                   FALSE, TRUE, FALSE, FALSE, FALSE))
+                                   FALSE, TRUE, FALSE, TRUE, FALSE, FALSE))
             {
                 empty = FALSE;
 
diff -ura openbox-3.6.1/openbox/client_list_menu.c openbox-3.6.1-multihead/openbox/client_list_menu.c
--- openbox-3.6.1/openbox/client_list_menu.c	2014-11-05 18:19:42.000000000 +0300
+++ openbox-3.6.1-multihead/openbox/client_list_menu.c	2018-11-15 12:11:34.088329218 +0300
@@ -54,8 +54,8 @@
 
     for (it = focus_order; it; it = g_list_next(it)) {
         ObClient *c = it->data;
-        if (focus_valid_target(c, d->desktop,
-                               TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE)) {
+        if (focus_valid_target(c, d->desktop, 0,
+                               TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE)) {
             ObMenuEntry *e;
 
             empty = FALSE;
diff -ura openbox-3.6.1/openbox/focus.c openbox-3.6.1-multihead/openbox/focus.c
--- openbox-3.6.1/openbox/focus.c	2014-11-05 18:19:42.000000000 +0300
+++ openbox-3.6.1-multihead/openbox/focus.c	2018-11-15 12:12:11.218328511 +0300
@@ -136,8 +136,8 @@
            3. it is not shaded
         */
         if ((allow_omnipresent || c->desktop == screen_desktop) &&
-            focus_valid_target(c, screen_desktop,
-                               TRUE, FALSE, FALSE, TRUE, FALSE, FALSE,
+            focus_valid_target(c, screen_desktop, 0,
+                               TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE,
                                FALSE) &&
             !c->shaded &&
             (allow_refocus || client_focus_target(c) != old) &&
@@ -158,8 +158,8 @@
            a splashscreen or a desktop window (save the desktop as a
            backup fallback though)
         */
-        if (focus_valid_target(c, screen_desktop,
-                               TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE) &&
+        if (focus_valid_target(c, screen_desktop, 0,
+                               TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE) &&
             (allow_refocus || client_focus_target(c) != old) &&
             client_focus(c))
         {
@@ -291,8 +291,8 @@
         ObClient *c = it->data;
         /* check that it's not a helper window to avoid infinite recursion */
         if (c != ft && c->type == OB_CLIENT_TYPE_NORMAL &&
-            focus_valid_target(c, screen_desktop,
-                               TRUE, iconic_windows, all_desktops,
+            focus_valid_target(c, screen_desktop, 0,
+                               TRUE, iconic_windows, all_desktops, TRUE,
                                TRUE, FALSE, FALSE, FALSE))
         {
             return TRUE;
@@ -303,9 +303,11 @@
 
 gboolean focus_valid_target(ObClient *ft,
                             guint    desktop,
+                            guint    monitor,
                             gboolean helper_windows,
                             gboolean iconic_windows,
                             gboolean all_desktops,
+                            gboolean all_monitors,
                             gboolean nonhilite_windows,
                             gboolean dock_windows,
                             gboolean desktop_windows,
@@ -327,6 +329,8 @@
     ok = (all_desktops || ft->desktop == desktop ||
           ft->desktop == DESKTOP_ALL);
 
+    ok = ok && (all_monitors || client_monitor(ft) == monitor);
+
     /* if we only include hilited windows, check if the window is */
     ok = ok && (nonhilite_windows || ft->demands_attention);
 
@@ -376,9 +380,11 @@
         ObClient *cft = client_focus_target(ft);
         ok = ok && (ft == cft || !focus_valid_target(cft,
                                                      screen_desktop,
+                                                     monitor,
                                                      TRUE,
                                                      iconic_windows,
                                                      all_desktops,
+                                                     all_monitors,
                                                      nonhilite_windows,
                                                      dock_windows,
                                                      desktop_windows,
diff -ura openbox-3.6.1/openbox/focus_cycle.c openbox-3.6.1-multihead/openbox/focus_cycle.c
--- openbox-3.6.1/openbox/focus_cycle.c	2014-11-05 18:19:42.000000000 +0300
+++ openbox-3.6.1-multihead/openbox/focus_cycle.c	2018-11-15 12:12:48.988327773 +0300
@@ -40,9 +40,11 @@
 static gboolean focus_cycle_linear;
 static gboolean focus_cycle_iconic_windows;
 static gboolean focus_cycle_all_desktops;
+static gboolean focus_cycle_all_monitors;
 static gboolean focus_cycle_nonhilite_windows;
 static gboolean focus_cycle_dock_windows;
 static gboolean focus_cycle_desktop_windows;
+static guint focus_cycle_monitor;
 
 static ObClient *focus_find_directional(ObClient *c,
                                         ObDirection dir,
@@ -109,6 +111,7 @@
     GList *it, *start, *list;
     ObClient *ft = NULL;
     ObClient *ret = NULL;
+    guint monitor = 0;
 
     if (cancel) {
         focus_cycle_target = NULL;
@@ -137,6 +140,9 @@
         start = it = forward ? g_list_last(list) : g_list_first(list);
     if (!start) goto done_cycle;
 
+    focus_cycle_monitor = client_monitor(it->data);
+    focus_cycle_all_monitors = FALSE;
+
     do {
         if (forward) {
             it = it->next;
@@ -163,6 +169,7 @@
 
     focus_cycle_target = NULL;
     focus_cycle_type = OB_CYCLE_NONE;
+    focus_cycle_all_monitors = TRUE;
     g_list_free(order);
     order = NULL;
 
@@ -339,9 +346,10 @@
 
 gboolean focus_cycle_valid(struct _ObClient *client)
 {
-    return focus_valid_target(client, screen_desktop, TRUE,
+    return focus_valid_target(client, screen_desktop, focus_cycle_monitor, TRUE,
                               focus_cycle_iconic_windows,
                               focus_cycle_all_desktops,
+                              focus_cycle_all_monitors,
                               focus_cycle_nonhilite_windows,
                               focus_cycle_dock_windows,
                               focus_cycle_desktop_windows,
diff -ura openbox-3.6.1/openbox/focus.h openbox-3.6.1-multihead/openbox/focus.h
--- openbox-3.6.1/openbox/focus.h	2014-11-05 18:19:42.000000000 +0300
+++ openbox-3.6.1-multihead/openbox/focus.h	2018-11-15 12:11:34.088329218 +0300
@@ -70,9 +70,11 @@
 
 gboolean focus_valid_target(struct _ObClient *ft,
                             guint    desktop,
+                            guint    monitor,
                             gboolean helper_windows,
                             gboolean iconic_windows,
                             gboolean all_desktops,
+                            gboolean all_monitors,
                             gboolean nonhilite_windows,
                             gboolean dock_windows,
                             gboolean desktop_windows,