aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/wl_shell.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-02 10:57:45 -0400
committerLibravatar emersion <contact@emersion.fr>2018-04-02 10:57:45 -0400
commit61fabede14bb3a8fe9ee5a249352cd405fd1b9bf (patch)
treede0cc1378f2edba5cc194c8dcebe4d5fdaeda647 /sway/desktop/wl_shell.c
parentAdd sway_view_impl (diff)
downloadsway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.tar.gz
sway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.tar.zst
sway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.zip
Address review comments
Diffstat (limited to 'sway/desktop/wl_shell.c')
-rw-r--r--sway/desktop/wl_shell.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
index e0909a03..6528a397 100644
--- a/sway/desktop/wl_shell.c
+++ b/sway/desktop/wl_shell.c
@@ -30,24 +30,18 @@ static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) {
30 } 30 }
31} 31}
32 32
33static void set_size(struct sway_view *view, int width, int height) { 33static void configure(struct sway_view *view, double ox, double oy, int width,
34 int height) {
34 if (!assert_wl_shell(view)) { 35 if (!assert_wl_shell(view)) {
35 return; 36 return;
36 } 37 }
38 view_update_position(view, ox, oy);
37 view->sway_wl_shell_surface->pending_width = width; 39 view->sway_wl_shell_surface->pending_width = width;
38 view->sway_wl_shell_surface->pending_height = height; 40 view->sway_wl_shell_surface->pending_height = height;
39 wlr_wl_shell_surface_configure(view->wlr_wl_shell_surface, 0, width, height); 41 wlr_wl_shell_surface_configure(view->wlr_wl_shell_surface, 0, width, height);
40} 42}
41 43
42static void set_position(struct sway_view *view, double ox, double oy) { 44static void _close(struct sway_view *view) {
43 if (!assert_wl_shell(view)) {
44 return;
45 }
46 view->swayc->x = ox;
47 view->swayc->y = oy;
48}
49
50static void close(struct sway_view *view) {
51 if (!assert_wl_shell(view)) { 45 if (!assert_wl_shell(view)) {
52 return; 46 return;
53 } 47 }
@@ -57,9 +51,8 @@ static void close(struct sway_view *view) {
57 51
58static const struct sway_view_impl view_impl = { 52static const struct sway_view_impl view_impl = {
59 .get_prop = get_prop, 53 .get_prop = get_prop,
60 .set_size = set_size, 54 .configure = configure,
61 .set_position = set_position, 55 .close = _close,
62 .close = close,
63}; 56};
64 57
65static void handle_commit(struct wl_listener *listener, void *data) { 58static void handle_commit(struct wl_listener *listener, void *data) {
@@ -68,8 +61,8 @@ static void handle_commit(struct wl_listener *listener, void *data) {
68 struct sway_view *view = sway_surface->view; 61 struct sway_view *view = sway_surface->view;
69 // NOTE: We intentionally discard the view's desired width here 62 // NOTE: We intentionally discard the view's desired width here
70 // TODO: Let floating views do whatever 63 // TODO: Let floating views do whatever
71 view->width = sway_surface->pending_width; 64 view_update_size(view, sway_surface->pending_width,
72 view->height = sway_surface->pending_height; 65 sway_surface->pending_height);
73 view_damage_from(view); 66 view_damage_from(view);
74} 67}
75 68