Merge branch 'backport' into work
authorDana Jansens <danakj@orodu.net>
Sat, 21 Nov 2009 21:56:07 +0000 (16:56 -0500)
committerDana Jansens <danakj@orodu.net>
Sat, 21 Nov 2009 21:56:07 +0000 (16:56 -0500)
Conflicts:
openbox/popup.c

1  2 
openbox/actions/moveresizeto.c
openbox/client.c
openbox/frame.c
openbox/popup.c
openbox/screen.c
render/theme.c

Simple merge
Simple merge
diff --cc openbox/frame.c
Simple merge
diff --cc openbox/popup.c
@@@ -64,11 -65,13 +64,13 @@@ ObPopup *popup_new(void
  void popup_free(ObPopup *self)
  {
      if (self) {
 -        XDestroyWindow(ob_display, self->bg);
 -        XDestroyWindow(ob_display, self->text);
+         popup_hide(self); /* make sure it's not showing or is being delayed and
+                              will be shown */
 +        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);
      }
@@@ -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);
diff --cc render/theme.c
Simple merge