Fix floating position when view is floated when mapped
This commit is contained in:
parent
f7cadf2333
commit
9119f87655
|
@ -173,17 +173,13 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xdg_shell_view *xdg_shell_view =
|
struct sway_xdg_shell_view *xdg_shell_view =
|
||||||
wl_container_of(listener, xdg_shell_view, commit);
|
wl_container_of(listener, xdg_shell_view, commit);
|
||||||
struct sway_view *view = &xdg_shell_view->view;
|
struct sway_view *view = &xdg_shell_view->view;
|
||||||
int width = view->wlr_xdg_surface->geometry.width;
|
|
||||||
int height = view->wlr_xdg_surface->geometry.height;
|
|
||||||
if (!width && !height) {
|
|
||||||
width = view->wlr_xdg_surface->surface->current->width;
|
|
||||||
height = view->wlr_xdg_surface->surface->current->height;
|
|
||||||
}
|
|
||||||
if (!view->natural_width && !view->natural_height) {
|
|
||||||
view->natural_width = width;
|
|
||||||
view->natural_height = height;
|
|
||||||
}
|
|
||||||
if (view->swayc && container_is_floating(view->swayc)) {
|
if (view->swayc && container_is_floating(view->swayc)) {
|
||||||
|
int width = view->wlr_xdg_surface->geometry.width;
|
||||||
|
int height = view->wlr_xdg_surface->geometry.height;
|
||||||
|
if (!width && !height) {
|
||||||
|
width = view->wlr_xdg_surface->surface->current->width;
|
||||||
|
height = view->wlr_xdg_surface->surface->current->height;
|
||||||
|
}
|
||||||
view_update_size(view, width, height);
|
view_update_size(view, width, height);
|
||||||
} else {
|
} else {
|
||||||
view_update_size(view, xdg_shell_view->pending_width,
|
view_update_size(view, xdg_shell_view->pending_width,
|
||||||
|
@ -216,6 +212,12 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
||||||
struct sway_view *view = &xdg_shell_view->view;
|
struct sway_view *view = &xdg_shell_view->view;
|
||||||
struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface;
|
||||||
|
|
||||||
|
view->natural_width = view->wlr_xdg_surface->geometry.width;
|
||||||
|
view->natural_height = view->wlr_xdg_surface->geometry.height;
|
||||||
|
if (!view->natural_width && !view->natural_height) {
|
||||||
|
view->natural_width = view->wlr_xdg_surface->surface->current->width;
|
||||||
|
view->natural_height = view->wlr_xdg_surface->surface->current->height;
|
||||||
|
}
|
||||||
view_map(view, view->wlr_xdg_surface->surface);
|
view_map(view, view->wlr_xdg_surface->surface);
|
||||||
|
|
||||||
xdg_shell_view->commit.notify = handle_commit;
|
xdg_shell_view->commit.notify = handle_commit;
|
||||||
|
|
|
@ -172,17 +172,13 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
|
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
|
||||||
wl_container_of(listener, xdg_shell_v6_view, commit);
|
wl_container_of(listener, xdg_shell_v6_view, commit);
|
||||||
struct sway_view *view = &xdg_shell_v6_view->view;
|
struct sway_view *view = &xdg_shell_v6_view->view;
|
||||||
int width = view->wlr_xdg_surface_v6->geometry.width;
|
|
||||||
int height = view->wlr_xdg_surface_v6->geometry.height;
|
|
||||||
if (!width && !height) {
|
|
||||||
width = view->wlr_xdg_surface_v6->surface->current->width;
|
|
||||||
height = view->wlr_xdg_surface_v6->surface->current->height;
|
|
||||||
}
|
|
||||||
if (!view->natural_width && !view->natural_height) {
|
|
||||||
view->natural_width = width;
|
|
||||||
view->natural_height = height;
|
|
||||||
}
|
|
||||||
if (view->swayc && container_is_floating(view->swayc)) {
|
if (view->swayc && container_is_floating(view->swayc)) {
|
||||||
|
int width = view->wlr_xdg_surface_v6->geometry.width;
|
||||||
|
int height = view->wlr_xdg_surface_v6->geometry.height;
|
||||||
|
if (!width && !height) {
|
||||||
|
width = view->wlr_xdg_surface_v6->surface->current->width;
|
||||||
|
height = view->wlr_xdg_surface_v6->surface->current->height;
|
||||||
|
}
|
||||||
view_update_size(view, width, height);
|
view_update_size(view, width, height);
|
||||||
} else {
|
} else {
|
||||||
view_update_size(view, xdg_shell_v6_view->pending_width,
|
view_update_size(view, xdg_shell_v6_view->pending_width,
|
||||||
|
@ -215,6 +211,12 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
||||||
struct sway_view *view = &xdg_shell_v6_view->view;
|
struct sway_view *view = &xdg_shell_v6_view->view;
|
||||||
struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6;
|
struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6;
|
||||||
|
|
||||||
|
view->natural_width = view->wlr_xdg_surface_v6->geometry.width;
|
||||||
|
view->natural_height = view->wlr_xdg_surface_v6->geometry.height;
|
||||||
|
if (!view->natural_width && !view->natural_height) {
|
||||||
|
view->natural_width = view->wlr_xdg_surface_v6->surface->current->width;
|
||||||
|
view->natural_height = view->wlr_xdg_surface_v6->surface->current->height;
|
||||||
|
}
|
||||||
view_map(view, view->wlr_xdg_surface_v6->surface);
|
view_map(view, view->wlr_xdg_surface_v6->surface);
|
||||||
|
|
||||||
xdg_shell_v6_view->commit.notify = handle_commit;
|
xdg_shell_v6_view->commit.notify = handle_commit;
|
||||||
|
|
|
@ -235,10 +235,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, xwayland_view, commit);
|
wl_container_of(listener, xwayland_view, commit);
|
||||||
struct sway_view *view = &xwayland_view->view;
|
struct sway_view *view = &xwayland_view->view;
|
||||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
if (!view->natural_width && !view->natural_height) {
|
|
||||||
view->natural_width = xsurface->width;
|
|
||||||
view->natural_height = xsurface->height;
|
|
||||||
}
|
|
||||||
if (view->swayc && container_is_floating(view->swayc)) {
|
if (view->swayc && container_is_floating(view->swayc)) {
|
||||||
view_update_size(view, xsurface->width, xsurface->height);
|
view_update_size(view, xsurface->width, xsurface->height);
|
||||||
view_update_position(view,
|
view_update_position(view,
|
||||||
|
@ -263,6 +259,9 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xwayland_surface *xsurface = data;
|
struct wlr_xwayland_surface *xsurface = data;
|
||||||
struct sway_view *view = &xwayland_view->view;
|
struct sway_view *view = &xwayland_view->view;
|
||||||
|
|
||||||
|
view->natural_width = xsurface->width;
|
||||||
|
view->natural_height = xsurface->height;
|
||||||
|
|
||||||
// Wire up the commit listener here, because xwayland map/unmap can change
|
// Wire up the commit listener here, because xwayland map/unmap can change
|
||||||
// the underlying wlr_surface
|
// the underlying wlr_surface
|
||||||
wl_signal_add(&xsurface->surface->events.commit, &xwayland_view->commit);
|
wl_signal_add(&xsurface->surface->events.commit, &xwayland_view->commit);
|
||||||
|
|
Loading…
Reference in a new issue