add misc.h with some standard enumerations with proper prefixing and capitalizations.
authorDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 06:18:47 +0000 (06:18 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 06:18:47 +0000 (06:18 +0000)
use the new enums throughout.

provide keycodes and cursors through ob_cursor and ob_keycode functions, which use the new misc.h enums for picking the cursor and keycode.

23 files changed:
openbox/action.c
openbox/action.h
openbox/client.c
openbox/client.h
openbox/dispatch.c
openbox/dispatch.h
openbox/dock.c
openbox/event.c
openbox/focus.c
openbox/frame.c
openbox/grab.c
openbox/grab.h
openbox/misc.h [new file with mode: 0644]
openbox/moveresize.c
openbox/openbox.c
openbox/openbox.h
openbox/screen.c
openbox/screen.h
openbox/stacking.c
plugins/keyboard/keyboard.c
plugins/placement/history.c
plugins/placement/placement.c
plugins/resistance/resistance.c

index e166dd8..85261a5 100644 (file)
@@ -41,42 +41,42 @@ void action_free(Action *a)
 
 void setup_action_directional_focus_north(Action *a)
 {
 
 void setup_action_directional_focus_north(Action *a)
 {
-    a->data.diraction.direction = Direction_North;
+    a->data.diraction.direction = OB_DIRECTION_NORTH;
 }
 
 void setup_action_directional_focus_east(Action *a)
 {
 }
 
 void setup_action_directional_focus_east(Action *a)
 {
-    a->data.diraction.direction = Direction_East;
+    a->data.diraction.direction = OB_DIRECTION_EAST;
 }
 
 void setup_action_directional_focus_south(Action *a)
 {
 }
 
 void setup_action_directional_focus_south(Action *a)
 {
-    a->data.diraction.direction = Direction_South;
+    a->data.diraction.direction = OB_DIRECTION_SOUTH;
 }
 
 void setup_action_directional_focus_west(Action *a)
 {
 }
 
 void setup_action_directional_focus_west(Action *a)
 {
-    a->data.diraction.direction = Direction_West;
+    a->data.diraction.direction = OB_DIRECTION_WEST;
 }
 
 void setup_action_directional_focus_northeast(Action *a)
 {
 }
 
 void setup_action_directional_focus_northeast(Action *a)
 {
-    a->data.diraction.direction = Direction_NorthEast;
+    a->data.diraction.direction = OB_DIRECTION_NORTHEAST;
 }
 
 void setup_action_directional_focus_southeast(Action *a)
 {
 }
 
 void setup_action_directional_focus_southeast(Action *a)
 {
-    a->data.diraction.direction = Direction_SouthEast;
+    a->data.diraction.direction = OB_DIRECTION_SOUTHEAST;
 }
 
 void setup_action_directional_focus_southwest(Action *a)
 {
 }
 
 void setup_action_directional_focus_southwest(Action *a)
 {
-    a->data.diraction.direction = Direction_SouthWest;
+    a->data.diraction.direction = OB_DIRECTION_SOUTHWEST;
 }
 
 void setup_action_directional_focus_northwest(Action *a)
 {
 }
 
 void setup_action_directional_focus_northwest(Action *a)
 {
-    a->data.diraction.direction = Direction_NorthWest;
+    a->data.diraction.direction = OB_DIRECTION_NORTHWEST;
 }
 
 void setup_action_send_to_desktop(Action *a)
 }
 
 void setup_action_send_to_desktop(Action *a)
@@ -141,22 +141,22 @@ void setup_action_cycle_windows_previous(Action *a)
 
 void setup_action_movetoedge_north(Action *a)
 {
 
 void setup_action_movetoedge_north(Action *a)
 {
-    a->data.diraction.direction = Direction_North;
+    a->data.diraction.direction = OB_DIRECTION_NORTH;
 }
 
 void setup_action_movetoedge_south(Action *a)
 {
 }
 
 void setup_action_movetoedge_south(Action *a)
 {
-    a->data.diraction.direction = Direction_South;
+    a->data.diraction.direction = OB_DIRECTION_SOUTH;
 }
 
 void setup_action_movetoedge_east(Action *a)
 {
 }
 
 void setup_action_movetoedge_east(Action *a)
 {
-    a->data.diraction.direction = Direction_East;
+    a->data.diraction.direction = OB_DIRECTION_EAST;
 }
 
 void setup_action_movetoedge_west(Action *a)
 {
 }
 
 void setup_action_movetoedge_west(Action *a)
 {
-    a->data.diraction.direction = Direction_West;
+    a->data.diraction.direction = OB_DIRECTION_WEST;
 }
 
 void setup_action_top_layer(Action *a)
 }
 
 void setup_action_top_layer(Action *a)
@@ -702,7 +702,7 @@ void action_move_relative_horz(union ActionData *data)
 {
     Client *c = data->relative.c;
     if (c)
 {
     Client *c = data->relative.c;
     if (c)
-        client_configure(c, Corner_TopLeft,
+        client_configure(c, OB_CORNER_TOPLEFT,
                          c->area.x + data->relative.delta, c->area.y,
                          c->area.width, c->area.height, TRUE, TRUE);
 }
                          c->area.x + data->relative.delta, c->area.y,
                          c->area.width, c->area.height, TRUE, TRUE);
 }
@@ -711,7 +711,7 @@ void action_move_relative_vert(union ActionData *data)
 {
     Client *c = data->relative.c;
     if (c)
 {
     Client *c = data->relative.c;
     if (c)
-        client_configure(c, Corner_TopLeft,
+        client_configure(c, OB_CORNER_TOPLEFT,
                          c->area.x, c->area.y + data->relative.delta,
                          c->area.width, c->area.height, TRUE, TRUE);
 }
                          c->area.x, c->area.y + data->relative.delta,
                          c->area.width, c->area.height, TRUE, TRUE);
 }
@@ -720,7 +720,7 @@ void action_resize_relative_horz(union ActionData *data)
 {
     Client *c = data->relative.c;
     if (c)
 {
     Client *c = data->relative.c;
     if (c)
-        client_configure(c, Corner_TopLeft, c->area.x, c->area.y,
+        client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
                          c->area.width +
                          data->relative.delta * c->size_inc.width,
                          c->area.height, TRUE, TRUE);
                          c->area.width +
                          data->relative.delta * c->size_inc.width,
                          c->area.height, TRUE, TRUE);
@@ -730,7 +730,7 @@ void action_resize_relative_vert(union ActionData *data)
 {
     Client *c = data->relative.c;
     if (c && !c->shaded)
 {
     Client *c = data->relative.c;
     if (c && !c->shaded)
-        client_configure(c, Corner_TopLeft, c->area.x, c->area.y,
+        client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
                          c->area.width, c->area.height +
                          data->relative.delta * c->size_inc.height,
                          TRUE, TRUE);
                          c->area.width, c->area.height +
                          data->relative.delta * c->size_inc.height,
                          TRUE, TRUE);
@@ -815,23 +815,23 @@ void action_desktop(union ActionData *data)
 static void cur_row_col(guint *r, guint *c)
 {
     switch (screen_desktop_layout.orientation) {
 static void cur_row_col(guint *r, guint *c)
 {
     switch (screen_desktop_layout.orientation) {
-    case Orientation_Horz:
+    case OB_ORIENTATION_HORZ:
         switch (screen_desktop_layout.start_corner) {
         switch (screen_desktop_layout.start_corner) {
-        case Corner_TopLeft:
+        case OB_CORNER_TOPLEFT:
             *r = screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop % screen_desktop_layout.columns;
             break;
             *r = screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop % screen_desktop_layout.columns;
             break;
-        case Corner_BottomLeft:
+        case OB_CORNER_BOTTOMLEFT:
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop % screen_desktop_layout.columns;
             break;
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop % screen_desktop_layout.columns;
             break;
-        case Corner_TopRight:
+        case OB_CORNER_TOPRIGHT:
             *r = screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop_layout.columns - 1 -
                 screen_desktop % screen_desktop_layout.columns;
             break;
             *r = screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop_layout.columns - 1 -
                 screen_desktop % screen_desktop_layout.columns;
             break;
-        case Corner_BottomRight:
+        case OB_CORNER_BOTTOMRIGHT:
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop_layout.columns - 1 -
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop / screen_desktop_layout.columns;
             *c = screen_desktop_layout.columns - 1 -
@@ -839,23 +839,23 @@ static void cur_row_col(guint *r, guint *c)
             break;
         }
         break;
             break;
         }
         break;
-    case Orientation_Vert:
+    case OB_ORIENTATION_VERT:
         switch (screen_desktop_layout.start_corner) {
         switch (screen_desktop_layout.start_corner) {
-        case Corner_TopLeft:
+        case OB_CORNER_TOPLEFT:
             *r = screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop / screen_desktop_layout.rows;
             break;
             *r = screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop / screen_desktop_layout.rows;
             break;
-        case Corner_BottomLeft:
+        case OB_CORNER_BOTTOMLEFT:
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop / screen_desktop_layout.rows;
             break;
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop / screen_desktop_layout.rows;
             break;
-        case Corner_TopRight:
+        case OB_CORNER_TOPRIGHT:
             *r = screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop_layout.columns - 1 -
                 screen_desktop / screen_desktop_layout.rows;
             break;
             *r = screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop_layout.columns - 1 -
                 screen_desktop / screen_desktop_layout.rows;
             break;
-        case Corner_BottomRight:
+        case OB_CORNER_BOTTOMRIGHT:
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop_layout.columns - 1 -
             *r = screen_desktop_layout.rows - 1 -
                 screen_desktop % screen_desktop_layout.rows;
             *c = screen_desktop_layout.columns - 1 -
@@ -869,46 +869,46 @@ static void cur_row_col(guint *r, guint *c)
 static guint translate_row_col(guint r, guint c)
 {
     switch (screen_desktop_layout.orientation) {
 static guint translate_row_col(guint r, guint c)
 {
     switch (screen_desktop_layout.orientation) {
-    case Orientation_Horz:
+    case OB_ORIENTATION_HORZ:
         switch (screen_desktop_layout.start_corner) {
         switch (screen_desktop_layout.start_corner) {
-        case Corner_TopLeft:
+        case OB_CORNER_TOPLEFT:
             return r % screen_desktop_layout.rows *
                 screen_desktop_layout.columns +
                 c % screen_desktop_layout.columns;
             return r % screen_desktop_layout.rows *
                 screen_desktop_layout.columns +
                 c % screen_desktop_layout.columns;
-        case Corner_BottomLeft:
+        case OB_CORNER_BOTTOMLEFT:
             return (screen_desktop_layout.rows - 1 -
                     r % screen_desktop_layout.rows) *
                 screen_desktop_layout.columns +
                 c % screen_desktop_layout.columns;
             return (screen_desktop_layout.rows - 1 -
                     r % screen_desktop_layout.rows) *
                 screen_desktop_layout.columns +
                 c % screen_desktop_layout.columns;
-        case Corner_TopRight:
+        case OB_CORNER_TOPRIGHT:
             return r % screen_desktop_layout.rows *
                 screen_desktop_layout.columns +
                 (screen_desktop_layout.columns - 1 -
                  c % screen_desktop_layout.columns);
             return r % screen_desktop_layout.rows *
                 screen_desktop_layout.columns +
                 (screen_desktop_layout.columns - 1 -
                  c % screen_desktop_layout.columns);
-        case Corner_BottomRight:
+        case OB_CORNER_BOTTOMRIGHT:
             return (screen_desktop_layout.rows - 1 -
                     r % screen_desktop_layout.rows) *
                 screen_desktop_layout.columns +
                 (screen_desktop_layout.columns - 1 -
                  c % screen_desktop_layout.columns);
         }
             return (screen_desktop_layout.rows - 1 -
                     r % screen_desktop_layout.rows) *
                 screen_desktop_layout.columns +
                 (screen_desktop_layout.columns - 1 -
                  c % screen_desktop_layout.columns);
         }
-    case Orientation_Vert:
+    case OB_ORIENTATION_VERT:
         switch (screen_desktop_layout.start_corner) {
         switch (screen_desktop_layout.start_corner) {
-        case Corner_TopLeft:
+        case OB_CORNER_TOPLEFT:
             return c % screen_desktop_layout.columns *
                 screen_desktop_layout.rows +
                 r % screen_desktop_layout.rows;
             return c % screen_desktop_layout.columns *
                 screen_desktop_layout.rows +
                 r % screen_desktop_layout.rows;
-        case Corner_BottomLeft:
+        case OB_CORNER_BOTTOMLEFT:
             return c % screen_desktop_layout.columns *
                 screen_desktop_layout.rows +
                 (screen_desktop_layout.rows - 1 -
                  r % screen_desktop_layout.rows);
             return c % screen_desktop_layout.columns *
                 screen_desktop_layout.rows +
                 (screen_desktop_layout.rows - 1 -
                  r % screen_desktop_layout.rows);
-        case Corner_TopRight:
+        case OB_CORNER_TOPRIGHT:
             return (screen_desktop_layout.columns - 1 -
                     c % screen_desktop_layout.columns) *
                 screen_desktop_layout.rows +
                 r % screen_desktop_layout.rows;
             return (screen_desktop_layout.columns - 1 -
                     c % screen_desktop_layout.columns) *
                 screen_desktop_layout.rows +
                 r % screen_desktop_layout.rows;
-        case Corner_BottomRight:
+        case OB_CORNER_BOTTOMRIGHT:
             return (screen_desktop_layout.columns - 1 -
                     c % screen_desktop_layout.columns) *
                 screen_desktop_layout.rows +
             return (screen_desktop_layout.columns - 1 -
                     c % screen_desktop_layout.columns) *
                 screen_desktop_layout.rows +
@@ -1167,21 +1167,23 @@ void action_movetoedge(union ActionData *data)
     h = screen_area(c->desktop)->height;
     w = screen_area(c->desktop)->width;
     switch(data->diraction.direction) {
     h = screen_area(c->desktop)->height;
     w = screen_area(c->desktop)->width;
     switch(data->diraction.direction) {
-    case Direction_North:
+    case OB_DIRECTION_NORTH:
         y = 0;
         break;
         y = 0;
         break;
-    case Direction_West:
+    case OB_DIRECTION_WEST:
         x = 0;
         break;
         x = 0;
         break;
-    case Direction_South:
+    case OB_DIRECTION_SOUTH:
         y = h - c->frame->area.height;
         break;
         y = h - c->frame->area.height;
         break;
-    case Direction_East:
+    case OB_DIRECTION_EAST:
         x = w - c->frame->area.width;
         break;
         x = w - c->frame->area.width;
         break;
+    default:
+        g_assert_not_reached();
     }
     frame_frame_gravity(c->frame, &x, &y);
     }
     frame_frame_gravity(c->frame, &x, &y);
-    client_configure(c, Corner_TopLeft,
+    client_configure(c, OB_CORNER_TOPLEFT,
                      x, y, c->area.width, c->area.height, TRUE, TRUE);
 
 }
                      x, y, c->area.width, c->area.height, TRUE, TRUE);
 
 }
index f79bd56..9dfbc71 100644 (file)
@@ -15,7 +15,7 @@ struct AnyAction {
 
 struct DirectionalAction{
     Client *c;
 
 struct DirectionalAction{
     Client *c;
-    int direction;
+    ObDirection direction;
 };
 
 struct Execute {
 };
 
 struct Execute {
index bdf9ed0..3249fd5 100644 (file)
@@ -254,7 +254,7 @@ void client_manage(Window window)
     focus_order_add_new(self);
 
     /* focus the new window? */
     focus_order_add_new(self);
 
     /* focus the new window? */
-    if (ob_state != State_Starting && config_focus_new &&
+    if (ob_state != OB_STATE_STARTING && config_focus_new &&
         (self->type == Type_Normal || self->type == Type_Dialog)) {
         gboolean group_foc = FALSE;
         
         (self->type == Type_Normal || self->type == Type_Dialog)) {
         gboolean group_foc = FALSE;
         
@@ -403,7 +403,7 @@ void client_unmanage(Client *self)
     frame_release_client(self->frame, self);
     self->frame = NULL;
      
     frame_release_client(self->frame, self);
     self->frame = NULL;
      
-    if (ob_state != 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);
        /* these values should not be persisted across a window
           unmapping/mapping */
        prop_erase(self->window, prop_atoms.net_wm_desktop);
@@ -453,7 +453,7 @@ void client_move_onscreen(Client *self)
 
     frame_frame_gravity(self->frame, &x, &y); /* get where the client
                                                  should be */
 
     frame_frame_gravity(self->frame, &x, &y); /* get where the client
                                                  should be */
-    client_configure(self , Corner_TopLeft, x, y,
+    client_configure(self, OB_CORNER_TOPLEFT, x, y,
                      self->area.width, self->area.height,
                      TRUE, TRUE);
 }
                      self->area.width, self->area.height,
                      TRUE, TRUE);
 }
@@ -1095,7 +1095,7 @@ void client_reconfigure(Client *self)
     /* by making this pass FALSE for user, we avoid the emacs event storm where
        every configurenotify causes an update in its normal hints, i think this
        is generally what we want anyways... */
     /* by making this pass FALSE for user, we avoid the emacs event storm where
        every configurenotify causes an update in its normal hints, i think this
        is generally what we want anyways... */
-    client_configure(self, Corner_TopLeft, self->area.x, self->area.y,
+    client_configure(self, OB_CORNER_TOPLEFT, self->area.x, self->area.y,
                      self->area.width, self->area.height, FALSE, TRUE);
 }
 
                      self->area.width, self->area.height, FALSE, TRUE);
 }
 
@@ -1114,7 +1114,7 @@ void client_update_wmhints(Client *self)
 
        /* only do this when first managing the window *AND* when we aren't
            starting up! */
 
        /* only do this when first managing the window *AND* when we aren't
            starting up! */
-       if (ob_state != State_Starting && self->frame == NULL)
+       if (ob_state != OB_STATE_STARTING && self->frame == NULL)
             if (hints->flags & StateHint)
                 self->iconic = hints->initial_state == IconicState;
 
             if (hints->flags & StateHint)
                 self->iconic = hints->initial_state == IconicState;
 
@@ -1594,7 +1594,8 @@ static void client_apply_startup_state(Client *self)
     */
 }
 
     */
 }
 
-void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
+void client_configure(Client *self, ObCorner anchor,
+                      int x, int y, int w, int h,
                      gboolean user, gboolean final)
 {
     gboolean moved = FALSE, resized = FALSE;
                      gboolean user, gboolean final)
 {
     gboolean moved = FALSE, resized = FALSE;
@@ -1753,15 +1754,15 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
     }
 
     switch (anchor) {
     }
 
     switch (anchor) {
-    case Corner_TopLeft:
+    case OB_CORNER_TOPLEFT:
        break;
        break;
-    case Corner_TopRight:
+    case OB_CORNER_TOPRIGHT:
        x -= w - self->area.width;
        break;
        x -= w - self->area.width;
        break;
-    case Corner_BottomLeft:
+    case OB_CORNER_BOTTOMLEFT:
        y -= h - self->area.height;
        break;
        y -= h - self->area.height;
        break;
-    case Corner_BottomRight:
+    case OB_CORNER_BOTTOMRIGHT:
        x -= w - self->area.width;
        y -= h - self->area.height;
        break;
        x -= w - self->area.width;
        y -= h - self->area.height;
        break;
@@ -1865,7 +1866,7 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
 
     client_setup_decor_and_functions(self);
 
 
     client_setup_decor_and_functions(self);
 
-    client_configure(self, Corner_TopLeft, x, y, w, h, TRUE, TRUE);
+    client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE);
 
     /* try focus us when we go into fullscreen mode */
     client_focus(self);
 
     /* try focus us when we go into fullscreen mode */
     client_focus(self);
@@ -2042,7 +2043,7 @@ void client_maximize(Client *self, gboolean max, int dir, gboolean savearea)
 
     /* figure out where the client should be going */
     frame_frame_gravity(self->frame, &x, &y);
 
     /* figure out where the client should be going */
     frame_frame_gravity(self->frame, &x, &y);
-    client_configure(self, Corner_TopLeft, x, y, w, h, TRUE, TRUE);
+    client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE);
 }
 
 void client_shade(Client *self, gboolean shade)
 }
 
 void client_shade(Client *self, gboolean shade)
@@ -2457,7 +2458,7 @@ Icon *client_icon(Client *self, int w, int h)
 }
 
 /* this be mostly ripped from fvwm */
 }
 
 /* this be mostly ripped from fvwm */
-Client *client_find_directional(Client *c, Direction dir) 
+Client *client_find_directional(Client *c, ObDirection dir) 
 {
     int my_cx, my_cy, his_cx, his_cy;
     int offset = 0;
 {
     int my_cx, my_cy, his_cx, his_cy;
     int offset = 0;
@@ -2512,21 +2513,23 @@ Client *client_find_directional(Client *c, Direction dir)
         }
 
         switch(dir) {
         }
 
         switch(dir) {
-        case Direction_North :
-        case Direction_South :
-        case Direction_NorthEast :
-        case Direction_SouthWest :
+        case OB_DIRECTION_NORTH:
+        case OB_DIRECTION_SOUTH:
+        case OB_DIRECTION_NORTHEAST:
+        case OB_DIRECTION_SOUTHWEST:
             offset = (his_cx < 0) ? -his_cx : his_cx;
             offset = (his_cx < 0) ? -his_cx : his_cx;
-            distance = (dir == Direction_North || dir == Direction_NorthEast) ?
-                -his_cy : his_cy;
+            distance = ((dir == OB_DIRECTION_NORTH ||
+                        dir == OB_DIRECTION_NORTHEAST) ?
+                        -his_cy : his_cy);
             break;
             break;
-        case Direction_East :
-        case Direction_West :
-        case Direction_SouthEast :
-        case Direction_NorthWest :
+        case OB_DIRECTION_EAST:
+        case OB_DIRECTION_WEST:
+        case OB_DIRECTION_SOUTHEAST:
+        case OB_DIRECTION_NORTHWEST:
             offset = (his_cy < 0) ? -his_cy : his_cy;
             offset = (his_cy < 0) ? -his_cy : his_cy;
-            distance = (dir == Direction_West || dir == Direction_NorthWest) ?
-                -his_cx : his_cx;
+            distance = ((dir == OB_DIRECTION_WEST ||
+                        dir == OB_DIRECTION_NORTHWEST) ?
+                        -his_cx : his_cx);
             break;
         }
 
             break;
         }
 
index ede9df6..1e8adf6 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __client_h
 #define __client_h
 
 #ifndef __client_h
 #define __client_h
 
+#include "misc.h"
 #include "geom.h"
 #include "stacking.h"
 #include "render/color.h"
 #include "geom.h"
 #include "stacking.h"
 #include "render/color.h"
@@ -64,14 +65,6 @@ typedef enum {
     MwmDecor_Maximize = 1 << 6  /*!< Show a maximize button */
 } MemDecorations;
 
     MwmDecor_Maximize = 1 << 6  /*!< Show a maximize button */
 } MemDecorations;
 
-/*! Corners of the client window, used for anchor positions */
-typedef enum {
-    Corner_TopLeft,
-    Corner_TopRight,
-    Corner_BottomLeft,
-    Corner_BottomRight
-} Corner;
-
 /*! Possible window types */
 typedef enum {
     Type_Desktop, /*!< A desktop (bottom-most window) */
 /*! Possible window types */
 typedef enum {
     Type_Desktop, /*!< A desktop (bottom-most window) */
@@ -110,18 +103,6 @@ typedef enum {
     Decor_Close       = 1 << 8  /*!< Display a close button */
 } Decoration;
 
     Decor_Close       = 1 << 8  /*!< Display a close button */
 } Decoration;
 
-/*! The directions used by client_find_directional */
-typedef enum {
-    Direction_North,
-    Direction_East,
-    Direction_South,
-    Direction_West,
-    Direction_NorthEast,
-    Direction_SouthEast,
-    Direction_SouthWest,
-    Direction_NorthWest
-} Direction;
-
 typedef struct Client {
     ObWindow obwin;
 
 typedef struct Client {
     ObWindow obwin;
 
@@ -346,7 +327,8 @@ gboolean client_focused(Client *self);
               interactive move/resize, and then be TRUE for the last call
               only.
 */
               interactive move/resize, and then be TRUE for the last call
               only.
 */
-void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
+void client_configure(Client *self, ObCorner anchor,
+                      int x, int y, int w, int h,
                      gboolean user, gboolean final);
 
 void client_reconfigure(Client *self);
                      gboolean user, gboolean final);
 
 void client_reconfigure(Client *self);
@@ -499,7 +481,7 @@ Client *client_search_modal_child(Client *self);
 Client *client_search_top_transient(Client *self);
 
 /*! Return the "closest" client in the given direction */
 Client *client_search_top_transient(Client *self);
 
 /*! Return the "closest" client in the given direction */
-Client *client_find_directional(Client *c, Direction dir);
+Client *client_find_directional(Client *c, ObDirection dir);
 
 /*! Set a client window to be above/below other clients.
   @layer < 0 indicates the client should be placed below other clients.<br>
 
 /*! Set a client window to be above/below other clients.
   @layer < 0 indicates the client should be placed below other clients.<br>
index 6f2b3d4..87f41dc 100644 (file)
@@ -238,7 +238,7 @@ void dispatch_move(Client *c, int *x, int *y)
     *y = obe.data.c.num[1];
 }
 
     *y = obe.data.c.num[1];
 }
 
-void dispatch_resize(Client *c, int *w, int *h, Corner corner)
+void dispatch_resize(Client *c, int *w, int *h, ObCorner corner)
 {
     guint i;
     GSList *it;
 {
     guint i;
     GSList *it;
index d3ac0d4..852d0bf 100644 (file)
@@ -98,6 +98,6 @@ void dispatch_signal(int signal);
 void dispatch_move(Client *c, int *x, int *y);
 /* *w and *h should be set with the destination of the window, they may be
    changed by the event handlers */
 void dispatch_move(Client *c, int *x, int *y);
 /* *w and *h should be set with the destination of the window, they may be
    changed by the event handlers */
-void dispatch_resize(Client *c, int *w, int *h, Corner corner);
+void dispatch_resize(Client *c, int *w, int *h, ObCorner corner);
 
 #endif
 
 #endif
index 12985fb..08f6513 100644 (file)
@@ -91,7 +91,7 @@ void dock_add(Window win, XWMHints *wmhints)
       member set the root window, and one set to the client, but both get
       handled and need to be ignored.
     */
       member set the root window, and one set to the client, but both get
       handled and need to be ignored.
     */
-    if (ob_state == State_Starting)
+    if (ob_state == OB_STATE_STARTING)
        app->ignore_unmaps += 2;
 
     if (app->win != app->icon_win) {
        app->ignore_unmaps += 2;
 
     if (app->win != app->icon_win) {
@@ -109,7 +109,7 @@ void dock_add(Window win, XWMHints *wmhints)
 
     grab_button_full(2, 0, app->icon_win,
                      ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
 
     grab_button_full(2, 0, app->icon_win,
                      ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
-                     GrabModeAsync, ob_cursors.move);
+                     GrabModeAsync, OB_CURSOR_MOVE);
 
     g_hash_table_insert(window_map, &app->icon_win, app);
 
 
     g_hash_table_insert(window_map, &app->icon_win, app);
 
index 6260e91..11eacbd 100644 (file)
@@ -671,7 +671,7 @@ static void event_handle_client(Client *client, XEvent *e)
        break;
     case EnterNotify:
         if (client_normal(client)) {
        break;
     case EnterNotify:
         if (client_normal(client)) {
-            if (ob_state == State_Starting) {
+            if (ob_state == OB_STATE_STARTING) {
                 /* move it to the top of the focus order */
                 guint desktop = client->desktop;
                 if (desktop == DESKTOP_ALL) desktop = screen_desktop;
                 /* move it to the top of the focus order */
                 guint desktop = client->desktop;
                 if (desktop == DESKTOP_ALL) desktop = screen_desktop;
@@ -722,7 +722,7 @@ static void event_handle_client(Client *client, XEvent *e)
        if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
                                               CWX | CWY)) {
            int x, y, w, h;
        if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
                                               CWX | CWY)) {
            int x, y, w, h;
-           Corner corner;
+           ObCorner corner;
               
            x = (e->xconfigurerequest.value_mask & CWX) ?
                e->xconfigurerequest.x : client->area.x;
               
            x = (e->xconfigurerequest.value_mask & CWX) ?
                e->xconfigurerequest.x : client->area.x;
@@ -736,17 +736,17 @@ static void event_handle_client(Client *client, XEvent *e)
            switch (client->gravity) {
            case NorthEastGravity:
            case EastGravity:
            switch (client->gravity) {
            case NorthEastGravity:
            case EastGravity:
-               corner = Corner_TopRight;
+               corner = OB_CORNER_TOPRIGHT;
                break;
            case SouthWestGravity:
            case SouthGravity:
                break;
            case SouthWestGravity:
            case SouthGravity:
-               corner = Corner_BottomLeft;
+               corner = OB_CORNER_BOTTOMLEFT;
                break;
            case SouthEastGravity:
                break;
            case SouthEastGravity:
-               corner = Corner_BottomRight;
+               corner = OB_CORNER_BOTTOMRIGHT;
                break;
            default:     /* NorthWest, Static, etc */
                break;
            default:     /* NorthWest, Static, etc */
-               corner = Corner_TopLeft;
+               corner = OB_CORNER_TOPLEFT;
            }
 
            client_configure(client, corner, x, y, w, h, FALSE, TRUE);
            }
 
            client_configure(client, corner, x, y, w, h, FALSE, TRUE);
@@ -920,7 +920,8 @@ static void event_handle_client(Client *client, XEvent *e)
             else
                 h = client->area.y;
             client->gravity = tmpg;
             else
                 h = client->area.y;
             client->gravity = tmpg;
-            client_configure(client, Corner_TopLeft, x, y, w, h, FALSE, TRUE);
+            client_configure(client, OB_CORNER_TOPLEFT,
+                             x, y, w, h, FALSE, TRUE);
             client->gravity = oldg;
         }
        break;
             client->gravity = oldg;
         }
        break;
index 12d30d2..8d5e6c5 100644 (file)
@@ -111,7 +111,7 @@ void focus_set_client(Client *client)
         push_to_top(client);
 
     /* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */
         push_to_top(client);
 
     /* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */
-    if (ob_state != State_Exiting) {
+    if (ob_state != OB_STATE_EXITING) {
         active = client ? client->window : None;
         PROP_SET32(ob_root, net_active_window, window, active);
     }
         active = client ? client->window : None;
         PROP_SET32(ob_root, net_active_window, window, active);
     }
index 5409fc7..a9e287d 100644 (file)
@@ -61,9 +61,9 @@ Frame *frame_new()
     self->iconify = createWindow(self->title, mask, &attrib);
     self->handle = createWindow(self->window, mask, &attrib);
     mask |= CWCursor;
     self->iconify = createWindow(self->title, mask, &attrib);
     self->handle = createWindow(self->window, mask, &attrib);
     mask |= CWCursor;
-    attrib.cursor = ob_cursors.bl;
+    attrib.cursor = ob_cursor(OB_CURSOR_SOUTHWEST);
     self->lgrip = createWindow(self->handle, mask, &attrib);
     self->lgrip = createWindow(self->handle, mask, &attrib);
-    attrib.cursor = ob_cursors.br;
+    attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
     self->rgrip = createWindow(self->handle, mask, &attrib);
 
     self->focused = FALSE;
     self->rgrip = createWindow(self->handle, mask, &attrib);
 
     self->focused = FALSE;
@@ -344,7 +344,7 @@ void frame_grab_client(Frame *self, Client *client)
       member set the root window, and one set to the client, but both get
       handled and need to be ignored.
     */
       member set the root window, and one set to the client, but both get
       handled and need to be ignored.
     */
-    if (ob_state == State_Starting)
+    if (ob_state == OB_STATE_STARTING)
        client->ignore_unmaps += 2;
 
     /* select the event mask on the client's parent (to receive config/map
        client->ignore_unmaps += 2;
 
     /* select the event mask on the client's parent (to receive config/map
index 7cb553a..3f87f3b 100644 (file)
@@ -32,7 +32,7 @@ gboolean grab_keyboard(gboolean grab)
     return ret;
 }
 
     return ret;
 }
 
-gboolean grab_pointer(gboolean grab, Cursor cur)
+gboolean grab_pointer(gboolean grab, ObCursor cur)
 {
     static guint pgrabs = 0;
     gboolean ret = FALSE;
 {
     static guint pgrabs = 0;
     gboolean ret = FALSE;
@@ -40,7 +40,8 @@ gboolean grab_pointer(gboolean grab, Cursor cur)
     if (grab) {
         if (pgrabs++ == 0)
             ret = XGrabPointer(ob_display, ob_root, False, GRAB_PTR_MASK,
     if (grab) {
         if (pgrabs++ == 0)
             ret = XGrabPointer(ob_display, ob_root, False, GRAB_PTR_MASK,
-                               GrabModeAsync, GrabModeAsync, FALSE, cur,
+                               GrabModeAsync, GrabModeAsync, FALSE,
+                               ob_cursor(cur),
                                event_lasttime) == Success;
         else
             ret = TRUE;
                                event_lasttime) == Success;
         else
             ret = TRUE;
@@ -52,7 +53,7 @@ gboolean grab_pointer(gboolean grab, Cursor cur)
     return ret;
 }
 
     return ret;
 }
 
-gboolean grab_pointer_window(gboolean grab, Cursor cur, Window win)
+gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win)
 {
     static guint pgrabs = 0;
     gboolean ret = FALSE;
 {
     static guint pgrabs = 0;
     gboolean ret = FALSE;
@@ -60,7 +61,8 @@ gboolean grab_pointer_window(gboolean grab, Cursor cur, Window win)
     if (grab) {
         if (pgrabs++ == 0)
             ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK,
     if (grab) {
         if (pgrabs++ == 0)
             ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK,
-                               GrabModeAsync, GrabModeAsync, TRUE, cur,
+                               GrabModeAsync, GrabModeAsync, TRUE,
+                               ob_cursor(cur),
                                event_lasttime) == Success;
         else
             ret = TRUE;
                                event_lasttime) == Success;
         else
             ret = TRUE;
@@ -113,13 +115,13 @@ void grab_shutdown()
 }
 
 void grab_button_full(guint button, guint state, Window win, guint mask,
 }
 
 void grab_button_full(guint button, guint state, Window win, guint mask,
-                      int pointer_mode, Cursor cursor)
+                      int pointer_mode, ObCursor cur)
 {
     guint i;
 
     for (i = 0; i < MASK_LIST_SIZE; ++i)
         XGrabButton(ob_display, button, state | mask_list[i], win, FALSE, mask,
 {
     guint i;
 
     for (i = 0; i < MASK_LIST_SIZE; ++i)
         XGrabButton(ob_display, button, state | mask_list[i], win, FALSE, mask,
-                    pointer_mode, GrabModeSync, None, cursor);
+                    pointer_mode, GrabModeSync, None, ob_cursor(cur));
 }
 
 void grab_button(guint button, guint state, Window win, guint mask)
 }
 
 void grab_button(guint button, guint state, Window win, guint mask)
index 78d7d26..39489ed 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __grab_h
 #define __grab_h
 
 #ifndef __grab_h
 #define __grab_h
 
+#include "misc.h"
+
 #include <glib.h>
 #include <X11/Xlib.h>
 
 #include <glib.h>
 #include <X11/Xlib.h>
 
@@ -8,13 +10,13 @@ void grab_startup();
 void grab_shutdown();
 
 gboolean grab_keyboard(gboolean grab);
 void grab_shutdown();
 
 gboolean grab_keyboard(gboolean grab);
-gboolean grab_pointer(gboolean grab, Cursor cur);
-gboolean grab_pointer_window(gboolean grab, Cursor cur, Window win);
+gboolean grab_pointer(gboolean grab, ObCursor cur);
+gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win);
 void grab_server(gboolean grab);
 
 void grab_button(guint button, guint state, Window win, guint mask);
 void grab_button_full(guint button, guint state, Window win, guint mask,
 void grab_server(gboolean grab);
 
 void grab_button(guint button, guint state, Window win, guint mask);
 void grab_button_full(guint button, guint state, Window win, guint mask,
-                      int pointer_mode, Cursor cursor);
+                      int pointer_mode, ObCursor cursor);
 void ungrab_button(guint button, guint state, Window win);
 
 void grab_key(guint keycode, guint state, Window win, int keyboard_mode);
 void ungrab_button(guint button, guint state, Window win);
 
 void grab_key(guint keycode, guint state, Window win, int keyboard_mode);
diff --git a/openbox/misc.h b/openbox/misc.h
new file mode 100644 (file)
index 0000000..5f84a98
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef __ob__misc_h
+#define __ob__misc_h
+
+typedef enum
+{
+    OB_CURSOR_POINTER,
+    OB_CURSOR_BUSY,
+    OB_CURSOR_MOVE,
+    OB_CURSOR_NORTH,
+    OB_CURSOR_NORTHEAST,
+    OB_CURSOR_EAST,
+    OB_CURSOR_SOUTHEAST,
+    OB_CURSOR_SOUTH,
+    OB_CURSOR_SOUTHWEST,
+    OB_CURSOR_WEST,
+    OB_CURSOR_NORTHWEST,
+    OB_NUM_CURSORS
+} ObCursor;
+
+typedef enum
+{
+    OB_KEY_RETURN,
+    OB_KEY_ESCAPE,
+    OB_KEY_LEFT,
+    OB_KEY_RIGHT,
+    OB_KEY_UP,
+    OB_KEY_DOWN,
+    OB_NUM_KEYS
+} ObKey;
+
+typedef enum
+{
+    OB_STATE_STARTING,
+    OB_STATE_RUNNING,
+    OB_STATE_EXITING
+} ObState;
+
+typedef enum
+{
+    OB_DIRECTION_NORTH,
+    OB_DIRECTION_NORTHEAST,
+    OB_DIRECTION_EAST,
+    OB_DIRECTION_SOUTHEAST,
+    OB_DIRECTION_SOUTH,
+    OB_DIRECTION_SOUTHWEST,
+    OB_DIRECTION_WEST,
+    OB_DIRECTION_NORTHWEST
+} ObDirection;
+
+typedef enum
+{
+    OB_ORIENTATION_HORZ,
+    OB_ORIENTATION_VERT
+} ObOrientation;
+
+typedef enum
+{
+    OB_CORNER_TOPLEFT,
+    OB_CORNER_TOPRIGHT,
+    OB_CORNER_BOTTOMLEFT,
+    OB_CORNER_BOTTOMRIGHT
+} ObCorner;
+
+#endif
index 63de5c5..9356468 100644 (file)
@@ -22,10 +22,7 @@ static int start_x, start_y, start_cx, start_cy, start_cw, start_ch;
 static int cur_x, cur_y;
 static guint button;
 static guint32 corner;
 static int cur_x, cur_y;
 static guint button;
 static guint32 corner;
-static Corner lockcorner;
-
-static guint button_return, button_escape, button_left, button_right,
-    button_up, button_down;
+static ObCorner lockcorner;
 
 static Popup *popup = NULL;
 static InternalWindow opaque_window = { { Window_Internal }, None };
 
 static Popup *popup = NULL;
 static InternalWindow opaque_window = { { Window_Internal }, None };
@@ -40,13 +37,6 @@ void moveresize_startup()
     XSetWindowAttributes attrib;
     XGCValues gcv;
 
     XSetWindowAttributes attrib;
     XGCValues gcv;
 
-    button_return = XKeysymToKeycode(ob_display, XStringToKeysym("Return"));
-    button_escape = XKeysymToKeycode(ob_display, XStringToKeysym("Escape"));
-    button_left = XKeysymToKeycode(ob_display, XStringToKeysym("Left"));
-    button_right = XKeysymToKeycode(ob_display, XStringToKeysym("Right"));
-    button_up = XKeysymToKeycode(ob_display, XStringToKeysym("Up"));
-    button_down = XKeysymToKeycode(ob_display, XStringToKeysym("Down"));
-
     popup = popup_new(FALSE);
     popup_size_to_string(popup, "W:  0000  W:  0000");
 
     popup = popup_new(FALSE);
     popup_size_to_string(popup, "W:  0000  W:  0000");
 
@@ -91,7 +81,7 @@ static void popup_coords(char *format, int a, int b)
 
 void moveresize_start(Client *c, int x, int y, guint b, guint32 cnr)
 {
 
 void moveresize_start(Client *c, int x, int y, guint b, guint32 cnr)
 {
-    Cursor cur;
+    ObCursor cur;
     Rect *a;
 
     g_assert(!moveresize_in_progress);
     Rect *a;
 
     g_assert(!moveresize_in_progress);
@@ -124,27 +114,27 @@ void moveresize_start(Client *c, int x, int y, guint b, guint32 cnr)
     moveresize_in_progress = TRUE;
 
     if (corner == prop_atoms.net_wm_moveresize_size_topleft)
     moveresize_in_progress = TRUE;
 
     if (corner == prop_atoms.net_wm_moveresize_size_topleft)
-        cur = ob_cursors.tl;
+        cur = OB_CURSOR_NORTHWEST;
     else if (corner == prop_atoms.net_wm_moveresize_size_top)
     else if (corner == prop_atoms.net_wm_moveresize_size_top)
-        cur = ob_cursors.t;
+        cur = OB_CURSOR_NORTH;
     else if (corner == prop_atoms.net_wm_moveresize_size_topright)
     else if (corner == prop_atoms.net_wm_moveresize_size_topright)
-        cur = ob_cursors.tr;
+        cur = OB_CURSOR_NORTHEAST;
     else if (corner == prop_atoms.net_wm_moveresize_size_right)
     else if (corner == prop_atoms.net_wm_moveresize_size_right)
-        cur = ob_cursors.r;
+        cur = OB_CURSOR_EAST;
     else if (corner == prop_atoms.net_wm_moveresize_size_bottomright)
     else if (corner == prop_atoms.net_wm_moveresize_size_bottomright)
-        cur = ob_cursors.br;
+        cur = OB_CURSOR_SOUTHEAST;
     else if (corner == prop_atoms.net_wm_moveresize_size_bottom)
     else if (corner == prop_atoms.net_wm_moveresize_size_bottom)
-        cur = ob_cursors.b;
+        cur = OB_CURSOR_SOUTH;
     else if (corner == prop_atoms.net_wm_moveresize_size_bottomleft)
     else if (corner == prop_atoms.net_wm_moveresize_size_bottomleft)
-        cur = ob_cursors.bl;
+        cur = OB_CURSOR_SOUTHWEST;
     else if (corner == prop_atoms.net_wm_moveresize_size_left)
     else if (corner == prop_atoms.net_wm_moveresize_size_left)
-        cur = ob_cursors.l;
+        cur = OB_CURSOR_WEST;
     else if (corner == prop_atoms.net_wm_moveresize_size_keyboard)
     else if (corner == prop_atoms.net_wm_moveresize_size_keyboard)
-        cur = ob_cursors.br;
+        cur = OB_CURSOR_SOUTHEAST;
     else if (corner == prop_atoms.net_wm_moveresize_move)
     else if (corner == prop_atoms.net_wm_moveresize_move)
-        cur = ob_cursors.move;
+        cur = OB_CURSOR_MOVE;
     else if (corner == prop_atoms.net_wm_moveresize_move_keyboard)
     else if (corner == prop_atoms.net_wm_moveresize_move_keyboard)
-        cur = ob_cursors.move;
+        cur = OB_CURSOR_MOVE;
     else
         g_assert_not_reached();
 
     else
         g_assert_not_reached();
 
@@ -177,7 +167,7 @@ void moveresize_end(gboolean cancel)
     popup_hide(popup);
 
     if (moving) {
     popup_hide(popup);
 
     if (moving) {
-        client_configure(moveresize_client, Corner_TopLeft,
+        client_configure(moveresize_client, OB_CORNER_TOPLEFT,
                          (cancel ? start_cx : cur_x),
                          (cancel ? start_cy : cur_y),
                          start_cw, start_ch, TRUE, TRUE);
                          (cancel ? start_cx : cur_x),
                          (cancel ? start_cy : cur_y),
                          start_cw, start_ch, TRUE, TRUE);
@@ -205,7 +195,7 @@ static void do_move()
     oldh = moveresize_client->frame->area.height;
     /* get where the client should be */
     frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
     oldh = moveresize_client->frame->area.height;
     /* get where the client should be */
     frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
-    client_configure(moveresize_client, Corner_TopLeft, cur_x, cur_y,
+    client_configure(moveresize_client, OB_CORNER_TOPLEFT, cur_x, cur_y,
                      start_cw, start_ch, TRUE, FALSE);
     /* draw the new one */
     if (moveresize_client->frame->area.x != oldx ||
                      start_cw, start_ch, TRUE, FALSE);
     /* draw the new one */
     if (moveresize_client->frame->area.x != oldx ||
@@ -297,72 +287,72 @@ void moveresize_event(XEvent *e)
             if (corner == prop_atoms.net_wm_moveresize_size_topleft) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
             if (corner == prop_atoms.net_wm_moveresize_size_topleft) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
-                lockcorner = Corner_BottomRight;
+                lockcorner = OB_CORNER_BOTTOMRIGHT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_top) {
                 cur_x = start_cw;
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
             } else if (corner == prop_atoms.net_wm_moveresize_size_top) {
                 cur_x = start_cw;
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
-                lockcorner = Corner_BottomRight;
+                lockcorner = OB_CORNER_BOTTOMRIGHT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_topright) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
             } else if (corner == prop_atoms.net_wm_moveresize_size_topright) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch - (e->xmotion.y_root - start_y);
-                lockcorner = Corner_BottomLeft;
+                lockcorner = OB_CORNER_BOTTOMLEFT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_right) { 
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch;
             } else if (corner == prop_atoms.net_wm_moveresize_size_right) { 
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch;
-                lockcorner = Corner_BottomLeft;
+                lockcorner = OB_CORNER_BOTTOMLEFT;
             } else if (corner ==
                        prop_atoms.net_wm_moveresize_size_bottomright) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
             } else if (corner ==
                        prop_atoms.net_wm_moveresize_size_bottomright) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
-                lockcorner = Corner_TopLeft;
+                lockcorner = OB_CORNER_TOPLEFT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_bottom) {
                 cur_x = start_cw;
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
             } else if (corner == prop_atoms.net_wm_moveresize_size_bottom) {
                 cur_x = start_cw;
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
-                lockcorner = Corner_TopLeft;
+                lockcorner = OB_CORNER_TOPLEFT;
             } else if (corner ==
                        prop_atoms.net_wm_moveresize_size_bottomleft) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
             } else if (corner ==
                        prop_atoms.net_wm_moveresize_size_bottomleft) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
-                lockcorner = Corner_TopRight;
+                lockcorner = OB_CORNER_TOPRIGHT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_left) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch;
             } else if (corner == prop_atoms.net_wm_moveresize_size_left) {
                 cur_x = start_cw - (e->xmotion.x_root - start_x);
                 cur_y = start_ch;
-                lockcorner = Corner_TopRight;
+                lockcorner = OB_CORNER_TOPRIGHT;
             } else if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
             } else if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
                 cur_x = start_cw + (e->xmotion.x_root - start_x);
                 cur_y = start_ch + (e->xmotion.y_root - start_y);
-                lockcorner = Corner_TopLeft;
+                lockcorner = OB_CORNER_TOPLEFT;
             } else
                 g_assert_not_reached();
 
             do_resize();
         }
     } else if (e->type == KeyPress) {
             } else
                 g_assert_not_reached();
 
             do_resize();
         }
     } else if (e->type == KeyPress) {
-        if (e->xkey.keycode == button_escape)
+        if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
             moveresize_end(TRUE);
             moveresize_end(TRUE);
-        else if (e->xkey.keycode == button_return)
+        else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
             moveresize_end(FALSE);
         else {
             if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
             moveresize_end(FALSE);
         else {
             if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
-                if (e->xkey.keycode == button_right)
+                if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
                     cur_x += MAX(4, moveresize_client->size_inc.width);
                     cur_x += MAX(4, moveresize_client->size_inc.width);
-                else if (e->xkey.keycode == button_left)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))
                     cur_x -= MAX(4, moveresize_client->size_inc.width);
                     cur_x -= MAX(4, moveresize_client->size_inc.width);
-                else if (e->xkey.keycode == button_down)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
                     cur_y += MAX(4, moveresize_client->size_inc.height);
                     cur_y += MAX(4, moveresize_client->size_inc.height);
-                else if (e->xkey.keycode == button_up)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
                     cur_y -= MAX(4, moveresize_client->size_inc.height);
                 else
                     return;
                 do_resize();
             } else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
                     cur_y -= MAX(4, moveresize_client->size_inc.height);
                 else
                     return;
                 do_resize();
             } else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
