From 12d4c8666c9475f254783fd33d1eb2b47f32e030 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 17 Apr 2003 05:43:41 +0000 Subject: [PATCH] add support for net_moveresize_window and net_wm_moveresize --- openbox/event.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++- openbox/prop.c | 1 + openbox/prop.h | 1 + openbox/screen.c | 21 +++++++++++------ 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index f9191255..f02f2506 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -662,7 +662,66 @@ static void event_handle_client(Client *client, XEvent *e) client_shade(client, FALSE); client_focus(client); stacking_raise(client); - } + } else if (msgtype == prop_atoms.net_wm_moveresize) { + g_message("net_wm_moveresize for 0x%lx", client->window); + if ((Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_topleft || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_top || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_topright || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_right || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_right || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_bottomright || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_bottom || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_bottomleft || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_left || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_move || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_size_keyboard || + (Atom)e->xclient.data.l[2] == + prop_atoms.net_wm_moveresize_move_keyboard) { + + moveresize_start(client, e->xclient.data.l[0], + e->xclient.data.l[1], e->xclient.data.l[2], + e->xclient.data.l[3]); + } + } else if (msgtype == prop_atoms.net_moveresize_window) { + int oldg = client->gravity; + int tmpg, x, y, w, h; + + if (e->xclient.data.l[0] & 0xff) + tmpg = e->xclient.data.l[0] & 0xff; + else + tmpg = oldg; + + if (e->xclient.data.l[0] & 1 << 8) + x = e->xclient.data.l[1]; + else + x = client->area.x; + if (e->xclient.data.l[0] & 1 << 9) + y = e->xclient.data.l[2]; + else + y = client->area.y; + if (e->xclient.data.l[0] & 1 << 10) + w = e->xclient.data.l[3]; + else + w = client->area.y; + if (e->xclient.data.l[0] & 1 << 11) + h = e->xclient.data.l[4]; + else + h = client->area.y; + client->gravity = tmpg; + client_configure(client, Corner_TopLeft, x, y, w, h, TRUE, TRUE); + client->gravity = oldg; + } break; case PropertyNotify: /* validate cuz we query stuff off the client here */ diff --git a/openbox/prop.c b/openbox/prop.c index cb432ac3..7117a91c 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -45,6 +45,7 @@ void prop_startup() CREATE(net_close_window, "_NET_CLOSE_WINDOW"); CREATE(net_wm_moveresize, "_NET_WM_MOVERESIZE"); + CREATE(net_moveresize_window, "_NET_MOVERESIZE_WINDOW"); CREATE(net_wm_name, "_NET_WM_NAME"); CREATE(net_wm_visible_name, "_NET_WM_VISIBLE_NAME"); diff --git a/openbox/prop.h b/openbox/prop.h index 2ed9f559..06ad1437 100644 --- a/openbox/prop.h +++ b/openbox/prop.h @@ -49,6 +49,7 @@ typedef struct Atoms { /* root window messages */ Atom net_close_window; Atom net_wm_moveresize; + Atom net_moveresize_window; /* application window properties */ Atom net_wm_name; Atom net_wm_visible_name; diff --git a/openbox/screen.c b/openbox/screen.c index 299bb684..118798e8 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -78,7 +78,7 @@ gboolean screen_annex() PROP_SET32(support_window, net_supporting_wm_check, window,support_window); /* set the _NET_SUPPORTED_ATOMS hint */ - num_support = 48; + num_support = 61; i = 0; supported = g_new(guint32, num_support); supported[i++] = prop_atoms.net_current_desktop; @@ -129,14 +129,21 @@ gboolean screen_annex() supported[i++] = prop_atoms.net_wm_state_fullscreen; supported[i++] = prop_atoms.net_wm_state_above; supported[i++] = prop_atoms.net_wm_state_below; + supported[i++] = prop_atoms.net_moveresize_window; + supported[i++] = prop_atoms.net_wm_moveresize; + supported[i++] = prop_atoms.net_wm_moveresize_size_topleft; + supported[i++] = prop_atoms.net_wm_moveresize_size_top; + supported[i++] = prop_atoms.net_wm_moveresize_size_topright; + supported[i++] = prop_atoms.net_wm_moveresize_size_right; + supported[i++] = prop_atoms.net_wm_moveresize_size_bottomright; + supported[i++] = prop_atoms.net_wm_moveresize_size_bottom; + supported[i++] = prop_atoms.net_wm_moveresize_size_bottomleft; + supported[i++] = prop_atoms.net_wm_moveresize_size_left; + supported[i++] = prop_atoms.net_wm_moveresize_move; + supported[i++] = prop_atoms.net_wm_moveresize_size_keyboard; + supported[i++] = prop_atoms.net_wm_moveresize_move_keyboard; g_assert(i == num_support); /* - supported[] = prop_atoms.net_wm_moveresize; - supported[] = prop_atoms.net_wm_moveresize_size_topleft; - supported[] = prop_atoms.net_wm_moveresize_size_topright; - supported[] = prop_atoms.net_wm_moveresize_size_bottomleft; - supported[] = prop_atoms.net_wm_moveresize_size_bottomright; - supported[] = prop_atoms.net_wm_moveresize_move; supported[] = prop_atoms.net_wm_action_stick; */ -- 2.45.2