X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fpopup.c;h=e3d52e496a5be3b12c074ee9c17068d04aeed1f3;hb=0fedacf700e9f8af32a8fdda91a369b5562ab4ba;hp=5c96f073a90b71d68ac449c0bdf605eff33e8714;hpb=5a96dee7565a1bdbf3088b2eaac276a932742cf6;p=chaz%2Fopenbox diff --git a/openbox/popup.c b/openbox/popup.c index 5c96f073..e3d52e49 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -177,7 +177,6 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text) 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) { @@ -189,6 +188,9 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *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); @@ -324,8 +326,9 @@ void icon_popup_delay_show(ObIconPopup *self, gulong usec, void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm) { - if (wm != 0) self->popup->iconwm = wm; - if (hm != 0) self->popup->iconhm = 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, @@ -501,6 +504,7 @@ void pager_popup_delay_show(ObPagerPopup *self, gulong usec, void pager_popup_icon_size_multiplier(ObPagerPopup *self, guint wm, guint hm) { - if (wm != 0) self->popup->iconwm = wm; - if (hm != 0) self->popup->iconhm = hm; + /* cap them at 1 */ + self->popup->iconwm = MAX(1, wm); + self->popup->iconhm = MAX(1, hm); }