-                if (e->xkey.keycode == button_right)
+                if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
                     cur_x += 4;
                     cur_x += 4;
-                else if (e->xkey.keycode == button_left)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))
                     cur_x -= 4;
                     cur_x -= 4;
-                else if (e->xkey.keycode == button_down)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
                     cur_y += 4;
                     cur_y += 4;
-                else if (e->xkey.keycode == button_up)
+                else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
                     cur_y -= 4;
                 else
                     return;
                     cur_y -= 4;
                 else
                     return;
index 1298540..8f19b31 100644 (file)
@@ -60,13 +60,14 @@ RrTheme    *ob_rr_theme = NULL;
 Display    *ob_display = NULL;
 int         ob_screen;
 Window      ob_root;
 Display    *ob_display = NULL;
 int         ob_screen;
 Window      ob_root;
-State       ob_state;
+ObState     ob_state;
 gboolean    ob_shutdown = FALSE;
 gboolean    ob_restart  = FALSE;
 char       *ob_restart_path = NULL;
 gboolean    ob_remote   = TRUE;
 gboolean    ob_sync     = FALSE;
 gboolean    ob_shutdown = FALSE;
 gboolean    ob_restart  = FALSE;
 char       *ob_restart_path = NULL;
 gboolean    ob_remote   = TRUE;
 gboolean    ob_sync     = FALSE;
