Commit Graph

20 Commits

Author SHA1 Message Date
Bryce Harrington a0bbfea64b src: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
Pekka Paalanen 2829f7c42e compositor,shell: move debug key code to core
The code for the key binding that triggers debug key bindings, that is,
the code that makes mod+SHIFT+SPACE work, used to live in shell.c. I
want to make the debug key bindings available in ivi-shell too, so this
code should be shared. Move it to core.

The code was originally introduced in
commit c509d2b152
so update the copyright in binding.c to reflect that.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-03-02 16:56:01 +02:00
Giulio Camuffo 943b46ed66 input: swallow the key press event when running a compositor key binding
Reviewed-by: Daniel Stone <daniel.stone@collabora.com>
2014-12-15 17:41:25 +02:00
Giulio Camuffo a20ca811f9 input: send focus events to the focused client when running a key binding
When running a key binding we don't send the key press to the client
via the wl_keyboard.key event. Instead, send a wl_keyboard.leave/enter
pair so that the client knows the actual state of the keyboard.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-12-01 16:26:53 +02:00
Pekka Paalanen 86b5396d89 Revert "input: don't send to clients key events eaten by bindings"
This reverts commit 5c11fc6fb7.

According to two input specialists, this was the wrong way:
http://lists.freedesktop.org/archives/wayland-devel/2014-November/018287.html

Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-19 13:45:38 +02:00
Giulio Camuffo 5c11fc6fb7 input: don't send to clients key events eaten by bindings
weston key bindings are supposed to eat the key events, and not pass it
on to clients, and indeed the wl_keyboard.key event is not sent. But
we must also not put the key in the keys array to pass to client with
the wl_keyboard.enter event, or else we may send the 'eaten' one too.
In the case of a key binding hiding a surface having the keyboard focus,
the shell may decide to give the focus to another surface, but that will
happen before the key is released, so the new focus surface will receive
the code of the bound key in the wl_keyboard.enter array.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-11 15:07:12 +02:00
Giulio Camuffo 24b98d0108 input: allow to destroy bindings in their handler
use wl_list_for_each_safe to iterate on the bindings list when
firing them, this way a binding can safely be destroyed in its
function handler.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 15:35:47 +02:00
Jonas Ådahl 9484b695b9 input: Keep track of number of touch points inside touch struct
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-02 15:24:05 -08:00
Emilio Pozuelo Monfort 1539ea2f74 input: don't run modifier bindings when the kbd is grabbed
We don't want bindings to be run while the keyboard is grabbed.
Otherwise the binding handler may grab the keyboard too, making
the old grab go away without even being cancelled.
2013-11-27 22:49:31 -08:00
Daniel Stone 96d47c0ef7 Add modifier-only binding
Add the ability to bind to modifiers; the binding is armed when a key
which sets the requested modifier is pressed, and triggered if the key
is released with no other keys having been pressed in the meantime, as
well as mouse buttons or scroll axes.

This only works for direct modifiers (e.g. Shift and Alt), not modifiers
which latch or lock.

[pochu: rebased]
2013-11-19 11:49:25 -08:00
Jonas Ådahl 1ea343e1be Add cancel function to grab interfaces
A grab can potentially allocate memory and would normally end the grab
itself, freeing the allocated memory in the process. However at in some
situations the compositor may want to abort a grab. The grab owner still
needs to free some memory and abort the grab properly. To do this a new
function 'cancel' is introduced in all the grab interfaces instructing
the grabs owner to abort the grab.

This patch also hooks up grab cancelling to seat device releasing and
when the compositor looses focus, which would potentially leak memory
before.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:44:06 -07:00
Neil Roberts a28c69358c Add a touch binding to activate a surface
Adds a new binding type for touch events via the new function
weston_compositor_add_touch_binding. The binding can only be added for
a touch down with the first finger. The shell now uses this to install
a binding to activate the current surface.
2013-10-14 13:53:08 -07:00
Neil Roberts 96d790e74b input: Emit events on all resources for a client
The Wayland protocol permits a client to request the pointer, keyboard
and touch multiple times from the seat global. This is very useful in a
component like Clutter-GTK where we are combining two libraries that use
Wayland together.

This change migrates the weston input handling code to emit the
events for all the resources for the client by using the newly added
wl_resource_for_each macro to iterate over the resources that are
associated with the focused surface's client.

We maintain a list of focused resources on the pointer and keyboard
which is updated when the focus changes. However since we can have
resources created after the focus has already been set we must add the
resources to the right list and also update any state.

Additionally when setting the pointer focus it will now send the
keyboard modifiers regardless of whether the focused client has a
pointer resource. This is important because otherwise if the client
gets the pointer later than you getting the keyboard then the
modifiers might not be up-to-date.

Co-author: Neil Roberts <neil@linux.intel.com>
2013-09-21 20:56:55 -07:00
Rob Bradford 880ebc7ed9 input: For serial generation get the display from the compositor
This removes the use of wl_client_get_display() where the client is
derived from the focussed resource. This starts the removal of the
assumption of a single resource on a client that would be notified about
events on the focussed surface.
2013-08-12 16:54:10 -07:00
Kristian Høgsberg c2d7042b9d compositor: Fix a couple of left-over wl_resource direct access 2013-06-25 15:34:33 -04:00
Daniel Stone c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

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

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Kristian Høgsberg e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Kristian Høgsberg 29139d4a45 fold wl_keyboard into weston_keyboard 2013-05-06 21:40:36 -04:00
Rune K. Svendsen 14b2fe7020 Eat scroll event if a key binding function is executed because of it.
When an axis (scroll) event results in a key binding function
being executed, eat the scroll event so the underlying window
doesn't receive it.
Thanks to Scott Moreau for helping me solve this.
2013-03-18 21:43:17 -04:00
Ander Conselvan de Oliveira cbdebc2370 compositor: Split util.c into binding.c and animation.c
The few functions not related to bindings or animations were moved
into compositor.c.
2013-02-21 21:12:44 -05:00