[PATCH weston 2/3] xwm: fix positioning of transient surfaces
Tiago Vignatti
tiago.vignatti at intel.com
Fri May 25 07:50:05 PDT 2012
commit eaee7841 took out the configure positioning of windows. This patch
brings it back and addresses also logic for resizing and sub-menus, that was
not covered on that commit.
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/xwayland/window-manager.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index b6aac2a..3cc0a50 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -409,6 +409,7 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
xcb_configure_notify_event_t *configure_notify =
(xcb_configure_notify_event_t *) event;
struct weston_wm_window *window;
+ int x, y;
window = hash_table_lookup(wm->window_hash, configure_notify->window);
@@ -417,6 +418,14 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
configure_notify->window,
configure_notify->x, configure_notify->y,
configure_notify->width, configure_notify->height);
+
+ /* fetch the position only when configure notify come for client type
+ * of windows, so for instance a resize action won't fall here */
+ if (configure_notify->window == window->id) {
+ weston_wm_window_get_child_position(window, &x, &y);
+ window->x = configure_notify->x - x;
+ window->y = configure_notify->y - y;
+ }
}
static void
@@ -1290,6 +1299,7 @@ xserver_map_shell_surface(struct weston_wm *wm,
&wm->server->compositor->shell_interface;
struct weston_wm_window *parent;
struct theme *t = window->wm->theme;
+ int x = 0, y = 0;
if (!shell_interface->create_shell_surface)
return;
@@ -1305,10 +1315,16 @@ xserver_map_shell_surface(struct weston_wm *wm,
}
parent = hash_table_lookup(wm->window_hash, window->transient_for->id);
+
+ /* treat sub-menus */
+ if (parent->x != 0 && parent->y != 0) {
+ x = parent->x + t->margin + t->width;
+ y = parent->y + t->margin + t->titlebar_height;
+ }
shell_interface->set_transient(window->shsurf, parent->shsurf,
- window->x - parent->x + t->margin + t->width,
- window->y - parent->y + t->margin + t->titlebar_height,
- WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
+ window->x + t->margin + t->width - x,
+ window->y + t->margin + t->titlebar_height - y,
+ WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
}
static void
--
1.7.9.5
More information about the wayland-devel
mailing list