-Cursors     ob_cursors;
+Cursor      ob_cursors[OB_NUM_CURSORS];
+KeyCode     ob_keys[OB_NUM_KEYS];
 char       *ob_rc_path  = NULL;
 
 static void signal_handler(const ObEvent *e, void *data);
 char       *ob_rc_path  = NULL;
 
 static void signal_handler(const ObEvent *e, void *data);
@@ -92,7 +93,7 @@ int main(int argc, char **argv)
     xmlDocPtr doc;
     xmlNodePtr node;
 
     xmlDocPtr doc;
     xmlNodePtr node;
 
-    ob_state = State_Starting;
+    ob_state = OB_STATE_STARTING;
 
     /* initialize the locale */
     if (!setlocale(LC_ALL, ""))
 
     /* initialize the locale */
     if (!setlocale(LC_ALL, ""))
@@ -170,17 +171,43 @@ int main(int argc, char **argv)
        display we're using, so they open in the right place. */
     putenv(g_strdup_printf("DISPLAY=%s", DisplayString(ob_display)));
 
        display we're using, so they open in the right place. */
     putenv(g_strdup_printf("DISPLAY=%s", DisplayString(ob_display)));
 
-    ob_cursors.ptr = XCreateFontCursor(ob_display, XC_left_ptr);
-    ob_cursors.busy = XCreateFontCursor(ob_display, XC_watch);
-    ob_cursors.move = XCreateFontCursor(ob_display, XC_fleur);
-    ob_cursors.tl = XCreateFontCursor(ob_display, XC_top_left_corner);
-    ob_cursors.tr = XCreateFontCursor(ob_display, XC_top_right_corner);
-    ob_cursors.bl = XCreateFontCursor(ob_display, XC_bottom_left_corner);
-    ob_cursors.br = XCreateFontCursor(ob_display, XC_bottom_right_corner);
-    ob_cursors.t = XCreateFontCursor(ob_display, XC_top_side);
-    ob_cursors.r = XCreateFontCursor(ob_display, XC_right_side);
-    ob_cursors.b = XCreateFontCursor(ob_display, XC_bottom_side);
-    ob_cursors.l = XCreateFontCursor(ob_display, XC_left_side);
+    /* create available cursors */
+    ob_cursors[OB_CURSOR_POINTER] =
+        XCreateFontCursor(ob_display, XC_left_ptr);
+    ob_cursors[OB_CURSOR_BUSY] =
+        XCreateFontCursor(ob_display, XC_watch);
+    ob_cursors[OB_CURSOR_MOVE] =
+        XCreateFontCursor(ob_display, XC_fleur);
+    ob_cursors[OB_CURSOR_NORTH] =
+        XCreateFontCursor(ob_display, XC_top_side);
+    ob_cursors[OB_CURSOR_NORTHEAST] =
+        XCreateFontCursor(ob_display, XC_top_right_corner);
+    ob_cursors[OB_CURSOR_EAST] =
+        XCreateFontCursor(ob_display, XC_right_side);
+    ob_cursors[OB_CURSOR_SOUTHEAST] =
+        XCreateFontCursor(ob_display, XC_bottom_right_corner);
+    ob_cursors[OB_CURSOR_SOUTH] =
+        XCreateFontCursor(ob_display, XC_bottom_side);
+    ob_cursors[OB_CURSOR_SOUTHWEST] =
+        XCreateFontCursor(ob_display, XC_bottom_left_corner);
+    ob_cursors[OB_CURSOR_WEST] =
+        XCreateFontCursor(ob_display, XC_left_side);
+    ob_cursors[OB_CURSOR_NORTHWEST] =
+        XCreateFontCursor(ob_display, XC_top_left_corner);
+
+    /* create available keycodes */
+    ob_keys[OB_KEY_RETURN] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Return"));
+    ob_keys[OB_KEY_ESCAPE] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Escape"));
+    ob_keys[OB_KEY_LEFT] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Left"));
+    ob_keys[OB_KEY_RIGHT] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Right"));
+    ob_keys[OB_KEY_UP] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Up"));
+    ob_keys[OB_KEY_DOWN] =
+        XKeysymToKeycode(ob_display, XStringToKeysym("Down"));
 
     prop_startup(); /* get atoms values for the display */
     extensions_query_all(); /* find which extensions are present */
 
     prop_startup(); /* get atoms values for the display */
     extensions_query_all(); /* find which extensions are present */
