Commit Graph

371 Commits

Author SHA1 Message Date
Jasper St. Pierre
e62cf4745f device-manager: Select for events on XIAllMasterDevices
This removes a bit of work that we have to do for every device, and makes it
easy for mutter to patch out parts of the event mask it doesn't want.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-11 14:09:43 -04:00
Jasper St. Pierre
032688800c device-manager: Don't pass the event mask around
There's no point in doing this, as we always use a constant event mask.
Simply do what everything else does.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-11 14:09:43 -04:00
Jasper St. Pierre
e38ea7a20f x11: Remove support for XInput 1
Now we either use core X11 or XInput 2.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-11 14:03:43 -04:00
Jasper St. Pierre
0b32f99bd1 backend-x11: Remove bad branch prediction
This will only get once, at in Clutter initialization time.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-10 17:22:48 -04:00
Emmanuele Bassi
dc7d42d87a x11: Replace deprecated Cogl API 2013-07-03 18:24:27 +01:00
Emmanuele Bassi
41bb03da2d Use the new macros for adding private data 2013-07-03 18:04:32 +01:00
Emmanuele Bassi
2e905dd9d4 Fix annotations for signal arguments
The introspection scanner started warning about mismatched arguments
number.
2013-07-03 13:13:41 +01:00
Matthias Clasen
d343cc6289 x11: trap errors when calling XIQueryDevice
Devices can disappear at any time, causing XIQueryDevice
to throw an error. At the same time, plug a memory leak.

https://bugzilla.gnome.org/show_bug.cgi?id=701974
2013-06-10 21:45:47 -04:00
Emmanuele Bassi
03296e30e7 Fix compilers warnings when debugging is disabled 2013-04-04 11:53:38 +01:00
Jasper St. Pierre
c26d724f3d clutter-backend: Request XI2.3
Since XIQueryVersion, the bad API that it is, chooses the first client
version that it gets, we need to ensure that we pass XIQueryVersion the
new XI2.3 version, knowing fully well that Clutter won't be confused
by the new features.

https://bugzilla.gnome.org/show_bug.cgi?id=692466
2013-03-12 17:09:29 -04:00
Jasper St. Pierre
009da0c6ce x11: Always request XI2.2
The X server should fill in the minor version that it supports in the
case where it only supports the older version. We should not get a
BadRequest or fail the version check if we pass something higher.

https://bugzilla.gnome.org/show_bug.cgi?id=692466
2013-03-12 17:09:29 -04:00
Sebastian Keller
9dbc01b61f xi2: Reset scroll info for correct device on device change 2013-03-12 17:09:29 -04:00
Rui Matos
40ef7a5f6e x11/xi2: Factor the XKB group state in to fill events' modifier_state
Otherwise XkbTranslateKeyCode() won't yeld the correct keysyms when
group > 1.

https://bugzilla.gnome.org/show_bug.cgi?id=695260
2013-03-06 13:36:09 +01:00
Rui Matos
b01469c8f3 x11/clutter-keymap-x11: Honor XkbNewKeyboardNotify events
We already select for XkbNewKeyboardNotify events but are not acting
on them. Start doing so.

https://bugzilla.gnome.org/show_bug.cgi?id=694267
2013-02-24 18:35:53 +01:00
Damien Lespiau
3e479a3326 cogl: Don't use cogl_xlib_set_diplay()
This function is deprecated and has been replaced by set_display() on
the renderer. This is done in the get_renderer() vfunc of both the x11
and gdk backends already.

Actually cogl_xlib_set_diplay() is now a no-op and can be safely removed.

https://bugzilla.gnome.org/show_bug.cgi?id=687652
2013-02-20 23:06:28 +00:00
Rui Matos
c0469601c7 x11/device-manager-xi2: Fix slave to master association
A slave is associated to a master device, not the other way around.

https://bugzilla.gnome.org/show_bug.cgi?id=692971
2013-02-01 10:13:01 +01:00
Yanko Kaneti
069abd1122 xi2: Fix access beyond array boundaries 2013-02-01 06:17:36 +02:00
Jasper St. Pierre
4691878a76 x11: Ignore num lock / scroll lock for event state
As x11 considers num lock and scroll lock to be modifiers, code that
checks for an exact modifier combination will fail if naively done when
num lock or scroll lock are turned on. Applications that want to ignore
these modifiers will need to use XKB to manually mask out the modifier
state.

As it is very unlikely that applications will want to care about the
state of num lock or scroll lock for key press/key release events, mask
out the num lock and scroll lock keys automatically.

https://bugzilla.gnome.org/show_bug.cgi?id=690664
2013-01-14 12:56:07 -05:00
Daniel Stone
1a0e501efd X11: Use XFixes for show/hide cursor
This has been disabled since February 2008, on the grounds that XFixes
didn't work reliably for hiding cursors.  This has almost certainly been
fixed then and seems to work entirely reliably across a number of X
servers released in the past few years, and is definitely better than a
1x1 black dot for a cursor.

Helpfully though, where the spec states that the cursor will be hidden
when inside the specified window or one of its children, it actually
only uses the window to look up the Screen, and hides the cursor across
the entire Screen.  So, when using this, we also need to track crossing
events.

If it's still broken, this needs to be fixed in the X server.

https://bugzilla.gnome.org/show_bug.cgi?id=690497

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-01-10 17:10:50 +00:00
Emmanuele Bassi
47c1e26385 Enable XInput support by default
Instead of using core events, we should move into the XXI century, and
use the XInput extension.

https://bugzilla.gnome.org/show_bug.cgi?id=673838
2012-12-18 01:27:31 +00:00
Jasper St. Pierre
9614dff158 xi2: Reset the correct scroll axes on DeviceChanged
Otherwise, we'll have incorrect scrolling when we switch hardware
devices without switching virtual devices. For example, on a ThinkPad,
scroll using the touchpad, move the eraser mouse, and then scroll again:
the deltas will be wrong. This also matches what GTK+ does.

https://bugzilla.gnome.org/show_bug.cgi?id=689258
2012-11-29 16:50:54 -05:00
Emanuele Aina
35faaf604c x11: set the stage for core events with no associated stage
When the last touch has been released the stage on the
corresponding master device (eg. the virtual core pointer) is set
to NULL and no mouse events can be delivered until an ENTER event
has occurred and the stage pointer restored.

This is due to the fact that the master devices can send both
touch events and mouse events, forwarding events coming from the
attached slave devices.

To restore delivery of mouse events we need to ensure that the
stage is set on each ButtonPress, ButtonRelease and Motion event
coming from master devices.

https://bugzilla.gnome.org/show_bug.cgi?id=684509
2012-09-24 17:08:24 +01:00
Emanuele Aina
a6abf86e94 input-device: print device number in debug messages
https://bugzilla.gnome.org/show_bug.cgi?id=684530
2012-09-24 17:04:08 +01:00
Emmanuele Bassi
950e60f824 x11: Add EventSequence → touch detail accessor
The ClutterEventSequence structure is a fully opaque type; on X11, it is
just an unsigned integer that gets converted into a pointer, but in the
future it may become a fully fledged data structure.

Obviously, we cannot tell people to just dereference the pointer into an
integer in order to use it, and still retain the ability to change the
type; for this reason, we need a proper accessor function to convert the
EventSequence into a touch detail, to be used with the XInput API.
2012-09-05 09:43:47 +01:00
Lionel Landwerlin
d6a0f7eb61 input-device: don't reset a device's stage until all touch points are gone
803b3bafb6 introduced a new issue for
multi touch events.

In the case where 2 touch events for 2 different touch points are
processed in the same iteration, a call to
_clutter_stage_remove_device() when processing the first event will
remove the stage setting of the InputDevice. That means Clutter will
skip the second event, because it can't find a stage to which relate
the event, so no related actor and so no emission.

To fix this we move the _clutter_stage_(add/remove)_device() calls
into the input device. This way the input device can find out exactly
when to call these functions (i.e. when no touch point were previously
active or when no touch point remain active).

https://bugzilla.gnome.org/show_bug.cgi?id=682362
2012-09-03 21:50:24 +01:00
Tomeu Vizoso
d5332d1e4c stage: Remove tracking input devices, it's not used
https://bugzilla.gnome.org/show_bug.cgi?id=683126
2012-09-03 21:50:19 +01:00
Emmanuele Bassi
b2b22dbe6c x11/device-manager-xi2: Put XIPointerEmulated under conditionals
There are a couple of debugging messages using XInput 2.2 symbols
unconditionally, and it breaks builds on older systems.

https://bugzilla.gnome.org/show_bug.cgi?id=683219
2012-09-02 22:48:52 +01:00
Emmanuele Bassi
31b8b2e22f x11: Add debug notes for pointer-emulated 2012-07-18 17:14:17 -04:00
Emmanuele Bassi
2a31a93c5e x11/xi2: Do not generate scroll events on ButtonRelease
Scroll events are generated on ButtonPress only in the core event
handling, so it should happen the same if we use XInput.

https://bugzilla.gnome.org/show_bug.cgi?id=680088
2012-07-17 10:13:12 -04:00
Emmanuele Bassi
b985c4035e Deprecate ClutterTexture's API
ClutterTexture is full of side effects that have been picked up over the
years; they make improving ClutterTexture harder than necessary, as well
as making subclassing impossible without introducing weird behaviours in
the child classes as well.

Since Clutter 1.10 we have the ClutterImage content type, which is
side-effects free, given that it just paints texture data using the
state of the actor.

Sadly, we still have subclasses of ClutterTexture, both deprecated and
not, so we cannot deprecate ClutterTexture right out; the type and
structures will still be available, like we do for ClutterGroup, but the
whole API should be moved to the deprecated section, waiting for the
time in which we can get rid of it all.
2012-07-11 13:22:21 +01:00
Emmanuele Bassi
0e4c6d0a87 Deprecate clutter_threads_enter()/leave()
Acquiring the Clutter lock to mark critical sections is not portable,
and not recommended to implement threaded applications with Clutter.

The recommended pattern is to use worker threads, and schedule UI
updates inside idle or timeout handlers within the main loop. We should
enforce this pattern by deprecating the threads_enter()/leave()
functions. For compatibility concerns, we need internal API to acquire
the main lock during frame processing dispatch.

https://bugzilla.gnome.org/show_bug.cgi?id=679450
2012-07-11 13:22:19 +01:00
Matthias Clasen
e3ca87784e XI2: Avoid a crash in event translation
It is possible that we get a DeviceChanged event for a device
that is not in the hash table yet. E.g. I've seen this when
using xrandr to change screen resolution. Prevent a crash in
this case.

https://bugzilla.gnome.org/review?bug=678439
2012-06-20 07:22:12 -04:00
Bastien Nocera
2bb84d9169 x11/device-manager-xi2: Fix assertions with touch
When getting touch events, the device manager would try
to pass an invalid device to translate_axes().

clutter_event_set_device() will only update event->touch.device
for touch events, not event->motion.device, as used.

Fixes Totem crashing on mouse motion/button press when using
a touchpad.

https://bugzilla.gnome.org/show_bug.cgi?id=675371
2012-05-03 19:32:07 +02:00
Emmanuele Bassi
0dd74ca3fb docs: Annotation fixes
The introspection scanner has become slightly more annoying, in the hope
that people start fixing their annotations. As it turns out, it was the
right move.
2012-04-30 17:17:41 +01:00
Emmanuele Bassi
26d8ad7479 Be resilient in case there is no device manager
It's possible to run Clutter with the 'null' input backend, which means
that clutter_device_manager_get_default() may return NULL. In the future
we may add a default dummy device manager, but right now it's safer to
just add a simple NULL check in the places where we ask for the device
manager.
2012-04-26 13:56:00 +01:00
Cosimo Cecchi
032870dccc device-manager: select/unselect device events as device change
When a device is added or changes, select/unselect events from X
accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=673644
2012-04-24 18:49:42 -04:00
Cosimo Cecchi
d61515322a x11/device-manager-xi2: Flip deltas around
Up/down is Y.
2012-04-20 18:33:16 +01:00
Peter Hutterer
a66fbd258e Rename XINPUT_2_2 define to HAVE_XINPUT_2_2
configure.ac defines XINPUT_2_2 if XI 2.2 support was found. The code
expects XINPUT_2_2 in the device manager, but HAVE_XINPUT_2_2 in the x11
backend.

