diff options
author | emersion <contact@emersion.fr> | 2018-04-02 10:57:45 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-02 10:57:45 -0400 |
commit | 61fabede14bb3a8fe9ee5a249352cd405fd1b9bf (patch) | |
tree | de0cc1378f2edba5cc194c8dcebe4d5fdaeda647 /sway/desktop/xwayland.c | |
parent | Add sway_view_impl (diff) | |
download | sway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.tar.gz sway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.tar.zst sway-61fabede14bb3a8fe9ee5a249352cd405fd1b9bf.zip |
Address review comments
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 93c78228..39076fab 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -33,22 +33,13 @@ static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) { | |||
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | static void set_size(struct sway_view *view, int width, int height) { | 36 | static void configure(struct sway_view *view, double ox, double oy, int width, |
37 | int height) { | ||
37 | if (!assert_xwayland(view)) { | 38 | if (!assert_xwayland(view)) { |
38 | return; | 39 | return; |
39 | } | 40 | } |
40 | view->sway_xwayland_surface->pending_width = width; | ||
41 | view->sway_xwayland_surface->pending_height = height; | ||
42 | |||
43 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 41 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
44 | wlr_xwayland_surface_configure(xsurface, xsurface->x, xsurface->y, | ||
45 | width, height); | ||
46 | } | ||
47 | 42 | ||
48 | static void set_position(struct sway_view *view, double ox, double oy) { | ||
49 | if (!assert_xwayland(view)) { | ||
50 | return; | ||
51 | } | ||
52 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 43 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); |
53 | if (!sway_assert(output, "view must be within tree to set position")) { | 44 | if (!sway_assert(output, "view must be within tree to set position")) { |
54 | return; | 45 | return; |
@@ -64,13 +55,12 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
64 | return; | 55 | return; |
65 | } | 56 | } |
66 | 57 | ||
67 | view->swayc->x = ox; | 58 | view_update_position(view, ox, oy); |
68 | view->swayc->y = oy; | ||
69 | 59 | ||
70 | wlr_xwayland_surface_configure(view->wlr_xwayland_surface, | 60 | view->sway_xwayland_surface->pending_width = width; |
71 | ox + loutput->x, oy + loutput->y, | 61 | view->sway_xwayland_surface->pending_height = height; |
72 | view->wlr_xwayland_surface->width, | 62 | wlr_xwayland_surface_configure(xsurface, ox + loutput->x, oy + loutput->y, |
73 | view->wlr_xwayland_surface->height); | 63 | width, height); |
74 | } | 64 | } |
75 | 65 | ||
76 | static void set_activated(struct sway_view *view, bool activated) { | 66 | static void set_activated(struct sway_view *view, bool activated) { |
@@ -90,8 +80,7 @@ static void _close(struct sway_view *view) { | |||
90 | 80 | ||
91 | static const struct sway_view_impl view_impl = { | 81 | static const struct sway_view_impl view_impl = { |
92 | .get_prop = get_prop, | 82 | .get_prop = get_prop, |
93 | .set_size = set_size, | 83 | .configure = configure, |
94 | .set_position = set_position, | ||
95 | .set_activated = set_activated, | 84 | .set_activated = set_activated, |
96 | .close = _close, | 85 | .close = _close, |
97 | }; | 86 | }; |
@@ -102,8 +91,8 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
102 | struct sway_view *view = sway_surface->view; | 91 | struct sway_view *view = sway_surface->view; |
103 | // NOTE: We intentionally discard the view's desired width here | 92 | // NOTE: We intentionally discard the view's desired width here |
104 | // TODO: Let floating views do whatever | 93 | // TODO: Let floating views do whatever |
105 | view->width = sway_surface->pending_width; | 94 | view_update_size(view, sway_surface->pending_width, |
106 | view->height = sway_surface->pending_height; | 95 | sway_surface->pending_height); |
107 | view_damage_from(view); | 96 | view_damage_from(view); |
108 | } | 97 | } |
109 | 98 | ||