2007-05-10 Matthew Allum <mallum@openedhand.com>

* clutter/egl/clutter-backend-egl.c:
        * clutter/egl/clutter-event-egl.c:
        * clutter/sdl/clutter-backend-sdl.c:
        * clutter/sdl/clutter-event-sdl.c:
        Fix SDL & EGL backends to work with newer backend code.
This commit is contained in:
Matthew Allum 2007-05-10 12:49:34 +00:00
parent 41834d92a6
commit e121eb54c8
5 changed files with 32 additions and 131 deletions

View File

@ -1,3 +1,11 @@
2007-05-10 Matthew Allum <mallum@openedhand.com>
* clutter/egl/clutter-backend-egl.c:
* clutter/egl/clutter-event-egl.c:
* clutter/sdl/clutter-backend-sdl.c:
* clutter/sdl/clutter-event-sdl.c:
Fix SDL & EGL backends to work with newer backend code.
2007-05-10 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-color.h:

View File

@ -89,13 +89,6 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
return FALSE;
}
/* generic backend properties */
backend->res_width = WidthOfScreen (backend_egl->xscreen);
backend->res_height = HeightOfScreen (backend_egl->xscreen);
backend->mm_width = WidthMMOfScreen (backend_egl->xscreen);
backend->mm_height = HeightMMOfScreen (backend_egl->xscreen);
backend->screen_num = backend_egl->xscreen_num;
backend->n_screens = ScreenCount (backend_egl->xdpy);
}
g_free (clutter_display_name);
@ -268,20 +261,9 @@ clutter_backend_egl_init (ClutterBackendEgl *backend_egl)
{
ClutterBackend *backend = CLUTTER_BACKEND (backend_egl);
backend->events_queue = g_queue_new ();
backend->button_click_time[0] = backend->button_click_time[1] = 0;
backend->button_number[0] = backend->button_number[1] = -1;
backend->button_x[0] = backend->button_x[1] = 0;
backend->button_y[0] = backend->button_y[1] = 0;
backend->res_width = backend->res_height = -1;
backend->mm_width = backend->mm_height = -1;
backend->screen_num = 0;
backend->n_screens = 0;
backend->double_click_time = 250;
backend->double_click_distance = 5;
/* FIXME: get from xsettings */
clutter_backend_set_double_click_time (backend, 250);
clutter_backend_set_double_click_distance (backend, 5);
}
GType

View File

