summaryrefslogtreecommitdiff
path: root/openbox/place.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2013-08-11 14:33:46 +0200
committerDana Jansens <danakj@orodu.net>2013-08-11 13:07:49 -0400
commitb2b5df767cc54539f75fc1263fe21f8a0ab1d797 (patch)
tree06e705da11df2bb5bf78858c576945be85b47998 /openbox/place.c
parent937ba3c7e791111bd94153866545dd9bb8334c7f (diff)
Allow specifying only one of width and height in per-app settings size
Fixes bug 5819.
Diffstat (limited to 'openbox/place.c')
-rw-r--r--openbox/place.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/openbox/place.c b/openbox/place.c
index d2d66e02..7d5c8694 100644
--- a/openbox/place.c
+++ b/openbox/place.c
@@ -322,28 +322,32 @@ static void place_per_app_setting_size(ObClient *client, Rect *screen,
gint *w, gint *h,
ObAppSettings *settings)
{
- if (!settings || !settings->size_given)
+ if (!settings)
return;
- ob_debug("sizing by per-app settings");
-
- g_assert(settings->width_num > 0);
+ g_assert(settings->width_num >= 0);
g_assert(settings->width_denom >= 0);
- g_assert(settings->height_num > 0);
+ g_assert(settings->height_num >= 0);
g_assert(settings->height_denom >= 0);
- if (!settings->width_denom)
- *w = settings->width_num;
- else {
- *w = screen->width * settings->width_num / settings->width_denom;
- *w = MIN(*w, screen->width);
+ if (settings->width_num) {
+ ob_debug("setting width by per-app settings");
+ if (!settings->width_denom)
+ *w = settings->width_num;
+ else {
+ *w = screen->width * settings->width_num / settings->width_denom;
+ *w = MIN(*w, screen->width);
+ }
}
- if (!settings->height_denom)
- *h = settings->height_num;
- else {
- *h = screen->height * settings->height_num / settings->height_denom;
- *h = MIN(*h, screen->height);
+ if (settings->height_num) {
+ ob_debug("setting height by per-app settings");
+ if (!settings->height_denom)
+ *h = settings->height_num;
+ else {
+ *h = screen->height * settings->height_num / settings->height_denom;
+ *h = MIN(*h, screen->height);
+ }
}
}