gnome-applets r11238 - trunk/mixer



Author: callum
Date: Mon Feb  2 08:05:20 2009
New Revision: 11238
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=11238&view=rev

Log:
Popdown the volume control dock when it looses focus.

Modified:
   trunk/mixer/ChangeLog
   trunk/mixer/applet.c
   trunk/mixer/dock.c

Modified: trunk/mixer/applet.c
==============================================================================
--- trunk/mixer/applet.c	(original)
+++ trunk/mixer/applet.c	Mon Feb  2 08:05:20 2009
@@ -884,6 +884,15 @@
   return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
 }
 
+static gboolean
+gnome_volume_applet_dock_focus_out (GtkWidget *dock, GdkEventFocus *event,
+				    GnomeVolumeApplet *applet)
+{
+  gnome_volume_applet_popdown_dock (applet);
+
+  return FALSE;
+}
+
 /*
  * Change orientation or size of panel.
  */
@@ -898,9 +907,12 @@
   if (applet->dock) {
     gtk_widget_destroy (GTK_WIDGET (applet->dock));
   }
-  dock = gnome_volume_applet_dock_new (IS_PANEL_HORIZONTAL (orientation) ?
-				       GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL,
+  dock = gnome_volume_applet_dock_new (GTK_ORIENTATION_VERTICAL,
 				       applet);
+  gtk_widget_add_events (dock, GDK_FOCUS_CHANGE_MASK);
+  g_signal_connect (G_OBJECT (dock), "focus-out-event",
+		    G_CALLBACK (gnome_volume_applet_dock_focus_out),
+		    applet);
   applet->dock = GNOME_VOLUME_APPLET_DOCK (dock);
   gnome_volume_applet_dock_change (applet->dock, applet->adjustment);
 

Modified: trunk/mixer/dock.c
==============================================================================
--- trunk/mixer/dock.c	(original)
+++ trunk/mixer/dock.c	Mon Feb  2 08:05:20 2009
@@ -60,13 +60,13 @@
   dock->orientation = -1;
   dock->timeout = 0;
 
-#if 0
+#if 1
   /* We can't use a simple GDK_WINDOW_TYPE_HINT_DOCK here since
    * the dock windows don't accept input by default. Instead we use 
    * the popup menu type. In the end we set everything by hand anyway
    * since what happens depends very heavily on the window manager. */
-  gtk_window_set_type_hint (GTK_WINDOW (dock), 
-      			    GDK_WINDOW_TYPE_HINT_POPUP_MENU);
+//  gtk_window_set_type_hint (GTK_WINDOW (dock), 
+//      			    GDK_WINDOW_TYPE_HINT_POPUP_MENU);
   gtk_window_set_keep_above (GTK_WINDOW (dock), TRUE);
   gtk_window_set_decorated (GTK_WINDOW (dock), FALSE);
   gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dock), TRUE);
@@ -104,7 +104,11 @@
 gnome_volume_applet_dock_new (GtkOrientation orientation,
 			      GnomeVolumeApplet *parent)
 {
-  GtkWidget *button, *scale, *mute, *more;
+  /* FIXME: Remove the orientation argument, or fix it for vertical
+     boxes (a "horizontal" orientation - the meaning is reversed for
+     historical reasons. */
+
+  GtkWidget *button, *scale, *mute, *more, *label;
   GtkWidget *container, *outerline, *innerline, *frame;
   GnomeVolumeAppletDock *dock;
   gint i;
@@ -121,8 +125,6 @@
 
   dock = g_object_new (GNOME_VOLUME_APPLET_TYPE_DOCK,
 		       NULL);
-  gtk_window_set_type_hint (GTK_WINDOW (dock), 
-      			    GDK_WINDOW_TYPE_HINT_DOCK);
   dock->orientation = orientation;
   dock->model = parent;
 



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