X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus_cycle_popup.c;h=c7921fa991db3b09db6e1618fd1444e7083d6e4f;hb=6799c67c07e99c440f549802f60d9f16995ab711;hp=4d1dfaa35a87533dd9ab3b6bf66c2efcb1d9f684;hpb=f86fa2b3b49b1e790e84bd041f3e91cb63f369a4;p=chaz%2Fopenbox diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index 4d1dfaa3..c7921fa9 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -23,6 +23,7 @@ #include "screen.h" #include "focus.h" #include "openbox.h" +#include "config.h" #include "window.h" #include "event.h" #include "render/render.h" @@ -30,16 +31,16 @@ #include #include +/* Size of the icons, which can appear inside or outside of a hilite box */ +#define ICON_SIZE config_theme_window_list_icon_size /* Size of the hilite box around a window's icon */ -#define HILITE_SIZE 40 +#define HILITE_SIZE (ICON_SIZE + 2*HILITE_OFFSET) /* Width of the outer ring around the hilite box */ #define HILITE_WIDTH 2 /* Space between the outer ring around the hilite box and the icon inside it */ #define HILITE_MARGIN 1 /* Total distance from the edge of the hilite box to the icon inside it */ #define HILITE_OFFSET (HILITE_WIDTH + HILITE_MARGIN) -/* Size of the icons, which can appear inside or outside of a hilite box */ -#define ICON_SIZE (HILITE_SIZE - 2*HILITE_OFFSET) /* Margin area around the outside of the dialog */ #define OUTSIDE_BORDER 3 /* Margin area around the text */ @@ -54,6 +55,7 @@ typedef struct _ObFocusCyclePopupTarget ObFocusCyclePopupTarget; struct _ObFocusCyclePopupTarget { ObClient *client; + RrImage *icon; gchar *text; Window iconwin; /* This is used when the popup is in list mode */ @@ -139,8 +141,10 @@ void focus_cycle_popup_startup(gboolean reconfig) may or may not be used */ RrAppearanceAddTextures(popup.a_icon, 2); - popup.a_icon->texture[0].type = RR_TEXTURE_RGBA; + RrAppearanceClearTextures(popup.a_icon); + popup.a_icon->texture[0].type = RR_TEXTURE_IMAGE; + RrAppearanceClearTextures(popup.a_arrow); popup.a_arrow->texture[0].type = RR_TEXTURE_MASK; popup.a_arrow->texture[0].data.mask.color = ob_rr_theme->osd_color; @@ -212,9 +216,11 @@ void focus_cycle_popup_shutdown(gboolean reconfig) while(popup.targets) { ObFocusCyclePopupTarget *t = popup.targets->data; + RrImageUnref(t->icon); g_free(t->text); XDestroyWindow(obt_display, t->iconwin); XDestroyWindow(obt_display, t->textwin); + g_free(t); popup.targets = g_list_delete_link(popup.targets, popup.targets); } @@ -272,6 +278,8 @@ static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets, t->client = ft; t->text = text; + t->icon = client_icon(t->client); + RrImageRef(t->icon); /* own the icon so it won't go away */ t->iconwin = create_window(p->bg, 0, 0, NULL); t->textwin = create_window(p->bg, 0, 0, NULL); @@ -547,7 +555,6 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) /* row and column start from 0 */ const gint row = i / icons_per_row - p->scroll; const gint col = i % icons_per_row; - const ObClientIcon *icon; gint iconx, icony; gint list_mode_textx, list_mode_texty; RrAppearance *text; @@ -590,16 +597,13 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) } /* get the icon from the client */ - icon = client_icon(target->client, ICON_SIZE, ICON_SIZE); - p->a_icon->texture[0].data.rgba.width = icon->width; - p->a_icon->texture[0].data.rgba.height = icon->height; - p->a_icon->texture[0].data.rgba.twidth = ICON_SIZE; - p->a_icon->texture[0].data.rgba.theight = ICON_SIZE; - p->a_icon->texture[0].data.rgba.tx = HILITE_OFFSET; - p->a_icon->texture[0].data.rgba.ty = HILITE_OFFSET; - p->a_icon->texture[0].data.rgba.alpha = + p->a_icon->texture[0].data.image.twidth = ICON_SIZE; + p->a_icon->texture[0].data.image.theight = ICON_SIZE; + p->a_icon->texture[0].data.image.tx = HILITE_OFFSET; + p->a_icon->texture[0].data.image.ty = HILITE_OFFSET; + p->a_icon->texture[0].data.image.alpha = target->client->iconic ? OB_ICONIC_ALPHA : 0xff; - p->a_icon->texture[0].data.rgba.data = icon->data; + p->a_icon->texture[0].data.image.image = target->icon; /* Draw the hilite? */ p->a_icon->texture[1].type = (target == newtarget) ? @@ -685,6 +689,7 @@ void focus_cycle_popup_hide(void) while(popup.targets) { ObFocusCyclePopupTarget *t = popup.targets->data; + RrImageUnref(t->icon); g_free(t->text); XDestroyWindow(obt_display, t->iconwin); XDestroyWindow(obt_display, t->textwin); @@ -726,8 +731,7 @@ void focus_cycle_popup_single_show(struct _ObClient *c, } text = popup_get_name(c); - icon_popup_show(single_popup, text, client_icon(c, HILITE_SIZE, - HILITE_SIZE)); + icon_popup_show(single_popup, text, client_icon(c)); g_free(text); screen_hide_desktop_popup(); }