@@ -232,10 +259,10 @@ int main(int argc, char **argv)
        /* get all the existing windows */
        client_manage_all();
 
        /* get all the existing windows */
        client_manage_all();
 
-       ob_state = State_Running;
+       ob_state = OB_STATE_RUNNING;
        while (!ob_shutdown)
            event_loop();
        while (!ob_shutdown)
            event_loop();
-       ob_state = State_Exiting;
+       ob_state = OB_STATE_EXITING;
 
         dock_remove_all();
        client_unmanage_all();
 
         dock_remove_all();
        client_unmanage_all();
@@ -564,3 +591,15 @@ static void exit_with_error(gchar *msg)
     sm_shutdown();
     exit(EXIT_FAILURE);
 }
     sm_shutdown();
     exit(EXIT_FAILURE);
 }
+
+Cursor ob_cursor(ObCursor cursor)
+{
+    g_assert(cursor < OB_NUM_CURSORS);
+    return ob_cursors[cursor];
+}
+
+KeyCode ob_keycode(ObKey key)
+{
+    g_assert(key < OB_NUM_KEYS);
+    return ob_keys[key];
+}
index 7723035..6900499 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __openbox_h
 #define __openbox_h
 
 #ifndef __openbox_h
 #define __openbox_h
 
+#include "misc.h"
+
 #include "render/render.h"
 #include "render/theme.h"
 
 #include "render/render.h"
 #include "render/theme.h"
 
