simplify window.h macros, and rename the window types to ObWindowClass for consistent name style

This commit is contained in:
Dana Jansens 2008-01-31 10:00:10 -05:00
parent 73c9a0e06b
commit 52369e319f
7 changed files with 37 additions and 37 deletions

View file

@ -476,7 +476,7 @@ static void event_process(const XEvent *ec, gpointer data)
case OB_WINDOW_CLASS_MENUFRAME: case OB_WINDOW_CLASS_MENUFRAME:
menu = WINDOW_AS_MENUFRAME(obwin); menu = WINDOW_AS_MENUFRAME(obwin);
break; break;
case OB_WINDOW_CLASS_INTERNALWINDOW: case OB_WINDOW_CLASS_INTERNAL:
/* we don't do anything with events directly on these windows */ /* we don't do anything with events directly on these windows */
break; break;
} }
@ -711,7 +711,7 @@ static void event_process(const XEvent *ec, gpointer data)
ObWindow *w; ObWindow *w;
if ((w = window_find(e->xbutton.subwindow)) && if ((w = window_find(e->xbutton.subwindow)) &&
WINDOW_IS_INTERNALWINDOW(w)) WINDOW_IS_INTERNAL(w))
{ {
event_handle_user_input(client, e); event_handle_user_input(client, e);
} }

View file

@ -59,10 +59,10 @@ void focus_cycle_indicator_startup(gboolean reconfig)
if (reconfig) return; if (reconfig) return;
focus_indicator.top.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; focus_indicator.top.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.left.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; focus_indicator.left.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.right.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; focus_indicator.right.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.bottom.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; focus_indicator.bottom.obwin.type = OB_WINDOW_CLASS_INTERNAL;
attr.override_redirect = True; attr.override_redirect = True;
attr.background_pixel = BlackPixel(obt_display, ob_screen); attr.background_pixel = BlackPixel(obt_display, ob_screen);
@ -79,18 +79,18 @@ void focus_cycle_indicator_startup(gboolean reconfig)
create_window(obt_root(ob_screen), create_window(obt_root(ob_screen),
CWOverrideRedirect | CWBackPixel, &attr); CWOverrideRedirect | CWBackPixel, &attr);
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
window_add(&focus_indicator.top.window, window_add(&focus_indicator.top.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.top)); INTERNAL_AS_WINDOW(&focus_indicator.top));
window_add(&focus_indicator.left.window, window_add(&focus_indicator.left.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.left)); INTERNAL_AS_WINDOW(&focus_indicator.left));
window_add(&focus_indicator.right.window, window_add(&focus_indicator.right.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.right)); INTERNAL_AS_WINDOW(&focus_indicator.right));
window_add(&focus_indicator.bottom.window, window_add(&focus_indicator.bottom.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom)); INTERNAL_AS_WINDOW(&focus_indicator.bottom));
color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff); color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
@ -122,10 +122,10 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
window_remove(focus_indicator.right.window); window_remove(focus_indicator.right.window);
window_remove(focus_indicator.bottom.window); window_remove(focus_indicator.bottom.window);
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.top));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.left));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.right));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
XDestroyWindow(obt_display, focus_indicator.top.window); XDestroyWindow(obt_display, focus_indicator.top.window);
XDestroyWindow(obt_display, focus_indicator.left.window); XDestroyWindow(obt_display, focus_indicator.left.window);

View file

