[gtk+/rendering-cleanup: 63/65] gdk: Replace direct calls of _gdk_event_func with _gdk_event_emit()



commit f4fdcd449da02a8ec2b71b53cd8361977bb92b94
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 2 10:59:37 2010 +0100

    gdk: Replace direct calls of _gdk_event_func with _gdk_event_emit()
    
    For now that function just calls the event func.

 gdk/gdkevents.c                  |   13 ++++-
 gdk/gdkinternals.h               |    5 +--
 gdk/gdkwindow.c                  |    4 +-
 gdk/quartz/GdkQuartzWindow.c     |   10 ++--
 gdk/quartz/gdkeventloop-quartz.c |    3 +-
 gdk/win32/gdkevents-win32.c      |   92 ++++++++++++++++++--------------------
 gdk/x11/gdkeventsource.c         |    3 +-
 7 files changed, 64 insertions(+), 66 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 272fb32..438beb8 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -59,9 +59,16 @@ struct _GdkIOClosure
 /* Private variable declarations
  */
 
-GdkEventFunc   _gdk_event_func = NULL;    /* Callback for events */
-gpointer       _gdk_event_data = NULL;
-GDestroyNotify _gdk_event_notify = NULL;
+static GdkEventFunc   _gdk_event_func = NULL;    /* Callback for events */
+static gpointer       _gdk_event_data = NULL;
+static GDestroyNotify _gdk_event_notify = NULL;
+
+void
+_gdk_event_emit (GdkEvent *event)
+{
+  if (_gdk_event_func)
+    (*_gdk_event_func) (event, _gdk_event_data);
+}
 
 /*********************************************
  * Functions for maintaining the event queue *
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 8aede53..a0063cd 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -268,10 +268,6 @@ struct _GdkWindow
 #define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
 #define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
 
-extern GdkEventFunc   _gdk_event_func;    /* Callback for events */
-extern gpointer       _gdk_event_data;
-extern GDestroyNotify _gdk_event_notify;
-
 extern GSList    *_gdk_displays;
 extern gchar     *_gdk_display_name;
 extern gint       _gdk_screen_number;
@@ -281,6 +277,7 @@ extern gboolean   _gdk_enable_multidevice;
 void      _gdk_events_queue  (GdkDisplay *display);
 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
 
+void   _gdk_event_emit               (GdkEvent   *event);
 GList* _gdk_event_queue_find_first   (GdkDisplay *display);
 void   _gdk_event_queue_remove_link  (GdkDisplay *display,
 				      GList      *node);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 36d13f6..1be8be0 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -3944,7 +3944,7 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
 	  event.expose.region = expose_region;
 	  cairo_region_get_extents (expose_region, &event.expose.area);
 
-	  (*_gdk_event_func) (&event, _gdk_event_data);
+          _gdk_event_emit (&event);
 
 	  g_object_unref (window);
 	}
@@ -3994,7 +3994,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
       cairo_region_t *update_area = window->update_area;
       window->update_area = NULL;
 
