Commit graph

133 commits

Author SHA1 Message Date
Jason Ekstrand a85118c1b8 Use wl_resource_create() for creating resources
This commit sets the version numbers for all added/created objects.  The
wl_compositor.create_surface implementation was altered to create a surface
with the same version as the underlying wl_compositor.  Since no other
"child interfaces" have version greater than 1, they were all hard-coded to
version 1.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-07-03 14:52:06 -04:00
Rob Bradford 382ff46ffb build: Make libxkbcommon build-time optional in the compositor
v2: Incorporate review feedback from Daniel Stone - improved configure
message about the purpose of this option and reorganisation of #ifdefs.
2013-06-28 19:56:41 -04:00
Matt Roper 01a9273bd2 input: Add support for making libxkbcommon optional
In embedded environments, devices that appear as evdev "keyboards" often
have no resemblence to PC-style keyboards.  It is not uncommon for such
environments to have no concept of modifier keys and no need for XKB key
mapping; in these cases libxkbcommon initialization becomes unnecessary
startup overhead.  On some SOC platforms, xkb keymap compilation can
account for as much as 1/3 - 1/2 of the total compositor startup time.

This patch introduces a 'use_xkbcommon' flag in the core compositor
structure that indicates whether the compositor is running in "raw
keyboard" mode.  In raw keyboard mode, the compositor bypasses all
libxkbcommon initialization and processing.  'key' events containing the
integer keycode will continue to be delivered via the wl_keyboard
interface, but no 'keymap' event will be sent to clients.  No modifier
handling or keysym mapping is performed in this mode.

Note that upstream sample apps (e.g., weston-terminal or the
desktop-shell client) will not recognize raw keycodes and will not react
to keypresses when the compositor is operating in raw keyboard mode.
This is expected behavior; key events are still being sent to the
client, the client (and/or its toolkit) just isn't written to handle
keypresses without doing xkb keysym mapping.  Applications written
specifically for such embedded environments would be handling keypresses
via the raw keycode delivered as part of the 'key' event rather than
using xkb keysym mapping.

Whether to use xkbcommon is a global option that applies to all
compositor keyboard devices on the system; it is an all-or-nothing flag.
This patch simply adds conditional checks on whether xkbcommon is to be
used or not.

v3 don't send zero as the file descriptor - instead send the result of
opening /dev/null

v2 by Rob Bradford <rob@linux.intel.com>: the original version of the
patch used a "raw_keycodes" flag instead of the "use_xkbcommon" used in
this patch.

v1: Reviewed-by: Singh, Satyeshwar <satyeshwar.singh@intel.com>
v1: Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
2013-06-28 19:55:29 -04:00
Rob Bradford 66bd9f5baf compositor-drm: Enable seat constraining when configured in weston.ini
This change tweaks weston_pointer_clamp to take into consideration if a
seat is constrained to a particular output by only considering the
pointer position valid if it is within the output we a constrained to.
This function is also used for the initial warping of the pointer when a
constraint is first established.

The other two changes are the application of the constraint when either
a new device added or a new output created and therefore outputs and
input devices can be brought up in either order.

v2: the code in create_output_for_connector has been spun off into a
new function setup_output_seat_constraint (Ander). The inappropriate
warping behaviour has been resolved by using weston_pointer_clamp
(Pekka).
2013-06-28 13:36:14 -04:00
Rob Bradford 806d8c0b78 input: Add weston_pointer_clamp function to ensure pointer visible
This refactors the code out from clip_pointer_motion into a function of
its own which can then be used elsewhere to clamp the pointer
coordinates to the range of the outputs.

This change also makes the caller of clip_pointer_motion use this new
function.
2013-06-25 16:28:04 -04:00
Kristian Høgsberg 6c8d778646 compositor: Remove double free()s in resource destructors
With the change to move free()ing of the wl_resource into wayland-server, we now have
a few cases where we double free the resource in the destructor.  This patch
removes those.
2013-06-25 10:29:30 -04:00
Giulio Camuffo 1fd4b01d10 input: check if the focus surface has a valid resource
the resource can be NULL in some cases, like when the focus is
taken by the black_surface used in shell.c as fullscreen background.
2013-06-20 15:22:35 -04:00
Jason Ekstrand 44a3863a17 input: Use wl_resource_get accessor functions for resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:49:11 -04:00
Jason Ekstrand 0f2ef7ebd3 Use wl_resource_get_user_data for weston_surface resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 15:58:29 -04:00
Jason Ekstrand 26ed73cee8 Change weston_surface.resource to a wl_resource pointer.
This is the first in what will be a series of weston patches to convert
instances of wl_resource to pointers so we can make wl_resource opaque.
This patch handles weston_surface and should be the most invasive of the
entire series.  I am sending this one out ahead of the rest for review.

Specifically, my machine is not set up to build XWayland so I have no
ability to test it fully.  Could someone please test with XWayland and let
me know if this causes problems?

