summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-10 04:06:50 +0000
committerDana Jansens <danakj@orodu.net>2007-05-10 04:06:50 +0000
commitc2c84c3f5ed75561d7d6502f787ab06bc7d984d2 (patch)
tree458bacc4398654f6f395bbb2de8e6a788644b050
parentae4bb6bcb25e3e8b2405b38baebc1859b8135454 (diff)
add support for _NET_RESTACK_WINDOW
-rw-r--r--openbox/event.c79
-rw-r--r--openbox/prop.c3
-rw-r--r--openbox/prop.h3
-rw-r--r--openbox/screen.c1
-rw-r--r--openbox/stacking.c44
-rw-r--r--openbox/stacking.h12
6 files changed, 99 insertions, 43 deletions
diff --git a/openbox/event.c b/openbox/event.c
index 0c594d6b..271114a2 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -1026,50 +1026,12 @@ static void event_handle_client(ObClient *client, XEvent *e)
ObWindow *win;
win = g_hash_table_lookup(window_map,
&e->xconfigurerequest.above);
- if (WINDOW_IS_CLIENT(win))
+ if (WINDOW_IS_CLIENT(win) && WINDOW_AS_CLIENT(win) != client)
sibling = WINDOW_AS_CLIENT(win);
}
- switch (e->xconfigurerequest.detail) {
- case Below:
- ob_debug("ConfigureRequest Below for client %s sibling %s\n",
- client->title, sibling ? sibling->title : "(all)");
- /* just lower it */
- stacking_lower(CLIENT_AS_WINDOW(client));
- break;
- case BottomIf:
- ob_debug("ConfigureRequest BottomIf for client %s sibling "
- "%s\n",
- client->title, sibling ? sibling->title : "(all)");
- /* if this client occludes sibling (or anything if NULL), then
- lower it to the bottom */
- if (stacking_occluded(sibling, client))
- stacking_lower(CLIENT_AS_WINDOW(client));
- break;
- case Above:
- ob_debug("ConfigureRequest Above for client %s sibling %s\n",
- client->title, sibling ? sibling->title : "(all)");
- /* activate it rather than just focus it */
- client_activate(client, FALSE, FALSE);
- break;
- case TopIf:
- ob_debug("ConfigureRequest TopIf for client %s sibling %s\n",
- client->title, sibling ? sibling->title : "(all)");
- if (stacking_occluded(client, sibling))
- /* activate it rather than just focus it */
- client_activate(client, FALSE, FALSE);
- case Opposite:
- ob_debug("ConfigureRequest Opposite for client %s sibling "
- "%s\n",
- client->title, sibling ? sibling->title : "(all)");
- if (stacking_occluded(client, sibling))
- /* activate it rather than just focus it */
- client_activate(client, FALSE, FALSE);
- else if (stacking_occluded(sibling, client))
- stacking_lower(CLIENT_AS_WINDOW(client));
- default:
- break;
- }
+ stacking_restack_request(client, sibling,
+ e->xconfigurerequest.detail);
}
break;
case UnmapNotify:
@@ -1246,6 +1208,41 @@ static void event_handle_client(ObClient *client, XEvent *e)
client_convert_gravity(client, grav, &x, &y, w, h);
client_find_onscreen(client, &x, &y, w, h, FALSE);
client_configure(client, x, y, w, h, FALSE, TRUE);
+ } else if (msgtype == prop_atoms.net_restack_window) {
+ if (e->xclient.data.l[0] != 2) {
+ ob_debug_type(OB_DEBUG_APP_BUGS,
+ "_NET_RESTACK_WINDOW sent for window %s with "
+ "invalid source indication %ld\n",
+ client->title, e->xclient.data.l[0]);
+ } else {
+ ObClient *sibling = NULL;
+ if (e->xclient.data.l[1]) {
+ ObWindow *win = g_hash_table_lookup(window_map,
+ &e->xclient.data.l[1]);
+ if (WINDOW_IS_CLIENT(win) &&
+ WINDOW_AS_CLIENT(win) != client)
+ {
+ sibling = WINDOW_AS_CLIENT(win);
+ }
+ if (sibling == NULL)
+ ob_debug_type(OB_DEBUG_APP_BUGS,
+ "_NET_RESTACK_WINDOW sent for window %s "
+ "with invalid sibling 0x%x\n",
+ client->title, e->xclient.data.l[1]);
+ }
+ if (e->xclient.data.l[2] == Below ||
+ e->xclient.data.l[2] == BottomIf ||
+ e->xclient.data.l[2] == Above ||
+ e->xclient.data.l[2] == TopIf ||
+ e->xclient.data.l[2] == Opposite)
+ {
+ stacking_restack_request(client, sibling,
+ e->xclient.data.l[2]);
+ }
+ ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_RESTACK_WINDOW sent "
+ "for window %s with invalid detail 0d\n",
+ client->title, e->xclient.data.l[2]);
+ }
}
break;
case PropertyNotify:
diff --git a/openbox/prop.c b/openbox/prop.c
index 3861f7c1..e0559068 100644
--- a/openbox/prop.c
+++ b/openbox/prop.c
@@ -75,6 +75,8 @@ 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_request_frame_extents, "_NET_REQUEST_FRAME_EXTENTS");
+ CREATE(net_restack_window, "_NET_RESTACK_WINDOW");
CREATE(net_startup_id, "_NET_STARTUP_ID");
@@ -95,7 +97,6 @@ void prop_startup()
CREATE(net_wm_user_time_window, "_NET_WM_USER_TIME_WINDOW");
CREATE(kde_net_wm_frame_strut, "_KDE_NET_WM_FRAME_STRUT");
CREATE(net_frame_extents, "_NET_FRAME_EXTENTS");
- CREATE(net_request_frame_extents, "_NET_REQUEST_FRAME_EXTENTS");
/* CREATE(net_wm_ping, "_NET_WM_PING"); */
#ifdef SYNC
diff --git a/openbox/prop.h b/openbox/prop.h
index 4f45b6d4..d1d6a516 100644
--- a/openbox/prop.h
+++ b/openbox/prop.h
@@ -108,6 +108,8 @@ typedef struct Atoms {
Atom net_close_window;
Atom net_wm_moveresize;
Atom net_moveresize_window;
+ Atom net_request_frame_extents;
+ Atom net_restack_window;
/* helpful hints to apps that aren't used for anything */
Atom net_wm_full_placement;
@@ -132,7 +134,6 @@ typedef struct Atoms {
Atom net_wm_user_time;
Atom net_wm_user_time_window;
Atom net_frame_extents;
- Atom net_request_frame_extents;
/* application protocols */
/* Atom net_wm_ping; */
diff --git a/openbox/screen.c b/openbox/screen.c
index 190468aa..51f226a5 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -276,6 +276,7 @@ gboolean screen_annex(const gchar *program_name)
supported[i++] = prop_atoms.net_wm_user_time_window;
supported[i++] = prop_atoms.net_frame_extents;
supported[i++] = prop_atoms.net_request_frame_extents;
+ supported[i++] = prop_atoms.net_restack_window;
supported[i++] = prop_atoms.net_startup_id;
#ifdef SYNC
supported[i++] = prop_atoms.net_wm_sync_request;
diff --git a/openbox/stacking.c b/openbox/stacking.c
index afad8ad0..70a072fc 100644
--- a/openbox/stacking.c
+++ b/openbox/stacking.c
@@ -25,6 +25,7 @@
#include "group.h"
#include "frame.h"
#include "window.h"
+#include "debug.h"
GList *stacking_list = NULL;
@@ -492,3 +493,46 @@ gboolean stacking_occluded(ObClient *client, ObClient *sibling)
}
return obscured;
}
+
+void stacking_restack_request(ObClient *client, ObClient *sibling,
+ gint detail)
+{
+ switch (detail) {
+ case Below:
+ ob_debug("Restack request Below for client %s sibling %s\n",
+ client->title, sibling ? sibling->title : "(all)");
+ /* just lower it */
+ stacking_lower(CLIENT_AS_WINDOW(client));
+ break;
+ case BottomIf:
+ ob_debug("Restack request BottomIf for client %s sibling "
+ "%s\n",
+ client->title, sibling ? sibling->title : "(all)");
+ /* if this client occludes sibling (or anything if NULL), then
+ lower it to the bottom */
+ if (stacking_occluded(sibling, client))
+ stacking_lower(CLIENT_AS_WINDOW(client));
+ break;
+ case Above:
+ ob_debug("Restack request Above for client %s sibling %s\n",
+ client->title, sibling ? sibling->title : "(all)");
+ /* activate it rather than just focus it */
+ client_activate(client, FALSE, FALSE);
+ break;
+ case TopIf:
+ ob_debug("Restack request TopIf for client %s sibling %s\n",
+ client->title, sibling ? sibling->title : "(all)");
+ if (stacking_occluded(client, sibling))
+ /* activate it rather than just focus it */
+ client_activate(client, FALSE, FALSE);
+ case Opposite:
+ ob_debug("Restack request Opposite for client %s sibling "
+ "%s\n",
+ client->title, sibling ? sibling->title : "(all)");
+ if (stacking_occluded(client, sibling))
+ /* activate it rather than just focus it */
+ client_activate(client, FALSE, FALSE);
+ else if (stacking_occluded(sibling, client))
+ stacking_lower(CLIENT_AS_WINDOW(client));
+ }
+}
diff --git a/openbox/stacking.h b/openbox/stacking.h
index 70e4b2d4..d570c944 100644
--- a/openbox/stacking.h
+++ b/openbox/stacking.h
@@ -64,4 +64,16 @@ void stacking_below(ObWindow *window, ObWindow *below);
*/
gboolean stacking_occluded(struct _ObClient *client,struct _ObClient *sibling);
+/*! Restack a window based upon a sibling (or all windows) in various ways.
+ @param client The client to be restacked
+ @param sibling Another client to compare to, or NULL to compare to all
+ windows
+ @param detail One of Above, Below, TopIf, BottomIf, Opposite
+ See http://tronche.com/gui/x/xlib/window/configure.html for details on
+ how each detail works with and without a sibling.
+*/
+void stacking_restack_request(struct _ObClient *client,
+ struct _ObClient *sibling,
+ gint detail);
+
#endif