summaryrefslogtreecommitdiff
path: root/openbox/screen.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2009-12-09 16:41:52 -0500
committerDana Jansens <danakj@orodu.net>2009-12-09 16:41:52 -0500
commitaa329719b99792a624449b2448abee9e2c67ce94 (patch)
tree630e343b5b475940d13952e6cfbec5c16ab62ec0 /openbox/screen.c
parent10d99cc5e9efe40527c6ace3740b67890ea37729 (diff)
Add a primaryMonitor config option, where the focus-cycle and keychain popups will appear
Diffstat (limited to 'openbox/screen.c')
-rw-r--r--openbox/screen.c51
1 files changed, 38 insertions, 13 deletions
diff --git a/openbox/screen.c b/openbox/screen.c
index 899b4bc3..bc8c72d8 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -1723,24 +1723,38 @@ gboolean screen_physical_area_monitor_contains(guint head, Rect *search)
return RECT_INTERSECTS_RECT(monitor_area[head], *search);
}
-Rect* screen_physical_area_active(void)
+guint screen_monitor_active(void)
{
- Rect *a;
- gint x, y;
-
if (moveresize_client)
- a = screen_physical_area_monitor(client_monitor(moveresize_client));
+ return client_monitor(moveresize_client);
else if (focus_client)
- a = screen_physical_area_monitor(client_monitor(focus_client));
- else {
- Rect mon;
- if (screen_pointer_pos(&x, &y))
- RECT_SET(mon, x, y, 1, 1);
+ return client_monitor(focus_client);
+ else
+ return screen_monitor_pointer();
+}
+
+Rect* screen_physical_area_active(void)
+{
+ return screen_physical_area_monitor(screen_monitor_active());
+}
+
+guint screen_monitor_primary(void)
+{
+ if (config_primary_monitor_index > 0) {
+ if (config_primary_monitor_index-1 < screen_num_monitors)
+ return config_primary_monitor_index - 1;
else
- RECT_SET(mon, 0, 0, 1, 1);
- a = screen_physical_area_monitor(screen_find_monitor(&mon));
+ return 0;
}
- return a;
+ else if (config_primary_monitor == OB_PLACE_MONITOR_ACTIVE)
+ return screen_monitor_active();
+ else /* config_primary_monitor == OB_PLACE_MONITOR_MOUSE */
+ return screen_monitor_pointer();
+}
+
+Rect *screen_physical_area_primary(void)
+{
+ return screen_physical_area_monitor(screen_monitor_primary());
}
void screen_set_root_cursor(void)
@@ -1753,6 +1767,17 @@ void screen_set_root_cursor(void)
ob_cursor(OB_CURSOR_POINTER));
}
+guint screen_monitor_pointer()
+{
+ Rect mon;
+ gint x, y;
+ if (screen_pointer_pos(&x, &y))
+ RECT_SET(mon, x, y, 1, 1);
+ else
+ RECT_SET(mon, 0, 0, 1, 1);
+ return screen_find_monitor(&mon);
+}
+
gboolean screen_pointer_pos(gint *x, gint *y)
{
Window w;