From 122d55fbadea0409fbc902a1740e1c8ff3aecd88 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Jul 2003 17:03:05 +0000 Subject: [PATCH] prefixing and capitalizing the StackLayer -> ObStackingLayer enum. less includes in headers for less rebuilding on changes --- openbox/action.h | 28 ++++++++++++++-------------- openbox/client.c | 25 +++++++++++++------------ openbox/client.h | 2 +- openbox/config.c | 24 ++++++++++++------------ openbox/config.h | 11 +++++------ openbox/dispatch.c | 1 + openbox/dispatch.h | 29 ++++++++++++++++------------- openbox/dock.c | 3 ++- openbox/event.c | 2 +- openbox/extensions.h | 3 +++ openbox/framerender.c | 5 +++-- openbox/framerender.h | 4 ++-- openbox/menu.c | 1 + openbox/menu.h | 11 +++++++---- openbox/menu_render.c | 8 +++++--- openbox/moveresize.c | 1 + openbox/popup.h | 6 +++--- openbox/screen.h | 1 - openbox/stacking.c | 18 +++++++++--------- openbox/stacking.h | 18 +++++++++--------- openbox/window.c | 4 ++-- openbox/window.h | 8 ++++++-- plugins/keyboard/keyboard.c | 1 + 23 files changed, 117 insertions(+), 97 deletions(-) diff --git a/openbox/action.h b/openbox/action.h index e84a273f..3abf7f2b 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -1,7 +1,7 @@ #ifndef __action_h #define __action_h -#include "client.h" +#include "misc.h" #include "parser/parse.h" /* These have to all have a Client* at the top even if they don't use it, so @@ -10,57 +10,57 @@ */ struct AnyAction { - ObClient *c; + struct _ObClient *c; }; struct DirectionalAction{ - ObClient *c; + struct _ObClient *c; ObDirection direction; }; struct Execute { - ObClient *c; + struct _ObClient *c; char *path; }; struct ClientAction { - ObClient *c; + struct _ObClient *c; }; struct MoveResizeRelative { - ObClient *c; + struct _ObClient *c; int delta; }; struct SendToDesktop { - ObClient *c; + struct _ObClient *c; guint desk; gboolean follow; }; struct SendToDesktopDirection { - ObClient *c; + struct _ObClient *c; gboolean wrap; gboolean follow; }; struct Desktop { - ObClient *c; + struct _ObClient *c; guint desk; }; struct Layer { - ObClient *c; + struct _ObClient *c; int layer; /* < 0 = below, 0 = normal, > 0 = above */ }; struct DesktopDirection { - ObClient *c; + struct _ObClient *c; gboolean wrap; }; struct MoveResize { - ObClient *c; + struct _ObClient *c; int x; int y; guint32 corner; /* prop_atoms.net_wm_moveresize_* */ @@ -68,14 +68,14 @@ struct MoveResize { }; struct ShowMenu { - ObClient *c; + struct _ObClient *c; char *name; int x; int y; }; struct CycleWindows { - ObClient *c; + struct _ObClient *c; gboolean linear; gboolean forward; gboolean final; diff --git a/openbox/client.c b/openbox/client.c index 141bfcb9..0dab31d0 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1485,27 +1485,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 +1527,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; diff --git a/openbox/client.h b/openbox/client.h index 9c96351e..24cefe30 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -223,7 +223,7 @@ struct _ObClient /*! The layer in which the window will be stacked, windows in lower layers are always below windows in higher layers. */ - StackLayer layer; + ObStackingLayer layer; /*! A bitmask of values in the Decoration enum The values in the variable are the decorations that the client wants to diff --git a/openbox/config.c b/openbox/config.c index 4fd251da..42d479af 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -15,14 +15,14 @@ GSList *config_desktops_names; gboolean config_opaque_move; gboolean config_opaque_resize; -StackLayer config_dock_layer; -gboolean config_dock_floating; -ObDirection config_dock_pos; -int config_dock_x; -int config_dock_y; -ObOrientation config_dock_orient; -gboolean config_dock_hide; -guint config_dock_hide_timeout; +ObStackingLayer config_dock_layer; +gboolean config_dock_floating; +ObDirection config_dock_pos; +gint config_dock_x; +gint config_dock_y; +ObOrientation config_dock_orient; +gboolean config_dock_hide; +guint config_dock_hide_timeout; static void parse_focus(xmlDocPtr doc, xmlNodePtr node, void *d) { @@ -124,11 +124,11 @@ static void parse_dock(xmlDocPtr doc, xmlNodePtr node, void *d) } if ((n = parse_find_node("stacking", node))) { if (parse_contains("top", doc, n)) - config_dock_layer = Layer_Top; + config_dock_layer = OB_STACKING_LAYER_TOP; else if (parse_contains("normal", doc, n)) - config_dock_layer = Layer_Normal; + config_dock_layer = OB_STACKING_LAYER_NORMAL; else if (parse_contains("bottom", doc, n)) - config_dock_layer = Layer_Below; + config_dock_layer = OB_STACKING_LAYER_BELOW; } if ((n = parse_find_node("direction", node))) { if (parse_contains("horizontal", doc, n)) @@ -166,7 +166,7 @@ void config_startup() parse_register("moveresize", parse_moveresize, NULL); - config_dock_layer = Layer_Top; + config_dock_layer = OB_STACKING_LAYER_TOP; config_dock_pos = OB_DIRECTION_NORTHEAST; config_dock_floating = FALSE; config_dock_x = 0; diff --git a/openbox/config.h b/openbox/config.h index 41e84fde..79f8432c 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -2,7 +2,6 @@ #define __config_h #include "misc.h" -#include "dock.h" #include "stacking.h" #include @@ -27,17 +26,17 @@ extern gboolean config_opaque_move; extern gboolean config_opaque_resize; /*! The stacking layer the dock will reside in */ -extern StackLayer config_dock_layer; +extern ObStackingLayer config_dock_layer; /*! Is the dock floating */ extern gboolean config_dock_floating; /*! Where to place the dock if not floating */ extern ObDirection config_dock_pos; -/*! If config_dock_pos is DockPos_Floating, this is the top-left corner's +/*! If config_dock_floating, this is the top-left corner's position */ -extern int config_dock_x; -/*! If config_dock_pos is DockPos_Floating, this is the top-left corner's +extern gint config_dock_x; +/*! If config_dock_floating, this is the top-left corner's position */ -extern int config_dock_y; +extern gint config_dock_y; /*! Whether the dock places the dockapps in it horizontally or vertically */ extern ObOrientation config_dock_orient; /*! Whether to auto-hide the dock when the pointer is not over it */ diff --git a/openbox/dispatch.c b/openbox/dispatch.c index 9bcf9963..291e9580 100644 --- a/openbox/dispatch.c +++ b/openbox/dispatch.c @@ -1,5 +1,6 @@ #include "dispatch.h" #include "extensions.h" +#include "client.h" #include diff --git a/openbox/dispatch.h b/openbox/dispatch.h index 320c46a6..93b3e459 100644 --- a/openbox/dispatch.h +++ b/openbox/dispatch.h @@ -1,9 +1,12 @@ #ifndef __dispatch_h #define __dispatch_h -#include "client.h" +#include "misc.h" + #include +struct _ObClient; + void dispatch_startup(); void dispatch_shutdown(); @@ -41,23 +44,23 @@ typedef enum { typedef struct { XEvent *e; - ObClient *client; + struct _ObClient *client; } EventData_X; typedef struct { - ObClient *client; + struct _ObClient *client; int num[3]; - /* Event_ObClient_Desktop: num[0] = new number, num[1] = old number - Event_ObClient_Urgent: num[0] = urgent state - Event_ObClient_Moving: num[0] = dest x coord, num[1] = dest y coord -- + /* Event_Client_Desktop: num[0] = new number, num[1] = old number + Event_Client_Urgent: num[0] = urgent state + Event_Client_Moving: num[0] = dest x coord, num[1] = dest y coord -- change these in the handler to adjust where the window will be placed - Event_ObClient_Resizing: num[0] = dest width, num[1] = dest height -- + Event_Client_Resizing: num[0] = dest width, num[1] = dest height -- change these in the handler to adjust where the window will be placed num[2] = the anchored corner */ -} EventData_ObClient; +} EventData_Client; typedef struct { int num[2]; @@ -73,7 +76,7 @@ typedef struct { typedef struct { EventData_X x; /* for Event_X_* event types */ - EventData_ObClient c; /* for Event_ObClient_* event types */ + EventData_Client c; /* for Event_ObClient_* event types */ EventData_Ob o; /* for Event_Ob_* event types */ EventData_Signal s; /* for Event_Signal */ } EventData; @@ -89,15 +92,15 @@ typedef unsigned int EventMask; void dispatch_register(EventMask mask, EventHandler h, void *data); -void dispatch_x(XEvent *e, ObClient *c); -void dispatch_client(EventType e, ObClient *c, int num0, int num1); +void dispatch_x(XEvent *e, struct _ObClient *c); +void dispatch_client(EventType e, struct _ObClient *c, int num0, int num1); void dispatch_ob(EventType e, int num0, int num1); void dispatch_signal(int signal); /* *x and *y should be set with the destination of the window, they may be changed by the event handlers */ -void dispatch_move(ObClient *c, int *x, int *y); +void dispatch_move(struct _ObClient *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(ObClient *c, int *w, int *h, ObCorner corner); +void dispatch_resize(struct _ObClient *c, int *w, int *h, ObCorner corner); #endif diff --git a/openbox/dock.c b/openbox/dock.c index cb41f7ee..da9bdd2a 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -33,7 +33,8 @@ void dock_startup() CWOverrideRedirect | CWEventMask, &attrib); dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_unfocused_title); - XSetWindowBorder(ob_display, dock->frame, ob_rr_theme->b_color->pixel); + XSetWindowBorder(ob_display, dock->frame, + RrColorPixel(ob_rr_theme->b_color)); XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->bwidth); g_hash_table_insert(window_map, &dock->frame, dock); diff --git a/openbox/event.c b/openbox/event.c index 7a1f66e9..b6899a8b 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -662,7 +662,7 @@ static void event_handle_client(ObClient *client, XEvent *e) /* are we a fullscreen window or a transient of one? (checks layer) if we are then we need to be iconified since we are losing focus */ - if (client->layer == Layer_Fullscreen && !client->iconic && + if (client->layer == OB_STACKING_LAYER_FULLSCREEN && !client->iconic && !client_search_focus_tree_full(client)) /* iconify fullscreen windows when they and their transients aren't focused */ diff --git a/openbox/extensions.h b/openbox/extensions.h index e8262768..51dafd92 100644 --- a/openbox/extensions.h +++ b/openbox/extensions.h @@ -1,6 +1,8 @@ #ifndef __extensions_h #define __extensions_h +#include "geom.h" + #include #ifdef XKB #include @@ -17,6 +19,7 @@ #ifdef VIDMODE #include #endif + #include /*! Does the display have the XKB extension? */ diff --git a/openbox/framerender.c b/openbox/framerender.c index ec69c983..b73077cd 100644 --- a/openbox/framerender.c +++ b/openbox/framerender.c @@ -1,6 +1,7 @@ #include "frame.h" #include "openbox.h" #include "screen.h" +#include "client.h" #include "framerender.h" #include "render/theme.h" @@ -16,10 +17,10 @@ void framerender_frame(ObFrame *self) { if (self->focused) XSetWindowBorder(ob_display, self->plate, - ob_rr_theme->cb_focused_color->pixel); + RrColorPixel(ob_rr_theme->cb_focused_color)); else XSetWindowBorder(ob_display, self->plate, - ob_rr_theme->cb_unfocused_color->pixel); + RrColorPixel(ob_rr_theme->cb_unfocused_color)); if (self->client->decorations & Decor_Titlebar) { RrAppearance *t, *l, *m, *n, *i, *d, *s, *c; diff --git a/openbox/framerender.h b/openbox/framerender.h index 1aee9027..42e29fab 100644 --- a/openbox/framerender.h +++ b/openbox/framerender.h @@ -1,8 +1,8 @@ #ifndef __framerender_h #define __framerender_h -#include "frame.h" +struct _ObFrame; -void framerender_frame(ObFrame *self); +void framerender_frame(struct _ObFrame *self); #endif diff --git a/openbox/menu.c b/openbox/menu.c index 582b7a36..c12fadf9 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -1,6 +1,7 @@ #include "menu.h" #include "openbox.h" #include "stacking.h" +#include "client.h" #include "grab.h" #include "screen.h" #include "geom.h" diff --git a/openbox/menu.h b/openbox/menu.h index d9cb2a8f..9beb8f2a 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -2,16 +2,19 @@ #define __menu_h #include "action.h" +#include "window.h" #include "render/render.h" #include "geom.h" #include +struct _ObClient; + struct Menu; struct MenuEntry; typedef void(*menu_controller_show)(struct Menu *self, - int x, int y, ObClient *); + int x, int y, struct _ObClient *); typedef void(*menu_controller_update)(struct Menu *self); typedef void(*menu_controller_mouseover)(struct MenuEntry *self, gboolean enter); @@ -45,7 +48,7 @@ typedef struct Menu { /* render stuff */ - ObClient *client; + struct _ObClient *client; Window frame; Window title; RrAppearance *a_title; @@ -104,8 +107,8 @@ Menu *menu_new_full(char *label, char *name, Menu *parent, menu_controller_show show, menu_controller_update update); void menu_free(char *name); -void menu_show(char *name, int x, int y, ObClient *client); -void menu_show_full(Menu *menu, int x, int y, ObClient *client); +void menu_show(char *name, int x, int y, struct _ObClient *client); +void menu_show_full(Menu *menu, int x, int y, struct _ObClient *client); void menu_hide(Menu *self); diff --git a/openbox/menu_render.c b/openbox/menu_render.c index deebfd89..4b6e7d8f 100644 --- a/openbox/menu_render.c +++ b/openbox/menu_render.c @@ -26,10 +26,12 @@ void menu_render_full(Menu *self) { if (self->a_title == NULL) { XSetWindowBorderWidth(ob_display, self->frame, ob_rr_theme->bwidth); XSetWindowBackground(ob_display, self->frame, - ob_rr_theme->b_color->pixel); + RrColorPixel(ob_rr_theme->b_color)); XSetWindowBorderWidth(ob_display, self->title, ob_rr_theme->bwidth); - XSetWindowBorder(ob_display, self->frame, ob_rr_theme->b_color->pixel); - XSetWindowBorder(ob_display, self->title, ob_rr_theme->b_color->pixel); + XSetWindowBorder(ob_display, self->frame, + RrColorPixel(ob_rr_theme->b_color)); + XSetWindowBorder(ob_display, self->title, + RrColorPixel(ob_rr_theme->b_color)); self->a_title = RrAppearanceCopy(ob_rr_theme->a_menu_title); self->a_items = RrAppearanceCopy(ob_rr_theme->a_menu); diff --git a/openbox/moveresize.c b/openbox/moveresize.c index bc315365..97837295 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -3,6 +3,7 @@ #include "screen.h" #include "prop.h" #include "client.h" +#include "frame.h" #include "dispatch.h" #include "openbox.h" #include "popup.h" diff --git a/openbox/popup.h b/openbox/popup.h index 7a138bd0..3707c8cb 100644 --- a/openbox/popup.h +++ b/openbox/popup.h @@ -1,10 +1,10 @@ #ifndef __popup_h #define __popup_h -#include "client.h" - #include +struct _ObClientIcon; + typedef struct _ObPopup Popup; Popup *popup_new(gboolean hasicon); @@ -21,7 +21,7 @@ void popup_position(Popup *self, gint gravity, gint x, gint y); void popup_size(Popup *self, gint w, gint h); void popup_size_to_string(Popup *self, gchar *text); -void popup_show(Popup *self, gchar *text, ObClientIcon *icon); +void popup_show(Popup *self, gchar *text, struct _ObClientIcon *icon); void popup_hide(Popup *self); #endif diff --git a/openbox/screen.h b/openbox/screen.h index 1d119ac8..4df32be1 100644 --- a/openbox/screen.h +++ b/openbox/screen.h @@ -3,7 +3,6 @@ #include "misc.h" #include "geom.h" -#include "client.h" struct _ObClient; diff --git a/openbox/stacking.c b/openbox/stacking.c index 58f7ee79..3a556fc4 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -82,22 +82,22 @@ static void do_restack(GList *wins, GList *before) static void do_raise(GList *wins) { GList *it; - GList *layer[NUM_STACKLAYER] = {NULL}; + GList *layer[OB_NUM_STACKING_LAYERS] = {NULL}; int i; for (it = wins; it; it = g_list_next(it)) { - StackLayer l; + ObStackingLayer l; l = window_layer(it->data); layer[l] = g_list_append(layer[l], it->data); } it = stacking_list; - for (i = NUM_STACKLAYER - 1; i >= 0; --i) { + for (i = OB_NUM_STACKING_LAYERS - 1; i >= 0; --i) { if (layer[i]) { for (; it; it = g_list_next(it)) { /* look for the top of the layer */ - if (window_layer(it->data) <= (StackLayer) i) + if (window_layer(it->data) <= (ObStackingLayer) i) break; } do_restack(layer[i], it); @@ -109,22 +109,22 @@ static void do_raise(GList *wins) static void do_lower(GList *wins) { GList *it; - GList *layer[NUM_STACKLAYER] = {NULL}; + GList *layer[OB_NUM_STACKING_LAYERS] = {NULL}; int i; for (it = wins; it; it = g_list_next(it)) { - StackLayer l; + ObStackingLayer l; l = window_layer(it->data); layer[l] = g_list_append(layer[l], it->data); } it = stacking_list; - for (i = NUM_STACKLAYER - 1; i >= 0; --i) { + for (i = OB_NUM_STACKING_LAYERS - 1; i >= 0; --i) { if (layer[i]) { for (; it; it = g_list_next(it)) { /* look for the top of the next layer down */ - if (window_layer(it->data) < (StackLayer) i) + if (window_layer(it->data) < (ObStackingLayer) i) break; } do_restack(layer[i], it); @@ -264,7 +264,7 @@ void stacking_lower(ObWindow *window) void stacking_add(ObWindow *win) { - StackLayer l; + ObStackingLayer l; GList *wins; g_assert(focus_backup != None); /* make sure I dont break this in the diff --git a/openbox/stacking.h b/openbox/stacking.h index 4f284ea6..132ef490 100644 --- a/openbox/stacking.h +++ b/openbox/stacking.h @@ -8,15 +8,15 @@ /*! The possible stacking layers a client window can be a part of */ typedef enum { - Layer_Desktop, /*!< 0 - desktop windows */ - Layer_Below, /*!< 1 - normal windows w/ below */ - Layer_Normal, /*!< 2 - normal windows */ - Layer_Above, /*!< 3 - normal windows w/ above */ - Layer_Top, /*!< 4 - always-on-top-windows (docks?) */ - Layer_Fullscreen, /*!< 5 - fullscreeen windows */ - Layer_Internal, /*!< 6 - openbox windows/menus */ - NUM_STACKLAYER -} StackLayer; + OB_STACKING_LAYER_DESKTOP, /*!< 0 - desktop windows */ + OB_STACKING_LAYER_BELOW, /*!< 1 - normal windows w/ below */ + OB_STACKING_LAYER_NORMAL, /*!< 2 - normal windows */ + OB_STACKING_LAYER_ABOVE, /*!< 3 - normal windows w/ above */ + OB_STACKING_LAYER_TOP, /*!< 4 - always-on-top-windows (docks?) */ + OB_STACKING_LAYER_FULLSCREEN, /*!< 5 - fullscreeen windows */ + OB_STACKING_LAYER_INTERNAL, /*!< 6 - openbox windows/menus */ + OB_NUM_STACKING_LAYERS +} ObStackingLayer; /* list of ObWindow*s in stacking order from highest to lowest */ extern GList *stacking_list; diff --git a/openbox/window.c b/openbox/window.c index 781aa5db..8ca01b6f 100644 --- a/openbox/window.c +++ b/openbox/window.c @@ -41,7 +41,7 @@ Window window_layer(ObWindow *self) { switch (self->type) { case Window_Menu: - return Layer_Internal; + return OB_STACKING_LAYER_INTERNAL; case Window_Dock: return config_dock_layer; case Window_DockApp: @@ -51,7 +51,7 @@ Window window_layer(ObWindow *self) case Window_Client: return ((ObClient*)self)->layer; case Window_Internal: - return Layer_Internal; + return OB_STACKING_LAYER_INTERNAL; } g_assert_not_reached(); return None; diff --git a/openbox/window.h b/openbox/window.h index 7e7e4d34..fbdcf024 100644 --- a/openbox/window.h +++ b/openbox/window.h @@ -4,6 +4,9 @@ #include #include +typedef struct _ObWindow ObWindow; +typedef struct _ObInternalWindow ObInternalWindow; + typedef enum { Window_Menu, Window_Dock, @@ -12,9 +15,10 @@ typedef enum { Window_Internal /* used for stacking but not events */ } Window_InternalType; -typedef struct ObWindow { +struct _ObWindow +{ Window_InternalType type; -} ObWindow; +}; /* Wrapper for internal stuff. If its struct matches this then it can be used as an ObWindow */ diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c index f89620db..b1923af3 100644 --- a/plugins/keyboard/keyboard.c +++ b/plugins/keyboard/keyboard.c @@ -4,6 +4,7 @@ #include "kernel/openbox.h" #include "kernel/event.h" #include "kernel/grab.h" +#include "kernel/client.h" #include "kernel/action.h" #include "kernel/prop.h" #include "kernel/timer.h" -- 2.39.2