mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-26 21:58:08 +01:00
xwayland: Cleanup geometry handling on commit
Instead of doing this roundabout thing where we get the surface from the view, let's instead get it from the `wlr_surface_state` that we already track in `handle_commit`. This makes the NULL state impossible which is what the old `get_geometry` is checking for and generally cleans things up a little bit. Also don't check if the geometry x/y changed, those will always be 0 for xwayland.
This commit is contained in:
parent
6e5fc4c2aa
commit
ed2724bd6c
1 changed files with 5 additions and 16 deletions
|
@ -414,17 +414,6 @@ static const struct sway_view_impl view_impl = {
|
||||||
.destroy = destroy,
|
.destroy = destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void get_geometry(struct sway_view *view, struct wlr_box *box) {
|
|
||||||
box->x = box->y = 0;
|
|
||||||
if (view->surface) {
|
|
||||||
box->width = view->surface->current.width;
|
|
||||||
box->height = view->surface->current.height;
|
|
||||||
} else {
|
|
||||||
box->width = 0;
|
|
||||||
box->height = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_commit(struct wl_listener *listener, void *data) {
|
static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xwayland_view *xwayland_view =
|
struct sway_xwayland_view *xwayland_view =
|
||||||
wl_container_of(listener, xwayland_view, commit);
|
wl_container_of(listener, xwayland_view, commit);
|
||||||
|
@ -432,12 +421,12 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
struct wlr_surface_state *state = &xsurface->surface->current;
|
struct wlr_surface_state *state = &xsurface->surface->current;
|
||||||
|
|
||||||
struct wlr_box new_geo;
|
struct wlr_box new_geo = {0};
|
||||||
get_geometry(view, &new_geo);
|
new_geo.width = state->width;
|
||||||
|
new_geo.height = state->height;
|
||||||
|
|
||||||
bool new_size = new_geo.width != view->geometry.width ||
|
bool new_size = new_geo.width != view->geometry.width ||
|
||||||
new_geo.height != view->geometry.height ||
|
new_geo.height != view->geometry.height;
|
||||||
new_geo.x != view->geometry.x ||
|
|
||||||
new_geo.y != view->geometry.y;
|
|
||||||
|
|
||||||
if (new_size) {
|
if (new_size) {
|
||||||
// The client changed its surface size in this commit. For floating
|
// The client changed its surface size in this commit. For floating
|
||||||
|
|
Loading…
Reference in a new issue