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

Mike Massonnet mmassonnet at xfce.org
Mon Oct 29 14:23:47 CET 2007


Author: mmassonnet
Date: 2007-10-29 13:23:47 +0000 (Mon, 29 Oct 2007)
New Revision: 3474

Modified:
   xfce4-notes-plugin/trunk/panel-plugin/notes.c
Log:
    * panel-plugin/notes.c: Rename functions around title press/release


Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-29 11:38:03 UTC (rev 3473)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-29 13:23:47 UTC (rev 3474)
@@ -65,15 +65,13 @@
                                                          gint transparency);
 static gboolean         notes_window_state_event        (NotesWindow *notes_window,
                                                          GdkEventWindowState *event);
-static gboolean         notes_window_start_move         (NotesWindow *notes_window,
+static gboolean         notes_window_title_press        (NotesWindow *notes_window,
                                                          GdkEventButton *event);
-static gboolean         notes_window_start_move         (NotesWindow *notes_window,
+static gboolean         notes_window_title_release      (NotesWindow *notes_window,
                                                          GdkEventButton *event);
 
-static gboolean         notes_window_timeout_start_move (NotesWindow *notes_window);
+static gboolean         notes_window_start_move         (NotesWindow *notes_window);
 
-static gboolean         notes_window_timeout_start_move_destroy (NotesWindow *notes_window);
-
 static gboolean         notes_window_scroll_event       (NotesWindow *notes_window,
                                                          GdkEventScroll *event);
 static void             notes_window_shade              (NotesWindow *notes_window);
@@ -340,11 +338,11 @@
                             notes_window);
   g_signal_connect_swapped (notes_window->eb_move,
                             "button-press-event",
-                            G_CALLBACK (notes_window_start_move),
+                            G_CALLBACK (notes_window_title_press),
                             notes_window);
   g_signal_connect_swapped (notes_window->eb_move,
                             "button-release-event",
-                            G_CALLBACK (notes_window_timeout_start_move_destroy),
+                            G_CALLBACK (notes_window_title_release),
                             notes_window);
   g_signal_connect_swapped (notes_window->eb_move,
                             "scroll-event",
@@ -1009,8 +1007,8 @@
 }
 
 static gboolean
-notes_window_start_move (NotesWindow *notes_window,
-                         GdkEventButton *event)
+notes_window_title_press (NotesWindow *notes_window,
+                          GdkEventButton *event)
 {
   if (G_LIKELY (event->type == GDK_BUTTON_PRESS))
     {
@@ -1019,7 +1017,7 @@
         {
           gdk_window_show (notes_window->window->window);
           notes_window->timeout_start_move =
-            g_timeout_add (100, (GSourceFunc)notes_window_timeout_start_move, notes_window);
+            g_timeout_add (50, (GSourceFunc)notes_window_start_move, notes_window);
         }
       /* Send to background */
       else if (event->button == 2)
@@ -1030,8 +1028,25 @@
 }
 
 static gboolean
-notes_window_timeout_start_move (NotesWindow *notes_window)
+notes_window_title_release (NotesWindow *notes_window,
+                            GdkEventButton *event)
 {
+  if (G_LIKELY (event->type == GDK_BUTTON_RELEASE))
+    {
+      if (event->button == 1)
+        {
+          if (notes_window->timeout_start_move > 0)
+            g_source_remove (notes_window->timeout_start_move);
+          notes_window->timeout_start_move = 0;
+        }
+    }
+
+  return FALSE;
+}
+
+static gboolean
+notes_window_start_move (NotesWindow *notes_window)
+{
   gint x, y, xfoo, ybar;
 
   gtk_window_get_position (GTK_WINDOW (notes_window->window), &x, &y);
@@ -1041,22 +1056,11 @@
 
   gtk_window_begin_move_drag (GTK_WINDOW (notes_window->window),
                               1, x, y, gtk_get_current_event_time ());
-  notes_window_timeout_start_move_destroy (notes_window);
 
   return FALSE;
 }
 
 static gboolean
-notes_window_timeout_start_move_destroy (NotesWindow *notes_window)
-{
-  TRACE ("Timeout destroyed");
-  if (notes_window->timeout_start_move > 0)
-    g_source_remove (notes_window->timeout_start_move);
-  notes_window->timeout_start_move = 0;
-  return FALSE;
-}
-
-static gboolean
 notes_window_scroll_event (NotesWindow *notes_window,
                            GdkEventScroll *event)
 {




More information about the Goodies-commits mailing list