-      if (_gdk_event_func && gdk_window_is_viewable (window))
+      if (gdk_window_is_viewable (window))
 	{
 	  cairo_region_t *expose_region;
 	  gboolean end_implicit;
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index cbd5493..eb3cce8 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzWindow.c
@@ -478,7 +478,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
 
-  (*_gdk_event_func) (event, _gdk_event_data);
+  _gdk_event_emit (event);
 
   gdk_event_free (event);
 
@@ -508,7 +508,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
 
-  (*_gdk_event_func) (event, _gdk_event_data);
+  _gdk_event_emit (event);
 
   gdk_event_free (event);
   
@@ -536,7 +536,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
 
-  (*_gdk_event_func) (event, _gdk_event_data);
+  _gdk_event_emit (event);
 
   gdk_event_free (event);
 
@@ -563,7 +563,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
 
-  (*_gdk_event_func) (event, _gdk_event_data);
+  _gdk_event_emit (event);
 
   gdk_event_free (event);
 
@@ -592,7 +592,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   gdk_event_set_device (event,
                         gdk_drag_context_get_device (_gdk_quartz_drag_source_context));
 
-  (*_gdk_event_func) (event, _gdk_event_data);
+  _gdk_event_emit (event);
 
   gdk_event_free (event);
 
diff --git a/gdk/quartz/gdkeventloop-quartz.c b/gdk/quartz/gdkeventloop-quartz.c
index f11d4d8..71c15b8 100644
--- a/gdk/quartz/gdkeventloop-quartz.c
+++ b/gdk/quartz/gdkeventloop-quartz.c
@@ -670,8 +670,7 @@ gdk_event_dispatch (GSource     *source,
 
   if (event)
     {
-      if (_gdk_event_func)
-	(*_gdk_event_func) (event, _gdk_event_data);
+      _gdk_event_emit (event);
 
       gdk_event_free (event);
     }
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 31b1dae..e29df55 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -3018,54 +3018,51 @@ gdk_event_translate (MSG  *msg,
       /* We need to render to clipboard immediately, don't call
        * append_event()
        */
-      if (_gdk_event_func)
-	{
-	  event = gdk_event_new (GDK_SELECTION_REQUEST);
-	  event->selection.window = window;
-	  event->selection.send_event = FALSE;
-	  event->selection.selection = GDK_SELECTION_CLIPBOARD;
-	  event->selection.target = target;
-	  event->selection.property = _gdk_selection;
-	  event->selection.requestor = msg->hwnd;
-	  event->selection.time = msg->time;
+      event = gdk_event_new (GDK_SELECTION_REQUEST);
+      event->selection.window = window;
+      event->selection.send_event = FALSE;
+      event->selection.selection = GDK_SELECTION_CLIPBOARD;
+      event->selection.target = target;
+      event->selection.property = _gdk_selection;
+      event->selection.requestor = msg->hwnd;
+      event->selection.time = msg->time;
 
-	  fixup_event (event);
-	  GDK_NOTE (EVENTS, g_print (" (calling gdk_event_func)"));
-	  GDK_NOTE (EVENTS, _gdk_win32_print_event (event));
-	  (*_gdk_event_func) (event, _gdk_event_data);
-	  gdk_event_free (event);
-
-	  /* Now the clipboard owner should have rendered */
-	  if (!_delayed_rendering_data)
-	    {
-	      GDK_NOTE (EVENTS, g_print (" (no _delayed_rendering_data?)"));
-	    }
-	  else
-	    {
-	      if (msg->wParam == CF_DIB)
-		{
-		  _delayed_rendering_data =
-		    _gdk_win32_selection_convert_to_dib (_delayed_rendering_data,
-							 target);
-		  if (!_delayed_rendering_data)
-		    {
-		      g_warning ("Cannot convert to DIB from delayed rendered image");
-		      break;
-		    }
-		}
-
-	      /* The requestor is holding the clipboard, no
-	       * OpenClipboard() is required/possible
-	       */
-	      GDK_NOTE (DND,
-			g_print (" SetClipboardData(%s,%p)",
-				 _gdk_win32_cf_to_string (msg->wParam),
-				 _delayed_rendering_data));
+      fixup_event (event);
+      GDK_NOTE (EVENTS, g_print (" (calling _gdk_event_emit)"));
+      GDK_NOTE (EVENTS, _gdk_win32_print_event (event));
+      _gdk_event_emit (event);
+      gdk_event_free (event);
 
-	      API_CALL (SetClipboardData, (msg->wParam, _delayed_rendering_data));
-	      _delayed_rendering_data = NULL;
-	    }
-	}
+      /* Now the clipboard owner should have rendered */
+      if (!_delayed_rendering_data)
+        {
+          GDK_NOTE (EVENTS, g_print (" (no _delayed_rendering_data?)"));
+        }
+      else
+        {
+          if (msg->wParam == CF_DIB)
+            {
+              _delayed_rendering_data =
+                _gdk_win32_selection_convert_to_dib (_delayed_rendering_data,
+                                                     target);
+              if (!_delayed_rendering_data)
+                {
+                  g_warning ("Cannot convert to DIB from delayed rendered image");
+                  break;
+                }
+            }
+
+          /* The requestor is holding the clipboard, no
+           * OpenClipboard() is required/possible
+           */
+          GDK_NOTE (DND,
+                    g_print (" SetClipboardData(%s,%p)",
+                             _gdk_win32_cf_to_string (msg->wParam),
+                             _delayed_rendering_data));
+
+          API_CALL (SetClipboardData, (msg->wParam, _delayed_rendering_data));
+          _delayed_rendering_data = NULL;
+        }
       break;
 
     case WM_ACTIVATE:
@@ -3222,8 +3219,7 @@ gdk_event_dispatch (GSource     *source,
 
   if (event)
     {
-      if (_gdk_event_func)
-	(*_gdk_event_func) (event, _gdk_event_data);
+      _gdk_event_emit (event);
       
       gdk_event_free (event);
 
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index 5a59752..5f0c3a7 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -318,8 +318,7 @@ gdk_event_source_dispatch (GSource     *source,
 
   if (event)
     {
-      if (_gdk_event_func)
-	(*_gdk_event_func) (event, _gdk_event_data);
+      _gdk_event_emit (event);
 
       gdk_event_free (event);
     }



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