Avoids a segfault whenever we get a key event, and try to set the
cursor, dereferencing a NULL input->pointer.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
The break statement wasn't copy and pasted along with the rest of the code
causing menu item before it ("Move to workspace below") to fall through to
the fullscreen case.
We need to clamp or center on a per axis basis. If the window is wider
but the image is taller, we need to center horizontally but
clamp vertically. We can only do that if by combining the two
functions.
The intended behavior is that a quick click (press and then release
within 500ms) just pops up the menu and doesn't select anything. Then
we can mouse around and and click to select an item. Alternatively, a
click and hold (ie press and release after 500ms) lets you press right
button, mouse down on the menu item you want and release to select it.
This is how menus work in most toolkits.
The handling in weston is fine, it's there to handle the case where
the button release happens outside any client window, since the client
doesn't get those events. If such a release happens late or we get a
second release outside the popup window we shut down the popup.
The problem is in toytoolkit, where we need to select the item if we
get a release within 500ms or if we get a second release. A second
release is the case where the first release came after 500ms and
didn't pop down the menu, and the second release event is from a click
on a menu item.
https://bugs.freedesktop.org/show_bug.cgi?id=52456
If clients don't set a cursor, they get whatever the last cursor was
before the pointer entered their window. That's a little confusing, so
set a pointer on enter to avoid that. The down-side is that simple EGL
isn't very simple anymore.
https://bugs.freedesktop.org/show_bug.cgi?id=52452
Toytoolkit does not support setting opaqueness for anything else than
the immediate child widget of the frame widget. Backgrounds do not have
frames, so we need to poke it in manually.
This should allow Weston to paint the background without blending.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Grabbed widgets should always receive motion events as if it was the
widget that would receive it if no grab was active. This means that the
focused widget should always be passed as the widget argument to widget
motion handlers.
This reverts commit 8c9c8fcf6e.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
The simple clients all just call wl_display_dispatch() in a while loop
without checking the return value. Now, if the server dies or other
error occurs, we get a -1 return value instead and need to break the loop.
Do not build the tablet-shell client if --disable-tablet-shell is given.
Change --enable-tablet-shell to --disable-tablet-shell in ./configure
--help output, since it is enabled by default. Add a description.
Use proper quoting in the conditional.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
since it doesn't use any of them. Fixes a build failure on systems,
where (E)GL headers are in non-standard path.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
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>
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>
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>
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>
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>
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.
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>
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>
desktop-shell never returned from display_run() since it
was essentially killed when weston exited. To fix this,
it is necessary to watch for EPOLLHUP in window.c so that
toytoolkit clients will return from display_run() when
weston quits. This allows for clients to clean up
as needed.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>