X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fpopup.c;h=156ce8605b9751ee6205aff9bc7bcc892586291e;hb=db9190fb340d0e5e4b2591e13cac5b9926c8798d;hp=f341e0922dd543501e555875c032f0266ea23d17;hpb=9a3f05a780f8cbfeb68626552d25c48ab0245ca3;p=chaz%2Fopenbox diff --git a/openbox/popup.c b/openbox/popup.c index f341e092..156ce860 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -52,7 +52,8 @@ ObPopup *popup_new() InputOutput, RrVisual(ob_rr_inst), 0, NULL); XSetWindowBorderWidth(ob_display, self->bg, ob_rr_theme->fbwidth); - XSetWindowBorder(ob_display, self->bg, ob_rr_theme->frame_b_color->pixel); + XSetWindowBorder(ob_display, self->bg, + RrColorPixel(ob_rr_theme->frame_focused_border_color)); XMapWindow(ob_display, self->text); @@ -169,17 +170,14 @@ 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 * 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) { @@ -191,6 +189,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); @@ -326,8 +327,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, @@ -486,7 +488,8 @@ void pager_popup_delay_show(ObPagerPopup *self, gulong usec, for (i = self->desks; i < screen_num_desktops; ++i) { XSetWindowAttributes attr; - attr.border_pixel = RrColorPixel(ob_rr_theme->frame_b_color); + attr.border_pixel = + RrColorPixel(ob_rr_theme->frame_focused_border_color); self->wins[i] = XCreateWindow(ob_display, self->popup->bg, 0, 0, 1, 1, ob_rr_theme->fbwidth, RrDepth(ob_rr_inst), InputOutput, @@ -503,6 +506,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); }