1
0
Fork 0
Commit graph

530 commits

Author SHA1 Message Date
Jonas Ådahl
c3d2352a9e Explicitly create per backend stage windows
Split the stage window implementations into three separate objects: one
for X11 as a compositing manager, one for X11 running as a nested
Wayland compositor, and one for running with the native backend.

The new stage window implementations are only thin shells; this is in
preparation for making the stage windows behave more differently.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
55726e787b backends: Make clutter stage resizing more explicit
The stage resizing was placed in the generic backend, which was only
run on certain configurations (when running nested or using the native
backend). This commits makes the resizing more explicit thus more
obvious.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2ceff4ee9b Create cogl renderer in MetaRenderer
Instead of passing around the KMS file descriptor via clutter to cogl,
just make our own clutter backend create the cogl renderer and set the
KSM fd.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a54042e938 Introduce MetaRenderer
MetaRenderer is meant to be the object responsible for rendering the
scene graph. It will contain the logic related to the cogl winsys
backend, the clutter backend, and the clutter stage window.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
90de521799 Make mutter manage its own clutter backends
Introduce two new clutter backends: MetaClutterBackendX11 and
MetaClutterBackendNative. They are so far only wrap ClutterBackendX11
and ClutterBackendEglNative respectively, but the aim is to move things
from the original clutter backends when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Rui Matos
7f6bcea331 compositor: Handle GL video memory purged errors
Emit a signal so that interested parties can recreate their FBOs and
queue a full scene graph redraw to ensure we don't end up showing
graphical artifacts.

This relies on the GL driver supporting the
NV_robustness_video_memory_purge extension and cogl creating a
suitable GL context. For now we only make use of it with the X backend
since the only driver with which this is useful is NVIDIA.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:50 +02:00
Rui Matos
1141929bc5 backends: Add flags to MetaMonitorMode
And export them in the DBus API since they're useful for
gnome-control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=763832
2016-05-13 18:44:45 +02:00
Jonas Ådahl
f0f638d2bd Move out generic math parts out of the native barrier implementation
In order to reuse some vector math for pointer confinement, move out
those parts to its own file, introducing the types old types
"MetaVector2" and "MetaLine2" outside of meta-barrier-native.c, as well
as introducing MetaBorder which is a line, with a blocking direction.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Ray Strode
42b3a34f7b idle-monitor-xsync: fix crash if watch callback removes different watch
Right now the XSync based idle monitoring code, will fetch all active
watches into a list, and then call their watch callbacks one by one
as necessary.  If one watch callback invalidates another watch, the
list will contain free'd memory.

This commit makes sure to consult the hash table after ever call
of a watch callback, to ensure mutter never looks at freed memory.

Fixes crash reported on IRC by Laine Stump with his synergy setup.

https://bugzilla.gnome.org/show_bug.cgi?id=760330
2016-01-11 11:23:39 -05:00
Jasper St. Pierre
9ebe3419c3 monitor-manager-xrandr: Don't query legacy properties
This never could have worked -- the Atom name it was querying was a root
window property, not an output property.
2016-01-09 18:06:18 -08:00
Bastien Nocera
a27b2597b9 backends: Force 2-finger scroll by default if available
When the touchpad is two-finger scrolling capable, always enable it.

When the touchpad only supports edge scrolling (usually older devices, and
usually smaller devices), allow disabling the edge scrolling.

This requires a newer gsettings-desktop-schemas as the scroll-method key
was removed, and the edge-scroll-enabled key added.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:38:23 +01:00
Rui Matos
af2a13ded4 monitor-manager-xrandr: Skip outputs with no crtcs
Outputs with no crtcs shouldn't happen, but if it does we should
ignore them, instead of possibly crashing later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
8b200de35a monitor-manager-xrandr: Skip outputs with no modes
If we can't find any valid modes for an output we need to unwind and
skip the output because trying to use a modeless output later will
crash us.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
57ae203aab Revert "monitor-manager-xrandr: Ignore outputs without modes"
This reverts commit 86a913d37a. It
introduced a memory leak, so we'll go for a cleaner approach.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
86a913d37a monitor-manager-xrandr: Ignore outputs without modes
In some cases we get outputs without any valid mode. We need to ignore
them or we'll crash later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-23 14:13:26 +02:00
Alberts Muktupāvels
2857fdbdb8 backend-x11: Ensure the Xkb group index remains properly set
Ubuntu ships a patch in the X server that makes the group switch
keybindings only work on key release, i.e. the X server internal group
locking happens on key release which means that mutter gets the
XKB_KEY_ISO_Next_Group key press event, does its XLockGroup() call
with a new index and then, on key release, the X server moves the
index further again.