Because a surface may be created from XWayland, the resource may not always
exist.  Therefore, a destroy signal was added to weston_surface and
everything used to listen to surface->resource.destroy_signal now listens
to surface->destroy_signal.
2013-06-12 15:04:49 -04:00
Rob Bradford e445ae69f2 input: Send the seat name if the client advertises verson 2 of wl_seat 2013-06-05 00:17:43 -04:00
Rob Bradford 9af5f9e0fe input: Add a seat name parameter to weston_seat_init 2013-06-05 00:17:38 -04:00
Alexander Larsson bcd18d9b09 input: Fix possible crash in clip_pointer_motion
It was erronously using output->current->height in one
place where it should use output->height. This may cause
it to create an invalid clipped coordinate in case of output
scaling or transform, because the next round "prev" would
end up NULL.
2013-05-28 16:14:34 -04:00
Kristian Høgsberg 6848c25677 input: Move surface picking into the pointer grab focus callback
Currently the core input code does surface picking before calling into
the focus callback of the current grab.  Not all grabs need to pick a
surface however, so we're doing work we don't have to in those cases.

For example, the shell move and resize grabs don't need to pick and the
default grab in implicit grab mode doesn't either.

With this change, the pointer grab mechanism is now very simple:
the focus callback is called whenever the pointer may have a new focus,
the motion callback is called whenever the pointer moves and
the button callback whenever a button is pressed or released.
2013-05-08 22:03:45 -04:00
Kristian Høgsberg be6403ed5c input: Get rid of grab focus concept
This was another complication that we had to have to support the
split between libwayland-server and weston.  Different grabs want to send
events relative to different surfaces at different times.  The default
grab switches between sending coordinates relative to the 'current' surface,
that is the surface the pointer is currently above, or the 'clicked'
surface, in case of an implicit grab.

The grab focus was set by the grab implementation and the core input code
would transform the pointer position to surface relative coordinates for the
grab focus and store in grab->x/y.

Now we can just let the grab implementation transform the pointer
coordinates itself, leaving the implementation free to transform
according to whichever surface it wants.  Or not transform at all if
it doesn't need surface relative coordinates (like the shell move and resize
grabs).
2013-05-08 21:03:23 -04:00
Kristian Høgsberg e122b7ba58 input: Remove 'current' and related fields from weston_pointer
The current surface field was used to track the surface the pointer was
currently over along with pointer position relative to that surface,
regardless of implicit or explicit grabs.  The main purpose was to restore
the default grab when another grab terminated.  We can now just repick in
that case and avoid keeping that state around, with the destroy listener
overhead that involves.

There was one other use case - we used to optimize out calls to
weston_pointer_set_focus() if the focus didn't actually change.  We can
still do that, but we have to do that in the default_grab_focus() handler
and compare against weston_pointer->focus instead.
2013-05-08 16:47:06 -04:00
Kristian Høgsberg 195b869f0e input: Move sprite fields into weston_pointer from weston_seat 2013-05-08 15:58:49 -04:00
Kristian Høgsberg fe7aa90ed4 compositor: Adapt to wl_surface going away
struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course).  A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
2013-05-08 09:54:37 -04:00
Kristian Høgsberg a4036bbd23 input: Allocate pointer/keyboard/touch structs 2013-05-07 23:52:07 -04:00
Kristian Høgsberg 2bf876282f input: Eliminate weston_seat::has_pointer/keyboard/touch
We can just look at weston_seat::pointer/keyboard/touch now.
2013-05-07 23:40:26 -04:00
Kristian Høgsberg aad8099c2f data-device: Update drag icon position from configure and motion handlers
We can now update the drag icon position directly from the configure
handler or the grab motion handler, and no longer need
weston_seat_update_drag_surface().
2013-05-07 22:57:15 -04:00
Kristian Høgsberg 624d8f2293 data-device: Don't emit a signal for drag icon changes
The signal used to be in libwayland-server and the listener in weston, but
now they're both in the same file, so lets stop using signal.
2013-05-07 20:46:04 -04:00
Kristian Høgsberg 7848bb687c input: Move drag handling to data-device.c 2013-05-07 11:18:46 -04:00
Kristian Høgsberg e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Kristian Høgsberg 4912454ba4 input: Remove wl_seat destroy signal
We already have one on weston_seat.
2013-05-06 22:27:40 -04:00
Kristian Høgsberg 4a2a274350 input: Fold wl_seat init/release into weston_seat init/release 2013-05-06 22:24:50 -04:00
Kristian Høgsberg e329f36533 input: Rename wl_touch to weston_touch
This is now a weston object.
2013-05-06 22:19:57 -04:00
Kristian Høgsberg 02bbabbd56 input: Rename wl_pointer to weston_pointer
This is now a weston object.
2013-05-06 22:15:05 -04:00
Kristian Høgsberg a71e8b2e4d input: Rename weston_device_repick() to weston_seat_repick()
Old left-over misnaming.
2013-05-06 21:51:21 -04:00
Kristian Høgsberg 80fb82df3a input: Drop find_resource_for_client()
We can use find_resource_for_surface() instead now that it's all in the
same file.
2013-05-06 21:49:55 -04:00
Kristian Høgsberg b5e26104ee move input code from compositor.c into input.c 2013-05-06 21:46:18 -04:00
Kristian Høgsberg 29139d4a45 fold wl_keyboard into weston_keyboard 2013-05-06 21:40:36 -04:00
Kristian Høgsberg 2158a889a1 Import input structs and helper functions from wayland 2013-05-06 21:40:32 -04:00