summaryrefslogtreecommitdiff
path: root/openbox/screen.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2009-07-05 22:27:25 +0200
committerMikael Magnusson <mikachu@gmail.com>2009-09-19 15:03:12 +0200
commit308478e4a5f4dc76d69395dda8a9bc42cb69eec4 (patch)
tree54ec31d91428b2a7d3e4c7bdf902fe182abfc25d /openbox/screen.c
parent3f72b9d67f21781e513a9c058e8624b8b86b92ea (diff)
parentba1ac214dfdbc0539c922e84c2318c1bf2566c0c (diff)
Merge branch 'backport' into work
Conflicts: openbox/actions/desktop.c openbox/client.c openbox/event.c openbox/extensions.c openbox/popup.c openbox/screen.c parser/parse.c
Diffstat (limited to 'openbox/screen.c')
-rw-r--r--openbox/screen.c135
1 files changed, 95 insertions, 40 deletions
diff --git a/openbox/screen.c b/openbox/screen.c
index 74d073c4..09d5003c 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -77,7 +77,7 @@ static GSList *struts_left = NULL;
static GSList *struts_right = NULL;
static GSList *struts_bottom = NULL;
-static ObPagerPopup *desktop_popup;
+static ObPagerPopup **desktop_popup;
/*! The number of microseconds that you need to be on a desktop before it will
replace the remembered "last desktop" */
@@ -344,15 +344,22 @@ void screen_startup(gboolean reconfig)
guint32 d;
gboolean namesexist = FALSE;
- desktop_popup = pager_popup_new();
- pager_popup_height(desktop_popup, POPUP_HEIGHT);
-
if (reconfig) {
- /* update the pager popup's width */
- pager_popup_text_width_to_strings(desktop_popup,
- screen_desktop_names,
- screen_num_desktops);
+ guint i;
+ desktop_popup = g_new(ObPagerPopup*, screen_num_monitors);
+ for (i = 0; i < screen_num_monitors; i++) {
+ desktop_popup[i] = pager_popup_new();
+ pager_popup_height(desktop_popup[i], POPUP_HEIGHT);
+
+ /* update the pager popup's width */
+ pager_popup_text_width_to_strings(desktop_popup[i],
+ screen_desktop_names,
+ screen_num_desktops);
+ }
+
return;
+ } else {
+ desktop_popup = NULL;
}
/* get the initial size */
@@ -441,7 +448,12 @@ void screen_startup(gboolean reconfig)
void screen_shutdown(gboolean reconfig)
{
- pager_popup_free(desktop_popup);
+ guint i;
+
+ for (i = 0; i < screen_num_monitors; i++) {
+ pager_popup_free(desktop_popup[i]);
+ }
+ g_free(desktop_popup);
if (reconfig)
return;
@@ -911,39 +923,52 @@ static guint translate_row_col(guint r, guint c)
static gboolean hide_desktop_popup_func(gpointer data)
{
- pager_popup_hide(desktop_popup);
+ guint i;
+
+ for (i = 0; i < screen_num_monitors; i++) {
+ pager_popup_hide(desktop_popup[i]);
+ }
return FALSE; /* don't repeat */
}
void screen_show_desktop_popup(guint d)
{
Rect *a;
+ guint i;
/* 0 means don't show the popup */
if (!config_desktop_popup_time) return;
- a = screen_physical_area_active();
- pager_popup_position(desktop_popup, CenterGravity,
- a->x + a->width / 2, a->y + a->height / 2);
- pager_popup_icon_size_multiplier(desktop_popup,
- (screen_desktop_layout.columns /
- screen_desktop_layout.rows) / 2,
- (screen_desktop_layout.rows/
- screen_desktop_layout.columns) / 2);
- pager_popup_max_width(desktop_popup,
- MAX(a->width/3, POPUP_WIDTH));
- pager_popup_show(desktop_popup, screen_desktop_names[d], d);
-
- obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func);
- obt_main_loop_timeout_add(ob_main_loop, config_desktop_popup_time * 1000,
- hide_desktop_popup_func, NULL, NULL, NULL);
- g_free(a);
+ for (i = 0; i < screen_num_monitors; i++) {
+ a = screen_physical_area_monitor(i);
+ pager_popup_position(desktop_popup[i], CenterGravity,
+ a->x + a->width / 2, a->y + a->height / 2);
+ pager_popup_icon_size_multiplier(desktop_popup[i],
+ (screen_desktop_layout.columns /
+ screen_desktop_layout.rows) / 2,
+ (screen_desktop_layout.rows/
+ screen_desktop_layout.columns) / 2);
+ pager_popup_max_width(desktop_popup[i],
+ MAX(a->width/3, POPUP_WIDTH));
+ pager_popup_show(desktop_popup[i], screen_desktop_names[d], d);
+
+ obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func);
+ obt_main_loop_timeout_add(ob_main_loop, config_desktop_popup_time * 1000,
+ hide_desktop_popup_func, desktop_popup[i],
+ g_direct_equal, NULL);
+ g_free(a);
+ }
}
void screen_hide_desktop_popup(void)
{
- obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func);
- pager_popup_hide(desktop_popup);
+ guint i;
+
+ for (i = 0; i < screen_num_monitors; i++) {
+ obt_main_loop_timeout_remove_data(ob_main_loop, hide_desktop_popup_func,
+ desktop_popup[i], FALSE);
+ pager_popup_hide(desktop_popup[i]);
+ }
}
guint screen_find_desktop(guint from, ObDirection dir,
@@ -1178,9 +1203,11 @@ void screen_update_desktop_names(void)
}
/* resize the pager for these names */
- pager_popup_text_width_to_strings(desktop_popup,
- screen_desktop_names,
- screen_num_desktops);
+ for (i = 0; i < screen_num_monitors; i++) {
+ pager_popup_text_width_to_strings(desktop_popup[i],
+ screen_desktop_names,
+ screen_num_desktops);
+ }
}
void screen_show_desktop(gboolean show, ObClient *show_only)
@@ -1302,7 +1329,10 @@ typedef struct {
static void get_xinerama_screens(Rect **xin_areas, guint *nxin)
{
guint i;
- gint l, r, t, b;
+ gint n, l, r, t, b;
+#ifdef XINERAMA
+ XineramaScreenInfo *info;
+#endif
if (ob_debug_xinerama) {
gint w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen));
@@ -1313,10 +1343,8 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin)
RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h);
}
#ifdef XINERAMA
- else if (obt_display_extension_xinerama) {
- guint i;
- gint n;
- XineramaScreenInfo *info = XineramaQueryScreens(obt_display, &n);
+ else if (obt_display_extension_xinerama &&
+ (info = XineramaQueryScreens(obt_display, &n))) {
*nxin = n;
*xin_areas = g_new(Rect, *nxin + 1);
for (i = 0; i < *nxin; ++i)
@@ -1357,6 +1385,20 @@ void screen_update_areas(void)
g_free(monitor_area);
get_xinerama_screens(&monitor_area, &screen_num_monitors);
+ if (!desktop_popup) {
+ desktop_popup = g_new(ObPagerPopup*, screen_num_monitors);
+ for (i = 0; i < screen_num_monitors; i++) {
+ desktop_popup[i] = pager_popup_new();
+ pager_popup_height(desktop_popup[i], POPUP_HEIGHT);
+
+ if (screen_desktop_names)
+ /* update the pager popup's width */
+ pager_popup_text_width_to_strings(desktop_popup[i],
+ screen_desktop_names,
+ screen_num_desktops);
+ }
+ }
+
/* set up the user-specified margins */
config_margins.top_start = RECT_LEFT(monitor_area[screen_num_monitors]);
config_margins.top_end = RECT_RIGHT(monitor_area[screen_num_monitors]);
@@ -1454,6 +1496,15 @@ void screen_update_areas(void)
b = MAX(b, s->strut->bottom);
}
+ if (l) l += RECT_LEFT (monitor_area[screen_num_monitors])
+ - RECT_LEFT (monitor_area[i]);
+ if (t) t += RECT_TOP (monitor_area[screen_num_monitors])
+ - RECT_TOP (monitor_area[i]);
+ if (r) r -= RECT_RIGHT (monitor_area[screen_num_monitors])
+ - RECT_RIGHT (monitor_area[i]);
+ if (b) b -= RECT_BOTTOM(monitor_area[screen_num_monitors])
+ - RECT_BOTTOM(monitor_area[i]);
+
/* based on these margins, set the work area for the
monitor/desktop */
dims[(i * screen_num_desktops + j) * 4 + 0] += l;
@@ -1594,28 +1645,32 @@ Rect* screen_area(guint desktop, guint head, Rect *search)
if ((s->desktop == d || s->desktop == DESKTOP_ALL) &&
STRUT_LEFT_IN_SEARCH(s->strut, search) &&
!STRUT_LEFT_IGNORE(s->strut, us, search))
- l = MAX(l, al + s->strut->left);
+ l = MAX(l, RECT_LEFT(monitor_area[screen_num_monitors])
+ + s->strut->left);
}
for (it = struts_top; it; it = g_slist_next(it)) {
ObScreenStrut *s = it->data;
if ((s->desktop == d || s->desktop == DESKTOP_ALL) &&
STRUT_TOP_IN_SEARCH(s->strut, search) &&
!STRUT_TOP_IGNORE(s->strut, us, search))
- t = MAX(t, at + s->strut->top);
+ t = MAX(t, RECT_TOP(monitor_area[screen_num_monitors])
+ + s->strut->top);
}
for (it = struts_right; it; it = g_slist_next(it)) {
ObScreenStrut *s = it->data;
if ((s->desktop == d || s->desktop == DESKTOP_ALL) &&
STRUT_RIGHT_IN_SEARCH(s->strut, search) &&
!STRUT_RIGHT_IGNORE(s->strut, us, search))
- r = MIN(r, ar - s->strut->right);
+ r = MIN(r, RECT_RIGHT(monitor_area[screen_num_monitors])
+ - s->strut->right);
}
for (it = struts_bottom; it; it = g_slist_next(it)) {
ObScreenStrut *s = it->data;
if ((s->desktop == d || s->desktop == DESKTOP_ALL) &&
STRUT_BOTTOM_IN_SEARCH(s->strut, search) &&
!STRUT_BOTTOM_IGNORE(s->strut, us, search))
- b = MIN(b, ab - s->strut->bottom);
+ b = MIN(b, RECT_BOTTOM(monitor_area[screen_num_monitors])
+ - s->strut->bottom);
}
/* limit to this monitor */