We can work around this without affecting our behavior in unpatched X
servers by doing a XLockGroup() every time we're notified of the
locked group changing if it doesn't match what we requested.

https://bugzilla.gnome.org/show_bug.cgi?id=756543
2015-10-23 14:13:26 +02:00
Rui Matos
43a1d43f2b monitor-manager-xrandr: Be more robust when reading XRROutputInfos
We might get modes in XRROutputInfos that aren't in the
XRRScreenResources we get earlier. This always seems to be transient,
i.e. when it happens, the X server will usually send us a follow up
RRScreenChangeNotify where we then get a "stable" view of the world
again.

In any case, when these glitches happen, we end up with NULL pointers
in the MetaOutput->modes array which makes us crash later on. This
patch ensures that doesn't happen.

https://bugzilla.gnome.org/show_bug.cgi?id=756660
2015-10-16 13:57:26 +02:00
Rui Matos
9abc071283 backend-x11: Fallback to a default keymap if getting it from X fails
This shouldn't fail but apparently sometimes it does and in that case
having a possibly wrong idea of the keymap is still better than
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=754979
2015-09-25 19:09:48 +02:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02:00
Florian Müllner
27b37407d0 Don't duplicate declarations from G_DEFINE_TYPE 2015-09-24 03:01:51 +02:00
Jonas Ådahl
79c86ae890 Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that
cursor sprites changes appearance as it moves across the screen.
Renderers are adapted to handle the necessary functionality.

The logic for changing the cursor sprite appearance is done outside of
MetaCursorSprite, and actually where depends on what type of cursor it
is. In mutter we now have two types of cursors that may have their
appearance changed:

 - Themed cursors (aka root cursors)
 - wl_surface cursors

Themed cursors are created by MetaScreen and when created, when
applicable(*), it will extend the cursor via connecting to a signal
which is emitted everytime the cursor is moved. The signal handler will
calculate the expected scale given the monitor it is on and reload the
theme in a correct size when needed.

wl_surface cursors are created when a wl_surface is assigned the
"cursor" role, i.e. when a client calls wl_pointer.set_cursor. A
cursor role object is created which is connected to the cursor object
by the position signal, and will set a correct texture scale given what
monitor the cursor is on and what scale the wl_surface's active buffer
is in. It will also push new buffers to the same to the cursor object
when new ones are committed to the surface.

This commit also makes texture loading lazy, since the renderer doesn't
calculate a rectangle when the cursor position changes.

The native backend is refactored to be triple-buffered; see the comment
in meta-cursor-renderer-native.c for further explanations.

* when we are running as a Wayland compositor

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
8900bd2f5c backends/x11: Draw our own cursor sprite when running nested
Use a specialized cursor renderer when running as a nested Wayand
compositor. This new renderer sets an empty X11 cursor and draws the
cursor as part of the stage using the generic cursor renderer drawing
path.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Ting-Wei Lan
5066eaf691 build: Fix non-wayland build
This fixes build error caused by commit 614d6bd. We can simply remove
the usage of meta-wayland.c functions in non-wayland build because
META_BACKEND_X11_MODE_NESTED is only used in wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-08 01:50:03 +08:00
Owen W. Taylor
614d6bd0f8 Nested X11: use KeymapNotify events to fix key state on FocusIn
If the user Alt-Tabs out of the window, we will be left thinking
the Alt key is still pressed since we don't see a release for it.

Solve this and other related issues for the nested X11 compositor
by selecting for KeymapStateMask which causes a KeymapNotify event
to be sent after each FocusIn, and when we get these events, update
the internal XKB state and send any necessary modifiers events to
clients.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-03 16:02:25 -04:00
Jonas Ådahl
4b667d1e09 Rename MetaCursorReference to MetaCursorSprite
It isn't really a reference to a MetaCursor enum, but a reference
counted cursor sprite, and enum value.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Rui Matos
299ed424d3 compositor: Handle fences in the frontend X connection
Since mutter has two X connections and does damage handling on the
frontend while fence triggering is done on the backend, we have a race
between XDamageSubtract() and XSyncFenceTrigger() causing missed
redraws in the GL_EXT_X11_sync_object path.

If the fence trigger gets processed first by the server, any client
drawing that happens between that and the damage subtract being
processed and is completely contained in the last damage event box
that mutter got, won't be included in the current frame nor will it
cause a new damage event.

A simple fix for this would be XSync()ing on the frontend connection
after doing all the damage subtracts but that would add a round trip
on every frame again which defeats the asynchronous design of X
fences.

Instead, if we move fence handling to the frontend we automatically
get the right ordering between damage subtracts and fence triggers.

