Commit Graph

22 Commits

Author SHA1 Message Date
Neil Roberts
d454bfcc87 [ClutterStageX11] Remove the handling_configure flag
Since Clutter changed to using a layout scheme the handling_configure
flag no longer works because the allocate method is not invoked
immediately during the call to set_size from the ConfigureNotify
handler. However it is also no longer neccessary because the resizes
are effectively batched up until a relayout is run so it won't cause
an infinite loop of resize and notify events anyway.
2009-01-14 15:10:50 +00:00
Emmanuele Bassi
4f6cc0b25f [x11] Proper fix for the ClutterStage resize race
Continuation of the fix in commit 00a3c69868.

Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.

This commit will break the stage embedding into other toolkits.
2009-01-12 11:15:41 +00:00
Emmanuele Bassi
00a3c69868 [x11] Fix a race condition when resizing a stage
There is a race condition when we resize a stage before showing
it on X11.

The race goes like this:

  - clutter_init() creates the default stage and realize it, which
    will cause a 640x480 Window to be created
  - call set_size(800, 600) on the stage will cause the Window to be
    resized to 800x600
  - call show() on the stage for the first time will cause COGL
    to set up an 800 by 600 GL viewport
  - the Window will be mapped, which will cause X to notify the
    window manager that the Window should be resized to 800x600
  - the window manager will approve the resize
  - X resizes the drawable to 800x600

To fix the race, we need to defer COGL from setting up the viewport
until we receive a ConfigureNotify event and the X server has resized
the Drawable.

In order to defer the call to cogl_setup_viewport() we add a new
private flag, CLUTTER_STAGE_IN_RESIZE; the flag is checked whenever
we need to change the viewport size along with the SYNC_MATRICES
private flag. Thus, cogl_setup_viewport() will be called only if
SYNC_MATRICES is set and IN_RESIZE is not set.
2009-01-09 12:06:46 +00:00
Emmanuele Bassi
473d0e9fc3 2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box

	* clutter/clutter-actor.[ch]: Rework the size allocation,
	request and paint area. Now ::request_coords() is called
	::allocate(), and ::query_coords() has been split into
	::get_preferred_width() and ::get_preferred_height(). See
	the documentation and the layout test on how to implement
	a container and layout manager with the new API. (#915,
	based on a patch by Havoc Pennington, Lucas Rocha and Johan
	Bilien)

	* clutter/clutter-clone-texture.c: Port CloneTexture to
	the new size negotiation API; it just means forwarding
	the requests to the parent texture.

	* clutter/clutter-deprecated.h: Add deprecated and replaced
	API.

	* clutter/clutter-entry.c: Port Entry to the new size
	negotiation API.

	* clutter/clutter-group.c: Port Group to the new size
	negotiation API; the semantics of the Group actor do not
	change.

	* clutter/clutter-label.c: Port Label to the new size
	negotiation API, and vastly simplify the code.

	* clutter/clutter-main.[ch]: Add API for executing a
	relayout when needed.

	* clutter/clutter-private.h: Add new Stage private API.

	* clutter/clutter-rectangle.c: Update the get_abs_opacity()
	call to get_paint_opacity().

	* clutter/clutter-stage.c:
	(clutter_stage_get_preferred_width),
	(clutter_stage_get_preferred_height),
	(clutter_stage_allocate),
	(clutter_stage_class_init): Port Stage to the new size
	negotiation API.

	* clutter/clutter-texture.c: Port Texture to the new size
	negotiation API.

	* clutter/clutter-types.h: Add ClutterRequestMode enumeration.

	* clutter/x11/clutter-stage-x11.c: Port the X11 stage
	implementation to the new size negotiation API.

	* tests/Makefile.am: Add the layout manager test case.

	* tests/test-opacity.c: Update.

	* tests/test-project.c: Update.

	* tests/test-layout.c: Test case for a layout manager implemented
	using the new size negotiation API; the layout manager handles
	both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
