Commit Graph

76 Commits

Author SHA1 Message Date
Craig R. Hughes
9ecddeb1c3 osx: Handle bare modifier keypresses
http://bugzilla.clutter-project.org/show_bug.cgi?id=2644
2011-06-07 14:39:01 +01:00
Robert Bragg
e381a159a7 Remove unused _cogl_swap_buffers_notify
Recently _cogl_swap_buffers_notify was added (in 142b229c5c) so that
Cogl would be notified when Clutter performs a swap buffers request for
a given onscreen framebuffer. It was expected this would be required for
the recent cogl_read_pixel optimization that was implemented (ref
1bdb0e6e98) but in the end it wasn't used.

Since it wasn't used in the end this patch removes the API.
2011-04-11 15:26:25 +01:00
Emmanuele Bassi
28c0a4d6be osx: Do not unrealize on hide
Calling unrealize on ClutterStage::hide will cause an assertion
failure and other badness when we destroy the stage.
2011-04-02 22:36:38 +01:00
Emmanuele Bassi
3e5aa9ed63 Add private header for event-related API 2011-02-18 16:35:36 +00: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
cef380040d osx: Use _clutter_event_push()
Do not operate directly on the event queue, but use the wrapper call
that all backends share.
2011-02-02 14:44:35 +00:00
Emmanuele Bassi
af22290f0d osx: Re-add the event time
Some overzealous diffing led to a missing call to setting the time of a
ClutterEvent from the corresponding NSEvent.
2011-02-02 14:44:35 +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
Viatcheslav Gachkaylo
634e4ffd1a osx: Improve the event loop
Implementation of event loop which works with GLib events, native OS X
events and Clutter events.

The event loop source code comes from the equivalent code in the Quartz
GDK backend from GTK+ 2.22.1, which is LGPL v2.1+ and thus compatible
with Clutter's licensing terms.

The code has been tested with libsoup, which did not work before together
with Clutter.

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

http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
2011-01-31 13:43:12 +00:00
Robert Bragg
142b229c5c cogl: Adds _cogl_swap_buffers_notify for clutter backends
This adds a stop-gap mechanism for Cogl to know when the window system
is requested to present the current backbuffer to the frontbuffer by
adding a _cogl_swap_buffers_notify function that backends are now
expected to call right after issuing the equivalent request to OpenGL
vie the platforms OpenGL binding layer. This (blindly) updates all the
backends to call this new function.

For now Cogl doesn't do anything with the notification but the intention
is to use it as part of a planned read-pixel optimization which will
need to reset some state at the start of each new frame.
2011-01-21 16:18:10 +00:00
Emmanuele Bassi
2fe20ff3c5 osx: Implement the set_accept_focus() vfunc
Like the x11 and win32 backends, the quartz backend should allow setting
the key focus when showing the stage window.
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
43edfc9400 Clean up clutter-private.h/4
Move the private Backend API to a separate header.

This also allows us to finally move the class vtable and instance
structure to a separate file and plug the visibility hole that left
the Backend class bare for everyone to poke into.
2010-10-21 12:22:17 +01: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
68156c24c1 build: Remove unused Makefile.am
We switched to a non-recursive layout, hence we don't need Makefile.am
in the osx/ and fruity/ sub-directories.
2010-10-19 17:48:15 +01:00
Emmanuele Bassi
56c89bd86b osx: Fix glib.h include path
The fix for removing glib/gmain.h introduced the wrong path for glib.h.
2010-10-15 12:40:43 +01:00
Roland Peffer
d842619755 osx: Add button mask to the modifier state translation
The modifier state translation is missing the CLUTTER_BUTTON*_MASK.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2365

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-10-14 18:23:02 +01:00
Emmanuele Bassi
f8af2da4c8 osx: Compilation fixes
Replace deprecated symbols with the correct ones.
2010-10-10 09:31:55 +01:00
Robert Bragg
b499696d83 Use paint volumes to do automatic culling
This uses actor paint volumes to perform culling during
clutter_actor_paint.

When performing a clipped redraw (because only a few localized actors
changed) then as we traverse the scenegraph painting the actors we can
now ignore actors that don't intersect the clip region. Early testing
shows this can have a big performance benefit; e.g. 100% fps improvement
for test-state with culling enabled and we hope that there are even much
more compelling examples than that in the real world,

Most Clutter applications are 2Dish interfaces and have quite a lot of
actors that get continuously painted when anything is animated. The
dynamic actors are often localized to an area of user focus though so
with culling we can completely avoid painting any of the static actors
outside the current clip region.

Obviously the cost of culling has to be offset against the cost of
painting to determine if it's a win, but our (limited) testing suggests
it should be a win for most applications.

Note: we hope we will be able to also bring another performance bump
from culling with another iteration - hopefully in the 1.6 cycle - to
avoid doing the culling in screen space and instead do it in the stage's
model space. This will hopefully let us minimize the cost of
transforming the actor volumes for culling.
2010-09-29 15:12:58 +01:00
Robert Bragg
3540d222e1 paint volumes: another pass at the design
This is a fairly extensive second pass at exposing paint volumes for
actors.

The API has changed to allow clutter_actor_get_paint_volume to fail
since there are times - such as when an actor isn't a descendent of the
stage - when the volume can't be determined. Another example is when
something has connected to the "paint" signal of the actor and we simply
have no way of knowing what might be drawn in that handler.

The API has also be changed to return a const ClutterPaintVolume pointer
(transfer none) so we can avoid having to dynamically allocate the
volumes in the most common/performance critical code paths. Profiling was
showing the slice allocation of volumes taking about 1% of an apps time,
for some fairly basic tests. Most volumes can now simply be allocated on
the stack; for clutter_actor_get_paint_volume we return a pointer to
&priv->paint_volume and if we need a more dynamic allocation there is
now a _clutter_stage_paint_volume_stack_allocate() mechanism which lets
us allocate data which expires at the start of the next frame.

The API has been extended to make it easier to implement
get_paint_volume for containers by using
clutter_actor_get_transformed_paint_volume and
clutter_paint_volume_union. The first allows you to query the paint
volume of a child but transformed into parent actor coordinates. The
second lets you combine volumes together so you can union all the
volumes for a container's children and report that as the container's
own volume.

The representation of paint volumes has been updated to consider that
2D actors are the most common.

The effect apis, clutter-texture and clutter-group have been update
accordingly.
2010-09-29 15:12:57 +01:00
Robert Bragg
f5f066df9c Try to clean up how we handle actor transformations
When building actor relative transforms, instead of using the matrix
stack to combine transformations and making assumptions about what is
currently on the stack we now just explicitly initialize an identity
matrix and apply transforms to that.

This removes the full_vertex_t typedef for internal transformation code
and we just use ClutterVertex.

ClutterStage now implements apply_transform like any other actor now
and the code we had in _cogl_setup_viewport has been moved to the
stage's apply_transform instead.

ClutterStage now tracks an explicit projection matrix and viewport
geometry. The projection matrix is derived from the perspective whenever
that changes, and the viewport is updated when the stage gets a new
allocation. The SYNC_MATRICES mechanism has been removed in favour of
_clutter_stage_dirty_viewport/projection() APIs that get used when
switching between multiple stages to ensure cogl has the latest
information about the onscreen framebuffer.
2010-09-13 18:18:34 +01:00
Roman Kudiyarov
8326ea26f8 osx: Fixed stage resize policy
Added initialization of minimum window size property on Cocoa
side. This property works when user change window size by mouse
dragging. But when size is changed by clutter_actor_set_size this
property will not help and was added another check in
clutter_stage_osx_resize. Also osx_get_geometry was refactoried
because it returns incorrect values in many cases but now size is
saved in [Window reshape] in requisition_width/height and this value
will be returned in any case to frontend.
2010-08-04 15:13:12 +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
dc23b88de2 osx: Fixed warnings in osx event implementation 2010-08-04 15:13:11 +01:00
Roman Kudiyarov
af8308295c Added willResize delegate for osx stage.
By default a clutter stage is not user resizable and this delegate
controls this option while resizing the stage.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
49b2b62311 Fixed lack of reaction for keyboard events after showing stage on osx.
Trick with hiding view while showing the stage affects on responder
chain. The main view ceases to be first responder and we should
manually set first responder.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
e4c4ef6792 Fixed incorrect size return in osx stage if stage resizable by user.
For some reasons width&height was equal to 1 if flag user-resizable
was true.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
411b5a09bb osx: Added size initialization for stage
After stage creation it's size can be changed by user and it should be
taken into account in clutter_stage_osx_realize.
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
904f619419 osx: Implemented hide cursor backend implementation
Add implementation for hide cursor in stage. Also added using this
feature in test-animator.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
12e5011488 osx: Added missed function declaration for stage
Added empty functions for cursor and window resize functional with
notes FIXME and also they are added to iface.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
01c9570d16 osx: Remove drawing call while showing stage and add viewport init
Viewport didn't initialized before OGL drawing and it causes crash on
assert so added viewport initalization to
clutter_stage_osx_realize. Also showing the stage causes drawing
function but other part of the system(in particular conformance tests)
don't expect it and aren't ready at this moment.
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
Emmanuele Bassi
eae4561929 Clean up the private flags for ClutterActor
Provide macros to quickly query a flag, and remove all namespacing
except the initial 'CLUTTER'.
2010-07-21 16:10:46 +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
Robert Bragg
43efab46bc Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.

