1
0
Fork 0
Commit graph

118 commits

Author SHA1 Message Date
Jonas Ådahl
7c2b88f73b wayland: Implement support for 'cursor-visible' stage property
This will allow clutter Wayland clients to either not draw any pointer
cursor or draw its own.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=709590
2013-11-14 18:34:40 +00:00
Rob Bradford
a748aab0ed 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:18:18 +01:00
Giovanni Campagna
59f1e531f9 ClutterEvent: add API to query the full keyboard state when the event was generated
When talking to other applications or serializing the modifier
state (and in particular when implementing a wayland compositor),
the effective modifier state alone is not sufficient, one needs
to know the base, latched and locked modifiers.

Previously one could do with backend specific functionality
such as clutter_device_manager_evdev_get_xkb_state(), but the
problem is that the internal data structures are updated as
soon as the events are fetched from the upstream source, but
the events are reported to the application some time later,
and thus the two can get out of sync.
This way, on the other hand, the information is cached in the
event, and provided to the application with the value that
was current when the event was generated.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:23 +02:00
Giovanni Campagna
786532213b evdev: add master / slave device handling
All evdev devices are slave devices, which means that xkb state
and pointer position must be shared by emulating a core keyboard
and a core pointer. Also, we must make sure to add all modifier
state (keyboard and button) to our events.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 17:42:43 +02:00
Rob Bradford
1afe757109 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 17:29:28 +01:00
Rob Bradford
9808da7efe 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:38:40 +01:00
Rob Bradford
66044b665f wayland: Check there is valid pointer or keyboard focus for events 2013-08-04 15:33:30 +01:00
Rob Bradford
7153863309 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:24:01 +01:00
Chris Cummins
b6d2232150 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:24:00 +01:00
Rob Bradford
a5e44d3934 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:23:40 +01:00
Neil Roberts
78f20627ac wayland: Don't pass the shell and compositor down to Cogl
The Wayland 1.0 API allows orthoganal components of an application to
query the shell and compositor themselves by querying their own
wl_registry. The corresponding API in Cogl has been removed so Clutter
shouldn't call it anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=703878
2013-07-10 13:29:35 +01:00
Neil Roberts
6c66148faf Update ClutterWaylandSurface to use a resource instead of wl_buffer
The Wayland server API has changed so that wl_shm_buffer is no longer
a type of wl_buffer and wl_buffer will become an opaque type. This
changes ClutterWaylandSurface to accept resources for a wl_buffer
instead of directly taking the wl_buffer so that it can do different
things depending on whether the resource points to an SHM buffer or a
normal buffer. This matches similar changes to Cogl:

https://git.gnome.org/browse/cogl/commit/?id=9b35e1651ad0e46ed48989

https://bugzilla.gnome.org/show_bug.cgi?id=703608
2013-07-10 13:28:52 +01:00
Rob Bradford
7df59887d7 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 10:30:17 +01:00
Rob Bradford
8df5aba361 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:35:29 +01:00
Emmanuele Bassi
41bb03da2d Use the new macros for adding private data 2013-07-03 18:04:32 +01:00
Rob Bradford
e352047499 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-07-02 16:01:55 +01:00
Rob Bradford
5758ab5c89 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:43:49 +01:00
Chris Cummins
242f611863 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:42:08 +01:00
Chris Cummins
3de7e49432 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:42:08 +01:00
Chris Cummins
a075c286f2 clutter-stage-wayland: Pedantic typo fix
Je ne parle pas français
2013-05-14 12:42:08 +01:00
Chris Cummins
15bed2d9bd wayland: Add API version annotations
Version numbers have been derived from source code comment blocks.
2013-05-14 12:42:08 +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