X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=engines%2Fopenbox%2Fobengine.c;h=75396c8a6ca5b4c4a569ba38b34d82fe597d4763;hb=fb1696659672386bcfc0f753b67f9eeda74e93b9;hp=f3395669d4ddd7f749c6ec758fec7a69af1a9396;hpb=4398c7c168fdcba1e31afc465d9783a57e7e674a;p=chaz%2Fopenbox diff --git a/engines/openbox/obengine.c b/engines/openbox/obengine.c index f3395669..75396c8a 100644 --- a/engines/openbox/obengine.c +++ b/engines/openbox/obengine.c @@ -1,10 +1,10 @@ #include "obtheme.h" #include "obrender.h" #include "obengine.h" -#include "../../kernel/openbox.h" -#include "../../kernel/extensions.h" -#include "../../kernel/dispatch.h" -#include "../../kernel/config.h" +#include "kernel/openbox.h" +#include "kernel/extensions.h" +#include "kernel/dispatch.h" +#include "kernel/config.h" #ifdef HAVE_SYS_STAT_H # include @@ -14,7 +14,8 @@ #include #define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask) -#define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask) +#define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ + ButtonPressMask | ButtonReleaseMask) #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask | ExposureMask) @@ -33,8 +34,6 @@ color_rgb *ob_s_titlebut_focused_color; color_rgb *ob_s_titlebut_unfocused_color; /* style settings - fonts */ int ob_s_winfont_height; -int ob_s_winfont_shadow; -int ob_s_winfont_shadow_offset; ObFont *ob_s_winfont; /* style settings - masks */ pixmap_mask *ob_s_max_set_mask; @@ -83,6 +82,9 @@ Appearance *ob_a_icon; /* always parentrelative, so no focused/unfocused */ Appearance *ob_a_focused_handle; Appearance *ob_a_unfocused_handle; +Appearance *ob_app_hilite_label; +Appearance *ob_app_unhilite_label; + static void layout_title(ObFrame *self); static void mouse_event(const ObEvent *e, ObFrame *self); @@ -90,21 +92,6 @@ gboolean startup() { char *path; - g_quark_from_string("none"); - g_quark_from_string("root"); - g_quark_from_string("client"); - g_quark_from_string("titlebar"); - g_quark_from_string("handle"); - g_quark_from_string("frame"); - g_quark_from_string("blcorner"); - g_quark_from_string("brcorner"); - g_quark_from_string("maximize"); - g_quark_from_string("alldesktops"); - g_quark_from_string("shade"); - g_quark_from_string("iconify"); - g_quark_from_string("icon"); - g_quark_from_string("close"); - /* create the ~/.openbox/themes/openbox dir */ path = g_build_filename(g_get_home_dir(), ".openbox", "themes", "openbox", NULL); @@ -156,6 +143,8 @@ gboolean startup() ob_a_icon = appearance_new(Surface_Planar, 1); ob_a_focused_handle = appearance_new(Surface_Planar, 0); ob_a_unfocused_handle = appearance_new(Surface_Planar, 0); + ob_app_hilite_label = appearance_new(Surface_Planar, 1); + ob_app_unhilite_label = appearance_new(Surface_Planar, 1); if (obtheme_load()) { RECT_SET(ob_a_focused_pressed_desk->area, 0, 0, @@ -300,6 +289,8 @@ void shutdown() appearance_free(ob_a_icon); appearance_free(ob_a_focused_handle); appearance_free(ob_a_unfocused_handle); + appearance_free(ob_app_hilite_label); + appearance_free(ob_app_unhilite_label); } static Window createWindow(Window parent, unsigned long mask, @@ -494,7 +485,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) self->icon_x = -1; self->desk_x = -1; self->shade_x = -1; - self->icon_x = -1; + self->iconify_x = -1; self->label_x = -1; self->max_x = -1; self->close_x = -1; @@ -529,7 +520,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) self->bwidth; XMapWindow(ob_display, self->handle); - if (self->a_focused_handle->surface.data.planar.grad == + if (ob_a_focused_grip->surface.data.planar.grad == Background_ParentRelative) RECT_SET(self->a_focused_handle->area, 0, 0, self->width, ob_s_handle_height); @@ -538,7 +529,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) GRIP_WIDTH + self->bwidth, 0, self->width - (GRIP_WIDTH + self->bwidth) * 2, ob_s_handle_height); - if (self->a_unfocused_handle->surface.data.planar.grad == + if (ob_a_unfocused_grip->surface.data.planar.grad == Background_ParentRelative) RECT_SET(self->a_unfocused_handle->area, 0, 0, self->width, ob_s_handle_height); @@ -707,18 +698,12 @@ static void layout_title(ObFrame *self) char *lc; int x; gboolean n, d, i, l, m, c, s; - ConfigValue layout; n = d = i = l = m = c = s = FALSE; - if (!config_get("titlebar.layout", Config_String, &layout)) { - layout.string = "NDLIMC"; - config_set("titlebar.layout", Config_String, layout); - } - /* figure out whats being shown, and the width of the label */ self->label_width = self->width - (ob_s_bevel + 1) * 2; - for (lc = layout.string; *lc != '\0'; ++lc) { + for (lc = config_engine_layout; *lc != '\0'; ++lc) { switch (*lc) { case 'N': if (!(self->frame.client->decorations & Decor_Icon)) break; @@ -776,7 +761,7 @@ static void layout_title(ObFrame *self) if (!c) XUnmapWindow(ob_display, self->close); x = ob_s_bevel + 1; - for (lc = layout.string; *lc != '\0'; ++lc) { + for (lc = config_engine_layout; *lc != '\0'; ++lc) { switch (*lc) { case 'N': if (!n) break; @@ -861,28 +846,28 @@ static void mouse_event(const ObEvent *e, ObFrame *self) } } -GQuark get_context(Client *client, Window win) +Context get_context(Client *client, Window win) { ObFrame *self; - if (win == ob_root) return g_quark_try_string("root"); - if (client == NULL) return g_quark_try_string("none"); - if (win == client->window) return g_quark_try_string("client"); + if (win == ob_root) return Context_Root; + if (client == NULL) return Context_None; + if (win == client->window) return Context_Client; self = (ObFrame*) client->frame; - if (win == self->frame.window) return g_quark_try_string("frame"); - if (win == self->frame.plate) return g_quark_try_string("client"); - if (win == self->title) return g_quark_try_string("titlebar"); - if (win == self->label) return g_quark_try_string("titlebar"); - if (win == self->handle) return g_quark_try_string("handle"); - if (win == self->lgrip) return g_quark_try_string("blcorner"); - if (win == self->rgrip) return g_quark_try_string("brcorner"); - if (win == self->max) return g_quark_try_string("maximize"); - if (win == self->iconify) return g_quark_try_string("iconify"); - if (win == self->close) return g_quark_try_string("close"); - if (win == self->icon) return g_quark_try_string("icon"); - if (win == self->desk) return g_quark_try_string("alldesktops"); - if (win == self->shade) return g_quark_try_string("shade"); - - return g_quark_try_string("none"); + if (win == self->frame.window) return Context_Frame; + if (win == self->frame.plate) return Context_Client; + if (win == self->title) return Context_Titlebar; + if (win == self->label) return Context_Titlebar; + if (win == self->handle) return Context_Handle; + if (win == self->lgrip) return Context_BLCorner; + if (win == self->rgrip) return Context_BRCorner; + if (win == self->max) return Context_Maximize; + if (win == self->iconify) return Context_Iconify; + if (win == self->close) return Context_Close; + if (win == self->icon) return Context_Icon; + if (win == self->desk) return Context_AllDesktops; + if (win == self->shade) return Context_Shade; + + return Context_None; }