summaryrefslogtreecommitdiff
path: root/src/input.c
Commit message (Collapse)AuthorAgeFilesLines
* input: Add comment explaining why pointer isn't freed when device is removedDerek Foreman2015-01-081-0/+5
| | | | | | | | | When the last pointer is removed from a seat, the pointer struct is intentionally kept. This has some interesting side effects, so I've documented it here so people like me don't errantly assume it's a bug. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* compositor: add weston_surface_set_label_func()Pekka Paalanen2014-12-081-0/+10
| | | | | | | | | | | | | | | | | | | | When printing out logs from Weston's actions, mainly for debugging, it can be very difficult to identify the different surfaces. Inspecting the configure function pointer is not useful, as the configure functions may live in modules. Add vfunc get_label to weston_surface, which will produce a short, human-readable description of the surface, which allows identifying it better, rather than just looking at the surface size, for instance. Set the label function from most parts of Weston, to identify cursors and drag icons, and panels, backgrounds, screensavers and lock surfaces, and the desktop shell's application surfaces. v2: renamed 'description' to 'label', so we get weston_surface_set_label_func(). Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* input: send focus events to the focused client when running a key bindingGiulio Camuffo2014-12-011-2/+1
| | | | | | | | 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>
* input: Use slightly less obscure logic in evdev_notify_keyboard_focus()Derek Foreman2014-11-271-0/+1
| | | | | | | | | | | | While the test is actually correct (for non-negative numbers), it's not at all clear and seems to be an accidental order of operations mistake. Also, add an assert() to make sure this number is never negative. Closes bug 86346 - https://bugs.freedesktop.org/show_bug.cgi?id=86346 Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* input: don't run the key bindings on focus inGiulio Camuffo2014-11-241-6/+0
| | | | | | | When getting the focus we get the list of pressed keys, but we are not supposed to run the key binding on them. Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Revert "input: don't send to clients key events eaten by bindings"Pekka Paalanen2014-11-191-48/+19
| | | | | | | | | | | | This reverts commit 5c11fc6fb7d9b1bccd50fc982c0798c9e09a2a04. 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>
* input: use tmp var in pointer_unmap_spritePekka Paalanen2014-11-121-4/+6
| | | | | | Remove lots of repeated indirection. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* input: don't send to clients key events eaten by bindingsGiulio Camuffo2014-11-111-19/+48
| | | | | | | | | | | | | 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>
* input: fix access to invalid resourceGiulio Camuffo2014-11-111-1/+1
| | | | | | | | | the keyboard focus surface may not have a valid resource (server side surface or a surface surviving its client), so check if it is valid before using it. Acked-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* cosmetic: replace boolean function return values with boolDerek Foreman2014-11-041-4/+4
| | | | | | | | For functions that test if something is true/valid and return a 1 or 0, it makes sense to switch to bool. Reviewed-by: Bryce Harrington <b.harrington@samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: send error for surface role resetsPekka Paalanen2014-10-081-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the more accurate definition of wl_surface roles in Wayland, enforce the restriction: a role is always set permanently, and attempting to change it is a protocol error. This patch is based on Jasper's patch: http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html The difference in this patch compared to his are: - send role errors on the interface whose request triggers it, not on wl_surface - an interface could have several requests assigning different roles, cannot use wl_interface as the unique key; use an arbitary string instead - ensure in window-manager.c that create_shell_surface() -> create_common_surface() is never called with surface->configure set, to avoid compositor abort - use wl_resource_post_no_memory() where appropriate instead of hand-rolling it with wl_resource_post_error() Ideally we would not add weston_surface::role_name field, but use weston_surface::configure. At the moment this is not possible though, because at least shell.c uses several different roles with the same configure function. Drag'n'drop uses two configure functions for the same role. The configure hook is also reset in several places, which is not good for role tracking. This patch overlooks the wl_surface roles assigned in privileged extensions: screensaver, panel, background, lock, input panel. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
* input: Schedule pointer sprite repaint when cursor is setJonas Ådahl2014-09-101-1/+3
| | | | | | | | | | | | | | If a cursor was set with wl_pointer.set_cursor but not in combination with an action that has the side effect of damaging the region where the cursor is positioned, it would not be drawn. This patch explicitly schedules a repaint of the pointer sprite when it is set. clickdot is updated to illustrate the bug; when moving the pointer over clickdot, the pointer is hidden. When not having moved the pointer for 500 ms it is made visible using wl_pointer.set_pointer. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* touch-input: Don't dereference NULL pointer during full screen fadeDerek Foreman2014-09-051-2/+8
| | | | | | | | | | | | If a full screen program is fading out and a touch start happens, it will result in a NULL pointer dereference when weston_touch_set_focus tries to derefernce view->surface->resource. Instead, this patch sets the focus to NULL, which should be the same as if the program was destroyed during the touch anyway. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78706 Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: add a way to change the keyboard locksGiulio Camuffo2014-09-031-0/+52
| | | | | | | | | This adds a function weston_keyboard_set_locks() which can be used to change the state of the num lock and the caps locks, changing the leds too. Only the evdev and libinput backends supports this, since it doesn't make sense for embedded sessions. Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Don't protect xkb_*_unref from NULLRan Benita2014-08-201-6/+3
| | | | | | | Since xkbcommon-0.3.0, which is required by weston, a NULL argument doesn't do anything. Signed-off-by: Ran Benita <ran234@gmail.com>
* Replace deprecated xkbcommon symbols with current namesRan Benita2014-08-201-33/+37
| | | | | | | | | | | These symbols (xkb_map_* and others) were replaced in xkbcommon with more consistent names. See the header xkbcommon/xkbcommon-compat.h for how the old names map to the new. The new names have been available since the first stable xkbcommon release (0.2.0). Signed-off-by: Ran Benita <ran234@gmail.com>
* compositor: fetch repeat info from weston.iniJonny Lamb2014-08-151-3/+6
|
* Use the named SINCE_VERSION defines for version checksJasper St. Pierre2014-08-081-1/+1
| | | | To make our code more clear.
* input: Send key-repeatJasper St. Pierre2014-08-051-1/+4
|
* compositor: keep track of the weston_layer a weston_view is inGiulio Camuffo2014-07-231-2/+2
| | | | | | | | | This introduces a new struct, weston_layer_entry, which is now used in place of wl_list to keep the link for the layer list in weston_view and the head of the list in weston_layer. weston_layer_entry also has a weston_layer*, which points to the layer the view is in or, in the case the entry it's the head of the list, to the layer itself.
* libinput: Forward frame events to clientsJonas Ådahl2014-04-211-0/+19
| | | | | | Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77353 Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* Add a signal for when a seat updates its capabilitiesJason Ekstrand2014-04-021-0/+2
| | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* input: Send leave and enter pair when the surface moves under the cursorKristian Høgsberg2014-02-181-12/+16
| | | | | | | | | | The client needs to know that the pointer is at a different position in its surface. We can't send motion as that corresponds to the pointer actually moving. Leaving the surface and entering at the new position is a better semantic match and doesn't correspond to pointer motion or user input. https://bugs.freedesktop.org/show_bug.cgi?id=71927
* compositor: Drop core ping_handler calloutKristian Høgsberg2014-02-111-16/+0
| | | | | | | This was always a little iffy. At least it could have been a signal, but we now have focus signal, so lets just use that. We lose the ability to detect unresponsive clients at key event time, but we could add that back by adding a key_signal.
* input: Run touch binding before calling touch grabKristian Høgsberg2014-02-051-2/+3
| | | | | | | We don't want to send events if the binding is going to handle the touch event. Also, this restricts touch bindings to only trigger on touch down. For gesture bindings we want something similar to the motion signal we have for the pointer.
* input: Transform to surface coordinates outside resource for loopKristian Høgsberg2014-02-051-3/+3
| | | | | | When we send the pointer motion event, the transform from compositor to surface coordinates doesn't depend on the resource. Transform the coordinates up front instead of everytime we send to a resource.
* input: Remove exported function weston_pointer_verify()Ander Conselvan de Oliveira2014-02-011-3/+17
| | | | | Instead, add a compositor signal that an output has been destroyed and handle that case locally in input.c.
* input: Fix weston_seat_init_keyboard() error pathAnder Conselvan de Oliveira2014-02-011-7/+14
| | | | | | | | | | | | | The pointer seat->keyboard was set before some possible error returns. That pointer was left unchanged in case of failure, pointing to an uninitialized keyboard struct (that was also leaked). If a client sent a wl_seat::get_keyboard request, that would cause Weston to crash. Fix this by setting the seat->keyboard pointer only after the keymap initialization is done and there is no more possibilities for failure. Also plug the memory leaks on the error path. https://bugs.freedesktop.org/show_bug.cgi?id=74035
* input: Empty the current input region when configuring pointer surfacesAnder Conselvan de Oliveira2014-02-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The input region of the cursor surface is set to empty in pointer_cursor_surface_configure(). Since during the commit process this function is called before the pending input region is made current, it empties surface->pending.input instead of surface->input. But pointer_cursor_surface_configure() is also called from pointer_set_cursor() in order to map the cursor even if there isn't a subsequent attach and commit to the cursor surface. In that case, surface->input is never emptied, since the configure function emptied only the pending input region and there wasn't a commit that made it effective. Fix this by emptying both pending and current input regions. The latter shouldn't cause problems since the surface can't have a role prior to being assigned the cursor role, so it shouldn't be mapped in the first place. Also change toytoolkit so that it triggers the bug. https://bugs.freedesktop.org/show_bug.cgi?id=73711
* input: Unlink saved kbd focus listener when releasing seat1.4Jonas Ådahl2014-01-271-0/+3
| | | | | | | | Not doing this would leave a invalid list item in the view's destroy signal listener list if destroying a seat that had previously lost keyboard focus. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* input: Ignore touch up events if num_tp is 0Kristian Høgsberg2014-01-081-0/+8
| | | | | | | This can happen if we start out with one or more fingers on the touch screen, in which case we didn't get the corresponding down event. Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73367
* input: Don't leak the initial keymapRui Matos2014-01-081-0/+1
| | | | | | weston_xkb_info_create() takes ownership of the xkb_keymap instance so we should drop our reference or we would leak it later if the keymap was changed.
* compositor: Make pointers visible when an output is unpluggedAnder Conselvan de Oliveira2013-12-161-12/+64
| | | | | | Previously, if a pointer was inside an output that was unplugged, it could potentialy end up outside any valid output forever. With this patch, the pointer is moved to the "closest" output to the pointer.
* input: make sure the devices get the resource destruction signalGiulio Camuffo2013-12-061-12/+14
| | | | | | The device may not have a resource for the client yet, but install the listeners nevertheless. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=65726
* input: Reset keyboard state when releasing last seat keyboardJonas Ådahl2013-12-031-0/+24
| | | | | | | Don't rely on the input driver to properly send button-up events for every pressed key. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* input: Move the xkb fields from weston_seat to weston_keyboardJonas Ådahl2013-12-031-65/+72
| | | | | | | XKB integration is a keyboard feature and should as such be kept track of in the keyboard struct. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* Remove the weston_view.geometry.width/height fieldsJason Ekstrand2013-12-021-5/+4
| | | | | | | | | | This has a couple of additional implications for the internal weston API: 1) weston_view_configure no longer exists. Use weston_view_set_position instead. 2) The weston_surface.configure callback no longer takes a width and height. If you need these, surface.width/height are set before configure is called. If you need to know when the width/height changes, you must track that yourself.
* input: Reset pointer state when last pointer device was removedJonas Ådahl2013-12-021-0/+7
| | | | | | | Reset pointer button count in case the driver did not emit appropriate number of number button released events. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* input: Reset touch state when last touch device was removedJonas Ådahl2013-12-021-0/+7
| | | | | | | Reset the touch point count in case the driver did not emit appropriate number of touch up events. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* input: Keep track of number of touch points inside touch structJonas Ådahl2013-12-021-7/+6
| | | | Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* compositor: do not recompute size on pointer_set_cursorPekka Paalanen2013-11-281-2/+2
| | | | | | | | | This removes the calls to weston_surface_buffer_width/height() from input.c, which are the last external calls to them. Instead, use the cached values from weston_surface::width,height. These have already been set by weston_surface_commit(), because that is the only way a weston_surface can get a buffer.
* input: Cancel pointer grabs when compositor loses kb focusKristian Høgsberg2013-11-221-0/+2
| | | | | This makes sure we pop down popups when the X backend loses keyboard focus or when the kms backend vt-switches away.
* input: set the focus to NULL when the focus's resource is destroyedGiulio Camuffo2013-11-201-23/+85
| | | | | | | | with the surface ref-count feature a surface may live on after its resource was destroyed. so listen for the resource destroy signal and set the focus to NULL. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* input: Fix a segfault in focus checkingJason Ekstrand2013-11-191-1/+4
| | | | | Without this, weston will segfault whenever the focus is a non-client surface such as the black surface in fullscreen.
* input: Don't send leave events to destroyed viewsEmilio Pozuelo Monfort2013-11-191-1/+26
| | | | | | | | | If a view which has focus is destroyed, we would send a leave event while changing focus, causing a segfault. Prevent this by listening to the view's destroy signal and removing it from the pointer focus. Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
* Add modifier-only bindingDaniel Stone2013-11-191-0/+38
| | | | | | | | | | | | 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]
* compositor: add a way to override the default pointer grabGiulio Camuffo2013-11-151-3/+15
|
* input: let the pointer motion handlers move the pointerGiulio Camuffo2013-11-151-15/+10
| | | | this allows to implement pointer barriers by using a custom handler
* zoom: use the new pointer motion signal to move the zoom frame.Giulio Camuffo2013-11-151-8/+0
|
* input: add a motion signal to weston_pointerGiulio Camuffo2013-11-151-0/+3
| | | | | | The signal will be emitted after the pointer is moved. A shell plugin can listen to the signal and activate certain effects when the pointer touches the screen corners, for instance.