Commit Graph

31 Commits

Author SHA1 Message Date
Emmanuele Bassi
c6fba47a52 Hide clutter_context_get_default()
The clutter_context_get_default() function is private, but shared
across Clutter. For this reason, it should be prefixed by '_' so
that the symbol is hidden from the shared object.
2009-06-18 14:20:28 +01:00
Owen W. Taylor
d28c9e5db1 Remove unnecessary setting of CLUTTER_ACTOR_REALIZED flag
An implementaton of realize() never needs to set the
CLUTTER_ACTOR_REALIZED flag, though it can unset the flag if
things fail unexpectedly. (Previously, stage backend implementations
had to do this since clutter_actor_realize() wasn't used; this
is no longer the case.)

http://bugzilla.openedhand.com/show_bug.cgi?id=1634

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:07:33 +01:00
Emmanuele Bassi
0187bb3965 [actor] Use flags to control allocations
Instead of passing a boolean value, the ::allocate virtual function
should use a bitmask and flags. This gives us room for expansion
without breaking API/ABI, and allows to encode more information to
the allocation process instead of just changes of absolute origin.
2009-06-04 16:30:31 +01:00
Neil Roberts
fa0b33ec30 [clutter-stage-win32] Call clutter_actor_map instead of setting the flags
The clutter_actor_map and unmap functions need to be called to
properly update the mapped state. This matches the changes to the X11
stage in 125bded8.
2009-06-04 11:59:17 +01:00
Neil Roberts
af68945486 [clutter-event-win32] Fix the argument types to clutter_actor_get_size
clutter_actor_get_size now takes float pointers so it was issuing a
warning.
2009-06-04 11:50:52 +01:00
Emmanuele Bassi
d6d208da7d 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 16:44:47 +01:00
Havoc Pennington
125bded814 Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state

* Add a VISIBLE flag tracking application programmer's
  expected showing-state for the actor, allowing us to
  always ensure we keep what the app wants while tracking
  internal implementation state separately.

* Make MAPPED reflect whether the actor will be painted;
  add notification on a ClutterActor::mapped property.
  Keep MAPPED state updated as the actor is shown,
  ancestors are shown, actor is reparented, etc.

* Require a stage and realized parents to realize; this means
  at realization time the correct window system and GL resources
  are known. But unparented actors can no longer be realized.

* Allow children to be unrealized even if parent is realized.
  Otherwise in effect either all actors or no actors are realized,
  i.e. it becomes a stage-global flag.

* Allow clutter_actor_realize() to "fail" if not inside a toplevel

* Rework clutter_actor_unrealize() so internally we have
  a flavor that does not mess with visibility flag

* Add _clutter_actor_rerealize() to encapsulate a somewhat
  tricky operation we were doing in a couple of places

* Do not realize/unrealize children in ClutterGroup,
  ClutterActor already does it

* Do not realize impl by hand in clutter_stage_show(),
  since showing impl already does that

* Do not unrealize in various dispose() methods, since
  ClutterActor dispose implementation already does it
  and chaining up is mandatory

* ClutterTexture uses COGL while unrealizable (before it's
  added to a stage). Previously this breakage was affecting
  ClutterActor because we had to allow realize outside
  a stage. Move the breakage to ClutterTexture, by making
  ClutterTexture just use COGL while not realized.

* Unrealize before we set parent to NULL in clutter_actor_unparent().
  This means unrealize() implementations can get to the stage.
  Because actors need the stage in order to detach from stage.

* Update clutter-actor-invariants.txt to reflect latest changes

* Remove explicit hide/unrealize from ClutterActor::dispose since
  unparent already forces those
  Instead just assert that unparent() occurred and did the right thing.

* Check whether parent implements unrealize before chaining up
  Needed because ClutterGroup no longer has to implement unrealize.

* Perform unrealize in the default handler for the signal.
  This allows non-containers that have children to work properly,
  and allows containers to override how it's done.

* Add map/unmap virtual methods and set MAPPED flag on self and
  children in there. This allows subclasses to hook map/unmap.
  These are not signals, because notify::mapped is better for
  anything it's legitimate for a non-subclass to do.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-24 15:27:19 +01:00