https://bugzilla.gnome.org/show_bug.cgi?id=728464
2015-08-13 14:14:46 +02:00
Florian Müllner
cba2ab445e backend-x11: Don't assert on something that might happen
While we shouldn't normally receive crossing events for any windows
except the stage when running nested, we do in case we hold a pointer
grab - just ignore those events instead of taking down the user's
session.
2015-08-10 17:00:57 +02:00
Rui Matos
39763d4add compositor: Add support for GL_EXT_x11_sync_object
If GL advertises this extension we'll use it to synchronize X with GL
rendering instead of relying on the XSync() behavior with open source
drivers.

Some driver bugs were uncovered while working on this so if we have
had to reboot the ring a few times, something is probably wrong and
we're likely to just make things worse by continuing to try.  Let's
err on the side of caution, disable ourselves and fallback to the
XSync() path in the compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=728464
2015-08-07 17:27:42 +02:00
Peter Hutterer
5f1bcc124f input-settings-x11: check properties for correctness before changing them
Before submitting a new scroll mode, click method or sendevents mode check if
the value is supported by the device. This avoids BadValue errors when setting
two-finger scrolling on single-finger touchpad devices since we can't easily
handle BadValue (see 9747277b)

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-14 16:42:33 -05:00
Cosimo Cecchi
659b8ed471 monitor-manager-xrandr: don't set underscan property when not supported
We should not be setting random output properties like this.
Use the function we just introduced to only set the underscan flag when
it's actually supported.
2015-07-01 18:22:48 -07:00
Cosimo Cecchi
94bce5a00f monitor-manager: add a property to discover if underscan is supported
So that clients such as the control center can decide to hide an
underscanning checkbutton when the output does not support it.

Support in the KMS / native backend to come later...
2015-07-01 18:20:57 -07:00
Jasper St. Pierre
8da5761ffc x11/xrandr: Use xcb to set properties on outputs
It seems that fglrx sometimes gives us absolute junk when requesting the
outputs, and if we don't trap errors, we'll just crash when trying to
configure a junk output. Use xcb so errors simply get ignored.
2015-06-28 13:25:49 -07:00
Peter Hutterer
b55f792302 input-settings-x11: don't create non-existing atoms
If the atom doesn't exist it won't exist on the device either so we can
shortcut the property retrieval/modification. Creating atoms by name but not
doing anything with them also confuses kcm_touchpad

https://bugzilla.redhat.com/show_bug.cgi?id=1199825

https://bugzilla.gnome.org/show_bug.cgi?id=751471
2015-06-26 21:52:45 -07:00
Jasper St. Pierre
2cbaa6660c backend-x11: Fix our awful hack for crossing events, too
For enter / leave events, which we use in the UI code, we need to make
sure that these coordinates are root-relative as well, otherwise the
cursor when entering frames might be incorrect.
2015-06-24 10:35:38 -07:00
Carlos Garnacho
82a7060cdb x11: Fix touch events on nested wayland
If we're running as a nested compositor, we must not attempt to
passive grab on the root window, and we should be setting the
touch event mask on the stage window.

https://bugzilla.gnome.org/show_bug.cgi?id=751036
2015-06-16 20:39:46 +02:00
Jasper St. Pierre
6aead0c67c backend-x11: Use a mode switch to determine whether we're nested or not
The "meta_is_wayland_compositor" checks were getting a bit difficult to read.
2015-06-16 08:13:13 -07:00
Jasper St. Pierre
9747277b7e Revert "input-settings-x11: Use xcb to change input settings"
This reverts commit 989f9630a4.

xcb is not smart enough to properly submit requests for
XIChangeProperty. Let's revert this until we can fix xcb.
2015-06-12 00:49:39 -04:00
Jasper St. Pierre
989f9630a4 input-settings-x11: Use xcb to change input settings
This way, we won't be hit with BadValue errors if we set it to a value
outside the X device's range. This can happen for touchpads without
two-finger scrolling, for instance.
2015-06-11 21:13:21 -04:00
Dave Airlie
9f65edd4f5 backend/x11: add support for setting randr 1.5 monitors
This interface allows us to propogate back the constructed
monitors to randr using the randr 1.5 protocol. Apps
should pick it up from there.
2015-06-01 09:38:13 -07:00
Dave Airlie
6a77d9722a backend: add output tile info retrieval.
this just adds backend support for retrieving the tile
information from X11 (randr 1.5) and native backends.

It stores the tiling information into the output struct.
2015-06-01 09:38:13 -07:00
Dave Airlie
ef296031cb backends/x11: add a flag to denote randr 1.5 is in use.
If the server reports randr 1.5, just cache the information
for later patches to use.
2015-06-01 09:38:13 -07:00
Jasper St. Pierre
4d80a4cc31 Use more g_autofoo throughout mutter 2015-05-29 17:18:35 -07:00
Jasper St. Pierre
95ad52ba58 xrandr: Fix copy/paste typo in connector type heuristics 2015-05-12 18:17:16 -07:00
Rui Matos
dac30a222e input-settings-x11: Honor default value for click method setting
Now that xf86-input-libinput exposes default values we can honor the
gsettings value.

