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

View file

@ -59,10 +59,10 @@ void focus_cycle_indicator_startup(gboolean reconfig)
if (reconfig) return;
focus_indicator.top.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
focus_indicator.left.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
focus_indicator.right.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
focus_indicator.bottom.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
focus_indicator.top.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.left.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.right.obwin.type = OB_WINDOW_CLASS_INTERNAL;
focus_indicator.bottom.obwin.type = OB_WINDOW_CLASS_INTERNAL;
attr.override_redirect = True;
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),
CWOverrideRedirect | CWBackPixel, &attr);
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom));
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top));
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
window_add(&focus_indicator.top.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
INTERNAL_AS_WINDOW(&focus_indicator.top));
window_add(&focus_indicator.left.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
INTERNAL_AS_WINDOW(&focus_indicator.left));
window_add(&focus_indicator.right.window,
INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
INTERNAL_AS_WINDOW(&focus_indicator.right));
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);
@ -122,10 +122,10 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
window_remove(focus_indicator.right.window);
window_remove(focus_indicator.bottom.window);
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom));
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.top));
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.left));
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.right));
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
XDestroyWindow(obt_display, focus_indicator.top.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();
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_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
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);
stacking_add(INTERNALWINDOW_AS_WINDOW(&popup));
window_add(&popup.bg, INTERNALWINDOW_AS_WINDOW(&popup));
stacking_add(INTERNAL_AS_WINDOW(&popup));
window_add(&popup.bg, INTERNAL_AS_WINDOW(&popup));
}
void focus_cycle_popup_shutdown(gboolean reconfig)
@ -135,7 +135,7 @@ void focus_cycle_popup_shutdown(gboolean reconfig)
icon_popup_free(single_popup);
window_remove(popup.bg);
stacking_remove(INTERNALWINDOW_AS_WINDOW(&popup));
stacking_remove(INTERNAL_AS_WINDOW(&popup));
while(popup.targets) {
ObFocusCyclePopupTarget *t = popup.targets->data;

View file

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

View file

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

View file

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

View file

@ -31,13 +31,13 @@ typedef enum {
OB_WINDOW_CLASS_MENUFRAME,
OB_WINDOW_CLASS_DOCK,
OB_WINDOW_CLASS_CLIENT,
OB_WINDOW_CLASS_INTERNALWINDOW
} Window_InternalType;
OB_WINDOW_CLASS_INTERNAL
} ObWindowClass;
/* In order to be an ObWindow, you need to make this struct the top of your
struct */
struct _ObWindow {
Window_InternalType type;
ObWindowClass type;
};
#define WINDOW_IS_MENUFRAME(win) \
@ -46,8 +46,8 @@ struct _ObWindow {
(((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK)
#define WINDOW_IS_CLIENT(win) \
(((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT)
#define WINDOW_IS_INTERNALWINDOW(win) \
(((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNALWINDOW)
#define WINDOW_IS_INTERNAL(win) \
(((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNAL)
struct _ObMenu;
struct _ObDock;
@ -57,12 +57,12 @@ struct _ObClient;
#define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win)
#define WINDOW_AS_DOCK(win) ((struct _ObDock*)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 DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
#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_shutdown(gboolean reconfig);