From: Dana Jansens Date: Sat, 21 Nov 2009 21:56:07 +0000 (-0500) Subject: Merge branch 'backport' into work X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=4bf6b1b551be744be4fbe4d1faab5be12d051378;p=chaz%2Fopenbox Merge branch 'backport' into work Conflicts: openbox/popup.c --- 4bf6b1b551be744be4fbe4d1faab5be12d051378 diff --cc openbox/popup.c index af1c511c,5cbe0347..47d0d0fb --- a/openbox/popup.c +++ b/openbox/popup.c @@@ -64,11 -65,13 +64,13 @@@ ObPopup *popup_new(void void popup_free(ObPopup *self) { if (self) { + popup_hide(self); /* make sure it's not showing or is being delayed and + will be shown */ - XDestroyWindow(ob_display, self->bg); - XDestroyWindow(ob_display, self->text); + XDestroyWindow(obt_display, self->bg); + XDestroyWindow(obt_display, self->text); RrAppearanceFree(self->a_bg); RrAppearanceFree(self->a_text); - g_hash_table_remove(window_map, &self->bg); + window_remove(self->bg); stacking_remove(self); g_free(self); } diff --cc openbox/screen.c index be9f8fb7,3e27903f..b53671fa --- a/openbox/screen.c +++ b/openbox/screen.c @@@ -1321,73 -1338,34 +1321,83 @@@ typedef struct } \ } +static void get_xinerama_screens(Rect **xin_areas, guint *nxin) +{ + guint i; + gint n, l, r, t, b; +#ifdef XINERAMA + XineramaScreenInfo *info; +#endif + + if (ob_debug_xinerama) { + gint w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)); + gint h = HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen)); + *nxin = 2; + *xin_areas = g_new(Rect, *nxin + 1); + RECT_SET((*xin_areas)[0], 0, 0, w/2, h); + RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h); + } +#ifdef XINERAMA + 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) + RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org, + info[i].width, info[i].height); + XFree(info); + } +#endif + else { + *nxin = 1; + *xin_areas = g_new(Rect, *nxin + 1); + RECT_SET((*xin_areas)[0], 0, 0, + WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)), + HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen))); + } + + /* returns one extra with the total area in it */ + l = (*xin_areas)[0].x; + t = (*xin_areas)[0].y; + r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1; + b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1; + for (i = 1; i < *nxin; ++i) { + l = MIN(l, (*xin_areas)[i].x); + t = MIN(l, (*xin_areas)[i].y); + r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1); + b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1); + } + RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1); +} + void screen_update_areas(void) { - guint i, j; + guint i, j, onum; gulong *dims; GList *it; GSList *sit; + onum = screen_num_monitors; + g_free(monitor_area); - extensions_xinerama_screens(&monitor_area, &screen_num_monitors); + 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++) { + if (screen_num_monitors < onum) { + /* free some of the pager popups */ + for (i = screen_num_monitors; i < onum; ++i) + pager_popup_free(desktop_popup[i]); + desktop_popup = g_renew(ObPagerPopup*, desktop_popup, + screen_num_monitors); + } + else { + /* add some more pager popups */ + desktop_popup = g_renew(ObPagerPopup*, desktop_popup, + screen_num_monitors); + for (i = onum; 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 */ + if (screen_desktop_names) /* the areas are initialized before the + desktop names */ pager_popup_text_width_to_strings(desktop_popup[i], screen_desktop_names, screen_num_desktops);