summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn <sabetts@juicebox>2008-06-20 14:01:39 -0700
committerShawn <sabetts@juicebox>2008-06-20 14:01:39 -0700
commit4e08030acf10a54af36e92b14624257fbf0835a4 (patch)
tree17d15c0cc37bfd889b92fcb5fbc65c6a23cbb9cc
parentea17008472c85c2c931336774335261b8394a691 (diff)
downloadratpoison-4e08030acf10a54af36e92b14624257fbf0835a4.zip
support the netwm dialog window type
-rw-r--r--NEWS5
-rw-r--r--src/globals.c2
-rw-r--r--src/globals.h6
-rw-r--r--src/main.c2
-rw-r--r--src/manage.c29
5 files changed, 42 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index bec1efe..a89a38e 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,11 @@ are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
* Changes since 1.4.3
+** netwm dialog type windows supported
+These windows are treated as transients. Some Firefox popup windows
+are tagged as dialog windows and should now work with ratpoison as
+expected.
+
** new format character %M
This expands to Maxsize if the window is a maxsize window, nothing if not.
diff --git a/src/globals.c b/src/globals.c
index 91467c3..5f21148 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -50,6 +50,8 @@ Atom rp_selection;
/* netwm atoms */
Atom _net_wm_pid;
Atom _net_supported;
+Atom _net_wm_window_type;
+Atom _net_wm_window_type_dialog;
int rp_current_screen;
rp_screen *screens;
diff --git a/src/globals.h b/src/globals.h
index 2f0126f..b7aaa00 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -114,8 +114,10 @@ extern Atom wm_take_focus;
extern Atom wm_colormaps;
/* netwm atoms. */
-Atom _net_wm_pid;
-Atom _net_supported;
+extern Atom _net_wm_pid;
+extern Atom _net_supported;
+extern Atom _net_wm_window_type;
+extern Atom _net_wm_window_type_dialog;
/* mouse properties */
extern int rat_x;
diff --git a/src/main.c b/src/main.c
index c255a17..48fdb88 100644
--- a/src/main.c
+++ b/src/main.c
@@ -685,6 +685,8 @@ main (int argc, char *argv[])
PRINT_DEBUG (("_NET_WM_PID = %ld\n", _net_wm_pid));
_net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
PRINT_DEBUG (("_NET_SUPPORTED = %ld\n", _net_supported));
+ _net_wm_window_type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+ _net_wm_window_type_dialog = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
/* Setup signal handlers. */
XSetErrorHandler(handler);
diff --git a/src/manage.c b/src/manage.c
index 1b12c58..8bad332 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -317,6 +317,32 @@ window_is_transient (rp_window *win)
;
}
+static Atom
+get_net_wm_window_type (rp_window *win)
+{
+ Atom type, window_type = None;
+ int format;
+ unsigned long nitems;
+ unsigned long bytes_left;
+ unsigned char *data;
+
+ if (win == NULL)
+ return None;
+
+ if (XGetWindowProperty (dpy, win->w, _net_wm_window_type, 0, 1L,
+ False, XA_ATOM, &type, &format,
+ &nitems, &bytes_left,
+ &data) == Success && nitems > 0)
+ {
+ window_type = *(Atom *)data;
+ PRINT_DEBUG(("hey ya %ld %ld\n", window_type, _net_wm_window_type_dialog));
+ }
+ XFree (data);
+
+ return window_type;
+}
+
+
void
update_window_information (rp_window *win)
{
@@ -339,6 +365,9 @@ update_window_information (rp_window *win)
/* Transient status */
win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
+ if (get_net_wm_window_type(win) == _net_wm_window_type_dialog)
+ win->transient = 1;
+
update_window_gravity (win);
}