@@ -27,15 +29,8 @@ extern int      ob_screen;
 /*! The root window */
 extern Window   ob_root;
 
 /*! The root window */
 extern Window   ob_root;
 
-/*! States of execution for Openbox */
-typedef enum {
-    State_Starting,
-    State_Exiting,
-    State_Running
-} State;
-
 /* The state of execution of the window manager */
 /* The state of execution of the window manager */
-extern State ob_state;
+extern ObState ob_state;
 
 /*! When set to true, Openbox will exit */
 extern gboolean ob_shutdown;
 
 /*! When set to true, Openbox will exit */
 extern gboolean ob_shutdown;
@@ -50,24 +45,13 @@ extern gboolean ob_remote;
 /*! Runtime option to run in synchronous mode */
 extern gboolean ob_sync;
 
 /*! Runtime option to run in synchronous mode */
 extern gboolean ob_sync;
 
-typedef struct Cursors {
-    Cursor ptr;
-    Cursor busy;
-    Cursor move;
-    Cursor bl;
-    Cursor br;
-    Cursor tl;
-    Cursor tr;
-    Cursor t;
-    Cursor r;
-    Cursor b;
-    Cursor l;
-} Cursors;
-extern Cursors ob_cursors;
-
 /*! The path of the rc file. If NULL the default paths are searched for one. */
 extern char *ob_rc_path;
 
 /*! The path of the rc file. If NULL the default paths are searched for one. */
 extern char *ob_rc_path;
 