https://bugzilla.gnome.org/show_bug.cgi?id=746290
2015-05-08 17:44:59 +02:00
Rui Matos
7d1b593fbd input-settings-x11: Factor out a get_property() helper
We'll need to get the value of some properties. Fail if the number of
items returned is less than we expect and warn if it exceeds it so
that we can easily find out if items are added to a property later and
fix it.
2015-05-08 17:44:57 +02:00
Jasper St. Pierre
c68e43a97f monitor-manager-xrandr: Set the underscan border properties, too 2015-04-27 17:23:56 -07:00
Tomeu Vizoso
cc53d48fa8 MonitorManager: Add support for overscan compensation
Some DRM drivers have added a consistent set of properties that
allow compensating for the overscan that some TVs do, without the
user being able to disable.
2015-04-27 17:17:15 -07:00
Ondrej Holy
3561b46fc6 backends/x11: Fix set_scroll_button
There is copy&pasted code in set_scroll_button, which is apparently
wrong, because it is trying to set scroll method instead of the scroll
button...

https://bugzilla.gnome.org/show_bug.cgi?id=747967
2015-04-17 10:50:33 +02:00
Carlos Garnacho
3a2920d4bc backends/x11: Implement set_click_method configuration option
https://bugzilla.gnome.org/show_bug.cgi?id=746290
2015-03-16 18:05:51 +01:00
Carlos Garnacho
af9d8f1931 backends/x11: Call meta_backend_update_last_device() from XI_DeviceChanged
On X11, calling this function on meta_display_handle_events() will not catch
mouse events happening over clients, so poke directly in the backend for
XI_DeviceChanged events, which mutter will get on device switches.

The code has been slightly refactored so we deal with XIEvents at a single
handle_input_event() function.

https://bugzilla.gnome.org/show_bug.cgi?id=712775
2015-03-13 21:01:11 +01:00
Rui Matos
3f2d658f20 monitor-manager: Expose MetaMonitorManager to introspection
This just exposes the type and the singleton getter necessary to make
it available to introspection. We'll expose more functionality as it
becomes needed.

https://bugzilla.gnome.org/show_bug.cgi?id=743745
2015-01-30 13:13:49 -05:00
Rui Matos
ad90b7dd2f monitor-manager: Initialize MetaOutput even when we can't get the EDID
Otherwise we'll crash later when building a MetaConfiguration.

https://bugzilla.gnome.org/show_bug.cgi?id=743412
2015-01-27 14:42:45 +01:00
Jasper St. Pierre
7e7c8ecbd4 backend-x11: Also spoof Enter/Leave notifies as well
So that we track when the user enters/exits the frame window
appropriately. This fixes a rogue cursor appearing when the window
doesn't define one.
2015-01-19 21:56:32 -08:00
Carlos Garnacho
3c06f2dc90 backends/x11: Implement X11-specific MetaInputSettings
This goes through modifying XI2 device properties, either common ones (eg.
set on every device) or those specific to the libinput X11 driver. Keyboard
repeat/rate are set through core and XKB APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=739397
2015-01-18 13:32:28 -08:00
Jasper St. Pierre
f083935c6e barrier: Fix type cast macros 2015-01-18 13:32:28 -08:00
Jasper St. Pierre
ef32bbdc99 x11/barrier: Fix build
We were missing the get_type() function.
2015-01-17 17:42:48 -08:00
Jonas Ådahl
5f91a62f6f barriers: Separate implementation from public API
This patch removes the X11 specific code from MetaBarrier and creates an
abstraction layer MetaBarrierImpl. The existing X11 implementation is
moved to a new GObject MetaBarrierImplX11 implementing the abstract
interface MetaBarrierImpl which is instantiated by MetaBarrier when
supported.

While at it, move it to backends/ and properly name the files.

https://bugzilla.gnome.org/show_bug.cgi?id=706655
2015-01-17 17:22:57 -08:00
Carlos Garnacho
625d3de2ee backends: Make KMS EDID information equal to X11's
EDID parsing has been refactored to a common meta_output_parse_edid()
function, which ensures the extracted information is the same on both KMS
and X11 backend, so it can be used consistently on eg. settings values.