@ -98,7 +98,7 @@ void focus_cycle_popup_startup(gboolean reconfig)
single_popup = icon_popup_new(); single_popup = icon_popup_new();
popup.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; popup.obwin.type = OB_WINDOW_CLASS_INTERNAL;
popup.a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg); popup.a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
popup.a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label); popup.a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
popup.a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex); popup.a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
@ -126,8 +126,8 @@ void focus_cycle_popup_startup(gboolean reconfig)
XMapWindow(obt_display, popup.text); XMapWindow(obt_display, popup.text);
stacking_add(INTERNALWINDOW_AS_WINDOW(&popup)); stacking_add(INTERNAL_AS_WINDOW(&popup));
window_add(&popup.bg, INTERNALWINDOW_AS_WINDOW(&popup)); window_add(&popup.bg, INTERNAL_AS_WINDOW(&popup));
} }
void focus_cycle_popup_shutdown(gboolean reconfig) void focus_cycle_popup_shutdown(gboolean reconfig)
@ -135,7 +135,7 @@ void focus_cycle_popup_shutdown(gboolean reconfig)
icon_popup_free(single_popup); icon_popup_free(single_popup);
window_remove(popup.bg); window_remove(popup.bg);
stacking_remove(INTERNALWINDOW_AS_WINDOW(&popup)); stacking_remove(INTERNAL_AS_WINDOW(&popup));
while(popup.targets) { while(popup.targets) {
ObFocusCyclePopupTarget *t = popup.targets->data; ObFocusCyclePopupTarget *t = popup.targets->data;

View file

@ -38,7 +38,7 @@ extern GList *menu_frame_visible;
struct _ObMenuFrame struct _ObMenuFrame
{ {
/* stuff to be an ObWindow */ /* stuff to be an ObWindow */
Window_InternalType type; ObWindow type;
Window window; Window window;
struct _ObMenu *menu; struct _ObMenu *menu;

View file

@ -33,7 +33,7 @@ ObPopup *popup_new(void)
XSetWindowAttributes attrib; XSetWindowAttributes attrib;
ObPopup *self = g_new0(ObPopup, 1); ObPopup *self = g_new0(ObPopup, 1);
self->obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW; self->obwin.type = OB_WINDOW_CLASS_INTERNAL;
self->gravity = NorthWestGravity; self->gravity = NorthWestGravity;
self->x = self->y = self->textw = self->h = 0; self->x = self->y = self->textw = self->h = 0;
self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg); self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
@ -56,8 +56,8 @@ ObPopup *popup_new(void)
XMapWindow(obt_display, self->text); XMapWindow(obt_display, self->text);
stacking_add(INTERNALWINDOW_AS_WINDOW(self)); stacking_add(INTERNAL_AS_WINDOW(self));
window_add(&self->bg, INTERNALWINDOW_AS_WINDOW(self)); window_add(&self->bg, INTERNAL_AS_WINDOW(self));
return self; return self;
} }
@ -141,7 +141,7 @@ static gboolean popup_show_timeout(gpointer data)
ObPopup *self = data; ObPopup *self = data;
XMapWindow(obt_display, self->bg); XMapWindow(obt_display, self->bg);
stacking_raise(INTERNALWINDOW_AS_WINDOW(self)); stacking_raise(INTERNAL_AS_WINDOW(self));
self->mapped = TRUE; self->mapped = TRUE;
self->delay_mapped = FALSE; self->delay_mapped = FALSE;

View file

@ -52,8 +52,8 @@ Window window_top(ObWindow *self)
return WINDOW_AS_DOCK(self)->frame; return WINDOW_AS_DOCK(self)->frame;
case OB_WINDOW_CLASS_CLIENT: case OB_WINDOW_CLASS_CLIENT:
return WINDOW_AS_CLIENT(self)->frame->window; return WINDOW_AS_CLIENT(self)->frame->window;
case OB_WINDOW_CLASS_INTERNALWINDOW: case OB_WINDOW_CLASS_INTERNAL:
return WINDOW_AS_INTERNALWINDOW(self)->window; return WINDOW_AS_INTERNAL(self)->window;
} }
g_assert_not_reached(); g_assert_not_reached();
return None; return None;
@ -67,7 +67,7 @@ ObStackingLayer window_layer(ObWindow *self)
case OB_WINDOW_CLASS_CLIENT: case OB_WINDOW_CLASS_CLIENT:
return ((ObClient*)self)->layer; return ((ObClient*)self)->layer;
case OB_WINDOW_CLASS_MENUFRAME: case OB_WINDOW_CLASS_MENUFRAME:
case OB_WINDOW_CLASS_INTERNALWINDOW: case OB_WINDOW_CLASS_INTERNAL:
return OB_STACKING_LAYER_INTERNAL; return OB_STACKING_LAYER_INTERNAL;
} }
g_assert_not_reached(); g_assert_not_reached();

View file

@ -31,13 +31,13 @@ typedef enum {
OB_WINDOW_CLASS_MENUFRAME, OB_WINDOW_CLASS_MENUFRAME,
OB_WINDOW_CLASS_DOCK, OB_WINDOW_CLASS_DOCK,
OB_WINDOW_CLASS_CLIENT, OB_WINDOW_CLASS_CLIENT,
OB_WINDOW_CLASS_INTERNALWINDOW OB_WINDOW_CLASS_INTERNAL
} Window_InternalType; } ObWindowClass;
/* In order to be an ObWindow, you need to make this struct the top of your /* In order to be an ObWindow, you need to make this struct the top of your
struct */ struct */
struct _ObWindow { struct _ObWindow {
Window_InternalType type; ObWindowClass type;
}; };
#define WINDOW_IS_MENUFRAME(win) \ #define WINDOW_IS_MENUFRAME(win) \
@ -46,8 +46,8 @@ struct _ObWindow {
(((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK) (((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK)
#define WINDOW_IS_CLIENT(win) \ #define WINDOW_IS_CLIENT(win) \
(((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT) (((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT)
#define WINDOW_IS_INTERNALWINDOW(win) \ #define WINDOW_IS_INTERNAL(win) \
(((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNALWINDOW) (((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNAL)
struct _ObMenu; struct _ObMenu;
struct _ObDock; struct _ObDock;
@ -57,12 +57,12 @@ struct _ObClient;
#define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win) #define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win)
#define WINDOW_AS_DOCK(win) ((struct _ObDock*)win) #define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
#define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win) #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
#define WINDOW_AS_INTERNALWINDOW(win) ((struct _ObInternalWindow*)win) #define WINDOW_AS_INTERNAL(win) ((struct _ObInternalWindow*)win)
#define MENUFRAME_AS_WINDOW(menu) ((ObWindow*)menu) #define MENUFRAME_AS_WINDOW(menu) ((ObWindow*)menu)
#define DOCK_AS_WINDOW(dock) ((ObWindow*)dock) #define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
#define CLIENT_AS_WINDOW(client) ((ObWindow*)client) #define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
#define INTERNALWINDOW_AS_WINDOW(intern) ((ObWindow*)intern) #define INTERNAL_AS_WINDOW(intern) ((ObWindow*)intern)
void window_startup (gboolean reconfig); void window_startup (gboolean reconfig);
void window_shutdown(gboolean reconfig); void window_shutdown(gboolean reconfig);