X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fpopup.c;h=e3d52e496a5be3b12c074ee9c17068d04aeed1f3;hb=b23476ed5855bf92d6e0038bdcecf0141849ddea;hp=bf682aafb6c7a659ddc29b4c3b4336eb3e156ada;hpb=82b2f0aa7a1723632e8d3cf7dc772e4bdb66868a;p=chaz%2Fopenbox diff --git a/openbox/popup.c b/openbox/popup.c index bf682aaf..e3d52e49 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -39,6 +39,7 @@ ObPopup *popup_new() self->x = self->y = self->textw = self->h = 0; self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg); self->a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label); + self->iconwm = self->iconhm = 1; attrib.override_redirect = True; self->bg = XCreateWindow(ob_display, RootWindow(ob_display, ob_screen), @@ -168,27 +169,28 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text) /* get the height, which is also used for the icon width */ emptyy = t + b + ob_rr_theme->paddingy * 2; - if (self->h) { - h = self->h; - texth = h - emptyy; - } else - h = texth + emptyy; + if (self->h) + texth = self->h - emptyy; + h = texth * self->iconhm + emptyy; if (self->textw) textw = self->textw; iconx = textx = l + ob_rr_theme->paddingx; - icony = texty = t + ob_rr_theme->paddingy; emptyx = l + r + ob_rr_theme->paddingx * 2; if (self->hasicon) { - iconw = iconh = texth; + iconw = texth * self->iconwm; + iconh = texth * self->iconhm; textx += iconw + ob_rr_theme->paddingx; if (textw) emptyx += ob_rr_theme->paddingx; /* between the icon and text */ } else iconw = 0; + texty = (h - texth - emptyy) / 2 + t + ob_rr_theme->paddingy; + icony = (h - iconh - emptyy) / 2 + t + ob_rr_theme->paddingy; + w = textw + emptyx + iconw; /* cap it at maxw/minw */ if (self->maxw) w = MIN(w, self->maxw); @@ -322,6 +324,13 @@ void icon_popup_delay_show(ObIconPopup *self, gulong usec, popup_delay_show(self->popup, usec, text); } +void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm) +{ + /* cap them at 1 */ + self->popup->iconwm = MAX(1, wm); + self->popup->iconhm = MAX(1, hm); +} + static void pager_popup_draw_icon(gint px, gint py, gint w, gint h, gpointer data) { @@ -492,3 +501,10 @@ void pager_popup_delay_show(ObPagerPopup *self, gulong usec, popup_delay_show(self->popup, usec, text); } + +void pager_popup_icon_size_multiplier(ObPagerPopup *self, guint wm, guint hm) +{ + /* cap them at 1 */ + self->popup->iconwm = MAX(1, wm); + self->popup->iconhm = MAX(1, hm); +}