Commit Graph

114 Commits

Author SHA1 Message Date
Rob Bradford
29eef6de61 wayland: Check for NULL surface on pointer leave events
In the protocol this is the expected behaviour when the client has
destroyed the surface.

https://bugzilla.gnome.org/show_bug.cgi?id=707377
2013-09-09 18:19:28 +01:00
Rob Bradford
2b8fcfd75b wayland: When resizing only trigger a redraw if the stage has been shown
This is necessary to avoid a deadlock with the compositor. When setting
a stage size before the stage was shown this would trigger a redraw
inside clutter_stage_wayland_resize. This redraw would result
in a call into eglSwapBuffers which would attach a buffer to the surface
and commit. Unfortunately this would happen before the role for the
surface was set. This would result in the compositor not relaying to the
client that the desired frame was shown.

With this change the call to wl_shell_surface_set_toplevel is always
made before the first redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=704457
2013-08-12 19:13:57 +01:00
Rob Bradford
b6a931c8d9 wayland: Only process enter and leave events Clutter created surfaces
When combining with GTK we will receive enter and leave events for surfaces
from both toolkits therefore we must filter our events appropriately.
2013-08-04 15:45:01 +01:00
Rob Bradford
61dc824c91 wayland: Check there is valid pointer or keyboard focus for events 2013-08-04 15:44:42 +01:00
Rob Bradford
de933213b7 wayland: Only create and act on shell_surface for non-foreign surfaces
We should not create a shell surface and set the role for that shell
surface if the surface was a foreign one provided through
clutter_wayland_set_wl_surface

https://bugzilla.gnome.org/show_bug.cgi?id=699578
2013-07-23 18:27:55 +01:00
Chris Cummins
d390a44615 wayland: Add foreign surface support to stage
This adds support for optionally a providing a foreign Wayland surface
to a ClutterStage before it is first show. Setting a foreign surface
prevents Cogl from allocating a surface and shell surface for the stage
automatically.

v2: add CLUTTER_AVAILABLE_IN_1_16 annotation and API reference docs
    (review from Emmanuele Bassi)
v3: set a boolean to indicate that this stage is using a foreign surface
(Rob Bradford)

https://bugzilla.gnome.org/show_bug.cgi?id=699578
2013-07-23 18:27:52 +01:00
Rob Bradford
a5230278b4 wayland: Add API for disabling the event dispatching
This allows the integration of Clutter with another library, like GTK+,
that is dispatching the events itself. This is implemented by calling
into the cogl_wayland_renderer_set_event_dispatch_enabled() and since
that function must be called on the newly created renderer the newly
added clutter_wayland_disable_event_retrieval must be called before
clutter_init()

https://bugzilla.gnome.org/show_bug.cgi?id=704279
2013-07-23 18:27:50 +01:00
Rob Bradford
3d646804d1 wayland: Use a fake millisecond monotonic time source for event times
The majority of Clutter input events require a time so that that the
upper levels of abstraction can identify the ordering of events and also
work out a click count.

Although some Wayland events have microsecond timestamps not all those
that Clutter expects do have. Therefore we would need to create some
fake times for those events. Instead we always calculate our own time
using the monotonic time.

https://bugzilla.gnome.org/show_bug.cgi?id=697285
2013-07-10 13:11:23 +01:00
Rob Bradford
6521701e29 wayland: add support for connecting to a foreign display
This allows the reuse of the display connection and hence objects with
existing code that is using Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=703566
2013-07-09 12:36:49 +01:00
Rob Bradford
5c93c0a1af wayland: make the surface toplevel when showing the stage
Cogl (as of 0b2b46ce) now only sets the shell surface as toplevel when
the CoglOnscreen is shown.

Without calling wl_shell_surface_set_toplevel the compositor will not
know what role to give to the compositor and thus the stage will not
appear.

When we look to support multiple roles / foreign surfaces we will need
to revisit this call and ensure we only call it when we are working in
the default case.

https://bugzilla.gnome.org/show_bug.cgi?id=703188
2013-06-28 12:15:40 +01:00
Rob Bradford
cba63dd93f wayland: Do not poll the Wayland socket for events
Since Cogl also polls on this file descriptor we can get into situations
where our event source is woken up to handle events but those events
have instead been handled by Cogl resulting in the source sitting in
poll().

We can safely rely on Cogl to handle the polling on the event source and
to dispatch those events.

https://bugzilla.gnome.org/show_bug.cgi?id=702202
2013-06-28 11:38:44 +01:00
Rob Bradford
c3be92a30c wayland: Remove now removed CLUTTER_AVAILABLE_ API annotations
In 00bee5f the API annotations were removed as the API is refreshed from
the start. This change removes the annotations from the Wayland API.

https://bugzilla.gnome.org/show_bug.cgi?id=703202
2013-06-28 11:38:44 +01:00
Chris Cummins
8231aae3ad clutter-input-device-wayland: Update indentifier name
Fixes a discrepancy between the function name and the gtk-doc identifier
introduced in 8f4e39b6 when the Wayland input protocol changed.
2013-05-14 12:28:21 +01:00
Chris Cummins
188f7d6881 docs: Remove empty line before parameter tags
The gtk-doc parser has somewhat esoteric rules regarding blank lines and
paragraph breaks, causing these parameter descriptions to be missed. See:

https://developer.gnome.org/gtk-doc-manual/stable/documenting_syntax.html.en
2013-05-14 12:28:16 +01:00
Chris Cummins
f2918d1a0f clutter-stage-wayland: Pedantic typo fix
Je ne parle pas français
2013-05-14 12:28:11 +01:00
Chris Cummins
6e6e69c84d wayland: Add API version annotations
Version numbers have been derived from source code comment blocks.
2013-05-14 12:28:04 +01:00
Emmanuele Bassi
e3259435f2 2.0: Remove all Since: annotations
We're starting from scratch.
2013-04-05 18:48:01 +01:00
Neil Roberts
d5896d284e wayland: Queue a redraw after showing the stage
On the other backends we will get some sort of expose event after
showing the stage's window which will queue a redraw. These expose
events don't exist on Wayland so nothing will cause Clutter to queue a
redraw. Weston doesn't bother displaying anything for the stage's
surface until the first buffer is sent, which of course it will never
receive if Clutter doesn't paint anything. This patch just makes it
explicitly queue a redraw after the stage is shown so that we will
always pass at least one frame to the compositor.

The bug can be seen by running test-stage-sizing. That example doesn't
have any animations so it won't try to queue any redraws until
something interacts with it. On the other hand something like
test-actors works fine without the patch because it constantly queues
redraws anyway in order to display the animation.

https://bugzilla.gnome.org/show_bug.cgi?id=696791
2013-03-28 16:12:34 +00:00
Daniel Stone
dfb145988e wayland: Only include Wayland headers in private
As wayland-client.h and wayland-server.h can't be included together,
split the Wayland backend file into clutter-backend-wayland.h, which
only defines the types, and clutter-backend-wayland-priv.h, which
actually uses the Wayland client types.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

https://bugzilla.gnome.org/show_bug.cgi?id=692851
2013-02-20 23:06:28 +00:00
Daniel Stone
b37b9d917a wayland-compositor: Don't use Wayland types in public API
The definition of wl_display differs between Wayland clients and
servers, and it's unsafe to include both wayland-client.h and
wayland-server.h at the same time.  Fudge around this by making the
compositor public API use void * rather than struct wl_display *.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

https://bugzilla.gnome.org/show_bug.cgi?id=692851
2013-02-20 23:06:28 +00:00
Rob Bradford
cbab0a62ad wayland: Port to new protocol 2012-10-12 18:54:25 +01:00
Rob Bradford
eb61e372b0 wayland: Initialise the repeat key to the expected default value
The code for handling key repeats (and in particular stopping on focus loss)
assumes that the repeat key is set to XKB_KEYCODE_INVALID in the default case.
2012-10-12 15:23:03 +01:00
Rob Bradford
fce43c420e wayland: Use wl_cursor_theme to provide a buffer for the Wayland cursor
This change switches to the new mechanism for loading a cursor into a buffer.
It no longer relies on having a PNG stored in a known location and instead
loads from the Wayland cursor theme.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-10-12 15:12:55 +01:00
Daniel Stone
a33d84234f Hide clutter_input_device_wayland and clutter_stage_wayland types
By prefixing them with an underscore, so they don't get exported as part
of public ABI.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-10-12 15:12:55 +01:00
Daniel Stone
978202aa49 Wayland: Set default font DPI to 96
Otherwise the units test fails, since the default DPI is set to -1.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-10-12 15:12:55 +01:00
Daniel Stone
1c7a740385 Wayland: Add key repeat
Add support for repeating keys to the Wayland input backend.
Unfortunately the repeat delay/interval is hardcoded into the Clutter
backend, as Wayland doesn't yet tell clients what the global values
should be.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-10-12 15:12:55 +01:00
Daniel Stone
8f4e39b6d7 Port to new Wayland and xkbcommon APIs
For Wayland, this is mostly the input protocol having changed, although
there's also the SHM pool API, the cursor API, as well as fullscreen and
ping.

Also port to the new (months-old) xkbcommon API, as used by Weston 0.95.
This involves having xkbcommon manage the state for us, where
appropriate.  Fans of multi-layout keyboards (or just caps lock) will no
doubt appreciate these changes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-10-12 15:12:55 +01:00
Emmanuele Bassi
0e4c6d0a87 Deprecate clutter_threads_enter()/leave()
Acquiring the Clutter lock to mark critical sections is not portable,
and not recommended to implement threaded applications with Clutter.

The recommended pattern is to use worker threads, and schedule UI
updates inside idle or timeout handlers within the main loop. We should
enforce this pattern by deprecating the threads_enter()/leave()
functions. For compatibility concerns, we need internal API to acquire
the main lock during frame processing dispatch.

https://bugzilla.gnome.org/show_bug.cgi?id=679450
2012-07-11 13:22:19 +01:00
Emmanuele Bassi
0b76ba332d Fixes for the API reference
Typos, missing symbols, and missing documentation.
2012-04-27 12:30:48 +01:00
Robert Bragg
f1aa16069d clutter-wayland-compositor.h: Adds missing header guards
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:37:08 +00:00
Neil Roberts
dee544645b wayland: Fix some missing includes
The commit 90e5088 added some extra compiler warning options that were
triggering warnings when enabling the wayland build due to missing
header includes. This adds those header includes in.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:36:58 +00:00
Robert Bragg
cf96c9caf3 include standalone cogl-wayland-server/client headers
Because the wayland-server-protocol.h header includes symbols that
collide with wayland-client-protocol.h Cogl now provides top level
<cogl/cogl-wayland-server.h> and <cogl/cogl-wayland-client.h> headers so
that applications can ensure they only include one of the wayland
protocol headers in a particular compilation unit. This updates clutter
accordingly to include those headers.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:36:50 +00:00
Rob Bradford
568951b8ac wayland: Only try and resize the framebuffer if there is a valid framebuffer 2012-03-20 13:32:20 +00:00
Emmanuele Bassi
a8d8005800 docs: Updates to the API reference 2012-03-05 23:45:40 +00:00
Neil Roberts
cfbb7a0fa0 clutter-wayland-surface: Add padding to the class struct
This just adds some padding pointers so that we can later add more
virtual functions without breaking ABI.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:52 +00:00
Neil Roberts
5f654069fe clutter-input-device-wayland: Include clutter-stage-private.h
This was giving a warning about using _clutter_stage_update_state
without declaring it.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
b5c90f6caa wayland-surface: don't queue redraw on buffer attach
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Neil Roberts
1f7968e5f9 wayland/x11: Set constraints on the CoglRenderer
When using the Wayland backend this sets a constraint that the
CoglRenderer selects the Wayland EGL winsys.

When a Wayland compositor display is set it now also sets a constraint
that the render should use EGL because only EGL renderers will set up
the required wl_drm global object.

The X11 backend now sets the X11 constraint.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Neil Roberts
13e3f9e5f1 Add an input device function to convert keycodes to evdev codes
This adds a virtual function to ClutterInputDevice to translate a
keycode from the hardware_keycode member of ClutterKeyEvent to an
evdev keycode. The function can fail so that input backends that don't
have a sensible way to translate to evdev keycodes can return FALSE.
There are implementations for evdev, wayland and X. The X
implementation assumes that the X server is using an evdev driver in
which case the hardware keycodes are the evdev codes plus 8.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
1bfd1d85eb Updates in line with latest wayland protocol
The shm buffer format enum values were renamed and the explicitly
premultiplied format was dropped since it's now assumed if the buffer
has an alpha component then it's premultiplied.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Neil Roberts
6cc58f7d7d clutter-wayland-surface: Remove the pick method
The pick method doesn't do anything special over the default pick
method provided by ClutterActor so there's no need to implement it.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
560f92b698 wayland-surface: removes unused origin variable
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
c1aac36d35 wayland-surface: Adds queue-damage-redraw signal
This adds a signal that's emitted whenever a wayland surface is damaged
that allows sub-classes to override the default handler to change
how clipped redraws are queued if the sub-class doesn't simply draw
a rectangle. The signal can also be used just to track damage.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
b89af8efa3 wayland-surface: Add cogl-texture property
This adds a "cogl-texture" gobject property so that a compositor may
listen for notifications of changes to the texture used to paint.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Neil Roberts
8ac2200aac clutter-wayland-surface: Rename the width/height properties
This patch renames the width/height properties to
surface-width/surface-height so that they won't override the
width/height properties of ClutterActor which have different
semantics.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
612bde3c4a wayland-surface: Set actor size on buffer attach
When a new buffer is attached and we update the width and height
properties for the surface we now also call clutter_actor_set_size()

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
0ba6127edc wayland-surface: Adds _get_surface function
This adds a clutter_wayland_surface_get_surface() function for querying
the struct wl_surface * associated with a ClutterWaylandSurface.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
83b94ec27d wayland-surface: Make _set_surface api public
This exposes a clutter_wayland_surface_set_surface() function. The
implementation ignores requests to re-set the same surface and since now
has code to cleanup old surface state before setting the new surface.
(previously the surface was construct only so this wasn't necessary)

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
862eebceb6 wayland-surface: Cleanup properly in _dispose
When disposing a ClutterWaylandSurface we now make sure to unref any
pipeline we created and unref any surface buffer textures we created.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
c7e10024d8 wayland-surface: remove unused damage array
There was a GArray member named damage that wasn't being used which this
patch removes.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:50 +00:00