Commit Graph

414 Commits

Author SHA1 Message Date
Lionel Landwerlin
ff1a5aae7a x11: stage window: reset framebuffer on foreign window unrealize
Similarly to 13dbb74c81, we need to reset the
framebuffer in the x11 for foreign windows.

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:29:04 +01:00
Emmanuele Bassi
13c722c026 x11: Remove unused enumeration
The ClutterX11XInputEventTypes enumeration has been unused inside
Clutter for the past 4 years and a half, since we switched to the
XInput 2 API.

The enumeration itself has always been private, and nobody should
have used it in the first place, but if something breaks, we can
revert this commit.
2015-07-20 13:05:06 +01:00
Emmanuele Bassi
9d40fafa2a Do not generate backend-specific enumeration types
They should be part of the backend-specific API.

The only backend that has an enumeration type is the X11 one, and it's
small, so we can simply put it there.

This is not an ABI change: the backend-specific symbols are still in
the same SO. You'll be required to import clutter-x11.h to have access
to the GType method at the source level, whereas before just importing
clutter.h would have sufficed. The only user of that enumeration was a
function declared in clutter-x11.h, anyway.
2015-07-20 13:00:12 +01:00
Peter Hutterer
661078a4f2 x11: don't create the libinput tapping property
If it doesn't exist, we don't have a touchpad. Don't create the property
and potentially confuse other pieces of the stack that do the same check.
2015-07-07 16:03:31 +01:00
Rui Matos
9268bb9144 x11: Fix touchpad detection
Commit 79849ef1d5fff9acd310cd68d59df0c7cf2cb28f had a typo in the
device property format check. This property is formated in 8-bit
items, not 32-bit.

This went unnoticed till now because some touchpads were still being
detected as such due to a second check below:

      else if (strstr (name, "touchpad") != NULL)
        source = CLUTTER_TOUCHPAD_DEVICE;

https://bugzilla.gnome.org/show_bug.cgi?id=749482
2015-05-18 11:43:58 +02:00
Emmanuele Bassi
877e58a6b4 x11: Plug a leak on error path
If XIGetProperty() does not return what we expect, but still returned
something, we need to free it.
2015-04-09 12:35:23 +01:00
Emmanuele Bassi
83cd36e95f x11: Improve touchpad detection heuristics
We should use the same heuristics used by GDK in order to detect whether
a device is a touchpad or not.

Based on the similar code from Carlos Garnacho for GDK:
https://git.gnome.org/browse/gtk+/commit/?id=6f07d5e7

https://bugzilla.gnome.org/show_bug.cgi?id=747436
2015-04-09 11:03:16 +01:00
Emmanuele Bassi
1912f28063 docs: Remove leftover DocBook tags
We use markdown for the documentation.
2015-03-12 20:22:57 +00:00
Owen W. Taylor
c32dc34080 Allow setting up quad-buffer stereo output
Add clutter_x11_set_use_stereo_stage() that can be called
before clutter_init() so that the CoglDisplay we create and all
stages created from that CoglDisplay will be created with a
stereo fbconfig.

This is done in clutter-x11 because of the similarity to the
existing clutter_x11_set_use_argb_visual(), and because it's
not clear without other examples whether the need to have
stereo enabled from before clutter_init() is universal or
somethign specific to GLX.

Cogl required version is increased to 1.20, which has the
required API.

https://bugzilla.gnome.org/show_bug.cgi?id=732706
2015-02-23 16:39:21 -05:00
Carlos Garnacho
c0d5d58e8b x11: Set vendor/product IDs on input devices
This is fetched from XInput device properties

https://bugzilla.gnome.org/show_bug.cgi?id=740759
2015-01-09 17:01:22 +01:00
Jonas Danielsson
9660b001f7 device-manager-xi2: Fix scaling of coordinates
Do not CLAMP to width/height before applying the scale factor
we will lose all information we need to scale properly.

https://bugzilla.gnome.org/show_bug.cgi?id=730815
2015-01-09 06:38:24 -05:00
Emmanuele Bassi
2034e75658 Use the proper debug category
Backend-related notes should use the `BACKEND` category, not `MISC`.
2015-01-01 12:44:19 +00:00
Sjoerd Simons
1be019852f device-manager-xi2: Fix core pointer retrieval race
The core pointer concept doesn't really exist anymore in an XI2 world,
so the clutter API is a bit of a mismatch with what X provides. Using
XIGetClientPointer doesn't really help, as far as i can tell the
semantics of XIGetClientPointer are essentially: Whatever the X server
picked when it had to reply with device-dependant data to a query
without a device specifier. Not very useful...

To make matters worse, whether XIGetClientPointer returns a valid
pointer depends on whether there has been a query that forced it to pick
one in the first place, making the whole thing pretty non-deterministic.

This patch changes things around such that instead of using
XIGetClientPointer to determine the core pointer, we simply pick the
first master pointer device. In practise this will essentially always
be the X virtual core pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=729462
2014-12-15 17:29:52 +00:00
Jonas Ådahl
5281425a53 DeviceManagerXi2: Update cached core pointer in getter if NULL
XIGetClientPointer() may return the device id '0' when called early.
This patch makes pointer cursors work in nested mutter Wayland
sessions again.

https://bugzilla.gnome.org/show_bug.cgi?id=729462
2014-12-15 17:24:59 +00:00
Carlos Garnacho
a0e2ba62a1 x11: Resort to device name matching for non-mt touchpads
If a touchpad is not multitouch, or does not report MT axes (eg. through
the libinput driver), resort to name matching before falling back to
CLUTTER_POINTER_DEVICE.

https://bugzilla.gnome.org/show_bug.cgi?id=741350
2014-12-11 11:48:06 +01:00
Rico Tzschichholz
084dc49a0c x11: Add missing closure annotation to ClutterX11FilterFunc 2014-10-02 09:27:36 +02:00
Carlos Garnacho
591d31c970 xi2: XSync before getting the client pointer on construction
If the device manager is created and queried for the client pointer at
a very early stage in application lifetime, the device_id returned would
be 0 as the server hasn't apparently decided yet about the client pointer.

For these situations, doing XSync prior to fetching the client pointer
gets the server to device about the client pointer before we query it.

https://bugzilla.gnome.org/show_bug.cgi?id=735388
2014-08-25 16:51:31 +02:00
Adel Gadllah
cfcba18684 clutter-settings: Mark window-scaling-factor as fixed when set by the app
When an application sets the scaling factor manually we should mark it as fixed
and not override it when the xsettings change. This matches GDKs behaviour.

In order for this to work we cannot use the same path when setting the value
internally so introduce a _clutter_settings_set_property_internal and use it
for that.

https://bugzilla.gnome.org/show_bug.cgi?id=735244
2014-08-23 14:02:56 +02:00
Emmanuele Bassi
f12c174d72 Remove unused internal 'in-resize' flag
A remnant of days gone by.
2014-08-15 12:07:48 +01:00
Carlos Garnacho
4c4e72a9dc x11: Set the input device stage on XI_TouchBegin, if not already set
Until now, touch events sort of rely on XI_Enter/XI_Leave events accompanying
the pointer emulating touch in order to have a stage set on the device, These
events won't happen though if it's not a pointer emulating touch which happens
on the stage, causing touch events to be ignored.

Fix this by ensuring that the input device has a stage on XI_TouchBegin itself,
but only if it's not already set, so we don't possibly steal touch events to
an already interacting stage.

https://bugzilla.gnome.org/show_bug.cgi?id=732234
2014-06-25 16:55:16 +01:00
Gustavo Noronha Silva
fcdd222c61 device-manager-xi2: use allocation for clamping
The coordinates translated by the XI2 device manager were being clamped using
the X window size kept by StageX11. However, when the stage is fullscreen,
that size is not updated to the screen size, but kept the same in order to
allow going back to it when the stage goes out of fullscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=731268
2014-06-05 15:03:10 -03:00
Emmanuele Bassi
ddc1955f6b docs: Port backend-specific sections to markdown 2014-03-17 23:10:07 +00:00
Emmanuele Bassi
53a86e91d9 Annotate symbols in backend-specific headers
Like we did for the rest of the API.
2014-03-17 19:26:49 +00:00
Rui Matos
e70a0109f2 Avoid needless event copies when queueing from a backend to a stage
All backends follow the same pattern of queueing events first in
ClutterMainContext, then copying them to a ClutterStage queue and
immediately free them. Instead, we can just pass ownership of events
directly to ClutterStage thus avoiding the allocation and copy in
between.

https://bugzilla.gnome.org/show_bug.cgi?id=711857
2014-03-15 19:44:57 +00:00
Emmanuele Bassi
572504db4d Edit an incorrect comment
The location of the cool-off handling of clipped redraws has been moved
to clutter-stage-x11.c a long time ago (commit 1b1e77b4).
2014-03-15 19:31:54 +00:00
Emmanuele Bassi
3209129d6b x11: Add keymap direction query
We should use the Xkb API to query the direction of the key map,
depending on the group. To get a valid result we need to go over
the Unicode equivalents of the key symbols for each group, so we
should cache the result.

The code used to query and cache the key map direction is taken
from GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=705779
2014-03-03 23:42:33 +00:00
Adel Gadllah
4a3ad9c3af DeviceManagerXi2: Cache the client pointer
Currently clutter_device_manager_xi2_get_core_device always
does a round trip to query the client.

So avoid that by caching the client pointer and only update it when the
xi devices change.

https://bugzilla.gnome.org/show_bug.cgi?id=725561
2014-03-03 15:06:11 +01:00
Carlos Garnacho
488639eb63 x11: Avoid invalid ClutterInputDevice pointers in the device list
Due to the way add_device() invariably adds to the master/slave device
lists, while keeping ClutterInputDevices 1:1 with device IDs, it may
leave invalid pointers in the list if add_device() is called multiple
times for the same device ID. There are two situations where this may
happen:

