diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-03 10:51:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-03 10:51:45 -0400 |
commit | 80caaf8fcc184fbf5839c67cb32e66e8dcd0ab7b (patch) | |
tree | c20f7b856e8bb08b40b41bbab3afe6b9a0ff41f2 /rootston/desktop.c | |
parent | ec11a95d0c945d138cede66b7c6e53e343c82f8f (diff) | |
parent | cf713edc1052943ceaf33fd3b41242b5775fd924 (diff) |
Merge pull request #385 from emersion/resize-below-min-size
Fix moving views when resizing below min size
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r-- | rootston/desktop.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index f93d1df8..29f78ac7 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -45,9 +45,15 @@ void view_get_size(struct roots_view *view, struct wlr_box *box) { box->height = view->wlr_surface->current->height; } -void view_set_position(struct roots_view *view, double x, double y) { - if (view->set_position) { - view->set_position(view, x, y); +void view_activate(struct roots_view *view, bool activate) { + if (view->activate) { + view->activate(view, activate); + } +} + +void view_move(struct roots_view *view, double x, double y) { + if (view->move) { + view->move(view, x, y); return; } @@ -55,18 +61,23 @@ void view_set_position(struct roots_view *view, double x, double y) { view->y = y; } -void view_activate(struct roots_view *view, bool activate) { - if (view->activate) { - view->activate(view, activate); - } -} - void view_resize(struct roots_view *view, uint32_t width, uint32_t height) { if (view->resize) { view->resize(view, width, height); } } +void view_move_resize(struct roots_view *view, double x, double y, + uint32_t width, uint32_t height) { + if (view->move_resize) { + view->move_resize(view, x, y, width, height); + return; + } + + view_move(view, x, y); + view_resize(view, width, height); +} + void view_close(struct roots_view *view) { if (view->close) { view->close(view); @@ -101,7 +112,7 @@ bool view_center(struct roots_view *view) { double view_x = (double)(width - size.width) / 2 + l_output->x; double view_y = (double)(height - size.height) / 2 + l_output->y; - view_set_position(view, view_x, view_y); + view_move(view, view_x, view_y); return true; } |