[notification-daemon] Add support for themes to always stack



commit e250834a4ee297213793b3811ccad5fba736ca2a
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Jan 8 19:28:26 2010 -0500

    Add support for themes to always stack
    
    This allows themes to be designed to not use an arrow to point
    to a parent window.
    
    Based on a patch by Vincent Untz <vuntz gnome org>

 src/daemon/daemon.c  |    6 +++---
 src/daemon/engines.c |   13 +++++++++++++
 src/daemon/engines.h |    1 +
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 76ec019..e9a8633 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -1280,14 +1280,14 @@ notify_daemon_notify_handler(NotifyDaemon *daemon,
 	}
 
 
-	if (window_xid != None)
+	if (window_xid != None && !theme_get_always_stack(nw))
 	{
 		/*
 		 * Do nothing here if we were passed an XID; we'll call
 		 * sync_notification_position later.
 		 */
 	}
-	else if (use_pos_data)
+	else if (use_pos_data && !theme_get_always_stack(nw))
 	{
 		/*
 		 * Typically, the theme engine will set its own position based on
@@ -1326,7 +1326,7 @@ notify_daemon_notify_handler(NotifyDaemon *daemon,
 	 * for changes, and reposition the window based on the source
 	 * window.  We need to do this after return_id is calculated.
 	 */
-	if (window_xid != None)
+	if (window_xid != None && !theme_get_always_stack(nw))
 	{
 		monitor_notification_source_windows(daemon, nt, window_xid);
 		sync_notification_position(daemon, nw, window_xid);
diff --git a/src/daemon/engines.c b/src/daemon/engines.c
index 7541de1..16c81bb 100644
--- a/src/daemon/engines.c
+++ b/src/daemon/engines.c
@@ -30,6 +30,7 @@ typedef struct
 	void (*move_notification)(GtkWindow *nw, int x, int y);
 	void (*set_notification_timeout)(GtkWindow *nw, glong timeout);
 	void (*notification_tick)(GtkWindow *nw, glong timeout);
+	gboolean (*get_always_stack)(GtkWindow *nw);
 
 } ThemeEngine;
 
@@ -83,6 +84,7 @@ load_theme_engine(const char *name)
 	BIND_OPTIONAL_FUNC(set_notification_timeout);
 	BIND_OPTIONAL_FUNC(set_notification_hints);
 	BIND_OPTIONAL_FUNC(notification_tick);
+	BIND_OPTIONAL_FUNC(get_always_stack);
 
 	if (!engine->theme_check_init(NOTIFICATION_DAEMON_MAJOR_VERSION,
 								  NOTIFICATION_DAEMON_MINOR_VERSION,
@@ -304,3 +306,14 @@ theme_move_notification(GtkWindow *nw, int x, int y)
 	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");
 	engine->move_notification(nw, x, y);
 }
+
+gboolean
+theme_get_always_stack(GtkWindow *nw)
+{
+	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");
+
+	if (engine->get_always_stack != NULL)
+		return engine->get_always_stack(nw);
+	else
+		return FALSE;
+}
diff --git a/src/daemon/engines.h b/src/daemon/engines.h
index a691926..1cf50dc 100644
--- a/src/daemon/engines.h
+++ b/src/daemon/engines.h
@@ -21,5 +21,6 @@ void theme_add_notification_action(GtkWindow *nw, const char *label,
 								   const char *key, GCallback cb);
 void theme_clear_notification_actions(GtkWindow *nw);
 void theme_move_notification(GtkWindow *nw, int x, int y);
+gboolean theme_get_always_stack(GtkWindow *nw);
 
 #endif /* _ENGINES_H_ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]