+Cursor ob_cursor(ObCursor cursor);
+
+KeyCode ob_keycode(ObKey key);
+
 /* cuz i have nowhere better to put it right now... */
 gboolean ob_pointer_pos(int *x, int *y);
 
 /* cuz i have nowhere better to put it right now... */
 gboolean ob_pointer_pos(int *x, int *y);
 
index 75cc3c4..4998d97 100644 (file)
@@ -247,7 +247,7 @@ void screen_resize()
     screen_physical_size.height = geometry[1] = h;
     PROP_SETA32(ob_root, net_desktop_geometry, cardinal, geometry, 2);
 
     screen_physical_size.height = geometry[1] = h;
     PROP_SETA32(ob_root, net_desktop_geometry, cardinal, geometry, 2);
 
-    if (ob_state == State_Starting)
+    if (ob_state == OB_STATE_STARTING)
        return;
 
     dock_configure();
        return;
 
     dock_configure();
@@ -355,33 +355,42 @@ void screen_set_desktop(guint num)
 
 void screen_update_layout()
 {
 
 void screen_update_layout()
 {
-    guint32 *data = NULL;
+    ObOrientation orient;
+    ObCorner corner;
+    guint rows;
+    guint cols;
+    guint32 *data;
     guint num;
     guint num;
-
-    /* defaults */
-    screen_desktop_layout.orientation = prop_atoms.net_wm_orientation_horz;
-    screen_desktop_layout.start_corner = prop_atoms.net_wm_topleft;
-    screen_desktop_layout.rows = 1;
-    screen_desktop_layout.columns = screen_num_desktops;
+    gboolean valid = FALSE;
 
     if (PROP_GETA32(ob_root, net_desktop_layout, cardinal, &data, &num)) {
         if (num == 3 || num == 4) {
 
     if (PROP_GETA32(ob_root, net_desktop_layout, cardinal, &data, &num)) {
         if (num == 3 || num == 4) {
+
             if (data[0] == prop_atoms.net_wm_orientation_vert)
             if (data[0] == prop_atoms.net_wm_orientation_vert)
-                screen_desktop_layout.orientation = data[0];
-            if (num == 3)
-                screen_desktop_layout.start_corner =
-                    prop_atoms.net_wm_topright;
+                orient = OB_ORIENTATION_VERT;
+            else if (data[0] == prop_atoms.net_wm_orientation_horz)
+                orient = OB_ORIENTATION_HORZ;
+            else
+                goto screen_update_layout_bail;
+
+            if (num < 4)
+                corner = OB_CORNER_TOPLEFT;
             else {
                 if (data[3] == prop_atoms.net_wm_topright)
             else {
                 if (data[3] == prop_atoms.net_wm_topright)
-                    screen_desktop_layout.start_corner = data[3];
+                    corner = OB_CORNER_TOPRIGHT;
                 else if (data[3] == prop_atoms.net_wm_bottomright)
                 else if (data[3] == prop_atoms.net_wm_bottomright)
-                    screen_desktop_layout.start_corner = data[3];
+                    corner = OB_CORNER_BOTTOMRIGHT;
                 else if (data[3] == prop_atoms.net_wm_bottomleft)
                 else if (data[3] == prop_atoms.net_wm_bottomleft)
-                    screen_desktop_layout.start_corner = data[3];
+                    corner = OB_CORNER_BOTTOMLEFT;
+                else
+                    goto screen_update_layout_bail;
             }
 
             /* fill in a zero rows/columns */
             }
 
             /* fill in a zero rows/columns */
-            if (!(data[1] == 0 && data[2] == 0)) { /* both 0's is bad data.. */
+            if ((data[1] == 0 && data[2] == 0) || /* both 0's is bad data.. */
+                (data[1] != 0 && data[2] != 0)) { /* no 0's is bad data.. */
+                goto screen_update_layout_bail;
+            } else {
                 if (data[1] == 0) {
                     data[1] = (screen_num_desktops +
                                screen_num_desktops % data[2]) / data[2];
                 if (data[1] == 0) {
                     data[1] = (screen_num_desktops +
                                screen_num_desktops % data[2]) / data[2];
@@ -389,38 +398,39 @@ void screen_update_layout()
                     data[2] = (screen_num_desktops +
                                screen_num_desktops % data[1]) / data[1];
                 }
                     data[2] = (screen_num_desktops +
                                screen_num_desktops % data[1]) / data[1];
                 }
-                screen_desktop_layout.columns = data[1];
-                screen_desktop_layout.rows = data[2];
+                cols = data[1];
+                rows = data[2];
             }
 
             /* bounds checking */
             }
 
             /* bounds checking */
-            if (screen_desktop_layout.orientation ==
-                prop_atoms.net_wm_orientation_horz) {
-                if (screen_desktop_layout.rows > screen_num_desktops)
-                    screen_desktop_layout.rows = screen_num_desktops;
-                if (screen_desktop_layout.columns >
-                    ((screen_num_desktops + screen_num_desktops %
-                      screen_desktop_layout.rows) /
-                     screen_desktop_layout.rows))
-                    screen_desktop_layout.columns =
-                        (screen_num_desktops + screen_num_desktops %
-                         screen_desktop_layout.rows) /
-                        screen_desktop_layout.rows;
+            if (orient == OB_ORIENTATION_HORZ) {
+                rows = MIN(rows, screen_num_desktops);
+                cols = MIN(cols, ((screen_num_desktops +
+                                     (screen_num_desktops % rows)) / rows));
             } else {
             } else {
-                if (screen_desktop_layout.columns > screen_num_desktops)
-                    screen_desktop_layout.columns = screen_num_desktops;
-                if (screen_desktop_layout.rows >
-                    ((screen_num_desktops + screen_num_desktops %
-                      screen_desktop_layout.columns) /
-                     screen_desktop_layout.columns))
-                    screen_desktop_layout.rows =
-                        (screen_num_desktops + screen_num_desktops %
-                         screen_desktop_layout.columns) /
-                        screen_desktop_layout.columns;
+                cols = MIN(cols, screen_num_desktops);
+                rows = MIN(rows, ((screen_num_desktops +
+                                     (screen_num_desktops % cols)) / cols));
             }
             }
+
+            valid = TRUE;
         }
         }
-       g_free(data);
+    screen_update_layout_bail:
+        g_free(data);
     }
     }
+
+    if (!valid) {
+        /* defaults */
+        orient = OB_ORIENTATION_HORZ;
+        corner = OB_CORNER_TOPLEFT;
+        rows = 1;
+        cols = screen_num_desktops;
+    }
+
+    screen_desktop_layout.orientation = orient;
+    screen_desktop_layout.start_corner = corner;
+    screen_desktop_layout.rows = rows;
+    screen_desktop_layout.columns = cols;
 }
 
 void screen_update_desktop_names()
 }
 
 void screen_update_desktop_names()
