Skip to content

view: adjust position according to declared top left corner#365

Open
joggee-fr wants to merge 2 commits intocage-kiosk:masterfrom
joggee-fr:jg/topleft
Open

view: adjust position according to declared top left corner#365
joggee-fr wants to merge 2 commits intocage-kiosk:masterfrom
joggee-fr:jg/topleft

Conversation

@joggee-fr
Copy link
Collaborator

The XDG surface geometry includes an (x,y) coordinate indicating the top left corner of the window. Use this information to correctly set the view position.


Split from PR #278, it should fix issue #254.

Comment on lines +67 to +72
struct wlr_box view_box;
view->impl->get_geometry(view, &view_box);

// Do not forget to adjust position according to top left corner declared in view geometry
view->lx = layout_box->x - view_box.x;
view->ly = layout_box->y - view_box.y;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm not sure this is the correct spot to read the window geometry. The window geometry is likely to change when the client redraws in the maximized state. This function runs before though, when we send the event to ask the client to redraw itself maximized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emersion, I understand the client may adjust geometry using xdg_surface::set_window_geometry() before calling (again) wl_surface::commit(). wlroots then calls the handler for map event and in Cage view_map(), view_position() and finally view_maximize() or view_center() where the new geometry can be accessed.

emersion and others added 2 commits May 25, 2025 14:55
The XDG surface geometry includes an (x,y) coordinate indicating the top
left corner of the window. Use this information to correctly set the
view position.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments