Commit graph

16 commits

Author SHA1 Message Date
Olivier Fourdan df84dbe382 input: Update keyboard serial on press and release
Other compositors such as mutter update the keyboard serial for both key
press and key release, unlike weston which updates it only on key press.

When dealing with popup windows which require a match in serials, if the
event that caused the popup to be shown is a key release, then the popup
would be dismissed.

This occurs when navigating gtk+ sub-menus using the keyboard.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=768017
2016-11-16 14:46:22 +00:00
Quentin Glidic 2edc3d5462
libweston: Rename weston_surface::configure to ::committed
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1246
2016-08-14 09:28:50 +02:00
Quentin Glidic cde1345d69
input: Add helpers for all keyboard/pointer/touch events
These are useful to implement grabs.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1245
2016-08-14 09:28:50 +02:00
Jonas Ådahl d0be2bb5f2 input: Support non-rectangular pointer confine regions
This patch adds support for when the resulting pointer confinement region
is not a rectangle.

Support for this is implemented by converting the rectangles of the
region into the regions outer border. Pointer motions are then clamped
to these borders in order to not escape the confinement region.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-26 17:21:15 +08:00
Jonas Ådahl d3414f23c3 Implement pointer locking and confinement
This patch implements the wp_pointer_constraints protocol used for
locking or confining a pointer. It consists of a new global object with
two requests; one for locking the surface to a position, one for
confining the pointer to a given region.

In this patch, only the locking part is fully implemented as in
specified in the protocol, while confinement is only implemented for
when the union of the passed region and the input region of the confined
surface is a single rectangle.

Note that the pointer constraints protocol is still unstable and as
such has the unstable protocol naming conventions applied.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl c02ac11bd6 input: Split out pointer button sending from grab handler
We'll use it elsewhere later.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl f44942ea04 input: Split out motion sending from default grab
We'll reuse it later.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 3eb4ddd24d weston-pointer: Add destroy signal
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl f7deb6a959 compositor: Pass both surface and seat in activation signal
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 30d61d89c1 Implement the relative pointer protocol
A wp_relative_pointer object is an extension to the wl_pointer interface
only used for emitting relative pointer events. It will only emit events
when the parent pointer has focus.

To get a relative pointer object, use the get_relative_pointer request
of the global wp_relative_pointer_manager object.

The relative pointer protocol is currently an unstable protocol, so
unstable protocol naming conventions has been applied.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 94e2e2d39f compositor: Keep track of what views were activated by clicking
Adds a weston_view_activate() that can be passed an additional active
flag WESTON_ACTIVATE_CLICKED, that the shell passes when a view was
activated by clicking.

This allows shell-independent components implement heuristics depending
on how a view was activated.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl ef8e1c31e3 input: Activate view no matter the keyboard focus
Activate a view even though it effectively may already be active.
Without this, in later patches, it won't be possibe to track what view
was activated by clicking last, as a view which surface already had
keyboard focus, won't be activated.

To keep avoiding sending xdg_surface.configure events, only change the
keyboard focus if the focus actually changed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-07-26 17:21:15 +08:00
Armin Krezović f8486c33b4 compositor: Untangle surface/view is_mapped from output assignments
Currently, weston assumes a surface/view is mapped if
it has an output assigned. In a zero outputs scenario,
this isn't really desirable.

This patch introduces a new flag to weston_surface and
weston_view, which has to be set manually to indicate
that a surface/view is mapped.

v2:

- Remove usage of new flags from
  weston_{view,surface}_is_mapped at this point. They
  will be added after all the implicit mappings have
  been introduced
- Unmap a surface before unmapping a view so the input
  foci is cleaned up properly
- Remove implicit view mapping from view_list_add
- Cosmetic fixes

v3:

- Rebased to apply on git master

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-01 15:23:50 +03:00
Bryce Harrington 24f917e723 input: Move weston_seat_set_keyboard_focus and document
Place it with the other weston_seat functions.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-30 13:15:33 +03:00
Bryce Harrington 260c2ffd97 input: Rename weston_surface_activate to weston_seat_set_keyboard_focus
The name suggests that it activates surfaces, but the code says it
rather just assigns keyboard focus.  Rename it for clarity, and so the
original function name could be used for something more appropriate
later.  Switch order of parameters since keyboard focus is a property of
the seat.  Update all callers as appropriate.

Change was asked for by pq, May 26, 2016:

 "This should be called weston_seat_set_keyboard_focus(seat, surface).
 Keyboard focus is a property of the seat."

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-30 13:15:33 +03:00
Pekka Paalanen b5e3ea218b Rename src/ to libweston/
This clarifies what is supposed to be the libweston code.

v2: screen-share.c is already in compositor/ instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Renamed from src/input.c (Browse further)