Commit Graph

90 Commits

Author SHA1 Message Date
Carlos Garnacho
4cae9bdd05 x11: Store last axes from device
And use these for the missing axes if the valuator mask is incomplete.
This used to work fine on tablets because the Wacom driver ensures all
valuators are sent, which is not true if using the evdev driver.

https://bugzilla.gnome.org/show_bug.cgi?id=703610
2015-03-02 18:57:04 +01:00
Carlos Garnacho
6f07d5e761 x11: Detect libinput touchpads
These aren't reported as XIDependentTouch devices, so make it poke a
property that's specific to touchpads managed by the libinput driver.
2015-02-02 13:55:38 +01:00
Carlos Garnacho
121fddc4d2 x11: Fetch vendor/product identifiers for input devices
These are retrieved from XInput device properties.

https://bugzilla.gnome.org/show_bug.cgi?id=740758
2015-01-19 15:09:19 +01:00
Jasper St. Pierre
8fb2bdb2fb gdkdevicemanager-xi2: Add debug output for key events 2014-06-29 19:10:42 -04:00
Jasper St. Pierre
de5cba4fc9 gdkdevicemanager-xi2: Fix debug outputs for button events
We had the arguments in the wrong order here.
2014-06-29 19:10:41 -04:00
Carlos Garnacho
3dbabbd2e5 x11: Handle all XI2 crossing mode values in switch
This fixes potential assertions if a GTK+ app gets to receive
a XINotifyPassiveGrab/Ungrab pointer crossing event, currently
triggerable by XIGrabEnter passive grabs.

http://bugzilla.gnome.org/show_bug.cgi?id=719762
2013-12-04 21:22:23 -05:00
Carlos Garnacho
a53a931755 x11: Unset GdkX11DeviceXI2 scroll valuators on device change
Scroll valuators were being just appended again and again, leading
to 1) a growing memory issue anytime a device changed 2) the first
scroll valuators to stay permanent on the application lifetime, as
the first stored valuators would always match.

https://bugzilla.gnome.org/show_bug.cgi?id=705203
2013-11-22 12:49:32 +01:00
Carlos Garnacho
fee754e0d2 gdk: Ignore crossings generated by passive grabs when resetting scroll axes
Passive grabs may take pointer focus out of the application, even though
the pointer didn't leave the window, but those events still trigger resetting
of the scroll axes. This is most visible with compiz, and possibly other
reparenting WMs, where passive grabs happen on the WM-managed window that
is a parent of the application toplevel.

As it is not possible to have scrolling happening on the timespan a passive
grab takes action, it is entirely safe for GTK+ to assume none happened if
it gets a crossing event of that nature.

https://bugzilla.gnome.org/show_bug.cgi?id=699574#c33
2013-11-18 22:12:18 +01:00
Carlos Garnacho
962415aeb7 x11: Add extra debug spew on XI2 crossing and button events
This information will be useful in case someone stumbles on a situation
similar to https://bugzilla.gnome.org/show_bug.cgi?id=699574, so we can
figure out where do the crossing events come from or go to easily.
2013-11-17 00:42:18 +01:00
Carlos Garnacho
4168c3cab9 gdk: be more selective resetting scroll events
It's been reported in several applications that scrolling feels jerky
since commit cc7b3985b3.

Investigation reported that the combination of passive 4-7 button grabs
on the toplevel and the presence of native subwindows might trigger
too often crossing events from the child window to the toplevel and
back as scroll "buttons" trigger the passive grab. Those crossing events
would reset the scroll valuators rendering scrolling from jerky on
touchpads (where there's intermediate smooth events between the emulated
button ones) to ineffective on regular mouse wheels (where the crossing
event would reset the valuators right before the single smooth scroll
event we get is delivered)

So, only reset scroll valuators when the pointer enters the toplevel
(we only care about this when the pointer is on the window after it's
been possibly scrolling somewhere else), and it doesn't come from an
inferior.

The situations where this happened varied though, the native subwindow
could be one created explicitly by the application, or created indirectly
through gdk_window_ensure_native(). The latter was mainly the case for
evolution (through gtk_selection_set_owner()) and any GtkScrolledWindow
under the oxygen-gtk3 theme (through gdk_window_set_composited())

https://bugzilla.gnome.org/show_bug.cgi?id=699574
2013-11-17 00:42:18 +01:00
Alexander Larsson
525e5cff04 x11: Initial cut at supporting window scaling for X11
If you set GDK_SCALE=2 in the environment then all windows will be
scaled by 2. Its not an ideal solution as it doesn't handle
multi-monitors at different scales, and only affects gtk apps.
But it is a good starting points and will help a lot on HiDPI
laptops.
2013-07-03 14:34:14 +02:00
Matthias Clasen
459e10196d GdkDeviceManagerXI2: chain up in constructed
Dispose does chain up, and the parent class' dispose expects
that the object has been fully constructed.
2013-06-29 19:21:28 -04:00
Mario Sanchez Prada
201410de60 Missing NULL-check in XI2's implementation for get_window()
Add missing check in gdk_x11_device_manager_xi2_get_window(), returning
NULL if no valid XI2Event* has been found. Calling code seems to be
prepared to handle NULLs coming from this function, so it should be
safe enough (e.g. check gdk_event_source_get_filter_window()).

https://bugzilla.gnome.org/show_bug.cgi?id=700465
2013-05-19 21:21:41 -04:00
David King
b0121ed0a1 xi2: Improve pointer emulation debug reporting
Reporting "true" or "false" is nicer than the value of the flag.

https://bugzilla.gnome.org/show_bug.cgi?id=697795
2013-04-11 15:56:13 +01:00
Carlos Garnacho
cc7b3985b3 xi2: Reset scroll valuators on synthesized crossing events
On crossing events resulting from moving windows (eg. workspace switch),
deviceid equals sourceid, so make those reset scroll valuators on all
slave devices to avoid misleading jumps in scroll events

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=690275
2013-04-10 20:18:09 +02:00
Ross Lagerwall
942c63d82b x11: Remove unused macro
https://bugzilla.gnome.org/show_bug.cgi?id=694395
2013-03-04 21:09:06 -05:00
Owen W. Taylor
06c4598fc5 GdkX11DeviceManagerXI2: handle focus events not on a known window
If we get a focus event for a X window we don't recognize, just
ignore it and avoid a g-critical when
_gdk_device_manager_core_handle_focus() is called with a NULL window.
2013-02-14 17:19:51 -05:00
Jasper St. Pierre
9dc4c5ce73 xi2: Abort early if we don't have a proper GDK window
This can happen in mutter or other applications that use GDK filters
but don't actually create GDK windows for everything they get events
for.

https://bugzilla.gnome.org/show_bug.cgi?id=689401
2012-12-13 10:51:38 -05:00
Owen W. Taylor
0aa989ae76 GtkPlug: fix handling of key events for different layouts
GtkPlug directly handles X KeyPress/Release events, instead of using
translation in GDK (which expects XI2 events for XI2). When this
was done, the handling of the group was stubbed out and never replaced.

Export gdk_keymap_x11_group_for_state() and gdk_keymap_x11_is_modifier()
so we can fill out the fields correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=675167
2012-04-30 16:35:10 -04:00
Sam Thursfield
2e873e3fdc Fix build with XInput < 2.2
Fixes regression introduced in fa8e6f7857
2012-04-24 12:55:39 +01:00
Cosimo Cecchi
8bb3a2001f xi2: ignore extraneous events for smooth scroll
Since the event will be ignored anyway after it's translated (slave
devices are disabled), don't let it run in the smooth scroll code path,
as it will burn our caches for the actual event we're interested in.

https://bugzilla.gnome.org/show_bug.cgi?id=673644
2012-04-22 13:06:39 -04:00
Cosimo Cecchi
37149668c0 xi2: fix thinko in variable type
https://bugzilla.gnome.org/show_bug.cgi?id=673644
2012-04-22 13:01:08 -04:00
Matthias Clasen
5a41b74c5c XI2: More logging for smooth scrolling
In addition to the delta, log device information.
This was triggered by
https://bugzilla.gnome.org/show_bug.cgi?id=673644
2012-04-22 13:00:47 -04:00
Matthias Clasen
432f0151eb xi2: Remove touchscreen heuristics
It doesn't make sense to consider a device a touchscreen if it
doesn't have any touch classes. Even if it has 'touch' in its
name.
https://bugzilla.gnome.org/show_bug.cgi?id=673440
2012-04-06 20:00:35 -04:00
Matthias Clasen
9d1688680c xi2: Don't reset scroll valuators too often
According to XInput gurus, a motion event without valuators
does not invalidate the stored value, so we should keep it.

https://bugzilla.gnome.org/show_bug.cgi?id=671659
2012-03-08 22:35:43 -05:00
Benjamin Otte
858a654676 x11: Avoid spurious focus events on grabs
We want to avoid handling focus events for the private focus window,
otherwise the keyboard grab taken by for example buttons will cause a
spurious FOCUS_OUT/FOCUS_IN on the toplevel.

The code that did this seems to have been lost in the XI2 transition for
GTK3.

This patch reapplies db4a6040af which was
backed out in 18406b7b04 to give
developers a chance to get their X servers fixed. As we want to get this
bugfix in for 3.4, we need to commit it now.

https://bugzilla.gnome.org/show_bug.cgi?id=657578
2012-03-07 15:35:21 +01:00
Matthias Clasen
3dd5e88c07 xi2: Normalize scroll deltas
XI2 provides us with an increment for each scroll valuator,
and by dividing the delta by the increment, we obtain normalized
values in some abstract 'scroll unit'.

