[Goodies-commits] r3323 - xfce4-notes-plugin/trunk/panel-plugin

Mike Massonnet mmassonnet at xfce.org
Wed Oct 10 23:55:36 CEST 2007


Author: mmassonnet
Date: 2007-10-10 21:55:35 +0000 (Wed, 10 Oct 2007)
New Revision: 3323

Modified:
   xfce4-notes-plugin/trunk/panel-plugin/notes.c
Log:
Start move/send to background/send to foreground window function


Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-10 21:55:19 UTC (rev 3322)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-10 21:55:35 UTC (rev 3323)
@@ -44,12 +44,10 @@
                                                          NotesWindow *notes_window);
 static gboolean         notes_window_delete_note        (GtkWidget *widget,
                                                          NotesWindow *notes_window);
-static gboolean         notes_window_start_move         (GtkWidget *widget,
-                                                         GdkEventButton *event,
-                                                         NotesWindow *notes_window);
-static gboolean         notes_window_shade              (GtkWidget *widget,
-                                                         GdkEventScroll *event,
-                                                         NotesWindow *notes_window);
+static gboolean         notes_window_start_move         (NotesWindow *notes_window,
+                                                         GdkEventButton *event);
+static gboolean         notes_window_shade              (NotesWindow *notes_window,
+                                                         GdkEventScroll *event);
 static void             notes_window_close_window       (GtkWidget *widget,
                                                          NotesWindow *notes_window);
 
@@ -230,14 +228,14 @@
                     "clicked",
                     G_CALLBACK (notes_window_delete_note),
                     notes_plugin);
-  g_signal_connect (G_OBJECT (notes_window->eb_move),
-                    "button-press-event",
-                    G_CALLBACK (notes_window_start_move),
-                    notes_window);
-  g_signal_connect (G_OBJECT (notes_window->eb_move),
-                    "scroll-event",
-                    G_CALLBACK (notes_window_shade),
-                    notes_window);
+  g_signal_connect_swapped (G_OBJECT (notes_window->eb_move),
+                            "button-press-event",
+                            G_CALLBACK (notes_window_start_move),
+                            notes_window);
+  g_signal_connect_swapped (G_OBJECT (notes_window->eb_move),
+                            "scroll-event",
+                            G_CALLBACK (notes_window_shade),
+                            notes_window);
   g_signal_connect (notes_window->window,
                     "delete-event",
                     G_CALLBACK (notes_window_close_window), /* XXX should prevent ALT+F4 */
@@ -384,17 +382,32 @@
 }
 
 static gboolean
-notes_window_start_move (GtkWidget *widget,
-                         GdkEventButton *event,
-                         NotesWindow *notes_window)
+notes_window_start_move (NotesWindow *notes_window,
+                         GdkEventButton *event)
 {
+  if (G_LIKELY (event->type == GDK_BUTTON_PRESS))
+    {
+      if (event->button == 1)
+        {
+          /* Send to foreground and move the window */
+          gdk_window_show (notes_window->window->window);
+          gtk_window_begin_move_drag (GTK_WINDOW (notes_window->window),
+                                      event->button,
+                                      event->x_root,
+                                      event->y_root,
+                                      event->time);
+        }
+      else if (event->button == 2)
+        /* Send to background */
+        gdk_window_lower (notes_window->window->window);
+    }
+
   return FALSE;
 }
 
 static gboolean
-notes_window_shade (GtkWidget *widget,
-                    GdkEventScroll *event,
-                    NotesWindow *notes_window)
+notes_window_shade (NotesWindow *notes_window,
+                    GdkEventScroll *event)
 {
   if (G_LIKELY (event->type == GDK_SCROLL))
     {




More information about the Goodies-commits mailing list