mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
Forward-port xdg-shell-v6 positioner improvements
This commit is contained in:
parent
278aa84619
commit
2e3d901ac5
5 changed files with 79 additions and 104 deletions
|
|
@ -165,14 +165,19 @@ static void create_popup() {
|
|||
}
|
||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||
assert(xdg_wm_base && surface);
|
||||
struct xdg_surface *xdg_surface = xdg_wm_base_get_xdg_surface(
|
||||
xdg_wm_base, surface);
|
||||
struct xdg_positioner *xdg_positioner = xdg_wm_base_create_positioner(
|
||||
xdg_wm_base);
|
||||
struct xdg_surface *xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface(xdg_wm_base, surface);
|
||||
struct xdg_positioner *xdg_positioner =
|
||||
xdg_wm_base_create_positioner(xdg_wm_base);
|
||||
assert(xdg_surface && xdg_positioner);
|
||||
|
||||
xdg_positioner_set_size(xdg_positioner, 256, 256);
|
||||
xdg_positioner_set_anchor_rect(xdg_positioner, 0, 0, width, height);
|
||||
xdg_positioner_set_offset(xdg_positioner, 0, 0);
|
||||
xdg_positioner_set_anchor_rect(xdg_positioner, cur_x, cur_y, 1, 1);
|
||||
xdg_positioner_set_anchor(xdg_positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
|
||||
xdg_positioner_set_gravity(xdg_positioner, XDG_POSITIONER_GRAVITY_TOP_LEFT);
|
||||
xdg_positioner_set_constraint_adjustment(xdg_positioner,
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE);
|
||||
|
||||
popup = xdg_surface_get_popup(xdg_surface, NULL, xdg_positioner);
|
||||
assert(popup);
|
||||
|
|
@ -185,6 +190,8 @@ static void create_popup() {
|
|||
wl_surface_commit(surface);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
xdg_positioner_destroy(xdg_positioner);
|
||||
|
||||
struct wl_egl_window *egl_window;
|
||||
struct wlr_egl_surface *egl_surface;
|
||||
egl_window = wl_egl_window_create(surface, 256, 256);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue