Reinit edges stuff on screen resize
authorMikael Magnusson <mikachu@gmail.com>
Thu, 18 Apr 2013 11:08:11 +0000 (13:08 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Sat, 11 Oct 2014 00:17:21 +0000 (02:17 +0200)
openbox/edges.c
openbox/edges.h
openbox/screen.c

index 1576dbaf11a63595a63d243b2cbc429642fd9996..2b40619b8c3a5b917bf763cf04ba82e9b3e820e4 100644 (file)
@@ -8,12 +8,12 @@
 #include <glib.h>
 
 /* Array of array of monitors of edges: edge[monitor 2][top edge] */
-ObEdge ***edge;
+ObEdge ***edge = NULL;
 #warning put in config.c and parse configs of course
 gboolean config_edge_enabled[OB_NUM_EDGES] = {1, 1, 1, 1, 1, 1, 1, 1};
 /* this could change at runtime, we should hook into that, but for now
  * don't crash on reconfigure/shutdown */
-static edge_monitors;
+static guint edge_monitors;
 
 #ifdef DEBUG
 #define EDGE_WIDTH 10
@@ -109,6 +109,10 @@ void edges_shutdown(gboolean reconfigure)
 {
     gint i, m;
 
+    /* This is in case we get called before startup by screen_resize() */
+    if (!edge)
+        return;
+
     for (m = 0; m < edge_monitors; m++) {
         for (i = 0; i < OB_NUM_EDGES; i++) {
             if (!config_edge_enabled[i])
@@ -123,3 +127,9 @@ void edges_shutdown(gboolean reconfigure)
     }
     g_slice_free1(sizeof(ObEdge**) * edge_monitors, edge);
 }
+
+void edges_configure()
+{
+    edges_shutdown(TRUE);
+    edges_startup(TRUE);
+}
index 4648404476681e6249a9f856b4be3bed04679786..419cba61d81e35bf987d4210ff7f211353a18125 100644 (file)
@@ -27,5 +27,6 @@ struct _ObEdge
 
 void edges_startup(gboolean reconfigure);
 void edges_shutdown(gboolean reconfigure);
+void edges_configure(void);
 
 #endif
index e758ada1c5207f2abd82fd2e94351ea61d2d89e5..60f3bf915c4263065325b167a4ec3d6a18460e2d 100644 (file)
@@ -20,6 +20,7 @@
 #include "debug.h"
 #include "openbox.h"
 #include "dock.h"
+#include "edges.h"
 #include "grab.h"
 #include "startupnotify.h"
 #include "moveresize.h"
@@ -500,6 +501,7 @@ void screen_resize(void)
 
     /* this calls screen_update_areas(), which we need ! */
     dock_configure();
+    edges_configure();
 
     for (it = client_list; it; it = g_list_next(it)) {
         client_move_onscreen(it->data, FALSE);