On newer X servers, the latter causes a BadValue when XIQueryDevice sends a
different major/minor than gdk's device manager (gnome-control-center).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

https://bugzilla.gnome.org/show_bug.cgi?id=673961
2012-04-12 11:31:29 +01:00
Emmanuele Bassi
25bf0b72f6 x11/stage: Leave a comment about multi-head setup
The get_geometry() implementation is broken on multi-head systems; the
only solution is to use XRandR to get the size of the CRTC that contains
the stage.
2012-04-10 12:34:54 +01:00
Emmanuele Bassi
f6da5ea616 x11/device-manager-xi2: Add 'Abs Distance' axis
In XInput 2, the proximity events of XInput 1 have been replaced by an
axis on a valuator class. This means that, on devices that support
proximity information, for instance pens of a tablet, you will start
receiving events with the distance as an axis value - similarly to how
the pressure and tilt are presented in the API.
2012-04-10 09:32:00 +01:00
Emmanuele Bassi
86a5213473 x11/device-manager-xi2: Remove heuristics for touchscreen devices
Devices that have touch valuator classes will be touchscreens or
touchpads; anything else should be ignored.
2012-04-07 23:07:59 +01:00
Emmanuele Bassi
5a77f814ab x11/keymap: Silence deprecation warnings around a fallback
We still use XKeycodeToKeysym() in a fallback path in case we're not
running on a decent enough system; XKeycodeToKeysym() is deprecated as
of version 1.12 of the X server, but since I don't want to copy a bunch
of code from GDK or, god forbid, from Xlib, for a fallback path, it's
probably more reasonable to just silence the compiler warnings - at
least until we can drop all the X compatibility crap, and just use
modern, or semi-modern, API.
2012-03-19 14:40:46 +00:00
Emmanuele Bassi
09a317d23d x11: Add support for touch events
For the time being, we just relay everything we get from the X server to
the Clutter application.
2012-03-19 14:29:24 +00:00
Emmanuele Bassi
1c500f7de9 x11: Reset scroll valuators
We need to clear up the state on enter and leave, as well as when the X
server tells us that the device has changed.
2012-03-19 14:29:23 +00:00
Emmanuele Bassi
676a317439 x11: Add support for scroll valuators on XInput2.2 2012-03-19 12:41:24 +00:00
Lionel Landwerlin
4d42904fcc x11/stage: fix multi-stage support
When handling Configure events from the X server we update the
internal copy of the window size. Unfortunately we may be updating the
wrong stage implementation because we use the one related to the event
translator (which is the first created stage).

This patch fix flickering/redrawning issues with multi-stage by
looking for the right stage implementation associated with an XEvent.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
2012-03-18 00:17:36 +00:00
Emmanuele Bassi
3a86d88b43 x11/device-manager-core: Avoid a signed/unsigned comparison 2012-03-07 12:36:43 +00:00
Emmanuele Bassi
f5065059b7 x11/keymap: Avoid a signed/unsigned comparison 2012-03-07 12:36:43 +00:00
Emmanuele Bassi
f54a4532a4 x11/backend: Ensure that pre/post parse hooks are not exposed
Not even as private methods.
2012-03-07 12:36:43 +00:00
Neil Roberts
1f7968e5f9 wayland/x11: Set constraints on the CoglRenderer
When using the Wayland backend this sets a constraint that the
CoglRenderer selects the Wayland EGL winsys.

When a Wayland compositor display is set it now also sets a constraint
that the render should use EGL because only EGL renderers will set up
the required wl_drm global object.

The X11 backend now sets the X11 constraint.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00