summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@intel.com>2012-06-04 19:39:27 +0300
committerTiago Vignatti <tiago.vignatti@intel.com>2012-06-11 20:33:36 +0300
commitfd45b2f4c6d348e616efc07332f8d55138039f76 (patch)
tree4c21312a3fefd54005f8550a0fc7a4ae1b0f7ebf
parent55bbb844ceba6c241a453a4769b92bf750564ad8 (diff)
xwm: fix transient positioning
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. I've tested on the following: firefox, google-chrome, gtk3-demo's Menus widget. Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
-rw-r--r--src/xwayland/window-manager.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 389cc78..4127957 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -387,6 +387,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);
@@ -395,6 +396,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);
+
+ /* resize falls here */
+ if (configure_notify->window != window->id)
+ return;
+
+ weston_wm_window_get_child_position(window, &x, &y);
+ window->x = configure_notify->x - x;
+ window->y = configure_notify->y - y;
}
static void
@@ -1313,6 +1322,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;
@@ -1329,9 +1339,16 @@ xserver_map_shell_surface(struct weston_wm *wm,
}
parent = hash_table_lookup(wm->window_hash, window->transient_for->id);
+
+ /* non-decorated and non-toplevel windows, e.g. sub-menus */
+ if (!parent->decorate && parent->override_redirect) {
+ x = parent->x + t->margin;
+ y = parent->y + t->margin;
+ }
+
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,
+ window->x + t->margin - x,
+ window->y + t->margin - y,
WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
}