]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
make ob_state a function so it cant be changed outside of openbox.c
[chaz/openbox] / openbox / client.c
index 65b6b3b0556be9604ccacea4a30673442f9368f5..339c2a18515d9860a197da9d910d279fd5344c56 100644 (file)
@@ -67,7 +67,8 @@ void client_set_list()
     } else
        windows = NULL;
 
-    PROP_SETA32(ob_root, net_client_list, window, (guint32*)windows, size);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_client_list, window, (guint32*)windows, size);
 
     if (windows)
        g_free(windows);
@@ -89,7 +90,7 @@ void client_foreach_transient(ObClient *self, ObClientForeachFunc func, void *da
 void client_foreach_ancestor(ObClient *self, ObClientForeachFunc func, void *data)
 {
     if (self->transient_for) {
-        if (self->transient_for != TRAN_GROUP) {
+        if (self->transient_for != OB_TRAN_GROUP) {
             if (!func(self->transient_for, data)) return;
             client_foreach_ancestor(self->transient_for, func, data);
         } else {
@@ -113,7 +114,8 @@ void client_manage_all()
     XWMHints *wmhints;
     XWindowAttributes attrib;
 
-    XQueryTree(ob_display, ob_root, &w, &w, &children, &nchild);
+    XQueryTree(ob_display, RootWindow(ob_display, ob_screen),
+               &w, &w, &children, &nchild);
 
     /* remove all icon windows from the list */
     for (i = 0; i < nchild; i++) {
@@ -168,9 +170,9 @@ void client_manage_all()
         if (active) {
             g_assert(WINDOW_IS_CLIENT(active));
             if (!client_focus(WINDOW_AS_CLIENT(active)))
-                focus_fallback(Fallback_NoFocus);
+                focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
         } else
-            focus_fallback(Fallback_NoFocus);
+            focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
     }
 }
 
@@ -254,7 +256,7 @@ void client_manage(Window window)
     focus_order_add_new(self);
 
     /* focus the new window? */
-    if (ob_state != OB_STATE_STARTING && config_focus_new &&
+    if (ob_state() != OB_STATE_STARTING && config_focus_new &&
         (self->type == OB_CLIENT_TYPE_NORMAL || self->type == OB_CLIENT_TYPE_DIALOG)) {
         gboolean group_foc = FALSE;
         
@@ -350,7 +352,7 @@ void client_unmanage(ObClient *self)
     screen_update_areas();
 
     /* tell our parent(s) that we're gone */
-    if (self->transient_for == TRAN_GROUP) { /* transient of group */
+    if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
         GSList *it;
 
         for (it = self->group->members; it; it = it->next)
@@ -364,7 +366,7 @@ void client_unmanage(ObClient *self)
 
     /* tell our transients that we're gone */
     for (it = self->transients; it != NULL; it = it->next) {
-        if (((ObClient*)it->data)->transient_for != TRAN_GROUP) {
+        if (((ObClient*)it->data)->transient_for != OB_TRAN_GROUP) {
             ((ObClient*)it->data)->transient_for = NULL;
             client_calc_layer(it->data);
         }
@@ -403,7 +405,7 @@ void client_unmanage(ObClient *self)
     frame_release_client(self->frame, self);
     self->frame = NULL;
      
-    if (ob_state != OB_STATE_EXITING) {
+    if (ob_state() != OB_STATE_EXITING) {
        /* these values should not be persisted across a window
           unmapping/mapping */
        prop_erase(self->window, prop_atoms.net_wm_desktop);
@@ -599,7 +601,7 @@ static void client_get_desktop(ObClient *self)
         gboolean trdesk = FALSE;
 
        if (self->transient_for) {
-           if (self->transient_for != TRAN_GROUP) {
+           if (self->transient_for != OB_TRAN_GROUP) {
                 self->desktop = self->transient_for->desktop;
                 trdesk = TRUE;
             } else {
@@ -700,9 +702,9 @@ void client_update_transient_for(ObClient *self)
                    group */
                 if (t == self->group->leader ||
                     t == None ||
-                    t == ob_root) {
+                    t == RootWindow(ob_display, ob_screen)) {
                     /* window is a transient for its group! */
-                    c = TRAN_GROUP;
+                    c = OB_TRAN_GROUP;
                 }
             }
         }
@@ -711,7 +713,7 @@ void client_update_transient_for(ObClient *self)
 
     /* if anything has changed... */
     if (c != self->transient_for) {
-       if (self->transient_for == TRAN_GROUP) { /* transient of group */
+       if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
             GSList *it;
 
            /* remove from old parents */
@@ -726,7 +728,7 @@ void client_update_transient_for(ObClient *self)
                 g_slist_remove(self->transient_for->transients, self);
         }
        self->transient_for = c;
-       if (self->transient_for == TRAN_GROUP) { /* transient of group */
+       if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
             GSList *it;
 
            /* add to new parents */
@@ -1123,7 +1125,7 @@ void client_update_wmhints(ObClient *self)
 
        /* only do this when first managing the window *AND* when we aren't
            starting up! */
-       if (ob_state != OB_STATE_STARTING && self->frame == NULL)
+       if (ob_state() != OB_STATE_STARTING && self->frame == NULL)
             if (hints->flags & StateHint)
                 self->iconic = hints->initial_state == IconicState;
 
@@ -1155,7 +1157,7 @@ void client_update_wmhints(ObClient *self)
                        set up */
                     for (it = self->group->members; it; it = it->next)
                         if (it->data != self &&
-                            ((ObClient*)it->data)->transient_for == TRAN_GROUP)
+                            ((ObClient*)it->data)->transient_for == OB_TRAN_GROUP)
                             self->transients = g_slist_append(self->transients,
                                                               it->data);
                 }
@@ -1460,7 +1462,7 @@ ObClient *client_search_focus_tree(ObClient *self)
 ObClient *client_search_focus_tree_full(ObClient *self)
 {
     if (self->transient_for) {
-        if (self->transient_for != TRAN_GROUP) {
+        if (self->transient_for != OB_TRAN_GROUP) {
             return client_search_focus_tree_full(self->transient_for);
         } else {
             GSList *it;
@@ -1485,27 +1487,28 @@ ObClient *client_search_focus_tree_full(ObClient *self)
     return client_search_focus_tree(self);
 }
 
-static StackLayer calc_layer(ObClient *self)
+static ObStackingLayer calc_layer(ObClient *self)
 {
-    StackLayer l;
+    ObStackingLayer l;
 
-    if (self->fullscreen) l = Layer_Fullscreen;
-    else if (self->type == OB_CLIENT_TYPE_DESKTOP) l = Layer_Desktop;
+    if (self->fullscreen) l = OB_STACKING_LAYER_FULLSCREEN;
+    else if (self->type == OB_CLIENT_TYPE_DESKTOP)
+        l = OB_STACKING_LAYER_DESKTOP;
     else if (self->type == OB_CLIENT_TYPE_DOCK) {
-        if (!self->below) l = Layer_Top;
-        else l = Layer_Normal;
+        if (!self->below) l = OB_STACKING_LAYER_TOP;
+        else l = OB_STACKING_LAYER_NORMAL;
     }
-    else if (self->above) l = Layer_Above;
-    else if (self->below) l = Layer_Below;
-    else l = Layer_Normal;
+    else if (self->above) l = OB_STACKING_LAYER_ABOVE;
+    else if (self->below) l = OB_STACKING_LAYER_BELOW;
+    else l = OB_STACKING_LAYER_NORMAL;
 
     return l;
 }
 
 static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
-                                        StackLayer l, gboolean raised)
+                                        ObStackingLayer l, gboolean raised)
 {
-    StackLayer old, own;
+    ObStackingLayer old, own;
     GSList *it;
 
     old = self->layer;
@@ -1526,7 +1529,7 @@ static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
 
 void client_calc_layer(ObClient *self)
 {
-    StackLayer l;
+    ObStackingLayer l;
     ObClient *orig;
 
     orig = self;
@@ -2418,7 +2421,7 @@ void client_unfocus(ObClient *self)
 #ifdef DEBUG_FOCUS
     g_message("client_unfocus for %lx", self->window);
 #endif
-    focus_fallback(Fallback_Unfocusing);
+    focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING);
 }
 
 void client_activate(ObClient *self)
@@ -2597,7 +2600,7 @@ ObClient *client_search_top_transient(ObClient *self)
 {
     /* move up the transient chain as far as possible */
     if (self->transient_for) {
-        if (self->transient_for != TRAN_GROUP) {
+        if (self->transient_for != OB_TRAN_GROUP) {
             return client_search_top_transient(self->transient_for);
         } else {
             GSList *it;
This page took 0.03089 seconds and 4 git commands to generate.