Separate simple EGL clients from other simple clients. This allows to
build either simple-shm or simple-egl, whichever you want. We avoid
linking libEGL and GLESv2 into simple-shm, and we can build simple-shm
even if nothing provides EGL, GLESv2, or wayland-egl APIs.
Change the options in configure --help from --enable to --disable, since
these are enabled by default, and you would normally only ever give the
--disable flavor. Add descriptions.
Remove the #define BUILD_SIMPLE_CLIENTS since it is not used.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
configure.ac: The toytoolkit clients used to get libEGL linked to them
even if there was no cairo-egl. This is useless, and actually harmful on
platforms, where libEGL absolutely requires one of the GL ES libraries
to be linked in, too.
Look for EGL-related packages only for cairo-egl with toytoolkit.
window.c: protect all GL header includes with HAVE_CAIRO_EGL, since that
is the only case we can support EGL, GL, or GLESv2 at all. In the case
we do not have cairo-egl, add enough definitions to let us build the
stubs for EGL-related functions.
Remove some #ifdefs that were inside of the same #ifdef already.
These changes allow to build sorfware rendering toytoolkit clients
without any bits of EGL libs or headers.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Otherwise the user has no indication which package is missing for
CAIRO_EGL, and has to dig into config.log for it.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Rather than delivering touch events directly to clients, we'll now
call through the touch grab handler. The default handler (in
wayland-server) will deliver these events the same way they worked
before.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Support for zooming by using ctrl + the vertical axis (scrolling upwards
zooms in) and panning by both the horizontal and vertical axis as well
as click and drag was added to demonstrate how axis should work.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
If the keyboard modifier event was received after the key event the
modifier state would end up incorrect.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Axis events are in the same coordinate space as motion events, thus
measured in pixels. To emulate axis events for discrete events move the
axis by a number of pixels every step.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Callbacks registered via display_set_output_configure_handler() are
promised to be called when we know the current mode for the output. If
the following order of events happens:
1. toytoolkit binds to a wl_output global
2. application registers an output configure handler
3. the wl_output.mode events are received
Then in step 2 we would call the callback with uninitialised output
informations, giving it a 0x0 size.
To avoid such race, do not call the callback from
display_set_output_configure_handler() if the output has 0x0 size.
The wl_output.mode event will be received later, and that will trigger
the right call to the callback.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
libwayland-server was changed to emit the new drag icon signal instead
of faking an attach event with a NULL buffer so this has to be done on
this side.
event-test assumes, that even without the very first wl_surface.attach
(and commit), the surface will have infinite (previously undef) input
region. event-test simply has test-client to create a wl_surface, and
then it forcefully sets its position and size, and assumes the input
region is now the full surface, so that notify_motion() will hit it.
Change Weston to initialize the input region to infinite, instead of
empty.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.
This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.
Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.
compositor-wayland assumes renderer->repaint_output does a commit.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
In weston, the wl_resource:data field for a wl_surface object always
contains struct weston_surface *, never struct wl_surface *.
Even though this is just a cosmetic fix, it should reduce confusion.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Make input region double-buffered as specified in the new protocol.
While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.
As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.
weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.
Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.
In clients, make sure commit happens after setting the opaque region.
Mesa does not need a fix, as it never touches the opaque region.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
weston_surface_create() already inits the opaque region, so the second
init in create_black_surface() is logically wrong. Whether this was a
memory leak or not, depends on Pixman internals.
Fini before initing again.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".
Implement double-buffering of damage in the compositor as required by
the new protocol.
Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().
Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.
NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.
simple-shm and simple-touch OTOH will work now.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".
Clients are now required to issue wl_surface.commit for the
wl_surface.attach to take effect.
While changing this, change the surface argument to
weston_surface_attach() from wl_surface into weston_surface, for
consistency.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.
This fixes the bug where surface is above panel_layer
just after it is restored from fullscreen mode.
How to reproduce:
* move surface under panel
* set surface fullscreen
* restore surface to normal mode
This applies the same pattern as used in other error cases in this block - and
cleans up the file desciptors and allocated memory too.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
If the for loop does not match on a button it will fall through and try and
dereference into the array using the terminating value of the loop. This
terminating value of the loop is the dimension of the array and thus beyond
its bounds.
Cc: Jan Arne Petersen <jpetersen@openismus.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
readlink() returns the number of bytes that it has written excluding any NUL
byte (since it does not write that itself.) This could lead to attempting to
access beyond the end of buffer if the destination of the link is exactly 100
bytes long. The standard solution to this is to subtract one from the buffer
when passing it into readlink().
Signed-off-by: Rob Bradford <rob@linux.intel.com>
The original code would overrun since the calculation of the range did not
take into consideration the size of the entries in the table.
Cc:Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
e->code is in the same range for ABS_ and for REL_. As the code currently
stands and for the current values in Linux's input.h there is no risk of a
problem. However just in case it would be wise to break after evaluating the
relative events.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
The previous logging code would never be reached - this change makes sure a
message is reported if changing keyboard mode to either the desired (K_OFF) or
fallback (K_RAW with handler that drops the events) fails.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
The original code always set the finger_state to the appropriate bitmask
irrespective of whether the event was a press or a release. It would also blat
all members of the bitmask rather than ORing in the new bit for the event.
Cc:Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
The workspace state parameters were initialized after the first
roundtrip. If a workspace manager state event was received during this
roundtrip the state parameters were cleared leaving an incorrect state.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>