Commit Graph

6461 Commits

Author SHA1 Message Date
Carlos Garnacho
d6fc41b73e clutter: Add function to find out the number of modes for a pad group
This is obtained in backend-dependent ways in the upper layers, seems
better to let ClutterInputDevice provide this information.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
9d38ffa6e3 clutter: Add functions to find out mode switch buttons, and their group
This is done in the upper layers through backend-dependent ways, seems
better to let ClutterInputDevice provide this information.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
8bcdf9ba61 clutter: Add current group mode on pad events
This info can be obtained here right away, so we don't need
backend-dependent paths in the upper layers.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
1ff9bbd59c clutter/evdev: Add ClutterInputDeviceEvdev::output-aspect-ratio
When != 0, this property will express the W:H ratio of the desired
output area (be it one monitor or the span of all monitors). At
the time of translating coordinates, coordinates will be skewed so
that the input area of the tablet is a rectangle of the given ratio.

Events happening in the input areas that fall outside the output
aspect ratio will be clamped to the nearest coordinate in the rect.

If the ratio is 0, the whole input area of the tablet will be used
and no coordinate skewing will happen.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
cc838ead8b clutter/evdev: Add ClutterInputDeviceEvdev::device-matrix property
And transform absolute events using this matrix. This property is
akin to the "Coordinate Transformation Matrix" property in X11,
and will be used to map tablets/touchscreens to outputs, favoured
over the libinput matrix which is meant for calibration.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
9c79a1631d backends: Pass seat ID to evdev ClutterDeviceManager
Clutter assumed seat0 which is most usually, but not always correct.
Add an evdev-backend specific function to allow passing the seat
that will be used for ClutterDeviceManager construction, which we
already obtain in MetaLauncher.

https://bugzilla.gnome.org/show_bug.cgi?id=778092
2017-02-02 23:39:02 +01:00
Rui Matos
1597b357a1 clutter/evdev: Dispatch libinput before generating key repeat events
Since both the libinput event source and the key repeat timer have the
same priority, the order in which both handlers are called is
arbitrary if both sources are ready on the same poll return. This
means that sometimes we generate key repeats when there's already a
real key event queued on libinput that would cancel the repeat timer
if only it was processed before.

One solution would be lowering the repeat timer source priority a
notch lower than the libinput source but that would mean that a steady
stream of events from libinput (e.g. pointer device motion) would
prevent any key repeats to happen.

Instead, we can fix this problem by trying to dispatch libinput from
the key repeat timer and checking if the timer source has been
destroyed before generating more key repeats.

https://bugzilla.gnome.org/show_bug.cgi?id=774989
2017-01-25 13:07:48 +01:00
Rui Matos
73524cadd4 clutter/evdev: Avoid losing key repeat timestamp resolution
Commit 9214d5029c changed the notify*
API to use microseconds and we already have a microsecond time source
here so we can use the timestamp directly without losing resolution at
this layer.

https://bugzilla.gnome.org/show_bug.cgi?id=774989
2017-01-25 13:07:43 +01:00
Florian Müllner
e8380d11c4 build: Fix cogl include paths of tests
Those were missed by commit 0aa6d9782c ...
2016-11-23 23:12:55 +01:00
Florian Müllner
0aa6d9782c build: Fix cogl include paths
cogl-egl-defines.h is now referenced from a public header, so we need
to include its location whenever the header is used (directly or via
cogl.h).
2016-11-23 18:03:59 +01:00
Jonas Ådahl
c2e72823fc clutter: Fix a couple introspection warnings
This includes not introspecting ClutterStageView things at all for now,
as they are only used by C code.

https://bugzilla.gnome.org/show_bug.cgi?id=774827
2016-11-23 21:59:16 +08:00
Carlos Garnacho
af920851ca clutter: Fix build
Typo in get_type() function, can only be classified as post-c&p brain fart.
2016-11-07 14:24:36 +01:00
Carlos Garnacho
ea4dbdd66f clutter/x11: Implement ClutterInputDeviceTool
This is implemented using Wacom-driver specific properties at
the moment, until libinput becomes the fallback driver handling
tablet and pad management.

Whenever a tool becomes in proximity, a new ClutterInputDeviceToolXI2
will be created (if it wasn't created previously) for the given
serial number. This tool will be set in all events send from the
device.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
b252771a8f clutter/evdev: Take over stylus configuration
Stylus configuration (stylus buttons, pressure) was handled
at the very high level, doing the button and pressure translations
right before sending these to wayland clients.

However, it makes more sense to store these settings into the
ClutterInputDeviceTool itself, and have clutter apply the config
at the lower level so 1) the settings actually apply desktop-wide,
not just in clients and 2) X11 and wayland may share similar
configuration paths. The settings are now just applied whenever
the tool enters proximity, in reaction to
ClutterDeviceManager::tool-changed.

