Add private backend data to events, and handle it when copying/freeing

2008-05-06  Richard Hult  <richard@imendio.com>

	* gdk/gdkevents.c: (gdk_event_copy), (gdk_event_free):
	* gdk/gdkinternals.h: Add private backend data to events, and
	handle it when copying/freeing events. Currently only needed in
	the quartz backend.

	* gdk/directfb/gdkevents-directfb.c:
	* gdk/quartz/gdkevents-quartz.c:
	* gdk/win32/gdkevents-win32.c:
	* gdk/x11/gdkevents-x11.c: (_gdk_windowing_event_data_copy)
	(_gdk_windowing_event_data_free): Add stubs for X11, win32 and
	directfb. Implement for quartz. Part of fixing bug #473822.

svn path=/trunk/; revision=20078
This commit is contained in:
Richard Hult 2008-05-06 21:00:06 +00:00 committed by Richard Hult
parent e6431057d6
commit 4ee2d1b6ba
7 changed files with 88 additions and 0 deletions

View File

@ -1,3 +1,17 @@
2008-05-06 Richard Hult <richard@imendio.com>
* gdk/gdkevents.c: (gdk_event_copy), (gdk_event_free):
* gdk/gdkinternals.h: Add private backend data to events, and
handle it when copying/freeing events. Currently only needed in
the quartz backend.
* gdk/directfb/gdkevents-directfb.c:
* gdk/quartz/gdkevents-quartz.c:
* gdk/win32/gdkevents-win32.c:
* gdk/x11/gdkevents-x11.c: (_gdk_windowing_event_data_copy)
(_gdk_windowing_event_data_free): Add stubs for X11, win32 and
directfb. Implement for quartz. Part of fixing bug #473822.
2008-05-05 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkmain-quartz.c (_gdk_windowing_init): Initalize

View File

@ -961,5 +961,16 @@ gdk_net_wm_supports (GdkAtom property)
return FALSE;
}
void
_gdk_windowing_event_data_copy (GdkEvent *dst,
GdkEvent *src)
{
}
void
_gdk_windowing_event_data_free (GdkEvent *event)
{
}
#define __GDK_EVENTS_X11_C__
#include "gdkaliasdef.c"

View File

@ -420,6 +420,9 @@ gdk_event_copy (const GdkEvent *event)
default:
break;
}
if (gdk_event_is_allocated (event))
_gdk_windowing_event_data_copy (new_event, event);
return new_event;
}
@ -485,6 +488,8 @@ gdk_event_free (GdkEvent *event)
break;
}
_gdk_windowing_event_data_free (event);
g_hash_table_remove (event_hash, event);
g_slice_free (GdkEventPrivate, (GdkEventPrivate*) event);
}

View File

@ -166,6 +166,7 @@ struct _GdkEventPrivate
GdkEvent event;
guint flags;
GdkScreen *screen;
gpointer windowing_data;
};
extern GdkEventFunc _gdk_event_func; /* Callback for events */
@ -188,6 +189,10 @@ GList* _gdk_event_queue_append (GdkDisplay *display,
void _gdk_event_button_generate (GdkDisplay *display,
GdkEvent *event);
void _gdk_windowing_event_data_copy (GdkEvent *dst,
GdkEvent *src);
void _gdk_windowing_event_data_free (GdkEvent *event);
void gdk_synthesize_window_state (GdkWindow *window,
GdkWindowState unset_flags,
GdkWindowState set_flags);

View File

@ -1554,10 +1554,15 @@ create_key_event (GdkWindow *window,
GdkEventType type)
{
GdkEvent *event;
GdkEventPrivate *priv;
gchar buf[7];
gunichar c = 0;
event = gdk_event_new (type);
priv = (GdkEventPrivate *) event;
priv->windowing_data = [nsevent retain];
event->key.window = window;
event->key.time = get_time_from_ns_event (nsevent);
event->key.state = get_keyboard_modifiers_from_ns_event (nsevent);
@ -2038,3 +2043,29 @@ gdk_screen_get_setting (GdkScreen *screen,
return FALSE;
}
void
_gdk_windowing_event_data_copy (GdkEvent *dst,
GdkEvent *src)
{
GdkEventPrivate *priv_dst = (GdkEventPrivate *) dst;
GdkEventPrivate *priv_src = (GdkEventPrivate *) src;
if (priv_src->windowing_data)
{
priv_dst->windowing_data = priv_src->windowing_data;
[(NSEvent *)priv_dst->windowing_data retain];
}
}
void
_gdk_windowing_event_data_free (GdkEvent *event)
{
GdkEventPrivate *priv = (GdkEventPrivate *) event;
if (priv->windowing_data)
{
[(NSEvent *)priv->windowing_data release];
priv->windowing_data = NULL;
}
}

View File

@ -3652,3 +3652,14 @@ gdk_net_wm_supports (GdkAtom property)
{
return FALSE;
}
void
_gdk_windowing_event_data_copy (GdkEvent *dst,
GdkEvent *src)
{
}
void
_gdk_windowing_event_data_free (GdkEvent *event)
{
}

View File

@ -3085,5 +3085,16 @@ gdk_xsettings_watch_cb (Window window,
return True;
}
void
_gdk_windowing_event_data_copy (GdkEvent *dst,
GdkEvent *src)
{
}
void
_gdk_windowing_event_data_free (GdkEvent *event)
{
}
#define __GDK_EVENTS_X11_C__
#include "gdkaliasdef.c"