For mouse wheels, the evdev driver reports an increment of -1,
so doing this division fixes the inverted scrolling with wheels
that we've seen recently.
2012-03-04 19:12:27 -05:00
Matthias Clasen
9687ac33b8 xi2: Add some more debug output about scroll devices 2012-03-02 23:02:57 -05:00
Matthias Clasen
482f04c89c xi2: add some debug output for smooth scroll events 2012-03-02 09:57:53 -05:00
Javier Jardón
962a5d8b8a Require XInput2.h in X11 backend
Also remove support for XInput.h
2012-03-02 12:52:12 +00:00
Matthias Clasen
352fdc214a Fix build with XI2.x for x < 2 2012-03-01 16:45:23 -05:00
Carlos Garnacho
013da47a07 gdk,xi2: Ensure scroll valuators are reset on window/device switch
This is in order to avoid scrolling glitches as the device causing
scrolling to happen or the Window receiving the events changes.
2012-03-01 16:29:01 -05:00
Carlos Garnacho
147cdd8465 devicemanager,xi2: Implement smooth scrolling
XInput >= 2.1 allows for implementing smooth scrolling,
reporting the different scrolling axes as valuators.
Any change in those will be reported as GdkEventScroll
events with delta_x/y information.

the older kind of scroll events is still handled, and
emulated in devices able to provide smooth scrolling,
setting _gdk_event_set_pointer_emulated() in that case.
2012-03-01 16:28:58 -05:00
Matthias Clasen
e5f7725fe0 gdk: Add some debug output for touch events and devices 2012-03-01 16:25:20 -05:00
Matthias Clasen
f7b7cc22e6 xi2: Translate touch events
Translate XI_TouchBegin/Update/End to GDK_TOUCH_BEGIN/UPDATE/END
events.

At the same time,
set pointer-emulated flags on button events with XIPointerEmulated
and on touch events emulating the pointer.
2012-03-01 16:25:20 -05:00
Matthias Clasen
734c9056c6 xi2: Use the new device types for touch-capable devices
Any device with a XITouchClassInfo with num_touches > 0
qualifies as multitouch.
2012-03-01 16:19:57 -05:00
Carlos Garnacho
fbb0d8e546 xi2: Add major/minor properties to XI2 device manager
This may be used to turn on/off the features that are added to
new XInput2 revisions.
2012-03-01 16:19:57 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
18406b7b04 Revert "x11: Avoid spurious focus events on grabs"
This reverts commit db4a6040af.

This is causing bad focus confusion e.g. in gnome-terminal.
2011-12-22 16:03:56 +00:00
Benjamin Otte
db4a6040af x11: Avoid spurious focus events on grabs
We want to avoid handling focus events for the private focus window,
otherwise the keyboard grab taken by for example buttons will cause a
spurious FOCUS_OUT/FOCUS_IN on the toplevel.

The code that did this seems to have been lost in the XI2 transition for
GTK3.

https://bugzilla.gnome.org/show_bug.cgi?id=657578
2011-12-19 16:17:14 +01:00
Benjamin Otte
2ea328dfbc x11: Unify focus handling code
This code was essentially copy-pasted in two locations, so unify them in
the same place.

https://bugzilla.gnome.org/show_bug.cgi?id=657578
2011-12-19 16:17:13 +01:00
Carlos Garnacho
358ecad501 gdk,xi2: Make more resilient about not yet known devices
Dealing with disabled devices may turn into hierarchy/device
changed events on device IDs with no backing GdkDevice yet,
so protect against that. The device attachment will be handled
correctly when the device is enabled later.
2011-12-18 18:57:57 +01:00
Matthias Clasen
9b967ab8af XI2: Push error traps around XIQueryDevice calls
This may help against the crashes at resume time that some
people have been hitting when input devices mysteriously
disappear.
2011-11-30 00:16:43 -05:00
Carlos Garnacho
79ff1b669c x11: Don't create GdkDevices for disabled devices
Fixes bug #658379 - Disabled devices still added to list on startup,
spotted by Bastien Nocera. Do not create GdkDevices for disabled
devices on device manager construction, leading to a confusing initial
state.
2011-09-06 20:04:08 +02:00
Carlos Garnacho
b5f30143ed x11: Skip GenericEvents with no cookie data in the xi2 device manager
https://bugzilla.gnome.org/show_bug.cgi?id=653947

It could happen that a cookie event has been already allocated/freed
in an event filter, as it can't be allocated a second time, all GDK
can do is skipping the event. Spotted by Guillaume Desmottes.
2011-07-15 18:33:44 +02:00
Carlos Garnacho
6aab48ead0 gdk/x11: Add gdk_x11_device_manager_lookup()
This function can be used to find the GdkDevice wrapping
an XInput2 device ID. For core devices, the Virtual Core
Pointer/Keyboard IDs (2/3) may be used.
2011-07-15 18:14:38 +02:00
Matthias Clasen
0c162851ed Add a missing break statement 2011-06-14 21:59:55 -04:00
Matthias Clasen
5254fbacfb Avoid an oob read 2011-06-14 21:56:50 -04:00
Carlos Garnacho
d3274e8e06 xi2: Handle XIM modules that replace events
Fixes Bug 645993 - XIM has wierd behaviors. Some XIM modules
filter every key event, possibly replacing it with their own
one. These events usually have serial=0, so make
GdkDeviceManagerXI2 also listen on these.
2011-06-13 07:16:16 -04:00
Carlos Garnacho
a529568f79 gdk: Get the right filter window for XI2 events
GdkDeviceManagerXI2 now implements GdkEventTranslator::get_window,
retrieving the right window from the contained XIEvent.
2011-05-18 22:34:33 +02:00