[PATCH weston 08/10] xserver: treat tooltips differently from the others
Tiago Vignatti
tiago.vignatti at intel.com
Fri May 18 08:47:15 PDT 2012
tooltips follows the pointer, whereas most of the other transient is surface
relative.
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/xserver-launcher.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c
index 7c7bd0b..2cf5d1f 100644
--- a/src/xserver-launcher.c
+++ b/src/xserver-launcher.c
@@ -133,6 +133,8 @@ struct weston_wm_window {
struct weston_wm_window *transient_for;
uint32_t protocols;
xcb_atom_t type;
+ const char *atom_name;
+ uint32_t configured_x, configured_y;
int width, height;
};
@@ -321,6 +323,7 @@ weston_wm_window_read_properties(struct weston_wm_window *window)
break;
case XCB_ATOM_ATOM:
atom = xcb_get_property_value(reply);
+ window->atom_name = get_atom_name(wm->conn, *atom);
*(xcb_atom_t *) p = *atom;
break;
case TYPE_WM_PROTOCOLS:
@@ -644,6 +647,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
if (configure_notify->window != window->id)
return;
+ window->configured_x = configure_notify->x;
+ window->configured_y = configure_notify->y;
window->width = configure_notify->width;
window->height = configure_notify->height;
@@ -1788,19 +1793,23 @@ xserver_map_shell_surface(struct weston_wm *wm,
shell_interface->create_shell_surface(shell_interface->shell,
window->surface, &window->shsurf);
- if (!window->transient_for)
+ if (!window->transient_for) {
shell_interface->set_toplevel(window->shsurf);
- else {
- parent = hash_table_lookup(wm->window_hash,
- window->transient_for->id);
+ return;
+ }
+
+ parent = hash_table_lookup(wm->window_hash, window->transient_for->id);
+ if (!strcmp(window->atom_name, "_NET_WM_WINDOW_TYPE_TOOLTIP")) {
pointer = wm->server->compositor->seat->pointer;
- shell_interface->set_transient(window->shsurf,
- parent->shsurf,
- wl_fixed_to_int(pointer.x) -
- parent->surface->geometry.x,
- wl_fixed_to_int(pointer.y) -
- parent->surface->geometry.y + offset_y,
- WL_SHELL_SURFACE_TRANSIENT_METHOD_INACTIVE);
+ shell_interface->set_transient(window->shsurf, parent->shsurf,
+ wl_fixed_to_int(pointer.x) - parent->surface->geometry.x,
+ wl_fixed_to_int(pointer.y) - parent->surface->geometry.y +
+ offset_y,
+ WL_SHELL_SURFACE_TRANSIENT_METHOD_INACTIVE);
+ } else {
+ shell_interface->set_transient(window->shsurf, parent->shsurf,
+ window->configured_x, window->configured_y,
+ WL_SHELL_SURFACE_TRANSIENT_METHOD_INACTIVE);
}
}
--
1.7.9.5
More information about the wayland-devel
mailing list