/* 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 * self->iconhm + 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) {
} 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);
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,
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);
}