diff options
| author | Mikael Magnusson <mikachu@gmail.com> | 2014-10-06 18:20:51 +0200 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@gmail.com> | 2014-10-06 22:05:26 +0200 |
| commit | 2d289312ba13c358ad51aae560186949c7108dbf (patch) | |
| tree | 777c10f3aabce134b68c24c4c152da78a5492a8c /openbox | |
| parent | e02c2f4174ccb9e03956c59985cd710435c931f8 (diff) | |
Fix negative relative coordinate placement
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/place.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/openbox/place.c b/openbox/place.c index 91f87dca..1dc16c4f 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -296,24 +296,27 @@ static gboolean place_per_app_setting_position(ObClient *client, Rect *screen, ob_debug("placing by per-app settings"); if (settings->position.x.center) - *x = screen->x + screen->width / 2 - client->area.width / 2; - else if (settings->position.x.opposite) - *x = screen->x + screen->width - frame_size.width - - settings->position.x.pos; - else - *x = screen->x + settings->position.x.pos; - if (settings->position.x.denom) - *x = (*x * screen->width) / settings->position.x.denom; + *x = screen->width / 2 - client->area.width / 2; + else { + *x = settings->position.x.pos; + if (settings->position.x.denom) + *x = (*x * screen->width) / settings->position.x.denom; + if (settings->position.x.opposite) + *x = screen->width - frame_size.width - *x; + } if (settings->position.y.center) - *y = screen->y + screen->height / 2 - client->area.height / 2; - else if (settings->position.y.opposite) - *y = screen->y + screen->height - frame_size.height - - settings->position.y.pos; - else - *y = screen->y + settings->position.y.pos; - if (settings->position.y.denom) - *y = (*y * screen->height) / settings->position.y.denom; + *y = screen->height / 2 - client->area.height / 2; + else { + *y = settings->position.y.pos; + if (settings->position.y.denom) + *y = (*y * screen->height) / settings->position.y.denom; + if (settings->position.y.opposite) + *y = screen->height - frame_size.height - *y; + } + + *x += screen->x; + *y += screen->y; return TRUE; } |