This commit moves all handling of these two settings to
the clutter level, and removes the wayland-specific paths

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
75c3f0ffba clutter/evdev: Emit ClutterDeviceManager::tool-changed
We do so whenever a tool enters or leaves proximity. We now also
ensure that last_tool is NULL after it leaves proximity, although
the CLUTTER_PROXIMITY_OUT event itself should still contain tool
information.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
bd83873a7f clutter: Add ClutterDeviceManager::tool-changed signal
This signal will notify whenever a device changed tool.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
9abf6892c4 clutter/x11: Add minimal support for pad devices
We most notably handle button events (acquired through a passive grab on
all device buttons) which are translated to CLUTTER_PAD_BUTTON* events,
so there is generic handling of pad actions on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
674a48335d clutter/x11: Implement XTest-based ClutterVirtualInputDevice
This will be used too on X11 in order to implement the button-to-keycombo
mapping in pad devices.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
4cfc21d49d clutter: Rename touchpad gesture n_fingers getter to be more generic
This can also be used now on pinch events, so make a more generic name
for this function.

https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Carlos Garnacho
cf0a453d32 clutter/evdev: Fill n_fingers information in touchpad pinch events
Libinput tells us this much (at least for 3 fingers), so make sure
we propagate this info.

https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Carlos Garnacho
4186833df7 clutter: Add n_fingers field to ClutterTouchpadPinchEvent
https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Rui Matos
fc8de3d0c8 clutter/stage: Fix framebuffer capture origin offset (again)
Commit 5fbb479301 was wrong too. What we
really want to do here is getting view relative coordinates given the
view's and the rectangle's global coordinates so we need to subtract
the view's origin from the rectangle's.

https://bugzilla.gnome.org/show_bug.cgi?id=771502
2016-10-17 13:47:20 +02:00
Florian Müllner
a4e69f338d clutter: Reuse GTK+'s RTL/LTR handling
Commit a4fb7ef5a3 dropped translations of our internal cogl/clutter
forks, which broke the local-based text direction support. Instead
of bringing back translations just for this purpose, we can re-use
GTK's translations which use the same technique.

https://bugzilla.gnome.org/show_bug.cgi?id=771549
2016-09-19 23:10:57 +02:00
Rui Matos
5fbb479301 clutter/stage: Fix framebuffer capture origin offset
Commit f36fa53b0e had the offset math
wrong and the reviewer didn't notice it.

https://bugzilla.gnome.org/show_bug.cgi?id=771502
2016-09-19 22:28:05 +02:00
Jonas Ådahl
342532a98d ClutterStageCogl: Don't get buffer damage dirty pixel when not supported
Now with the existance of offscreen view framebuffers the buffer age
damage regions are only valid if the view in question doesn't doesn't
have an intermediate offscreen. So, for views that doesn't have buffer
age, return the dirty pixel (0,0).

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
219d2304e0 clutter: Let the stage window translate dirty pixel according to view
Otherwise if buffer age is not supported the dirty pixel would be
shifted potentially in unpaintable position.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
fb6b0de48b clutter: Use non-deprecated pixel reading function when picking
This wont fix anything, it just one small step away from using
deprecated cogl functions.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
b78b8c9578 ClutterStageView: Always blit full texture on full onscreen framebuffer
When blitting an offscreen onto an onscreen, the whole offscreen should
always be drawn on the whole onscreen. Thus, don't try to convert
between coordinate spaces, just draw the whole offscreen on the whole
onscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Olivier Fourdan
4c106a9c9b wayland: save/restore numlock state
Save the state on NumLock so that is can be (optionally) restored on
next login.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=757943
2016-09-09 19:07:10 +02:00
Jonas Ådahl
d893adb290 clutter: Compress instead of discard motion events
Clutter discards any motion event if next event happens to also be a
motion event. This is problematic when the motion event carries
relative motion deltas, since the information about them is completely
lost.

Until we have moved away made the stage stop discarding motion events,
lets work around the issue by compressing them, effectively adding
multiple relative motion deltas together, would one be discarded.

