[gnome-settings-daemon/randr-osd: 3/15] Create an OSD window for the XF86Display hotkey
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/randr-osd: 3/15] Create an OSD window for the XF86Display hotkey
- Date: Tue, 19 Jan 2010 23:35:02 +0000 (UTC)
commit 70ff18877868216f63aa7c4d43d5448b3a68fa10
Author: Federico Mena Quintero <federico novell com>
Date: Wed Jan 13 13:32:25 2010 -0600
Create an OSD window for the XF86Display hotkey
Signed-off-by: Federico Mena Quintero <federico novell com>
plugins/xrandr/Makefile.am | 7 +++--
plugins/xrandr/gsd-xrandr-manager.c | 38 +++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/plugins/xrandr/Makefile.am b/plugins/xrandr/Makefile.am
index d84eca1..b8d8f8e 100644
--- a/plugins/xrandr/Makefile.am
+++ b/plugins/xrandr/Makefile.am
@@ -59,9 +59,10 @@ libxrandr_la_CFLAGS = \
libxrandr_la_LDFLAGS = \
$(GSD_PLUGIN_LDFLAGS)
-libxrandr_la_LIBADD = \
- $(SETTINGS_PLUGIN_LIBS) \
- $(LIBNOTIFY_LIBS) \
+libxrandr_la_LIBADD = \
+ $(top_builddir)/plugins/common/libcommon.la \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(LIBNOTIFY_LIBS) \
$(RANDR_LIBS)
plugin_in_files = \
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index edbf559..52c2b4c 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -39,6 +39,8 @@
#include <gconf/gconf-client.h>
#include <dbus/dbus-glib.h>
+#include "gsd-osd-window.h"
+
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnomeui/gnome-rr-config.h>
@@ -124,6 +126,9 @@ struct GsdXrandrManagerPrivate
int current_stock_config; /* -1 if no configs */
StockConfig **stock_configs; /* NULL terminated, NULL if there are no configs */
+ /* On-screen-display window for the options shown with the XF86Display hotkey */
+ GtkWidget *osd_window;
+
/* Last time at which we got a "screen got reconfigured" event; see on_randr_event() */
guint32 last_config_timestamp;
};
@@ -992,6 +997,34 @@ error_message (GsdXrandrManager *mgr, const char *primary_text, GError *error_to
}
static void
+destroy_osd_window (GsdXrandrManager *manager)
+{
+ GsdXrandrManagerPrivate *priv = manager->priv;
+
+ if (priv->osd_window == NULL)
+ return;
+
+ gtk_widget_destroy (priv->osd_window);
+ priv->osd_window = NULL;
+}
+
+static void
+create_osd_window (GsdXrandrManager *manager)
+{
+ GsdXrandrManagerPrivate *priv = manager->priv;
+ GtkWidget *box;
+
+ if (priv->osd_window != NULL)
+ destroy_osd_window (manager);
+
+ priv->osd_window = gsd_osd_window_new ();
+
+ box = gtk_hbox_new (TRUE, 12);
+
+ /* FIXME */
+}
+
+static void
handle_stock_config_hotkey (GsdXrandrManager *mgr, guint32 timestamp)
{
GsdXrandrManagerPrivate *priv = mgr->priv;
@@ -1035,12 +1068,16 @@ handle_stock_config_hotkey (GsdXrandrManager *mgr, guint32 timestamp)
/* Our view of the world is incorrect, so regenerate the
* configurations
*/
+ destroy_osd_window (mgr);
generate_stock_configs (mgr);
}
gnome_rr_config_free (current);
if (priv->stock_configs) {
+ if (!mgr->priv->osd_window)
+ create_osd_window (mgr);
+
mgr->priv->current_stock_config++;
if (priv->stock_configs[mgr->priv->current_stock_config] == NULL)
@@ -1060,6 +1097,7 @@ handle_stock_config_hotkey (GsdXrandrManager *mgr, guint32 timestamp)
}
else {
g_debug ("no configurations generated");
+ destroy_osd_window (mgr);
}
g_debug ("done handling XF86Display");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]