https://bugzilla.gnome.org/show_bug.cgi?id=742882
2015-01-14 12:16:18 +01:00
Jasper St. Pierre
9c73e21113 xrandr: Remove mode fudge code for HSkew
This was part of a downstream patch that Endless has where we hid some
secret parameters inside the HSkew field. It wasn't meant as upstream
logic.
2015-01-08 15:04:50 -08:00
Jasper St. Pierre
34ba868b4c monitor-manager-xrandr: Fix a minor typo in an error message 2015-01-05 15:23:17 -08:00
Jasper St. Pierre
b9fb4a5887 backend: Use a GHashTable for device monitors
The array code has been tricky to maintain and leaky. Let's just use a
GHashTable to simplify our lives.
2014-12-31 08:53:57 -08:00
Jasper St. Pierre
d514e8ab41 monitor-manager: Add a connector-type property
This is so gnome-settings-daemon
2014-12-29 16:30:54 -08:00
Jasper St. Pierre
4450b5bb14 Revert "backends: Include Xfixes for cursor events and manipulation"
This reverts commit 34421e90c3.

These aren't needed at all.
2014-12-28 22:41:42 -08:00
Ikey Doherty
34421e90c3 backends: Include Xfixes for cursor events and manipulation
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=737463
2014-12-28 22:40:39 -08:00
Rui Matos
68542ae1ef Revert "monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify"
This reverts commit 47e339b46e. The
approach that was used to reduce the amount of work we do on RR events
to the necessary minimum is flawed. It assumes that, when the first
event we see where the retrieved XRRScreenResources.timestamp is
bigger than the previous, we already have all the data we need to
rebuild our view of the world.

That isn't true however, because the X server sends
RRScreenChangeNotify events for every step of the configuration
change, i.e. it lacks an atomic reconfiguration API. In particular, if
the X screen size is one of the changes, when we rebuild our state and
emit monitors-changed, the X screen size might still be the previous
one and since we stop updating ourselves until another reconfiguration
happens (noticed by looking at XRRScreenResources.timestamp) we end up
with the wrong idea of the X screen size.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-12-28 17:21:50 -08:00
Rui Matos
5a86286aba monitor-manager-xrandr: Set CRTC config even if it might be redundant
This optimization breaks our use of XRRScreenResources' timestamps to
detect hotplugs in case one of the outputs is disconnected and the
remaining ones don't need any mode, position or transform adjustments.

In that scenario, when applying the new configuration, we resize the X
screen but never call XRRSetCrtcConfig() and since XRRSetScreenSize()
doesn't take a timestamp and the X server doesn't update its last set
timestamp, when we next get a RRScreenChangeNotify and update
ourselves, XRRScreenResources.timestamp will still be smaller than
XRRScreenResources.configTimestamp which makes us think we're seeing a
new hotplug. We just don't enter an endless loop because the screen
size that we keep applying is always the same and the X server
short-circuits and stops sending us RRScreenChangeNotifys.

Always calling XRRSetCrtcConfig() ensures that the last set timestamp
will be bigger than configTimestamp in the next event and thus making
us trigger the monitors-changed signal properly.

Note that the X server already does basically the same checks that
we're removing here, so doing this shouldn't be a significant
efficiency loss. See

http://cgit.freedesktop.org/xorg/xserver/tree/randr/rrcrtc.c?h=server-1.16-branch#n539
2014-12-11 13:42:44 +01:00
Jonathon Jongsma
f6f5f624d4 monitor-manager: Add support for suggested position for outputs
In recent versions of the QXL driver, it may set "suggested X|Y" connector
properties. These properties are used to indicate the position at which
multiple displays should be aligned.  If all outputs have a suggested position,
the displays are arranged according to these positions, otherwise we fall back
to the default configuration.

At the moment, we trust that the driver has chosen sane values for the
suggested position.
2014-11-20 12:24:16 -06:00
Jonathon Jongsma
e72c6916aa xrandr: ignore hotplug_mode_update value
The important thing is whether this property exists or not, but the value
doesn't matter.
2014-11-05 11:58:34 -06:00
Jasper St. Pierre
90d6734f8c cursor-renderer-x11: Include Xfixes headers as well 2014-11-03 10:51:40 -08:00
Rui Matos
47e339b46e monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify
The X server sends several RRScreenChangeNotify events in a burst when
something happens which, currently, causes us to rebuild our view of
the world as many times and notify the upper layers about it which
causes a lot of bogus repeated work like rebuilding background actors.

We can avoid this extra work by looking at the timestamp in the
XRRScreenResources struct which is updated when an X client (including
us!) last changed something and comparing it with the previous
timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
016b8f5b4a monitor-manager-xrandr: Use CurrentTime when applying configurations
This is what the xrandr CLI tool does and will allow us to do less
work when we get RRScreenChangeNotify events.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
b3821c4f90 monitor-manager: Don't try to match the outputs on hotplug
meta_monitor_config_match_current() only matches the number of outputs
and if the output connector, vendor, product and serial match.