@@ -715,10 +725,10 @@ static void set_root_cursor()
 {
 #ifdef USE_LIBSN
         if (sn_busy_cnt)
 {
 #ifdef USE_LIBSN
         if (sn_busy_cnt)
-            XDefineCursor(ob_display, ob_root, ob_cursors.busy);
+            XDefineCursor(ob_display, ob_root, ob_cursor(OB_CURSOR_BUSY));
         else
 #endif
         else
 #endif
-            XDefineCursor(ob_display, ob_root, ob_cursors.ptr);
+            XDefineCursor(ob_display, ob_root, ob_cursor(OB_CURSOR_POINTER));
 }
 
 #ifdef USE_LIBSN
 }
 
 #ifdef USE_LIBSN
index 42e3dc1..b68f6ea 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __screen_h
 #define __screen_h
 
 #ifndef __screen_h
 #define __screen_h
 
+#include "misc.h"
 #include "geom.h"
 #include "client.h"
 
 #include "geom.h"
 #include "client.h"
 
@@ -17,15 +18,9 @@ extern guint screen_desktop;
 /*! Are we in showing-desktop mode? */
 extern gboolean screen_showing_desktop;
 
 /*! Are we in showing-desktop mode? */
 extern gboolean screen_showing_desktop;
 
-/*! Orientation of the desktops */
-typedef enum {
-    Orientation_Horz = 0,
-    Orientation_Vert = 1
-} Orientation;
-
 typedef struct DesktopLayout {
 typedef struct DesktopLayout {
-    Orientation orientation;
-    Corner start_corner;
+    ObOrientation orientation;
+    ObCorner start_corner;
     guint rows;
     guint columns;
 } DesktopLayout;
     guint rows;
     guint columns;
 } DesktopLayout;
index 6316049..c3d485f 100644 (file)
@@ -18,7 +18,7 @@ void stacking_set_list()
     /* on shutdown, don't update the properties, so that we can read it back
        in on startup and re-stack the windows as they were before we shut down
     */
     /* on shutdown, don't update the properties, so that we can read it back
        in on startup and re-stack the windows as they were before we shut down
     */
-    if (ob_state == State_Exiting) return;
+    if (ob_state == OB_STATE_EXITING) return;
 
     /* create an array of the window ids (from bottom to top,
        reverse order!) */
 
     /* create an array of the window ids (from bottom to top,
        reverse order!) */
index 3fe74ae..45b93ac 100644 (file)
@@ -78,7 +78,7 @@ void plugin_setup_config()
 KeyBindingTree *firstnode = NULL;
 
 static KeyBindingTree *curpos;
 KeyBindingTree *firstnode = NULL;
 
 static KeyBindingTree *curpos;
