diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-14 21:17:40 -0400 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-04-23 11:24:06 +0200 |
commit | 2e3d901ac56f962d2ac9aab8b86c01b388c593f5 (patch) | |
tree | c2b3e3c899b3ab157013c18f2814616f69b30738 /examples | |
parent | 278aa846195ceb8ea85c181aba21e0befbcce5de (diff) |
Forward-port xdg-shell-v6 positioner improvements
Diffstat (limited to 'examples')
-rw-r--r-- | examples/layer-shell.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/layer-shell.c b/examples/layer-shell.c index eee90b73..ac6e8a9e 100644 --- a/examples/layer-shell.c +++ b/examples/layer-shell.c @@ -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); |