]> Dogcows Code - chaz/openbox/blobdiff - openbox/screen.c
yay no tabs in the source
[chaz/openbox] / openbox / screen.c
index b0fc5c20a7f0bfb1fb5339c29baed835b21d81ed..aa296f9fa09a4cb0744694392b68a1be7f36038c 100644 (file)
@@ -43,9 +43,9 @@
 
 /*! The event mask to grab on the root window */
 #define ROOT_EVENTMASK (StructureNotifyMask | PropertyChangeMask | \
-                       EnterWindowMask | LeaveWindowMask | \
-                       SubstructureNotifyMask | SubstructureRedirectMask | \
-                       ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
+                        EnterWindowMask | LeaveWindowMask | \
+                        SubstructureNotifyMask | SubstructureRedirectMask | \
+                        ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
 
 guint    screen_num_desktops;
 guint    screen_num_monitors;
@@ -182,7 +182,7 @@ gboolean screen_annex()
                   ob_screen);
 
         XDestroyWindow(ob_display, screen_support_win);
-       return FALSE;
+        return FALSE;
     }
 
 
@@ -283,7 +283,7 @@ void screen_startup(gboolean reconfig)
     /* set the names */
     screen_desktop_names = g_new(gchar*,
                                  g_slist_length(config_desktops_names) + 1);
-    for (i = 0, it = config_desktops_names; it; ++i, it = it->next)
+    for (i = 0, it = config_desktops_names; it; ++i, it = g_slist_next(it))
         screen_desktop_names[i] = it->data; /* dont strdup */
     screen_desktop_names[i] = NULL;
     PROP_SETSS(RootWindow(ob_display, ob_screen),
@@ -295,7 +295,7 @@ void screen_startup(gboolean reconfig)
         screen_num_desktops = 0;
     screen_set_num_desktops(config_desktops_num);
     if (!reconfig) {
-        screen_set_desktop(0);
+        screen_set_desktop(MIN(config_screen_firstdesk, screen_num_desktops) - 1);
 
         /* don't start in showing-desktop mode */
         screen_showing_desktop = FALSE;
@@ -355,12 +355,12 @@ void screen_resize()
                 net_desktop_geometry, cardinal, geometry, 2);
 
     if (ob_state() == OB_STATE_STARTING)
-       return;
+        return;
 
     screen_update_areas();
     dock_configure();
 
-    for (it = client_list; it; it = it->next)
+    for (it = client_list; it; it = g_list_next(it))
         client_move_onscreen(it->data, FALSE);
 }
 
@@ -392,7 +392,7 @@ void screen_set_num_desktops(guint num)
     screen_update_desktop_names();
 
     /* move windows on desktops that will no longer exist! */
-    for (it = client_list; it != NULL; it = it->next) {
+    for (it = client_list; it; it = g_list_next(it)) {
         ObClient *c = it->data;
         if (c->desktop >= num && c->desktop != DESKTOP_ALL)
             client_set_desktop(c, num - 1, FALSE);
@@ -403,7 +403,7 @@ void screen_set_num_desktops(guint num)
 
     /* change our desktop if we're on one that no longer exists! */
     if (screen_desktop >= screen_num_desktops)
-       screen_set_desktop(num - 1);
+        screen_set_desktop(num - 1);
 
    /* update the focus lists */
     /* free our lists for the desktops which have disappeared */
@@ -605,7 +605,6 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
                            gboolean dialog, gboolean done, gboolean cancel)
 {
     static gboolean first = TRUE;
-    static gboolean lin;
     static guint origd, d;
     guint r, c;
 
@@ -617,13 +616,12 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
     }
     if (first) {
         first = FALSE;
-        lin = linear;
         d = origd = screen_desktop;
     }
 
     get_row_col(d, &r, &c);
 
-    if (lin) {
+    if (linear) {
         switch (dir) {
         case OB_DIRECTION_EAST:
             if (d < screen_num_desktops - 1)
@@ -868,7 +866,7 @@ void screen_show_desktop(gboolean show)
 
     if (show) {
         /* bottom to top */
-        for (it = g_list_last(stacking_list); it != NULL; it = it->prev) {
+        for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
             if (WINDOW_IS_CLIENT(it->data)) {
                 ObClient *client = it->data;
                 if (client->frame->visible && !client_should_show(client))
@@ -877,7 +875,7 @@ void screen_show_desktop(gboolean show)
         }
     } else {
         /* top to bottom */
-        for (it = stacking_list; it != NULL; it = it->next) {
+        for (it = stacking_list; it; it = g_list_next(it)) {
             if (WINDOW_IS_CLIENT(it->data)) {
                 ObClient *client = it->data;
                 if (!client->frame->visible && client_should_show(client))
@@ -888,7 +886,7 @@ void screen_show_desktop(gboolean show)
 
     if (show) {
         /* focus desktop */
-        for (it = focus_order[screen_desktop]; it; it = it->next)
+        for (it = focus_order[screen_desktop]; it; it = g_list_next(it))
             if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP &&
                 client_focus(it->data))
                 break;
@@ -1021,7 +1019,7 @@ void screen_update_areas()
             o = MIN(o, area[i][x].x);
 
         for (x = 0; x < screen_num_monitors; ++x) {
-            for (it = client_list; it; it = it->next) {
+            for (it = client_list; it; it = g_list_next(it)) {
                 ObClient *c = it->data;
                 screen_area_add_strut_left(&c->strut,
                                            &monitor_area[x],
@@ -1043,7 +1041,7 @@ void screen_update_areas()
             o = MIN(o, area[i][x].y);
 
         for (x = 0; x < screen_num_monitors; ++x) {
-            for (it = client_list; it; it = it->next) {
+            for (it = client_list; it; it = g_list_next(it)) {
                 ObClient *c = it->data;
                 screen_area_add_strut_top(&c->strut,
                                            &monitor_area[x],
@@ -1065,7 +1063,7 @@ void screen_update_areas()
             o = MAX(o, area[i][x].x + area[i][x].width - 1);
 
         for (x = 0; x < screen_num_monitors; ++x) {
-            for (it = client_list; it; it = it->next) {
+            for (it = client_list; it; it = g_list_next(it)) {
                 ObClient *c = it->data;
                 screen_area_add_strut_right(&c->strut,
                                            &monitor_area[x],
@@ -1090,7 +1088,7 @@ void screen_update_areas()
             o = MAX(o, area[i][x].y + area[i][x].height - 1);
 
         for (x = 0; x < screen_num_monitors; ++x) {
-            for (it = client_list; it; it = it->next) {
+            for (it = client_list; it; it = g_list_next(it)) {
                 ObClient *c = it->data;
                 screen_area_add_strut_bottom(&c->strut,
                                              &monitor_area[x],
@@ -1126,7 +1124,7 @@ void screen_update_areas()
 
         /* the area has changed, adjust all the maximized 
            windows */
-        for (it = client_list; it; it = it->next) {
+        for (it = client_list; it; it = g_list_next(it)) {
             ObClient *c = it->data; 
             if (i < screen_num_desktops) {
                 if (c->desktop == i)
@@ -1161,9 +1159,9 @@ Rect *screen_area_monitor(guint desktop, guint head)
     if (head > screen_num_monitors)
         return NULL;
     if (desktop >= screen_num_desktops) {
-       if (desktop == DESKTOP_ALL)
-           return &area[screen_num_desktops][head];
-       return NULL;
+        if (desktop == DESKTOP_ALL)
+            return &area[screen_num_desktops][head];
+        return NULL;
     }
     return &area[desktop][head];
 }
This page took 0.026474 seconds and 4 git commands to generate.