-static guint reset_key, reset_state, button_return, button_escape;
+static guint reset_key, reset_state;
 static Timer *chain_timer;
 
 static void grab_for_window(Window win, gboolean grab)
 static Timer *chain_timer;
 
 static void grab_for_window(Window win, gboolean grab)
@@ -177,9 +177,9 @@ static void event(ObEvent *e, void *foo)
              !(grabbed_key->state & e->data.x.e->xkey.state)))
             done = TRUE;
         else if (e->type == Event_X_KeyPress) {
              !(grabbed_key->state & e->data.x.e->xkey.state)))
             done = TRUE;
         else if (e->type == Event_X_KeyPress) {
-            if (e->data.x.e->xkey.keycode == button_return)
+            if (e->data.x.e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
                 done = TRUE;
                 done = TRUE;
-            else if (e->data.x.e->xkey.keycode == button_escape) {
+            else if (e->data.x.e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
                 GSList *it;
                 for (it = grabbed_key->actions; it; it = it->next) {
                     Action *act = it->data;
                 GSList *it;
                 for (it = grabbed_key->actions; it; it = it->next) {
                     Action *act = it->data;
@@ -258,8 +258,6 @@ static void event(ObEvent *e, void *foo)
 
 void plugin_startup()
 {
 
 void plugin_startup()
 {
-    guint i;
-
     curpos = NULL;
     chain_timer = NULL;
 
     curpos = NULL;
     chain_timer = NULL;
 
@@ -268,8 +266,6 @@ void plugin_startup()
                       (EventHandler)event, NULL);
 
     translate_key("C-g", &reset_state, &reset_key);
                       (EventHandler)event, NULL);
 
     translate_key("C-g", &reset_state, &reset_key);
-    translate_key("Escape", &i, &button_escape);
-    translate_key("Return", &i, &button_return);
 
     grab_keys(TRUE);
 }
 
     grab_keys(TRUE);
 }
index 797aef3..f2b4ea6 100644 (file)
@@ -58,7 +58,7 @@ gboolean place_history(Client *c)
 
     if (hi && !(hi->flags & PLACED)) {
         hi->flags |= PLACED;
 
     if (hi && !(hi->flags & PLACED)) {
         hi->flags |= PLACED;
-        if (ob_state != State_Starting) {
+        if (ob_state != OB_STATE_STARTING) {
             if (hi->flags & HAVE_POSITION ||
                 hi->flags & HAVE_SIZE) {
                 if (hi->flags & HAVE_POSITION) {
             if (hi->flags & HAVE_POSITION ||
                 hi->flags & HAVE_SIZE) {
                 if (hi->flags & HAVE_POSITION) {
@@ -77,7 +77,7 @@ gboolean place_history(Client *c)
                     w = c->area.width;
                     h = c->area.height;
                 }
                     w = c->area.width;
                     h = c->area.height;
                 }
-                client_configure(c, Corner_TopLeft, x, y, w, h,
+                client_configure(c, OB_CORNER_TOPLEFT, x, y, w, h,
                                  TRUE, TRUE);
             }
             if (hi->flags & HAVE_DESKTOP) {
                                  TRUE, TRUE);
             }
             if (hi->flags & HAVE_DESKTOP) {
index 589e0a3..b567e22 100644 (file)
@@ -30,7 +30,7 @@ static void place_random(Client *c)
     int x, y;
     Rect *area;
 
     int x, y;
     Rect *area;
 
-    if (ob_state == State_Starting) return;
+    if (ob_state == OB_STATE_STARTING) return;
 
     area = screen_area_monitor(c->desktop,
                                g_random_int_range(0, screen_num_monitors));
 
     area = screen_area_monitor(c->desktop,
                                g_random_int_range(0, screen_num_monitors));
@@ -46,7 +46,7 @@ static void place_random(Client *c)
     else       y = 0;
 
     frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */
     else       y = 0;
 
     frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */
-    client_configure(c, Corner_TopLeft, x, y, c->area.width, c->area.height,
+    client_configure(c, OB_CORNER_TOPLEFT, x, y, c->area.width, c->area.height,
                      TRUE, TRUE);
 }
 
                      TRUE, TRUE);
 }
 
index 3184475..b9539e4 100644 (file)
@@ -131,7 +131,7 @@ static void resist_move(Client *c, int *x, int *y)
     }
 }
 
     }
 }
 
-static void resist_size(Client *c, int *w, int *h, Corner corn)
+static void resist_size(Client *c, int *w, int *h, ObCorner corn)
 {
     GList *it;
     Client *target; /* target */
 {
     GList *it;
     Client *target; /* target */
@@ -177,15 +177,15 @@ static void resist_size(Client *c, int *w, int *h, Corner corn)
                 /* horizontal snapping */
                 if (t < tb && b > tt) {
                     switch (corn) {
                 /* horizontal snapping */
                 if (t < tb && b > tt) {
                     switch (corn) {
-                    case Corner_TopLeft:
-                    case Corner_BottomLeft:
+                    case OB_CORNER_TOPLEFT:
+                    case OB_CORNER_BOTTOMLEFT:
                         dlt = l;
                         drb = r + *w - c->frame->area.width;
                         if (r < tl && drb >= tl && drb < tl + resistance)
                             *w = tl - l, snapx = target;
                         break;
                         dlt = l;
                         drb = r + *w - c->frame->area.width;
                         if (r < tl && drb >= tl && drb < tl + resistance)
                             *w = tl - l, snapx = target;
                         break;
-                    case Corner_TopRight:
-                    case Corner_BottomRight:
+                    case OB_CORNER_TOPRIGHT:
+                    case OB_CORNER_BOTTOMRIGHT:
                         dlt = l - *w + c->frame->area.width;
                         drb = r;
                         if (l > tr && dlt <= tr && dlt > tr - resistance)
                         dlt = l - *w + c->frame->area.width;
                         drb = r;
                         if (l > tr && dlt <= tr && dlt > tr - resistance)
@@ -199,15 +199,15 @@ static void resist_size(Client *c, int *w, int *h, Corner corn)
                 /* vertical snapping */
                 if (l < tr && r > tl) {
                     switch (corn) {
                 /* vertical snapping */
                 if (l < tr && r > tl) {
                     switch (corn) {
-                    case Corner_TopLeft:
-                    case Corner_TopRight:
+                    case OB_CORNER_TOPLEFT:
+                    case OB_CORNER_TOPRIGHT:
                         dlt = t;
                         drb = b + *h - c->frame->area.height;
                         if (b < tt && drb >= tt && drb < tt + resistance)
                             *h = tt - t, snapy = target;
                         break;
                         dlt = t;
                         drb = b + *h - c->frame->area.height;
                         if (b < tt && drb >= tt && drb < tt + resistance)
                             *h = tt - t, snapy = target;
                         break;
-                    case Corner_BottomLeft:
-                    case Corner_BottomRight:
+                    case OB_CORNER_BOTTOMLEFT:
+                    case OB_CORNER_BOTTOMRIGHT:
                         dlt = t - *h + c->frame->area.height;
                         drb = b;
                         if (t > tb && dlt <= tb && dlt > tb - resistance)
                         dlt = t - *h + c->frame->area.height;
                         drb = b;
                         if (t > tb && dlt <= tb && dlt > tb - resistance)
@@ -226,15 +226,15 @@ static void resist_size(Client *c, int *w, int *h, Corner corn)
     
     /* horizontal snapping */
     switch (corn) {
     
     /* horizontal snapping */
     switch (corn) {
-    case Corner_TopLeft:
-    case Corner_BottomLeft:
+    case OB_CORNER_TOPLEFT:
+    case OB_CORNER_BOTTOMLEFT:
         dlt = l;
         drb = r + *w - c->frame->area.width;
         if (r <= ar && drb > ar && drb <= ar + resistance)
             *w = ar - l + 1;
         break;
         dlt = l;
         drb = r + *w - c->frame->area.width;
         if (r <= ar && drb > ar && drb <= ar + resistance)
             *w = ar - l + 1;
         break;
-    case Corner_TopRight:
-    case Corner_BottomRight:
+    case OB_CORNER_TOPRIGHT:
+    case OB_CORNER_BOTTOMRIGHT:
         dlt = l - *w + c->frame->area.width;
         drb = r;
         if (l >= al && dlt < al && dlt >= al - resistance)
         dlt = l - *w + c->frame->area.width;
         drb = r;
         if (l >= al && dlt < al && dlt >= al - resistance)
@@ -244,15 +244,15 @@ static void resist_size(Client *c, int *w, int *h, Corner corn)
 
     /* vertical snapping */
     switch (corn) {
 
     /* vertical snapping */
     switch (corn) {
-    case Corner_TopLeft:
-    case Corner_TopRight:
+    case OB_CORNER_TOPLEFT:
+    case OB_CORNER_TOPRIGHT:
         dlt = t;
         drb = b + *h - c->frame->area.height;
         if (b <= ab && drb > ab && drb <= ab + resistance)
             *h = ab - t + 1;
         break;
         dlt = t;
         drb = b + *h - c->frame->area.height;
         if (b <= ab && drb > ab && drb <= ab + resistance)
             *h = ab - t + 1;
         break;
-    case Corner_BottomLeft:
-    case Corner_BottomRight:
+    case OB_CORNER_BOTTOMLEFT:
+    case OB_CORNER_BOTTOMRIGHT:
         dlt = t - *h + c->frame->area.height;
         drb = b;
         if (t >= at && dlt < at && dlt >= at - resistance)
         dlt = t - *h + c->frame->area.height;
         drb = b;
         if (t >= at && dlt < at && dlt >= at - resistance)