https://bugzilla.gnome.org/show_bug.cgi?id=771049
2016-09-09 10:03:34 +08:00
Jonas Ådahl
f36fa53b0e clutter/stage: Offset framebuffer capture origin by view layout
The rectangle passed to capture_view() is in stage coordinate space;
thus, to translate to framebuffer coordinate space, the origin need to
be translated by the view layout position.

This fixes capturing views not at position (0, 0).

https://bugzilla.gnome.org/show_bug.cgi?id=770127
2016-09-06 14:59:36 +08:00
Jonas Ådahl
01edf10e82 clutter/evdev: Fix absolute pointer motion events
Absolute pointer events used the X coordinate as both X and Y. This
caused the pointer cursor to be moved incorrectly for absolute pointer
devices, commonly used in virtual machines.

https://bugzilla.gnome.org/show_bug.cgi?id=770557
2016-08-30 15:48:30 +08:00
Carlos Garnacho
a6e15e841b clutter/cogl: Transform swap buffers regions into onscreen coordinates
Those are given in view coordinates, so we must transform into onscreen
coordinates in order to perform swap_buffers on the right damage regions.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
61e9c5c357 clutter/cogl: Hook up ClutterStageView render-to-texture
"Blit" the result on the framebuffer after each view is painted.
This of course only applies if there is an offscreen buffer to
perform any blitting. Otherwise the onscreen framebuffer is rendered
to directly and this step is not necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
54dc10f890 clutter: Add infrastructure to render ClutterStageViews to offscreen
The offscreen is given through the ::back-buffer property, the ClutterStageView
will set up the the CoglPipeline used to render it back to the "onscreen"
framebuffer.

The pipeline can be altered through the setup_pipeline() vfunc, so ClutterStageView
implementations can alter the default behavior of blitting from offscreen to
onscreen with no transformations.

All getters of "the framebuffer" that were expecting to get an onscreen have
been updated to call the right clutter_stage_view_get_onscreen() function.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:36:45 +02:00
Sjoerd Simons
913c32ee34 Fix build of clutter tests
Various clutter test directly use cogl symbols, so they should be linked
against mutter-cogl as well.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=769636
2016-08-23 13:45:05 +02:00
Carlos Garnacho
b53b94e6f2 clutter/evdev: Implement ClutterVirtualInputDevice::notify_keyval
This is somewhat gross at the moment, because we're after all mimicking
real keyboard events, we can only lookup keycodes that are available
in the current map, and the control of levels is rather limited.

Eventually, we want to implement the text_input protocol, handle these
events separately to MetaWaylandKeyboard, so event->key.keyval is
is guaranteed to be the final result. Until then, this is the farthest
we can get.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:36:42 +02:00
Carlos Garnacho
4abd31d863 clutter: Add ClutterVirtualInputDevice vmethod to notify keysyms
Evcodes don't cut it when we have something already specifying the
character to be printed, despite the current group/level. This API
allows some more control on the intended output.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Carlos Garnacho
3c8b1462bc clutter: Make ClutterVirtualInputDevice public
This includes adding documentation and introspection annotations,
and marking the functions as extern.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Carlos Garnacho
27a77fa115 clutter/evdev: Allow specifying the ClutterInputMode of virtual devices
The seat core keyboard/pointer will be "master", the ones created through
ClutterVirtualInputDevice will be "slaves".

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Jonas Ådahl
0992b5c53e ClutterVirtualInputDeviceEvdev: Forward button and key presses
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Jonas Ådahl
e928370bf0 ClutterSeatEvdev: Keep track of button count
libinput does it for us, but only for physical devices. When we add
virtual devices to the same seat, we need to track button press count
ourself.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
d2b05f0305 ClutterVirtualInputDeviceEvdev: Forward motion events
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
bd326d38ac ClutterVirtualInputDeviceEvdev: Create associated ClutterInputDevice
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
8e335ce183 ClutterVirtualInputDeviceEvdev: Construct with a specific seat
We are still single seated, so until we are properly multi seated its
always the main seat.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
364b184f41 ClutterVirtualInputDevice: Store the device type
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
94016f7257 clutter/evdev: Move keyboard and pointer notification into seat
We notify per seat; so lets move the logic there. Touch and tablets to
follow later.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
e38a8363e4 ClutterVirtualInputDevice: Keep track of the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
76eb27e786 ClutterDeviceManagerEvdev: Split out seat into a separate file
Split out ClutterSeatEvdev functionality into a separate file.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
5db2be414b clutter: Add virtual input device API
Virtual input devices aim to enable injecting input events as if they
came from hardware events. This is useful for things such as remote
controlling, for example via a remote desktop session.

The API so far only consists of stumps.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:19 +02:00