mirror of
https://github.com/brl/mutter.git
synced 2025-02-19 22:54:08 +00:00
Add run-time version checks
Just like CLUTTER_CHECK_VERSION does version checking at compile time, we need a way to verify the version of the library that we are linking against. This is mostly needed for language bindings and for run-time loadable modules -- when we'll get those.
This commit is contained in:
parent
f8e6727e74
commit
f551cbfb61
@ -81,6 +81,10 @@ static GSList *main_loops = NULL;
|
|||||||
|
|
||||||
guint clutter_debug_flags = 0; /* global clutter debug flag */
|
guint clutter_debug_flags = 0; /* global clutter debug flag */
|
||||||
|
|
||||||
|
const guint clutter_major_version = CLUTTER_MAJOR_VERSION;
|
||||||
|
const guint clutter_minor_version = CLUTTER_MINOR_VERSION;
|
||||||
|
const guint clutter_micro_version = CLUTTER_MICRO_VERSION;
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
#ifdef CLUTTER_ENABLE_DEBUG
|
||||||
static const GDebugKey clutter_debug_keys[] = {
|
static const GDebugKey clutter_debug_keys[] = {
|
||||||
{ "misc", CLUTTER_DEBUG_MISC },
|
{ "misc", CLUTTER_DEBUG_MISC },
|
||||||
@ -2995,3 +2999,33 @@ _clutter_run_repaint_functions (void)
|
|||||||
if (reinvoke_list)
|
if (reinvoke_list)
|
||||||
context->repaint_funcs = reinvoke_list;
|
context->repaint_funcs = reinvoke_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_check_version:
|
||||||
|
* @major: major version, like 1 in 1.2.3
|
||||||
|
* @minor: minor version, like 2 in 1.2.3
|
||||||
|
* @micro: micro version, like 3 in 1.2.3
|
||||||
|
*
|
||||||
|
* Run-time version check, to check the version the Clutter library
|
||||||
|
* that an application is currently linked against
|
||||||
|
*
|
||||||
|
* This is the run-time equivalent of the compile-time %CLUTTER_CHECK_VERSION
|
||||||
|
* pre-processor macro
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the version of the Clutter library is
|
||||||
|
* greater than (@major, @minor, @micro), and %FALSE otherwise
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
clutter_check_version (guint major,
|
||||||
|
guint minor,
|
||||||
|
guint micro)
|
||||||
|
{
|
||||||
|
return (clutter_major_version > major ||
|
||||||
|
(clutter_major_version == major &&
|
||||||
|
clutter_minor_version > minor) ||
|
||||||
|
(clutter_major_version == major &&
|
||||||
|
clutter_minor_version == minor &&
|
||||||
|
clutter_micro_version >= micro));
|
||||||
|
}
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
#ifndef __CLUTTER_VERSION_H__
|
#ifndef __CLUTTER_VERSION_H__
|
||||||
#define __CLUTTER_VERSION_H__
|
#define __CLUTTER_VERSION_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CLUTTER_MAJOR_VERSION:
|
* CLUTTER_MAJOR_VERSION:
|
||||||
*
|
*
|
||||||
@ -117,7 +121,7 @@
|
|||||||
*
|
*
|
||||||
* The default GObject type for the Clutter stage.
|
* The default GObject type for the Clutter stage.
|
||||||
*
|
*
|
||||||
* Since 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
#define CLUTTER_STAGE_TYPE @CLUTTER_STAGE_TYPE@
|
#define CLUTTER_STAGE_TYPE @CLUTTER_STAGE_TYPE@
|
||||||
|
|
||||||
@ -131,5 +135,14 @@
|
|||||||
*/
|
*/
|
||||||
#define CLUTTER_NO_FPU CLUTTER_NO_FPU_MACRO_WAS_REMOVED
|
#define CLUTTER_NO_FPU CLUTTER_NO_FPU_MACRO_WAS_REMOVED
|
||||||
|
|
||||||
|
extern const guint clutter_major_version;
|
||||||
|
extern const guint clutter_minor_version;
|
||||||
|
extern const guint clutter_micro_version;
|
||||||
|
|
||||||
|
gboolean clutter_check_version (guint major,
|
||||||
|
guint minor,
|
||||||
|
guint micro);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_VERSION_H__ */
|
#endif /* __CLUTTER_VERSION_H__ */
|
||||||
|
@ -1125,10 +1125,17 @@ CLUTTER_MICRO_VERSION
|
|||||||
CLUTTER_VERSION
|
CLUTTER_VERSION
|
||||||
CLUTTER_VERSION_S
|
CLUTTER_VERSION_S
|
||||||
CLUTTER_VERSION_HEX
|
CLUTTER_VERSION_HEX
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
CLUTTER_CHECK_VERSION
|
CLUTTER_CHECK_VERSION
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
CLUTTER_FLAVOUR
|
CLUTTER_FLAVOUR
|
||||||
CLUTTER_COGL
|
CLUTTER_COGL
|
||||||
CLUTTER_NO_FPU
|
CLUTTER_NO_FPU
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
clutter_check_version
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user