Matthew Allum
94b2d6f664 2008-05-26 Matthew Allum <mallum@openedhand.com>
* clutter/x11/clutter-stage-x11.c: (clutter_stage_x11_request_coords):
        Dont allow the window to be resize to 0 dimentions. (fixes #933)
2008-05-26 20:55:53 +00:00
Emmanuele Bassi
6022344a80 2008-05-13 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-event-x11.c (event_translate): Remove the
	cheap Expose event compression, as it seems to play games when a
	composite manager is running. It's also not really needed, as
	the redraw queue will avoid redraws too close to each other
	anyway.

	* clutter/x11/clutter-stage-x11.c:
	(clutter_stage_x11_show), (clutter_stage_x11_hide): Do not chain
	up just to set the flags. This fixes a critical warning coming
	from ClutterActor::hide() default implementation.
2008-05-13 10:21:25 +00:00
Emmanuele Bassi
101a3cac4e 2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
	duplicated code and all the bookkeeping from the backends into
	ClutterStage whenever possible, to reduce the amount of	work a
	backend must do (and possibly get wrong). Thanks to Tommi
	Komulainen.

	* clutter/clutter-main.c:
	(clutter_init_with_args), (clutter_init): Realize the default
	stage after creation. The default stage is special, because we
	use it in the initialization sequence. This removes the burden
	from the backends and reduces the things a backend can get
	wrong.

	* clutter/clutter-stage.c:
	(clutter_stage_show): Make sure to realize the implementation if
	it hasn't been realized yet.

	(clutter_stage_realize): Set the REALIZED flag and call
	clutter_stage_ensure_current() if the implementation was
	successfully realized.

	(clutter_stage_unrealized): Call clutter_stage_ensure_current()
	on unrealize.

	* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_create_stage): Do not realize the stage anymore
	when creating it, and let the normal realization sequence take
	place.

	(clutter_backend_glx_ensure_context): Trap for X11 errors.

	* clutter/glx/clutter-stage-glx.c:
	(clutter_stage_glx_realize): Chain up to the X11 implementation
	so that we can set up the window state (title, cursor visibility)
	when we actually have a X window. Also, do not call
	clutter_stage_ensure_current(), and rely on the wrapper to do
	it for us. This means we can drop setting the REALIZED flag on
	the wrapper.

	(clutter_stage_glx_unrealize): Do not call
	clutter_stage_ensure_current() ourselves, and rely on the wrapper
	to do it for us.

	* clutter/x11/clutter-stage-x11.c:
	(set_wm_title),	(set_cursor_visible): Move the WM title and
	cursor visibility code inside their own functions.

	(clutter_stage_x11_realize): Set the window title and whether the
	cursor is visible or not after realizing the stage.

	(clutter_stage_x11_set_cursor_visible),
	(clutter_stage_x11_set_title): Call set_wm_title() and
	set_cursor_visible().

	(clutter_stage_x11_finalize): Free the title string.

	* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
	so that we can set it even when the stage hasn't been realized
	yet.

	* clutter/eglnative/clutter-backend-egl.c:
	(clutter_backend_egl_create_stage):
	* clutter/eglnative/clutter-stage-egl.c:
	(clutter_stage_egl_unrealize),
	(clutter_stage_egl_realize): Update the eglnative backend.

	* clutter/eglx/clutter-backend-egl.c:
	(clutter_backend_egl_ensure_context),
	(clutter_backend_egl_create_stage):
	* clutter/eglx/clutter-stage-egl.c:
	(clutter_stage_egl_unrealize),
	(clutter_stage_egl_realize): Update the eglx backend.

	* clutter/sdl/clutter-backend-sdl.c:
	(clutter_backend_sdl_create_stage):
	* clutter/sdl/clutter-stage-sdl.c:
	(clutter_stage_sdl_realize): Update the sdl backend.

	* clutter/fruity/clutter-backend-fruity.c:
	(clutter_backend_fruity_create_stage):
	* clutter/sdl/clutter-stage-fruity.c:
	(clutter_stage_fruity_realize): Update the fruity backend.

	* tests/test-multistage.c (on_button_press): Bail out if
	clutter_stage_new() returns NULL.

	* HACKING.backends: Update backend writing documentation.
2008-05-12 15:26:37 +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
Emmanuele Bassi
7fd5d5d10d 2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-backend.c: Add more debug messages

	* clutter/clutter-stage.h:
	* clutter/clutter-stage.c:
	(clutter_stage_is_default): Add a function to check if the
	stage is the default one.

	* clutter/glx/clutter-backend-glx.c:
	* clutter/glx/clutter-stage-glx.c:
	* clutter/x11/clutter-stage-x11.c: Keep the stage wrapper
	and implementation flags in sync, to ensure that the GL
	context is always set.
2008-04-04 17:26:26 +00:00
Emmanuele Bassi
f859135082 2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>
Bug #864 - Allow instantiating and subclassing of ClutterStage

	* clutter/Makefile.am: Add clutter-stage-window.[ch]

	* clutter/clutter-stage-manager.c:
	(_clutter_stage_manager_remove_stage): Do not warn if removing
	a stage we don't manage, as we might be invoked multiple times
	during a ClutterState dispose sequence.

	* clutter/clutter-actor.c:
	* clutter/clutter-backend.[ch]:
	* clutter/clutter-main.c:
	* clutter/clutter-private.h:
	* clutter/clutter-stage.[ch]: Make ClutterStage a proxy actor,
	with a private actor implementing the ClutterStageWindow
	interface for handling the per-backend realization, painting
	and unrealization, plus all the windowing system abstraction.

	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-stage-x11.[ch]: Port the X11 backend
	to the new backend and stage API and semantics.

	* clutter/glx/clutter-backend-glx.c:
	* clutter/glx/clutter-stage-glx.c: Port the GLX backend to
	the new backend and stage API and semantics.

	* clutter/eglx/clutter-backend-egl.[ch]:
	* clutter/eglx/clutter-stage-egl.[ch]: Port the EGLX backend
	to the new backend and stage API and semantics (untested).

	* tests/test-multistage.c (on_button_press): Rename
	clutter_stage_create_new() to clutter_stage_new().
2008-04-04 15:02:11 +00:00
Neil Roberts
f126822b5c 2008-04-04 Neil Roberts <neil@o-hand.com>
Applied patch from bug #810.

	* clutter/x11/clutter-event-x11.c (event_translate): Set a flag
	when resizing the stage from a ConfigureNotify event.

	* clutter/x11/clutter-stage-x11.c
	(clutter_stage_x11_request_coords): Don't try to resize the window
	again if the flag is set.
	(clutter_stage_x11_init): Added initialiser for the flag.

	* clutter/x11/clutter-stage-x11.h (struct _ClutterStageX11): Added
	the flag.
2008-04-04 13:46:50 +00:00
Matthew Allum
8847bcd195 2008-03-28 Matthew Allum <mallum@openedhand.com>
* clutter/Makefile.am:
        * clutter/clutter-actor.c:
        * clutter/clutter-actor.h:
        * clutter/clutter-backend.c:
        * clutter/clutter-backend.h:
        * clutter/clutter-debug.h:
        * clutter/clutter-event.c:
        * clutter/clutter-event.h:
        * clutter/clutter-feature.h:
        * clutter/clutter-group.h:
        * clutter/clutter-main.c:
        * clutter/clutter-main.h:
        * clutter/clutter-private.h:
        * clutter/clutter-stage.c:
        * clutter/clutter-stage.h:
        * clutter/clutter-stage-manager.c
        * clutter/clutter-stage-manager.h
        * clutter/clutter-types.h:
        * clutter/glx/clutter-backend-glx.c:
        * clutter/glx/clutter-backend-glx.h:
        * clutter/glx/clutter-stage-glx.c:
        * clutter/glx/clutter-stage-glx.h:
        * clutter/x11/clutter-backend-x11.c:
        * clutter/x11/clutter-backend-x11.h:
        * clutter/x11/clutter-event-x11.c:
        * clutter/x11/clutter-stage-x11.c:
        * clutter/x11/clutter-x11.h:
        * tests/Makefile.am:
        * tests/test-multistage.c:
        Initial commit of multi stage support (mostly a merge from the
        clutter-multistage branch).
        Note, this commit will break all backends except glx.
2008-03-28 22:50:55 +00:00
Emmanuele Bassi
4dfe577fba 2008-02-21 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-event-x11.c (event_translate): Ignore
	PropertyNotify events if they don't match our window.

	* clutter/x11/clutter-stage-x11.c:
	(clutter_stage_x11_request_coords): Chain up to the parent's
	request coords.
2008-02-21 12:45:48 +00:00
Emmanuele Bassi
cbf1b90895 2008-02-21 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-event-x11.c (event_translate): Ignore
	ConfigureNotify events if we are painting on a foreign window.

	* clutter/x11/clutter-stage-x11.c:
	(clutter_stage_x11_request_coords): Reliquish control of the
	window size, if we are painting on a foreign window. This fixes
	the GtkClutterEmbed widget.
2008-02-21 12:17:01 +00:00
Matthew Allum
a3c79e567c 2008-02-07 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-stage.c:
        * clutter/clutter-stage.h:
        * clutter/eglnative/clutter-stage-egl.c:
        * clutter/eglx/clutter-stage-egl.c:
        * clutter/osx/clutter-stage-osx.c:
        * clutter/sdl/clutter-stage-sdl.c:
        * clutter/x11/clutter-stage-x11.c:
        Add at least somne basic offscreen handling into all backends.
        Remove unused clutter_stage_set_offscreen vfunc. (#549)

        * clutter/clutter-texture.c:
        Minor API doc tweak, noting rowstride source in set_area
2008-02-07 12:55:51 +00:00
Matthew Allum
8366a906e2 2008-02-01 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-feature.h:
        * clutter/clutter-texture.c:
        * clutter/clutter-texture.h:
        * clutter/cogl/cogl.h:
        * clutter/cogl/gl/cogl.c:
        * clutter/cogl/gles/cogl.c:
        * tests/Makefile.am:
        * tests/test.fbo.c:
        Add initial support for FBO's in Clutter (OpenGL only so far).
        See new clutter_texture_new_from_actor()
        Initial implementation, needs work.

        * clutter/x11/clutter-stage-x11.c:
        (clutter_stage_x11_set_cursor_visible):
        Fall back to again not relying on xfixes to hide cursor. *sigh*

        * clutter/clutter-deprecated.h:
        Add clutter_group_find_child_by_id
2008-02-01 15:29:00 +00:00
Robert Bradford
e40ba6e9b7 2008-01-31 Rob Bradford <rob@openedhand.com>
* clutter/x11/clutter-backend-x11-private.h:
	Add missing start to comment

	* clutter/x11/clutter-backend-x11.c:
	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-stage-x11.c:
	* clutter/x11/clutter-x11.h:
	Remove tabs.
2008-01-31 11:24:11 +00:00
Emmanuele Bassi
69bc9516f9 2007-11-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-stage-x11.c:
	(clutter_stage_x11_set_cursor_visible): Restore the XFixes usage,
	as it now seems to be have been fixed.
2007-11-26 12:10:20 +00:00
Emmanuele Bassi
a02e20a14a 2007-11-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c:
	(clutter_actor_real_show),
	(clutter_actor_real_hide): Do not set the MAPPED flag on the actor
	if it is a top-level one (like ClutterStage); the backends are
	responsible for setting that flag, as it might be the result of an
	asynchronous operation (e.g. on X11).
	
	* clutter/eglnative/clutter-stage-egl.c:
	(clutter_stage_egl_show),
	(clutter_stage_egl_hide): Set/unset the CLUTTER_ACTOR_MAPPED flag
	on show and hide respectively.

	* clutter/osx/clutter-stage-osx.c:
	(clutter_stage_osx_show),
	(clutter_stage_osx_hide): Ditto as above.

	* clutter/sdl/clutter-stage-sdl.c:
	(clutter_stage_sdl_show),
	(clutter_stage_sdl_hide): Ditto as above, plus chain up to the
	parent class show/hide virtual functions.

	* clutter/x11/clutter-event-x11.c (event_translate): Use the MapNotify
	and UnmapNotify events to call the X11 stage map/unmap functions.

	* clutter/x11/clutter-stage-x11.[ch]:
	(clutter_stage_x11_set_fullscreen): Set the fullscreen_on_map flag
	with the fullscreen value.

	(clutter_stage_x11_map), (clutter_stage_x11_unmap): Set the MAPPED
	flag on the stage actor and redraw; also, if the fullscreen_on_map
	flag was set, call clutter_stage_fullscreen() as well. (#648)

	* tests/Makefile.am:
	* tests/test-fullscreen.c: Add a fullscreen test case for checking
	whether fullscreen works on every backend/platform.
2007-11-26 12:07:25 +00:00
Emmanuele Bassi
7c7b9d0568 2007-11-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-stage-x11.c: Chain up the hide and show
	to the parent's implementation.
2007-11-23 13:07:04 +00:00
Emmanuele Bassi
b7a79cf198 2007-11-17 Emmanuele Bassi <ebassi@openedhand.com>
Optimise Atoms usage in the X11 and X11-based backends.

	* clutter/x11/clutter-backend-x11.c:
2007-11-17 18:11:14 +00:00
Matthew Allum
3607a470aa 2007-11-15 Matthew Allum <mallum@openedhand.com>
* clutter/Makefile.am:
        * clutter/eglx/Makefile.am:
        * clutter/eglx/clutter-backend-egl.c:
        * clutter/eglx/clutter-backend-egl.h:
        * clutter/eglx/clutter-eglx.h:
        * clutter/eglx/clutter-event-egl.c:
        * clutter/eglx/clutter-stage-egl.c:
        * clutter/eglx/clutter-stage-egl.h:
        * clutter/glx/Makefile.am:
        * clutter/glx/clutter-backend-glx.c:
        * clutter/glx/clutter-backend-glx.h:
        * clutter/glx/clutter-event-glx.c:
        * clutter/glx/clutter-glx.h:
        * clutter/glx/clutter-stage-glx.c:
        * clutter/glx/clutter-stage-glx.h:
        * clutter/x11/Makefile.am:
        * clutter/x11/clutter-backend-x11-private.h:
        * clutter/x11/clutter-backend-x11.c:
        * clutter/x11/clutter-backend-x11.h:
        * clutter/x11/clutter-event-x11.c:
        * clutter/x11/clutter-stage-x11.c:
        * clutter/x11/clutter-stage-x11.h:
        * clutter/x11/clutter-x11.h:
        Create a new X11 backend class of which EGL and GLX 'real' backends
        then subclass. Effectively shares all X11 code between both backends
        avoids code duplication and brings many missing features to EGL X
        backend. Requires some cleanup and testing. (#518)

        * clutter/cogl/gles/cogl.c: (cogl_color):
        Add define to use color4ub only if configure finds it.
        If not fall back to old code.

        * configure.ac:
        Drop support for vincent checks.
        Drop sdles backend.
        Specifically check for color4ub call.
2007-11-15 14:45:27 +00:00