summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-13 17:16:39 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-13 17:16:39 +0800
commite21400f6b3996a5f55ed1c29a822df5a941ac86c (patch)
tree09168319ef55251d273a2a841488816186a7d923
parent4b16d3a39a5aea67902ac5698b5e059057bae06e (diff)
downloadunity-window-decorator-e21400f6b3996a5f55ed1c29a822df5a941ac86c.tar.gz
unity-window-decorator-e21400f6b3996a5f55ed1c29a822df5a941ac86c.tar.bz2
Display transient parent as "active" if the current window has a
transient dialog New UXD specification
-rw-r--r--src/events.c29
-rw-r--r--src/gtk-window-decorator.h2
-rw-r--r--src/metacity.c2
-rw-r--r--src/wnck.c27
4 files changed, 59 insertions, 1 deletions
diff --git a/src/events.c b/src/events.c
index 667fd0d..b007bdb 100644
--- a/src/events.c
+++ b/src/events.c
@@ -998,11 +998,40 @@ event_filter_func (GdkXEvent *gdkxevent,
if (get_window_prop (xevent->xproperty.window, select_window_atom, &select))
update_switcher_window (xevent->xproperty.window, select);
}
+ else if (xevent->xproperty.atom == XA_WM_TRANSIENT_FOR)
+ {
+ WnckWindow *win = wnck_window_get (xevent->xproperty.window);
+
+ if (win &&
+ wnck_window_get_window_type (win) == WNCK_WINDOW_DIALOG)
+ {
+ Window parent;
+
+ if (get_window_prop (xevent->xproperty.window, XA_WM_TRANSIENT_FOR, &parent))
+ {
+ WnckWindow *p = wnck_window_get (parent);
+ decor_t *d = g_object_get_data (G_OBJECT (p), "decor");
+ decor_t *d_transient = g_object_get_data (G_OBJECT (p), "decor");
+
+ if (g_slist_find (d->transient_windows, p))
+ break;
+
+ if (d)
+ {
+ d->transient_windows = g_slist_append (d->transient_windows, win);
+ d_transient->transient_parent = p;
+ }
+ }
+ }
+ }
break;
case DestroyNotify:
+ {
g_hash_table_remove (frame_table,
GINT_TO_POINTER (xevent->xproperty.window));
+
break;
+ }
case ClientMessage:
if (xevent->xclient.message_type == toolkit_action_atom)
{
diff --git a/src/gtk-window-decorator.h b/src/gtk-window-decorator.h
index b26885d..db611d9 100644
--- a/src/gtk-window-decorator.h
+++ b/src/gtk-window-decorator.h
@@ -396,6 +396,8 @@ typedef struct _decor {
WnckWindowActions actions;
XID prop_xid;
GtkWidget *force_quit_dialog;
+ GSList *transient_windows;
+ WnckWindow *transient_parent;
Bool created;
void (*draw) (struct _decor *d);
} decor_t;
diff --git a/src/metacity.c b/src/metacity.c
index dd8d6c1..1cdf246 100644
--- a/src/metacity.c
+++ b/src/metacity.c
@@ -482,7 +482,7 @@ meta_get_decoration_geometry (decor_t *d,
if (d->actions & WNCK_WINDOW_ACTION_SHADE)
*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_SHADE;
- if (d->active)
+ if (d->active || g_slist_length (d->transient_windows) > 1)
*flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS;
if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
diff --git a/src/wnck.c b/src/wnck.c
index 2b340ed..0fae48e 100644
--- a/src/wnck.c
+++ b/src/wnck.c
@@ -652,6 +652,7 @@ window_opened (WnckScreen *screen,
d->cr = NULL;
d->buffer_pixmap = NULL;
d->picture = None;
+ d->transient_windows = g_slist_alloc ();
connect_window (win);
@@ -667,6 +668,24 @@ window_opened (WnckScreen *screen,
{
add_frame_window (win, window, TRUE);
}
+
+ if (wnck_window_get_window_type (win) == WNCK_WINDOW_DIALOG)
+ {
+ Window parent;
+
+ if (get_window_prop (xid, XA_WM_TRANSIENT_FOR, &parent))
+ {
+ WnckWindow *p = wnck_window_get (parent);
+ decor_t *d = g_object_get_data (G_OBJECT (p), "decor");
+ decor_t *d_transient = g_object_get_data (G_OBJECT (win), "decor");
+
+ if (d)
+ {
+ d->transient_windows = g_slist_append (d->transient_windows, win);
+ d_transient->transient_parent = p;
+ }
+ }
+ }
}
static void
@@ -675,6 +694,14 @@ window_closed (WnckScreen *screen,
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
+ WnckWindow *parent = d->transient_parent;
+
+ if (parent)
+ {
+ decor_t *d_parent = g_object_get_data (G_OBJECT (parent), "decor");
+
+ d_parent->transient_windows = g_slist_remove (d_parent->transient_windows, win);
+ }
remove_frame_window (win);