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
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
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
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.
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The experimental cogl_pipeline_new() api was recently changed so it
explicitly takes a CoglContext. This updates all calls to
cogl_pipeline_new() in clutter accordingly.
* clutter_wayland_input_device_get_wl_input_device for the input device
* clutter_wayland_stage_get_wl_surface for the Wayland surface
* clutter_wayland_stage_get_wl_shell_surface for the shell surface
Also update the code to set the size of the stage to set it to the size of the
output. In future versions of the Wayland protocol we'll get a configure
message advising of us of the size we can be to achieve fullscreen.
Semantic changes to Wayland means that we cannot rely on the compositor
setting a pointer buffer for us if set it to nil. The first part of fixing
this is to create an shm buffer containing the bytes for our cursor.
The best way to do this currently is to load the cursor from the well known
location where weston instals its cursor images. The code to implemente this
was derivedlifted from the Wayland backend in GTK+.
The Wayland protocol now has events represent when a pointer enters the
surface and when it leaves again.
For leaves the surface is not set in the event, for enters the surface is set.
Simply use this to determine whether to emit CLUTTER_ENTER or CLUTTER_LEAVE.