Emmanuele Bassi
ccca24ab76 Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Colin Walters
3a4538e4f2 Typo in clutter-win32.pc.in introduced by commit 24ce19383 2009-03-10 12:16:53 +00:00
Colin Walters
24ce193836 Bug 1491 - Fix hardcoded lib path in .pc files
We should instead use @libdir@ from configure to be correct
on multilib systems.
2009-03-09 10:45:09 +00:00
Neil Roberts
1fcddb3b10 [win32] Track mouse leave messages
Bug 1178 - No enter / leave events on actors when pointer leaves the
           stage window

This patch causes the Win32 backend to emit CLUTTER_LEAVE events when
a WM_MOUSELEAVE event is received in the same way that f505536 does
for the X11 backend.

Windows will only send WM_MOUSELEAVE events if they are previously
requested using TrackMouseEvent so this needs to be called whenever
the mouse enters the window. There is no WM_MOUSELEAVE event but we
can detect when the mouse enters because we get a WM_MOUSEMOVE event.
2009-02-16 12:46:37 +00:00
Emmanuele Bassi
a32eca26b6 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1212 - Allow only a single include file for Clutter

	* clutter/*.h: Only allow including clutter.h in third
	party code.

	* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl-fixed.h:
	* clutter/cogl/cogl.h.in: Only allow including cogl.h in
	third party code.

	* clutter/cogl/common/Makefile.am:
	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gles/Makefile.am:
	* clutter/eglnative/Makefile.am:
	* clutter/eglx/Makefile.am:
	* clutter/fruity/Makefile.am:
	* clutter/glx/Makefile.am:
	* clutter/glx/clutter-glx.h:
	* clutter/osx/Makefile.am:
	* clutter/pango/Makefile.am:
	* clutter/sdl/Makefile.am:
	* clutter/win32/Makefile.am:
	* clutter/x11/Makefile.am: Fix build environment.

	* clutter/x11/clutter-x11-texture-pixmap.h:
	* clutter/x11/clutter-x11.h: Fix inclusion rules.

	* tests/test-pixmap.c: Fix inclusion of GdkPixbuf header.

	* README: Update release notes.
2008-10-30 17:04:34 +00:00
Neil Roberts
3fb00f9cdd Bug 1100 - WM_SIZE not handled correctly, user_resize and
window_style correction.

	* clutter/win32/clutter-stage-win32.c (get_window_style): Remove
	the WS_MAXIMIZEBOX style if the stage isn't resizable.
	(clutter_stage_win32_set_user_resize): Queue a redraw of the
	window frame when the user_resize property is changed.

	* clutter/win32/clutter-event-win32.c (message_translate): Don't
	update the size of the stage when handling WM_SIZE messages that
	result from the stage being minimized. Thanks to Roman Yazmin.
2008-09-16 16:00:31 +00:00
Neil Roberts
cd7b7c9c72 Bug 1091 - WM_MOUSEWHEEL (scroll-event) not handled correctlly
* clutter/win32/clutter-event-win32.c (message_translate): The
	coordinates in a WM_MOUSEWEEL message are given relative to the
	screen so they need to be converted to client coordinates before
	use. Thanks to Roman Yazmin.
2008-08-07 20:34:37 +00:00
Neil Roberts
abbcf0ee4b * clutter/win32/clutter-backend-win32.c (check_vblank_env): Use
g_ascii_strcasecmp instead of strcasecmp because strcasecmp isn't
	available in MSVC.
2008-06-30 16:08:45 +00:00
Neil Roberts
06d0696874 * clutter/x11/clutter-event-x11.c:
* clutter/win32/clutter-event-win32.c: Use the HAVE_CONFIG_H guard
	around #include "config.h"
2008-06-30 16:01:56 +00:00
Emmanuele Bassi
a07d57572c 2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c:
	(clutter_actor_set_min_width),
	(clutter_actor_set_min_height),
	(clutter_actor_set_natural_width),
	(clutter_actor_set_natural_height): Ignore any override of the
	minimum and natural size of the stage on backends that only
	support static stages.

	* clutter/clutter-stage.c (clutter_stage_allocate): Use the
	preferred size of the ClutterStage implementation instead of
	the display size.

	* clutter/clutter-backend.[ch]: Remove get_display_size() and
	clutter_backend_get_display_size().

	* clutter/eglnative/clutter-backend-egl.c:
	* clutter/fruity/clutter-backend-fruity.c:
	* clutter/osx/clutter-backend-osx.c:
	* clutter/sdl/clutter-backend-sdl.c:
	* clutter/win32/clutter-backend-win32.c:
	* clutter/x11/clutter-backend-x11.c: Remove get_display_size()
	implementations.
2008-06-26 21:42:44 +00:00
Neil Roberts
5f3db8e0a0 * clutter/win32/clutter-backend-win32.c
(clutter_backend_win32_get_display_size): Implement
	get_display_size on the Win32 backend.
2008-06-25 16:51:43 +00:00
Neil Roberts
1049959d34 * clutter/win32/clutter-stage-win32.c
(clutter_stage_win32_realize): Use a more direct method to choose
	the best pixel format instead of ChoosePixelFormat because
	otherwise if the display's depth is 16 then it will prefer the
	non-accelerated software implementation when the requested depth
	is 24.
2008-06-25 12:25:43 +00:00
Neil Roberts
feb16bcf95 Bug 979 - Wrong call convension for SwapIntervalProc in win32 backend
* clutter/win32/clutter-backend-win32.c: Use the correct calling
	convention for SwapInterval. Thanks to Haakon Sporsheim.
2008-06-24 22:07:15 +00:00
Neil Roberts
e4304e2d0a * clutter/win32/clutter-stage-win32.c: Updated to the new layout
API. All code to do with positioning the stage has been removed so
	the window is left where Windows wants to put it and it can not be
	moved with clutter_actor_set_position.

	* clutter/win32/clutter-stage-win32.h (ClutterStageWin32): Remove
	win_xpos and win_ypos.

	* clutter/win32/clutter-event-win32.c (message_translate): Remove
	the handler for WM_MOVE because the stage no longer cares where it
	is positioned.
2008-06-12 12:12:25 +00:00
Neil Roberts
bfaacb10bf * clutter/win32/clutter-event-win32.c (message_translate): Fix
signedness of old_xpos and old_ypos to get rid of compiler
	warnings.

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_get_features): Cast the result of
	glGetString to a signed char pointer to avoid compiler warnings.
2008-05-16 09:47:37 +00:00
Neil Roberts
8ef653a9e8 * clutter/win32/clutter-stage-win32.c:
* clutter/win32/clutter-backend-win32.c: Reflect changes to the
	GLX/X11 backend in revisions 2708-2709 and 2713-2715 which
	simplify the backend a little.
2008-05-15 22:03:22 +00:00
Neil Roberts
6409b1adeb Merged clutter-ivan branch into trunk.
svn merge \
 https://svn.o-hand.com/repos/clutter/trunk/clutter@2509 \
 https://svn.o-hand.com/repos/clutter/branches/clutter-ivan@HEAD
2008-04-25 13:37:36 +00:00
Neil Roberts
3d1f2a0859 Added support for foreign windows to the Win32 backend.
* clutter/win32/clutter-stage-win32.c
	(clutter_stage_win32_request_coords): Don't resize foreign
	windows.
	(clutter_stage_win32_unrealize): Don't destroy foreign windows.
	(clutter_stage_win32_init): Added initialiser for is_foreign_win.
	(clutter_win32_get_stage_from_window): Resort to looking in the
	stage list if the window isn't the right window class so that it
	can still find stages with foreign windows.
	(clutter_win32_set_stage_foreign): New public function to set a
	foreign window for a stage.

	* clutter/win32/clutter-event-win32.c
	(clutter_win32_disable_event_retrieval): New public function to
	disable event retrieval.
	(message_translate): Don't handle WM_SIZE or WM_MOVE for foreign
	windows.

	* clutter/win32/clutter-backend-win32.h (struct
	_ClutterBackendWin32): Added a flag to disable event retrieval

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_ensure_context): Update debug note to
	include whether the stage is foreign or not.
2008-04-15 16:12:37 +00:00
Neil Roberts
0b8a500fca Upgraded the Win32 backend to work with the multi-stage
subclassing code.

	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: Now inherits from
	ClutterGroup and implements ClutterStageWindow instead of
	inheriting directly from ClutterStage.

	* clutter/win32/clutter-event-win32.c (message_translate): Now
	takes an extra parameter to return whether DefWindowProc should be
	called. This is needed to prevent the default WM_CLOSE handler
	from destroying the window.

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_dispose): Destroy all of the stages using
	g_slist_foreach as per bug #871. Now also destroys the GL context.
	(clutter_backend_win32_get_features): Added assertions to ensure
	there is a valid GL context.
	(clutter_backend_win32_ensure_context): Accepts NULL stage. Gets
	implementation pointer from the stage.
2008-04-13 08:43:32 +00:00
Neil Roberts
e88c8b4ce1 2008-03-30 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_init): Added a call to
	timeBeginPeriod. Without this the frame rates are terrible because
	the glib timeouts are not accurate enough. However this requires
	Glib >= 2.16.0 to take any effect because of a change in the way
	g_poll is implemented. See revision 6597 of glib.
	(clutter_backend_win32_finalize): Added a call to timeEndPeriod.

	* configure.ac: Added -lwinmm to the library dependencies for the
	Win32 backend.
2008-03-30 22:27:27 +00:00
Neil Roberts
1a263dca5c 2008-03-30 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-win32.h: 
	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: 
	* clutter/win32/clutter-event-win32.c: 
	* clutter/win32/clutter-backend-win32.h: 
	* clutter/win32/clutter-backend-win32.c:
	Upgraded for multi-stage support.

	* clutter/win32/clutter-stage-win32.c
	(clutter_stage_win32_request_coords): Fixed so that it doesn't set
	the position or size if it hasn't changed. This was causing
	problems when the window was resized using the top left corner. In
	that case the window receives resize and move messages separately
	which caused the window to flash at a different size or position
	while one message was handled before the other.
	(clutter_stage_win32_realize): Added PFD_GENERIC_ACCELERATED to
	the list of pixel format flags to force it to use hardware
	acceleration.

2008-03-30  Neil Roberts  <neil@o-hand.com>

	* clutter-sections.txt: Added clutter_win32_get_stage_from_window
2008-03-30 16:51:01 +00:00
Neil Roberts
dd7ff3e829 2008-03-26 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-win32.h: Added gtk-doc documentation for
	the Win32 backend section.

	* clutter/win32/clutter-stage-win32.c
	(clutter_win32_get_stage_window): Fixed punctuation in the
	documentation.

	* README: Added notes about the Win32 backend.

2008-03-26  Neil Roberts  <neil@o-hand.com>

	* clutter-sections.txt: Added a section for the Win32 specific
	API.

	* clutter-docs.sgml: Added comments about the Win32 backend.

	* Makefile.am: Added bits to ignore the headers for the Win32
	backend.
2008-03-26 22:22:32 +00:00
Neil Roberts
9b52136be4 2008-03-26 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-event-win32.c (clutter_event_check):
	Removed the pointless parameter in the call to check_msg_pending.
	(check_msg_pending): Fixed to use PeekMessageW instead of
	PeekMessage.
2008-03-26 10:58:12 +00:00
Neil Roberts
051ed6b43b 2008-03-25 Neil Roberts <neil@o-hand.com>
Added a native Win32 WGL backend.

	* configure.ac: Added the 'win32' flavour.

	* clutter/cogl/gl/cogl.c (cogl_get_proc_address): Added an ifdef
	to use wglGetProcAddress with the Win32 backend.

	* clutter/Makefile.am (DIST_SUBDIRS): Added the win32 directory.

	* clutter/win32/clutter-win32.pc.in:
	* clutter/win32/clutter-win32.h: 
	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: 
	* clutter/win32/clutter-event-win32.c: 
	* clutter/win32/clutter-backend-win32.h: 
	* clutter/win32/Makefile.am:
	* clutter/win32/clutter-backend-win32.c: New files.
2008-03-25 15:42:50 +00:00