2006-05-29 04:59:36 -04: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
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2006-06-21 18:34:25 -04:00
|
|
|
/**
|
|
|
|
* SECTION:clutter-main
|
2006-06-22 10:36:05 -04:00
|
|
|
* @short_description: Various 'global' clutter functions.
|
2006-06-21 18:34:25 -04:00
|
|
|
*
|
2006-06-22 10:36:05 -04:00
|
|
|
* Functions to retrieve various global Clutter resources and other utility
|
|
|
|
* functions for mainloops, events and threads
|
2006-06-21 18:34:25 -04: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 16:27:53 -05: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 09:38:31 -04: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 16:27:53 -05: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 09:38:31 -04:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2008-06-10 10:01:43 -04:00
|
|
|
#include <glib/gi18n-lib.h>
|
2008-06-10 17:25:23 -04: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 09:38:31 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
#include "clutter-event.h"
|
|
|
|
#include "clutter-backend.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
#include "clutter-main.h"
|
2009-03-21 16:39:32 -04:00
|
|
|
#include "clutter-master-clock.h"
|
2006-07-24 17:15:19 -04:00
|
|
|
#include "clutter-feature.h"
|
2006-06-13 09:17:45 -04:00
|
|
|
#include "clutter-actor.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
#include "clutter-stage.h"
|
|
|
|
#include "clutter-private.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 16:27:53 -05:00
|
|
|
#include "clutter-debug.h"
|
2007-02-13 18:31:57 -05:00
|
|
|
#include "clutter-version.h" /* For flavour define */
|
2008-04-17 12:50:23 -04:00
|
|
|
#include "clutter-frame-source.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 16:27:53 -05:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
#include "cogl/cogl.h"
|
2008-10-30 13:11:29 -04:00
|
|
|
#include "pango/cogl-pango.h"
|
2007-05-28 14:49:34 -04:00
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
/* main context */
|
2008-12-23 11:40:26 -05:00
|
|
|
static ClutterMainContext *ClutterCntx = NULL;
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
/* main lock and locking/unlocking functions */
|
2008-12-23 11:40:26 -05:00
|
|
|
static GMutex *clutter_threads_mutex = NULL;
|
|
|
|
static GCallback clutter_threads_lock = NULL;
|
|
|
|
static GCallback clutter_threads_unlock = NULL;
|
2007-08-08 06:20:14 -04:00
|
|
|
|
2009-02-23 08:08:59 -05:00
|
|
|
/* command line options */
|
2008-12-23 11:40:26 -05:00
|
|
|
static gboolean clutter_is_initialized = FALSE;
|
|
|
|
static gboolean clutter_show_fps = FALSE;
|
|
|
|
static gboolean clutter_fatal_warnings = FALSE;
|
2009-02-23 08:08:59 -05:00
|
|
|
static gboolean clutter_disable_mipmap_text = FALSE;
|
2009-02-23 08:17:06 -05:00
|
|
|
static gboolean clutter_use_fuzzy_picking = 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 16:27:53 -05:00
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
static guint clutter_default_fps = 60;
|
2007-10-26 11:47:39 -04:00
|
|
|
|
2009-02-23 08:08:59 -05:00
|
|
|
static PangoDirection clutter_text_direction = PANGO_DIRECTION_LTR;
|
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
static guint clutter_main_loop_level = 0;
|
|
|
|
static GSList *main_loops = 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 16:27:53 -05:00
|
|
|
guint clutter_debug_flags = 0; /* global clutter debug flag */
|
|
|
|
|
|
|
|
#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 },
|
|
|
|
{ "gl", CLUTTER_DEBUG_GL },
|
|
|
|
{ "alpha", CLUTTER_DEBUG_ALPHA },
|
|
|
|
{ "behaviour", CLUTTER_DEBUG_BEHAVIOUR },
|
|
|
|
{ "pango", CLUTTER_DEBUG_PANGO },
|
2007-04-27 20:37:11 -04:00
|
|
|
{ "backend", CLUTTER_DEBUG_BACKEND },
|
2007-06-07 19:51:53 -04:00
|
|
|
{ "scheduler", CLUTTER_DEBUG_SCHEDULER },
|
2007-10-08 11:03:22 -04:00
|
|
|
{ "script", CLUTTER_DEBUG_SCRIPT },
|
2007-12-05 16:15:19 -05:00
|
|
|
{ "shader", CLUTTER_DEBUG_SHADER },
|
2008-03-28 18:50:55 -04:00
|
|
|
{ "multistage", CLUTTER_DEBUG_MULTISTAGE },
|
2009-04-15 12:25:50 -04:00
|
|
|
{ "animation", CLUTTER_DEBUG_ANIMATION },
|
|
|
|
{ "layout", CLUTTER_DEBUG_LAYOUT }
|
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 16:27:53 -05:00
|
|
|
};
|
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/**
|
|
|
|
* clutter_get_show_fps:
|
|
|
|
*
|
2007-08-08 06:20:14 -04: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 14:21:59 -04:00
|
|
|
*
|
2007-08-08 06:20:14 -04:00
|
|
|
* Return value: %TRUE if Clutter should show the FPS.
|
2007-03-22 14:21:59 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-01-23 15:29:11 -05:00
|
|
|
gboolean
|
2007-03-22 14:21:59 -04:00
|
|
|
clutter_get_show_fps (void)
|
2006-05-29 04:59:36 -04: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 16:27:53 -05:00
|
|
|
return clutter_show_fps;
|
2006-05-29 04:59:36 -04: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 13:07:52 -04:00
|
|
|
void
|
|
|
|
_clutter_stage_maybe_relayout (ClutterActor *stage)
|
|
|
|
{
|
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 11:44:47 -04:00
|
|
|
gfloat natural_width, natural_height;
|
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 13:07:52 -04:00
|
|
|
ClutterActorBox box = { 0, };
|
|
|
|
|
|
|
|
/* avoid reentrancy */
|
|
|
|
if (!(CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_RELAYOUT))
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (ACTOR, "Recomputing layout");
|
|
|
|
|
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IN_RELAYOUT);
|
|
|
|
|
|
|
|
natural_width = natural_height = 0;
|
|
|
|
clutter_actor_get_preferred_size (stage,
|
|
|
|
NULL, NULL,
|
|
|
|
&natural_width, &natural_height);
|
|
|
|
|
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = natural_width;
|
|
|
|
box.y2 = natural_height;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
|
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 11:44:47 -04:00
|
|
|
(int) natural_width,
|
|
|
|
(int) natural_height);
|
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 13:07:52 -04:00
|
|
|
|
|
|
|
clutter_actor_allocate (stage, &box, FALSE);
|
|
|
|
|
|
|
|
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IN_RELAYOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_maybe_setup_viewport (ClutterStage *stage)
|
2008-04-04 11:02:11 -04:00
|
|
|
{
|
2009-01-12 06:15:41 -05:00
|
|
|
if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES)
|
2008-04-04 11:02:11 -04:00
|
|
|
{
|
|
|
|
ClutterPerspective perspective;
|
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 11:44:47 -04:00
|
|
|
gfloat width, height;
|
2008-04-04 11:02:11 -04:00
|
|
|
|
|
|
|
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
|
[stage] Coalesce fog and perspective API
The fog and perspective API is currently split in two parts:
- the floating point version, using values
- the fixed point version, using structures
The relative properties are using the structure types, since they
are meant to set multiple values at the same time. Instead of
using bare values, the whole API should be coalesced into two
simple calls using structures to match the GObject properties.
Thus:
clutter_stage_set_fog (ClutterStage*, const ClutterFog*)
clutter_stage_get_fog (ClutterStage*, ClutterFog*)
clutter_stage_set_perspective (ClutterStage*, const ClutterPerspective*)
clutter_stage_get_perspective (ClutterStage*, ClutterPerspective*)
Which supercedes the fixed point and floating point variants.
More importantly, both ClutterFog and ClutterPerspective should
using floating point values, since that's what get passed to
COGL anyway.
ClutterFog should also drop the "density" member, since ClutterStage
only allows linear fog; non-linear fog distribution can be achieved
using a signal handler and calling cogl_set_fog() directly; this keeps
the API compact yet extensible.
Finally, there is no ClutterStage:fog so it should be added.
2009-03-09 13:24:44 -04:00
|
|
|
clutter_stage_get_perspective (stage, &perspective);
|
2008-04-04 11:02:11 -04:00
|
|
|
|
|
|
|
CLUTTER_NOTE (PAINT, "Setting up the viewport");
|
|
|
|
|
|
|
|
cogl_setup_viewport (width, height,
|
|
|
|
perspective.fovy,
|
|
|
|
perspective.aspect,
|
|
|
|
perspective.z_near,
|
|
|
|
perspective.z_far);
|
|
|
|
|
|
|
|
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
|
|
|
}
|
|
|
|
}
|
2007-01-16 09:37:54 -05: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 09:38:31 -04:00
|
|
|
/**
|
|
|
|
* clutter_redraw:
|
|
|
|
*
|
2007-08-08 06:20:14 -04:00
|
|
|
* Forces a redraw of the entire stage. Applications should never use this
|
|
|
|
* function, but queue a redraw using clutter_actor_queue_redraw().
|
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 09:38:31 -04:00
|
|
|
*/
|
2006-05-29 04:59:36 -04:00
|
|
|
void
|
2008-03-28 18:50:55 -04:00
|
|
|
clutter_redraw (ClutterStage *stage)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2007-03-22 14:21:59 -04:00
|
|
|
ClutterMainContext *ctx;
|
2009-05-07 14:07:21 -04:00
|
|
|
ClutterMasterClock *master_clock;
|
2009-03-21 16:39:32 -04:00
|
|
|
static GTimer *timer = NULL;
|
|
|
|
static guint timer_n_frames = 0;
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-05-28 14:49:34 -04:00
|
|
|
ctx = clutter_context_get_default ();
|
2009-05-07 14:07:21 -04:00
|
|
|
master_clock = _clutter_master_clock_get_default ();
|
2007-05-28 14:49:34 -04: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 13:07:52 -04:00
|
|
|
/* Before we can paint, we have to be sure we have the latest layout */
|
|
|
|
_clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
|
|
|
|
|
2008-03-28 18:50:55 -04:00
|
|
|
_clutter_backend_ensure_context (ctx->backend, stage);
|
2007-06-07 19:51:53 -04:00
|
|
|
|
2008-03-28 18:50:55 -04:00
|
|
|
/* Setup FPS count - not currently across *all* stages rather than per */
|
2008-04-04 11:02:11 -04:00
|
|
|
if (G_UNLIKELY (clutter_get_show_fps ()))
|
2007-05-28 14:49:34 -04:00
|
|
|
{
|
|
|
|
if (!timer)
|
|
|
|
timer = g_timer_new ();
|
|
|
|
}
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
/* The code below can't go in stage paint as base actor_paint
|
|
|
|
* will get called before it (and break picking, etc)
|
|
|
|
*/
|
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 13:07:52 -04:00
|
|
|
_clutter_stage_maybe_setup_viewport (stage);
|
2007-05-28 14:49:34 -04:00
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
/* Call through to the actual backend to do the painting down from
|
2007-05-28 14:49:34 -04:00
|
|
|
* the stage. It will likely need to swap buffers, vblank sync etc
|
2009-05-07 14:07:21 -04:00
|
|
|
* which will be windowing system dependent
|
2007-05-28 14:49:34 -04:00
|
|
|
*/
|
2008-03-28 18:50:55 -04:00
|
|
|
_clutter_backend_redraw (ctx->backend, stage);
|
2007-05-28 14:49:34 -04:00
|
|
|
|
2009-05-07 14:07:21 -04:00
|
|
|
/* prepare for the next frame; if anything queues a redraw as the
|
|
|
|
* result of a timeline, this will end up redrawing the scene
|
|
|
|
*/
|
|
|
|
_clutter_master_clock_advance (master_clock);
|
|
|
|
|
2007-05-28 14:49:34 -04:00
|
|
|
/* Complete FPS info */
|
2008-04-04 11:02:11 -04:00
|
|
|
if (G_UNLIKELY (clutter_get_show_fps ()))
|
2007-05-28 14:49:34 -04:00
|
|
|
{
|
|
|
|
timer_n_frames++;
|
|
|
|
|
|
|
|
if (g_timer_elapsed (timer, NULL) >= 1.0)
|
|
|
|
{
|
|
|
|
g_print ("*** FPS: %i ***\n", timer_n_frames);
|
|
|
|
timer_n_frames = 0;
|
|
|
|
g_timer_start (timer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-28 18:50:55 -04:00
|
|
|
CLUTTER_TIMESTAMP (SCHEDULER, "Redraw finish for stage:%p", stage);
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-11-19 11:30:56 -05:00
|
|
|
/**
|
|
|
|
* clutter_set_motion_events_enabled:
|
|
|
|
* @enable: %TRUE to enable per-actor motion events
|
|
|
|
*
|
|
|
|
* Sets whether per-actor motion events should be enabled or not (the
|
|
|
|
* default is to enable them).
|
|
|
|
*
|
|
|
|
* If @enable is %FALSE the following events will not work:
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem><para>ClutterActor::motion-event, unless on the
|
|
|
|
* #ClutterStage</para></listitem>
|
|
|
|
* <listitem><para>ClutterActor::enter-event</para></listitem>
|
|
|
|
* <listitem><para>ClutterActor::leave-event</para></listitem>
|
|
|
|
* </itemizedlist>
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-08-13 16:48:01 -04:00
|
|
|
void
|
2007-11-19 11:30:56 -05:00
|
|
|
clutter_set_motion_events_enabled (gboolean enable)
|
2007-08-13 16:48:01 -04:00
|
|
|
{
|
2007-11-19 11:30:56 -05:00
|
|
|
ClutterMainContext *context = clutter_context_get_default ();
|
2007-08-13 16:48:01 -04:00
|
|
|
|
|
|
|
context->motion_events_per_actor = enable;
|
|
|
|
}
|
|
|
|
|
2007-11-19 11:30:56 -05: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
|
|
|
|
*/
|
2007-08-13 16:48:01 -04:00
|
|
|
gboolean
|
|
|
|
clutter_get_motion_events_enabled (void)
|
|
|
|
{
|
2007-11-19 11:30:56 -05:00
|
|
|
ClutterMainContext *context = clutter_context_get_default ();
|
2007-08-13 16:48:01 -04:00
|
|
|
|
|
|
|
return context->motion_events_per_actor;
|
|
|
|
}
|
|
|
|
|
2008-05-13 14:40:14 -04:00
|
|
|
guint _clutter_pix_to_id (guchar pixel[4]);
|
|
|
|
|
2008-05-13 19:02:45 -04:00
|
|
|
static inline void init_bits (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
|
|
|
|
|
|
|
static gboolean done = FALSE;
|
|
|
|
if (G_LIKELY (done))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ctx = clutter_context_get_default ();
|
|
|
|
|
|
|
|
done = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_id_to_color (guint id, ClutterColor *col)
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
|
|
|
gint red, green, blue;
|
|
|
|
ctx = clutter_context_get_default ();
|
|
|
|
|
|
|
|
/* compute the numbers we'll store in the components */
|
2008-09-23 03:03:35 -04:00
|
|
|
red = (id >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
|
2008-05-13 19:02:45 -04:00
|
|
|
& (0xff >> (8-ctx->fb_r_mask_used));
|
|
|
|
green = (id >> ctx->fb_b_mask_used) & (0xff >> (8-ctx->fb_g_mask_used));
|
|
|
|
blue = (id) & (0xff >> (8-ctx->fb_b_mask_used));
|
|
|
|
|
|
|
|
/* shift left bits a bit and add one, this circumvents
|
|
|
|
* at least some potential rounding errors in GL/GLES
|
2008-09-23 03:03:35 -04:00
|
|
|
* driver / hw implementation.
|
2008-05-13 19:02:45 -04:00
|
|
|
*/
|
|
|
|
if (ctx->fb_r_mask_used != ctx->fb_r_mask)
|
2008-11-06 07:03:05 -05:00
|
|
|
red = red * 2;
|
2008-05-13 19:02:45 -04:00
|
|
|
if (ctx->fb_g_mask_used != ctx->fb_g_mask)
|
2008-11-06 07:03:05 -05:00
|
|
|
green = green * 2;
|
2008-05-13 19:02:45 -04:00
|
|
|
if (ctx->fb_b_mask_used != ctx->fb_b_mask)
|
2008-11-06 07:03:05 -05:00
|
|
|
blue = blue * 2;
|
2008-05-13 19:02:45 -04:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
/* shift up to be full 8bit values */
|
2008-11-06 07:03:05 -05: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 19:02:45 -04:00
|
|
|
|
|
|
|
col->red = red;
|
|
|
|
col->green = green;
|
|
|
|
col->blue = blue;
|
|
|
|
col->alpha = 0xff;
|
|
|
|
}
|
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
guint
|
|
|
|
_clutter_pixel_to_id (guchar pixel[4])
|
2008-05-13 19:02:45 -04:00
|
|
|
{
|
|
|
|
ClutterMainContext *ctx;
|
|
|
|
gint red, green, blue;
|
|
|
|
guint id;
|
|
|
|
|
|
|
|
ctx = clutter_context_get_default ();
|
|
|
|
|
|
|
|
/* reduce the pixel components to the number of bits actually used of the
|
|
|
|
* 8bits.
|
|
|
|
*/
|
|
|
|
red = pixel[0] >> (8 - ctx->fb_r_mask);
|
|
|
|
green = pixel[1] >> (8 - ctx->fb_g_mask);
|
|
|
|
blue = pixel[2] >> (8 - ctx->fb_b_mask);
|
|
|
|
|
|
|
|
/* 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 03:03:35 -04:00
|
|
|
blue = blue >> (ctx->fb_b_mask - ctx->fb_b_mask_used);
|
2008-05-13 19:02:45 -04:00
|
|
|
|
|
|
|
/* combine the correct per component values into the final id */
|
2008-09-23 03:03:35 -04:00
|
|
|
id = blue + (green << ctx->fb_b_mask_used)
|
2008-05-13 19:02:45 -04:00
|
|
|
+ (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used));
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2008-05-13 19:02:45 -04:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2007-10-02 10:03:36 -04:00
|
|
|
ClutterActor *
|
2007-08-13 16:48:01 -04:00
|
|
|
_clutter_do_pick (ClutterStage *stage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
ClutterPickMode mode)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
guchar pixel[4];
|
|
|
|
GLint viewport[4];
|
2008-10-30 12:50:07 -04:00
|
|
|
CoglColor white;
|
2007-08-13 16:48:01 -04:00
|
|
|
guint32 id;
|
2008-10-29 08:19:27 -04:00
|
|
|
GLboolean dither_was_on;
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
2008-03-28 18:50:55 -04:00
|
|
|
_clutter_backend_ensure_context (context->backend, stage);
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
/* needed for when a context switch happens */
|
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 13:07:52 -04:00
|
|
|
_clutter_stage_maybe_setup_viewport (stage);
|
2008-03-28 18:50:55 -04:00
|
|
|
|
2009-05-11 20:02:25 -04:00
|
|
|
cogl_clip_push_window_rect (x, y, 1, 1);
|
2008-10-30 12:50:07 -04:00
|
|
|
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
2009-02-12 08:23:20 -05:00
|
|
|
cogl_disable_fog ();
|
2009-04-24 13:09:52 -04:00
|
|
|
cogl_clear (&white,
|
|
|
|
COGL_BUFFER_BIT_COLOR |
|
2009-05-12 10:36:16 -04:00
|
|
|
COGL_BUFFER_BIT_DEPTH);
|
2007-08-13 16:48:01 -04:00
|
|
|
|
2007-10-31 11:38:18 -04:00
|
|
|
/* Disable dithering (if any) when doing the painting in pick mode */
|
2008-10-29 08:19:27 -04:00
|
|
|
dither_was_on = glIsEnabled (GL_DITHER);
|
2009-05-06 14:01:09 -04:00
|
|
|
if (dither_was_on)
|
|
|
|
glDisable (GL_DITHER);
|
2007-10-31 11:38:18 -04:00
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
/* Render the entire scence in pick mode - just single colored silhouette's
|
2007-08-13 16:48:01 -04:00
|
|
|
* are drawn offscreen (as we never swap buffers)
|
|
|
|
*/
|
|
|
|
context->pick_mode = mode;
|
|
|
|
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
|
|
|
context->pick_mode = CLUTTER_PICK_NONE;
|
2009-05-11 20:02:25 -04:00
|
|
|
cogl_clip_pop ();
|
2007-08-13 16:48:01 -04:00
|
|
|
|
|
|
|
/* Calls should work under both GL and GLES, note GLES needs RGBA */
|
|
|
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
2007-08-29 15:11:18 -04:00
|
|
|
|
2008-12-08 07:02:36 -05:00
|
|
|
/* Read the color of the screen co-ords pixel */
|
|
|
|
glReadPixels (x, viewport[3] - y -1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
|
|
|
|
2008-10-29 08:19:27 -04:00
|
|
|
/* Restore whether GL_DITHER was enabled */
|
|
|
|
if (dither_was_on)
|
|
|
|
glEnable (GL_DITHER);
|
2007-08-29 15:11:18 -04:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
if (pixel[0] == 0xff && pixel[1] == 0xff && pixel[2] == 0xff)
|
2008-04-04 11:02:11 -04:00
|
|
|
return CLUTTER_ACTOR (stage);
|
2007-08-13 16:48:01 -04:00
|
|
|
|
2008-05-13 19:02:45 -04:00
|
|
|
id = _clutter_pixel_to_id (pixel);
|
2007-08-13 16:48:01 -04:00
|
|
|
|
2007-11-15 12:35:47 -05:00
|
|
|
return clutter_get_actor_by_gid (id);
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
static PangoDirection
|
|
|
|
clutter_get_text_direction (void)
|
2008-06-13 05:10:39 -04:00
|
|
|
{
|
2008-12-23 11:40:26 -05:00
|
|
|
PangoDirection dir = PANGO_DIRECTION_LTR;
|
2009-01-06 07:35:19 -05:00
|
|
|
const gchar *direction;
|
2008-12-23 11:40:26 -05:00
|
|
|
|
|
|
|
direction = g_getenv ("CLUTTER_TEXT_DIRECTION");
|
|
|
|
if (direction && *direction != '\0')
|
|
|
|
{
|
|
|
|
if (strcmp (direction, "rtl") == 0)
|
|
|
|
dir = PANGO_DIRECTION_RTL;
|
2009-01-06 07:35:19 -05:00
|
|
|
else if (strcmp (direction, "ltr") == 0)
|
2008-12-23 11:40:26 -05:00
|
|
|
dir = PANGO_DIRECTION_LTR;
|
|
|
|
}
|
|
|
|
else
|
2009-01-06 07:35:19 -05:00
|
|
|
{
|
|
|
|
/* Translate to default:RTL if you want your widgets
|
|
|
|
* to be RTL, otherwise translate to default:LTR.
|
|
|
|
*
|
|
|
|
* Do *not* translate it to "predefinito:LTR": if it
|
|
|
|
* it isn't default:LTR or default:RTL it will not work
|
|
|
|
*/
|
|
|
|
char *e = _("default:LTR");
|
|
|
|
|
|
|
|
if (strcmp (e, "default:RTL") == 0)
|
|
|
|
dir = PANGO_DIRECTION_RTL;
|
|
|
|
else if (strcmp (e, "default:LTR") == 0)
|
|
|
|
dir = PANGO_DIRECTION_LTR;
|
|
|
|
else
|
|
|
|
g_warning ("Whoever translated default:LTR did so wrongly.");
|
|
|
|
}
|
2008-12-23 11:40:26 -05:00
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
2008-12-23 09:34:16 -05:00
|
|
|
static void
|
2009-01-05 10:27:33 -05:00
|
|
|
update_pango_context (ClutterBackend *backend,
|
|
|
|
PangoContext *context)
|
2008-12-23 09:34:16 -05:00
|
|
|
{
|
2008-12-23 11:40:26 -05:00
|
|
|
PangoFontDescription *font_desc;
|
2009-02-26 10:32:48 -05:00
|
|
|
const cairo_font_options_t *font_options;
|
2008-12-23 11:40:26 -05:00
|
|
|
const gchar *font_name;
|
2008-12-23 09:34:16 -05:00
|
|
|
gdouble resolution;
|
|
|
|
|
2009-01-05 11:48:46 -05:00
|
|
|
/* update the text direction */
|
|
|
|
pango_context_set_base_dir (context, clutter_text_direction);
|
|
|
|
|
|
|
|
/* get the configuration for the PangoContext from the backend */
|
2008-12-23 11:40:26 -05:00
|
|
|
font_name = clutter_backend_get_font_name (backend);
|
2008-12-23 09:34:16 -05:00
|
|
|
font_options = clutter_backend_get_font_options (backend);
|
|
|
|
resolution = clutter_backend_get_resolution (backend);
|
2009-01-05 10:27:33 -05:00
|
|
|
|
|
|
|
font_desc = pango_font_description_from_string (font_name);
|
2008-06-13 05:10:39 -04:00
|
|
|
|
|
|
|
if (resolution < 0)
|
|
|
|
resolution = 96.0; /* fall back */
|
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
pango_context_set_font_description (context, font_desc);
|
2008-12-23 09:34:16 -05:00
|
|
|
pango_cairo_context_set_font_options (context, font_options);
|
2008-06-13 05:10:39 -04:00
|
|
|
pango_cairo_context_set_resolution (context, resolution);
|
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
pango_font_description_free (font_desc);
|
2008-12-23 09:34:16 -05:00
|
|
|
}
|
|
|
|
|
2008-06-13 05:10:39 -04:00
|
|
|
PangoContext *
|
2009-01-05 10:27:33 -05:00
|
|
|
_clutter_context_get_pango_context (ClutterMainContext *self)
|
2008-06-13 05:10:39 -04:00
|
|
|
{
|
2009-01-05 11:44:52 -05:00
|
|
|
if (G_UNLIKELY (self->pango_context == NULL))
|
2008-12-23 09:27:41 -05:00
|
|
|
{
|
2009-01-05 10:27:33 -05:00
|
|
|
PangoContext *context;
|
|
|
|
|
2008-12-23 09:27:41 -05:00
|
|
|
context = cogl_pango_font_map_create_context (self->font_map);
|
|
|
|
self->pango_context = context;
|
2009-01-05 10:27:33 -05:00
|
|
|
|
|
|
|
g_signal_connect (self->backend, "resolution-changed",
|
|
|
|
G_CALLBACK (update_pango_context),
|
|
|
|
self->pango_context);
|
|
|
|
g_signal_connect (self->backend, "font-changed",
|
|
|
|
G_CALLBACK (update_pango_context),
|
|
|
|
self->pango_context);
|
2008-12-23 09:27:41 -05:00
|
|
|
}
|
|
|
|
|
2009-01-05 10:27:33 -05:00
|
|
|
update_pango_context (self->backend, self->pango_context);
|
|
|
|
|
|
|
|
return self->pango_context;
|
|
|
|
}
|
|
|
|
|
|
|
|
PangoContext *
|
|
|
|
_clutter_context_create_pango_context (ClutterMainContext *self)
|
|
|
|
{
|
|
|
|
PangoContext *context;
|
2008-06-13 05:10:39 -04:00
|
|
|
|
2009-01-05 10:27:33 -05:00
|
|
|
context = cogl_pango_font_map_create_context (self->font_map);
|
2009-01-05 11:45:59 -05:00
|
|
|
update_pango_context (self->backend, context);
|
2008-06-13 05:10:39 -04:00
|
|
|
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
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 09:38:31 -04:00
|
|
|
/**
|
|
|
|
* clutter_main_quit:
|
|
|
|
*
|
2006-06-22 05:12:40 -04: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 09:38:31 -04:00
|
|
|
*/
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
clutter_main_quit (void)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2007-08-08 06:20:14 -04:00
|
|
|
g_return_if_fail (main_loops != NULL);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
g_main_loop_quit (main_loops->data);
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
/**
|
|
|
|
* clutter_main_level:
|
|
|
|
*
|
2006-06-22 05:12:40 -04: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 09:38:31 -04:00
|
|
|
*/
|
|
|
|
gint
|
|
|
|
clutter_main_level (void)
|
|
|
|
{
|
2007-08-08 06:20:14 -04: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 09:38:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_main:
|
|
|
|
*
|
2006-06-22 05:12:40 -04: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 09:38:31 -04:00
|
|
|
*/
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
clutter_main (void)
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
GMainLoop *loop;
|
|
|
|
|
2008-09-22 12:36:27 -04:00
|
|
|
/* Make sure there is a context */
|
|
|
|
CLUTTER_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 16:27:53 -05:00
|
|
|
if (!clutter_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 09:38:31 -04:00
|
|
|
{
|
|
|
|
g_warning ("Called clutter_main() but Clutter wasn't initialised. "
|
|
|
|
"You must call clutter_init() first.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-07-24 13:39:40 -04:00
|
|
|
CLUTTER_MARK ();
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
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 09:38:31 -04:00
|
|
|
|
|
|
|
loop = g_main_loop_new (NULL, TRUE);
|
2007-08-08 06:20:14 -04: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 09:38:31 -04:00
|
|
|
|
2008-05-13 14:40:14 -04:00
|
|
|
#ifdef HAVE_CLUTTER_FRUITY
|
|
|
|
/* clutter fruity creates an application that forwards events and manually
|
|
|
|
* spins the mainloop
|
|
|
|
*/
|
2008-04-25 09:37:36 -04:00
|
|
|
clutter_fruity_main ();
|
|
|
|
#else
|
2007-08-08 06:20:14 -04: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 09:38:31 -04:00
|
|
|
{
|
2007-08-08 06:20:14 -04:00
|
|
|
clutter_threads_leave ();
|
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 09:38:31 -04:00
|
|
|
g_main_loop_run (loop);
|
2007-08-08 06:20:14 -04:00
|
|
|
clutter_threads_enter ();
|
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 09:38:31 -04:00
|
|
|
}
|
2008-04-25 09:37:36 -04: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 09:38:31 -04:00
|
|
|
|
2007-08-08 06:20:14 -04: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 09:38:31 -04:00
|
|
|
|
|
|
|
g_main_loop_unref (loop);
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
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 09:38:31 -04:00
|
|
|
|
2007-07-24 13:39:40 -04:00
|
|
|
CLUTTER_MARK ();
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
static void
|
|
|
|
clutter_threads_impl_lock (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_mutex)
|
|
|
|
g_mutex_lock (clutter_threads_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_threads_impl_unlock (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_mutex)
|
|
|
|
g_mutex_unlock (clutter_threads_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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().
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_init (void)
|
|
|
|
{
|
|
|
|
if (!g_thread_supported ())
|
|
|
|
g_error ("g_thread_init() must be called before clutter_threads_init()");
|
|
|
|
|
|
|
|
clutter_threads_mutex = g_mutex_new ();
|
|
|
|
|
|
|
|
if (!clutter_threads_lock)
|
|
|
|
clutter_threads_lock = clutter_threads_impl_lock;
|
|
|
|
|
|
|
|
if (!clutter_threads_unlock)
|
|
|
|
clutter_threads_unlock = clutter_threads_impl_unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_set_lock_functions:
|
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* This method must be called before clutter_threads_init(), and cannot
|
|
|
|
* be called multiple times.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GSourceFunc func;
|
|
|
|
gpointer data;
|
|
|
|
GDestroyNotify notify;
|
|
|
|
} ClutterThreadsDispatch;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
clutter_threads_dispatch (gpointer data)
|
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch = data;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
clutter_threads_enter ();
|
|
|
|
|
|
|
|
if (!g_source_is_destroyed (g_main_current_source ()))
|
|
|
|
ret = dispatch->func (dispatch->data);
|
|
|
|
|
|
|
|
clutter_threads_leave ();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_threads_dispatch_free (gpointer data)
|
|
|
|
{
|
|
|
|
ClutterThreadsDispatch *dispatch = data;
|
|
|
|
|
2007-08-22 06:12:15 -04: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 06:20:14 -04:00
|
|
|
if (dispatch->notify)
|
|
|
|
dispatch->notify (dispatch->data);
|
|
|
|
|
|
|
|
g_slice_free (ClutterThreadsDispatch, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_idle_full:
|
|
|
|
* @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 06:36:37 -04:00
|
|
|
* events pending. If the function returns %FALSE it is automatically
|
2007-08-08 06:20:14 -04:00
|
|
|
* removed from the list of event sources and will not be called again.
|
|
|
|
*
|
2008-08-04 06:36:37 -04: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 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* |[
|
2007-08-08 06:20:14 -04:00
|
|
|
* static gboolean
|
2008-08-04 06:36:37 -04:00
|
|
|
* idle_safe_callback (gpointer data)
|
2007-08-08 06:20:14 -04:00
|
|
|
* {
|
2008-08-04 06:36:37 -04:00
|
|
|
* SafeClosure *closure = data;
|
|
|
|
* gboolean res = FALSE;
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* /* mark the critical section */
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* clutter_threads_enter();
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* /* the callback does not need to acquire the Clutter
|
|
|
|
* * lock itself, as it is held by the this proxy handler
|
|
|
|
* */
|
|
|
|
* res = closure->callback (closure->data);
|
|
|
|
*
|
|
|
|
* clutter_threads_leave();
|
|
|
|
*
|
|
|
|
* return res;
|
2007-08-08 06:20:14 -04:00
|
|
|
* }
|
2008-08-04 06:36:37 -04:00
|
|
|
* static gulong
|
|
|
|
* add_safe_idle (GSourceFunc callback,
|
|
|
|
* gpointer data)
|
2007-08-08 06:20:14 -04:00
|
|
|
* {
|
2008-08-04 06:36:37 -04:00
|
|
|
* SafeClosure *closure = g_new0 (SafeClosure, 1);
|
|
|
|
*
|
|
|
|
* closure->callback = callback;
|
|
|
|
* closure->data = data;
|
|
|
|
*
|
|
|
|
* return g_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
|
|
|
|
* idle_safe_callback,
|
|
|
|
* closure,
|
|
|
|
* g_free)
|
2007-08-08 06:20:14 -04:00
|
|
|
* }
|
2008-08-04 06:36:37 -04:00
|
|
|
*]|
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04: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 06:20:14 -04:00
|
|
|
* {
|
2008-08-04 06:36:37 -04:00
|
|
|
* SomeClosure *closure = data;
|
|
|
|
*
|
|
|
|
* /* 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);
|
|
|
|
*
|
|
|
|
* g_object_unref (closure->label);
|
|
|
|
* g_free (closure);
|
|
|
|
*
|
|
|
|
* return FALSE;
|
2007-08-08 06:20:14 -04:00
|
|
|
* }
|
2008-08-04 06:36:37 -04:00
|
|
|
*
|
|
|
|
* /* within another thread */
|
|
|
|
* closure = g_new0 (SomeClosure, 1);
|
|
|
|
* /* 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);
|
|
|
|
*
|
|
|
|
* clutter_threads_add_idle_full (G_PRIORITY_HIGH_IDLE,
|
|
|
|
* update_ui,
|
|
|
|
* closure,
|
|
|
|
* NULL);
|
|
|
|
* ]|
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04: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,
|
|
|
|
clutter_threads_dispatch, dispatch,
|
|
|
|
clutter_threads_dispatch_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_idle:
|
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* Simple wrapper around clutter_threads_add_idle_full() using the
|
|
|
|
* default priority.
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04: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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_timeout_full:
|
|
|
|
* @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 06:36:37 -04: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 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* The first call to the function will be at the end of the first @interval.
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
2008-08-04 06:36:37 -04: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
|
|
|
|
* "keep up" with the interval. A more reliable source is available
|
|
|
|
* using clutter_threads_add_frame_source_full(), which is also internally
|
|
|
|
* used by #ClutterTimeline.
|
|
|
|
*
|
|
|
|
* See also clutter_threads_add_idle_full().
|
2007-08-08 06:20:14 -04:00
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04: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,
|
|
|
|
clutter_threads_dispatch, dispatch,
|
|
|
|
clutter_threads_dispatch_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_timeout:
|
|
|
|
* @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 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04: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);
|
|
|
|
}
|
|
|
|
|
2008-04-17 12:50:23 -04:00
|
|
|
/**
|
|
|
|
* clutter_threads_add_frame_source_full:
|
|
|
|
* @priority: the priority of the frame source. Typically this will be in the
|
|
|
|
* range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
|
2009-03-09 13:12:27 -04:00
|
|
|
* @fps: the number of times per second to call the function
|
2008-04-17 12:50:23 -04:00
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
* @notify: function to call when the timeout source is removed
|
|
|
|
*
|
2008-08-04 06:36:37 -04: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.
|
2008-04-17 12:50:23 -04:00
|
|
|
*
|
2008-05-09 12:27:06 -04:00
|
|
|
* This function is similar to clutter_threads_add_timeout_full()
|
|
|
|
* except that it will try to compensate for delays. For example, if
|
|
|
|
* @func takes half the interval time to execute then the function
|
|
|
|
* will be called again half the interval time after it finished. In
|
|
|
|
* contrast clutter_threads_add_timeout_full() would not fire until a
|
|
|
|
* full interval after the function completes so the delay between
|
|
|
|
* calls would be @interval * 1.5. This function does not however try
|
|
|
|
* to invoke the function multiple times to catch up missing frames if
|
2008-04-17 12:50:23 -04:00
|
|
|
* @func takes more than @interval ms to execute.
|
|
|
|
*
|
2008-08-04 06:36:37 -04:00
|
|
|
* See also clutter_threads_add_idle_full().
|
|
|
|
*
|
2008-04-17 12:50:23 -04:00
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_threads_add_frame_source_full (gint priority,
|
2009-03-09 13:12:27 -04:00
|
|
|
guint fps,
|
2008-04-17 12:50:23 -04:00
|
|
|
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 clutter_frame_source_add_full (priority,
|
2009-03-09 13:12:27 -04:00
|
|
|
fps,
|
2008-04-17 12:50:23 -04:00
|
|
|
clutter_threads_dispatch, dispatch,
|
|
|
|
clutter_threads_dispatch_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_add_frame_source:
|
2009-03-09 13:12:27 -04:00
|
|
|
* @fps: the number of times per second to call the function
|
2008-04-17 12:50:23 -04:00
|
|
|
* @func: function to call
|
|
|
|
* @data: data to pass to the function
|
|
|
|
*
|
|
|
|
* Simple wrapper around clutter_threads_add_frame_source_full().
|
|
|
|
*
|
|
|
|
* Return value: the ID (greater than 0) of the event source.
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
guint
|
2009-03-09 13:12:27 -04:00
|
|
|
clutter_threads_add_frame_source (guint fps,
|
2008-04-17 12:50:23 -04:00
|
|
|
GSourceFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
|
2009-03-09 13:12:27 -04:00
|
|
|
fps,
|
2008-04-17 12:50:23 -04:00
|
|
|
func, data,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
/**
|
|
|
|
* clutter_threads_enter:
|
|
|
|
*
|
|
|
|
* Locks the Clutter thread lock.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_enter (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_lock)
|
|
|
|
(* clutter_threads_lock) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_threads_leave:
|
|
|
|
*
|
|
|
|
* Unlocks the Clutter thread lock.
|
|
|
|
*
|
2007-08-18 08:39:30 -04:00
|
|
|
* Since: 0.4
|
2007-08-08 06:20:14 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_threads_leave (void)
|
|
|
|
{
|
|
|
|
if (clutter_threads_unlock)
|
|
|
|
(* clutter_threads_unlock) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 09:38:31 -04:00
|
|
|
/**
|
2007-03-22 14:21:59 -04:00
|
|
|
* clutter_get_debug_enabled:
|
2008-02-20 09:16:54 -05:00
|
|
|
*
|
2006-06-22 05:12:40 -04:00
|
|
|
* Check if clutter has debugging turned on.
|
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 09:38:31 -04:00
|
|
|
*
|
2006-06-22 05:12:40 -04:00
|
|
|
* Return value: TRUE if debugging is turned on, FALSE otherwise.
|
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 09:38:31 -04:00
|
|
|
*/
|
2006-05-29 04:59:36 -04:00
|
|
|
gboolean
|
2007-03-22 14:21:59 -04:00
|
|
|
clutter_get_debug_enabled (void)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2007-03-22 14:21:59 -04:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
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 16:27:53 -05:00
|
|
|
return clutter_debug_flags != 0;
|
2007-03-22 14:21:59 -04:00
|
|
|
#else
|
|
|
|
return FALSE;
|
|
|
|
#endif
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2007-10-16 09:41:34 -04:00
|
|
|
ClutterMainContext *
|
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 09:38:31 -04:00
|
|
|
clutter_context_get_default (void)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2007-05-28 14:49:34 -04:00
|
|
|
if (G_UNLIKELY(!ClutterCntx))
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
ClutterMainContext *ctx;
|
|
|
|
|
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 10:03:28 -04:00
|
|
|
ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
|
2007-03-22 14:21:59 -04:00
|
|
|
ctx->backend = g_object_new (_clutter_backend_impl_get_type (), 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 09:38:31 -04:00
|
|
|
ctx->is_initialized = FALSE;
|
2007-11-19 11:30:56 -05:00
|
|
|
ctx->motion_events_per_actor = TRUE;
|
|
|
|
|
2009-05-07 14:07:21 -04:00
|
|
|
ctx->master_clock = _clutter_master_clock_get_default ();
|
|
|
|
|
2007-06-07 19:51:53 -04:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
ctx->timer = g_timer_new ();
|
|
|
|
g_timer_start (ctx->timer);
|
|
|
|
#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 09:38:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return ClutterCntx;
|
|
|
|
}
|
|
|
|
|
2007-06-07 19:51:53 -04:00
|
|
|
/**
|
|
|
|
* clutter_get_timestamp:
|
|
|
|
*
|
|
|
|
* Returns the approximate number of microseconds passed since clutter was
|
|
|
|
* intialised.
|
|
|
|
*
|
|
|
|
* Return value: Number of microseconds since clutter_init() was called.
|
|
|
|
*/
|
|
|
|
gulong
|
|
|
|
clutter_get_timestamp (void)
|
|
|
|
{
|
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
ClutterMainContext *ctx;
|
2007-08-08 07:22:45 -04:00
|
|
|
gdouble seconds;
|
2007-06-07 19:51:53 -04:00
|
|
|
|
|
|
|
ctx = clutter_context_get_default ();
|
|
|
|
|
|
|
|
/* FIXME: may need a custom timer for embedded setups */
|
2007-08-08 09:24:43 -04:00
|
|
|
seconds = g_timer_elapsed (ctx->timer, NULL);
|
2007-06-07 19:51:53 -04:00
|
|
|
|
2007-08-08 09:24:43 -04:00
|
|
|
return (gulong)(seconds / 1.0e-6);
|
2007-06-07 19:51:53 -04:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-12-23 11:40:26 -05:00
|
|
|
static gboolean
|
|
|
|
clutter_arg_direction_cb (const char *key,
|
|
|
|
const char *value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
clutter_text_direction =
|
|
|
|
(strcmp (value, "rtl") == 0) ? PANGO_DIRECTION_RTL
|
|
|
|
: PANGO_DIRECTION_LTR;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-06-07 19:51:53 -04: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 16:27:53 -05: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 09:38:31 -04: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 16:27:53 -05: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 09:38:31 -04: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 16:27:53 -05: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 09:22:12 -04: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;
|
|
|
|
ClutterActor *stage;
|
2008-09-23 03:03:35 -04:00
|
|
|
gdouble resolution;
|
|
|
|
ClutterBackend *backend;
|
2008-09-19 09:22:12 -04:00
|
|
|
|
|
|
|
/* Note, creates backend if not already existing, though parse args will
|
|
|
|
* have likely created it
|
|
|
|
*/
|
|
|
|
ctx = clutter_context_get_default ();
|
2008-09-23 03:03:35 -04:00
|
|
|
backend = ctx->backend;
|
|
|
|
|
|
|
|
if (!ctx->options_parsed)
|
|
|
|
{
|
|
|
|
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()");
|
|
|
|
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call backend post parse hooks.
|
|
|
|
*/
|
2008-10-31 08:48:26 -04:00
|
|
|
if (!_clutter_backend_post_parse (backend, error))
|
|
|
|
return CLUTTER_INIT_ERROR_BACKEND;
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2008-09-19 09:22:12 -04:00
|
|
|
/* Stage will give us a GL Context etc */
|
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
if (!stage)
|
|
|
|
{
|
|
|
|
if (error)
|
|
|
|
g_set_error (error, CLUTTER_INIT_ERROR,
|
|
|
|
CLUTTER_INIT_ERROR_INTERNAL,
|
|
|
|
"Unable to create the default stage");
|
|
|
|
else
|
|
|
|
g_critical ("Unable to create the default stage");
|
|
|
|
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2009-02-03 20:04:58 -05:00
|
|
|
clutter_stage_set_title (CLUTTER_STAGE (stage), g_get_prgname ());
|
|
|
|
|
2008-09-19 09:22:12 -04:00
|
|
|
clutter_actor_realize (stage);
|
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (stage))
|
|
|
|
{
|
|
|
|
if (error)
|
|
|
|
g_set_error (error, CLUTTER_INIT_ERROR,
|
|
|
|
CLUTTER_INIT_ERROR_INTERNAL,
|
|
|
|
"Unable to realize the default stage");
|
|
|
|
else
|
|
|
|
g_critical ("Unable to realize the default stage");
|
|
|
|
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
/* Now we can safely assume we have a valid GL context and can
|
2008-09-19 09:22:12 -04:00
|
|
|
* start issueing cogl commands
|
|
|
|
*/
|
|
|
|
|
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 11:15:40 -05:00
|
|
|
/*
|
|
|
|
* Resolution requires display to be open, so can only be queried after
|
|
|
|
* the post_parse hooks run.
|
|
|
|
*
|
|
|
|
* NB: cogl_pango requires a Cogl context.
|
|
|
|
*/
|
|
|
|
ctx->font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
|
|
|
|
|
|
|
resolution = clutter_backend_get_resolution (ctx->backend);
|
|
|
|
cogl_pango_font_map_set_resolution (ctx->font_map, resolution);
|
2009-02-23 08:08:59 -05:00
|
|
|
|
2009-02-23 08:17:06 -05:00
|
|
|
if (G_LIKELY (!clutter_disable_mipmap_text))
|
2009-02-23 06:36:03 -05:00
|
|
|
cogl_pango_font_map_set_use_mipmapping (ctx->font_map, TRUE);
|
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 11:15:40 -05:00
|
|
|
|
|
|
|
clutter_text_direction = clutter_get_text_direction ();
|
|
|
|
|
|
|
|
|
2008-09-19 09:22:12 -04:00
|
|
|
/* 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;
|
|
|
|
|
2009-02-23 08:17:06 -05:00
|
|
|
/* XXX - describe what "fuzzy picking" is */
|
|
|
|
if (clutter_use_fuzzy_picking)
|
2008-09-19 09:22:12 -04:00
|
|
|
{
|
|
|
|
ctx->fb_r_mask_used--;
|
|
|
|
ctx->fb_g_mask_used--;
|
|
|
|
ctx->fb_b_mask_used--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initiate event collection */
|
|
|
|
_clutter_backend_init_events (ctx->backend);
|
|
|
|
|
|
|
|
/* finally features - will call to backend and cogl */
|
|
|
|
_clutter_feature_init ();
|
|
|
|
|
|
|
|
clutter_is_initialized = TRUE;
|
2008-09-23 03:03:35 -04:00
|
|
|
ctx->is_initialized = TRUE;
|
2008-09-19 09:22:12 -04: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 16:27:53 -05:00
|
|
|
static GOptionEntry clutter_args[] = {
|
|
|
|
{ "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps,
|
2009-01-06 07:11:07 -05:00
|
|
|
N_("Show frames per second"), NULL },
|
2007-10-26 11:47:39 -04:00
|
|
|
{ "clutter-default-fps", 0, 0, G_OPTION_ARG_INT, &clutter_default_fps,
|
2009-01-06 07:11:07 -05:00
|
|
|
N_("Default frame rate"), "FPS" },
|
2006-11-21 17:35:48 -05:00
|
|
|
{ "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings,
|
2009-01-06 07:11:07 -05:00
|
|
|
N_("Make all warnings fatal"), NULL },
|
2008-12-23 11:40:26 -05:00
|
|
|
{ "clutter-text-direction", 0, 0, G_OPTION_ARG_CALLBACK,
|
|
|
|
clutter_arg_direction_cb,
|
2009-01-07 07:06:33 -05:00
|
|
|
N_("Direction for the text"), "DIRECTION" },
|
2009-02-23 08:08:59 -05:00
|
|
|
{ "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
|
|
|
|
&clutter_disable_mipmap_text,
|
|
|
|
N_("Disable mipmapping on text"), NULL },
|
2009-02-23 08:17:06 -05: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 16:27:53 -05:00
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
{ "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
|
2009-01-06 07:11:07 -05: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 16:27:53 -05:00
|
|
|
{ "clutter-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_debug_cb,
|
2009-01-06 07:11:07 -05: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 16:27:53 -05:00
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
|
|
{ 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 09:38:31 -04: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 16:27:53 -05: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 14:21:59 -04: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 16:27:53 -05:00
|
|
|
const char *env_string;
|
2006-05-29 04:59:36 -04: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 16:27:53 -05:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return TRUE;
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2008-06-10 10:01:43 -04:00
|
|
|
if (setlocale (LC_ALL, "") == NULL)
|
|
|
|
g_warning ("Locale not supported by C library.\n"
|
|
|
|
"Using the fallback 'C' locale.");
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
clutter_context = clutter_context_get_default ();
|
|
|
|
|
2008-03-07 12:34:40 -05:00
|
|
|
clutter_context->id_pool = clutter_id_pool_new (256);
|
2007-10-08 12:18:33 -04:00
|
|
|
|
2007-03-22 14:21:59 -04: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 16:27:53 -05: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 04:59:36 -04: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 16:27:53 -05: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 09:38:31 -04:00
|
|
|
|
2007-10-26 11:47:39 -04: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 08:08:59 -05:00
|
|
|
env_string = g_getenv ("CLUTTER_DISABLE_MIPMAPPED_TEXT");
|
|
|
|
if (env_string)
|
|
|
|
clutter_disable_mipmap_text = TRUE;
|
|
|
|
|
2009-02-23 08:17:06 -05:00
|
|
|
#ifdef HAVE_CLUTTER_FRUITY
|
|
|
|
/* we always enable fuzzy picking in the "fruity" backend */
|
|
|
|
clutter_use_fuzzy_picking = TRUE;
|
|
|
|
#else
|
|
|
|
env_string = g_getenv ("CLUTTER_FUZZY_PICK");
|
|
|
|
if (env_string)
|
|
|
|
clutter_use_fuzzy_picking = TRUE;
|
|
|
|
#endif /* HAVE_CLUTTER_FRUITY */
|
|
|
|
|
2008-10-31 08:48:26 -04: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 16:27:53 -05: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 14:21:59 -04: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 16:27:53 -05:00
|
|
|
|
2006-11-21 17:35:48 -05:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return TRUE;
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
clutter_context = clutter_context_get_default ();
|
|
|
|
backend = clutter_context->backend;
|
|
|
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
|
|
|
|
2006-11-21 17:35:48 -05: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 11:47:39 -04:00
|
|
|
clutter_context->frame_rate = clutter_default_fps;
|
2008-09-23 03:03:35 -04:00
|
|
|
clutter_context->options_parsed = TRUE;
|
2007-10-26 11:47:39 -04:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
/*
|
|
|
|
* If not asked to defer display setup, call clutter_init_real(),
|
|
|
|
* which in turn calls the backend post parse hooks.
|
|
|
|
*/
|
|
|
|
if (!clutter_context->defer_display_setup)
|
|
|
|
return clutter_init_real (error);
|
2008-09-19 09:22:12 -04:00
|
|
|
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_get_option_group:
|
|
|
|
*
|
|
|
|
* 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 07:38:48 -04: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 ());
|
|
|
|
* res = g_option_context_parse (context, &argc, &argc, NULL);
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* is functionally equivalent to:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* clutter_init (&argc, &argv);
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* After g_option_context_parse() on a #GOptionContext containing the
|
|
|
|
* Clutter #GOptionGroup has returned %TRUE, Clutter is guaranteed to be
|
|
|
|
* initialized.
|
|
|
|
*
|
2009-02-16 19:25:20 -05: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 16:27:53 -05:00
|
|
|
* recognized by Clutter
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
GOptionGroup *
|
|
|
|
clutter_get_option_group (void)
|
|
|
|
{
|
2007-03-22 14:21:59 -04: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 16:27:53 -05:00
|
|
|
GOptionGroup *group;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
clutter_base_init ();
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
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 16:27:53 -05:00
|
|
|
group = g_option_group_new ("clutter",
|
2009-01-06 07:11:07 -05: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 16:27:53 -05:00
|
|
|
NULL,
|
|
|
|
NULL);
|
2008-02-20 09:16:54 -05: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 16:27:53 -05: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 07:11:07 -05:00
|
|
|
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/* add backend-specific options */
|
2007-03-23 13:55:13 -04: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 16:27:53 -05:00
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
/**
|
|
|
|
* clutter_get_option_group_without_init:
|
|
|
|
*
|
|
|
|
* 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. 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 gtk_clutter_init().
|
|
|
|
*
|
2009-02-16 19:25:20 -05:00
|
|
|
* Return value: (transfer full): a #GOptionGroup for the commandline arguments
|
2008-09-23 03:03:35 -04:00
|
|
|
* recognized by Clutter
|
|
|
|
*
|
|
|
|
* Since: 0.8.2
|
|
|
|
*/
|
|
|
|
GOptionGroup *
|
|
|
|
clutter_get_option_group_without_init (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
GOptionGroup *group;
|
|
|
|
|
|
|
|
clutter_base_init ();
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
context->defer_display_setup = TRUE;
|
|
|
|
|
|
|
|
group = clutter_get_option_group ();
|
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
|
|
|
|
2009-02-16 19:25:20 -05: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 16:27:53 -05:00
|
|
|
/**
|
|
|
|
* clutter_init_with_args:
|
2009-02-16 19:25:20 -05:00
|
|
|
* @argc: (inout): a pointer to the number of command line arguments
|
|
|
|
* @argv: (array length=argc) (inout): a pointer to the array of command line 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 16:27:53 -05:00
|
|
|
* @parameter_string: a string which is displayed in the
|
|
|
|
* first line of <option>--help</option> output, after
|
2006-12-05 00:16:52 -05:00
|
|
|
* <literal><replaceable>programname</replaceable> [OPTION...]</literal>
|
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 16:27:53 -05:00
|
|
|
* @entries: a %NULL terminated array of #GOptionEntry<!-- -->s
|
|
|
|
* describing the options of your program
|
|
|
|
* @translation_domain: a translation domain to use for translating
|
|
|
|
* the <option>--help</option> output for the options in @entries
|
|
|
|
* with gettext(), or %NULL
|
|
|
|
* @error: a return location for a #GError
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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 14:48:13 -04: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 16:27:53 -05:00
|
|
|
GOptionEntry *entries,
|
2008-10-21 14:48:13 -04: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 16:27:53 -05:00
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
GOptionContext *context;
|
|
|
|
GOptionGroup *group;
|
|
|
|
gboolean res;
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
|
|
|
|
if (clutter_is_initialized)
|
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
clutter_base_init ();
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
ctx = clutter_context_get_default ();
|
2007-06-19 10:10:25 -04:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
if (!ctx->defer_display_setup)
|
|
|
|
{
|
|
|
|
if (argc && *argc > 0 && *argv)
|
|
|
|
g_set_prgname ((*argv)[0]);
|
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 16:27:53 -05:00
|
|
|
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
|
2009-02-23 07:47:02 -05:00
|
|
|
group = clutter_get_option_group ();
|
|
|
|
g_option_context_add_group (context, group);
|
|
|
|
|
|
|
|
group = cogl_get_option_group ();
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
|
2008-09-23 03:03:35 -04: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 09:22:12 -04:00
|
|
|
*/
|
2008-09-23 03:03:35 -04: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 16:27:53 -05:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return clutter_init_real (error);
|
2007-01-23 15:29:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
clutter_parse_args (int *argc,
|
|
|
|
char ***argv)
|
|
|
|
{
|
|
|
|
GOptionContext *option_context;
|
2009-02-23 07:47:02 -05:00
|
|
|
GOptionGroup *clutter_group, *cogl_group;
|
2007-01-23 15:29:11 -05:00
|
|
|
GError *error = NULL;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
|
|
|
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 09:16:54 -05:00
|
|
|
g_option_context_set_help_enabled (option_context, FALSE);
|
2007-01-23 15:29:11 -05: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 07:47:02 -05:00
|
|
|
cogl_group = cogl_get_option_group ();
|
|
|
|
g_option_context_add_group (option_context, cogl_group);
|
|
|
|
|
2007-01-23 15:29:11 -05:00
|
|
|
if (!g_option_context_parse (option_context, argc, argv, &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 16:27:53 -05:00
|
|
|
{
|
2008-09-19 09:22:12 -04:00
|
|
|
if (error)
|
2008-09-23 03:03:35 -04:00
|
|
|
{
|
|
|
|
g_warning ("%s", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
2008-09-19 09:22:12 -04:00
|
|
|
|
2007-01-23 15:29:11 -05: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 16:27:53 -05:00
|
|
|
}
|
2006-06-08 17:28:05 -04:00
|
|
|
|
2007-01-23 15:29:11 -05:00
|
|
|
g_option_context_free (option_context);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-01-23 15:29:11 -05: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 16:27:53 -05:00
|
|
|
}
|
2006-11-15 16:19:01 -05: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 16:27:53 -05:00
|
|
|
/**
|
|
|
|
* clutter_init:
|
2009-02-16 19:25:20 -05:00
|
|
|
* @argc: (inout): The number of arguments in @argv
|
|
|
|
* @argv: (array length=argc) (inout): 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 16:27:53 -05:00
|
|
|
*
|
|
|
|
* It will initialise 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.
|
|
|
|
*
|
|
|
|
* Return value: 1 on success, < 0 on failure.
|
|
|
|
*/
|
|
|
|
ClutterInitError
|
|
|
|
clutter_init (int *argc,
|
|
|
|
char ***argv)
|
|
|
|
{
|
2008-09-23 03:03:35 -04:00
|
|
|
ClutterMainContext *ctx;
|
|
|
|
GError *error = 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 16:27:53 -05:00
|
|
|
if (clutter_is_initialized)
|
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
|
2007-08-08 06:20:14 -04:00
|
|
|
clutter_base_init ();
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
ctx = clutter_context_get_default ();
|
2007-06-19 10:10:25 -04:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
if (!ctx->defer_display_setup)
|
2007-04-27 20:37:11 -04:00
|
|
|
{
|
2008-09-23 03:03:35 -04:00
|
|
|
if (argc && *argc > 0 && *argv)
|
|
|
|
g_set_prgname ((*argv)[0]);
|
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 16:27:53 -05:00
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
/* parse_args will trigger backend creation and things like
|
|
|
|
* DISPLAY connection etc.
|
|
|
|
*/
|
|
|
|
if (clutter_parse_args (argc, argv) == FALSE)
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (MISC, "failed to parse arguments.");
|
|
|
|
return CLUTTER_INIT_ERROR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CLUTTER_INIT_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return clutter_init_real (&error);
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
2007-03-23 05:44:21 -04:00
|
|
|
|
|
|
|
gboolean
|
2007-10-02 10:03:36 -04:00
|
|
|
_clutter_boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
|
|
|
GValue *return_accu,
|
|
|
|
const GValue *handler_return,
|
|
|
|
gpointer dummy)
|
2007-03-23 05:44:21 -04:00
|
|
|
{
|
|
|
|
gboolean continue_emission;
|
|
|
|
gboolean signal_handled;
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-03-23 05:44:21 -04:00
|
|
|
signal_handled = g_value_get_boolean (handler_return);
|
|
|
|
g_value_set_boolean (return_accu, signal_handled);
|
|
|
|
continue_emission = !signal_handled;
|
2007-04-19 11:27:46 -04:00
|
|
|
|
2007-03-23 05:44:21 -04:00
|
|
|
return continue_emission;
|
|
|
|
}
|
2007-05-16 11:00:41 -04:00
|
|
|
|
2007-10-03 05:28:16 -04:00
|
|
|
static void
|
|
|
|
event_click_count_generate (ClutterEvent *event)
|
|
|
|
{
|
|
|
|
/* multiple button click detection */
|
2007-11-20 12:14:05 -05: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 05:28:16 -04:00
|
|
|
|
2007-11-20 12:14:05 -05:00
|
|
|
ClutterBackend *backend;
|
|
|
|
guint double_click_time;
|
|
|
|
guint double_click_distance;
|
2007-10-03 05:28:16 -04:00
|
|
|
|
2007-11-20 12:14:05 -05:00
|
|
|
backend = clutter_context_get_default ()->backend;
|
2007-10-03 05:28:16 -04:00
|
|
|
double_click_distance = clutter_backend_get_double_click_distance (backend);
|
|
|
|
double_click_time = clutter_backend_get_double_click_time (backend);
|
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
if (event->button.device != NULL)
|
|
|
|
{
|
|
|
|
click_count = event->button.device->click_count;
|
|
|
|
previous_x = event->button.device->previous_x;
|
|
|
|
previous_y = event->button.device->previous_y;
|
|
|
|
previous_time = event->button.device->previous_time;
|
|
|
|
previous_button_number = event->button.device->previous_button_number;
|
|
|
|
}
|
|
|
|
|
2007-11-20 12:14:05 -05:00
|
|
|
switch (event->type)
|
2007-11-20 12:05:23 -05:00
|
|
|
{
|
2007-11-20 12:14:05 -05:00
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_SCROLL:
|
|
|
|
/* check if we are in time and within distance to increment an
|
|
|
|
* existing click count
|
|
|
|
*/
|
|
|
|
if (event->button.time < previous_time + double_click_time &&
|
2008-02-20 09:16:54 -05:00
|
|
|
(ABS (event->button.x - previous_x) <= double_click_distance) &&
|
2007-11-20 12:14:05 -05:00
|
|
|
(ABS (event->button.y - previous_y) <= double_click_distance)
|
|
|
|
&& event->button.button == previous_button_number)
|
|
|
|
{
|
|
|
|
click_count ++;
|
|
|
|
}
|
|
|
|
else /* start a new click count*/
|
|
|
|
{
|
|
|
|
click_count=1;
|
|
|
|
previous_button_number = event->button.button;
|
|
|
|
}
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2008-03-28 18:50:55 -04:00
|
|
|
/* store time and position for this click for comparison with
|
2008-09-23 03:03:35 -04:00
|
|
|
* next event
|
2008-03-28 18:50:55 -04:00
|
|
|
*/
|
2007-11-20 12:14:05 -05:00
|
|
|
previous_time = event->button.time;
|
|
|
|
previous_x = event->button.x;
|
|
|
|
previous_y = event->button.y;
|
|
|
|
|
|
|
|
/* fallthrough */
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
event->button.click_count=click_count;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert (NULL);
|
2007-10-03 05:28:16 -04:00
|
|
|
}
|
2008-06-23 05:55:42 -04:00
|
|
|
|
|
|
|
if (event->button.device != NULL)
|
|
|
|
{
|
|
|
|
event->button.device->click_count = click_count;
|
|
|
|
event->button.device->previous_x = previous_x;
|
|
|
|
event->button.device->previous_y = previous_y;
|
|
|
|
event->button.device->previous_time = previous_time;
|
|
|
|
event->button.device->previous_button_number = previous_button_number;
|
|
|
|
}
|
2007-10-03 05:28:16 -04:00
|
|
|
}
|
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
static inline void
|
2007-11-16 08:41:07 -05:00
|
|
|
emit_event (ClutterEvent *event,
|
|
|
|
gboolean is_key_event)
|
2007-10-10 09:04:34 -04:00
|
|
|
{
|
2009-02-23 10:22:08 -05:00
|
|
|
static gboolean lock = FALSE;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2009-02-23 10:22:08 -05:00
|
|
|
GPtrArray *event_tree = NULL;
|
|
|
|
ClutterActor *actor;
|
|
|
|
gint i = 0;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2008-02-25 07:24:56 -05:00
|
|
|
if (!event->any.source)
|
|
|
|
{
|
2009-02-23 10:22:08 -05:00
|
|
|
CLUTTER_NOTE (EVENT, "No source set, discarding event");
|
2008-02-25 07:24:56 -05:00
|
|
|
return;
|
|
|
|
}
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2008-02-25 07:24:56 -05:00
|
|
|
/* reentrancy check */
|
2008-02-25 11:50:50 -05:00
|
|
|
if (lock != FALSE)
|
2009-02-27 12:59:16 -05:00
|
|
|
{
|
|
|
|
g_warning ("Tried emitting event during event delivery, bailing out.n");
|
|
|
|
return;
|
|
|
|
}
|
2008-02-25 07:24:56 -05:00
|
|
|
|
|
|
|
lock = TRUE;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2009-02-23 10:22:08 -05:00
|
|
|
event_tree = g_ptr_array_sized_new (64);
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2007-11-12 14:12:02 -05:00
|
|
|
actor = event->any.source;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
/* Build 'tree' of emitters for the event */
|
2009-02-23 10:22:08 -05:00
|
|
|
while (actor)
|
2007-10-10 09:04:34 -04:00
|
|
|
{
|
2007-11-16 08:41:07 -05:00
|
|
|
ClutterActor *parent;
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
parent = clutter_actor_get_parent (actor);
|
|
|
|
|
2007-11-15 12:35:47 -05:00
|
|
|
if (clutter_actor_get_reactive (actor) ||
|
2007-11-16 08:41:07 -05:00
|
|
|
parent == NULL || /* stage gets all events */
|
|
|
|
is_key_event) /* keyboard events are always emitted */
|
|
|
|
{
|
2009-02-23 10:22:08 -05:00
|
|
|
g_ptr_array_add (event_tree, g_object_ref (actor));
|
2007-11-16 08:41:07 -05:00
|
|
|
}
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
actor = parent;
|
2007-10-10 09:04:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Capture */
|
2009-02-23 10:22:08 -05:00
|
|
|
for (i = event_tree->len - 1; i >= 0; i--)
|
|
|
|
if (clutter_actor_event (g_ptr_array_index (event_tree, i), event, TRUE))
|
2007-10-16 09:41:34 -04:00
|
|
|
goto done;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
|
|
|
/* Bubble */
|
2009-02-23 10:22:08 -05:00
|
|
|
for (i = 0; i < event_tree->len; i++)
|
|
|
|
if (clutter_actor_event (g_ptr_array_index (event_tree, i), event, FALSE))
|
2007-10-10 09:04:34 -04:00
|
|
|
goto done;
|
|
|
|
|
2007-10-16 09:41:34 -04:00
|
|
|
done:
|
2009-02-23 10:22:08 -05:00
|
|
|
for (i = 0; i < event_tree->len; i++)
|
|
|
|
g_object_unref (g_ptr_array_index (event_tree, i));
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2009-02-23 10:22:08 -05:00
|
|
|
g_ptr_array_free (event_tree, TRUE);
|
2007-10-10 09:04:34 -04:00
|
|
|
|
|
|
|
lock = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-07-01 07:51:20 -04:00
|
|
|
/*
|
|
|
|
* Emits a pointer event after having prepared the event for delivery (setting
|
|
|
|
* source, computing click_count, generating enter/leave etc.).
|
|
|
|
*/
|
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
static inline void
|
2008-07-01 07:51:20 -04:00
|
|
|
emit_pointer_event (ClutterEvent *event,
|
|
|
|
ClutterInputDevice *device)
|
2007-11-16 08:41:07 -05:00
|
|
|
{
|
|
|
|
/* Using the global variable directly, since it has to be initialized
|
|
|
|
* at this point
|
|
|
|
*/
|
|
|
|
ClutterMainContext *context = ClutterCntx;
|
|
|
|
|
2008-07-01 07:51:20 -04:00
|
|
|
if (G_UNLIKELY (context->pointer_grab_actor != NULL &&
|
|
|
|
device == NULL))
|
|
|
|
{
|
|
|
|
/* global grab */
|
|
|
|
clutter_actor_event (context->pointer_grab_actor, event, FALSE);
|
|
|
|
}
|
|
|
|
else if (G_UNLIKELY (device != NULL &&
|
|
|
|
device->pointer_grab_actor != NULL))
|
|
|
|
{
|
|
|
|
/* per device grab */
|
|
|
|
clutter_actor_event (device->pointer_grab_actor, event, FALSE);
|
|
|
|
}
|
2007-11-16 08:41:07 -05:00
|
|
|
else
|
2008-07-01 07:51:20 -04:00
|
|
|
{
|
|
|
|
/* no grab, time to capture and bubble */
|
|
|
|
emit_event (event, FALSE);
|
|
|
|
}
|
2007-11-16 08:41:07 -05:00
|
|
|
}
|
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
static inline void
|
2007-11-16 08:41:07 -05:00
|
|
|
emit_keyboard_event (ClutterEvent *event)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = ClutterCntx;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (context->keyboard_grab_actor != NULL))
|
|
|
|
clutter_actor_event (context->keyboard_grab_actor, event, FALSE);
|
|
|
|
else
|
|
|
|
emit_event (event, TRUE);
|
|
|
|
}
|
|
|
|
|
2007-12-18 05:49:29 -05:00
|
|
|
static void
|
2008-06-23 05:55:42 -04:00
|
|
|
unset_motion_last_actor (ClutterActor *actor, ClutterInputDevice *dev)
|
2007-12-18 05:49:29 -05:00
|
|
|
{
|
|
|
|
ClutterMainContext *context = ClutterCntx;
|
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
if (dev == NULL)
|
|
|
|
context->motion_last_actor = NULL;
|
|
|
|
else
|
|
|
|
dev->motion_last_actor = NULL;
|
2007-12-18 05:49:29 -05:00
|
|
|
}
|
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
static ClutterInputDevice * clutter_event_get_device (ClutterEvent *event);
|
|
|
|
|
|
|
|
/* This function should perhaps be public and in clutter-event.c ?
|
|
|
|
*/
|
|
|
|
static ClutterInputDevice *
|
|
|
|
clutter_event_get_device (ClutterEvent *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case CLUTTER_NOTHING:
|
|
|
|
case CLUTTER_STAGE_STATE:
|
|
|
|
case CLUTTER_DESTROY_NOTIFY:
|
|
|
|
case CLUTTER_CLIENT_MESSAGE:
|
|
|
|
case CLUTTER_DELETE:
|
|
|
|
case CLUTTER_ENTER:
|
|
|
|
case CLUTTER_LEAVE:
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
return event->button.device;
|
|
|
|
case CLUTTER_MOTION:
|
|
|
|
return event->motion.device;
|
|
|
|
case CLUTTER_SCROLL:
|
|
|
|
return event->scroll.device;
|
|
|
|
break;
|
|
|
|
case CLUTTER_KEY_PRESS:
|
|
|
|
case CLUTTER_KEY_RELEASE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-02-12 12:21:18 -05:00
|
|
|
static void
|
|
|
|
set_motion_last_actor (ClutterActor *motion_current_actor,
|
|
|
|
ClutterInputDevice *device)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = ClutterCntx;
|
|
|
|
ClutterActor *last_actor = context->motion_last_actor;
|
|
|
|
|
|
|
|
if (device != NULL)
|
|
|
|
last_actor = device->motion_last_actor;
|
|
|
|
|
|
|
|
if (last_actor && last_actor != motion_current_actor)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func
|
|
|
|
(last_actor,
|
|
|
|
G_CALLBACK (unset_motion_last_actor),
|
|
|
|
device);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (motion_current_actor && last_actor != motion_current_actor)
|
|
|
|
{
|
|
|
|
g_signal_connect (motion_current_actor, "destroy",
|
|
|
|
G_CALLBACK (unset_motion_last_actor),
|
|
|
|
device);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (device != NULL)
|
|
|
|
device->motion_last_actor = motion_current_actor;
|
|
|
|
else
|
|
|
|
context->motion_last_actor = motion_current_actor;
|
|
|
|
}
|
|
|
|
|
2007-11-15 12:34:49 -05:00
|
|
|
static inline void
|
2007-11-16 08:41:07 -05:00
|
|
|
generate_enter_leave_events (ClutterEvent *event)
|
2007-11-15 12:30:30 -05:00
|
|
|
{
|
2007-12-18 05:49:29 -05:00
|
|
|
ClutterMainContext *context = ClutterCntx;
|
|
|
|
ClutterActor *motion_current_actor = event->motion.source;
|
2008-06-23 05:55:42 -04:00
|
|
|
ClutterActor *last_actor = context->motion_last_actor;
|
2008-10-01 09:46:33 -04:00
|
|
|
ClutterInputDevice *device = clutter_event_get_device (event);
|
2008-06-23 05:55:42 -04:00
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
if (device != NULL)
|
|
|
|
last_actor = device->motion_last_actor;
|
2007-11-15 12:30:30 -05:00
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
if (last_actor != motion_current_actor)
|
2007-11-15 12:30:30 -05:00
|
|
|
{
|
2007-12-18 08:03:45 -05:00
|
|
|
if (motion_current_actor)
|
2007-11-15 12:30:30 -05:00
|
|
|
{
|
|
|
|
ClutterEvent cev;
|
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 11:44:47 -04:00
|
|
|
gfloat x, y;
|
2007-11-15 12:30:30 -05:00
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
cev.crossing.device = device;
|
|
|
|
clutter_event_get_coords (event, &x, &y);
|
2008-07-01 07:51:20 -04:00
|
|
|
|
2007-12-18 08:03:45 -05:00
|
|
|
if (context->motion_last_actor)
|
|
|
|
{
|
|
|
|
cev.crossing.type = CLUTTER_LEAVE;
|
|
|
|
cev.crossing.time = event->any.time;
|
2008-02-20 09:16:54 -05:00
|
|
|
cev.crossing.flags = 0;
|
2008-10-01 09:46:33 -04:00
|
|
|
cev.crossing.x = x;
|
|
|
|
cev.crossing.y = y;
|
2008-06-23 05:55:42 -04:00
|
|
|
cev.crossing.source = last_actor;
|
2008-03-28 18:50:55 -04:00
|
|
|
cev.crossing.stage = event->any.stage;
|
2008-01-19 05:33:31 -05:00
|
|
|
cev.crossing.related = motion_current_actor;
|
2007-12-18 08:03:45 -05:00
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
emit_pointer_event (&cev, device);
|
2007-12-18 08:03:45 -05:00
|
|
|
}
|
2007-11-15 12:30:30 -05:00
|
|
|
|
|
|
|
cev.crossing.type = CLUTTER_ENTER;
|
|
|
|
cev.crossing.time = event->any.time;
|
2008-02-20 09:16:54 -05:00
|
|
|
cev.crossing.flags = 0;
|
2008-10-01 09:46:33 -04:00
|
|
|
cev.crossing.x = x;
|
|
|
|
cev.crossing.y = y;
|
2007-11-15 12:30:30 -05:00
|
|
|
cev.crossing.source = motion_current_actor;
|
2008-03-28 18:50:55 -04:00
|
|
|
cev.crossing.stage = event->any.stage;
|
2008-01-19 05:33:31 -05:00
|
|
|
|
2007-12-18 08:03:45 -05:00
|
|
|
if (context->motion_last_actor)
|
2008-06-23 05:55:42 -04:00
|
|
|
cev.crossing.related = last_actor;
|
2007-12-18 08:03:45 -05:00
|
|
|
else
|
2008-10-01 09:46:33 -04:00
|
|
|
cev.crossing.related = NULL;
|
2007-11-15 12:30:30 -05:00
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
emit_pointer_event (&cev, device);
|
2007-11-15 12:30:30 -05:00
|
|
|
}
|
|
|
|
}
|
2007-12-18 05:49:29 -05:00
|
|
|
|
2009-02-16 11:34:31 -05:00
|
|
|
set_motion_last_actor (motion_current_actor, device);
|
2007-11-15 12:30:30 -05:00
|
|
|
}
|
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
/**
|
2007-10-03 05:28:16 -04:00
|
|
|
* clutter_do_event
|
|
|
|
* @event: a #ClutterEvent.
|
|
|
|
*
|
|
|
|
* Processes an event. This function should never be called by applications.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_do_event (ClutterEvent *event)
|
|
|
|
{
|
2008-02-20 09:16:54 -05:00
|
|
|
/* FIXME: This should probably be clutter_cook_event() - it would
|
|
|
|
* take a raw event from the backend and 'cook' it so its more tasty.
|
|
|
|
*
|
2007-10-03 05:28:16 -04:00
|
|
|
*/
|
|
|
|
ClutterMainContext *context;
|
|
|
|
ClutterBackend *backend;
|
|
|
|
ClutterActor *stage;
|
2008-06-23 05:55:42 -04:00
|
|
|
ClutterInputDevice *device = NULL;
|
2007-11-19 11:30:56 -05:00
|
|
|
static gint32 motion_last_time = 0L;
|
2008-06-23 05:55:42 -04:00
|
|
|
gint32 local_motion_time;
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2007-10-03 05:28:16 -04:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
backend = context->backend;
|
2008-03-28 18:50:55 -04:00
|
|
|
stage = CLUTTER_ACTOR(event->any.stage);
|
2007-10-03 05:28:16 -04:00
|
|
|
|
|
|
|
if (!stage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CLUTTER_TIMESTAMP (EVENT, "Event received");
|
|
|
|
|
2009-02-14 06:38:16 -05:00
|
|
|
context->last_event_time = clutter_event_get_time (event);
|
|
|
|
|
2007-10-03 05:28:16 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
2007-11-16 08:41:07 -05:00
|
|
|
case CLUTTER_NOTHING:
|
|
|
|
event->any.source = stage;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_LEAVE:
|
2009-02-12 12:21:18 -05:00
|
|
|
/* The source is set for generated events, not for events
|
|
|
|
* resulting from the cursor leaving the stage
|
|
|
|
*/
|
|
|
|
if (event->any.source == NULL)
|
|
|
|
{
|
|
|
|
ClutterActor *last_actor = context->motion_last_actor;
|
|
|
|
|
|
|
|
if (event->crossing.device != NULL)
|
|
|
|
last_actor = event->crossing.device->motion_last_actor;
|
|
|
|
|
|
|
|
event->any.source = last_actor;
|
|
|
|
|
|
|
|
set_motion_last_actor (NULL, event->crossing.device);
|
|
|
|
}
|
|
|
|
/* flow through */
|
|
|
|
case CLUTTER_ENTER:
|
2008-07-01 07:51:20 -04:00
|
|
|
emit_pointer_event (event, event->crossing.device);
|
2007-11-16 08:41:07 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_DESTROY_NOTIFY:
|
|
|
|
case CLUTTER_DELETE:
|
|
|
|
event->any.source = stage;
|
2008-01-18 13:08:37 -05:00
|
|
|
/* the stage did not handle the event, so we just quit */
|
|
|
|
if (!clutter_stage_event (CLUTTER_STAGE (stage), event))
|
2008-03-28 18:50:55 -04:00
|
|
|
{
|
|
|
|
if (stage == clutter_stage_get_default())
|
|
|
|
clutter_main_quit ();
|
|
|
|
else
|
|
|
|
clutter_actor_destroy (stage);
|
|
|
|
}
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_KEY_PRESS:
|
|
|
|
case CLUTTER_KEY_RELEASE:
|
2007-11-15 12:08:48 -05:00
|
|
|
{
|
2007-11-16 08:41:07 -05:00
|
|
|
ClutterActor *actor = NULL;
|
2007-10-16 12:35:02 -04:00
|
|
|
|
2007-11-20 12:03:53 -05: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 07:24:56 -05:00
|
|
|
if (G_UNLIKELY (actor == NULL))
|
|
|
|
{
|
|
|
|
g_warning ("No key focus set, discarding");
|
|
|
|
return;
|
|
|
|
}
|
2007-11-20 12:03:53 -05:00
|
|
|
}
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
emit_keyboard_event (event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_MOTION:
|
2008-06-23 05:55:42 -04:00
|
|
|
device = event->motion.device;
|
|
|
|
|
|
|
|
if (device)
|
|
|
|
local_motion_time = device->motion_last_time;
|
|
|
|
else
|
|
|
|
local_motion_time = motion_last_time;
|
2007-11-19 11:30:56 -05:00
|
|
|
|
2008-03-04 11:23:13 -05:00
|
|
|
/* avoid rate throttling for synthetic motion events or if
|
|
|
|
* the per-actor events are disabled
|
|
|
|
*/
|
|
|
|
if (!(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC) ||
|
|
|
|
!context->motion_events_per_actor)
|
2007-11-20 12:03:53 -05:00
|
|
|
{
|
|
|
|
gint32 frame_rate, delta;
|
|
|
|
|
|
|
|
/* avoid issuing too many motion events, which leads to many
|
|
|
|
* redraws in pick mode (performance penalty)
|
|
|
|
*/
|
|
|
|
frame_rate = clutter_get_motion_events_frequency ();
|
|
|
|
delta = 1000 / frame_rate;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"skip motion event: %s (last:%d, delta:%d, time:%d)",
|
2008-06-23 05:55:42 -04:00
|
|
|
(event->any.time < (local_motion_time + delta) ? "yes" : "no"),
|
|
|
|
local_motion_time,
|
2007-11-20 12:03:53 -05:00
|
|
|
delta,
|
|
|
|
event->any.time);
|
|
|
|
|
2008-09-24 06:12:23 -04:00
|
|
|
/* we need to guard against roll-overs and the
|
|
|
|
* case where the time is rolled backwards and
|
|
|
|
* the backend is not ensuring a monotonic clock
|
|
|
|
* for the events.
|
|
|
|
*
|
|
|
|
* see:
|
|
|
|
* http://bugzilla.openedhand.com/show_bug.cgi?id=1130
|
|
|
|
*/
|
|
|
|
if (event->any.time >= local_motion_time &&
|
|
|
|
event->any.time < (local_motion_time + delta))
|
2007-11-20 12:03:53 -05:00
|
|
|
break;
|
|
|
|
else
|
2008-06-23 05:55:42 -04:00
|
|
|
local_motion_time = event->any.time;
|
2007-11-20 12:03:53 -05:00
|
|
|
}
|
2007-11-19 11:30:56 -05:00
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
if (device)
|
|
|
|
device->motion_last_time = local_motion_time;
|
|
|
|
else
|
|
|
|
motion_last_time = local_motion_time;
|
|
|
|
|
2007-11-20 12:03:53 -05:00
|
|
|
/* Only stage gets motion events if clutter_set_motion_events is TRUE,
|
|
|
|
* and the event is not a synthetic event with source set.
|
|
|
|
*/
|
|
|
|
if (!context->motion_events_per_actor &&
|
|
|
|
event->any.source == NULL)
|
2007-11-12 14:12:02 -05:00
|
|
|
{
|
2007-11-16 08:41:07 -05:00
|
|
|
/* Only stage gets motion events */
|
|
|
|
event->any.source = stage;
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
/* global grabs */
|
2007-11-16 08:41:07 -05:00
|
|
|
if (context->pointer_grab_actor != NULL)
|
2007-11-12 14:12:02 -05:00
|
|
|
{
|
2008-09-23 03:03:35 -04:00
|
|
|
clutter_actor_event (context->pointer_grab_actor,
|
2008-06-23 05:55:42 -04:00
|
|
|
event, FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (device != NULL && device->pointer_grab_actor != NULL)
|
|
|
|
{
|
2008-09-23 03:03:35 -04:00
|
|
|
clutter_actor_event (device->pointer_grab_actor,
|
2008-06-23 05:55:42 -04:00
|
|
|
event, FALSE);
|
2007-11-16 08:41:07 -05:00
|
|
|
break;
|
|
|
|
}
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2007-11-16 08:41:07 -05: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 14:12:02 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-10-03 05:28:16 -04:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
/* fallthrough */
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
case CLUTTER_SCROLL:
|
|
|
|
{
|
|
|
|
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 11:44:47 -04:00
|
|
|
gfloat x, y;
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
clutter_event_get_coords (event, &x, &y);
|
2007-10-03 05:28:16 -04:00
|
|
|
|
2007-11-20 12:03:53 -05: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 08:41:07 -05:00
|
|
|
{
|
2007-11-20 12:03:53 -05:00
|
|
|
/* Handle release off stage */
|
2008-05-31 13:09:40 -04:00
|
|
|
if ((x >= clutter_actor_get_width (stage) ||
|
|
|
|
y >= clutter_actor_get_height (stage) ||
|
2007-11-20 12:03:53 -05:00
|
|
|
x < 0 || y < 0))
|
2007-11-16 08:41:07 -05:00
|
|
|
{
|
2007-11-20 12:03:53 -05:00
|
|
|
if (event->type == CLUTTER_BUTTON_RELEASE)
|
|
|
|
{
|
2008-06-23 05:55:42 -04: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 11:44:47 -04:00
|
|
|
"Release off stage received at %.2f, %.2f",
|
2007-11-20 12:03:53 -05:00
|
|
|
x, y);
|
|
|
|
|
|
|
|
event->button.source = stage;
|
2008-07-01 07:51:20 -04:00
|
|
|
emit_pointer_event (event, event->button.device);
|
2007-11-20 12:03:53 -05:00
|
|
|
}
|
|
|
|
break;
|
2007-11-16 08:41:07 -05:00
|
|
|
}
|
2007-10-10 09:04:34 -04:00
|
|
|
|
2007-11-20 12:03:53 -05:00
|
|
|
/* Map the event to a reactive actor */
|
2008-02-20 09:16:54 -05:00
|
|
|
actor = _clutter_do_pick (CLUTTER_STAGE (stage),
|
|
|
|
x, y,
|
2007-11-20 12:03:53 -05:00
|
|
|
CLUTTER_PICK_REACTIVE);
|
2007-10-03 05:28:16 -04:00
|
|
|
|
2007-11-20 12:03:53 -05:00
|
|
|
event->any.source = actor;
|
|
|
|
if (!actor)
|
|
|
|
break;
|
|
|
|
}
|
2008-02-20 09:16:54 -05:00
|
|
|
else
|
2007-11-20 12:03:53 -05:00
|
|
|
{
|
|
|
|
/* use the source already set in the synthetic event */
|
|
|
|
actor = event->any.source;
|
|
|
|
}
|
2007-10-03 05:28:16 -04:00
|
|
|
|
2007-11-16 08:41:07 -05:00
|
|
|
|
|
|
|
/* FIXME: for an optimisation should check if there are
|
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 11:44:47 -04:00
|
|
|
* actually any reactive actors and avoid the pick all together
|
2007-11-16 08:41:07 -05:00
|
|
|
* (signalling just the stage). Should be big help for gles.
|
|
|
|
*/
|
|
|
|
|
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 11:44:47 -04:00
|
|
|
CLUTTER_NOTE (EVENT,
|
|
|
|
"Reactive event received at %.2f, %.2f - actor: %p",
|
|
|
|
x, y,
|
|
|
|
actor);
|
2007-11-15 12:08:48 -05:00
|
|
|
|
2008-10-01 09:46:33 -04:00
|
|
|
/* Create, enter/leave events if needed */
|
|
|
|
generate_enter_leave_events (event);
|
|
|
|
|
|
|
|
if (event->type != CLUTTER_MOTION)
|
2007-11-16 08:41:07 -05:00
|
|
|
{
|
|
|
|
/* Generate click count */
|
|
|
|
event_click_count_generate (event);
|
|
|
|
}
|
2008-07-01 07:51:20 -04:00
|
|
|
|
|
|
|
if (device == NULL)
|
|
|
|
{
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
device = event->button.device;
|
|
|
|
break;
|
|
|
|
case CLUTTER_SCROLL:
|
|
|
|
device = event->scroll.device;
|
|
|
|
break;
|
|
|
|
case CLUTTER_MOTION:
|
|
|
|
/* already handled in the MOTION case of the switch */
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
emit_pointer_event (event, device);
|
2007-11-16 08:41:07 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CLUTTER_STAGE_STATE:
|
|
|
|
/* fullscreen / focus - forward to stage */
|
|
|
|
event->any.source = stage;
|
|
|
|
clutter_stage_event (CLUTTER_STAGE (stage), event);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLUTTER_CLIENT_MESSAGE:
|
|
|
|
break;
|
2007-10-03 05:28:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-20 09:16:54 -05:00
|
|
|
/**
|
2007-11-15 12:35:47 -05:00
|
|
|
* clutter_get_actor_by_gid
|
2007-10-08 12:18:33 -04:00
|
|
|
* @id: a #ClutterActor ID.
|
|
|
|
*
|
2007-11-15 12:35:47 -05:00
|
|
|
* Retrieves the #ClutterActor with @id.
|
|
|
|
*
|
2009-02-16 19:25:20 -05: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 12:18:33 -04:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterActor*
|
2007-11-15 12:35:47 -05:00
|
|
|
clutter_get_actor_by_gid (guint32 id)
|
2007-10-08 12:18:33 -04:00
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
g_return_val_if_fail (context != NULL, NULL);
|
|
|
|
|
2008-03-07 12:34:40 -05:00
|
|
|
return CLUTTER_ACTOR (clutter_id_pool_lookup (context->id_pool, id));
|
2007-10-08 12:18:33 -04:00
|
|
|
}
|
|
|
|
|
2007-05-16 11:00:41 -04:00
|
|
|
void
|
|
|
|
clutter_base_init (void)
|
|
|
|
{
|
|
|
|
static gboolean initialised = FALSE;
|
|
|
|
|
|
|
|
if (!initialised)
|
|
|
|
{
|
2007-05-25 06:56:09 -04:00
|
|
|
GType foo; /* Quiet gcc */
|
|
|
|
|
2007-05-16 11:00:41 -04:00
|
|
|
initialised = TRUE;
|
|
|
|
|
2009-01-06 07:11:07 -05:00
|
|
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
|
2007-05-16 11:00:41 -04:00
|
|
|
/* initialise GLib type system */
|
|
|
|
g_type_init ();
|
2007-08-08 06:20:14 -04:00
|
|
|
|
|
|
|
/* CLUTTER_TYPE_ACTOR */
|
2007-05-25 06:56:09 -04:00
|
|
|
foo = clutter_actor_get_type ();
|
2007-05-16 11:00:41 -04:00
|
|
|
}
|
|
|
|
}
|
2007-10-08 12:18:33 -04:00
|
|
|
|
2007-11-19 11:30:56 -05:00
|
|
|
/**
|
|
|
|
* clutter_get_default_frame_rate:
|
|
|
|
*
|
|
|
|
* Retrieves the default frame rate used when creating #ClutterTimeline<!--
|
|
|
|
* -->s.
|
|
|
|
*
|
|
|
|
* This value is also used to compute the default frequency of motion
|
|
|
|
* events.
|
|
|
|
*
|
|
|
|
* Return value: the default frame rate
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-10-16 09:41:34 -04:00
|
|
|
guint
|
|
|
|
clutter_get_default_frame_rate (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-10-16 09:41:34 -04:00
|
|
|
return context->frame_rate;
|
|
|
|
}
|
|
|
|
|
2007-11-19 11:30:56 -05:00
|
|
|
/**
|
|
|
|
* clutter_set_default_frame_rate:
|
|
|
|
* @frames_per_sec: the new default frame rate
|
|
|
|
*
|
|
|
|
* Sets the default frame rate to be used when creating #ClutterTimeline<!--
|
|
|
|
* -->s
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-10-16 09:41:34 -04:00
|
|
|
void
|
|
|
|
clutter_set_default_frame_rate (guint frames_per_sec)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (context->frame_rate != frames_per_sec)
|
|
|
|
context->frame_rate = frames_per_sec;
|
|
|
|
}
|
2007-11-15 12:08:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_pointer_grab_weak_notify (gpointer data,
|
|
|
|
GObject *where_the_object_was)
|
|
|
|
{
|
2008-06-23 05:55:42 -04:00
|
|
|
ClutterInputDevice *dev = (ClutterInputDevice *)data;
|
2007-11-15 12:08:48 -05:00
|
|
|
ClutterMainContext *context;
|
2008-09-23 03:03:35 -04:00
|
|
|
|
2007-11-15 12:08:48 -05:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
2008-06-23 05:55:42 -04:00
|
|
|
if (dev)
|
|
|
|
{
|
|
|
|
dev->pointer_grab_actor = NULL;
|
|
|
|
clutter_ungrab_pointer_for_device (dev->id);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->pointer_grab_actor = NULL;
|
|
|
|
clutter_ungrab_pointer ();
|
|
|
|
}
|
2007-11-15 12:08:48 -05: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 17:51:17 -05: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.
|
|
|
|
*
|
|
|
|
* <note><para>Grabs completely override the entire event delivery chain
|
|
|
|
* done by Clutter. Pointer grabs should only be used as a last resource;
|
|
|
|
* using the #ClutterActor::captured-event signal should always be the
|
|
|
|
* preferred way to intercept event delivery to reactive actors.</para></note>
|
2007-11-15 12:08:48 -05:00
|
|
|
*
|
2008-06-27 17:13:19 -04:00
|
|
|
* If you wish to grab all the pointer events for a specific input device,
|
|
|
|
* you should use clutter_grab_pointer_for_device().
|
|
|
|
*
|
2007-11-15 12:08:48 -05: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 09:16:54 -05:00
|
|
|
|
2007-11-15 12:08:48 -05:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (context->pointer_grab_actor == actor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->pointer_grab_actor)
|
|
|
|
{
|
|
|
|
g_object_weak_unref (G_OBJECT (context->pointer_grab_actor),
|
|
|
|
on_pointer_grab_weak_notify,
|
|
|
|
NULL);
|
|
|
|
context->pointer_grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actor)
|
|
|
|
{
|
|
|
|
context->pointer_grab_actor = actor;
|
|
|
|
|
|
|
|
g_object_weak_ref (G_OBJECT (actor),
|
|
|
|
on_pointer_grab_weak_notify,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-27 17:13:19 -04:00
|
|
|
/**
|
|
|
|
* clutter_grab_pointer_for_device:
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
* @id: a device id, or -1
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2008-06-23 05:55:42 -04:00
|
|
|
void
|
2008-06-27 17:13:19 -04:00
|
|
|
clutter_grab_pointer_for_device (ClutterActor *actor,
|
|
|
|
gint id)
|
2008-06-23 05:55:42 -04:00
|
|
|
{
|
|
|
|
ClutterInputDevice *dev;
|
|
|
|
|
|
|
|
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
|
|
|
/* essentially a global grab */
|
|
|
|
if (id == -1)
|
|
|
|
{
|
|
|
|
clutter_grab_pointer (actor);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev = clutter_get_input_device_for_id (id);
|
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (dev->pointer_grab_actor == actor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (dev->pointer_grab_actor)
|
|
|
|
{
|
|
|
|
g_object_weak_unref (G_OBJECT (dev->pointer_grab_actor),
|
|
|
|
on_pointer_grab_weak_notify,
|
|
|
|
dev);
|
|
|
|
dev->pointer_grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actor)
|
|
|
|
{
|
|
|
|
dev->pointer_grab_actor = actor;
|
|
|
|
|
|
|
|
g_object_weak_ref (G_OBJECT (actor),
|
|
|
|
on_pointer_grab_weak_notify,
|
|
|
|
dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-15 12:08:48 -05: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 17:13:19 -04:00
|
|
|
/**
|
|
|
|
* clutter_ungrab_pointer_for_device:
|
|
|
|
* @id: a device id
|
|
|
|
*
|
|
|
|
* Removes an existing grab of the pointer events for device @id.
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
2008-06-23 05:55:42 -04:00
|
|
|
void
|
|
|
|
clutter_ungrab_pointer_for_device (gint id)
|
|
|
|
{
|
|
|
|
clutter_grab_pointer_for_device (NULL, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-15 12:08:48 -05:00
|
|
|
/**
|
|
|
|
* clutter_get_pointer_grab:
|
|
|
|
*
|
|
|
|
* Queries the current pointer grab of clutter.
|
|
|
|
*
|
2009-02-16 19:25:20 -05:00
|
|
|
* Return value: (transfer none): the actor currently holding the pointer grab, or NULL if there is no grab.
|
2007-11-15 12:08:48 -05:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_get_pointer_grab (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
return context->pointer_grab_actor;
|
|
|
|
}
|
2007-11-15 13:00:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_keyboard_grab_weak_notify (gpointer data,
|
|
|
|
GObject *where_the_object_was)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
context->keyboard_grab_actor = NULL;
|
|
|
|
|
|
|
|
clutter_ungrab_keyboard ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_grab_keyboard:
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
*
|
2009-03-03 17:51:17 -05: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 13:00:24 -05: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 09:16:54 -05:00
|
|
|
|
2007-11-15 13:00:24 -05:00
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (context->keyboard_grab_actor == actor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->keyboard_grab_actor)
|
|
|
|
{
|
|
|
|
g_object_weak_unref (G_OBJECT (context->keyboard_grab_actor),
|
|
|
|
on_keyboard_grab_weak_notify,
|
|
|
|
NULL);
|
|
|
|
context->keyboard_grab_actor = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actor)
|
|
|
|
{
|
|
|
|
context->keyboard_grab_actor = actor;
|
|
|
|
|
|
|
|
g_object_weak_ref (G_OBJECT (actor),
|
|
|
|
on_keyboard_grab_weak_notify,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-16 19:25:20 -05:00
|
|
|
* Return value: (transfer none): the actor currently holding the keyboard grab, or NULL if there is no grab.
|
2007-11-15 13:00:24 -05:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_get_keyboard_grab (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
return context->keyboard_grab_actor;
|
|
|
|
}
|
2007-11-19 11:30:56 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_get_motion_events_frequency:
|
2008-02-20 09:16:54 -05:00
|
|
|
*
|
2007-11-19 11:30:56 -05:00
|
|
|
* Retrieves the number of motion events per second that are delivered
|
|
|
|
* to the stage.
|
|
|
|
*
|
|
|
|
* See clutter_set_motion_events_frequency().
|
|
|
|
*
|
|
|
|
* Return value: the number of motion events per second
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_get_motion_events_frequency (void)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = clutter_context_get_default ();
|
|
|
|
|
|
|
|
if (G_LIKELY (context->motion_frequency == 0))
|
|
|
|
{
|
|
|
|
guint frequency;
|
2008-02-20 09:16:54 -05:00
|
|
|
|
2007-11-19 11:30:56 -05:00
|
|
|
frequency = clutter_default_fps / 4;
|
|
|
|
frequency = CLAMP (frequency, 20, 45);
|
|
|
|
|
|
|
|
return frequency;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return context->motion_frequency;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_set_motion_events_frequency:
|
2007-12-06 07:38:04 -05:00
|
|
|
* @frequency: the number of motion events per second, or 0 for the
|
|
|
|
* default value
|
2007-11-19 11:30:56 -05:00
|
|
|
*
|
|
|
|
* Sets the motion events frequency. Setting this to a non-zero value
|
|
|
|
* will override the default setting, so it should be rarely used.
|
|
|
|
*
|
|
|
|
* Motion events are delivered from the default backend to the stage
|
|
|
|
* and are used to generate the enter/leave events pair. This might lead
|
|
|
|
* to a performance penalty due to the way the actors are identified.
|
|
|
|
* Using this function is possible to reduce the frequency of the motion
|
|
|
|
* events delivery to the stage.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_set_motion_events_frequency (guint frequency)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context = clutter_context_get_default ();
|
|
|
|
|
2007-12-06 07:38:04 -05:00
|
|
|
/* never allow the motion events to exceed the default frame rate */
|
|
|
|
context->motion_frequency = CLAMP (frequency, 1, clutter_default_fps);
|
2007-11-19 11:30:56 -05: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 10:03:28 -04: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 03:03:35 -04: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 10:03:28 -04:00
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_clear_glyph_cache (void)
|
|
|
|
{
|
|
|
|
if (CLUTTER_CONTEXT ()->font_map)
|
2008-10-30 13:11:29 -04:00
|
|
|
cogl_pango_font_map_clear_glyph_cache (CLUTTER_CONTEXT ()->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 10:03:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-01-27 09:25:50 -05: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 10:03:28 -04:00
|
|
|
*
|
2009-01-27 09:25:50 -05: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 10:03:28 -04:00
|
|
|
*
|
2009-01-27 09:25:50 -05: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 11:55:25 -05:00
|
|
|
* introduce some artifacts if the text is animated.
|
2009-01-27 09:25:50 -05:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
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 10:03:28 -04:00
|
|
|
*/
|
|
|
|
void
|
2009-01-27 09:25:50 -05: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 10:03:28 -04:00
|
|
|
{
|
2009-01-27 09:25:50 -05:00
|
|
|
ClutterFontFlags old_flags, changed_flags;
|
2009-02-26 10:32:48 -05:00
|
|
|
const cairo_font_options_t *font_options;
|
|
|
|
cairo_font_options_t *new_font_options;
|
|
|
|
ClutterBackend *backend;
|
|
|
|
|
|
|
|
backend = clutter_get_default_backend ();
|
2009-01-27 09:25:50 -05: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 10:03:28 -04:00
|
|
|
if (CLUTTER_CONTEXT ()->font_map)
|
2008-10-30 13:11:29 -04:00
|
|
|
cogl_pango_font_map_set_use_mipmapping (CLUTTER_CONTEXT ()->font_map,
|
2009-01-27 09:25:50 -05:00
|
|
|
(flags
|
|
|
|
& CLUTTER_FONT_MIPMAPPING) != 0);
|
|
|
|
|
|
|
|
old_flags = clutter_get_font_flags ();
|
|
|
|
|
2009-02-26 10:32:48 -05:00
|
|
|
font_options = clutter_backend_get_font_options (backend);
|
|
|
|
new_font_options = cairo_font_options_copy (font_options);
|
2009-01-27 09:25:50 -05: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;
|
|
|
|
|
|
|
|
if ((changed_flags & CLUTTER_FONT_HINTING))
|
2009-02-26 10:32:48 -05:00
|
|
|
cairo_font_options_set_hint_style (new_font_options,
|
2009-01-27 09:25:50 -05:00
|
|
|
(flags & CLUTTER_FONT_HINTING)
|
|
|
|
? CAIRO_HINT_STYLE_FULL
|
|
|
|
: CAIRO_HINT_STYLE_NONE);
|
|
|
|
|
2009-02-26 10:32:48 -05:00
|
|
|
clutter_backend_set_font_options (backend, new_font_options);
|
2009-01-27 11:55:25 -05:00
|
|
|
|
2009-02-26 10:32:48 -05:00
|
|
|
cairo_font_options_destroy (new_font_options);
|
2009-01-27 11:55:25 -05:00
|
|
|
|
2009-01-27 09:25:50 -05:00
|
|
|
if (CLUTTER_CONTEXT ()->pango_context)
|
2009-02-26 10:32:48 -05:00
|
|
|
update_pango_context (backend, CLUTTER_CONTEXT ()->pango_context);
|
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 10:03:28 -04: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 13:07:52 -04:00
|
|
|
|
|
|
|
/**
|
2009-01-27 09:25:50 -05: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 13:07:52 -04:00
|
|
|
*
|
2009-01-27 09:25:50 -05: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 13:07:52 -04:00
|
|
|
*
|
2009-01-27 09:25:50 -05: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 13:07:52 -04:00
|
|
|
*
|
2009-01-27 09:25:50 -05:00
|
|
|
* Since: 1.0
|
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 13:07:52 -04:00
|
|
|
*/
|
2009-01-27 09:25:50 -05: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 13:07:52 -04:00
|
|
|
{
|
2009-01-27 09:25:50 -05:00
|
|
|
ClutterMainContext *ctxt = CLUTTER_CONTEXT ();
|
2008-10-30 13:11:29 -04:00
|
|
|
CoglPangoFontMap *font_map = NULL;
|
2009-02-26 10:32:48 -05:00
|
|
|
const cairo_font_options_t *font_options;
|
2009-01-27 09:25:50 -05:00
|
|
|
ClutterFontFlags flags = 0;
|
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 13:07:52 -04:00
|
|
|
|
|
|
|
font_map = CLUTTER_CONTEXT ()->font_map;
|
|
|
|
|
2009-01-27 09:25:50 -05:00
|
|
|
if (G_LIKELY (font_map)
|
|
|
|
&& cogl_pango_font_map_get_use_mipmapping (font_map))
|
|
|
|
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 13:07:52 -04:00
|
|
|
|
2009-01-27 09:25:50 -05:00
|
|
|
font_options = clutter_backend_get_font_options (ctxt->backend);
|
|
|
|
|
|
|
|
if ((cairo_font_options_get_hint_style (font_options)
|
|
|
|
!= CAIRO_HINT_STYLE_DEFAULT)
|
|
|
|
&& (cairo_font_options_get_hint_style (font_options)
|
|
|
|
!= CAIRO_HINT_STYLE_NONE))
|
|
|
|
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 13:07:52 -04:00
|
|
|
}
|
2008-06-23 05:55:42 -04:00
|
|
|
|
2008-06-27 17:13:19 -04:00
|
|
|
/**
|
|
|
|
* clutter_get_input_device_for_id:
|
|
|
|
* @id: a device id
|
|
|
|
*
|
|
|
|
* Retrieves the #ClutterInputDevice from its id.
|
|
|
|
*
|
2009-02-16 19:25:20 -05:00
|
|
|
* Return value: (transfer none): a #ClutterInputDevice, or %NULL
|
2008-06-27 17:13:19 -04:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
ClutterInputDevice *
|
2008-06-23 05:55:42 -04:00
|
|
|
clutter_get_input_device_for_id (gint id)
|
|
|
|
{
|
|
|
|
GSList *item;
|
|
|
|
ClutterInputDevice *device = NULL;
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
|
2008-09-23 03:03:35 -04:00
|
|
|
for (item = context->input_devices;
|
|
|
|
item != NULL;
|
2008-06-23 05:55:42 -04:00
|
|
|
item = item->next)
|
|
|
|
{
|
2008-06-27 17:13:19 -04:00
|
|
|
device = item->data;
|
2008-06-23 05:55:42 -04:00
|
|
|
|
|
|
|
if (device->id == id)
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-10-30 13:11:29 -04: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-16 19:25:20 -05:00
|
|
|
* Return value: (transfer none): the #PangoFontMap instance. The returned
|
|
|
|
* value is owned by Clutter and it should never be unreferenced.
|
2008-10-30 13:11:29 -04:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
PangoFontMap *
|
|
|
|
clutter_get_font_map (void)
|
|
|
|
{
|
|
|
|
if (CLUTTER_CONTEXT ()->font_map)
|
|
|
|
return PANGO_FONT_MAP (CLUTTER_CONTEXT ()->font_map);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|