1) If devices are disabled and later enabled: devices are added invariably
   to the master/slave lists on constructed(), but then on XIDeviceEnabled
   they'd get added yet again.
2) Racy cases where the ClutterDeviceManager is created around the same time
   XIHierarchyEvents are sent. When getting the XIDeviceInfo on constructed(),
   these devices may already appear as enabled, even though XIDeviceEnabled
   is seen through XIHierarchyEvents processed in the event loop sortly after.

   This last case can be seen when starting gnome-shell on a different tty,
   and entering in the one it's been spawned on, clutter initialization
   happens around the same time devices are added back because of the tty
   switch, and multiple extra ClutterInputDevices are created.

https://bugzilla.gnome.org/show_bug.cgi?id=724971
2014-02-25 10:18:20 +01:00
Emmanuele Bassi
dd034cccad x11: Fix bad logic in axis check
https://bugzilla.gnome.org/show_bug.cgi?id=711540
2014-02-10 17:43:16 +00:00
Emmanuele Bassi
30d1e47c4e x11/stage: Store new size on unrealized resize()
If the StageX11 is asked to resize itself while not being realized, then
we just need to store the new size and return.
2014-01-23 12:17:09 +00:00
Emmanuele Bassi
c1c59bd898 x11/stage: Resize on window-scaling-factor changes
If we get a change in the window scaling factor we want to resize the
backing store of each stage, so we use the notification on the
ClutterSettings:window-scaling-factor property to do so.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2014-01-20 12:26:46 +00:00
Emmanuele Bassi
2c8a19b8c1 x11/stage: Remove CLUTTER_SCALE handling
Use the ClutterSettings:window-scaling-factor property instead.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2014-01-20 12:26:46 +00:00
Emmanuele Bassi
69eb2e5f3b settings: Add window scaling related settings
We share two settings with GDK, so we can pick the window scaling factor
and the unscaled font resolution when we initialize Clutter.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2014-01-20 12:26:46 +00:00
Rui Matos
ce1f8f1dd0 device-manager-xi2: Fix device instances leaking on removal
Don't add an extra reference when adding to the devices hash table. We
already own the initial reference.

https://bugzilla.gnome.org/show_bug.cgi?id=712812
2013-11-21 19:34:14 +01:00
Jasper St. Pierre
c2b0b9aace input-device-xi2: Calculate the correct state for button events
The state that the X server sends for button events, by specification,
contains the button state before the event. We need to synthesize in
the result of the event in order to determine what the current button
state is.

https://bugzilla.gnome.org/show_bug.cgi?id=712322
2013-11-14 14:30:30 -05:00
Jasper St. Pierre
0fda81feab Remove use of XFixes for showing/hiding the cursor
XFixesShowCursor / XFixesHideCursor does not actually take the suppled
window argument into account -- the effect is actually global. Use
XDefineCursor instead.

https://bugzilla.gnome.org/show_bug.cgi?id=707071
2013-11-14 18:34:40 +00:00
Jasper St. Pierre
98e03fc03f device-manager-xi2: Clamp coordinates of events to the stage coordinates
The X server can sometimes send us coordinates in the negatives or above
our window in extreme cases. Ensure that the user never sees this.
2013-11-14 18:34:40 +00:00
Jasper St. Pierre
1de024b5fa device-manager-xi2: Don't divide by the scale factor twice
The coordinates we pass into translate_axes are already scaled.
2013-11-14 18:34:40 +00:00
Emmanuele Bassi
300c76df17 x11: Ensure we have a stage before accessing its fields
For some XI2 we do not have a Stage associated to the event window.

Original patch by: Giovanni Campagna <scampa.giovanni@gmail.com>
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=708439
2013-09-20 10:56:57 +01:00
Emmanuele Bassi
75f81fee70 x11: Apply the window scaling factor
On high DPI density displays we create surfaces with a size scaled up by
a certain factor. Even if the contents stay at the same relative size
and position, we need to compensate the scaling both when changing the
surface size, and when dealing with input.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2013-09-19 22:51:52 +01:00
Giovanni Campagna
59f1e531f9 ClutterEvent: add API to query the full keyboard state when the event was generated
When talking to other applications or serializing the modifier
state (and in particular when implementing a wayland compositor),
the effective modifier state alone is not sufficient, one needs
to know the base, latched and locked modifiers.

Previously one could do with backend specific functionality
such as clutter_device_manager_evdev_get_xkb_state(), but the
problem is that the internal data structures are updated as
soon as the events are fetched from the upstream source, but
the events are reported to the application some time later,
and thus the two can get out of sync.
This way, on the other hand, the information is cached in the
event, and provided to the application with the value that
was current when the event was generated.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:23 +02:00
Emmanuele Bassi
c2d5dd2d11 x11: Remove unused variable 2013-07-12 09:57:23 +01:00
Jasper St. Pierre
01707f0da9 input-device-x11: Remove more dead code
It seems this API has never been used..
2013-07-11 14:09:43 -04:00
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