tests: Use an internal setter for disabling vblank sync

Instead of using g_setenv().
This commit is contained in:
Emmanuele Bassi 2013-12-12 18:11:03 +00:00
parent 526d0ea884
commit b1eb412c23
3 changed files with 11 additions and 4 deletions

View File

@ -3948,6 +3948,12 @@ clutter_check_windowing_backend (const char *backend_type)
return FALSE; return FALSE;
} }
void
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
{
clutter_sync_to_vblank = !!sync_to_vblank;
}
gboolean gboolean
_clutter_get_sync_to_vblank (void) _clutter_get_sync_to_vblank (void)
{ {

View File

@ -231,6 +231,7 @@ void _clutter_id_to_color (guint id,
ClutterActor * _clutter_get_actor_by_id (ClutterStage *stage, ClutterActor * _clutter_get_actor_by_id (ClutterStage *stage,
guint32 actor_id); guint32 actor_id);
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
gboolean _clutter_get_sync_to_vblank (void); gboolean _clutter_get_sync_to_vblank (void);
/* use this function as the accumulator if you have a signal with /* use this function as the accumulator if you have a signal with

View File

@ -10,6 +10,7 @@
#include "clutter-event.h" #include "clutter-event.h"
#include "clutter-keysyms.h" #include "clutter-keysyms.h"
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-stage.h" #include "clutter-stage.h"
typedef struct { typedef struct {
@ -54,11 +55,10 @@ clutter_test_init (int *argc,
} }
#endif #endif
/* by explicitly setting CLUTTER_VBLANK to "none" we disable the /* we explicitly disable the synchronisation to the vertical refresh
* synchronisation, and run the master clock using a 60 fps timer * rate, and run the master clock using a 60 fps timer instead.
* instead.
*/ */
g_setenv ("CLUTTER_VBLANK", "none", FALSE); _clutter_set_sync_to_vblank (FALSE);
g_test_init (argc, argv, NULL); g_test_init (argc, argv, NULL);
g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id=%s"); g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id=%s");