@ -147,40 +147,6 @@ set_user_time (Display *display,
}
}
/**
* clutter_events_pending:
*
* FIXME
*
* Return value: FIXME
*
* Since: 0.4
*/
gboolean
clutter_events_pending (void)
{
GList *i;
for (i = event_sources; i != NULL; i = i->next)
{
ClutterEventSource *source = i->data;
ClutterBackend *backend = source->backend;
if (_clutter_event_queue_check_pending (backend))
return TRUE;
}
for (i = event_sources; i != NULL; i = i->next)
{
ClutterEventSource *source = i->data;
ClutterBackend *backend = source->backend;
if (clutter_check_xpending (backend))
return TRUE;
}
return FALSE;
}
static void
translate_key_event (ClutterBackend *backend,
@ -325,32 +291,26 @@ clutter_event_translate (ClutterBackend *backend,
return res;
}
void
_clutter_events_queue (ClutterBackend *backend)
static void
events_queue (ClutterBackend *backend)
{
ClutterBackendEgl *backend_egl = CLUTTER_BACKEND_EGL (backend);
ClutterEvent *event;
XEvent xevent;
ClutterBackendEgl *backend_egl = CLUTTER_BACKEND_EGL (backend);
ClutterEvent *event;
XEvent xevent;
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
Display *xdisplay = backend_egl->xdpy;
while (!_clutter_event_queue_check_pending (backend) && XPending (xdisplay))
while (!clutter_events_pending () && XPending (xdisplay))
{
XNextEvent (xdisplay, &xevent);
switch (xevent.type)
{
case KeyPress:
case KeyRelease:
break;
default:
if (XFilterEvent (&xevent, None))
continue;
}
event = clutter_event_new (CLUTTER_NOTHING);
if (clutter_event_translate (backend, event, &xevent))
{
_clutter_event_queue_push (backend, event);
g_queue_push_head (clutter_context->events_queue, event);
}
else
{
@ -367,8 +327,7 @@ clutter_event_prepare (GSource *source,
gboolean retval;
*timeout = -1;
retval = (_clutter_event_queue_check_pending (backend) ||
clutter_check_xpending (backend));
retval = (clutter_events_pending () || clutter_check_xpending (backend));
return retval;
}
@ -381,8 +340,7 @@ clutter_event_check (GSource *source)
gboolean retval;
if (event_source->event_poll_fd.revents & G_IO_IN)
retval = (_clutter_event_queue_check_pending (backend) ||
clutter_check_xpending (backend));
retval = (clutter_events_pending () || clutter_check_xpending (backend));
else
retval = FALSE;
@ -397,17 +355,13 @@ clutter_event_dispatch (GSource *source,
ClutterBackend *backend = ((ClutterEventSource *) source)->backend;
ClutterEvent *event;
_clutter_events_queue (backend);
event = _clutter_event_queue_pop (backend);
events_queue (backend);
event = clutter_event_get ();
if (event)
{
if (_clutter_event_func)
{
CLUTTER_NOTE (EVENT, "Dispatching _clutter_event_func");
(* _clutter_event_func) (event, _clutter_event_data);
}
clutter_do_event (event);
clutter_event_free (event);
}

View File

@ -22,7 +22,6 @@ static gboolean
clutter_backend_sdl_post_parse (ClutterBackend *backend,
GError **error)
{
ClutterBackendSDL *backend_sdl = CLUTTER_BACKEND_SDL (backend);
int err;
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0)
@ -117,8 +116,6 @@ clutter_backend_sdl_get_stage (ClutterBackend *backend)
static void
clutter_backend_sdl_finalize (GObject *gobject)
{
ClutterBackendSDL *backend_sdl = CLUTTER_BACKEND_SDL (gobject);
SDL_Quit();
if (backend_singleton)
@ -191,20 +188,8 @@ clutter_backend_sdl_init (ClutterBackendSDL *backend_sdl)
{
ClutterBackend *backend = CLUTTER_BACKEND (backend_sdl);
backend->events_queue = g_queue_new ();
backend->button_click_time[0] = backend->button_click_time[1] = 0;
backend->button_number[0] = backend->button_number[1] = -1;
backend->button_x[0] = backend->button_x[1] = 0;
backend->button_y[0] = backend->button_y[1] = 0;
backend->res_width = backend->res_height = -1;
backend->mm_width = backend->mm_height = -1;
backend->screen_num = 0;
backend->n_screens = 0;
backend->double_click_time = 250;
backend->double_click_distance = 5;
clutter_backend_set_double_click_time (backend, 250);
clutter_backend_set_double_click_distance (backend, 5);
}
GType

View File

@ -105,21 +105,6 @@ _clutter_events_uninit (ClutterBackend *backend)
}
}
/**
* clutter_events_pending:
*
* FIXME
*
* Return value: FIXME
*
* Since: 0.4
*/
gboolean
clutter_events_pending (void)
{
return FALSE;
}
static gboolean
clutter_event_prepare (GSource *source,
gint *timeout)
@ -138,19 +123,11 @@ clutter_event_check (GSource *source)
return SDL_PeepEvents(&events, 1, SDL_PEEKEVENT, SDL_ALLEVENTS);
}
void
_clutter_events_queue (ClutterBackend *backend)
{
/* FIXME: Implement */
}
static gboolean
clutter_event_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
ClutterBackend *backend = ((ClutterEventSource *) source)->backend;
SDL_Event sdl_event;
ClutterEvent *event = NULL;
@ -169,16 +146,11 @@ clutter_event_dispatch (GSource *source,
return TRUE;
event = _clutter_event_queue_pop (backend);
event = clutter_event_get ();
if (event)
{
if (_clutter_event_func)
{
CLUTTER_NOTE (EVENT, "Dispatching _clutter_event_func");
(* _clutter_event_func) (event, _clutter_event_data);
}
clutter_do_event(event);
clutter_event_free (event);
}