summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-05-30 12:15:44 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-05-30 12:15:44 -0400
commita6d9a5e4aa9cfecbfea044bd3ee1ec219adc4879 (patch)
tree581006208308f1800d4b6366fdaa004d98217a4f
parentf197e9f7a39bdf736cda4abf825fbbab8cbe16e0 (diff)
xwm: Set WM_STATE window property
xprop and gtk+ dnd is now working.
-rw-r--r--src/xwayland/window-manager.c26
-rw-r--r--src/xwayland/xwayland.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 53b578d..9444132 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -443,6 +443,28 @@ our_resource(struct weston_wm *wm, uint32_t id)
return (id & ~setup->resource_id_mask) == setup->resource_id_base;
}
+#define ICCCM_WITHDRAWN_STATE 0
+#define ICCCM_NORMAL_STATE 1
+#define ICCCM_ICONIC_STATE 3
+
+static void
+weston_wm_window_set_state(struct weston_wm_window *window, int32_t state)
+{
+ struct weston_wm *wm = window->wm;
+ uint32_t property[2];
+
+ property[0] = state;
+ property[1] = XCB_WINDOW_NONE;
+
+ xcb_change_property(wm->conn,
+ XCB_PROP_MODE_REPLACE,
+ window->id,
+ wm->atom.wm_state,
+ wm->atom.wm_state,
+ 32, /* format */
+ 2, property);
+}
+
static void
weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
{
@@ -498,6 +520,7 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
xcb_map_window(wm->conn, map_request->window);
xcb_map_window(wm->conn, window->frame_id);
+ weston_wm_window_set_state(window, ICCCM_NORMAL_STATE);
window->cairo_surface =
cairo_xcb_surface_create_with_xrender_format(wm->conn,
@@ -555,6 +578,8 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
xcb_reparent_window(wm->conn, window->id, wm->wm_window, 0, 0);
xcb_destroy_window(wm->conn, window->frame_id);
+ weston_wm_window_set_state(window, ICCCM_WITHDRAWN_STATE);
+
window->frame_id = XCB_WINDOW_NONE;
if (wm->focus_window == window)
wm->focus_window = NULL;
@@ -949,6 +974,7 @@ wxs_wm_get_resources(struct weston_wm *wm)
{ "WM_PROTOCOLS", F(atom.wm_protocols) },
{ "WM_TAKE_FOCUS", F(atom.wm_take_focus) },
{ "WM_DELETE_WINDOW", F(atom.wm_delete_window) },
+ { "WM_STATE", F(atom.wm_state) },
{ "_NET_WM_NAME", F(atom.net_wm_name) },
{ "_NET_WM_ICON", F(atom.net_wm_icon) },
{ "_NET_WM_STATE", F(atom.net_wm_state) },
diff --git a/src/xwayland/xwayland.h b/src/xwayland/xwayland.h
index 26be7de..1b1cdff 100644
--- a/src/xwayland/xwayland.h
+++ b/src/xwayland/xwayland.h
@@ -79,6 +79,7 @@ struct weston_wm {
xcb_atom_t wm_protocols;
xcb_atom_t wm_take_focus;
xcb_atom_t wm_delete_window;
+ xcb_atom_t wm_state;
xcb_atom_t net_wm_name;
xcb_atom_t net_wm_icon;
xcb_atom_t net_wm_state;