summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-05-28 01:40:21 +0000
committerDana Jansens <danakj@orodu.net>2003-05-28 01:40:21 +0000
commitb7780b749f5a8a9b0e4ff27736edaf2336238507 (patch)
treea77363a688f2ca38578842a64d866076f2dd2c8e
parent4b2ec0d03c1f9706f542d5b64e08a1fca6ca508a (diff)
proper centering of the text in popups without icons
-rw-r--r--openbox/popup.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/openbox/popup.c b/openbox/popup.c
index efde0758..a550e815 100644
--- a/openbox/popup.c
+++ b/openbox/popup.c
@@ -83,7 +83,7 @@ void popup_size_to_string(Popup *self, char *text)
self->h = texth + theme_bevel * 2;
iconw = (self->hasicon ? texth : 0);
- self->w = textw + iconw + theme_bevel * 3;
+ self->w = textw + iconw + theme_bevel * (self->hasicon ? 3 : 2);
}
void popup_show(Popup *self, char *text, Icon *icon)
@@ -149,9 +149,9 @@ void popup_show(Popup *self, char *text, Icon *icon)
iconw = (self->hasicon ? texth : 0);
if (self->w) {
w = self->w;
- textw = w - (iconw + theme_bevel * 3);
+ textw = w - (iconw + theme_bevel * (self->hasicon ? 3 : 2));
} else
- w = textw + iconw + theme_bevel * 3;
+ w = textw + iconw + theme_bevel * (self->hasicon ? 3 : 2);
/* sanity checks to avoid crashes! */
if (w < 1) w = 1;
if (h < 1) h = 1;
@@ -196,10 +196,12 @@ void popup_show(Popup *self, char *text, Icon *icon)
RECT_SET(self->a_text->texture[0].position, theme_bevel, theme_bevel,
textw - theme_bevel * 2, texth - theme_bevel * 2);
self->a_text->surface.data.planar.parent = self->a_bg;
- self->a_text->surface.data.planar.parentx = iconw + theme_bevel * 2;
+ self->a_text->surface.data.planar.parentx = iconw +
+ theme_bevel * (self->hasicon ? 2 : 1);
self->a_text->surface.data.planar.parenty = theme_bevel;
XMoveResizeWindow(ob_display, self->text,
- iconw + theme_bevel * 2, theme_bevel, textw, texth);
+ iconw + theme_bevel * (self->hasicon ? 2 : 1),
+ theme_bevel, textw, texth);
if (self->hasicon) {
if (iconw < 1) iconw = 1; /* sanity check for crashes */