summaryrefslogtreecommitdiff
path: root/src/totem-fullscreen.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-11-06 16:54:21 +0000
committerBastien Nocera <hadess@hadess.net>2009-11-11 16:30:51 +0000
commit2e94d1067a5096f87a18faa11505f27d964e4013 (patch)
tree2cb46dfcd125f8639a9fef72e96f3da21cc73475 /src/totem-fullscreen.c
parent3110aef8cd00aa8af1d9b3a5a091c74a89fd0f4e (diff)
downloadtotem-2e94d1067a5096f87a18faa11505f27d964e4013.tar.gz
Show OSD when keys are pressed in fullscreen
Better than popping up the fullscreen popups. Only works when compositing is on. https://bugzilla.gnome.org/show_bug.cgi?id=600985
Diffstat (limited to 'src/totem-fullscreen.c')
-rw-r--r--src/totem-fullscreen.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/totem-fullscreen.c b/src/totem-fullscreen.c
index 564579b66..cd393d4e5 100644
--- a/src/totem-fullscreen.c
+++ b/src/totem-fullscreen.c
@@ -36,6 +36,7 @@
#include "totem-interface.h"
#include "totem-time-label.h"
#include "bacon-video-widget.h"
+#include "gsd-media-keys-window.h"
#define FULLSCREEN_POPUP_TIMEOUT 5
@@ -53,6 +54,7 @@ G_MODULE_EXPORT gboolean totem_fullscreen_motion_notify (GtkWidget *widget, GdkE
struct _TotemFullscreenPrivate {
BaconVideoWidget *bvw;
GtkWidget *parent_window;
+ GtkWidget *osd;
/* Fullscreen Popups */
GtkWidget *exit_popup;
@@ -141,6 +143,20 @@ totem_fullscreen_theme_changed_cb (GtkIconTheme *icon_theme, TotemFullscreen *fs
}
static void
+totem_fullscreen_composited_changed_cb (GdkScreen *screen, TotemFullscreen *fs)
+{
+ if (gdk_screen_is_composited (screen)) {
+ if (fs->priv->osd == NULL)
+ fs->priv->osd = gsd_media_keys_window_new ();
+ } else {
+ if (fs->priv->osd != NULL) {
+ gtk_widget_destroy (fs->priv->osd);
+ fs->priv->osd = NULL;
+ }
+ }
+}
+
+static void
totem_fullscreen_window_realize_cb (GtkWidget *widget, TotemFullscreen *fs)
{
GdkScreen *screen;
@@ -148,9 +164,13 @@ totem_fullscreen_window_realize_cb (GtkWidget *widget, TotemFullscreen *fs)
screen = gtk_widget_get_screen (widget);
g_signal_connect (G_OBJECT (screen), "size-changed",
G_CALLBACK (totem_fullscreen_size_changed_cb), fs);
+ g_signal_connect (G_OBJECT (screen), "composited-changed",
+ G_CALLBACK (totem_fullscreen_composited_changed_cb), fs);
g_signal_connect (G_OBJECT (gtk_icon_theme_get_for_screen (screen)),
"changed",
G_CALLBACK (totem_fullscreen_theme_changed_cb), fs);
+
+ totem_fullscreen_composited_changed_cb (screen, fs);
}
static void
@@ -289,6 +309,39 @@ totem_fullscreen_show_popups (TotemFullscreen *fs, gboolean show_cursor)
}
void
+totem_fullscreen_show_popups_or_osd (TotemFullscreen *fs,
+ const char *icon_name,
+ gboolean show_cursor)
+{
+ GtkAllocation allocation;
+ GdkScreen *screen;
+ GdkWindow *window;
+ GdkRectangle rect;
+ int monitor;
+
+ if (fs->priv->osd == NULL || icon_name == NULL) {
+ totem_fullscreen_show_popups (fs, show_cursor);
+ return;
+ }
+
+ gtk_widget_get_allocation (GTK_WIDGET (fs->priv->bvw), &allocation);
+ gtk_window_resize (GTK_WINDOW (fs->priv->osd),
+ allocation.height / 8,
+ allocation.height / 8);
+
+ window = gtk_widget_get_window (GTK_WIDGET (fs->priv->bvw));
+ screen = gtk_widget_get_screen (GTK_WIDGET (fs->priv->bvw));
+ monitor = gdk_screen_get_monitor_at_window (screen, window);
+ gdk_screen_get_monitor_geometry (screen, monitor, &rect);
+
+ gtk_window_move (GTK_WINDOW (fs->priv->osd), rect.x + 8, rect.y + 8);
+
+ gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (fs->priv->osd),
+ icon_name, FALSE);
+ gtk_widget_show (fs->priv->osd);
+}
+
+void
totem_fullscreen_set_fullscreen (TotemFullscreen *fs,
gboolean fullscreen)
{