Commit f9a95677 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

gdk: Replace direct calls of _gdk_event_func with _gdk_event_emit()

For now that function just calls the event func.
parent b3e85041
......@@ -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 *
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment