From 506c1aa005d0328d4d32e123d437c6afe92b8ea4 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 31 Mar 2003 19:38:24 +0000 Subject: [PATCH] change buttons masks so that there are masks for max and desktop buttons when their state changes but not for all buttons just when they are pressed --- engines/openbox/obengine.c | 67 +++++++++++++---------- engines/openbox/obengine.h | 18 ++++--- engines/openbox/obrender.c | 26 +++++---- engines/openbox/obtheme.c | 108 ++++++++++++++++++++++--------------- 4 files changed, 130 insertions(+), 89 deletions(-) diff --git a/engines/openbox/obengine.c b/engines/openbox/obengine.c index 4372f158..b6a66db5 100644 --- a/engines/openbox/obengine.c +++ b/engines/openbox/obengine.c @@ -37,28 +37,30 @@ int ob_s_winfont_shadow; int ob_s_winfont_shadow_offset; ObFont *ob_s_winfont; /* style settings - masks */ -pixmap_mask *ob_s_max_pressed_mask; -pixmap_mask *ob_s_max_unpressed_mask; -pixmap_mask *ob_s_iconify_pressed_mask; -pixmap_mask *ob_s_iconify_unpressed_mask; -pixmap_mask *ob_s_desk_pressed_mask; -pixmap_mask *ob_s_desk_unpressed_mask; -pixmap_mask *ob_s_close_pressed_mask; -pixmap_mask *ob_s_close_unpressed_mask; +pixmap_mask *ob_s_max_set_mask; +pixmap_mask *ob_s_max_unset_mask; +pixmap_mask *ob_s_iconify_mask; +pixmap_mask *ob_s_desk_set_mask; +pixmap_mask *ob_s_desk_unset_mask; +pixmap_mask *ob_s_close_mask; /* global appearances */ Appearance *ob_a_focused_unpressed_max; Appearance *ob_a_focused_pressed_max; +Appearance *ob_a_focused_pressed_set_max; Appearance *ob_a_unfocused_unpressed_max; Appearance *ob_a_unfocused_pressed_max; +Appearance *ob_a_unfocused_pressed_set_max; Appearance *ob_a_focused_unpressed_close; Appearance *ob_a_focused_pressed_close; Appearance *ob_a_unfocused_unpressed_close; Appearance *ob_a_unfocused_pressed_close; Appearance *ob_a_focused_unpressed_desk; Appearance *ob_a_focused_pressed_desk; +Appearance *ob_a_focused_pressed_set_desk; Appearance *ob_a_unfocused_unpressed_desk; Appearance *ob_a_unfocused_pressed_desk; +Appearance *ob_a_unfocused_pressed_set_desk; Appearance *ob_a_focused_unpressed_iconify; Appearance *ob_a_focused_pressed_iconify; Appearance *ob_a_unfocused_unpressed_iconify; @@ -105,23 +107,26 @@ gboolean startup() ob_s_title_unfocused_color = ob_s_title_focused_color = ob_s_titlebut_unfocused_color = ob_s_titlebut_focused_color = NULL; ob_s_winfont = NULL; - ob_s_max_pressed_mask = ob_s_max_unpressed_mask = NULL; - ob_s_iconify_pressed_mask = ob_s_iconify_unpressed_mask = NULL; - ob_s_desk_pressed_mask = ob_s_desk_unpressed_mask = NULL; - ob_s_close_pressed_mask = ob_s_close_unpressed_mask = NULL; + ob_s_max_set_mask = ob_s_max_unset_mask = NULL; + ob_s_desk_set_mask = ob_s_desk_unset_mask = NULL; + ob_s_iconify_mask = ob_s_close_mask = NULL; ob_a_focused_unpressed_max = appearance_new(Surface_Planar, 1); ob_a_focused_pressed_max = appearance_new(Surface_Planar, 1); + ob_a_focused_pressed_set_max = appearance_new(Surface_Planar, 1); ob_a_unfocused_unpressed_max = appearance_new(Surface_Planar, 1); ob_a_unfocused_pressed_max = appearance_new(Surface_Planar, 1); + ob_a_unfocused_pressed_set_max = appearance_new(Surface_Planar, 1); ob_a_focused_unpressed_close = NULL; ob_a_focused_pressed_close = NULL; ob_a_unfocused_unpressed_close = NULL; ob_a_unfocused_pressed_close = NULL; ob_a_focused_unpressed_desk = NULL; ob_a_focused_pressed_desk = NULL; + ob_a_focused_pressed_set_desk = NULL; ob_a_unfocused_unpressed_desk = NULL; ob_a_unfocused_pressed_desk = NULL; + ob_a_unfocused_pressed_set_desk = NULL; ob_a_focused_unpressed_iconify = NULL; ob_a_focused_pressed_iconify = NULL; ob_a_unfocused_unpressed_iconify = NULL; @@ -139,10 +144,14 @@ gboolean startup() if (obtheme_load()) { RECT_SET(ob_a_focused_pressed_desk->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); + RECT_SET(ob_a_focused_pressed_set_desk->area, 0, 0, + BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_focused_unpressed_desk->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_unfocused_pressed_desk->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); + RECT_SET(ob_a_unfocused_pressed_set_desk->area, 0, 0, + BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_unfocused_unpressed_desk->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_focused_pressed_iconify->area, 0, 0, @@ -157,10 +166,14 @@ gboolean startup() BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_focused_pressed_max->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); + RECT_SET(ob_a_focused_pressed_set_max->area, 0, 0, + BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_focused_unpressed_max->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_unfocused_pressed_max->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); + RECT_SET(ob_a_unfocused_pressed_set_max->area, 0, 0, + BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_unfocused_unpressed_max->area, 0, 0, BUTTON_SIZE, BUTTON_SIZE); RECT_SET(ob_a_focused_pressed_close->area, 0, 0, @@ -193,29 +206,27 @@ void shutdown() if (ob_s_titlebut_focused_color != NULL) color_free(ob_s_titlebut_focused_color); - if (ob_s_max_pressed_mask != NULL) - pixmap_mask_free(ob_s_max_pressed_mask); - if (ob_s_max_unpressed_mask != NULL) - pixmap_mask_free(ob_s_max_unpressed_mask); - if (ob_s_desk_pressed_mask != NULL) - pixmap_mask_free(ob_s_desk_pressed_mask); - if (ob_s_desk_unpressed_mask != NULL) - pixmap_mask_free(ob_s_desk_unpressed_mask); - if (ob_s_iconify_pressed_mask != NULL) - pixmap_mask_free(ob_s_iconify_pressed_mask); - if (ob_s_iconify_unpressed_mask != NULL) - pixmap_mask_free(ob_s_iconify_unpressed_mask); - if (ob_s_close_pressed_mask != NULL) - pixmap_mask_free(ob_s_close_pressed_mask); - if (ob_s_close_unpressed_mask != NULL) - pixmap_mask_free(ob_s_close_unpressed_mask); + if (ob_s_max_set_mask != NULL) + pixmap_mask_free(ob_s_max_set_mask); + if (ob_s_max_unset_mask != NULL) + pixmap_mask_free(ob_s_max_unset_mask); + if (ob_s_desk_set_mask != NULL) + pixmap_mask_free(ob_s_desk_set_mask); + if (ob_s_desk_unset_mask != NULL) + pixmap_mask_free(ob_s_desk_unset_mask); + if (ob_s_iconify_mask != NULL) + pixmap_mask_free(ob_s_iconify_mask); + if (ob_s_close_mask != NULL) + pixmap_mask_free(ob_s_close_mask); if (ob_s_winfont != NULL) font_close(ob_s_winfont); appearance_free(ob_a_focused_unpressed_max); appearance_free(ob_a_focused_pressed_max); + appearance_free(ob_a_focused_pressed_set_max); appearance_free(ob_a_unfocused_unpressed_max); appearance_free(ob_a_unfocused_pressed_max); + appearance_free(ob_a_unfocused_pressed_set_max); if (ob_a_focused_unpressed_close != NULL) appearance_free(ob_a_focused_unpressed_close); if (ob_a_focused_pressed_close != NULL) diff --git a/engines/openbox/obengine.h b/engines/openbox/obengine.h index ad07e0d5..f84ed21f 100644 --- a/engines/openbox/obengine.h +++ b/engines/openbox/obengine.h @@ -32,27 +32,29 @@ extern int ob_s_winfont_shadow; extern int ob_s_winfont_shadow_offset; extern ObFont *ob_s_winfont; -extern pixmap_mask *ob_s_max_pressed_mask; -extern pixmap_mask *ob_s_max_unpressed_mask; -extern pixmap_mask *ob_s_iconify_pressed_mask; -extern pixmap_mask *ob_s_iconify_unpressed_mask; -extern pixmap_mask *ob_s_desk_pressed_mask; -extern pixmap_mask *ob_s_desk_unpressed_mask; -extern pixmap_mask *ob_s_close_pressed_mask; -extern pixmap_mask *ob_s_close_unpressed_mask; +extern pixmap_mask *ob_s_max_set_mask; +extern pixmap_mask *ob_s_max_unset_mask; +extern pixmap_mask *ob_s_iconify_mask; +extern pixmap_mask *ob_s_desk_set_mask; +extern pixmap_mask *ob_s_desk_unset_mask; +extern pixmap_mask *ob_s_close_mask; extern Appearance *ob_a_focused_unpressed_max; extern Appearance *ob_a_focused_pressed_max; +extern Appearance *ob_a_focused_pressed_set_max; extern Appearance *ob_a_unfocused_unpressed_max; extern Appearance *ob_a_unfocused_pressed_max; +extern Appearance *ob_a_unfocused_pressed_set_max; extern Appearance *ob_a_focused_unpressed_close; extern Appearance *ob_a_focused_pressed_close; extern Appearance *ob_a_unfocused_unpressed_close; extern Appearance *ob_a_unfocused_pressed_close; extern Appearance *ob_a_focused_unpressed_desk; extern Appearance *ob_a_focused_pressed_desk; +extern Appearance *ob_a_focused_pressed_set_desk; extern Appearance *ob_a_unfocused_unpressed_desk; extern Appearance *ob_a_unfocused_pressed_desk; +extern Appearance *ob_a_unfocused_pressed_set_desk; extern Appearance *ob_a_focused_unpressed_iconify; extern Appearance *ob_a_focused_pressed_iconify; extern Appearance *ob_a_unfocused_unpressed_iconify; diff --git a/engines/openbox/obrender.c b/engines/openbox/obrender.c index a9ed1e39..f63d61f4 100644 --- a/engines/openbox/obrender.c +++ b/engines/openbox/obrender.c @@ -27,12 +27,14 @@ void obrender_frame(ObFrame *self) l = (client_focused(self->frame.client) ? self->a_focused_label : self->a_unfocused_label); m = (client_focused(self->frame.client) ? - ((self->max_press || - self->frame.client->max_vert || self->frame.client->max_horz) ? - ob_a_focused_pressed_max : ob_a_focused_unpressed_max) : - ((self->max_press || - self->frame.client->max_vert || self->frame.client->max_horz) ? - ob_a_unfocused_pressed_max : ob_a_unfocused_unpressed_max)); + (self->frame.client->max_vert || self->frame.client->max_horz ? + ob_a_focused_pressed_set_max : + (self->max_press ? + ob_a_focused_pressed_max : ob_a_focused_unpressed_max)) : + (self->frame.client->max_vert || self->frame.client->max_horz ? + ob_a_unfocused_pressed_set_max : + (self->max_press ? + ob_a_unfocused_pressed_max : ob_a_unfocused_unpressed_max))); n = self->a_icon; i = (client_focused(self->frame.client) ? (self->iconify_press ? @@ -41,10 +43,14 @@ void obrender_frame(ObFrame *self) ob_a_unfocused_pressed_iconify : ob_a_unfocused_unpressed_iconify)); d = (client_focused(self->frame.client) ? - (self->desk_press || self->frame.client->desktop == DESKTOP_ALL ? - ob_a_focused_pressed_desk : ob_a_focused_unpressed_desk) : - (self->desk_press || self->frame.client->desktop == DESKTOP_ALL ? - ob_a_unfocused_pressed_desk : ob_a_unfocused_unpressed_desk)); + (self->frame.client->desktop == DESKTOP_ALL ? + ob_a_focused_pressed_set_desk : + (self->desk_press ? + ob_a_focused_pressed_desk : ob_a_focused_unpressed_desk)) : + (self->frame.client->desktop == DESKTOP_ALL ? + ob_a_unfocused_pressed_set_desk : + (self->desk_press ? + ob_a_unfocused_pressed_desk : ob_a_unfocused_unpressed_desk))); c = (client_focused(self->frame.client) ? (self->close_press ? ob_a_focused_pressed_close : ob_a_focused_unpressed_close) : diff --git a/engines/openbox/obtheme.c b/engines/openbox/obtheme.c index 86850bae..f0dbb676 100644 --- a/engines/openbox/obtheme.c +++ b/engines/openbox/obtheme.c @@ -355,44 +355,50 @@ gboolean obtheme_load() &ob_s_titlebut_unfocused_color)) ob_s_titlebut_unfocused_color = color_new(0xff, 0xff, 0xff); - if (!read_mask(db, "window.button.max.mask", &ob_s_max_unpressed_mask)) { - char data[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f }; - ob_s_max_unpressed_mask = pixmap_mask_new(7, 7, data); - } - if (!read_mask(db, "window.button.max.pressed.mask", - &ob_s_max_pressed_mask)) { - ob_s_max_pressed_mask = pixmap_mask_copy(ob_s_max_unpressed_mask); + if (read_mask(db, "window.button.max.mask", &ob_s_max_unset_mask)) { + if (!read_mask(db, "window.button.max.pressed.mask", + &ob_s_max_set_mask)) { + ob_s_max_set_mask = pixmap_mask_copy(ob_s_max_unset_mask); + } + } else { + { + char data[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f }; + ob_s_max_unset_mask = pixmap_mask_new(6, 6, data); + } + { + char data[] = { 0x3c, 0x24, 0x27, 0x3f, 0x0f, 0x0f }; + ob_s_max_set_mask = pixmap_mask_new(6, 6, data); + } } if (!read_mask(db, "window.button.icon.mask", - &ob_s_iconify_unpressed_mask)) { - char data[] = { 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e }; - ob_s_iconify_unpressed_mask = pixmap_mask_new(7, 7, data); - } - if (!read_mask(db, "window.button.icon.pressed.mask", - &ob_s_iconify_pressed_mask)) { - ob_s_iconify_pressed_mask = - pixmap_mask_copy(ob_s_iconify_unpressed_mask); + &ob_s_iconify_mask)) { + char data[] = { 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x3f }; + ob_s_iconify_mask = pixmap_mask_new(6, 6, data); } - if (!read_mask(db, "window.button.stick.mask", - &ob_s_desk_unpressed_mask)) { - char data[] = { 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x00 }; - ob_s_desk_unpressed_mask = pixmap_mask_new(7, 7, data); - } - if (!read_mask(db, "window.button.stick.pressed.mask", - &ob_s_desk_pressed_mask)) { - ob_s_desk_pressed_mask = pixmap_mask_copy(ob_s_desk_unpressed_mask); + if (read_mask(db, "window.button.stick.mask", + &ob_s_desk_unset_mask)) { + if (!read_mask(db, "window.button.stick.pressed.mask", + &ob_s_desk_set_mask)) { + ob_s_desk_set_mask = + pixmap_mask_copy(ob_s_desk_unset_mask); + } + } else { + { + char data[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 }; + ob_s_desk_unset_mask = pixmap_mask_new(6, 6, data); + } + { + char data[] = { 0x0c, 0x0c, 0x3f, 0x3f, 0x0c, 0x0c }; + ob_s_desk_set_mask = pixmap_mask_new(6, 6, data); + } } if (!read_mask(db, "window.button.close.mask", - &ob_s_close_unpressed_mask)) { - char data[] = { 0x22, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x22 }; - ob_s_close_unpressed_mask = pixmap_mask_new(7, 7, data); - } - if (!read_mask(db, "window.button.close.pressed.mask", - &ob_s_close_pressed_mask)) { - ob_s_close_pressed_mask = pixmap_mask_copy(ob_s_close_unpressed_mask); + &ob_s_close_mask)) { + char data[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 }; + ob_s_close_mask = pixmap_mask_new(6, 6, data); } if (!read_appearance(db, "window.title.focus", ob_a_focused_title)) @@ -437,8 +443,11 @@ gboolean obtheme_load() ob_a_unfocused_unpressed_desk = appearance_copy(ob_a_unfocused_unpressed_max); ob_a_unfocused_pressed_desk = appearance_copy(ob_a_unfocused_pressed_max); + ob_a_unfocused_pressed_set_desk = + appearance_copy(ob_a_unfocused_pressed_max); ob_a_focused_unpressed_desk = appearance_copy(ob_a_focused_unpressed_max); ob_a_focused_pressed_desk = appearance_copy(ob_a_focused_pressed_max); + ob_a_focused_pressed_set_desk = appearance_copy(ob_a_focused_pressed_max); ob_a_unfocused_unpressed_iconify = appearance_copy(ob_a_unfocused_unpressed_max); ob_a_unfocused_pressed_iconify = @@ -446,6 +455,9 @@ gboolean obtheme_load() ob_a_focused_unpressed_iconify = appearance_copy(ob_a_focused_unpressed_max); ob_a_focused_pressed_iconify = appearance_copy(ob_a_focused_pressed_max); + ob_a_unfocused_pressed_set_max = + appearance_copy(ob_a_unfocused_pressed_max); + ob_a_focused_pressed_set_max = appearance_copy(ob_a_focused_pressed_max); ob_a_icon->surface.data.planar.grad = Background_ParentRelative; @@ -469,59 +481,69 @@ gboolean obtheme_load() ob_a_focused_unpressed_max->texture[0].type = ob_a_focused_pressed_max->texture[0].type = + ob_a_focused_pressed_set_max->texture[0].type = ob_a_unfocused_unpressed_max->texture[0].type = ob_a_unfocused_pressed_max->texture[0].type = + ob_a_unfocused_pressed_set_max->texture[0].type = ob_a_focused_unpressed_close->texture[0].type = ob_a_focused_pressed_close->texture[0].type = ob_a_unfocused_unpressed_close->texture[0].type = ob_a_unfocused_pressed_close->texture[0].type = ob_a_focused_unpressed_desk->texture[0].type = ob_a_focused_pressed_desk->texture[0].type = + ob_a_focused_pressed_set_desk->texture[0].type = ob_a_unfocused_unpressed_desk->texture[0].type = ob_a_unfocused_pressed_desk->texture[0].type = + ob_a_unfocused_pressed_set_desk->texture[0].type = ob_a_focused_unpressed_iconify->texture[0].type = ob_a_focused_pressed_iconify->texture[0].type = ob_a_unfocused_unpressed_iconify->texture[0].type = ob_a_unfocused_pressed_iconify->texture[0].type = Bitmask; ob_a_focused_unpressed_max->texture[0].data.mask.mask = ob_a_unfocused_unpressed_max->texture[0].data.mask.mask = - ob_s_max_unpressed_mask; - ob_a_focused_pressed_max->texture[0].data.mask.mask = + ob_a_focused_pressed_max->texture[0].data.mask.mask = ob_a_unfocused_pressed_max->texture[0].data.mask.mask = - ob_s_max_pressed_mask; - ob_a_focused_unpressed_close->texture[0].data.mask.mask = - ob_a_unfocused_unpressed_close->texture[0].data.mask.mask = - ob_s_close_unpressed_mask; + ob_s_max_unset_mask; + ob_a_focused_pressed_set_max->texture[0].data.mask.mask = + ob_a_unfocused_pressed_set_max->texture[0].data.mask.mask = + ob_s_max_set_mask; ob_a_focused_pressed_close->texture[0].data.mask.mask = ob_a_unfocused_pressed_close->texture[0].data.mask.mask = - ob_s_close_pressed_mask; + ob_a_focused_unpressed_close->texture[0].data.mask.mask = + ob_a_unfocused_unpressed_close->texture[0].data.mask.mask = + ob_s_close_mask; ob_a_focused_unpressed_desk->texture[0].data.mask.mask = ob_a_unfocused_unpressed_desk->texture[0].data.mask.mask = - ob_s_desk_unpressed_mask; - ob_a_focused_pressed_desk->texture[0].data.mask.mask = + ob_a_focused_pressed_desk->texture[0].data.mask.mask = ob_a_unfocused_pressed_desk->texture[0].data.mask.mask = - ob_s_desk_pressed_mask; + ob_s_desk_unset_mask; + ob_a_focused_pressed_set_desk->texture[0].data.mask.mask = + ob_a_unfocused_pressed_set_desk->texture[0].data.mask.mask = + ob_s_desk_set_mask; ob_a_focused_unpressed_iconify->texture[0].data.mask.mask = ob_a_unfocused_unpressed_iconify->texture[0].data.mask.mask = - ob_s_iconify_unpressed_mask; - ob_a_focused_pressed_iconify->texture[0].data.mask.mask = + ob_a_focused_pressed_iconify->texture[0].data.mask.mask = ob_a_unfocused_pressed_iconify->texture[0].data.mask.mask = - ob_s_iconify_pressed_mask; + ob_s_iconify_mask; ob_a_focused_unpressed_max->texture[0].data.mask.color = ob_a_focused_pressed_max->texture[0].data.mask.color = + ob_a_focused_pressed_set_max->texture[0].data.mask.color = ob_a_focused_unpressed_close->texture[0].data.mask.color = ob_a_focused_pressed_close->texture[0].data.mask.color = ob_a_focused_unpressed_desk->texture[0].data.mask.color = ob_a_focused_pressed_desk->texture[0].data.mask.color = + ob_a_focused_pressed_set_desk->texture[0].data.mask.color = ob_a_focused_unpressed_iconify->texture[0].data.mask.color = ob_a_focused_pressed_iconify->texture[0].data.mask.color = ob_s_titlebut_focused_color; ob_a_unfocused_unpressed_max->texture[0].data.mask.color = ob_a_unfocused_pressed_max->texture[0].data.mask.color = + ob_a_unfocused_pressed_set_max->texture[0].data.mask.color = ob_a_unfocused_unpressed_close->texture[0].data.mask.color = ob_a_unfocused_pressed_close->texture[0].data.mask.color = ob_a_unfocused_unpressed_desk->texture[0].data.mask.color = ob_a_unfocused_pressed_desk->texture[0].data.mask.color = + ob_a_unfocused_pressed_set_desk->texture[0].data.mask.color = ob_a_unfocused_unpressed_iconify->texture[0].data.mask.color = ob_a_unfocused_pressed_iconify->texture[0].data.mask.color = ob_s_titlebut_unfocused_color; -- 2.45.2