In the X backend, this means that we can't use it to bypass doing any
work because it won't detect cases where we actually want to update
ourselves like e.g. an output being turned off either by us or by
another X client (e.g. xrandr).

In the native backend, unlike the xrandr backend, we only get called
on real hotplug events and thus should always trigger the common
hotplug code to (possibly) apply a new mode so the check is pointless
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
29e5c6c363 monitor-manager-xrandr: Re-work xrandr event handling
In randr events, configTimestamp can be considered the hotplug time,
i.e. whenever the server notices hardware changes, this value will be
updated.

Having that in mind, we can re-work the logic to make it clearer.
There are no semantic changes.
2014-10-16 20:39:16 +02:00
Jasper St. Pierre
cc8462969d monitor-manager: Put the common hotplug code in a common path as well
So we can reuse it in the KMS backend.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
989bb6ebb1 monitor-manager: Simplify reading the current configuration
Make a wrapper in MetaMonitorManager that handles freeing the existing
configuration for us.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
1dbda68839 monitor-manager-xrandr: Refactor handle_xevent once more
Make the flow a bit clearer, and inline a method only used once.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
e7356917b0 meta-monitor-manager-xrandr: Simplify handle_xevent
The code here was a bit messy with the addition of
hotplug_mode_update, and the comments were a bit confusing and
inaccurate. Clean it up and comment it a bit better to make the flow and
intention more clear.
2014-10-03 15:12:00 -06:00
Rui Matos
478b75e803 backend-x11: Re-upload keymap when new keyboard devices are added
The X server applies a default keymap to hotplugged keyboard
devices. To enforce our current settings we must re-upload the keymap
when a new keyboard shows up.

Note that setting the VCK keymap causes the server to propagate it
to all slave keyboard devices.

https://bugzilla.gnome.org/show_bug.cgi?id=737673
2014-10-02 19:14:03 +02:00
Jasper St. Pierre
21bffe4aef monitor-manager-xrandr: Fix small leak for invalid properties
If the property is invalid, then we leak the allocated buffer. Make sure
to free it in this case.
2014-09-29 17:54:20 -06:00
Owen W. Taylor
602dd7fdf2 MetaBackendX11: Don't XResizeWindow behind clutter's back
In the case of a nested Wayland compositor inside an X session,
Clutter is managing the toplevel window size, so don't call
XResizeWindow on it - this will confuse Clutter and get the size
and the hints out of sync on the toplevel window.

https://bugzilla.gnome.org/show_bug.cgi?id=736279
2014-09-08 14:40:50 -04:00
Jasper St. Pierre
3ee09c6251 meta-monitor-xrandr: Assign a name to the mode
Based on a downstream Endless patch. They use this to show a proper mode
name to the users.
2014-08-23 08:54:06 -04:00
Jasper St. Pierre
35e0982e35 xrandr: Port some checks to XCB so we don't have to deal with BadName
RandR's QueryOutputProperty request makes the incredible decision of
throwing a BadName if you pass a property that doesn't exist, which
means that trying to check if a property exists is a royal pain when
using Xlib.

XCB's interface is much more friendly about errors and not having global
state and things like that, so use that instead to query our backlight
property.
2014-08-19 11:08:44 -04:00
Jasper St. Pierre
277df44cfb xrandr: Fix build
Gah, I keep forgetting to squash for some reason.
2014-08-18 18:01:04 -04:00
Jasper St. Pierre
2dded1e510 xrandr: Don't use RRQueryOutputProperty to fetch hotplug_mode_update
If the property doesn't exist, a BadName error will be generated. This
is a terrible API, but it's what we're stuck with. Use
RRGetOutputProperty instead.
2014-08-18 18:00:33 -04:00
Jasper St. Pierre
39f65f9f86 backend: Add a keymap-changed signal 2014-08-14 17:36:29 -04:00
Jasper St. Pierre
bda2d6d1ac backend-x11: Don't leak the keymap
meta_backend_get_keymap is supposed to return a static keymap, not a new
one every time. Cache it internally. We don't update it when the keymap
changes on the server, but we'll do this soon.
2014-08-14 17:35:49 -04:00
Jasper St. Pierre
467465c99c backend: Create the stage in the backend, rather than the compositor
This allows creating the stage much earlier than it otherwise would have
been. Our initialization sequence has always been a bit haphazard, with
first the MetaBackend created, then the MetaDisplay, and inside of that,
the MetaScreen and MetaCompositor.

Refactor this out so that the MetaBackend creates the Clutter
stage. Besides the clarity of early initialization, we now have much
easier access to the stage, allowing us to use it for things such as
key focus and beyond.
2014-08-13 20:08:46 -04:00
Rui Matos
101b215d6b backends: Add methods to handle keymaps
These methods allow us to set and get xkbcommon keymaps as well as
locking a specific layout in a layout group.

With this, we introduce dependencies on xkeyboard-config, xkbfile,
xkbcommon-x11 and a libX11 new enough to have xcb support.

https://bugzilla.gnome.org/show_bug.cgi?id=734301
2014-08-07 11:24:24 +02:00
Jasper St. Pierre
4b5a503cee backend-x11: Make sure to not crash during initialization
Sometimes we can get a host event without having the display up and
running yet. Just don't pass it to the compositor in that case, since it
won't be possible for it to have any event that matters.
2014-07-27 16:14:46 +02:00
Adel Gadllah
6ee5a1437c x11: Move event filter to backend connection 2014-07-19 18:51:26 +02:00
Adel Gadllah
029673d0ee Revert "backend-x11: Take the touch grab on the stage window"
This reverts commit 3b85e4b2b9.

This breaks touch support; reverting would break wayland
(is what this patch tried to fix; we should find a better solution
that works on both).
2014-07-17 17:18:08 +02:00
Jasper St. Pierre
3b85e4b2b9 backend-x11: Take the touch grab on the stage window
So we don't get assert fails when touching the screen on mutter nested.
2014-07-14 17:24:31 -04:00
Jasper St. Pierre
55354f5c38 Take the touch grab in MetaBackendX11
This means that it won't trigger when we're running as a Wayland
compositor, which will cause a few warnings and possibly more
brokenness.
2014-07-14 09:41:10 -04:00
Jasper St. Pierre
eb952819c2 monitor: Don't use wl_output_transform in our APIs
Invent our own API so we can build without Wayland headers.
2014-07-13 11:35:01 -04:00
Carlos Garnacho
704cae1de3 backend: Use the most recent event time on replayed touch events
When a touch sequence is passively grabbed and later rejected, events
will be replayed on the next client in propagation order, although those
events (either transformed to pointer events or not) will contain the
original timestamps, this will make grabs fail with InvalidTime if triggered
from the replayed ButtonPress/TouchBegin handler.

In order to work around this, store the most recent event time (presumably
gotten from the XI_TouchEnd caused by the passive grab being rejected), and
use that time on the events being replayed afterwards and grabs, so we don't
possibly fail with InvalidTime if those events result in a compositor grab.
2014-07-08 11:21:29 -04:00
Carlos Garnacho
faf55c4627 backend-x11: Ensure touch event coordinates are translated to the stage's
Now that those events are going to be received, coordinates translation
should also happen on those.
2014-07-07 19:17:03 -04:00
Carlos Garnacho
f351c5d304 backend-x11: Remove pointless goto
The function is not as complex as needing that, plus it always jumped
anytime bypass_clutter is TRUE, so make all conditional code depend on
that.
2014-07-07 19:15:48 -04:00
Jasper St. Pierre
63bca17ab6 backend-x11: Only spoof the event when we're passing it to Clutter
There's no need to do so otherwise.
2014-07-07 19:13:31 -04:00
Jasper St. Pierre
af135c0b0b monitor-manager: Rename output_id to winsys_id
The output_id is more of an opaque identifier for the monitor, based on
its underlying ID from the windowing system. Since we also use the term
"output_id" for the output's index, rename our use of the opaque cookie
"output_id" to "winsys_id".
2014-07-01 13:24:34 -04:00
Jasper St. Pierre
b704659899 backend: Add an XIWarpPointer wrapper
This makes Alt+F7 / Alt+F8 work respectively under X11 nested mode.
For the native backend implementation, we'll need a special Clutter
function, so don't implement that for now.
2014-05-27 14:28:35 -04:00
Jasper St. Pierre
47b3336ffa monitor-manager-xrandr: Make sure to XFlush the XUngrabServer
Otherwise, the server may not receive our request, meaning that
we'll hang onto the server grab forever.
2014-05-22 17:39:46 -04:00
Jasper St. Pierre
480a853263 x11: Add simple cursor renderer 2014-05-17 13:27:16 -04:00
Jasper St. Pierre
c8f3820956 backend-x11: Always pass None for the cursor
This means we fall back to what's defined on the root window, which
will give us our properly set cursor.
2014-05-13 16:20:03 -04:00
Jasper St. Pierre
25a16c3379 Remove trailing whitespace 2014-05-02 09:34:48 -04:00
Jasper St. Pierre
9607513e62 backend-x11: Fix cursor position under nested 2014-04-28 13:29:45 -04:00
Jasper St. Pierre
18730f2a5e backend-x11: Take grabs on the stage window
This means that grabs will be reported with respect to the
stage window, and that our event coordinates will be more
correct under nested.
2014-04-28 13:29:31 -04:00
Jasper St. Pierre
c5d4f4a245 backend-x11: Split out event translation to another method
Keep the indentation from getting too hairy.
2014-04-24 12:12:54 -04:00
Jasper St. Pierre
a027937ccc backend-x11: Set the proper coordinates on the spoofed device event
When we click on a window with a passive grab, then the event_x
and event_y will be relative to that window, instead of relative to
the stage, which means that picking will be wrong.

Forcibly using root_x / root_y breaks nested mode. Nested mode is
a testing mode that should be replaced by a DRI3-enabled Xephyr,
though. It's getting too hairy to support properly.
2014-04-24 12:12:54 -04:00
Jasper St. Pierre
01a773ed5a backend-x11: Don't use clutter_stage_get_default
It turns out Clutter doesn't actually set the stage as the default
when creating a new one, so this creates a new stage that then dies.
2014-04-23 16:01:02 -04:00
Jasper St. Pierre
97074ccdad backend-x11: Fix leak of the event data 2014-04-23 15:43:34 -04:00
Jasper St. Pierre
6111bb9dec backend-x11: Adapt a consistent naming scheme for the event struct 2014-04-23 15:43:34 -04:00
Jasper St. Pierre
e9eb3c32a9 compositor: Move event spoofing code to MetaBackendX11
This is now where we handle device events.
2014-04-23 14:23:13 -04:00
Jasper St. Pierre
fdd43fc2d9 backend-x11: Add KeyPress / KeyRelease to mask 2014-04-23 14:23:12 -04:00
Jasper St. Pierre
4cbf420b4b idle-monitor-xsync: Clean up includes
Conflicts:
	src/backends/x11/meta-idle-monitor-xsync.c
2014-04-23 13:27:11 -04:00
Jasper St. Pierre
fd373948d2 idle-monitor-xsync: Retrieve your xdisplay from the backend 2014-04-23 13:27:11 -04:00
Jasper St. Pierre
1dc8a7eca3 monitor: Remove handle_xevent as a generic method 2014-04-23 12:15:12 -04:00
Jasper St. Pierre
861cfc23df x11: Make sure to handle RANDR events from the right connection 2014-04-23 12:15:12 -04:00
Jasper St. Pierre
86368e7e07 backend: Add grab_device / ungrab_device
This makes sure that we take active grabs on the correct connection.
Passive grabs are still broken.
2014-04-23 12:15:12 -04:00
Jasper St. Pierre
6c743dad88 xrandr: Rewrite to be based on the X11 display connection 2014-04-23 10:24:26 -04:00
Jasper St. Pierre
28666da6a1 backend-x11: Simplify XSync initialization handling a bit 2014-04-22 14:17:08 -04:00
Jasper St. Pierre
3d091e514d backend: Poll events from the host X11 server ourselves
I was accidentally pulling events from the Xwayland server under
nested for the idle monitor, which is wrong. Whoops.
2014-04-22 10:26:03 -04:00
Jasper St. Pierre
c44b1d730d backends: Move MonitorManager creation to MetaBackend as well 2014-04-21 20:25:21 -04:00
Jasper St. Pierre
48dc544bef backends: Move most of the code from meta_backend_init into the subclasses 2014-04-21 20:25:21 -04:00
Jasper St. Pierre
31d744195d backends: Build MetaBackend subclasses for each backend 2014-04-21 20:25:21 -04:00
Jasper St. Pierre
00ea9bf14b backends: Start on an initial MetaBackend object
This isn't great so far -- all we did is put the idle monitors here
instead. We'll soon have separate backend subclasses for the two
backends.
2014-04-21 20:25:21 -04:00
Jasper St. Pierre
f3ee9be4cb idle-monitor: Use the XSync idle monitor under X11 nested 2014-04-21 20:25:20 -04:00
Bastien Nocera
d53e04f4c8 Name all timeouts and idles
Better names can be used once we make more use of them.

https://bugzilla.gnome.org/show_bug.cgi?id=727979
2014-04-10 18:59:46 +02:00
Colin Guthrie
c2b9155979 MonitorXrandr: Mask a BadValue error on VirtualBox.
https://bugzilla.gnome.org/show_bug.cgi?id=707563
2014-04-09 12:19:11 -07:00
Robert Ancell
f68d65a5ae xrandr: Use specified output property name for backlight control
Backlight controls are set using the "BACKLIGHT" XRANDR output property.
This should be "Backlight" according to the XRANDR spec [1].

Some drivers (Intel) export both properties and some only the specified property (nvidia).
Users of drivers that only export the specified property cannot change their backlight using XRANDR.

[1] http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt section 9.1

https://bugzilla.gnome.org/show_bug.cgi?id=723606
2014-04-09 12:17:58 -07:00
Jasper St. Pierre
bce1d5117b Start creating different subdirectories for each backend 2014-03-31 23:44:47 -04:00