Currently this is the structure I'm aiming for:
cogl/
    cogl/
	<put common source here>
	winsys/
	   cogl-glx.c
	   cogl-wgl.c
	driver/
	    gl/
	    gles/
	os/ ?
    utils/
	cogl-fixed
	cogl-matrix-stack?
        cogl-journal?
        cogl-primitives?
    pango/

The new winsys component is a starting point for migrating window system
code (i.e.  x11,glx,wgl,osx,egl etc) from Clutter to Cogl.

The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.

Overview of the planned structure:

* The winsys/ API is the API that binds OpenGL to a specific window system,
  be that X11 or win32 etc.  Example are glx, wgl and egl. Much of the logic
  under clutter/{glx,osx,win32 etc} should migrate here.

* Note there is also the idea of a winsys-base that may represent a window
  system for which there are multiple winsys APIs.  An example of this is
  x11, since glx and egl may both be used with x11.  (currently only Clutter
  has the idea of a winsys-base)

* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
  representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
  GLES 1.1 (fixed funciton) and 2.0 (fully shader based)

* Everything under cogl/ should fundamentally be supporting access to the
  GPU.  Essentially Cogl's most basic requirement is to provide a nice GPU
  Graphics API and drawing a line between this and the utility functionality
  we add to support Clutter should help keep this lean and maintainable.

* Code under utils/ as suggested builds on cogl/ adding more convenient
  APIs or mechanism to optimize special cases. Broadly speaking you can
  compare cogl/ to OpenGL and utils/ to GLU.

* clutter/pango will be moved to clutter/cogl/pango

How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"

Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps

As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
2009-10-16 18:58:50 +01:00
Robert Bragg
15d7a86621 [backends] Remove the idea of offscreen stages from all backends
The only backend that tried to implement offscreen stages was the GLX backend
and even this has apparently be broken for some time without anyone noticing.

The property still remains and since the property already clearly states that
it may not work I don't expect anyone to notice.

This simplifies quite a bit of the GLX code which is very desireable from the
POV that we want to start migrating window system code down to Cogl and the
simpler the code is the more straight forward this work will be.

In the future when Cogl has a nicely designed API for framebuffer objects then
re-implementing offscreen stages cleanly for *all* backends should be quite
straightforward.
2009-10-16 18:58:47 +01:00
Emmanuele Bassi
f0cb337d92 [build] Fix LDADD -> LIBADD usage 2009-08-11 13:27:25 +01:00
Emmanuele Bassi
dfc32b60c4 [osx] Clean up Makefile.am
The OS X backend Makefile.am was missing a line concatenation, and
so the -xobjective-c directive was always ignored.

Instead of dumping everything into INCLUDES and LDADD we should follow
what the rest of the backends do, and use per-target CFLAGS and LDADD,
and reserve the INCLUDES to -D and -I directives.

Thanks to: Christian Hergert <chris@dronelabs.com>
2009-08-11 13:11:34 +01:00
Damien Lespiau
94b35a4a5e [build] GCC_FLAGS is no more, MAINTAINER_CFLAGS is the One.
CC_FLAGS was a left over from the 0.8.x age. Killed it and use the
newer MAINTAINER_CFLAGS variable instead.
2009-08-03 14:25:08 +01:00
Michael Mortensen
2c2f31b1be [osx] Update events to floating point coordinates
The event translation code should be using the float type for
coordinates.

Fixes bug:

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-27 10:45:26 +01:00
Emmanuele Bassi
13f32cb3b9 [osx] Implement StageWindow::show/::hide
Instead of using the Actor class ::show and ::hide virtual function,
use the StageWindow interface API.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1724
2009-07-26 20:10:42 +01:00
Emmanuele Bassi
7a8895944b [osx] Enable motion event dispatch
By default NSWindow does not listen to mousemoved events and hence the
default behaviour for Actors using the "motion-event" signal  differs
from backend to backend.

Using setAcceptsMouseMovedEvents seems to fix it; unfortunately, I
cannot verify it, but since nobody is currently working on the Quartz
backend I guess it cannot get more broken than how currently is.

Thanks to: Michael <michael@f3k.org>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1687
2009-07-13 16:56:47 +01:00