mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-15 08:56:26 -05:00
rootston: view set position
This commit is contained in:
parent
0536ea3c47
commit
169bc216ed
5 changed files with 58 additions and 23 deletions
|
|
@ -109,19 +109,6 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||
view->type = ROOTS_WL_SHELL_VIEW;
|
||||
|
||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) {
|
||||
// we need to map it relative to the parent
|
||||
int i =
|
||||
list_seq_find(desktop->views,
|
||||
shell_surface_compare_equals, surface->parent);
|
||||
if (i != -1) {
|
||||
struct roots_view *parent = desktop->views->items[i];
|
||||
view->x = parent->x + surface->transient_state->x;
|
||||
view->y = parent->y + surface->transient_state->y;
|
||||
}
|
||||
} else {
|
||||
view->x = view->y = 200;
|
||||
}
|
||||
view->wl_shell_surface = surface;
|
||||
view->roots_wl_shell_surface = roots_surface;
|
||||
view->wlr_surface = surface->surface;
|
||||
|
|
@ -131,4 +118,17 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
roots_surface->view = view;
|
||||
list_add(desktop->views, view);
|
||||
view_initialize(view);
|
||||
|
||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) {
|
||||
// we need to map it relative to the parent
|
||||
int i =
|
||||
list_seq_find(desktop->views,
|
||||
shell_surface_compare_equals, surface->parent);
|
||||
if (i != -1) {
|
||||
struct roots_view *parent = desktop->views->items[i];
|
||||
view_set_position(view,
|
||||
parent->x + surface->transient_state->x,
|
||||
parent->y + surface->transient_state->y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue