Commit Graph

31 Commits

Author SHA1 Message Date
Emmanuele Bassi
6d68ac2e8b osx: Clean up the backend implementation
Instead of implementing create_stage() and a constructor for
ClutterStageOSX, we can use the default implementations in
ClutterBackend, and spare us some code duplication.
2011-11-10 14:55:04 +00:00
Emmanuele Bassi
17c89bd0a0 backend: Clean up the device manager creation
Create the device manager during the event initialization, where it
makes sense.

This allows us to get rid of the per-backend get_device_manager()
virtual function, and just store the DeviceManager pointer into the
ClutterBackend structure.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
b980d2dc17 */backend: Store the StageWindow implementation type 2011-11-10 14:55:03 +00:00
Emmanuele Bassi
adb6ffbd0e backend: Unify the event initialization
Input backends are, in some cases, independent from the windowing system
backends; we can initialize input handling using a model similar to what
we use for windowing backends, including an environment variable and
compile-/run-time checks.

This model allows us to remove the backend-specific init_events(), and
use a generic implementation directly inside the base ClutterBackend
class, thus further reducing the backend-specific code that every
platform has to implement.

This requires some minor surgery to every single backend, to make sure
that the function exposed to initialize the event loop is similar and
performs roughly the same operations.
2011-11-10 14:42:40 +00:00
Emmanuele Bassi
a09bbffd92 Implement multi-backend support
The Clutter backend split is opaque enough that should allow us to just
build all possible backends inside the same shared object, and select
the wanted backend at initialization time.

This requires some work in the build system, as well as the
initialization code, to remove duplicate functions that might cause
conflicts at build and link time. We also need to defer all the checks
of the internal state of the platform-specific API to run-time type
checks.
2011-11-03 13:45:19 +00:00
Emmanuele Bassi
53d9e88135 Remove _clutter_shader_release_all()
This function is called when the backend is being disposed - as a way
of releasing all ClutterShader. This doesn't take into account three
things:

  - ClutterShader is deprecated
  - the Backend is *never* disposed
  - once the process terminates, all its resources are automatically
    released by the OS

So the _clutter_shader_release_all() function is a pointless exercise
in futility.
2011-10-12 10:36:17 +01:00
Emmanuele Bassi
18b3da95ef osx: Code style cleanups 2011-07-13 19:33:11 +01:00
Emmanuele Bassi
54a4511247 Fix some ISO C90 warnings on OSX 2011-02-15 12:14:17 +00:00
Emmanuele Bassi
224280be22 backend: Invoke ClutterStageWindow::redraw by default
Instead of asking all backends to do that for us, we can call
ClutterStageWindow::redraw ourselves by default.

This changeset fixes all backends to actually do the right thing, and
move the stage implementation redraw inside the ClutterStageWindow
implementation itself.
2011-02-09 13:29:30 +00:00
Emmanuele Bassi
9fa85ee9bf osx: Add more checks to the redraw function
The redraw function might be called during destruction phase, when the
Stage state has not entirely been tore down. We need to be slightly more
resilient to that scenario.
2011-02-03 16:25:42 +00:00
Viatcheslav Gachkaylo
901ed32568 Fixed bugs with mouse events.
Enter/leave events are now being received. Mouse move events
now work properly.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2545
2011-02-03 10:58:38 +00:00
Emmanuele Bassi
2c1f8c9ad3 osx: Add devices to event translation code
Use a DeviceManager sub-class similar to the Win32 backend one, which
creates two InputDevices: a core pointer and a core keyboard.

The event translation code then uses these two devices to fill out the
.device field of the events.

Throw in enter/leave tracking, given that we need to update the device's
state.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
2011-01-31 13:47:34 +00:00
Emmanuele Bassi
8613013ab0 Clean up clutter-private.h/3
Move Stage private API to a separate header.
2010-10-21 11:33:26 +01:00
Emmanuele Bassi
f8af2da4c8 osx: Compilation fixes
Replace deprecated symbols with the correct ones.
2010-10-10 09:31:55 +01:00
Roman Kudiyarov
52b6a3cd49 osx: added resolution initialization in backend
It's important step of initialization because all features calls from
font rendering libs based on this parameter. By default it equals to
-1 and test-text-cache test crashes in this case.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
8e2b45648f osx: Fixed problem with freezing application while checking behaviour.
Problem was in incorrect application initialization.
[NSApplication sharedApplication] should be call in backend init(not
in init stage). It doesn't require any data and only makes a
connection to window server.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
8c69a639cb osx: Fixed bug with creating context twice.
We should assign context and pixel_format vars to null to avoid
multiple context creation.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
50793eac51 osx: added create_context function in backend
Cleanup clutter_backend_osx_post_parse function and move context
initialization to clutter_backend_osx_create_context. The OpenGL pixel
format attributes were taken as is. Also move bringing application to
foreground in clutter_stage_osx_realize, it seems there is best place
for it.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
e3295050f5 osx: Fixed crash while features initialization
Clearing current context couses incorrect work of glGetString function
and all next GL functions that use it work incorrectly.
2010-08-04 15:13:10 +01:00
Robert Bragg
279e68d8d9 osx: explicitly request depth and stencil buffer bits
This is a blind patch because I don't know enough about the osx backend
and the osx backend probably doesn't even work these days anyway but
since people have filed bugs specifically on OSX that imply they don't
have a depth or stencil buffer this tries to fix that.

Maybe someone will eventually pick up the osx backend again and verify
if this helps.

http://bugzilla.clutter-project.org/show_bug.cgi?id=1394
2010-07-07 14:09:32 +01:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Joshua Lock
031d4d6203 osx: Fix a warning on Snow Leopard
Apple where nice and changed API between releases. This patch checks the
version of the compilation environment and tries to use the right parameter
type.

http://bugzilla.openedhand.com/show_bug.cgi?id=1866
2009-11-06 11:48:42 +00:00
Joshua Lock
4533e37744 osx: Implement the updated ClutterStageWindow interface
In the new Clutter world backend stage implementations should be lightweight
objects implementing the ClutterStageWindow interface and not ClutterActor
subclasses.

This patch performs various cut-n-pastes to acheive that for the OSX backend

http://bugzilla.openedhand.com/show_bug.cgi?id=1864
2009-11-06 11:47:49 +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
Emmanuele Bassi
561e95eedf 2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/osx/clutter-backend-osx.c:
	(clutter_backend_osx_get_display_size): Fix the allocation pool
	macro name.
2008-06-26 13:52:35 +00:00
Emmanuele Bassi
ce348f805c 2008-06-25 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/osx/clutter-backend-osx.c:
	(clutter_backend_osx_get_display_size),
	(clutter_backend_osx_class_init): Implement the get_display_size
	function.
2008-06-25 15:59:54 +00:00
Tommi Komulainen
45ff3cb00c OSX: print GL_VENDOR, GL_RENDERER, GL_VERSION and GL_EXTENSIONS
* clutter/osx/clutter-backend-osx.c (clutter_backend_osx_post_parse):
	Print GL_VENDOR, GL_RENDERER, GL_VERSION and GL_EXTENSIONS to aid
	debugging.
2008-06-09 23:00:31 +00:00
Tommi Komulainen
b8e8a80a40 OSX: add multistage support
Bug #911 - OSX: add multistage support

	* clutter/osx/clutter-backend-osx.{c,h}
	(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
	clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
	clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
	clutter_backend_osx_dispose, ClutterGLView:drawRect:):
	* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
	ClutterGLWindow:setFrameSize:):
	Adapt to new multistage backend API. Don't keep a pointer to
	default stage. Derive from ClutterActor instead of ClutterStage.
	Implement ClutterStageWindow interface. Paint, resize and
	otherwise manipulate the wrapper rather than self when necessary.

	(clutter_backend_post_parse): Create our singleton GL context
	here. We could probably create the context when the default
	stage is created, but I think this is more clean.

	* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
	* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
	ClutterGLWindow:windowShouldClose:):
	* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
	for clutter-event-osx.c to easily get the stage for NSWindow.
	Fill in ClutterEventAny::stage on our events.

	Consistently use 'stage_osx' and 'wrapper' as variable names
	when referring to ClutterStageOSX and ClutterStage objects
	respectively.
2008-06-05 21:27:58 +00:00
Tommi Komulainen
cba23c0b26 OSX: add missing memory pool wrapup
Bug #910 - OSX: missing memory pool

	* clutter/osx/clutter-backend-osx.c (clutter_backend_osx_redraw):
	Add missing memory pool wrapup.
2008-06-05 21:27:28 +00:00
Emmanuele Bassi
e57b42ae52 2007-11-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c (clutter_actor_destroy): Bail out
	if clutter_actor_destroy() was called on the stage: the stage
	is not for the user to destroy.

	* clutter/x11/clutter-backend-x11.c:
	* clutter/eglnative/clutter-backend-egl.c:
	* clutter/sdl/clutter-backend-sdl.c:
	* clutter/osx/clutter-backend-osx.c: Unset the top-level private
	flag on the stage when disposing it, so the backends can safely
	call clutter_actor_destroy().

	* clutter/clutter-private.h: Tweak the private flags accessors,
	to avoid the typecheck.
2007-11-23 11:20:14 +00:00
Matthew Allum
737ac37f27 2007-10-26 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-texture.c:
        * clutter/cogl/cogl.h:
        * clutter/cogl/gl/cogl-defines.h:
        * clutter/cogl/gles/cogl-defines.h:
        * clutter/cogl/gl/cogl.c:
        * clutter/cogl/gles/cogl.c:
        Switch from use of guint to COGLuint. Avoids problems when
        guint != GLuint on some platforms, i.e OSX.
        (Tommi Komulainen, #526)

        * clutter/Makefile.am:
        * clutter/osx/Makefile.am:
        * clutter/osx/clutter-backend-osx.c:
        * clutter/osx/clutter-backend-osx.h:
        * clutter/osx/clutter-event-osx.c:
        * clutter/osx/clutter-osx.h:
        * clutter/osx/clutter-stage-osx.c:
        * clutter/osx/clutter-stage-osx.h:
        * configure.ac:
        Add initial Cocoa/OSX Backend (by Tommi Komulainen, see #526)
2007-10-26 22:06:45 +00:00