prefixing and capitalizing the StackLayer -> ObStackingLayer enum. less includes in headers for less rebuilding on changes
jump to
@@ -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 @@ available (possibly NULL though) if it wants it.
*/ 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 @@ guint button;
}; 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;
@@ -1485,27 +1485,28 @@ return 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 @@ }
void client_calc_layer(ObClient *self) { - StackLayer l; + ObStackingLayer l; ObClient *orig; orig = self;
@@ -223,7 +223,7 @@ gboolean below;
/*! 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
@@ -15,14 +15,14 @@
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 @@ config_dock_y = parse_int(doc, n);
} 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 @@ config_opaque_resize = TRUE;
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;
@@ -2,7 +2,6 @@ #ifndef __config_h
#define __config_h #include "misc.h" -#include "dock.h" #include "stacking.h" #include <glib.h>@@ -27,17 +26,17 @@ while they are resize */
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 */
@@ -1,5 +1,6 @@
#include "dispatch.h" #include "extensions.h" +#include "client.h" #include <glib.h>
@@ -1,8 +1,11 @@
#ifndef __dispatch_h #define __dispatch_h -#include "client.h" +#include "misc.h" + #include <X11/Xlib.h> + +struct _ObClient; void dispatch_startup(); void dispatch_shutdown();@@ -41,23 +44,23 @@ } EventType;
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 @@ } EventData_Signal;
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
@@ -33,7 +33,8 @@ RrVisual(ob_rr_inst),
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);
@@ -662,7 +662,7 @@ #endif
/* 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 */
@@ -1,6 +1,8 @@
#ifndef __extensions_h #define __extensions_h +#include "geom.h" + #include <X11/Xlib.h> #ifdef XKB #include <X11/XKBlib.h>@@ -17,6 +19,7 @@ #endif
#ifdef VIDMODE #include <X11/extensions/xf86vmode.h> #endif + #include <glib.h> /*! Does the display have the XKB extension? */
@@ -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;
@@ -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
@@ -3,6 +3,7 @@ #include "framerender.h"
#include "screen.h" #include "prop.h" #include "client.h" +#include "frame.h" #include "dispatch.h" #include "openbox.h" #include "popup.h"
@@ -1,9 +1,9 @@
#ifndef __popup_h #define __popup_h -#include "client.h" - #include <glib.h> + +struct _ObClientIcon; typedef struct _ObPopup Popup;@@ -21,7 +21,7 @@ the text size. */
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
@@ -3,7 +3,6 @@ #define __screen_h
#include "misc.h" #include "geom.h" -#include "client.h" struct _ObClient;
@@ -82,22 +82,22 @@
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_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_add(ObWindow *win) { - StackLayer l; + ObStackingLayer l; GList *wins; g_assert(focus_backup != None); /* make sure I dont break this in the
@@ -8,15 +8,15 @@ #include <X11/Xlib.h>
/*! 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;
@@ -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 @@ break;
case Window_Client: return ((ObClient*)self)->layer; case Window_Internal: - return Layer_Internal; + return OB_STACKING_LAYER_INTERNAL; } g_assert_not_reached(); return None;
@@ -4,6 +4,9 @@
#include <X11/Xlib.h> #include <glib.h> +typedef struct _ObWindow ObWindow; +typedef struct _ObInternalWindow ObInternalWindow; + typedef enum { Window_Menu, Window_Dock,@@ -12,9 +15,10 @@ Window_Client,
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 */
@@ -4,6 +4,7 @@ #include "kernel/dispatch.h"
#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"