2006-05-29 08:59:36 +00:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2006-05-29 08:59:36 +00:00
|
|
|
*/
|
2012-03-06 12:09:00 +00:00
|
|
|
|
2006-06-21 22:34:25 +00:00
|
|
|
/**
|
|
|
|
* SECTION:clutter-main
|
2014-03-17 23:07:58 +00:00
|
|
|
* @short_description: Various 'global' Clutter functions.
|
2006-06-21 22:34:25 +00:00
|
|
|
*
|
2006-06-22 14:36:05 +00:00
|
|
|
* Functions to retrieve various global Clutter resources and other utility
|
|
|
|
* functions for mainloops, events and threads
|
2009-12-02 14:15:43 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* ## The Clutter Threading Model
|
2009-12-02 14:15:43 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* Clutter is *thread-aware*: all operations performed by Clutter are assumed
|
|
|
|
* to be under the Big Clutter Lock, which is created when the threading is
|
|
|
|
* initialized through clutter_init(), and entered when calling user-related
|
|
|
|
* code during event handling and actor drawing.
|
2009-12-02 14:15:43 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* The only safe and portable way to use the Clutter API in a multi-threaded
|
|
|
|
* environment is to only access the Clutter API from a thread that did called
|
|
|
|
* clutter_init() and clutter_main().
|
2009-12-02 14:15:43 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* The common pattern for using threads with Clutter is to use worker threads
|
|
|
|
* to perform blocking operations and then install idle or timeout sources with
|
|
|
|
* the result when the thread finishes, and update the UI from those callbacks.
|
2009-12-02 14:15:43 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* For a working example of how to use a worker thread to update the UI, see
|
|
|
|
* [threads.c](https://git.gnome.org/browse/clutter/tree/examples/threads.c?h=clutter-1.18)
|
2006-06-21 22:34:25 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
#include "config.h"
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#endif
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2008-06-10 14:01:43 +00:00
|
|
|
#include <glib/gi18n-lib.h>
|
2008-06-10 21:25:23 +00:00
|
|
|
#include <locale.h>
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
2012-06-24 08:58:12 +00:00
|
|
|
#include "clutter-actor-private.h"
|
2010-10-21 10:49:37 +00:00
|
|
|
#include "clutter-backend-private.h"
|
2011-09-21 17:05:03 +00:00
|
|
|
#include "clutter-config.h"
|
2010-10-21 10:49:37 +00:00
|
|
|
#include "clutter-debug.h"
|
|
|
|
#include "clutter-device-manager-private.h"
|
2012-03-07 12:34:06 +00:00
|
|
|
#include "clutter-event-private.h"
|
2010-10-21 10:49:37 +00:00
|
|
|
#include "clutter-feature.h"
|
2006-05-29 08:59:36 +00:00
|
|
|
#include "clutter-main.h"
|
2009-03-21 20:39:32 +00:00
|
|
|
#include "clutter-master-clock.h"
|
2006-05-29 08:59:36 +00:00
|
|
|
#include "clutter-private.h"
|
2011-10-11 13:42:31 +00:00
|
|
|
#include "clutter-settings-private.h"
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
#include "clutter-stage-manager.h"
|
2010-10-21 10:49:37 +00:00
|
|
|
#include "clutter-stage-private.h"
|
|
|
|
#include "clutter-version.h" /* For flavour define */
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2011-09-21 17:05:03 +00:00
|
|
|
#ifdef CLUTTER_WINDOWING_X11
|
|
|
|
#include "x11/clutter-backend-x11.h"
|
|
|
|
#endif
|
|
|
|
#ifdef CLUTTER_WINDOWING_EGL
|
|
|
|
#include "egl/clutter-backend-eglnative.h"
|
|
|
|
#endif
|
|
|
|
#ifdef CLUTTER_WINDOWING_WAYLAND
|
|
|
|
#include "wayland/clutter-backend-wayland.h"
|
|
|
|
#endif
|
|
|
|
|
2011-02-22 15:51:13 +00:00
|
|
|
#include <cogl/cogl.h>
|
2011-05-16 15:04:27 +00:00
|
|
|
#include <cogl-pango/cogl-pango.h>
|
2007-05-28 18:49:34 +00:00
|
|
|
|
2010-04-26 17:33:49 +00:00
|
|
|
#include "cally.h" /* For accessibility support */
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
/* main context */
|
2008-12-23 16:40:26 +00:00
|
|
|
static ClutterMainContext *ClutterCntx = NULL;
|
2011-09-01 16:12:46 +00:00
|
|
|
G_LOCK_DEFINE_STATIC (ClutterCntx);
|
2007-01-23 20:29:11 +00:00
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
/* main lock and locking/unlocking functions */
|
2011-10-07 14:08:27 +00:00
|
|
|
static GMutex clutter_threads_mutex;
|
2008-12-23 16:40:26 +00:00
|
|
|
static GCallback clutter_threads_lock = NULL;
|
|
|
|
static GCallback clutter_threads_unlock = NULL;
|
2007-08-08 10:20:14 +00:00
|
|
|
|
2009-02-23 13:08:59 +00:00
|
|
|
/* command line options */
|
2008-12-23 16:40:26 +00:00
|
|
|
static gboolean clutter_is_initialized = FALSE;
|
|
|
|
static gboolean clutter_show_fps = FALSE;
|
|
|
|
static gboolean clutter_fatal_warnings = FALSE;
|
2009-02-23 13:08:59 +00:00
|
|
|
static gboolean clutter_disable_mipmap_text = FALSE;
|
2009-02-23 13:17:06 +00:00
|
|
|
static gboolean clutter_use_fuzzy_picking = FALSE;
|
2010-04-26 17:33:49 +00:00
|
|
|
static gboolean clutter_enable_accessibility = TRUE;
|
2011-11-04 16:35:38 +00:00
|
|
|
static gboolean clutter_sync_to_vblank = TRUE;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-12-23 16:40:26 +00:00
|
|
|
static guint clutter_default_fps = 60;
|
2007-10-26 15:47:39 +00:00
|
|
|
|
2010-11-15 15:36:41 +00:00
|
|
|
static ClutterTextDirection clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
|
2009-02-23 13:08:59 +00:00
|
|
|
|
2008-12-23 16:40:26 +00:00
|
|
|
static guint clutter_main_loop_level = 0;
|
|
|
|
static GSList *main_loops = NULL;
|
|
|
|
|
2011-10-10 14:42:36 +00:00
|
|
|
/* debug flags */
|
|
|
|
guint clutter_debug_flags = 0;
|
2010-02-16 20:08:35 +00:00
|
|
|
guint clutter_paint_debug_flags = 0;
|
2011-10-10 14:42:36 +00:00
|
|
|
guint clutter_pick_debug_flags = 0;
|
2010-02-16 20:08:35 +00:00
|
|
|
|
2009-10-30 11:02:35 +00:00
|
|
|
const guint clutter_major_version = CLUTTER_MAJOR_VERSION;
|
|
|
|
const guint clutter_minor_version = CLUTTER_MINOR_VERSION;
|
|
|
|
const guint clutter_micro_version = CLUTTER_MICRO_VERSION;
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
static const GDebugKey clutter_debug_keys[] = {
|
|
|
|
{ "misc", CLUTTER_DEBUG_MISC },
|
|
|
|
{ "actor", CLUTTER_DEBUG_ACTOR },
|
|
|
|
{ "texture", CLUTTER_DEBUG_TEXTURE },
|
|
|
|
{ "event", CLUTTER_DEBUG_EVENT },
|
|
|
|
{ "paint", CLUTTER_DEBUG_PAINT },
|
2010-08-23 10:33:22 +00:00
|
|
|
{ "pick", CLUTTER_DEBUG_PICK },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
{ "pango", CLUTTER_DEBUG_PANGO },
|
2007-04-28 00:37:11 +00:00
|
|
|
{ "backend", CLUTTER_DEBUG_BACKEND },
|
2007-06-07 23:51:53 +00:00
|
|
|
{ "scheduler", CLUTTER_DEBUG_SCHEDULER },
|
2007-10-08 15:03:22 +00:00
|
|
|
{ "script", CLUTTER_DEBUG_SCRIPT },
|
2007-12-05 21:15:19 +00:00
|
|
|
{ "shader", CLUTTER_DEBUG_SHADER },
|
2009-04-15 16:25:50 +00:00
|
|
|
{ "animation", CLUTTER_DEBUG_ANIMATION },
|
2011-02-01 18:32:08 +00:00
|
|
|
{ "layout", CLUTTER_DEBUG_LAYOUT },
|
2011-09-19 11:36:52 +00:00
|
|
|
{ "clipping", CLUTTER_DEBUG_CLIPPING },
|
2011-09-28 12:24:57 +00:00
|
|
|
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
|
2010-02-16 20:08:35 +00:00
|
|
|
};
|
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
|
|
|
|
|
|
static const GDebugKey clutter_pick_debug_keys[] = {
|
2009-09-24 11:49:17 +00:00
|
|
|
{ "nop-picking", CLUTTER_DEBUG_NOP_PICKING },
|
2011-10-13 10:38:27 +00:00
|
|
|
{ "dump-pick-buffers", CLUTTER_DEBUG_DUMP_PICK_BUFFERS },
|
2010-02-16 20:08:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const GDebugKey clutter_paint_debug_keys[] = {
|
2009-11-30 17:47:55 +00:00
|
|
|
{ "disable-swap-events", CLUTTER_DEBUG_DISABLE_SWAP_EVENTS },
|
|
|
|
{ "disable-clipped-redraws", CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS },
|
2010-09-07 17:50:29 +00:00
|
|
|
{ "redraws", CLUTTER_DEBUG_REDRAWS },
|
|
|
|
{ "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES },
|
2011-06-06 17:22:20 +00:00
|
|
|
{ "disable-culling", CLUTTER_DEBUG_DISABLE_CULLING },
|
2011-09-23 14:12:44 +00:00
|
|
|
{ "disable-offscreen-redirect", CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT },
|
2011-10-13 10:38:27 +00:00
|
|
|
{ "continuous-redraw", CLUTTER_DEBUG_CONTINUOUS_REDRAW },
|
|
|
|
{ "paint-deform-tiles", CLUTTER_DEBUG_PAINT_DEFORM_TILES },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
};
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2011-10-07 14:53:50 +00:00
|
|
|
static void
|
|
|
|
clutter_threads_impl_lock (void)
|
|
|
|
{
|
|
|
|
g_mutex_lock (&clutter_threads_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_threads_impl_unlock (void)
|
|
|
|
{
|
2012-09-26 08:45:46 +00:00
|
|
|
/* we need to trylock here, in case the lock hasn't been acquired; on
|
|
|
|
* various systems trying to release a mutex that hasn't been acquired
|
|
|
|
* will cause a run-time error. trylock() will either fail, in which
|
|
|
|
* case we can release the lock we own; or it will succeeds, in which
|
|
|
|
* case we need to release the lock we just acquired. so we ignore the
|
|
|
|
* returned value.
|
|
|
|
*
|
|
|
|
* see: https://bugs.gnome.org/679439
|
|
|
|
*/
|
|
|
|
g_mutex_trylock (&clutter_threads_mutex);
|
2011-10-07 14:53:50 +00:00
|
|
|
g_mutex_unlock (&clutter_threads_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
clutter_threads_init_default (void)
|
|
|
|
{
|
|
|
|
g_mutex_init (&clutter_threads_mutex);
|
|
|
|
|
|
|
|
if (clutter_threads_lock == NULL)
|
|
|
|
clutter_threads_lock = clutter_threads_impl_lock;
|
|
|
|
|
|
|
|
if (clutter_threads_unlock == NULL)
|
|
|
|
clutter_threads_unlock = clutter_threads_impl_unlock;
|
|
|
|
}
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
#define ENVIRONMENT_GROUP "Environment"
|
|
|
|
#define DEBUG_GROUP "Debug"
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_config_read_from_key_file (GKeyFile *keyfile)
|
|
|
|
{
|
|
|
|
GError *key_error = NULL;
|
|
|
|
gboolean bool_value;
|
|
|
|
gint int_value;
|
2011-10-11 21:43:54 +00:00
|
|
|
gchar *str_value;
|
2011-10-11 14:28:47 +00:00
|
|
|
|
|
|
|
if (!g_key_file_has_group (keyfile, ENVIRONMENT_GROUP))
|
|
|
|
return;
|
|
|
|
|
2015-12-11 15:41:35 +00:00
|
|
|
str_value =
|
|
|
|
g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"Backends",
|
|
|
|
&key_error);
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_try_set_windowing_backend (str_value);
|
|
|
|
|
|
|
|
g_free (str_value);
|
|
|
|
|
2015-12-10 16:52:45 +00:00
|
|
|
str_value =
|
|
|
|
g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"Drivers",
|
|
|
|
&key_error);
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_set_allowed_drivers (str_value);
|
|
|
|
|
|
|
|
g_free (str_value);
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
bool_value =
|
|
|
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"ShowFps",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_show_fps = bool_value;
|
|
|
|
|
|
|
|
bool_value =
|
|
|
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"DisableMipmappedText",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_disable_mipmap_text = bool_value;
|
|
|
|
|
|
|
|
bool_value =
|
|
|
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"UseFuzzyPicking",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_use_fuzzy_picking = bool_value;
|
|
|
|
|
|
|
|
bool_value =
|
|
|
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"EnableAccessibility",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_enable_accessibility = bool_value;
|
|
|
|
|
2011-11-04 16:35:38 +00:00
|
|
|
bool_value =
|
|
|
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"SyncToVblank",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_sync_to_vblank = bool_value;
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
int_value =
|
|
|
|
g_key_file_get_integer (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"DefaultFps",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
clutter_default_fps = int_value;
|
|
|
|
|
|
|
|
str_value =
|
|
|
|
g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
|
|
|
|
"TextDirection",
|
|
|
|
&key_error);
|
|
|
|
|
|
|
|
if (key_error != NULL)
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (g_strcmp0 (str_value, "rtl") == 0)
|
|
|
|
clutter_text_direction = CLUTTER_TEXT_DIRECTION_RTL;
|
|
|
|
else
|
|
|
|
clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
|
|
|
|
}
|
2011-10-11 21:43:54 +00:00
|
|
|
|
|
|
|
g_free (str_value);
|
2011-10-11 14:28:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
static void
|
|
|
|
clutter_debug_read_from_key_file (GKeyFile *keyfile)
|
|
|
|
{
|
|
|
|
GError *key_error = NULL;
|
2011-10-11 21:43:54 +00:00
|
|
|
gchar *value;
|
2011-10-11 14:28:47 +00:00
|
|
|
|
|
|
|
if (!g_key_file_has_group (keyfile, DEBUG_GROUP))
|
|
|
|
return;
|
|
|
|
|
|
|
|
value = g_key_file_get_value (keyfile, DEBUG_GROUP,
|
|
|
|
"Debug",
|
|
|
|
&key_error);
|
|
|
|
if (key_error == NULL)
|
|
|
|
{
|
|
|
|
clutter_debug_flags |=
|
|
|
|
g_parse_debug_string (value,
|
|
|
|
clutter_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_debug_keys));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
|
2011-10-11 21:43:54 +00:00
|
|
|
g_free (value);
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
value = g_key_file_get_value (keyfile, DEBUG_GROUP,
|
|
|
|
"PaintDebug",
|
|
|
|
&key_error);
|
|
|
|
if (key_error == NULL)
|
|
|
|
{
|
|
|
|
clutter_paint_debug_flags |=
|
|
|
|
g_parse_debug_string (value,
|
|
|
|
clutter_paint_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_paint_debug_keys));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_clear_error (&key_error);
|
|
|
|
|
2011-10-11 21:43:54 +00:00
|
|
|
g_free (value);
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
value = g_key_file_get_value (keyfile, DEBUG_GROUP,
|
|
|
|
"PickDebug",
|
|
|
|
&key_error);
|
|
|
|
if (key_error == NULL)
|
|
|
|
{
|
|
|
|
clutter_pick_debug_flags |=
|
|
|
|
g_parse_debug_string (value,
|
|
|
|
clutter_pick_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_pick_debug_keys));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_clear_error (&key_error);
|
2011-10-11 21:43:54 +00:00
|
|
|
|
|
|
|
g_free (value);
|
2011-10-11 14:28:47 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_config_read_from_file (const gchar *config_path)
|
|
|
|
{
|
|
|
|
ClutterSettings *settings = clutter_settings_get_default ();
|
|
|
|
GKeyFile *key_file = g_key_file_new ();
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
g_key_file_load_from_file (key_file, config_path, G_KEY_FILE_NONE, &error);
|
|
|
|
if (error == NULL)
|
|
|
|
{
|
2011-11-09 09:09:37 +00:00
|
|
|
CLUTTER_NOTE (MISC, "Reading configuration from '%s'", config_path);
|
|
|
|
|
2011-10-11 14:28:47 +00:00
|
|
|
clutter_config_read_from_key_file (key_file);
|
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
clutter_debug_read_from_key_file (key_file);
|
|
|
|
#endif
|
|
|
|
_clutter_settings_read_from_key_file (settings, key_file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Unable to read configuration settings from '%s': %s",
|
|
|
|
config_path,
|
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_key_file_free (key_file);
|
|
|
|
}
|
2011-10-11 13:42:31 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_config_read (void)
|
|
|
|
{
|
|
|
|
gchar *config_path;
|
|
|
|
|
|
|
|
config_path = g_build_filename (CLUTTER_SYSCONFDIR,
|
|
|
|
"clutter-1.0",
|
|
|
|
"settings.ini",
|
|
|
|
NULL);
|
|
|
|
if (g_file_test (config_path, G_FILE_TEST_EXISTS))
|
2011-10-11 14:28:47 +00:00
|
|
|
clutter_config_read_from_file (config_path);
|
2011-10-11 13:42:31 +00:00
|
|
|
|
|
|
|
g_free (config_path);
|
|
|
|
|
|
|
|
config_path = g_build_filename (g_get_user_config_dir (),
|
|
|
|
"clutter-1.0",
|
|
|
|
"settings.ini",
|
|
|
|
NULL);
|
|
|
|
if (g_file_test (config_path, G_FILE_TEST_EXISTS))
|
2011-10-11 14:28:47 +00:00
|
|
|
clutter_config_read_from_file (config_path);
|
2011-10-11 13:42:31 +00:00
|
|
|
|
|
|
|
g_free (config_path);
|
|
|
|
}
|
|
|
|
|
2007-03-22 18:21:59 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_show_fps:
|
|
|
|
*
|
2007-08-08 10:20:14 +00:00
|
|
|
* Returns whether Clutter should print out the frames per second on the
|
|
|
|
* console. You can enable this setting either using the
|
|
|
|
* <literal>CLUTTER_SHOW_FPS</literal> environment variable or passing
|
|
|
|
* the <literal>--clutter-show-fps</literal> command line argument. *
|
2007-03-22 18:21:59 +00:00
|
|
|
*
|
2007-08-08 10:20:14 +00:00
|
|
|
* Return value: %TRUE if Clutter should show the FPS.
|
2007-03-22 18:21:59 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
2011-11-15 17:58:25 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: This function does not do anything. Use the environment
|
|
|
|
* variable or the configuration file to determine whether Clutter should
|
|
|
|
* print out the FPS counter on the console.
|
2007-03-22 18:21:59 +00:00
|
|
|
*/
|
2007-01-23 20:29:11 +00:00
|
|
|
gboolean
|
2007-03-22 18:21:59 +00:00
|
|
|
clutter_get_show_fps (void)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2011-11-15 17:58:25 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_clutter_context_get_show_fps (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
return context->show_fps;
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
2010-04-26 17:33:49 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_accessibility_enabled:
|
|
|
|
*
|
|
|
|
* Returns whether Clutter has accessibility support enabled. As
|
|
|
|
* least, a value of TRUE means that there are a proper AtkUtil
|
|
|
|
* implementation available
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if Clutter has accessibility support enabled
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_get_accessibility_enabled (void)
|
|
|
|
{
|
|
|
|
return cally_get_cally_initialized ();
|
|
|
|
}
|
|
|
|
|
2013-03-01 09:58:54 +00:00
|
|
|
/**
|
|
|
|
* clutter_disable_accessibility:
|
|
|
|
*
|
|
|
|
* Disable loading the accessibility support. It has the same effect
|
|
|
|
* as setting the environment variable
|
|
|
|
* CLUTTER_DISABLE_ACCESSIBILITY. For the same reason, this method
|
|
|
|
* should be called before clutter_init().
|
|
|
|
*
|
|
|
|
* Since: 1.14
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_disable_accessibility (void)
|
|
|
|
{
|
|
|
|
if (clutter_is_initialized)
|
|
|
|
{
|
|
|
|
g_warning ("clutter_disable_accessibility() can only be called before "
|
|
|
|
"initializing Clutter.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
clutter_enable_accessibility = FALSE;
|
|
|
|
}
|
|
|
|
|
2009-06-05 16:55:24 +00:00
|
|
|
/**
|
|
|
|
* clutter_redraw:
|
|
|
|
*
|
|
|
|
* Forces a redraw of the entire stage. Applications should never use this
|
|
|
|
* function, but queue a redraw using clutter_actor_queue_redraw().
|
|
|
|
*
|
|
|
|
* This function should only be used by libraries integrating Clutter from
|
|
|
|
* within another toolkit.
|
2011-10-10 14:48:43 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_stage_ensure_redraw() instead.
|
2009-06-05 16:55:24 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_redraw (ClutterStage *stage)
|
|
|
|
{
|
2009-06-09 15:29:29 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2009-06-05 16:55:24 +00:00
|
|
|
|
2009-06-09 15:29:29 +00:00
|
|
|
clutter_stage_ensure_redraw (stage);
|
2009-06-05 16:55:24 +00:00
|
|
|
}
|
|
|
|
|
2007-11-19 16:30:56 +00:00
|
|
|
/**
|
|
|
|
* clutter_set_motion_events_enabled:
|
|
|
|
* @enable: %TRUE to enable per-actor motion events
|
|
|
|
*
|
2011-06-20 10:41:28 +00:00
|
|
|
* Sets whether per-actor motion events should be enabled or not on
|
|
|
|
* all #ClutterStage<!-- -->s managed by Clutter.
|
2007-11-19 16:30:56 +00:00
|
|
|
*
|
|
|
|
* If @enable is %FALSE the following events will not work:
|
2014-03-17 23:07:58 +00:00
|
|
|
*
|
|
|
|
* - ClutterActor::motion-event, except on the #ClutterStage
|
|
|
|
* - ClutterActor::enter-event
|
|
|
|
* - ClutterActor::leave-event
|
2007-11-19 16:30:56 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
2011-06-20 10:41:28 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.8: Use clutter_stage_set_motion_events_enabled() instead.
|
2007-11-19 16:30:56 +00:00
|
|
|
*/
|
2007-08-13 20:48:01 +00:00
|
|
|
void
|
2007-11-19 16:30:56 +00:00
|
|
|
clutter_set_motion_events_enabled (gboolean enable)
|
2007-08-13 20:48:01 +00:00
|
|
|
{
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
ClutterStageManager *stage_manager;
|
|
|
|
ClutterMainContext *context;
|
|
|
|
const GSList *l;
|
|
|
|
|
|
|
|
enable = !!enable;
|
|
|
|
|
|
|
|
context = _clutter_context_get_default ();
|
|
|
|
if (context->motion_events_per_actor == enable)
|
|
|
|
return;
|
2007-08-13 20:48:01 +00:00
|
|
|
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
/* store the flag for later query and for newly created stages */
|
2007-08-13 20:48:01 +00:00
|
|
|
context->motion_events_per_actor = enable;
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
|
|
|
|
/* propagate the change to all stages */
|
|
|
|
stage_manager = clutter_stage_manager_get_default ();
|
|
|
|
|
|
|
|
for (l = clutter_stage_manager_peek_stages (stage_manager);
|
|
|
|
l != NULL;
|
|
|
|
l = l->next)
|
|
|
|
{
|
2011-06-20 10:41:28 +00:00
|
|
|
clutter_stage_set_motion_events_enabled (l->data, enable);
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
}
|
2007-08-13 20:48:01 +00:00
|
|
|
}
|
|
|
|
|
2007-11-19 16:30:56 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_motion_events_enabled:
|
|
|
|
*
|
|
|
|
* Gets whether the per-actor motion events are enabled.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the motion events are enabled
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
2011-06-20 10:41:28 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.8: Use clutter_stage_get_motion_events_enabled() instead.
|
2007-11-19 16:30:56 +00:00
|
|
|
*/
|
2007-08-13 20:48:01 +00:00
|
|
|
gboolean
|
|
|
|
clutter_get_motion_events_enabled (void)
|
|
|
|
{
|
2011-06-20 12:53:09 +00:00
|
|
|
return _clutter_context_get_motion_events_enabled ();
|
2007-08-13 20:48:01 +00:00
|
|
|
}
|
|
|
|
|
2008-05-13 23:02:45 +00:00
|
|
|
void
|
2011-02-15 11:50:26 +00:00
|
|
|
_clutter_id_to_color (guint id_,
|
|
|
|
ClutterColor *col)
|
2008-05-13 23:02:45 +00:00
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
2009-06-17 16:59:54 +00:00
|
|
|
gint red, green, blue;
|
|
|
|
|
|
|
|
ctx = _clutter_context_get_default ();
|
2008-05-13 23:02:45 +00:00
|
|
|
|
2010-09-27 17:25:50 +00:00
|
|
|
if (ctx->fb_g_mask == 0)
|
|
|
|
{
|
|
|
|
/* Figure out framebuffer masks used for pick */
|
|
|
|
cogl_get_bitmasks (&ctx->fb_r_mask,
|
|
|
|
&ctx->fb_g_mask,
|
|
|
|
&ctx->fb_b_mask, NULL);
|
|
|
|
|
|
|
|
ctx->fb_r_mask_used = ctx->fb_r_mask;
|
|
|
|
ctx->fb_g_mask_used = ctx->fb_g_mask;
|
|
|
|
ctx->fb_b_mask_used = ctx->fb_b_mask;
|
|
|
|
|
|
|
|
/* XXX - describe what "fuzzy picking" is */
|
|
|
|
if (clutter_use_fuzzy_picking)
|
|
|
|
{
|
|
|
|
ctx->fb_r_mask_used--;
|
|
|
|
ctx->fb_g_mask_used--;
|
|
|
|
ctx->fb_b_mask_used--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-13 23:02:45 +00:00
|
|
|
/* compute the numbers we'll store in the components */
|
2011-02-15 11:50:26 +00:00
|
|
|
red = (id_ >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
|
2009-12-11 20:17:58 +00:00
|
|
|
& (0xff >> (8-ctx->fb_r_mask_used));
|
2011-02-15 11:50:26 +00:00
|
|
|
green = (id_ >> ctx->fb_b_mask_used)
|
2009-12-11 20:17:58 +00:00
|
|
|
& (0xff >> (8-ctx->fb_g_mask_used));
|
2011-02-15 11:50:26 +00:00
|
|
|
blue = (id_)
|
2009-12-11 20:17:58 +00:00
|
|
|
& (0xff >> (8-ctx->fb_b_mask_used));
|
2008-05-13 23:02:45 +00:00
|
|
|
|
|
|
|
/* shift left bits a bit and add one, this circumvents
|
|
|
|
* at least some potential rounding errors in GL/GLES
|
2008-09-23 07:03:35 +00:00
|
|
|
* driver / hw implementation.
|
2008-05-13 23:02:45 +00:00
|
|
|
*/
|
|
|
|
if (ctx->fb_r_mask_used != ctx->fb_r_mask)
|
2008-11-06 12:03:05 +00:00
|
|
|
red = red * 2;
|
2008-05-13 23:02:45 +00:00
|
|
|
if (ctx->fb_g_mask_used != ctx->fb_g_mask)
|
2008-11-06 12:03:05 +00:00
|
|
|
green = green * 2;
|
2008-05-13 23:02:45 +00:00
|
|
|
if (ctx->fb_b_mask_used != ctx->fb_b_mask)
|
2008-11-06 12:03:05 +00:00
|
|
|
blue = blue * 2;
|
2008-05-13 23:02:45 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
/* shift up to be full 8bit values */
|
2008-11-06 12:03:05 +00:00
|
|
|
red = (red << (8 - ctx->fb_r_mask)) | (0x7f >> (ctx->fb_r_mask_used));
|
|
|
|
green = (green << (8 - ctx->fb_g_mask)) | (0x7f >> (ctx->fb_g_mask_used));
|
|
|
|
blue = (blue << (8 - ctx->fb_b_mask)) | (0x7f >> (ctx->fb_b_mask_used));
|
2008-05-13 23:02:45 +00:00
|
|
|
|
|
|
|
col->red = red;
|
|
|
|
col->green = green;
|
|
|
|
col->blue = blue;
|
|
|
|
col->alpha = 0xff;
|
2009-09-24 11:49:17 +00:00
|
|
|
|
2009-10-05 15:46:24 +00:00
|
|
|
/* XXX: We rotate the nibbles of the colors here so that there is a
|
|
|
|
* visible variation between colors of sequential actor identifiers;
|
|
|
|
* otherwise pick buffers dumped to an image will pretty much just look
|
|
|
|
* black.
|
|
|
|
*/
|
2010-02-16 20:08:35 +00:00
|
|
|
if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))
|
2009-09-24 11:49:17 +00:00
|
|
|
{
|
2009-12-11 20:17:58 +00:00
|
|
|
col->red = (col->red << 4) | (col->red >> 4);
|
2009-09-24 11:49:17 +00:00
|
|
|
col->green = (col->green << 4) | (col->green >> 4);
|
2009-12-11 20:17:58 +00:00
|
|
|
col->blue = (col->blue << 4) | (col->blue >> 4);
|
2009-09-24 11:49:17 +00:00
|
|
|
}
|
2008-05-13 23:02:45 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:17:04 +00:00
|
|
|
guint
|
2008-09-23 07:03:35 +00:00
|
|
|
_clutter_pixel_to_id (guchar pixel[4])
|
2008-05-13 23:02:45 +00:00
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
2011-02-15 11:50:26 +00:00
|
|
|
gint red, green, blue;
|
|
|
|
guint retval;
|
2008-05-13 23:02:45 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
ctx = _clutter_context_get_default ();
|
2008-05-13 23:02:45 +00:00
|
|
|
|
|
|
|
/* reduce the pixel components to the number of bits actually used of the
|
|
|
|
* 8bits.
|
|
|
|
*/
|
2010-02-16 20:08:35 +00:00
|
|
|
if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))
|
2009-09-24 11:49:17 +00:00
|
|
|
{
|
|
|
|
guchar tmp;
|
2009-10-05 15:46:24 +00:00
|
|
|
|
|
|
|
/* XXX: In _clutter_id_to_color we rotated the nibbles of the colors so
|
|
|
|
* that there is a visible variation between colors of sequential actor
|
|
|
|
* identifiers (otherwise pick buffers dumped to an image will pretty
|
|
|
|
* much just look black.) Here we reverse that rotation.
|
|
|
|
*/
|
2009-09-24 11:49:17 +00:00
|
|
|
tmp = ((pixel[0] << 4) | (pixel[0] >> 4));
|
|
|
|
red = tmp >> (8 - ctx->fb_r_mask);
|
|
|
|
tmp = ((pixel[1] << 4) | (pixel[1] >> 4));
|
|
|
|
green = tmp >> (8 - ctx->fb_g_mask);
|
|
|
|
tmp = ((pixel[2] << 4) | (pixel[2] >> 4));
|
|
|
|
blue = tmp >> (8 - ctx->fb_b_mask);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
red = pixel[0] >> (8 - ctx->fb_r_mask);
|
|
|
|
green = pixel[1] >> (8 - ctx->fb_g_mask);
|
|
|
|
blue = pixel[2] >> (8 - ctx->fb_b_mask);
|
|
|
|
}
|
2008-05-13 23:02:45 +00:00
|
|
|
|
|
|
|
/* divide potentially by two if 'fuzzy' */
|
|
|
|
red = red >> (ctx->fb_r_mask - ctx->fb_r_mask_used);
|
|
|
|
green = green >> (ctx->fb_g_mask - ctx->fb_g_mask_used);
|
2008-09-23 07:03:35 +00:00
|
|
|
blue = blue >> (ctx->fb_b_mask - ctx->fb_b_mask_used);
|
2008-05-13 23:02:45 +00:00
|
|
|
|
|
|
|
/* combine the correct per component values into the final id */
|
2011-02-15 11:50:26 +00:00
|
|
|
retval = blue
|
|
|
|
+ (green << ctx->fb_b_mask_used)
|
|
|
|
+ (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used));
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2011-02-15 11:50:26 +00:00
|
|
|
return retval;
|
2008-05-13 23:02:45 +00:00
|
|
|
}
|
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
static CoglPangoFontMap *
|
|
|
|
clutter_context_get_pango_fontmap (void)
|
2010-06-09 10:53:58 +00:00
|
|
|
{
|
2011-02-18 15:47:35 +00:00
|
|
|
ClutterMainContext *self;
|
2010-06-09 10:53:58 +00:00
|
|
|
CoglPangoFontMap *font_map;
|
|
|
|
gdouble resolution;
|
|
|
|
gboolean use_mipmapping;
|
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
self = _clutter_context_get_default ();
|
2010-06-09 10:53:58 +00:00
|
|
|
if (G_LIKELY (self->font_map != NULL))
|
|
|
|
return self->font_map;
|
|
|
|
|
|
|
|
font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
|
|
|
|
|
|
|
resolution = clutter_backend_get_resolution (self->backend);
|
|
|
|
cogl_pango_font_map_set_resolution (font_map, resolution);
|
|
|
|
|
|
|
|
use_mipmapping = !clutter_disable_mipmap_text;
|
|
|
|
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
|
|
|
|
|
|
|
self->font_map = font_map;
|
|
|
|
|
|
|
|
return self->font_map;
|
|
|
|
}
|
|
|
|
|
2009-11-06 16:50:53 +00:00
|
|
|
static ClutterTextDirection
|
2008-12-23 16:40:26 +00:00
|
|
|
clutter_get_text_direction (void)
|
2008-06-13 09:10:39 +00:00
|
|
|
{
|
2011-10-11 22:42:23 +00:00
|
|
|
ClutterTextDirection dir = CLUTTER_TEXT_DIRECTION_LTR;
|
2009-01-06 12:35:19 +00:00
|
|
|
const gchar *direction;
|
2008-12-23 16:40:26 +00:00
|
|
|
|
|
|
|
direction = g_getenv ("CLUTTER_TEXT_DIRECTION");
|
|
|
|
if (direction && *direction != '\0')
|
|
|
|
{
|
|
|
|
if (strcmp (direction, "rtl") == 0)
|
2009-11-06 16:50:53 +00:00
|
|
|
dir = CLUTTER_TEXT_DIRECTION_RTL;
|
2009-01-06 12:35:19 +00:00
|
|
|
else if (strcmp (direction, "ltr") == 0)
|
2009-11-06 16:50:53 +00:00
|
|
|
dir = CLUTTER_TEXT_DIRECTION_LTR;
|
2008-12-23 16:40:26 +00:00
|
|
|
}
|
|
|
|
else
|
2009-01-06 12:35:19 +00:00
|
|
|
{
|
2011-09-23 01:22:53 +00:00
|
|
|
/* Translators: Leave this UNTRANSLATED if your language is
|
|
|
|
* left-to-right. If your language is right-to-left
|
|
|
|
* (e.g. Hebrew, Arabic), translate it to "default:RTL".
|
2009-01-06 12:35:19 +00:00
|
|
|
*
|
2011-09-23 01:22:53 +00:00
|
|
|
* Do NOT translate it to non-English e.g. "predefinito:LTR"! If
|
|
|
|
* it isn't default:LTR or default:RTL it will not work.
|
2009-01-06 12:35:19 +00:00
|
|
|
*/
|
|
|
|
char *e = _("default:LTR");
|
|
|
|
|
|
|
|
if (strcmp (e, "default:RTL") == 0)
|
2009-11-06 16:50:53 +00:00
|
|
|
dir = CLUTTER_TEXT_DIRECTION_RTL;
|
2009-01-06 12:35:19 +00:00
|
|
|
else if (strcmp (e, "default:LTR") == 0)
|
2009-11-06 16:50:53 +00:00
|
|
|
dir = CLUTTER_TEXT_DIRECTION_LTR;
|
2009-01-06 12:35:19 +00:00
|
|
|
else
|
|
|
|
g_warning ("Whoever translated default:LTR did so wrongly.");
|
|
|
|
}
|
2008-12-23 16:40:26 +00:00
|
|
|
|
2012-09-19 10:39:41 +00:00
|
|
|
CLUTTER_NOTE (MISC, "Text direction: %s",
|
|
|
|
dir == CLUTTER_TEXT_DIRECTION_RTL ? "rtl" : "ltr");
|
|
|
|
|
2008-12-23 16:40:26 +00:00
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
/**
|
|
|
|
* clutter_main_quit:
|
|
|
|
*
|
2006-06-22 09:12:40 +00:00
|
|
|
* Terminates the Clutter mainloop.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
2006-05-29 08:59:36 +00:00
|
|
|
void
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
clutter_main_quit (void)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2015-01-01 15:07:19 +00:00
|
|
|
if (main_loops == NULL)
|
|
|
|
{
|
|
|
|
g_critical ("Calling clutter_main_quit() without calling clutter_main() "
|
|
|
|
"is not allowed. If you are using another main loop, use the "
|
|
|
|
"appropriate API to terminate it.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CLUTTER_NOTE (MISC, "Terminating main loop level %d", clutter_main_loop_level);
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
g_main_loop_quit (main_loops->data);
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
/**
|
|
|
|
* clutter_main_level:
|
|
|
|
*
|
2006-06-22 09:12:40 +00:00
|
|
|
* Retrieves the depth of the Clutter mainloop.
|
|
|
|
*
|
|
|
|
* Return value: The level of the mainloop.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
|
|
|
gint
|
|
|
|
clutter_main_level (void)
|
|
|
|
{
|
2007-08-08 10:20:14 +00:00
|
|
|
return clutter_main_loop_level;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_main:
|
|
|
|
*
|
2006-06-22 09:12:40 +00:00
|
|
|
* Starts the Clutter mainloop.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
2006-05-29 08:59:36 +00:00
|
|
|
void
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
clutter_main (void)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
GMainLoop *loop;
|
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
if (!_clutter_context_is_initialized ())
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
{
|
2011-02-18 15:47:35 +00:00
|
|
|
g_warning ("Called clutter_main() but Clutter wasn't initialised. "
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
"You must call clutter_init() first.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-01 15:09:23 +00:00
|
|
|
clutter_main_loop_level++;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (MISC, "Entering main loop level %d", clutter_main_loop_level);
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
loop = g_main_loop_new (NULL, TRUE);
|
2007-08-08 10:20:14 +00:00
|
|
|
main_loops = g_slist_prepend (main_loops, loop);
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
if (g_main_loop_is_running (main_loops->data))
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
{
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_release_lock ();
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
g_main_loop_run (loop);
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_acquire_lock ();
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
main_loops = g_slist_remove (main_loops, loop);
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
|
|
|
g_main_loop_unref (loop);
|
|
|
|
|
2015-01-01 15:09:23 +00:00
|
|
|
CLUTTER_NOTE (MISC, "Leaving main loop level %d", clutter_main_loop_level);
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
clutter_main_loop_level--;
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
/**
|
|
|
|
* clutter_threads_init:
|
|
|
|
*
|
|
|
|
* Initialises the Clutter threading mechanism, so that Clutter API can be
|
|
|
|
* called by multiple threads, using clutter_threads_enter() and
|
|
|
|
* clutter_threads_leave() to mark the critical sections.
|
|
|
|
*
|
|
|
|
* You must call g_thread_init() before this function.
|
|
|
|
*
|
|
|
|
* This function must be called before clutter_init().
|
|
|
|
*
|
2009-12-11 20:17:58 +00:00
|
|
|
* It is safe to call this function multiple times.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2011-10-07 14:53:50 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: This function does not do anything. Threading support
|
|
|
|
* is initialized when Clutter is initialized.
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_init (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-09-06 15:11:46 +00:00
|
|
|
* clutter_threads_set_lock_functions: (skip)
|
2007-08-08 10:20:14 +00:00
|
|
|
* @enter_fn: function called when aquiring the Clutter main lock
|
|
|
|
* @leave_fn: function called when releasing the Clutter main lock
|
|
|
|
*
|
|
|
|
* Allows the application to replace the standard method that
|
|
|
|
* Clutter uses to protect its data structures. Normally, Clutter
|
|
|
|
* creates a single #GMutex that is locked by clutter_threads_enter(),
|
|
|
|
* and released by clutter_threads_leave(); using this function an
|
|
|
|
* application provides, instead, a function @enter_fn that is
|
|
|
|
* called by clutter_threads_enter() and a function @leave_fn that is
|
|
|
|
* called by clutter_threads_leave().
|
|
|
|
*
|
|
|
|
* The functions must provide at least same locking functionality
|
|
|
|
* as the default implementation, but can also do extra application
|
|
|
|
* specific processing.
|
|
|
|
*
|
|
|
|
* As an example, consider an application that has its own recursive
|
|
|
|
* lock that when held, holds the Clutter lock as well. When Clutter
|
|
|
|
* unlocks the Clutter lock when entering a recursive main loop, the
|
|
|
|
* application must temporarily release its lock as well.
|
|
|
|
*
|
|
|
|
* Most threaded Clutter apps won't need to use this method.
|
|
|
|
*
|
2011-10-10 14:42:36 +00:00
|
|
|
* This method must be called before clutter_init(), and cannot
|
2007-08-08 10:20:14 +00:00
|
|
|
* be called multiple times.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_set_lock_functions (GCallback enter_fn,
|
|
|
|
GCallback leave_fn)
|
|
|
|
{
|
|
|
|
g_return_if_fail (clutter_threads_lock == NULL &&
|
|
|
|
clutter_threads_unlock == NULL);
|
|
|
|
|
|
|
|
clutter_threads_lock = enter_fn;
|
|
|
|
clutter_threads_unlock = leave_fn;
|
|
|
|
}
|
|
|
|
|
2010-11-06 20:00:39 +00:00
|
|
|
gboolean
|
|
|
|
_clutter_threads_dispatch (gpointer data)
|
2007-08-08 10:20:14 +00:00
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch = data;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_acquire_lock ();
|
2007-08-08 10:20:14 +00:00
|
|
|
|
|
|
|
if (!g_source_is_destroyed (g_main_current_source ()))
|
|
|
|
ret = dispatch->func (dispatch->data);
|
|
|
|
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_release_lock ();
|
2007-08-08 10:20:14 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-11-06 20:00:39 +00:00
|
|
|
void
|
|
|
|
_clutter_threads_dispatch_free (gpointer data)
|
2007-08-08 10:20:14 +00:00
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch = data;
|
|
|
|
|
2007-08-22 10:12:15 +00:00
|
|
|
/* XXX - we cannot hold the thread lock here because the main loop
|
|
|
|
* might destroy a source while still in the dispatcher function; so
|
|
|
|
* knowing whether the lock is being held or not is not known a priori.
|
|
|
|
*
|
|
|
|
* see bug: http://bugzilla.gnome.org/show_bug.cgi?id=459555
|
|
|
|
*/
|
2007-08-08 10:20:14 +00:00
|
|
|
if (dispatch->notify)
|
|
|
|
dispatch->notify (dispatch->data);
|
|
|
|
|
|
|
|
g_slice_free (ClutterThreadsDispatch, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-12-03 13:43:36 +00:00
|
|
|
* clutter_threads_add_idle_full: (rename-to clutter_threads_add_idle)
|
2007-08-08 10:20:14 +00:00
|
|
|
* @priority: the priority of the timeout source. Typically this will be in the
|
|
|
|
* range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE
|
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
* @notify: functio to call when the idle source is removed
|
|
|
|
*
|
|
|
|
* Adds a function to be called whenever there are no higher priority
|
2008-08-04 10:36:37 +00:00
|
|
|
* events pending. If the function returns %FALSE it is automatically
|
2007-08-08 10:20:14 +00:00
|
|
|
* removed from the list of event sources and will not be called again.
|
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* This function can be considered a thread-safe variant of g_idle_add_full():
|
|
|
|
* it will call @function while holding the Clutter lock. It is logically
|
|
|
|
* equivalent to the following implementation:
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* |[
|
2007-08-08 10:20:14 +00:00
|
|
|
* static gboolean
|
2008-08-04 10:36:37 +00:00
|
|
|
* idle_safe_callback (gpointer data)
|
2007-08-08 10:20:14 +00:00
|
|
|
* {
|
2008-08-04 10:36:37 +00:00
|
|
|
* SafeClosure *closure = data;
|
|
|
|
* gboolean res = FALSE;
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* // mark the critical section //
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* clutter_threads_enter();
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* // the callback does not need to acquire the Clutter
|
|
|
|
* / lock itself, as it is held by the this proxy handler
|
|
|
|
* //
|
2008-08-04 10:36:37 +00:00
|
|
|
* res = closure->callback (closure->data);
|
|
|
|
*
|
|
|
|
* clutter_threads_leave();
|
|
|
|
*
|
|
|
|
* return res;
|
2007-08-08 10:20:14 +00:00
|
|
|
* }
|
2008-08-04 10:36:37 +00:00
|
|
|
* static gulong
|
|
|
|
* add_safe_idle (GSourceFunc callback,
|
|
|
|
* gpointer data)
|
2007-08-08 10:20:14 +00:00
|
|
|
* {
|
2008-08-04 10:36:37 +00:00
|
|
|
* SafeClosure *closure = g_new0 (SafeClosure, 1);
|
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* closure->callback = callback;
|
|
|
|
* closure->data = data;
|
2008-08-04 10:36:37 +00:00
|
|
|
*
|
2011-10-10 14:42:36 +00:00
|
|
|
* return g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
2008-08-04 10:36:37 +00:00
|
|
|
* idle_safe_callback,
|
|
|
|
* closure,
|
|
|
|
* g_free)
|
2007-08-08 10:20:14 +00:00
|
|
|
* }
|
2008-08-04 10:36:37 +00:00
|
|
|
*]|
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* This function should be used by threaded applications to make sure
|
|
|
|
* that @func is emitted under the Clutter threads lock and invoked
|
|
|
|
* from the same thread that started the Clutter main loop. For instance,
|
|
|
|
* it can be used to update the UI using the results from a worker
|
|
|
|
* thread:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* static gboolean
|
|
|
|
* update_ui (gpointer data)
|
2007-08-08 10:20:14 +00:00
|
|
|
* {
|
2008-08-04 10:36:37 +00:00
|
|
|
* SomeClosure *closure = data;
|
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* // it is safe to call Clutter API from this function because
|
|
|
|
* / it is invoked from the same thread that started the main
|
|
|
|
* / loop and under the Clutter thread lock
|
|
|
|
* //
|
|
|
|
* clutter_label_set_text (CLUTTER_LABEL (closure->label),
|
|
|
|
* closure->text);
|
2008-08-04 10:36:37 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* g_object_unref (closure->label);
|
2008-08-04 10:36:37 +00:00
|
|
|
* g_free (closure);
|
|
|
|
*
|
|
|
|
* return FALSE;
|
2007-08-08 10:20:14 +00:00
|
|
|
* }
|
2008-08-04 10:36:37 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* // within another thread //
|
2008-08-04 10:36:37 +00:00
|
|
|
* closure = g_new0 (SomeClosure, 1);
|
2014-03-17 23:07:58 +00:00
|
|
|
* // always take a reference on GObject instances //
|
|
|
|
* closure->label = g_object_ref (my_application->label);
|
|
|
|
* closure->text = g_strdup (processed_text_to_update_the_label);
|
2008-08-04 10:36:37 +00:00
|
|
|
*
|
|
|
|
* clutter_threads_add_idle_full (G_PRIORITY_HIGH_IDLE,
|
|
|
|
* update_ui,
|
|
|
|
* closure,
|
|
|
|
* NULL);
|
|
|
|
* ]|
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_idle_full (gint priority,
|
|
|
|
GSourceFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify)
|
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch;
|
|
|
|
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
dispatch = g_slice_new (ClutterThreadsDispatch);
|
|
|
|
dispatch->func = func;
|
|
|
|
dispatch->data = data;
|
|
|
|
dispatch->notify = notify;
|
|
|
|
|
|
|
|
return g_idle_add_full (priority,
|
2010-11-06 20:00:39 +00:00
|
|
|
_clutter_threads_dispatch, dispatch,
|
|
|
|
_clutter_threads_dispatch_free);
|
2007-08-08 10:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-09-08 15:41:47 +00:00
|
|
|
* clutter_threads_add_idle: (skip)
|
2007-08-08 10:20:14 +00:00
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* Simple wrapper around clutter_threads_add_idle_full() using the
|
|
|
|
* default priority.
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_idle (GSourceFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
return clutter_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
|
|
|
|
func, data,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-12-03 13:43:36 +00:00
|
|
|
* clutter_threads_add_timeout_full: (rename-to clutter_threads_add_timeout)
|
2007-08-08 10:20:14 +00:00
|
|
|
* @priority: the priority of the timeout source. Typically this will be in the
|
|
|
|
* range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
|
|
|
|
* @interval: the time between calls to the function, in milliseconds
|
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
* @notify: function to call when the timeout source is removed
|
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* Sets a function to be called at regular intervals holding the Clutter
|
|
|
|
* threads lock, with the given priority. The function is called repeatedly
|
|
|
|
* until it returns %FALSE, at which point the timeout is automatically
|
|
|
|
* removed and the function will not be called again. The @notify function
|
|
|
|
* is called when the timeout is removed.
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* The first call to the function will be at the end of the first @interval.
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
2008-08-04 10:36:37 +00:00
|
|
|
* It is important to note that, due to how the Clutter main loop is
|
|
|
|
* implemented, the timing will not be accurate and it will not try to
|
2011-10-10 14:42:36 +00:00
|
|
|
* "keep up" with the interval.
|
2008-08-04 10:36:37 +00:00
|
|
|
*
|
|
|
|
* See also clutter_threads_add_idle_full().
|
2007-08-08 10:20:14 +00:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_timeout_full (gint priority,
|
|
|
|
guint interval,
|
|
|
|
GSourceFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify)
|
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch;
|
|
|
|
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
dispatch = g_slice_new (ClutterThreadsDispatch);
|
|
|
|
dispatch->func = func;
|
|
|
|
dispatch->data = data;
|
|
|
|
dispatch->notify = notify;
|
|
|
|
|
|
|
|
return g_timeout_add_full (priority,
|
|
|
|
interval,
|
2010-11-06 20:00:39 +00:00
|
|
|
_clutter_threads_dispatch, dispatch,
|
|
|
|
_clutter_threads_dispatch_free);
|
2007-08-08 10:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-09-08 15:41:47 +00:00
|
|
|
* clutter_threads_add_timeout: (skip)
|
2007-08-08 10:20:14 +00:00
|
|
|
* @interval: the time between calls to the function, in milliseconds
|
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
*
|
|
|
|
* Simple wrapper around clutter_threads_add_timeout_full().
|
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_timeout (guint interval,
|
|
|
|
GSourceFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
return clutter_threads_add_timeout_full (G_PRIORITY_DEFAULT,
|
|
|
|
interval,
|
|
|
|
func, data,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2012-07-05 13:30:26 +00:00
|
|
|
void
|
|
|
|
_clutter_threads_acquire_lock (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_lock != NULL)
|
|
|
|
(* clutter_threads_lock) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_threads_release_lock (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_unlock != NULL)
|
|
|
|
(* clutter_threads_unlock) ();
|
|
|
|
}
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
/**
|
|
|
|
* clutter_threads_enter:
|
|
|
|
*
|
|
|
|
* Locks the Clutter thread lock.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2012-07-05 13:30:26 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12: This function should not be used by application
|
|
|
|
* code; marking critical sections is not portable on various
|
|
|
|
* platforms. Instead of acquiring the Clutter lock, schedule UI
|
|
|
|
* updates from the main loop using clutter_threads_add_idle() or
|
|
|
|
* clutter_threads_add_timeout().
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_enter (void)
|
|
|
|
{
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_acquire_lock ();
|
2007-08-08 10:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_leave:
|
|
|
|
*
|
|
|
|
* Unlocks the Clutter thread lock.
|
|
|
|
*
|
2007-08-18 12:39:30 +00:00
|
|
|
* Since: 0.4
|
2012-07-05 13:30:26 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12: This function should not be used by application
|
|
|
|
* code; marking critical sections is not portable on various
|
|
|
|
* platforms. Instead of acquiring the Clutter lock, schedule UI
|
|
|
|
* updates from the main loop using clutter_threads_add_idle() or
|
|
|
|
* clutter_threads_add_timeout().
|
2007-08-08 10:20:14 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_leave (void)
|
|
|
|
{
|
2012-07-05 13:30:26 +00:00
|
|
|
_clutter_threads_release_lock ();
|
2007-08-08 10:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
/**
|
2007-03-22 18:21:59 +00:00
|
|
|
* clutter_get_debug_enabled:
|
2008-02-20 14:16:54 +00:00
|
|
|
*
|
2011-11-15 17:58:25 +00:00
|
|
|
* Check if Clutter has debugging enabled.
|
|
|
|
*
|
|
|
|
* Return value: %FALSE
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*
|
2011-11-15 17:58:25 +00:00
|
|
|
* Deprecated: 1.10: This function does not do anything.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
2006-05-29 08:59:36 +00:00
|
|
|
gboolean
|
2007-03-22 18:21:59 +00:00
|
|
|
clutter_get_debug_enabled (void)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2007-03-22 18:21:59 +00:00
|
|
|
return FALSE;
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
void
|
|
|
|
_clutter_context_lock (void)
|
|
|
|
{
|
|
|
|
G_LOCK (ClutterCntx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_context_unlock (void)
|
|
|
|
{
|
|
|
|
G_UNLOCK (ClutterCntx);
|
|
|
|
}
|
|
|
|
|
2009-06-19 13:09:42 +00:00
|
|
|
gboolean
|
|
|
|
_clutter_context_is_initialized (void)
|
|
|
|
{
|
|
|
|
if (ClutterCntx == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return ClutterCntx->is_initialized;
|
|
|
|
}
|
|
|
|
|
2011-10-17 12:25:15 +00:00
|
|
|
static ClutterMainContext *
|
|
|
|
clutter_context_get_default_unlocked (void)
|
|
|
|
{
|
|
|
|
if (G_UNLIKELY (ClutterCntx == NULL))
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
|
|
|
|
2015-12-11 15:39:54 +00:00
|
|
|
/* Read the configuration file, if any, before we set up the
|
|
|
|
* whole thing, so that we can override things like the backend
|
|
|
|
* and the driver
|
|
|
|
*/
|
|
|
|
clutter_config_read ();
|
|
|
|
|
2011-10-17 12:25:15 +00:00
|
|
|
ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
|
2007-03-22 18:21:59 +00:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
ctx->is_initialized = FALSE;
|
2011-10-17 12:25:15 +00:00
|
|
|
|
|
|
|
/* create the windowing system backend */
|
2013-09-10 16:29:28 +00:00
|
|
|
ctx->backend = _clutter_create_backend ();
|
2007-11-19 16:30:56 +00:00
|
|
|
|
2011-10-11 13:42:31 +00:00
|
|
|
/* create the default settings object, and store a back pointer to
|
|
|
|
* the backend singleton
|
|
|
|
*/
|
|
|
|
ctx->settings = clutter_settings_get_default ();
|
|
|
|
_clutter_settings_set_backend (ctx->settings, ctx->backend);
|
|
|
|
|
2011-10-17 12:25:15 +00:00
|
|
|
ctx->motion_events_per_actor = TRUE;
|
2011-09-01 16:12:46 +00:00
|
|
|
ctx->last_repaint_id = 1;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ClutterCntx;
|
|
|
|
}
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
ClutterMainContext *
|
|
|
|
_clutter_context_get_default (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *retval;
|
|
|
|
|
|
|
|
_clutter_context_lock ();
|
|
|
|
|
|
|
|
retval = clutter_context_get_default_unlocked ();
|
|
|
|
|
|
|
|
_clutter_context_unlock ();
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2007-06-07 23:51:53 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_timestamp:
|
|
|
|
*
|
2011-11-15 17:47:00 +00:00
|
|
|
* Returns the approximate number of microseconds passed since Clutter was
|
2007-06-07 23:51:53 +00:00
|
|
|
* intialised.
|
|
|
|
*
|
2011-11-15 17:47:00 +00:00
|
|
|
* This function shdould not be used by application code.
|
|
|
|
*
|
|
|
|
* The output of this function depends on whether Clutter was configured to
|
|
|
|
* enable its debugging code paths, so it's less useful than intended.
|
|
|
|
*
|
|
|
|
* Since Clutter 1.10, this function is an alias to g_get_monotonic_time()
|
|
|
|
* if Clutter was configured to enable the debugging code paths.
|
|
|
|
*
|
|
|
|
* Return value: Number of microseconds since clutter_init() was called, or
|
|
|
|
* zero if Clutter was not configured with debugging code paths.
|
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #GTimer or g_get_monotonic_time() for a proper
|
|
|
|
* timing source
|
2007-06-07 23:51:53 +00:00
|
|
|
*/
|
|
|
|
gulong
|
|
|
|
clutter_get_timestamp (void)
|
|
|
|
{
|
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
2011-11-15 15:34:51 +00:00
|
|
|
return (gulong) g_get_monotonic_time ();
|
2007-06-07 23:51:53 +00:00
|
|
|
#else
|
2011-11-15 15:34:51 +00:00
|
|
|
return 0L;
|
2007-06-07 23:51:53 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-12-23 16:40:26 +00:00
|
|
|
static gboolean
|
|
|
|
clutter_arg_direction_cb (const char *key,
|
|
|
|
const char *value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
clutter_text_direction =
|
2009-11-06 16:50:53 +00:00
|
|
|
(strcmp (value, "rtl") == 0) ? CLUTTER_TEXT_DIRECTION_RTL
|
|
|
|
: CLUTTER_TEXT_DIRECTION_LTR;
|
2008-12-23 16:40:26 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-06-07 23:51:53 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
static gboolean
|
|
|
|
clutter_arg_debug_cb (const char *key,
|
|
|
|
const char *value,
|
|
|
|
gpointer user_data)
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
{
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
clutter_debug_flags |=
|
|
|
|
g_parse_debug_string (value,
|
|
|
|
clutter_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_debug_keys));
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
static gboolean
|
|
|
|
clutter_arg_no_debug_cb (const char *key,
|
|
|
|
const char *value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
clutter_debug_flags &=
|
|
|
|
~g_parse_debug_string (value,
|
|
|
|
clutter_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_debug_keys));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
|
|
|
2008-09-19 13:22:12 +00:00
|
|
|
GQuark
|
|
|
|
clutter_init_error_quark (void)
|
|
|
|
{
|
|
|
|
return g_quark_from_static_string ("clutter-init-error-quark");
|
|
|
|
}
|
|
|
|
|
|
|
|
static ClutterInitError
|
|
|
|
clutter_init_real (GError **error)
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
2008-09-23 07:03:35 +00:00
|
|
|
ClutterBackend *backend;
|
2008-09-19 13:22:12 +00:00
|
|
|
|
|
|
|
/* Note, creates backend if not already existing, though parse args will
|
|
|
|
* have likely created it
|
|
|
|
*/
|
2009-06-17 16:59:54 +00:00
|
|
|
ctx = _clutter_context_get_default ();
|
2008-09-23 07:03:35 +00:00
|
|
|
backend = ctx->backend;
|
|
|
|
|
|
|
|
if (!ctx->options_parsed)
|
|
|
|
{
|
2009-12-03 20:49:54 +00:00
|
|
|
if (error)
|
|
|
|
g_set_error (error, CLUTTER_INIT_ERROR,
|
|
|
|
CLUTTER_INIT_ERROR_INTERNAL,
|
|
|
|
"When using clutter_get_option_group_without_init() "
|
|
|
|
"you must parse options before calling clutter_init()");
|
|
|
|
else
|
|
|
|
g_critical ("When using clutter_get_option_group_without_init() "
|
|
|
|
"you must parse options before calling clutter_init()");
|
2008-09-23 07:03:35 +00:00
|
|
|
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call backend post parse hooks.
|
|
|
|
*/
|
2008-10-31 12:48:26 +00:00
|
|
|
if (!_clutter_backend_post_parse (backend, error))
|
|
|
|
return CLUTTER_INIT_ERROR_BACKEND;
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2010-09-07 22:07:52 +00:00
|
|
|
/* If we are displaying the regions that would get redrawn with clipped
|
|
|
|
* redraws enabled we actually have to disable the clipped redrawing
|
|
|
|
* because otherwise we end up with nasty trails of rectangles everywhere.
|
|
|
|
*/
|
|
|
|
if (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)
|
|
|
|
clutter_paint_debug_flags |= CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS;
|
|
|
|
|
2010-09-07 17:50:29 +00:00
|
|
|
/* The same is true when drawing the outlines of paint volumes... */
|
|
|
|
if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES)
|
2011-06-16 16:24:26 +00:00
|
|
|
{
|
|
|
|
clutter_paint_debug_flags |=
|
|
|
|
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS | CLUTTER_DEBUG_DISABLE_CULLING;
|
|
|
|
}
|
2010-09-07 17:50:29 +00:00
|
|
|
|
2009-12-03 20:49:54 +00:00
|
|
|
/* this will take care of initializing Cogl's state and
|
|
|
|
* query the GL machinery for features
|
2009-12-03 17:13:44 +00:00
|
|
|
*/
|
2010-03-17 17:28:20 +00:00
|
|
|
if (!_clutter_feature_init (error))
|
|
|
|
return CLUTTER_INIT_ERROR_BACKEND;
|
2008-09-19 13:22:12 +00:00
|
|
|
|
Fully integrates CoglMaterial throughout the rest of Cogl
This glues CoglMaterial in as the fundamental way that Cogl describes how to
fill in geometry.
It adds cogl_set_source (), which is used to set the material which will be
used by all subsequent drawing functions
It adds cogl_set_source_texture as a convenience for setting up a default
material with a single texture layer, and cogl_set_source_color is now also
a convenience for setting up a material with a solid fill.
"drawing functions" include, cogl_rectangle, cogl_texture_rectangle,
cogl_texture_multiple_rectangles, cogl_texture_polygon (though the
cogl_texture_* funcs have been renamed; see below for details),
cogl_path_fill/stroke and cogl_vertex_buffer_draw*.
cogl_texture_rectangle, cogl_texture_multiple_rectangles and
cogl_texture_polygon no longer take a texture handle; instead the current
source material is referenced. The functions have also been renamed to:
cogl_rectangle_with_texture_coords, cogl_rectangles_with_texture_coords
and cogl_polygon respectivly.
Most code that previously did:
cogl_texture_rectangle (tex_handle, x, y,...);
needs to be changed to now do:
cogl_set_source_texture (tex_handle);
cogl_rectangle_with_texture_coords (x, y,....);
In the less likely case where you were blending your source texture with a color
like:
cogl_set_source_color4ub (r,g,b,a); /* where r,g,b,a isn't just white */
cogl_texture_rectangle (tex_handle, x, y,...);
you will need your own material to do that:
mat = cogl_material_new ();
cogl_material_set_color4ub (r,g,b,a);
cogl_material_set_layer (mat, 0, tex_handle));
cogl_set_source_material (mat);
Code that uses the texture coordinates, 0, 0, 1, 1 don't need to use
cog_rectangle_with_texure_coords since these are the coordinates that
cogl_rectangle will use.
For cogl_texture_polygon; as well as dropping the texture handle, the
n_vertices and vertices arguments were transposed for consistency. So
code previously written as:
cogl_texture_polygon (tex_handle, 3, verts, TRUE);
need to be written as:
cogl_set_source_texture (tex_handle);
cogl_polygon (verts, 3, TRUE);
All of the unit tests have been updated to now use the material API and
test-cogl-material has been renamed to test-cogl-multitexture since any
textured quad is now technically a test of CoglMaterial but this test
specifically creates a material with multiple texture layers.
Note: The GLES backend has not been updated yet; that will be done in a
following commit.
2009-01-23 16:15:40 +00:00
|
|
|
clutter_text_direction = clutter_get_text_direction ();
|
|
|
|
|
2008-09-19 13:22:12 +00:00
|
|
|
/* Initiate event collection */
|
|
|
|
_clutter_backend_init_events (ctx->backend);
|
|
|
|
|
|
|
|
clutter_is_initialized = TRUE;
|
2008-09-23 07:03:35 +00:00
|
|
|
ctx->is_initialized = TRUE;
|
2008-09-19 13:22:12 +00:00
|
|
|
|
2010-04-26 17:33:49 +00:00
|
|
|
/* Initialize a11y */
|
|
|
|
if (clutter_enable_accessibility)
|
|
|
|
cally_accessibility_init ();
|
|
|
|
|
2008-09-19 13:22:12 +00:00
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
static GOptionEntry clutter_args[] = {
|
|
|
|
{ "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps,
|
2009-01-06 12:11:07 +00:00
|
|
|
N_("Show frames per second"), NULL },
|
2007-10-26 15:47:39 +00:00
|
|
|
{ "clutter-default-fps", 0, 0, G_OPTION_ARG_INT, &clutter_default_fps,
|
2009-01-06 12:11:07 +00:00
|
|
|
N_("Default frame rate"), "FPS" },
|
2006-11-21 22:35:48 +00:00
|
|
|
{ "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings,
|
2009-01-06 12:11:07 +00:00
|
|
|
N_("Make all warnings fatal"), NULL },
|
2008-12-23 16:40:26 +00:00
|
|
|
{ "clutter-text-direction", 0, 0, G_OPTION_ARG_CALLBACK,
|
|
|
|
clutter_arg_direction_cb,
|
2009-01-07 12:06:33 +00:00
|
|
|
N_("Direction for the text"), "DIRECTION" },
|
2009-02-23 13:08:59 +00:00
|
|
|
{ "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
|
|
|
|
&clutter_disable_mipmap_text,
|
|
|
|
N_("Disable mipmapping on text"), NULL },
|
2009-02-23 13:17:06 +00:00
|
|
|
{ "clutter-use-fuzzy-picking", 0, 0, G_OPTION_ARG_NONE,
|
|
|
|
&clutter_use_fuzzy_picking,
|
|
|
|
N_("Use 'fuzzy' picking"), NULL },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
{ "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
|
2009-01-06 12:11:07 +00:00
|
|
|
N_("Clutter debugging flags to set"), "FLAGS" },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
{ "clutter-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_debug_cb,
|
2009-01-06 12:11:07 +00:00
|
|
|
N_("Clutter debugging flags to unset"), "FLAGS" },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
2010-04-26 17:33:49 +00:00
|
|
|
{ "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
|
|
|
|
N_("Enable accessibility"), NULL },
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
{ NULL, },
|
|
|
|
};
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
/* pre_parse_hook: initialise variables depending on environment
|
|
|
|
* variables; these variables might be overridden by the command
|
|
|
|
* line arguments that are going to be parsed after.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
pre_parse_hook (GOptionContext *context,
|
|
|
|
GOptionGroup *group,
|
|
|
|
gpointer data,
|
|
|
|
GError **error)
|
|
|
|
{
|
2007-03-22 18:21:59 +00:00
|
|
|
ClutterMainContext *clutter_context;
|
|
|
|
ClutterBackend *backend;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
const char *env_string;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return TRUE;
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2008-06-10 14:01:43 +00:00
|
|
|
if (setlocale (LC_ALL, "") == NULL)
|
|
|
|
g_warning ("Locale not supported by C library.\n"
|
|
|
|
"Using the fallback 'C' locale.");
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
clutter_context = _clutter_context_get_default ();
|
2007-03-22 18:21:59 +00:00
|
|
|
|
|
|
|
backend = clutter_context->backend;
|
|
|
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
env_string = g_getenv ("CLUTTER_DEBUG");
|
|
|
|
if (env_string != NULL)
|
|
|
|
{
|
|
|
|
clutter_debug_flags =
|
|
|
|
g_parse_debug_string (env_string,
|
|
|
|
clutter_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_debug_keys));
|
|
|
|
env_string = NULL;
|
|
|
|
}
|
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2010-02-16 20:08:35 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_PICK");
|
|
|
|
if (env_string != NULL)
|
|
|
|
{
|
|
|
|
clutter_pick_debug_flags =
|
|
|
|
g_parse_debug_string (env_string,
|
|
|
|
clutter_pick_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_pick_debug_keys));
|
|
|
|
env_string = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
env_string = g_getenv ("CLUTTER_PAINT");
|
|
|
|
if (env_string != NULL)
|
|
|
|
{
|
|
|
|
clutter_paint_debug_flags =
|
|
|
|
g_parse_debug_string (env_string,
|
|
|
|
clutter_paint_debug_keys,
|
|
|
|
G_N_ELEMENTS (clutter_paint_debug_keys));
|
|
|
|
env_string = NULL;
|
|
|
|
}
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_SHOW_FPS");
|
|
|
|
if (env_string)
|
|
|
|
clutter_show_fps = TRUE;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
2007-10-26 15:47:39 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_DEFAULT_FPS");
|
|
|
|
if (env_string)
|
|
|
|
{
|
|
|
|
gint default_fps = g_ascii_strtoll (env_string, NULL, 10);
|
|
|
|
|
|
|
|
clutter_default_fps = CLAMP (default_fps, 1, 1000);
|
|
|
|
}
|
|
|
|
|
2009-02-23 13:08:59 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_DISABLE_MIPMAPPED_TEXT");
|
|
|
|
if (env_string)
|
|
|
|
clutter_disable_mipmap_text = TRUE;
|
|
|
|
|
2009-02-23 13:17:06 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_FUZZY_PICK");
|
|
|
|
if (env_string)
|
|
|
|
clutter_use_fuzzy_picking = TRUE;
|
|
|
|
|
2011-11-04 16:35:38 +00:00
|
|
|
env_string = g_getenv ("CLUTTER_VBLANK");
|
|
|
|
if (g_strcmp0 (env_string, "none") == 0)
|
|
|
|
clutter_sync_to_vblank = FALSE;
|
|
|
|
|
2008-10-31 12:48:26 +00:00
|
|
|
return _clutter_backend_pre_parse (backend, error);
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* post_parse_hook: initialise the context and data structures
|
|
|
|
* and opens the X display
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
post_parse_hook (GOptionContext *context,
|
|
|
|
GOptionGroup *group,
|
|
|
|
gpointer data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
ClutterMainContext *clutter_context;
|
2007-03-22 18:21:59 +00:00
|
|
|
ClutterBackend *backend;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2006-11-21 22:35:48 +00:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return TRUE;
|
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
clutter_context = _clutter_context_get_default ();
|
2007-03-22 18:21:59 +00:00
|
|
|
backend = clutter_context->backend;
|
|
|
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
|
|
|
|
2006-11-21 22:35:48 +00:00
|
|
|
if (clutter_fatal_warnings)
|
|
|
|
{
|
|
|
|
GLogLevelFlags fatal_mask;
|
|
|
|
|
|
|
|
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
|
|
|
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
|
|
|
g_log_set_always_fatal (fatal_mask);
|
|
|
|
}
|
|
|
|
|
2007-10-26 15:47:39 +00:00
|
|
|
clutter_context->frame_rate = clutter_default_fps;
|
2011-11-15 17:58:25 +00:00
|
|
|
clutter_context->show_fps = clutter_show_fps;
|
2008-09-23 07:03:35 +00:00
|
|
|
clutter_context->options_parsed = TRUE;
|
2007-10-26 15:47:39 +00:00
|
|
|
|
2011-11-15 17:58:25 +00:00
|
|
|
/* If not asked to defer display setup, call clutter_init_real(),
|
2008-09-23 07:03:35 +00:00
|
|
|
* which in turn calls the backend post parse hooks.
|
|
|
|
*/
|
|
|
|
if (!clutter_context->defer_display_setup)
|
2011-03-04 23:56:12 +00:00
|
|
|
return clutter_init_real (error) == CLUTTER_INIT_SUCCESS;
|
2008-09-19 13:22:12 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
return TRUE;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-09-06 15:11:46 +00:00
|
|
|
* clutter_get_option_group: (skip)
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
*
|
|
|
|
* Returns a #GOptionGroup for the command line arguments recognized
|
|
|
|
* by Clutter. You should add this group to your #GOptionContext with
|
|
|
|
* g_option_context_add_group(), if you are using g_option_context_parse()
|
|
|
|
* to parse your commandline arguments.
|
|
|
|
*
|
2008-09-19 11:38:48 +00:00
|
|
|
* Calling g_option_context_parse() with Clutter's #GOptionGroup will result
|
|
|
|
* in Clutter's initialization. That is, the following code:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* g_option_context_set_main_group (context, clutter_get_option_group ());
|
2014-03-17 23:07:58 +00:00
|
|
|
* res = g_option_context_parse (context, &argc, &argc, NULL);
|
2008-09-19 11:38:48 +00:00
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* is functionally equivalent to:
|
|
|
|
*
|
|
|
|
* |[
|
2014-03-17 23:07:58 +00:00
|
|
|
* clutter_init (&argc, &argv);
|
2008-09-19 11:38:48 +00:00
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* After g_option_context_parse() on a #GOptionContext containing the
|
|
|
|
* Clutter #GOptionGroup has returned %TRUE, Clutter is guaranteed to be
|
|
|
|
* initialized.
|
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer full): a #GOptionGroup for the commandline arguments
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
* recognized by Clutter
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
GOptionGroup *
|
|
|
|
clutter_get_option_group (void)
|
|
|
|
{
|
2007-03-22 18:21:59 +00:00
|
|
|
ClutterMainContext *context;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
GOptionGroup *group;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
clutter_base_init ();
|
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2007-03-22 18:21:59 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
group = g_option_group_new ("clutter",
|
2009-01-06 12:11:07 +00:00
|
|
|
_("Clutter Options"),
|
|
|
|
_("Show Clutter Options"),
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
NULL,
|
|
|
|
NULL);
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook);
|
|
|
|
g_option_group_add_entries (group, clutter_args);
|
2009-01-06 12:11:07 +00:00
|
|
|
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2007-03-22 18:21:59 +00:00
|
|
|
/* add backend-specific options */
|
2007-03-23 17:55:13 +00:00
|
|
|
_clutter_backend_add_options (context->backend, group);
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
/**
|
2010-09-06 15:11:46 +00:00
|
|
|
* clutter_get_option_group_without_init: (skip)
|
2008-09-23 07:03:35 +00:00
|
|
|
*
|
|
|
|
* Returns a #GOptionGroup for the command line arguments recognized
|
|
|
|
* by Clutter. You should add this group to your #GOptionContext with
|
|
|
|
* g_option_context_add_group(), if you are using g_option_context_parse()
|
2011-03-04 23:55:02 +00:00
|
|
|
* to parse your commandline arguments.
|
|
|
|
*
|
|
|
|
* Unlike clutter_get_option_group(), calling g_option_context_parse() with
|
|
|
|
* the #GOptionGroup returned by this function requires a subsequent explicit
|
|
|
|
* call to clutter_init(); use this function when needing to set foreign
|
|
|
|
* display connection with clutter_x11_set_display(), or with
|
2014-03-17 23:07:58 +00:00
|
|
|
* `gtk_clutter_init()`.
|
2008-09-23 07:03:35 +00:00
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer full): a #GOptionGroup for the commandline arguments
|
2008-09-23 07:03:35 +00:00
|
|
|
* recognized by Clutter
|
|
|
|
*
|
2015-03-03 15:53:04 +00:00
|
|
|
* Since: 0.8
|
2008-09-23 07:03:35 +00:00
|
|
|
*/
|
|
|
|
GOptionGroup *
|
|
|
|
clutter_get_option_group_without_init (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
GOptionGroup *group;
|
|
|
|
|
|
|
|
clutter_base_init ();
|
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2008-09-23 07:03:35 +00:00
|
|
|
context->defer_display_setup = TRUE;
|
|
|
|
|
|
|
|
group = clutter_get_option_group ();
|
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
|
|
|
|
2009-02-17 00:25:20 +00:00
|
|
|
/* Note that the gobject-introspection annotations for the argc/argv
|
|
|
|
* parameters do not produce the right result; however, they do
|
|
|
|
* allow the common case of argc=NULL, argv=NULL to work.
|
|
|
|
*/
|
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
/**
|
|
|
|
* clutter_init_with_args:
|
2009-02-17 00:25:20 +00:00
|
|
|
* @argc: (inout): a pointer to the number of command line arguments
|
2009-07-02 12:15:42 +00:00
|
|
|
* @argv: (array length=argc) (inout) (allow-none): a pointer to the array
|
|
|
|
* of command line arguments
|
|
|
|
* @parameter_string: (allow-none): a string which is displayed in the
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
* first line of <option>--help</option> output, after
|
2006-12-05 05:16:52 +00:00
|
|
|
* <literal><replaceable>programname</replaceable> [OPTION...]</literal>
|
2012-06-12 22:41:39 +00:00
|
|
|
* @entries: (array) (allow-none): a %NULL terminated array of
|
|
|
|
* #GOptionEntry<!-- -->s describing the options of your program
|
2009-07-02 12:15:42 +00:00
|
|
|
* @translation_domain: (allow-none): a translation domain to use for
|
|
|
|
* translating the <option>--help</option> output for the options in
|
|
|
|
* @entries with gettext(), or %NULL
|
|
|
|
* @error: (allow-none): a return location for a #GError
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
*
|
|
|
|
* This function does the same work as clutter_init(). Additionally,
|
|
|
|
* it allows you to add your own command line options, and it
|
|
|
|
* automatically generates nicely formatted <option>--help</option>
|
|
|
|
* output. Note that your program will be terminated after writing
|
|
|
|
* out the help output. Also note that, in case of error, the
|
|
|
|
* error message will be placed inside @error instead of being
|
|
|
|
* printed on the display.
|
|
|
|
*
|
2011-10-21 20:19:27 +00:00
|
|
|
* Just like clutter_init(), if this function returns an error code then
|
|
|
|
* any subsequent call to any other Clutter API will result in undefined
|
|
|
|
* behaviour - including segmentation faults.
|
|
|
|
*
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
* Return value: %CLUTTER_INIT_SUCCESS if Clutter has been successfully
|
|
|
|
* initialised, or other values or #ClutterInitError in case of
|
|
|
|
* error.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
ClutterInitError
|
|
|
|
clutter_init_with_args (int *argc,
|
|
|
|
char ***argv,
|
2008-10-21 18:48:13 +00:00
|
|
|
const char *parameter_string,
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
GOptionEntry *entries,
|
2008-10-21 18:48:13 +00:00
|
|
|
const char *translation_domain,
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
GOptionContext *context;
|
|
|
|
GOptionGroup *group;
|
|
|
|
gboolean res;
|
2008-09-23 07:03:35 +00:00
|
|
|
ClutterMainContext *ctx;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
|
|
|
if (clutter_is_initialized)
|
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
clutter_base_init ();
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
ctx = _clutter_context_get_default ();
|
2007-06-19 14:10:25 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
if (!ctx->defer_display_setup)
|
|
|
|
{
|
2010-01-03 20:12:49 +00:00
|
|
|
#if 0
|
2008-09-23 07:03:35 +00:00
|
|
|
if (argc && *argc > 0 && *argv)
|
|
|
|
g_set_prgname ((*argv)[0]);
|
2010-01-03 20:12:49 +00:00
|
|
|
#endif
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
context = g_option_context_new (parameter_string);
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2009-02-23 12:47:02 +00:00
|
|
|
group = clutter_get_option_group ();
|
|
|
|
g_option_context_add_group (context, group);
|
|
|
|
|
|
|
|
group = cogl_get_option_group ();
|
2008-09-23 07:03:35 +00:00
|
|
|
g_option_context_add_group (context, group);
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
if (entries)
|
|
|
|
g_option_context_add_main_entries (context, entries, translation_domain);
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
res = g_option_context_parse (context, argc, argv, error);
|
|
|
|
g_option_context_free (context);
|
|
|
|
|
|
|
|
/* if res is FALSE, the error is filled for
|
|
|
|
* us by g_option_context_parse()
|
2008-09-19 13:22:12 +00:00
|
|
|
*/
|
2008-09-23 07:03:35 +00:00
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
/* if there has been an error in the initialization, the
|
|
|
|
* error id will be preserved inside the GError code
|
|
|
|
*/
|
|
|
|
if (error && *error)
|
|
|
|
return (*error)->code;
|
|
|
|
else
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return clutter_init_real (error);
|
2007-01-23 20:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-03-04 23:55:02 +00:00
|
|
|
clutter_parse_args (int *argc,
|
|
|
|
char ***argv,
|
|
|
|
GError **error)
|
2007-01-23 20:29:11 +00:00
|
|
|
{
|
|
|
|
GOptionContext *option_context;
|
2011-03-04 23:55:02 +00:00
|
|
|
GOptionGroup *clutter_group, *cogl_group;
|
|
|
|
GError *internal_error = NULL;
|
|
|
|
gboolean ret = TRUE;
|
2007-01-23 20:29:11 +00:00
|
|
|
|
|
|
|
if (clutter_is_initialized)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
option_context = g_option_context_new (NULL);
|
|
|
|
g_option_context_set_ignore_unknown_options (option_context, TRUE);
|
2008-02-20 14:16:54 +00:00
|
|
|
g_option_context_set_help_enabled (option_context, FALSE);
|
2007-01-23 20:29:11 +00:00
|
|
|
|
|
|
|
/* Initiate any command line options from the backend */
|
|
|
|
clutter_group = clutter_get_option_group ();
|
|
|
|
g_option_context_set_main_group (option_context, clutter_group);
|
|
|
|
|
2009-02-23 12:47:02 +00:00
|
|
|
cogl_group = cogl_get_option_group ();
|
|
|
|
g_option_context_add_group (option_context, cogl_group);
|
|
|
|
|
2011-03-04 23:55:02 +00:00
|
|
|
if (!g_option_context_parse (option_context, argc, argv, &internal_error))
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
{
|
2011-03-04 23:55:02 +00:00
|
|
|
g_propagate_error (error, internal_error);
|
2007-01-23 20:29:11 +00:00
|
|
|
ret = FALSE;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
}
|
2006-06-08 21:28:05 +00:00
|
|
|
|
2007-01-23 20:29:11 +00:00
|
|
|
g_option_context_free (option_context);
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2007-01-23 20:29:11 +00:00
|
|
|
return ret;
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
}
|
2006-11-15 21:19:01 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
/**
|
|
|
|
* clutter_init:
|
2009-02-17 00:25:20 +00:00
|
|
|
* @argc: (inout): The number of arguments in @argv
|
2009-07-02 12:15:42 +00:00
|
|
|
* @argv: (array length=argc) (inout) (allow-none): A pointer to an array
|
|
|
|
* of arguments.
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
*
|
2011-03-04 23:55:02 +00:00
|
|
|
* Initialises everything needed to operate with Clutter and parses some
|
|
|
|
* standard command line options; @argc and @argv are adjusted accordingly
|
|
|
|
* so your own code will never see those standard arguments.
|
|
|
|
*
|
|
|
|
* It is safe to call this function multiple times.
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* This function will not abort in case of errors during
|
2011-03-04 23:55:02 +00:00
|
|
|
* initialization; clutter_init() will print out the error message on
|
|
|
|
* stderr, and will return an error code. It is up to the application
|
|
|
|
* code to handle this case. If you need to display the error message
|
|
|
|
* yourself, you can use clutter_init_with_args(), which takes a #GError
|
2014-03-17 23:07:58 +00:00
|
|
|
* pointer.
|
2011-03-04 23:55:02 +00:00
|
|
|
*
|
2011-10-21 20:19:27 +00:00
|
|
|
* If this function fails, and returns an error code, any subsequent
|
|
|
|
* Clutter API will have undefined behaviour - including segmentation
|
|
|
|
* faults and assertion failures. Make sure to handle the returned
|
|
|
|
* #ClutterInitError enumeration value.
|
|
|
|
*
|
2011-03-04 23:55:02 +00:00
|
|
|
* Return value: a #ClutterInitError value
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
*/
|
|
|
|
ClutterInitError
|
|
|
|
clutter_init (int *argc,
|
|
|
|
char ***argv)
|
|
|
|
{
|
2008-09-23 07:03:35 +00:00
|
|
|
ClutterMainContext *ctx;
|
|
|
|
GError *error = NULL;
|
2011-03-04 23:55:02 +00:00
|
|
|
ClutterInitError res;
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
|
2007-08-08 10:20:14 +00:00
|
|
|
clutter_base_init ();
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
ctx = _clutter_context_get_default ();
|
2007-06-19 14:10:25 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
if (!ctx->defer_display_setup)
|
2007-04-28 00:37:11 +00:00
|
|
|
{
|
2010-01-03 20:12:49 +00:00
|
|
|
#if 0
|
2008-09-23 07:03:35 +00:00
|
|
|
if (argc && *argc > 0 && *argv)
|
|
|
|
g_set_prgname ((*argv)[0]);
|
2010-01-03 20:12:49 +00:00
|
|
|
#endif
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
|
2008-09-23 07:03:35 +00:00
|
|
|
/* parse_args will trigger backend creation and things like
|
|
|
|
* DISPLAY connection etc.
|
|
|
|
*/
|
2011-03-04 23:55:02 +00:00
|
|
|
if (!clutter_parse_args (argc, argv, &error))
|
2008-09-23 07:03:35 +00:00
|
|
|
{
|
2011-03-04 23:55:02 +00:00
|
|
|
g_critical ("Unable to initialize Clutter: %s", error->message);
|
|
|
|
g_error_free (error);
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2011-03-04 23:55:02 +00:00
|
|
|
res = CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
res = CLUTTER_INIT_SUCCESS;
|
2008-09-23 07:03:35 +00:00
|
|
|
}
|
|
|
|
else
|
2011-03-04 23:55:02 +00:00
|
|
|
{
|
|
|
|
res = clutter_init_real (&error);
|
|
|
|
if (error != NULL)
|
|
|
|
{
|
|
|
|
g_critical ("Unable to initialize Clutter: %s", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
2007-03-23 09:44:21 +00:00
|
|
|
|
|
|
|
gboolean
|
2007-10-02 14:03:36 +00:00
|
|
|
_clutter_boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
|
|
|
GValue *return_accu,
|
|
|
|
const GValue *handler_return,
|
|
|
|
gpointer dummy)
|
2007-03-23 09:44:21 +00:00
|
|
|
{
|
|
|
|
gboolean continue_emission;
|
|
|
|
gboolean signal_handled;
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2007-03-23 09:44:21 +00:00
|
|
|
signal_handled = g_value_get_boolean (handler_return);
|
|
|
|
g_value_set_boolean (return_accu, signal_handled);
|
|
|
|
continue_emission = !signal_handled;
|
2007-04-19 15:27:46 +00:00
|
|
|
|
2007-03-23 09:44:21 +00:00
|
|
|
return continue_emission;
|
|
|
|
}
|
2007-05-16 15:00:41 +00:00
|
|
|
|
2012-06-22 01:38:21 +00:00
|
|
|
gboolean
|
|
|
|
_clutter_boolean_continue_accumulator (GSignalInvocationHint *ihint,
|
|
|
|
GValue *return_accu,
|
|
|
|
const GValue *handler_return,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
|
|
|
gboolean continue_emission;
|
|
|
|
|
|
|
|
continue_emission = g_value_get_boolean (handler_return);
|
|
|
|
g_value_set_boolean (return_accu, continue_emission);
|
|
|
|
|
|
|
|
return continue_emission;
|
|
|
|
}
|
|
|
|
|
2007-10-03 09:28:16 +00:00
|
|
|
static void
|
|
|
|
event_click_count_generate (ClutterEvent *event)
|
|
|
|
{
|
|
|
|
/* multiple button click detection */
|
2007-11-20 17:14:05 +00:00
|
|
|
static gint click_count = 0;
|
|
|
|
static gint previous_x = -1;
|
|
|
|
static gint previous_y = -1;
|
|
|
|
static guint32 previous_time = 0;
|
|
|
|
static gint previous_button_number = -1;
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2009-12-07 23:13:52 +00:00
|
|
|
ClutterInputDevice *device = NULL;
|
2010-09-10 13:27:37 +00:00
|
|
|
ClutterSettings *settings;
|
2009-11-23 16:07:16 +00:00
|
|
|
guint double_click_time;
|
|
|
|
guint double_click_distance;
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2010-09-10 13:27:37 +00:00
|
|
|
settings = clutter_settings_get_default ();
|
|
|
|
|
|
|
|
g_object_get (settings,
|
|
|
|
"double-click-distance", &double_click_distance,
|
|
|
|
"double-click-time", &double_click_time,
|
|
|
|
NULL);
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2009-12-07 23:13:52 +00:00
|
|
|
device = clutter_event_get_device (event);
|
|
|
|
if (device != NULL)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2009-12-07 23:13:52 +00:00
|
|
|
click_count = device->click_count;
|
|
|
|
previous_x = device->previous_x;
|
|
|
|
previous_y = device->previous_y;
|
|
|
|
previous_time = device->previous_time;
|
|
|
|
previous_button_number = device->previous_button_number;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Restoring previous click count:%d (device:%d, time:%u)",
|
|
|
|
click_count,
|
|
|
|
clutter_input_device_get_device_id (device),
|
|
|
|
previous_time);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Restoring previous click count:%d (time:%u)",
|
|
|
|
click_count,
|
|
|
|
previous_time);
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
|
|
|
|
2009-12-07 23:13:52 +00:00
|
|
|
switch (clutter_event_type (event))
|
2007-11-20 17:05:23 +00:00
|
|
|
{
|
2007-11-20 17:14:05 +00:00
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
/* check if we are in time and within distance to increment an
|
|
|
|
* existing click count
|
|
|
|
*/
|
2009-12-07 23:13:52 +00:00
|
|
|
if (event->button.button == previous_button_number &&
|
|
|
|
event->button.time < (previous_time + double_click_time) &&
|
2008-02-20 14:16:54 +00:00
|
|
|
(ABS (event->button.x - previous_x) <= double_click_distance) &&
|
2009-12-07 23:13:52 +00:00
|
|
|
(ABS (event->button.y - previous_y) <= double_click_distance))
|
2007-11-20 17:14:05 +00:00
|
|
|
{
|
2009-12-07 23:13:52 +00:00
|
|
|
CLUTTER_NOTE (EVENT, "Increase click count (button: %d, time: %u)",
|
|
|
|
event->button.button,
|
|
|
|
event->button.time);
|
|
|
|
|
2009-11-23 16:07:16 +00:00
|
|
|
click_count += 1;
|
2007-11-20 17:14:05 +00:00
|
|
|
}
|
|
|
|
else /* start a new click count*/
|
|
|
|
{
|
2009-12-07 23:13:52 +00:00
|
|
|
CLUTTER_NOTE (EVENT, "Reset click count (button: %d, time: %u)",
|
|
|
|
event->button.button,
|
|
|
|
event->button.time);
|
|
|
|
|
2009-11-23 16:07:16 +00:00
|
|
|
click_count = 1;
|
2007-11-20 17:14:05 +00:00
|
|
|
previous_button_number = event->button.button;
|
|
|
|
}
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2009-11-23 16:07:16 +00:00
|
|
|
previous_x = event->button.x;
|
|
|
|
previous_y = event->button.y;
|
2009-12-07 23:13:52 +00:00
|
|
|
previous_time = event->button.time;
|
2007-11-20 17:14:05 +00:00
|
|
|
|
|
|
|
/* fallthrough */
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
2009-11-23 16:07:16 +00:00
|
|
|
event->button.click_count = click_count;
|
2007-11-20 17:14:05 +00:00
|
|
|
break;
|
2009-11-23 16:07:16 +00:00
|
|
|
|
2007-11-20 17:14:05 +00:00
|
|
|
default:
|
2010-02-04 18:29:47 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2007-10-03 09:28:16 +00:00
|
|
|
}
|
2008-06-23 09:55:42 +00:00
|
|
|
|
2009-12-07 23:13:52 +00:00
|
|
|
if (event->type == CLUTTER_BUTTON_PRESS && device != NULL)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2009-12-07 23:13:52 +00:00
|
|
|
CLUTTER_NOTE (EVENT, "Storing click count: %d (device:%d, time:%u)",
|
|
|
|
click_count,
|
|
|
|
clutter_input_device_get_device_id (device),
|
|
|
|
previous_time);
|
|
|
|
|
|
|
|
device->click_count = click_count;
|
|
|
|
device->previous_x = previous_x;
|
|
|
|
device->previous_y = previous_y;
|
|
|
|
device->previous_time = previous_time;
|
|
|
|
device->previous_button_number = previous_button_number;
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
2007-10-03 09:28:16 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 14:16:54 +00:00
|
|
|
static inline void
|
2012-06-24 08:58:12 +00:00
|
|
|
emit_event_chain (ClutterEvent *event)
|
2007-10-10 13:04:34 +00:00
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
static gboolean lock = FALSE;
|
2007-10-10 13:04:34 +00:00
|
|
|
|
2010-01-08 17:51:00 +00:00
|
|
|
if (event->any.source == NULL)
|
2008-02-25 12:24:56 +00:00
|
|
|
{
|
2009-02-23 15:22:08 +00:00
|
|
|
CLUTTER_NOTE (EVENT, "No source set, discarding event");
|
2008-02-25 12:24:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-10-10 13:04:34 +00:00
|
|
|
|
2008-02-25 12:24:56 +00:00
|
|
|
/* reentrancy check */
|
2008-02-25 16:50:50 +00:00
|
|
|
if (lock != FALSE)
|
2009-02-27 17:59:16 +00:00
|
|
|
{
|
2011-01-27 17:26:16 +00:00
|
|
|
g_warning ("Tried emitting event during event delivery, bailing out.");
|
2009-02-27 17:59:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-02-25 12:24:56 +00:00
|
|
|
|
|
|
|
lock = TRUE;
|
2007-10-10 13:04:34 +00:00
|
|
|
|
2012-06-24 08:58:12 +00:00
|
|
|
_clutter_actor_handle_event (event->any.source, event);
|
2007-10-10 13:04:34 +00:00
|
|
|
|
|
|
|
lock = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-07-01 11:51:20 +00:00
|
|
|
/*
|
|
|
|
* Emits a pointer event after having prepared the event for delivery (setting
|
|
|
|
* source, computing click_count, generating enter/leave etc.).
|
|
|
|
*/
|
|
|
|
|
2008-02-20 14:16:54 +00:00
|
|
|
static inline void
|
2008-07-01 11:51:20 +00:00
|
|
|
emit_pointer_event (ClutterEvent *event,
|
|
|
|
ClutterInputDevice *device)
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
2009-11-24 16:33:03 +00:00
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
2007-11-16 13:41:07 +00:00
|
|
|
|
2013-08-29 16:10:56 +00:00
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
return;
|
|
|
|
|
2009-11-24 16:33:03 +00:00
|
|
|
if (context->pointer_grab_actor == NULL &&
|
|
|
|
(device == NULL || device->pointer_grab_actor == NULL))
|
2008-07-01 11:51:20 +00:00
|
|
|
{
|
2009-11-24 16:33:03 +00:00
|
|
|
/* no grab, time to capture and bubble */
|
2012-06-24 08:58:12 +00:00
|
|
|
emit_event_chain (event);
|
2008-07-01 11:51:20 +00:00
|
|
|
}
|
2007-11-16 13:41:07 +00:00
|
|
|
else
|
2008-07-01 11:51:20 +00:00
|
|
|
{
|
2009-11-24 16:33:03 +00:00
|
|
|
if (context->pointer_grab_actor != NULL)
|
|
|
|
{
|
|
|
|
/* global grab */
|
|
|
|
clutter_actor_event (context->pointer_grab_actor, event, FALSE);
|
|
|
|
}
|
|
|
|
else if (device != NULL && device->pointer_grab_actor != NULL)
|
|
|
|
{
|
|
|
|
/* per device grab */
|
|
|
|
clutter_actor_event (device->pointer_grab_actor, event, FALSE);
|
|
|
|
}
|
2008-07-01 11:51:20 +00:00
|
|
|
}
|
2007-11-16 13:41:07 +00:00
|
|
|
}
|
|
|
|
|
2012-06-16 23:44:44 +00:00
|
|
|
static inline void
|
|
|
|
emit_touch_event (ClutterEvent *event,
|
|
|
|
ClutterInputDevice *device)
|
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
ClutterActor *grab_actor = NULL;
|
2012-06-16 23:44:44 +00:00
|
|
|
|
2013-08-29 16:10:56 +00:00
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
return;
|
|
|
|
|
2012-06-24 08:58:12 +00:00
|
|
|
if (device->sequence_grab_actors != NULL)
|
2012-06-16 23:44:44 +00:00
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
|
|
|
|
event->touch.sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (grab_actor != NULL)
|
|
|
|
{
|
|
|
|
/* per-device sequence grab */
|
2012-06-16 23:44:44 +00:00
|
|
|
clutter_actor_event (grab_actor, event, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* no grab, time to capture and bubble */
|
2012-06-24 08:58:12 +00:00
|
|
|
emit_event_chain (event);
|
2012-06-16 23:44:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-20 14:16:54 +00:00
|
|
|
static inline void
|
2011-10-10 15:45:20 +00:00
|
|
|
emit_keyboard_event (ClutterEvent *event,
|
|
|
|
ClutterInputDevice *device)
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
2009-11-23 16:07:16 +00:00
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
2007-11-16 13:41:07 +00:00
|
|
|
|
2013-08-29 16:10:56 +00:00
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
return;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (context->keyboard_grab_actor == NULL &&
|
|
|
|
(device == NULL || device->keyboard_grab_actor == NULL))
|
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
/* no grab, time to capture and bubble */
|
|
|
|
emit_event_chain (event);
|
2011-10-10 15:45:20 +00:00
|
|
|
}
|
2008-06-23 09:55:42 +00:00
|
|
|
else
|
2011-10-10 15:45:20 +00:00
|
|
|
{
|
|
|
|
if (context->keyboard_grab_actor != NULL)
|
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
/* global key grab */
|
2011-10-10 15:45:20 +00:00
|
|
|
clutter_actor_event (context->keyboard_grab_actor, event, FALSE);
|
|
|
|
}
|
|
|
|
else if (device != NULL && device->keyboard_grab_actor != NULL)
|
|
|
|
{
|
2012-06-24 08:58:12 +00:00
|
|
|
/* per-device key grab */
|
2011-10-10 15:45:20 +00:00
|
|
|
clutter_actor_event (context->keyboard_grab_actor, event, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2007-11-15 17:30:30 +00:00
|
|
|
}
|
|
|
|
|
2010-02-01 15:47:50 +00:00
|
|
|
static gboolean
|
|
|
|
is_off_stage (ClutterActor *stage,
|
|
|
|
gfloat x,
|
|
|
|
gfloat y)
|
|
|
|
{
|
2011-01-27 17:26:16 +00:00
|
|
|
gfloat width, height;
|
|
|
|
|
|
|
|
clutter_actor_get_size (stage, &width, &height);
|
|
|
|
|
2010-02-01 15:47:50 +00:00
|
|
|
return (x < 0 ||
|
|
|
|
y < 0 ||
|
2011-01-27 17:26:16 +00:00
|
|
|
x >= width ||
|
|
|
|
y >= height);
|
2010-02-01 15:47:50 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 14:16:54 +00:00
|
|
|
/**
|
2012-04-30 16:12:12 +00:00
|
|
|
* clutter_do_event:
|
2007-10-03 09:28:16 +00:00
|
|
|
* @event: a #ClutterEvent.
|
|
|
|
*
|
2011-02-03 11:30:10 +00:00
|
|
|
* Processes an event.
|
|
|
|
*
|
|
|
|
* The @event must be a valid #ClutterEvent and have a #ClutterStage
|
|
|
|
* associated to it.
|
|
|
|
*
|
|
|
|
* This function is only useful when embedding Clutter inside another
|
|
|
|
* toolkit, and it should never be called by applications.
|
2007-10-03 09:28:16 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_do_event (ClutterEvent *event)
|
2009-06-06 23:10:41 +00:00
|
|
|
{
|
2011-02-03 11:30:10 +00:00
|
|
|
/* we need the stage for the event */
|
|
|
|
if (event->any.stage == NULL)
|
|
|
|
{
|
|
|
|
g_warning ("%s: Event does not have a stage: discarding.", G_STRFUNC);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stages in destruction do not process events */
|
|
|
|
if (CLUTTER_ACTOR_IN_DESTRUCTION (event->any.stage))
|
2009-06-06 23:10:41 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Instead of processing events when received, we queue them up to
|
|
|
|
* handle per-frame before animations, layout, and drawing.
|
|
|
|
*
|
|
|
|
* This gives us the chance to reliably compress motion events
|
|
|
|
* because we've "looked ahead" and know all motion events that
|
|
|
|
* will occur before drawing the frame.
|
|
|
|
*/
|
2013-11-11 17:16:32 +00:00
|
|
|
_clutter_stage_queue_event (event->any.stage, event, TRUE);
|
2009-06-06 23:10:41 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 22:33:15 +00:00
|
|
|
static void
|
|
|
|
_clutter_process_event_details (ClutterActor *stage,
|
|
|
|
ClutterMainContext *context,
|
|
|
|
ClutterEvent *event)
|
2007-10-03 09:28:16 +00:00
|
|
|
{
|
2012-07-11 15:21:28 +00:00
|
|
|
ClutterInputDevice *device = clutter_event_get_device (event);
|
2007-10-10 13:04:34 +00:00
|
|
|
|
2007-10-03 09:28:16 +00:00
|
|
|
switch (event->type)
|
|
|
|
{
|
2007-11-16 13:41:07 +00:00
|
|
|
case CLUTTER_NOTHING:
|
|
|
|
event->any.source = stage;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_KEY_PRESS:
|
|
|
|
case CLUTTER_KEY_RELEASE:
|
2007-11-15 17:08:48 +00:00
|
|
|
{
|
2007-11-16 13:41:07 +00:00
|
|
|
ClutterActor *actor = NULL;
|
2007-10-16 16:35:02 +00:00
|
|
|
|
2007-11-20 17:03:53 +00:00
|
|
|
/* check that we're not a synthetic event with source set */
|
|
|
|
if (event->any.source == NULL)
|
|
|
|
{
|
|
|
|
actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage));
|
|
|
|
event->any.source = actor;
|
2008-02-25 12:24:56 +00:00
|
|
|
if (G_UNLIKELY (actor == NULL))
|
|
|
|
{
|
|
|
|
g_warning ("No key focus set, discarding");
|
|
|
|
return;
|
|
|
|
}
|
2007-11-20 17:03:53 +00:00
|
|
|
}
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
emit_keyboard_event (event, device);
|
2007-11-16 13:41:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-01-27 17:26:16 +00:00
|
|
|
case CLUTTER_ENTER:
|
|
|
|
/* if we're entering from outside the stage we need
|
|
|
|
* to check whether the pointer is actually on another
|
|
|
|
* actor, and emit an additional pointer event
|
|
|
|
*/
|
|
|
|
if (event->any.source == stage &&
|
|
|
|
event->crossing.related == NULL)
|
|
|
|
{
|
|
|
|
ClutterActor *actor = NULL;
|
|
|
|
|
|
|
|
emit_pointer_event (event, device);
|
|
|
|
|
2012-07-11 15:21:28 +00:00
|
|
|
actor = _clutter_input_device_update (device, NULL, FALSE);
|
2011-01-27 17:26:16 +00:00
|
|
|
if (actor != stage)
|
|
|
|
{
|
|
|
|
ClutterEvent *crossing;
|
|
|
|
|
|
|
|
/* we emit the exact same event on the actor */
|
|
|
|
crossing = clutter_event_copy (event);
|
|
|
|
crossing->crossing.related = stage;
|
|
|
|
crossing->crossing.source = actor;
|
|
|
|
|
|
|
|
emit_pointer_event (crossing, device);
|
|
|
|
clutter_event_free (crossing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
emit_pointer_event (event, device);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_LEAVE:
|
|
|
|
/* same as CLUTTER_ENTER above: when leaving the stage
|
|
|
|
* we need to also emit a CLUTTER_LEAVE event on the
|
|
|
|
* actor currently underneath the device, unless it's the
|
|
|
|
* stage
|
|
|
|
*/
|
|
|
|
if (event->any.source == stage &&
|
|
|
|
event->crossing.related == NULL &&
|
|
|
|
device->cursor_actor != stage)
|
|
|
|
{
|
|
|
|
ClutterEvent *crossing;
|
|
|
|
|
|
|
|
crossing = clutter_event_copy (event);
|
|
|
|
crossing->crossing.related = stage;
|
|
|
|
crossing->crossing.source = device->cursor_actor;
|
|
|
|
|
|
|
|
emit_pointer_event (crossing, device);
|
|
|
|
clutter_event_free (crossing);
|
|
|
|
}
|
|
|
|
emit_pointer_event (event, device);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_DESTROY_NOTIFY:
|
|
|
|
case CLUTTER_DELETE:
|
|
|
|
event->any.source = stage;
|
2013-08-29 16:10:56 +00:00
|
|
|
|
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
break;
|
|
|
|
|
2011-01-27 17:26:16 +00:00
|
|
|
/* the stage did not handle the event, so we just quit */
|
|
|
|
clutter_stage_event (CLUTTER_STAGE (stage), event);
|
|
|
|
break;
|
|
|
|
|
2007-11-16 13:41:07 +00:00
|
|
|
case CLUTTER_MOTION:
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
/* only the stage gets motion events if they are enabled */
|
2011-06-20 10:41:28 +00:00
|
|
|
if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
|
2007-11-20 17:03:53 +00:00
|
|
|
event->any.source == NULL)
|
2007-11-12 19:12:02 +00:00
|
|
|
{
|
2007-11-16 13:41:07 +00:00
|
|
|
/* Only stage gets motion events */
|
|
|
|
event->any.source = stage;
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2013-08-29 16:10:56 +00:00
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
break;
|
|
|
|
|
2008-06-23 09:55:42 +00:00
|
|
|
/* global grabs */
|
2007-11-16 13:41:07 +00:00
|
|
|
if (context->pointer_grab_actor != NULL)
|
2007-11-12 19:12:02 +00:00
|
|
|
{
|
2008-09-23 07:03:35 +00:00
|
|
|
clutter_actor_event (context->pointer_grab_actor,
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
event,
|
|
|
|
FALSE);
|
2008-06-23 09:55:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (device != NULL && device->pointer_grab_actor != NULL)
|
|
|
|
{
|
2008-09-23 07:03:35 +00:00
|
|
|
clutter_actor_event (device->pointer_grab_actor,
|
Store the motion event deliver flag in ClutterStage
Once upon a time, the land of Clutter had a stage singleton. It was
created automatically at initialization time and stayed around even
after the main loop was terminated. The singleton was content in
being all there was. There also was a global API to handle the
configuration of the stage singleton that would affect the behaviour
on other classes, signals and properties.
Then, an evil wizard came along and locked the stage singleton in his
black tower, and twisted it until it was possible to create new stages.
These new stages were pesky, and didn't have the same semantics of the
singleton: they didn't stay around when closed, or terminate the main
loop on delete events.
The evil wizard also started moving all the stage-related API from the
global context into class-specific methods.
Finally, the evil wizard cast a spell, and the stage singleton was
demoted to creation on demand - and until somebody called the
clutter_stage_get_default() function, the singleton remained in a limbo
of NULL pointers and undefined memory areas.
There was a last bit - literally - of information still held by the
global API; a tiny, little flag that disabled per-actor motion events.
The evil wizard added private accessors for it, and stored it inside the
stage private structure, in preparation for a deprecation that would
come in a future development cycle.
The evil wizard looked down upon the land of Clutter from the height of
his black tower; the lay of the land had been reshaped into a crucible
of potential, and the last dregs of the original force of creation were
either molted into new, useful shapes, or blasted away by the sheer fury
of his will.
All was good.
2011-02-18 17:19:04 +00:00
|
|
|
event,
|
|
|
|
FALSE);
|
2007-11-16 13:41:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2007-11-16 13:41:07 +00:00
|
|
|
/* Trigger handlers on stage in both capture .. */
|
|
|
|
if (!clutter_actor_event (stage, event, TRUE))
|
|
|
|
{
|
|
|
|
/* and bubbling phase */
|
|
|
|
clutter_actor_event (stage, event, FALSE);
|
2007-11-12 19:12:02 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2009-11-24 16:33:03 +00:00
|
|
|
/* fallthrough from motion */
|
2007-11-16 13:41:07 +00:00
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
case CLUTTER_SCROLL:
|
2015-05-22 16:30:09 +00:00
|
|
|
case CLUTTER_TOUCHPAD_PINCH:
|
|
|
|
case CLUTTER_TOUCHPAD_SWIPE:
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
Remove Units from the public API
With the recent change to internal floating point values, ClutterUnit
has become a redundant type, defined to be a float. All integer entry
points are being internally converted to floating point values to be
passed to the GL pipeline with the least amount of conversion.
ClutterUnit is thus exposed as just a "pixel with fractionary bits",
and not -- as users might think -- as generic, resolution and device
independent units. not that it was the case, but a definitive amount
of people was convinced it did provide this "feature", and was flummoxed
about the mere existence of this type.
So, having ClutterUnit exposed in the public API doubles the entry
points and has the following disadvantages:
- we have to maintain twice the amount of entry points in ClutterActor
- we still do an integer-to-float implicit conversion
- we introduce a weird impedance between pixels and "pixels with
fractionary bits"
- language bindings will have to choose what to bind, and resort
to manually overriding the API
+ *except* for language bindings based on GObject-Introspection, as
they cannot do manual overrides, thus will replicate the entire
set of entry points
For these reason, we should coalesces every Actor entry point for
pixels and for ClutterUnit into a single entry point taking a float,
like:
void clutter_actor_set_x (ClutterActor *self,
gfloat x);
void clutter_actor_get_size (ClutterActor *self,
gfloat *width,
gfloat *height);
gfloat clutter_actor_get_height (ClutterActor *self);
etc.
The issues I have identified are:
- we'll have a two cases of compiler warnings:
- printf() format of the return values from %d to %f
- clutter_actor_get_size() taking floats instead of unsigned ints
- we'll have a problem with varargs when passing an integer instead
of a floating point value, except on 64bit platforms where the
size of a float is the same as the size of an int
To be clear: the *intent* of the API should not change -- we still use
pixels everywhere -- but:
- we remove ambiguity in the API with regard to pixels and units
- we remove entry points we get to maintain for the whole 1.0
version of the API
- we make things simpler to bind for both manual language bindings
and automatic (gobject-introspection based) ones
- we have the simplest API possible while still exposing the
capabilities of the underlying GL implementation
2009-05-06 15:44:47 +00:00
|
|
|
gfloat x, y;
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2007-11-16 13:41:07 +00:00
|
|
|
clutter_event_get_coords (event, &x, &y);
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2007-11-20 17:03:53 +00:00
|
|
|
/* Only do a pick to find the source if source is not already set
|
|
|
|
* (as it could be in a synthetic event)
|
|
|
|
*/
|
|
|
|
if (event->any.source == NULL)
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
2010-02-01 15:47:50 +00:00
|
|
|
/* emulate X11 the implicit soft grab; the implicit soft grab
|
|
|
|
* keeps relaying motion events when the stage is left with a
|
|
|
|
* pointer button pressed. since this is what happens when we
|
|
|
|
* disable per-actor motion events we need to maintain the same
|
|
|
|
* behaviour when the per-actor motion events are enabled as
|
|
|
|
* well
|
|
|
|
*/
|
|
|
|
if (is_off_stage (stage, x, y))
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
2007-11-20 17:03:53 +00:00
|
|
|
if (event->type == CLUTTER_BUTTON_RELEASE)
|
|
|
|
{
|
2008-06-23 09:55:42 +00:00
|
|
|
CLUTTER_NOTE (EVENT,
|
Remove Units from the public API
With the recent change to internal floating point values, ClutterUnit
has become a redundant type, defined to be a float. All integer entry
points are being internally converted to floating point values to be
passed to the GL pipeline with the least amount of conversion.
ClutterUnit is thus exposed as just a "pixel with fractionary bits",
and not -- as users might think -- as generic, resolution and device
independent units. not that it was the case, but a definitive amount
of people was convinced it did provide this "feature", and was flummoxed
about the mere existence of this type.
So, having ClutterUnit exposed in the public API doubles the entry
points and has the following disadvantages:
- we have to maintain twice the amount of entry points in ClutterActor
- we still do an integer-to-float implicit conversion
- we introduce a weird impedance between pixels and "pixels with
fractionary bits"
- language bindings will have to choose what to bind, and resort
to manually overriding the API
+ *except* for language bindings based on GObject-Introspection, as
they cannot do manual overrides, thus will replicate the entire
set of entry points
For these reason, we should coalesces every Actor entry point for
pixels and for ClutterUnit into a single entry point taking a float,
like:
void clutter_actor_set_x (ClutterActor *self,
gfloat x);
void clutter_actor_get_size (ClutterActor *self,
gfloat *width,
gfloat *height);
gfloat clutter_actor_get_height (ClutterActor *self);
etc.
The issues I have identified are:
- we'll have a two cases of compiler warnings:
- printf() format of the return values from %d to %f
- clutter_actor_get_size() taking floats instead of unsigned ints
- we'll have a problem with varargs when passing an integer instead
of a floating point value, except on 64bit platforms where the
size of a float is the same as the size of an int
To be clear: the *intent* of the API should not change -- we still use
pixels everywhere -- but:
- we remove ambiguity in the API with regard to pixels and units
- we remove entry points we get to maintain for the whole 1.0
version of the API
- we make things simpler to bind for both manual language bindings
and automatic (gobject-introspection based) ones
- we have the simplest API possible while still exposing the
capabilities of the underlying GL implementation
2009-05-06 15:44:47 +00:00
|
|
|
"Release off stage received at %.2f, %.2f",
|
2007-11-20 17:03:53 +00:00
|
|
|
x, y);
|
|
|
|
|
|
|
|
event->button.source = stage;
|
2009-12-09 00:00:49 +00:00
|
|
|
event->button.click_count = 1;
|
2010-02-01 15:47:50 +00:00
|
|
|
|
2009-11-24 16:33:03 +00:00
|
|
|
emit_pointer_event (event, device);
|
2007-11-20 17:03:53 +00:00
|
|
|
}
|
2010-02-01 15:47:50 +00:00
|
|
|
else if (event->type == CLUTTER_MOTION)
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Motion off stage received at %.2f, %2.f",
|
|
|
|
x, y);
|
|
|
|
|
|
|
|
event->motion.source = stage;
|
|
|
|
|
|
|
|
emit_pointer_event (event, device);
|
|
|
|
}
|
|
|
|
|
2007-11-20 17:03:53 +00:00
|
|
|
break;
|
2007-11-16 13:41:07 +00:00
|
|
|
}
|
2007-10-10 13:04:34 +00:00
|
|
|
|
2010-01-08 17:51:00 +00:00
|
|
|
/* if the backend provides a device then we should
|
|
|
|
* already have everything we need to update it and
|
|
|
|
* get the actor underneath
|
|
|
|
*/
|
2009-11-24 16:33:03 +00:00
|
|
|
if (device != NULL)
|
2012-07-11 15:21:28 +00:00
|
|
|
actor = _clutter_input_device_update (device, NULL, TRUE);
|
2009-11-24 16:33:03 +00:00
|
|
|
else
|
2010-01-08 17:51:00 +00:00
|
|
|
{
|
|
|
|
CLUTTER_NOTE (EVENT, "No device found: picking");
|
|
|
|
|
2011-03-15 13:17:04 +00:00
|
|
|
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
|
|
|
|
x, y,
|
|
|
|
CLUTTER_PICK_REACTIVE);
|
2010-01-08 17:51:00 +00:00
|
|
|
}
|
2007-10-03 09:28:16 +00:00
|
|
|
|
2010-02-01 15:47:50 +00:00
|
|
|
if (actor == NULL)
|
2007-11-20 17:03:53 +00:00
|
|
|
break;
|
2010-02-01 15:47:50 +00:00
|
|
|
|
|
|
|
event->any.source = actor;
|
2007-11-20 17:03:53 +00:00
|
|
|
}
|
2008-02-20 14:16:54 +00:00
|
|
|
else
|
2007-11-20 17:03:53 +00:00
|
|
|
{
|
|
|
|
/* use the source already set in the synthetic event */
|
|
|
|
actor = event->any.source;
|
|
|
|
}
|
2007-10-03 09:28:16 +00:00
|
|
|
|
Remove Units from the public API
With the recent change to internal floating point values, ClutterUnit
has become a redundant type, defined to be a float. All integer entry
points are being internally converted to floating point values to be
passed to the GL pipeline with the least amount of conversion.
ClutterUnit is thus exposed as just a "pixel with fractionary bits",
and not -- as users might think -- as generic, resolution and device
independent units. not that it was the case, but a definitive amount
of people was convinced it did provide this "feature", and was flummoxed
about the mere existence of this type.
So, having ClutterUnit exposed in the public API doubles the entry
points and has the following disadvantages:
- we have to maintain twice the amount of entry points in ClutterActor
- we still do an integer-to-float implicit conversion
- we introduce a weird impedance between pixels and "pixels with
fractionary bits"
- language bindings will have to choose what to bind, and resort
to manually overriding the API
+ *except* for language bindings based on GObject-Introspection, as
they cannot do manual overrides, thus will replicate the entire
set of entry points
For these reason, we should coalesces every Actor entry point for
pixels and for ClutterUnit into a single entry point taking a float,
like:
void clutter_actor_set_x (ClutterActor *self,
gfloat x);
void clutter_actor_get_size (ClutterActor *self,
gfloat *width,
gfloat *height);
gfloat clutter_actor_get_height (ClutterActor *self);
etc.
The issues I have identified are:
- we'll have a two cases of compiler warnings:
- printf() format of the return values from %d to %f
- clutter_actor_get_size() taking floats instead of unsigned ints
- we'll have a problem with varargs when passing an integer instead
of a floating point value, except on 64bit platforms where the
size of a float is the same as the size of an int
To be clear: the *intent* of the API should not change -- we still use
pixels everywhere -- but:
- we remove ambiguity in the API with regard to pixels and units
- we remove entry points we get to maintain for the whole 1.0
version of the API
- we make things simpler to bind for both manual language bindings
and automatic (gobject-introspection based) ones
- we have the simplest API possible while still exposing the
capabilities of the underlying GL implementation
2009-05-06 15:44:47 +00:00
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Reactive event received at %.2f, %.2f - actor: %p",
|
|
|
|
x, y,
|
|
|
|
actor);
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2010-02-04 18:29:47 +00:00
|
|
|
/* button presses and releases need a click count */
|
|
|
|
if (event->type == CLUTTER_BUTTON_PRESS ||
|
|
|
|
event->type == CLUTTER_BUTTON_RELEASE)
|
2007-11-16 13:41:07 +00:00
|
|
|
{
|
|
|
|
/* Generate click count */
|
|
|
|
event_click_count_generate (event);
|
|
|
|
}
|
2008-07-01 11:51:20 +00:00
|
|
|
|
|
|
|
emit_pointer_event (event, device);
|
2007-11-16 13:41:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-19 13:47:19 +00:00
|
|
|
case CLUTTER_TOUCH_UPDATE:
|
2012-07-28 13:36:23 +00:00
|
|
|
/* only the stage gets motion events if they are enabled */
|
|
|
|
if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
|
|
|
|
event->any.source == NULL)
|
|
|
|
{
|
|
|
|
ClutterActor *grab_actor = NULL;
|
|
|
|
|
|
|
|
/* Only stage gets motion events */
|
|
|
|
event->any.source = stage;
|
|
|
|
|
2013-08-29 16:10:56 +00:00
|
|
|
if (_clutter_event_process_filters (event))
|
|
|
|
break;
|
|
|
|
|
2012-07-28 13:36:23 +00:00
|
|
|
/* global grabs */
|
|
|
|
if (device->sequence_grab_actors != NULL)
|
|
|
|
{
|
|
|
|
grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
|
|
|
|
event->touch.sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (grab_actor != NULL)
|
|
|
|
{
|
|
|
|
clutter_actor_event (grab_actor, event, FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Trigger handlers on stage in both capture .. */
|
|
|
|
if (!clutter_actor_event (stage, event, TRUE))
|
|
|
|
{
|
|
|
|
/* and bubbling phase */
|
|
|
|
clutter_actor_event (stage, event, FALSE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fallthrough from motion */
|
|
|
|
case CLUTTER_TOUCH_BEGIN:
|
2012-07-28 13:48:56 +00:00
|
|
|
case CLUTTER_TOUCH_CANCEL:
|
2012-03-19 13:47:19 +00:00
|
|
|
case CLUTTER_TOUCH_END:
|
2012-06-04 11:15:13 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
2012-07-11 15:21:28 +00:00
|
|
|
ClutterEventSequence *sequence;
|
2012-06-04 11:15:13 +00:00
|
|
|
gfloat x, y;
|
|
|
|
|
2012-07-11 15:21:28 +00:00
|
|
|
sequence =
|
|
|
|
clutter_event_get_event_sequence (event);
|
|
|
|
|
|
|
|
if (event->type == CLUTTER_TOUCH_BEGIN)
|
2012-08-21 14:26:30 +00:00
|
|
|
_clutter_input_device_add_event_sequence (device, event);
|
2012-07-11 15:21:28 +00:00
|
|
|
|
2012-06-04 11:15:13 +00:00
|
|
|
clutter_event_get_coords (event, &x, &y);
|
|
|
|
|
|
|
|
/* Only do a pick to find the source if source is not already set
|
|
|
|
* (as it could be in a synthetic event)
|
|
|
|
*/
|
|
|
|
if (event->any.source == NULL)
|
|
|
|
{
|
2012-10-05 12:34:20 +00:00
|
|
|
/* same as the mouse events above, emulate the X11 implicit
|
|
|
|
* soft grab */
|
|
|
|
if (is_off_stage (stage, x, y))
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Touch %s off stage received at %.2f, %.2f",
|
2012-11-20 16:37:53 +00:00
|
|
|
event->type == CLUTTER_TOUCH_UPDATE ? "update" :
|
|
|
|
event->type == CLUTTER_TOUCH_END ? "end" :
|
|
|
|
event->type == CLUTTER_TOUCH_CANCEL ? "cancel" :
|
2012-10-05 12:34:20 +00:00
|
|
|
"?", x, y);
|
|
|
|
|
2012-11-20 16:34:52 +00:00
|
|
|
event->touch.source = stage;
|
2012-10-05 12:34:20 +00:00
|
|
|
|
|
|
|
emit_touch_event (event, device);
|
|
|
|
|
|
|
|
if (event->type == CLUTTER_TOUCH_END)
|
|
|
|
_clutter_input_device_remove_event_sequence (device, event);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-11 15:21:28 +00:00
|
|
|
if (device != NULL)
|
|
|
|
actor = _clutter_input_device_update (device, sequence, TRUE);
|
|
|
|
else
|
2012-11-20 16:37:53 +00:00
|
|
|
{
|
|
|
|
CLUTTER_NOTE (EVENT, "No device found: picking");
|
|
|
|
|
|
|
|
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
|
|
|
|
x, y,
|
|
|
|
CLUTTER_PICK_REACTIVE);
|
|
|
|
}
|
2012-07-11 15:21:28 +00:00
|
|
|
|
2012-06-04 11:15:13 +00:00
|
|
|
if (actor == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
event->any.source = actor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* use the source already set in the synthetic event */
|
|
|
|
actor = event->any.source;
|
|
|
|
}
|
|
|
|
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Reactive event received at %.2f, %.2f - actor: %p",
|
|
|
|
x, y,
|
|
|
|
actor);
|
|
|
|
|
2012-06-16 23:44:44 +00:00
|
|
|
emit_touch_event (event, device);
|
2012-07-11 15:21:28 +00:00
|
|
|
|
|
|
|
if (event->type == CLUTTER_TOUCH_END)
|
2012-08-21 14:26:30 +00:00
|
|
|
_clutter_input_device_remove_event_sequence (device, event);
|
2012-07-11 15:21:28 +00:00
|
|
|
|
2012-06-04 11:15:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-11-16 13:41:07 +00:00
|
|
|
case CLUTTER_STAGE_STATE:
|
|
|
|
/* fullscreen / focus - forward to stage */
|
|
|
|
event->any.source = stage;
|
2013-08-29 16:10:56 +00:00
|
|
|
if (!_clutter_event_process_filters (event))
|
|
|
|
clutter_stage_event (CLUTTER_STAGE (stage), event);
|
2007-11-16 13:41:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_CLIENT_MESSAGE:
|
|
|
|
break;
|
2012-03-19 13:47:19 +00:00
|
|
|
|
|
|
|
case CLUTTER_EVENT_LAST:
|
|
|
|
break;
|
2007-10-03 09:28:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-10 14:48:43 +00:00
|
|
|
/*
|
2009-11-12 22:33:15 +00:00
|
|
|
* _clutter_process_event
|
|
|
|
* @event: a #ClutterEvent.
|
|
|
|
*
|
|
|
|
* Does the actual work of processing an event that was queued earlier
|
|
|
|
* out of clutter_do_event().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_clutter_process_event (ClutterEvent *event)
|
|
|
|
{
|
2010-02-11 15:13:40 +00:00
|
|
|
ClutterMainContext *context;
|
|
|
|
ClutterActor *stage;
|
2009-11-12 22:33:15 +00:00
|
|
|
|
|
|
|
context = _clutter_context_get_default ();
|
|
|
|
|
2010-02-11 15:13:40 +00:00
|
|
|
stage = CLUTTER_ACTOR (event->any.stage);
|
|
|
|
if (stage == NULL)
|
2012-06-24 08:58:12 +00:00
|
|
|
{
|
2012-11-20 16:37:53 +00:00
|
|
|
CLUTTER_NOTE (EVENT, "Discarding event without a stage set");
|
2012-06-24 08:58:12 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-11-12 22:33:15 +00:00
|
|
|
|
2012-11-16 15:33:00 +00:00
|
|
|
/* push events on a stack, so that we don't need to
|
2012-06-24 08:58:12 +00:00
|
|
|
* add an event parameter to all signals that can be emitted within
|
|
|
|
* an event chain
|
|
|
|
*/
|
2012-11-16 15:33:00 +00:00
|
|
|
context->current_event = g_slist_prepend (context->current_event, event);
|
2012-06-24 08:58:12 +00:00
|
|
|
|
2009-11-12 22:33:15 +00:00
|
|
|
_clutter_process_event_details (stage, context, event);
|
2012-06-24 08:58:12 +00:00
|
|
|
|
2012-11-16 15:33:00 +00:00
|
|
|
context->current_event = g_slist_delete_link (context->current_event, context->current_event);
|
2009-11-12 22:33:15 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 14:16:54 +00:00
|
|
|
/**
|
2010-09-03 11:14:50 +00:00
|
|
|
* clutter_get_actor_by_gid:
|
2011-02-15 11:50:26 +00:00
|
|
|
* @id_: a #ClutterActor unique id.
|
2007-10-08 16:18:33 +00:00
|
|
|
*
|
2011-02-15 11:50:26 +00:00
|
|
|
* Retrieves the #ClutterActor with @id_.
|
2007-11-15 17:35:47 +00:00
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): the actor with the passed id or %NULL.
|
|
|
|
* The returned actor does not have its reference count increased.
|
2007-10-08 16:18:33 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
2011-04-11 11:30:51 +00:00
|
|
|
*
|
2015-01-01 15:10:54 +00:00
|
|
|
* Deprecated: 1.8: The id is deprecated, and this function always returns
|
|
|
|
* %NULL. Use the proper scene graph API in #ClutterActor to find a child
|
|
|
|
* of the stage.
|
2007-10-08 16:18:33 +00:00
|
|
|
*/
|
2011-01-27 17:26:16 +00:00
|
|
|
ClutterActor *
|
2011-02-15 11:50:26 +00:00
|
|
|
clutter_get_actor_by_gid (guint32 id_)
|
2007-10-08 16:18:33 +00:00
|
|
|
{
|
2015-01-01 15:10:54 +00:00
|
|
|
return NULL;
|
2007-10-08 16:18:33 +00:00
|
|
|
}
|
|
|
|
|
2007-05-16 15:00:41 +00:00
|
|
|
void
|
|
|
|
clutter_base_init (void)
|
|
|
|
{
|
|
|
|
static gboolean initialised = FALSE;
|
|
|
|
|
|
|
|
if (!initialised)
|
|
|
|
{
|
|
|
|
initialised = TRUE;
|
|
|
|
|
2010-06-03 11:56:17 +00:00
|
|
|
bindtextdomain (GETTEXT_PACKAGE, CLUTTER_LOCALEDIR);
|
2009-01-06 12:11:07 +00:00
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
|
2012-12-15 18:44:26 +00:00
|
|
|
#if !GLIB_CHECK_VERSION (2, 35, 1)
|
2007-05-16 15:00:41 +00:00
|
|
|
/* initialise GLib type system */
|
|
|
|
g_type_init ();
|
2012-12-15 18:44:26 +00:00
|
|
|
#endif
|
2011-10-07 14:53:50 +00:00
|
|
|
|
|
|
|
/* initialise the Big Clutter Lock™ if necessary */
|
|
|
|
clutter_threads_init_default ();
|
2007-05-16 15:00:41 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-08 16:18:33 +00:00
|
|
|
|
2007-11-19 16:30:56 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_default_frame_rate:
|
|
|
|
*
|
2009-06-07 02:48:15 +00:00
|
|
|
* Retrieves the default frame rate. See clutter_set_default_frame_rate().
|
2007-11-19 16:30:56 +00:00
|
|
|
*
|
|
|
|
* Return value: the default frame rate
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-10-16 13:41:34 +00:00
|
|
|
guint
|
|
|
|
clutter_get_default_frame_rate (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2007-10-16 13:41:34 +00:00
|
|
|
return context->frame_rate;
|
|
|
|
}
|
|
|
|
|
2007-11-19 16:30:56 +00:00
|
|
|
/**
|
|
|
|
* clutter_set_default_frame_rate:
|
|
|
|
* @frames_per_sec: the new default frame rate
|
|
|
|
*
|
2009-06-07 02:48:15 +00:00
|
|
|
* Sets the default frame rate. This frame rate will be used to limit
|
|
|
|
* the number of frames drawn if Clutter is not able to synchronize
|
|
|
|
* with the vertical refresh rate of the display. When synchronization
|
|
|
|
* is possible, this value is ignored.
|
2007-11-19 16:30:56 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
2011-11-07 20:24:13 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: This function does not do anything any more.
|
2007-11-19 16:30:56 +00:00
|
|
|
*/
|
2007-10-16 13:41:34 +00:00
|
|
|
void
|
|
|
|
clutter_set_default_frame_rate (guint frames_per_sec)
|
|
|
|
{
|
|
|
|
}
|
2007-11-15 17:08:48 +00:00
|
|
|
|
|
|
|
static void
|
2011-10-10 15:45:20 +00:00
|
|
|
on_grab_actor_destroy (ClutterActor *actor,
|
|
|
|
ClutterInputDevice *device)
|
2007-11-15 17:08:48 +00:00
|
|
|
{
|
2011-10-10 15:45:20 +00:00
|
|
|
if (device == NULL)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
2008-09-23 07:03:35 +00:00
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (context->pointer_grab_actor == actor)
|
|
|
|
clutter_ungrab_pointer ();
|
2007-11-15 17:08:48 +00:00
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (context->keyboard_grab_actor == actor)
|
|
|
|
clutter_ungrab_keyboard ();
|
|
|
|
|
|
|
|
return;
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
2011-10-10 15:45:20 +00:00
|
|
|
|
|
|
|
switch (device->device_type)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2011-10-10 15:45:20 +00:00
|
|
|
case CLUTTER_POINTER_DEVICE:
|
|
|
|
device->pointer_grab_actor = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_KEYBOARD_DEVICE:
|
|
|
|
device->keyboard_grab_actor = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
2007-11-15 17:08:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_grab_pointer:
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Grabs pointer events, after the grab is done all pointer related events
|
|
|
|
* (press, motion, release, enter, leave and scroll) are delivered to this
|
2009-03-03 22:51:17 +00:00
|
|
|
* actor directly without passing through both capture and bubble phases of
|
|
|
|
* the event delivery chain. The source set in the event will be the actor
|
|
|
|
* that would have received the event if the pointer grab was not in effect.
|
|
|
|
*
|
2014-03-17 23:07:58 +00:00
|
|
|
* Grabs completely override the entire event delivery chain
|
2009-03-03 22:51:17 +00:00
|
|
|
* done by Clutter. Pointer grabs should only be used as a last resource;
|
|
|
|
* using the #ClutterActor::captured-event signal should always be the
|
2014-03-17 23:07:58 +00:00
|
|
|
* preferred way to intercept event delivery to reactive actors.
|
2007-11-15 17:08:48 +00:00
|
|
|
*
|
2011-10-10 15:45:20 +00:00
|
|
|
* This function should rarely be used.
|
|
|
|
*
|
|
|
|
* If a grab is required, you are strongly encouraged to use a specific
|
|
|
|
* input device by calling clutter_input_device_grab().
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
2007-11-15 17:08:48 +00:00
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_grab_pointer (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2007-11-15 17:08:48 +00:00
|
|
|
|
|
|
|
if (context->pointer_grab_actor == actor)
|
|
|
|
return;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (context->pointer_grab_actor != NULL)
|
2007-11-15 17:08:48 +00:00
|
|
|
{
|
2011-10-10 15:45:20 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (context->pointer_grab_actor,
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
NULL);
|
2007-11-15 17:08:48 +00:00
|
|
|
context->pointer_grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (actor != NULL)
|
2007-11-15 17:08:48 +00:00
|
|
|
{
|
|
|
|
context->pointer_grab_actor = actor;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
g_signal_connect (context->pointer_grab_actor, "destroy",
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_input_device_grab:
|
|
|
|
* @device: a #ClutterInputDevice
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Acquires a grab on @actor for the given @device.
|
|
|
|
*
|
|
|
|
* Any event coming from @device will be delivered to @actor, bypassing
|
|
|
|
* the usual event delivery mechanism, until the grab is released by
|
|
|
|
* calling clutter_input_device_ungrab().
|
|
|
|
*
|
|
|
|
* The grab is client-side: even if the windowing system used by the Clutter
|
|
|
|
* backend has the concept of "device grabs", Clutter will not use them.
|
|
|
|
*
|
|
|
|
* Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE and
|
|
|
|
* %CLUTTER_KEYBOARD_DEVICE can hold a grab.
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_input_device_grab (ClutterInputDevice *device,
|
|
|
|
ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ClutterActor **grab_actor;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
|
|
|
switch (device->device_type)
|
|
|
|
{
|
|
|
|
case CLUTTER_POINTER_DEVICE:
|
|
|
|
grab_actor = &(device->pointer_grab_actor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_KEYBOARD_DEVICE:
|
|
|
|
grab_actor = &(device->keyboard_grab_actor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_critical ("Only pointer and keyboard devices can grab an actor");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*grab_actor != NULL)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (*grab_actor,
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
device);
|
2007-11-15 17:08:48 +00:00
|
|
|
}
|
2011-10-10 15:45:20 +00:00
|
|
|
|
|
|
|
*grab_actor = actor;
|
|
|
|
|
|
|
|
g_signal_connect (*grab_actor,
|
|
|
|
"destroy",
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
device);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_input_device_ungrab:
|
|
|
|
* @device: a #ClutterInputDevice
|
|
|
|
*
|
|
|
|
* Releases the grab on the @device, if one is in place.
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_input_device_ungrab (ClutterInputDevice *device)
|
|
|
|
{
|
|
|
|
ClutterActor **grab_actor;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
|
|
|
|
|
|
switch (device->device_type)
|
|
|
|
{
|
|
|
|
case CLUTTER_POINTER_DEVICE:
|
|
|
|
grab_actor = &(device->pointer_grab_actor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_KEYBOARD_DEVICE:
|
|
|
|
grab_actor = &(device->keyboard_grab_actor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*grab_actor == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (*grab_actor,
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
device);
|
|
|
|
|
|
|
|
*grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_input_device_get_grabbed_actor:
|
|
|
|
* @device: a #ClutterInputDevice
|
|
|
|
*
|
|
|
|
* Retrieves a pointer to the #ClutterActor currently grabbing all
|
|
|
|
* the events coming from @device.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): a #ClutterActor, or %NULL
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
|
|
|
|
|
|
|
switch (device->device_type)
|
|
|
|
{
|
|
|
|
case CLUTTER_POINTER_DEVICE:
|
|
|
|
return device->pointer_grab_actor;
|
|
|
|
|
|
|
|
case CLUTTER_KEYBOARD_DEVICE:
|
|
|
|
return device->keyboard_grab_actor;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_critical ("Only pointer and keyboard devices can grab an actor");
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2007-11-15 17:08:48 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 21:13:19 +00:00
|
|
|
/**
|
|
|
|
* clutter_grab_pointer_for_device:
|
|
|
|
* @actor: a #ClutterActor
|
2011-02-15 11:50:26 +00:00
|
|
|
* @id_: a device id, or -1
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
|
|
|
* Grabs all the pointer events coming from the device @id for @actor.
|
|
|
|
*
|
|
|
|
* If @id is -1 then this function is equivalent to clutter_grab_pointer().
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
2011-10-10 15:45:20 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_input_device_grab() instead.
|
2008-06-27 21:13:19 +00:00
|
|
|
*/
|
2008-06-23 09:55:42 +00:00
|
|
|
void
|
2008-06-27 21:13:19 +00:00
|
|
|
clutter_grab_pointer_for_device (ClutterActor *actor,
|
2011-02-15 11:50:26 +00:00
|
|
|
gint id_)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2011-10-12 15:17:39 +00:00
|
|
|
ClutterDeviceManager *manager;
|
2008-06-23 09:55:42 +00:00
|
|
|
ClutterInputDevice *dev;
|
|
|
|
|
|
|
|
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
|
|
|
/* essentially a global grab */
|
2011-02-15 11:50:26 +00:00
|
|
|
if (id_ == -1)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2011-10-10 15:45:20 +00:00
|
|
|
if (actor == NULL)
|
|
|
|
clutter_ungrab_pointer ();
|
|
|
|
else
|
|
|
|
clutter_grab_pointer (actor);
|
|
|
|
|
2008-06-23 09:55:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-12 15:17:39 +00:00
|
|
|
manager = clutter_device_manager_get_default ();
|
2012-04-26 12:23:29 +00:00
|
|
|
if (manager == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-10-12 15:17:39 +00:00
|
|
|
dev = clutter_device_manager_get_device (manager, id_);
|
2011-02-15 11:50:26 +00:00
|
|
|
if (dev == NULL)
|
2008-06-23 09:55:42 +00:00
|
|
|
return;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (dev->device_type != CLUTTER_POINTER_DEVICE)
|
2008-06-23 09:55:42 +00:00
|
|
|
return;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (actor == NULL)
|
|
|
|
clutter_input_device_ungrab (dev);
|
|
|
|
else
|
|
|
|
clutter_input_device_grab (dev, actor);
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-15 17:08:48 +00:00
|
|
|
/**
|
|
|
|
* clutter_ungrab_pointer:
|
|
|
|
*
|
|
|
|
* Removes an existing grab of the pointer.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_ungrab_pointer (void)
|
|
|
|
{
|
|
|
|
clutter_grab_pointer (NULL);
|
|
|
|
}
|
|
|
|
|
2008-06-27 21:13:19 +00:00
|
|
|
/**
|
|
|
|
* clutter_ungrab_pointer_for_device:
|
2011-02-15 11:50:26 +00:00
|
|
|
* @id_: a device id
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
2011-02-15 11:50:26 +00:00
|
|
|
* Removes an existing grab of the pointer events for device @id_.
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2011-10-10 15:45:20 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_input_device_ungrab() instead.
|
2008-06-27 21:13:19 +00:00
|
|
|
*/
|
2008-06-23 09:55:42 +00:00
|
|
|
void
|
2011-02-15 11:50:26 +00:00
|
|
|
clutter_ungrab_pointer_for_device (gint id_)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2011-10-12 15:17:39 +00:00
|
|
|
ClutterDeviceManager *manager;
|
|
|
|
ClutterInputDevice *device;
|
|
|
|
|
|
|
|
manager = clutter_device_manager_get_default ();
|
2012-04-26 12:23:29 +00:00
|
|
|
if (manager == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-10-12 15:17:39 +00:00
|
|
|
device = clutter_device_manager_get_device (manager, id_);
|
|
|
|
if (device != NULL)
|
|
|
|
clutter_input_device_ungrab (device);
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-15 17:08:48 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_pointer_grab:
|
|
|
|
*
|
|
|
|
* Queries the current pointer grab of clutter.
|
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): the actor currently holding the pointer grab, or NULL if there is no grab.
|
2007-11-15 17:08:48 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_get_pointer_grab (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2007-11-15 17:08:48 +00:00
|
|
|
|
|
|
|
return context->pointer_grab_actor;
|
|
|
|
}
|
2007-11-15 18:00:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_grab_keyboard:
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
*
|
2009-03-03 22:51:17 +00:00
|
|
|
* Grabs keyboard events, after the grab is done keyboard
|
|
|
|
* events (#ClutterActor::key-press-event and #ClutterActor::key-release-event)
|
|
|
|
* are delivered to this actor directly. The source set in the event will be
|
|
|
|
* the actor that would have received the event if the keyboard grab was not
|
|
|
|
* in effect.
|
|
|
|
*
|
|
|
|
* Like pointer grabs, keyboard grabs should only be used as a last
|
|
|
|
* resource.
|
|
|
|
*
|
|
|
|
* See also clutter_stage_set_key_focus() and clutter_actor_grab_key_focus()
|
|
|
|
* to perform a "soft" key grab and assign key focus to a specific actor.
|
2007-11-15 18:00:24 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_grab_keyboard (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
2008-02-20 14:16:54 +00:00
|
|
|
|
2009-06-17 16:59:54 +00:00
|
|
|
context = _clutter_context_get_default ();
|
2007-11-15 18:00:24 +00:00
|
|
|
|
|
|
|
if (context->keyboard_grab_actor == actor)
|
|
|
|
return;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (context->keyboard_grab_actor != NULL)
|
2007-11-15 18:00:24 +00:00
|
|
|
{
|
2011-10-10 15:45:20 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (context->keyboard_grab_actor,
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
NULL);
|
2007-11-15 18:00:24 +00:00
|
|
|
context->keyboard_grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
if (actor != NULL)
|
2007-11-15 18:00:24 +00:00
|
|
|
{
|
|
|
|
context->keyboard_grab_actor = actor;
|
|
|
|
|
2011-10-10 15:45:20 +00:00
|
|
|
g_signal_connect (context->keyboard_grab_actor, "destroy",
|
|
|
|
G_CALLBACK (on_grab_actor_destroy),
|
|
|
|
NULL);
|
2007-11-15 18:00:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_ungrab_keyboard:
|
|
|
|
*
|
|
|
|
* Removes an existing grab of the keyboard.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_ungrab_keyboard (void)
|
|
|
|
{
|
|
|
|
clutter_grab_keyboard (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_get_keyboard_grab:
|
|
|
|
*
|
|
|
|
* Queries the current keyboard grab of clutter.
|
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): the actor currently holding the keyboard grab, or NULL if there is no grab.
|
2007-11-15 18:00:24 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_get_keyboard_grab (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
2009-06-17 16:59:54 +00:00
|
|
|
|
|
|
|
context = _clutter_context_get_default ();
|
2007-11-15 18:00:24 +00:00
|
|
|
|
|
|
|
return context->keyboard_grab_actor;
|
|
|
|
}
|
2007-11-19 16:30:56 +00:00
|
|
|
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
/**
|
|
|
|
* clutter_clear_glyph_cache:
|
|
|
|
*
|
|
|
|
* Clears the internal cache of glyphs used by the Pango
|
|
|
|
* renderer. This will free up some memory and GL texture
|
|
|
|
* resources. The cache will be automatically refilled as more text is
|
|
|
|
* drawn.
|
2008-09-23 07:03:35 +00:00
|
|
|
*
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
* Since: 0.8
|
2011-10-10 16:00:28 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_get_font_map() and
|
|
|
|
* cogl_pango_font_map_clear_glyph_cache() instead.
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_clear_glyph_cache (void)
|
|
|
|
{
|
2010-06-09 10:53:58 +00:00
|
|
|
CoglPangoFontMap *font_map;
|
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
font_map = clutter_context_get_pango_fontmap ();
|
2010-06-09 10:53:58 +00:00
|
|
|
cogl_pango_font_map_clear_glyph_cache (font_map);
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-01-27 14:25:50 +00:00
|
|
|
* clutter_set_font_flags:
|
|
|
|
* @flags: The new flags
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
*
|
2009-01-27 14:25:50 +00:00
|
|
|
* Sets the font quality options for subsequent text rendering
|
|
|
|
* operations.
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
*
|
2009-01-27 14:25:50 +00:00
|
|
|
* Using mipmapped textures will improve the quality for scaled down
|
|
|
|
* text but will use more texture memory.
|
|
|
|
*
|
|
|
|
* Enabling hinting improves text quality for static text but may
|
2009-01-27 16:55:25 +00:00
|
|
|
* introduce some artifacts if the text is animated.
|
2009-01-27 14:25:50 +00:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
2011-10-03 13:12:48 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_backend_set_font_options() and the
|
|
|
|
* #cairo_font_option_t API.
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
*/
|
|
|
|
void
|
2009-01-27 14:25:50 +00:00
|
|
|
clutter_set_font_flags (ClutterFontFlags flags)
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
{
|
2010-06-09 10:53:58 +00:00
|
|
|
CoglPangoFontMap *font_map;
|
2009-01-27 14:25:50 +00:00
|
|
|
ClutterFontFlags old_flags, changed_flags;
|
2009-02-26 15:32:48 +00:00
|
|
|
const cairo_font_options_t *font_options;
|
|
|
|
cairo_font_options_t *new_font_options;
|
2011-10-12 15:17:39 +00:00
|
|
|
cairo_hint_style_t hint_style;
|
2010-06-09 10:53:58 +00:00
|
|
|
gboolean use_mipmapping;
|
2009-02-26 15:32:48 +00:00
|
|
|
ClutterBackend *backend;
|
|
|
|
|
|
|
|
backend = clutter_get_default_backend ();
|
2011-02-18 15:47:35 +00:00
|
|
|
font_map = clutter_context_get_pango_fontmap ();
|
2011-10-12 15:17:39 +00:00
|
|
|
font_options = clutter_backend_get_font_options (backend);
|
|
|
|
old_flags = 0;
|
2009-01-27 14:25:50 +00:00
|
|
|
|
2011-10-12 15:17:39 +00:00
|
|
|
if (cogl_pango_font_map_get_use_mipmapping (font_map))
|
|
|
|
old_flags |= CLUTTER_FONT_MIPMAPPING;
|
|
|
|
|
|
|
|
hint_style = cairo_font_options_get_hint_style (font_options);
|
|
|
|
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
|
|
|
|
hint_style != CAIRO_HINT_STYLE_NONE)
|
|
|
|
old_flags |= CLUTTER_FONT_HINTING;
|
|
|
|
|
|
|
|
if (old_flags == flags)
|
|
|
|
return;
|
2009-01-27 14:25:50 +00:00
|
|
|
|
2009-02-26 15:32:48 +00:00
|
|
|
new_font_options = cairo_font_options_copy (font_options);
|
2009-01-27 14:25:50 +00:00
|
|
|
|
|
|
|
/* Only set the font options that have actually changed so we don't
|
|
|
|
override a detailed setting from the backend */
|
|
|
|
changed_flags = old_flags ^ flags;
|
|
|
|
|
2011-10-12 15:17:39 +00:00
|
|
|
if ((changed_flags & CLUTTER_FONT_MIPMAPPING))
|
|
|
|
{
|
|
|
|
use_mipmapping = (changed_flags & CLUTTER_FONT_MIPMAPPING) != 0;
|
|
|
|
|
|
|
|
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
|
|
|
}
|
|
|
|
|
2009-01-27 14:25:50 +00:00
|
|
|
if ((changed_flags & CLUTTER_FONT_HINTING))
|
2011-10-12 15:17:39 +00:00
|
|
|
{
|
|
|
|
hint_style = (flags & CLUTTER_FONT_HINTING)
|
|
|
|
? CAIRO_HINT_STYLE_FULL
|
|
|
|
: CAIRO_HINT_STYLE_NONE;
|
|
|
|
|
|
|
|
cairo_font_options_set_hint_style (new_font_options, hint_style);
|
|
|
|
}
|
2009-01-27 14:25:50 +00:00
|
|
|
|
2009-02-26 15:32:48 +00:00
|
|
|
clutter_backend_set_font_options (backend, new_font_options);
|
2009-01-27 16:55:25 +00:00
|
|
|
|
2009-02-26 15:32:48 +00:00
|
|
|
cairo_font_options_destroy (new_font_options);
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
2008-05-28 14:03:28 +00:00
|
|
|
}
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
|
|
|
|
/**
|
2009-01-27 14:25:50 +00:00
|
|
|
* clutter_get_font_flags:
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
*
|
2009-01-27 14:25:50 +00:00
|
|
|
* Gets the current font flags for rendering text. See
|
|
|
|
* clutter_set_font_flags().
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
*
|
2009-01-27 14:25:50 +00:00
|
|
|
* Return value: The font flags
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
*
|
2009-01-27 14:25:50 +00:00
|
|
|
* Since: 1.0
|
2011-10-03 13:12:48 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_backend_get_font_options() and the
|
|
|
|
* #cairo_font_options_t API.
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
*/
|
2009-01-27 14:25:50 +00:00
|
|
|
ClutterFontFlags
|
|
|
|
clutter_get_font_flags (void)
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
{
|
2008-10-30 17:11:29 +00:00
|
|
|
CoglPangoFontMap *font_map = NULL;
|
2009-02-26 15:32:48 +00:00
|
|
|
const cairo_font_options_t *font_options;
|
2009-01-27 14:25:50 +00:00
|
|
|
ClutterFontFlags flags = 0;
|
2011-02-18 15:47:35 +00:00
|
|
|
cairo_hint_style_t hint_style;
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
font_map = clutter_context_get_pango_fontmap ();
|
2010-06-09 10:53:58 +00:00
|
|
|
if (cogl_pango_font_map_get_use_mipmapping (font_map))
|
2009-01-27 14:25:50 +00:00
|
|
|
flags |= CLUTTER_FONT_MIPMAPPING;
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
font_options =
|
|
|
|
clutter_backend_get_font_options (clutter_get_default_backend ());
|
2009-01-27 14:25:50 +00:00
|
|
|
|
2011-02-18 15:47:35 +00:00
|
|
|
hint_style = cairo_font_options_get_hint_style (font_options);
|
|
|
|
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
|
|
|
|
hint_style != CAIRO_HINT_STYLE_NONE)
|
2009-01-27 14:25:50 +00:00
|
|
|
flags |= CLUTTER_FONT_HINTING;
|
|
|
|
|
|
|
|
return flags;
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
}
|
2008-06-23 09:55:42 +00:00
|
|
|
|
2008-06-27 21:13:19 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_input_device_for_id:
|
2011-02-15 11:50:26 +00:00
|
|
|
* @id_: the unique id for a device
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
2011-02-15 11:50:26 +00:00
|
|
|
* Retrieves the #ClutterInputDevice from its @id_. This is a convenience
|
2009-11-20 15:35:40 +00:00
|
|
|
* wrapper for clutter_device_manager_get_device() and it is functionally
|
|
|
|
* equivalent to:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* ClutterDeviceManager *manager;
|
|
|
|
* ClutterInputDevice *device;
|
|
|
|
*
|
|
|
|
* manager = clutter_device_manager_get_default ();
|
|
|
|
* device = clutter_device_manager_get_device (manager, id);
|
|
|
|
* ]|
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): a #ClutterInputDevice, or %NULL
|
2008-06-27 21:13:19 +00:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2011-10-10 15:57:18 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_device_manager_get_device() instead.
|
2008-06-27 21:13:19 +00:00
|
|
|
*/
|
|
|
|
ClutterInputDevice *
|
2011-02-15 11:50:26 +00:00
|
|
|
clutter_get_input_device_for_id (gint id_)
|
2008-06-23 09:55:42 +00:00
|
|
|
{
|
2009-11-20 15:35:40 +00:00
|
|
|
ClutterDeviceManager *manager;
|
2008-06-23 09:55:42 +00:00
|
|
|
|
2009-11-20 15:35:40 +00:00
|
|
|
manager = clutter_device_manager_get_default ();
|
2012-04-26 12:23:29 +00:00
|
|
|
if (manager == NULL)
|
|
|
|
return NULL;
|
2008-06-23 09:55:42 +00:00
|
|
|
|
2011-02-15 11:50:26 +00:00
|
|
|
return clutter_device_manager_get_device (manager, id_);
|
2008-06-23 09:55:42 +00:00
|
|
|
}
|
2008-10-30 17:11:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_get_font_map:
|
|
|
|
*
|
|
|
|
* Retrieves the #PangoFontMap instance used by Clutter.
|
|
|
|
* You can use the global font map object with the COGL
|
|
|
|
* Pango API.
|
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): the #PangoFontMap instance. The returned
|
|
|
|
* value is owned by Clutter and it should never be unreferenced.
|
2008-10-30 17:11:29 +00:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
PangoFontMap *
|
|
|
|
clutter_get_font_map (void)
|
|
|
|
{
|
2011-02-18 15:47:35 +00:00
|
|
|
return PANGO_FONT_MAP (clutter_context_get_pango_fontmap ());
|
2008-10-30 17:11:29 +00:00
|
|
|
}
|
2009-03-30 12:49:03 +00:00
|
|
|
|
|
|
|
typedef struct _ClutterRepaintFunction
|
|
|
|
{
|
|
|
|
guint id;
|
2012-03-06 12:09:00 +00:00
|
|
|
ClutterRepaintFlags flags;
|
2009-03-30 12:49:03 +00:00
|
|
|
GSourceFunc func;
|
|
|
|
gpointer data;
|
|
|
|
GDestroyNotify notify;
|
|
|
|
} ClutterRepaintFunction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_remove_repaint_func:
|
|
|
|
* @handle_id: an unsigned integer greater than zero
|
|
|
|
*
|
|
|
|
* Removes the repaint function with @handle_id as its id
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_remove_repaint_func (guint handle_id)
|
|
|
|
{
|
|
|
|
ClutterRepaintFunction *repaint_func;
|
|
|
|
ClutterMainContext *context;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
g_return_if_fail (handle_id > 0);
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
_clutter_context_lock ();
|
|
|
|
|
|
|
|
context = clutter_context_get_default_unlocked ();
|
2009-03-30 12:49:03 +00:00
|
|
|
l = context->repaint_funcs;
|
|
|
|
while (l != NULL)
|
|
|
|
{
|
|
|
|
repaint_func = l->data;
|
|
|
|
|
|
|
|
if (repaint_func->id == handle_id)
|
|
|
|
{
|
|
|
|
context->repaint_funcs =
|
|
|
|
g_list_remove_link (context->repaint_funcs, l);
|
|
|
|
|
|
|
|
g_list_free (l);
|
|
|
|
|
|
|
|
if (repaint_func->notify)
|
|
|
|
repaint_func->notify (repaint_func->data);
|
|
|
|
|
|
|
|
g_slice_free (ClutterRepaintFunction, repaint_func);
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
break;
|
2009-03-30 12:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
l = l->next;
|
|
|
|
}
|
2011-09-01 16:12:46 +00:00
|
|
|
|
|
|
|
_clutter_context_unlock ();
|
2009-03-30 12:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_repaint_func:
|
|
|
|
* @func: the function to be called within the paint cycle
|
|
|
|
* @data: data to be passed to the function, or %NULL
|
|
|
|
* @notify: function to be called when removing the repaint
|
|
|
|
* function, or %NULL
|
|
|
|
*
|
2012-03-06 12:09:00 +00:00
|
|
|
* Adds a function to be called whenever Clutter is processing a new
|
|
|
|
* frame.
|
|
|
|
*
|
2009-03-30 12:49:03 +00:00
|
|
|
* If the function returns %FALSE it is automatically removed from the
|
|
|
|
* list of repaint functions and will not be called again.
|
|
|
|
*
|
|
|
|
* This function is guaranteed to be called from within the same thread
|
2012-03-06 12:09:00 +00:00
|
|
|
* that called clutter_main(), and while the Clutter lock is being held;
|
|
|
|
* the function will be called within the main loop, so it is imperative
|
|
|
|
* that it does not block, otherwise the frame time budget may be lost.
|
2009-03-30 12:49:03 +00:00
|
|
|
*
|
|
|
|
* A repaint function is useful to ensure that an update of the scenegraph
|
|
|
|
* is performed before the scenegraph is repainted; for instance, uploading
|
2012-03-06 12:09:00 +00:00
|
|
|
* a frame from a video into a #ClutterTexture. By default, a repaint
|
|
|
|
* function added using this function will be invoked prior to the frame
|
|
|
|
* being processed.
|
|
|
|
*
|
|
|
|
* Adding a repaint function does not automatically ensure that a new
|
|
|
|
* frame will be queued.
|
2009-03-30 12:49:03 +00:00
|
|
|
*
|
|
|
|
* When the repaint function is removed (either because it returned %FALSE
|
|
|
|
* or because clutter_threads_remove_repaint_func() has been called) the
|
|
|
|
* @notify function will be called, if any is set.
|
|
|
|
*
|
2012-03-06 12:09:00 +00:00
|
|
|
* See also: clutter_threads_add_repaint_func_full()
|
|
|
|
*
|
2009-03-30 12:49:03 +00:00
|
|
|
* Return value: the ID (greater than 0) of the repaint function. You
|
|
|
|
* can use the returned integer to remove the repaint function by
|
|
|
|
* calling clutter_threads_remove_repaint_func().
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_repaint_func (GSourceFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify)
|
2012-03-06 12:09:00 +00:00
|
|
|
{
|
|
|
|
return clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_PRE_PAINT,
|
|
|
|
func,
|
|
|
|
data, notify);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_repaint_func_full:
|
|
|
|
* @flags: flags for the repaint function
|
|
|
|
* @func: the function to be called within the paint cycle
|
|
|
|
* @data: data to be passed to the function, or %NULL
|
|
|
|
* @notify: function to be called when removing the repaint
|
|
|
|
* function, or %NULL
|
|
|
|
*
|
|
|
|
* Adds a function to be called whenever Clutter is processing a new
|
|
|
|
* frame.
|
|
|
|
*
|
|
|
|
* If the function returns %FALSE it is automatically removed from the
|
|
|
|
* list of repaint functions and will not be called again.
|
|
|
|
*
|
|
|
|
* This function is guaranteed to be called from within the same thread
|
|
|
|
* that called clutter_main(), and while the Clutter lock is being held;
|
|
|
|
* the function will be called within the main loop, so it is imperative
|
|
|
|
* that it does not block, otherwise the frame time budget may be lost.
|
|
|
|
*
|
|
|
|
* A repaint function is useful to ensure that an update of the scenegraph
|
|
|
|
* is performed before the scenegraph is repainted; for instance, uploading
|
|
|
|
* a frame from a video into a #ClutterTexture. The @flags passed to this
|
|
|
|
* function will determine the section of the frame processing that will
|
|
|
|
* result in @func being called.
|
|
|
|
*
|
|
|
|
* Adding a repaint function does not automatically ensure that a new
|
|
|
|
* frame will be queued.
|
|
|
|
*
|
|
|
|
* When the repaint function is removed (either because it returned %FALSE
|
|
|
|
* or because clutter_threads_remove_repaint_func() has been called) the
|
|
|
|
* @notify function will be called, if any is set.
|
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the repaint function. You
|
|
|
|
* can use the returned integer to remove the repaint function by
|
|
|
|
* calling clutter_threads_remove_repaint_func().
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
|
|
|
|
GSourceFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify)
|
2009-03-30 12:49:03 +00:00
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
ClutterRepaintFunction *repaint_func;
|
|
|
|
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
_clutter_context_lock ();
|
2009-03-30 12:49:03 +00:00
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
context = clutter_context_get_default_unlocked ();
|
2009-03-30 12:49:03 +00:00
|
|
|
|
|
|
|
repaint_func = g_slice_new (ClutterRepaintFunction);
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
repaint_func->id = context->last_repaint_id++;
|
2012-03-06 12:09:00 +00:00
|
|
|
|
|
|
|
/* mask out QUEUE_REDRAW_ON_ADD, since we're going to consume it */
|
|
|
|
repaint_func->flags = flags & ~CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD;
|
2009-03-30 12:49:03 +00:00
|
|
|
repaint_func->func = func;
|
|
|
|
repaint_func->data = data;
|
|
|
|
repaint_func->notify = notify;
|
|
|
|
|
|
|
|
context->repaint_funcs = g_list_prepend (context->repaint_funcs,
|
|
|
|
repaint_func);
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
_clutter_context_unlock ();
|
2009-03-30 12:49:03 +00:00
|
|
|
|
2012-03-06 12:09:00 +00:00
|
|
|
if ((flags & CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD) != 0)
|
|
|
|
{
|
|
|
|
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
|
|
|
|
|
|
|
_clutter_master_clock_ensure_next_iteration (master_clock);
|
|
|
|
}
|
|
|
|
|
2009-03-30 12:49:03 +00:00
|
|
|
return repaint_func->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* _clutter_run_repaint_functions:
|
2012-03-06 12:09:00 +00:00
|
|
|
* @flags: only run the repaint functions matching the passed flags
|
2009-03-30 12:49:03 +00:00
|
|
|
*
|
|
|
|
* Executes the repaint functions added using the
|
|
|
|
* clutter_threads_add_repaint_func() function.
|
|
|
|
*
|
2012-03-06 12:09:00 +00:00
|
|
|
* Must be called with the Clutter thread lock held.
|
2009-03-30 12:49:03 +00:00
|
|
|
*/
|
|
|
|
void
|
2012-03-06 12:09:00 +00:00
|
|
|
_clutter_run_repaint_functions (ClutterRepaintFlags flags)
|
2009-03-30 12:49:03 +00:00
|
|
|
{
|
2011-02-18 15:47:35 +00:00
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
2009-03-30 12:49:03 +00:00
|
|
|
ClutterRepaintFunction *repaint_func;
|
2011-09-01 16:12:46 +00:00
|
|
|
GList *invoke_list, *reinvoke_list, *l;
|
2009-03-30 12:49:03 +00:00
|
|
|
|
|
|
|
if (context->repaint_funcs == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
/* steal the list */
|
|
|
|
invoke_list = context->repaint_funcs;
|
|
|
|
context->repaint_funcs = NULL;
|
|
|
|
|
2009-03-30 12:49:03 +00:00
|
|
|
reinvoke_list = NULL;
|
|
|
|
|
|
|
|
/* consume the whole list while we execute the functions */
|
2011-09-01 16:12:46 +00:00
|
|
|
while (invoke_list != NULL)
|
2009-03-30 12:49:03 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
repaint_func = invoke_list->data;
|
2009-03-30 12:49:03 +00:00
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
l = invoke_list;
|
|
|
|
invoke_list = g_list_remove_link (invoke_list, invoke_list);
|
2009-03-30 12:49:03 +00:00
|
|
|
|
|
|
|
g_list_free (l);
|
|
|
|
|
2012-03-06 12:09:00 +00:00
|
|
|
if ((repaint_func->flags & flags) != 0)
|
|
|
|
res = repaint_func->func (repaint_func->data);
|
|
|
|
else
|
|
|
|
res = TRUE;
|
2009-03-30 12:49:03 +00:00
|
|
|
|
|
|
|
if (res)
|
|
|
|
reinvoke_list = g_list_prepend (reinvoke_list, repaint_func);
|
|
|
|
else
|
|
|
|
{
|
2011-09-01 16:12:46 +00:00
|
|
|
if (repaint_func->notify != NULL)
|
2009-03-30 12:49:03 +00:00
|
|
|
repaint_func->notify (repaint_func->data);
|
|
|
|
|
|
|
|
g_slice_free (ClutterRepaintFunction, repaint_func);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-01 16:12:46 +00:00
|
|
|
if (context->repaint_funcs != NULL)
|
|
|
|
{
|
|
|
|
context->repaint_funcs = g_list_concat (context->repaint_funcs,
|
|
|
|
g_list_reverse (reinvoke_list));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
context->repaint_funcs = g_list_reverse (reinvoke_list);
|
2009-03-30 12:49:03 +00:00
|
|
|
}
|
2009-10-30 11:02:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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));
|
|
|
|
}
|
2009-11-06 16:50:53 +00:00
|
|
|
|
2009-12-07 19:00:55 +00:00
|
|
|
/**
|
|
|
|
* clutter_get_default_text_direction:
|
|
|
|
*
|
|
|
|
* Retrieves the default direction for the text. The text direction is
|
2015-03-11 15:39:42 +00:00
|
|
|
* determined by the locale and/or by the `CLUTTER_TEXT_DIRECTION`
|
2011-09-12 12:12:14 +00:00
|
|
|
* environment variable.
|
2009-12-07 19:00:55 +00:00
|
|
|
*
|
|
|
|
* The default text direction can be overridden on a per-actor basis by using
|
2011-09-12 12:12:14 +00:00
|
|
|
* clutter_actor_set_text_direction().
|
2009-12-07 19:00:55 +00:00
|
|
|
*
|
|
|
|
* Return value: the default text direction
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
2009-11-06 16:50:53 +00:00
|
|
|
ClutterTextDirection
|
|
|
|
clutter_get_default_text_direction (void)
|
|
|
|
{
|
|
|
|
return clutter_text_direction;
|
|
|
|
}
|
2011-02-09 12:38:10 +00:00
|
|
|
|
|
|
|
/*< private >
|
|
|
|
* clutter_clear_events_queue:
|
|
|
|
*
|
|
|
|
* Clears the events queue stored in the main context.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_clutter_clear_events_queue (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (context->events_queue != NULL)
|
|
|
|
{
|
|
|
|
g_queue_foreach (context->events_queue,
|
|
|
|
(GFunc) clutter_event_free,
|
|
|
|
NULL);
|
|
|
|
g_queue_free (context->events_queue);
|
|
|
|
context->events_queue = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_clear_events_queue_for_stage (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
GList *l, *next;
|
|
|
|
|
|
|
|
if (context->events_queue == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Remove any pending events for this stage from the event queue */
|
|
|
|
for (l = context->events_queue->head; l; l = next)
|
|
|
|
{
|
|
|
|
ClutterEvent *event = l->data;
|
|
|
|
|
|
|
|
next = l->next;
|
|
|
|
|
|
|
|
if (event->any.stage == stage)
|
|
|
|
{
|
|
|
|
g_queue_delete_link (context->events_queue, l);
|
|
|
|
clutter_event_free (event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-02-18 12:07:07 +00:00
|
|
|
|
|
|
|
ClutterPickMode
|
|
|
|
_clutter_context_get_pick_mode (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
return context->pick_mode;
|
|
|
|
}
|
2011-02-18 15:44:17 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_context_push_shader_stack (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
context->shaders = g_slist_prepend (context->shaders, actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClutterActor *
|
|
|
|
_clutter_context_peek_shader_stack (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (context->shaders != NULL)
|
|
|
|
return context->shaders->data;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ClutterActor *
|
|
|
|
_clutter_context_pop_shader_stack (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
context->shaders = g_slist_remove (context->shaders, actor);
|
|
|
|
|
|
|
|
return _clutter_context_peek_shader_stack ();
|
|
|
|
}
|
2011-06-20 12:53:09 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
_clutter_context_get_motion_events_enabled (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
return context->motion_events_per_actor;
|
|
|
|
}
|
2011-09-26 12:14:26 +00:00
|
|
|
|
|
|
|
/**
|
2011-10-17 15:03:19 +00:00
|
|
|
* clutter_check_windowing_backend:
|
2011-09-26 12:14:26 +00:00
|
|
|
* @backend_type: the name of the backend to check
|
|
|
|
*
|
2011-10-17 15:03:19 +00:00
|
|
|
* Checks the run-time name of the Clutter windowing system backend, using
|
2016-01-12 16:23:09 +00:00
|
|
|
* the symbolic macros like %CLUTTER_WINDOWING_X11.
|
2011-10-17 15:03:19 +00:00
|
|
|
*
|
|
|
|
* This function should be used in conjuction with the compile-time macros
|
|
|
|
* inside applications and libraries that are using the platform-specific
|
|
|
|
* windowing system API, to ensure that they are running on the correct
|
|
|
|
* windowing system; for instance:
|
2011-09-26 12:14:26 +00:00
|
|
|
*
|
2011-10-17 15:03:19 +00:00
|
|
|
* |[
|
2014-03-17 23:07:58 +00:00
|
|
|
* #ifdef CLUTTER_WINDOWING_X11
|
2011-10-17 15:03:19 +00:00
|
|
|
* if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
|
|
|
* {
|
2014-03-17 23:07:58 +00:00
|
|
|
* // it is safe to use the clutter_x11_* API
|
2011-10-17 15:03:19 +00:00
|
|
|
* }
|
|
|
|
* else
|
2014-03-17 23:07:58 +00:00
|
|
|
* #endif
|
2011-10-17 15:03:19 +00:00
|
|
|
* g_error ("Unknown Clutter backend.");
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the current Clutter windowing system backend is
|
|
|
|
* the one checked, and %FALSE otherwise
|
2011-09-26 12:14:26 +00:00
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
gboolean
|
2011-10-17 15:03:19 +00:00
|
|
|
clutter_check_windowing_backend (const char *backend_type)
|
2011-09-26 12:14:26 +00:00
|
|
|
{
|
|
|
|
ClutterMainContext *context = _clutter_context_get_default ();
|
|
|
|
|
|
|
|
g_return_val_if_fail (backend_type != NULL, FALSE);
|
|
|
|
|
2011-10-17 15:03:19 +00:00
|
|
|
backend_type = g_intern_string (backend_type);
|
|
|
|
|
2011-09-26 12:14:26 +00:00
|
|
|
#ifdef CLUTTER_WINDOWING_WAYLAND
|
2011-10-17 15:03:19 +00:00
|
|
|
if (backend_type == I_(CLUTTER_WINDOWING_WAYLAND) &&
|
2011-09-26 12:14:26 +00:00
|
|
|
CLUTTER_IS_BACKEND_WAYLAND (context->backend))
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef CLUTTER_WINDOWING_EGL
|
2011-10-17 15:03:19 +00:00
|
|
|
if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
|
2011-09-26 12:14:26 +00:00
|
|
|
CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
#endif
|
2011-10-17 15:03:19 +00:00
|
|
|
#ifdef CLUTTER_WINDOWING_X11
|
|
|
|
if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
|
|
|
|
CLUTTER_IS_BACKEND_X11 (context->backend))
|
2011-09-26 12:14:26 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-04 16:35:38 +00:00
|
|
|
|
2013-12-12 18:11:03 +00:00
|
|
|
void
|
|
|
|
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
|
|
|
|
{
|
|
|
|
clutter_sync_to_vblank = !!sync_to_vblank;
|
|
|
|
}
|
|
|
|
|
2011-11-04 16:35:38 +00:00
|
|
|
gboolean
|
|
|
|
_clutter_get_sync_to_vblank (void)
|
|
|
|
{
|
|
|
|
return clutter_sync_to_vblank;
|
|
|
|
}
|
2011-11-15 17:39:49 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_debug_messagev (const char *format,
|
|
|
|
va_list var_args)
|
|
|
|
{
|
2012-06-07 10:51:33 +00:00
|
|
|
static gint64 last_debug_stamp;
|
2011-11-15 17:39:49 +00:00
|
|
|
gchar *stamp, *fmt;
|
2012-06-07 10:51:33 +00:00
|
|
|
gint64 cur_time, debug_stamp;
|
|
|
|
|
|
|
|
cur_time = g_get_monotonic_time ();
|
|
|
|
|
|
|
|
/* if the last debug message happened less than a second ago, just
|
|
|
|
* show the increments instead of the full timestamp
|
|
|
|
*/
|
|
|
|
if (last_debug_stamp == 0 ||
|
|
|
|
cur_time - last_debug_stamp >= G_USEC_PER_SEC)
|
|
|
|
{
|
|
|
|
debug_stamp = cur_time;
|
|
|
|
last_debug_stamp = debug_stamp;
|
|
|
|
|
|
|
|
stamp = g_strdup_printf ("[%16" G_GINT64_FORMAT "]", debug_stamp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
debug_stamp = cur_time - last_debug_stamp;
|
|
|
|
|
|
|
|
stamp = g_strdup_printf ("[%+16" G_GINT64_FORMAT "]", debug_stamp);
|
|
|
|
}
|
2011-11-15 17:39:49 +00:00
|
|
|
|
|
|
|
fmt = g_strconcat (stamp, ":", format, NULL);
|
|
|
|
g_free (stamp);
|
|
|
|
|
|
|
|
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args);
|
|
|
|
|
|
|
|
g_free (fmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_debug_message (const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
_clutter_debug_messagev (format, args);
|
|
|
|
va_end (args);
|
|
|
|
}
|
2011-12-20 15:17:54 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
_clutter_diagnostic_enabled (void)
|
|
|
|
{
|
|
|
|
static const char *clutter_enable_diagnostic = NULL;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (clutter_enable_diagnostic == NULL))
|
|
|
|
{
|
|
|
|
clutter_enable_diagnostic = g_getenv ("CLUTTER_ENABLE_DIAGNOSTIC");
|
|
|
|
|
|
|
|
if (clutter_enable_diagnostic == NULL)
|
|
|
|
clutter_enable_diagnostic = "0";
|
|
|
|
}
|
|
|
|
|
|
|
|
return *clutter_enable_diagnostic != '0';
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_diagnostic_message (const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
char *fmt;
|
|
|
|
|
|
|
|
fmt = g_strconcat ("[DIAGNOSTIC]: ", format, NULL);
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
g_free (fmt);
|
|
|
|
}
|