1
0
Fork 0
Commit graph

246 commits

Author SHA1 Message Date
Jonas Ådahl
f950380202 monitor-manager-xrandr: Use G_DECLARE_FINAL_TYPE macro
Declare the MetaMonitorManagerXrandr type using the helper macro,
instead of manually.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
ab04286c6b monitor-manager/x11: Don't complain about 'normal' transform
The 'normal' transform has the value 0, so the g_warn_if_fail()
expression failed. Correct it so that it doesn't complain when no
transform is checked.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
e8a62861c9 Remove old monitor configuration system
Remove the old MetaMonitorConfig system and mark the new one as
non-experimental. This also removes the D-Bus property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:53 +08:00
Jonas Ådahl
9ac87b36c1 monitor-manager/xrandr: Fix name inconsistencies
MetaOutputs should be "output" and external types should be named as
such, i.e. XRandr outputs are renamed to "xrandr_output".

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:30 +08:00
freeroot
12792f99a0 Add tag-and-drag setting from libinput into mutter
The problem is that libinput offers the possibility to not enabled
dragging when tap-to-click is enabled but mutter doesn't. For people who
have a sensitive touchpad and who like tap-to-click option, dragging is
launched even when you don't want it : for example, when you select a
folder, most of the time the folder is dragging whereas just selected or
when you want to select some lines of a text file, several lines are
moved as a cut-paste which is not expected and erase datas.

To fix it, you need to have the possibility to desactivate the drag
option when you use tap-to-click in mutter. Because it's already a
specification of libinput, it remains to add it to mutter.
Implementation with X11 is added too.

https://bugzilla.gnome.org/show_bug.cgi?id=775755
2017-08-20 09:27:28 +08:00
Jonas Ådahl
b2a530b326 DisplayConfig: Make supported scales per mode
This changes the API to pass supported scales per mode instead of
providing a global list. This allows for more flexible scaling
scenarious, where a scale compatible with one mode can still be made
available even though another mode is incompatible.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
10b0351a59 Add support for rudimentary fractional scaling
When the logical layout mode is used, allow configuring the scaling to
be non-integer. Supported scales are so far hard coded to include at
most 1, 1.5 and 2, and scales that doesn't result in non-fractional
logical monitor sizes are discarded.

Wayland outputs are set to have scale ceil(actual_scale) meaning well
behaving Wayland clients will provide buffers with buffer scale 2, thus
being scaled down to the fractional scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b64c69e4bc logical-monitor: Make scale a float
To support fractional scaling, the logical monitor scale must be stored
as a float. No other functional changes is part of this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
c2e49f1bb5 clutter: Change stage view scale to be float
To support fractional scaling, change the stage view scale to be a
float instead of an int. Also change the places where it is retrieved
and used when scaling things.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Carlos Garnacho
10b30eaba5 backend: Set mapping-mode on X11 pen/eraser devices
And use it in the generic code for the checks about whether mapping to
an specific display applies or not.

https://bugzilla.gnome.org/show_bug.cgi?id=784402
2017-07-12 23:43:23 +02:00
Jason Gerecke
74882b2502 backends/x11: Account for non-zero device origin when setting tablet area
Wacom's display tablets typically do not have (0,0) coincident with the top
left corner of the screen. This "outbound" area must be taken into account
when setting the area or else an unexpected offset of the pointer will
occur.

https://bugzilla.gnome.org/show_bug.cgi?id=784009
2017-07-03 13:49:14 +02:00
Carlos Garnacho
d23275bc76 backends/x11: Handle left-handed mode on pen/eraser devices correctly
Due to the pen/eraser device separation in X11, CLUTTER_TABLET_DEVICE does
not apply there, this device type is only used in native/evdev. Checking
for CLUTTER_PEN/ERASER_DEVICE makes the left-handed mode correctly applied
on tablets.

https://bugzilla.gnome.org/show_bug.cgi?id=782027
2017-06-20 22:02:04 +02:00
Carlos Garnacho
48e820235e backends/x11: Fix c&p issue in tablet area calculation
instead of filling in the last array value, it overwrote the previous one.

https://bugzilla.gnome.org/show_bug.cgi?id=781703
2017-06-20 22:02:04 +02:00
Ikey Doherty
e9c9ee844c backends/x11: Ensure reply is initialised to NULL 2017-05-31 19:15:39 -04:00
Jonas Ådahl
1bb0e18042 monitor-manager/xrandr: Allow configuring scales on X11 too
This commit makes it possible to configure logical monitor scale also
when running on top of an X11 server using Xrandr. An extra property
'requires-globla-scale' is added to the D-Bus API is added to instruct
a configuration application to only allow setting a global logical
monitor scale.

This is needed to let gsd-xsettings use the configured state to set a
XSettings state that respects the explicit monitor configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
df39a7d0fd monitor-manager/xrandr: Use xcb API to configure CRTC
Use xcb-randr instead of libXrandr to set the CRTC configuration. This
is needed because data from the reply will later be used.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Evan Welsh
76198e0b3b Implements disable-while-typing in mutter.
Disable-while-typing disables the touchpad while the user is typing.

This patch introduces the necessary backend code to implement the
org.gnome.desktop.peripherals.touchpad.disable-while-typing setting of
gsettings-desktop-schemas which was implemented in commit
4c5b1c1df399d6afaaccb237e299ccd1d5d29ddd and released as part of 3.24.
This is known as dwt in libinput.

This patch has been tested on X11 and Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=764852
2017-05-24 11:56:54 +08:00
Jonas Ådahl
81e99c2680 input-settings: Minor structural cleanup
Let the backend implementations create their own input settings
backend, as is done with other backend specific special purpose
backends. Also use the macro for declaring the GType.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +08:00
Jonas Ådahl
9787b1cfd5 backends/x11/nested: Emulate per CRTC drawing
Make the nested backend emulate how the real backends actually draw,
i.e. by drawing each CRTC separately. This makes it possible to test
different configuration paths that can take place on different
hardware, without having said hardware.

For example, by setting MUTTER_DEBUG_TILED_DUMMY_MONITORS and
MUTTER_DEBUG_NESTED_OFFSCREEN_TRANSFORM to "1", one can test a system
with MST (tiled) monitors where the GPU doesn't support some transform.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
93c6a869ec x11/nested: Always draw to an offscreen framebuffer
Always draw the stage to an offscreen framebuffer when using the nested
backend, so that we more emulate things more similarly to how it works
real-world, i.e. it'll work the way whether stage views are enabled or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
9d914091f5 stage-x11-nested: Remove unused field
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
d38c4c1f2d logical-monitor: Track whether the logical monitor is transformed
Keep track of the logical monitor transform. When a logical monitor is
transformed, all of its monitors are also transformed in the same way.
A logical monitor can either be transformed on the CRTC level, or using
an offscreen intermediate buffer. In both cases will the logical
monitor be transformed, but only in the latter will the view be
transformed.

MetaCrtcs::transform currently does not represent whether the CRTC is
configured to be transformed or not; only when the backend can handle
it does it correctly correspond to the actual CRTC configuration. This
is intended to change with MetaMonitorConfigManager.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
2091df3856 renderer-x11: Split up into CM and Nested renderers
Split up the MetaRendererX11 class into one for when running as a
X11 compositing manager, and one for when running as a nested Wayland
compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
8163ca6821 Add support for scaled logical monitor framebuffers
This commit adds support for rendering onto enlarged per logical
monitor framebuffers, using the scaled clutter stage views, for HiDPI
enabled logical monitors.

This works by scaling the mode of the monitors in a logical monitors by
the scale, no longer relying on scaling the window actors and window
geometry for making windows have the correct size on HiDPI monitors.

It is disabled by default, as in automatically created configurations
will still use the old mode. This is partly because Xwayland clients
will not yet work good enough to make it feasible.

To enable, add the 'scale-monitor-framebuffer' keyword to the
org.gnome.mutter.experimental-features gsettings array.

It is still possible to specify the mode via the new D-Bus API, which
has been adapted.

The adaptations to the D-Bus API means the caller need to be aware of
how to position logical monitors on the stage grid. This depends on the
'layout-mode' property that is used (see the DisplayConfig D-Bus
documentation).

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
f25f14351c monitor-manager: Make max screen size optional
Make the concept of maximum screen size optional, as it is not
necessarily a thing on all systems (e.g. when using the native backend
and stage views).

The meta_monitor_monitor_get_limits() function is replaced by a
meta_monitor_manager_get_max_screen_size() which fails when no screen
limit is available. Callers and other users of the previous max screen
size fields are updated to deal with the fact that the limit is
optional.

The new D-Bus API is changed to move it to the properties bag, where
its absence means there is no applicable limit.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
691e7951ea DisplayConfig: Add new API for configuring monitors
Add a new D-Bus API that uses the state from GetCurrentState to
configure high level monitors, instead of low level CRTCs and
connectors. So far persistent configuration is not implemented, as
writing to the configuration store is still not supported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
d050fdb17f monitor-manager: Add per backend capabilities
Add a private API for querying backend capabilities. For now, only
mirroring capability is reported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
9e8ee491e6 monitor-manager: Add API to get scales supported by the backend
For the Xrandr backend, only scale 1 is supported, for the others, 1
and 2 are reported as supported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
fcc0288f0c monitor-manager: Let the backends handle no configuration
Let the backends decide whether to just rebuild a derived state, or use
the NULL config to rebuild an empty logical state.

This also changes the expected screen size values of the no-outputs
test; as this case is actually handled now.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
a393a614a1 monitor-manager: Remove 'scale' from MetaOutput
Replace the 'scale' of an output with a vfunc on the MetaMonitorManager
class that takes a monitor and a monitor mode which calculates the
scale. On X11 this always returns 1, on KMS, the old formula is used.
On the dummy and test backends, the already configured values are
returned.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:46 +08:00
Jonas Ådahl
ac813d5285 x11: Use EGL instead of GLX when drawing using GLES
When running as a X11 CM we shouldn't use the GLX winsys when the
driver doesn't support it, i.e. OpenGL ES drivers.

https://bugzilla.gnome.org/show_bug.cgi?id=771636
2017-03-25 00:17:18 +08:00
Jonas Ådahl
cdedd017d6 input-settings: Use logical monitors instead of outputs
A MetaOutput is a connector, not exactly a monitor or a region on the
stage; for example tiled monitors are split up into multiple outputs,
and for what is used in input settings, that makes no sense. Change
this to use logical monitors instead of outputs.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
a48c9d6cd9 input-settings: Don't use screen limits when keeping aspect ratio
When no output was specified, the screen limit was used to calculate the
aspect ratio. The screen limit, however, is either just an arbitrary
number if no screen limit is applicable, or a hardware graphics buffer
limit, which has nothing to do with anything actually displayed. Change
it to use the screen size instead, to get something that makes more
sense when no output is found.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
1039386e10 backend/x11/nested: Enable emulating offscreen transform framebuffer
Enable the usage of an offscreen transform texture, as used in the
native backend when the GPU doesn't support the transform configured.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
944339f6a5 monitor-manager: Expose whether the backend handles a transform
Expose via a new API whether the transform on a logical monitor is
handled by the backend. This was previously only exposed only in the
native backend. This will be used to emulate not supporting transforms
in the backend in the nested backend.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
e20e60783a tests: Make test backend inherit MetaBackendX11Nested
The test backend must inherit the nested backend, as MetaBackendX11 is
not complete.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Hyungwon Hwang
5fafaf92df dnd: Implement MetaDnd
Implement MetaDnd for emitting DnD signals to plugins such as gnome-shell. The
xdnd handling code comes from gnome-shell, and it is hidden behind MetaDnd now.

https://bugzilla.gnome.org/show_bug.cgi?id=765003
2017-03-07 08:28:36 +08:00
Jonas Ådahl
4e4b24e7a8 backends/x11: Fallback to the first logical monitor when out of focus
When running nested, the pointer can be outside of the stage, meaning
outside of any logical monitor. Handle this when getting the current
logical monitor by falling back to the first logical monitor when the
pointer coordinate is outside of any logical monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=779001
2017-03-06 22:39:03 +08:00
Owen W. Taylor
383ba566bd Call cogl_xlib_renderer_set_threaded_swap_wait_enabled()
Set up things so that if the INTEL_swap_event extension is not present,
but the driver is known to have good thread support, we use an extra
thread and call glXWaitVideoSync() in the thread. This allows idles
to work properly, even when Mutter is constantly redrawing new frames;
otherwise, without INTEL_swap_event, we'll just block in glXSwapBuffers().

https://bugzilla.gnome.org/show_bug.cgi?id=779039
2017-02-21 16:25:02 -05:00
Rui Matos
90923903ae MetaInputSettings: allow edge scrolling without 2fg capable devices
We should only force edge scrolling off if two finger is enabled *and*
we actually have two finger capable devices.

https://bugzilla.gnome.org/show_bug.cgi?id=778554
2017-02-16 16:49:44 +01:00
Jonas Ådahl
bd2ca79a48 backends/x11: Only apply keymap when not running nested
https://bugzilla.gnome.org/show_bug.cgi?id=777800
2017-02-15 14:04:16 +08:00
Jonas Ådahl
6d64123849 backends/x11: Split up X11 backend into Cm and Nested
Split up the X11 backend into two parts, one for running as a
Compositing Manager, and one for running as a nested Wayland
compositor.

This commit also cleans up the compositor configuration calculation,
attempting to make it more approachable.

https://bugzilla.gnome.org/show_bug.cgi?id=777800
2017-02-15 14:04:16 +08:00
Jonas Ådahl
644ee666f6 Introduce new monitor configuration system
The new monitor configuration system (MetaMonitorConfigManager) aims to
replace the current MetaMonitorConfig. The main difference between the
two is that MetaMonitorConfigManager works with higher level input
(MetaMonitor, MetaMonitorMode) instead of directly looking at the CRTC
and connector state. It still produces CRTC and connector configuration
later applied by the respective backends.

Other difference the new system aims to introduce is that the
configuration system doesn't manipulate the monitor manager state; that
responsibility is left for the monitor manager to handle (it only
manages configuration and creates CRTC/connector assignments, it
doesn't apply anything).

The new configuration system allows backends to not rely on deriving the
current configuration from the CRTC/connector state, as this may no longer be
possible (i.e. when using KMS and multiple framebuffers).

The MetaMonitorConfigManager system is so far disabled by default, as
it does not yet have all the features of the old system, but eventually
it will replace MetaMonitorConfig which will at that point be removed.
This will make it possible to remove old hacks introduced due to
limitations in the old system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
ee0677a021 monitor-manager: Let backend implementations handle inital config
How the initial configuration is done depends on the backend, so let
them do it themself.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
c041851fa5 monitor-manager: Rename read_current_config to read_current_state
The function meta_monitor_manager_read_current_config() was renamed to
meta_monitor_manager_read_current_state() as it does not read any
configuration, but reads the current state as described by the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
78799e58d2 monitor-manager: Make tiled Xrandr monitors based on monitors
Don't deal with adding/removing tiled Xrandr monitors in the generic
backend, but leave it to the Xrandr backend. The tiled monitor will
itself notify the backend when such a monitor is added and removed.

Tiled Xrandr monitors are now based no MetaMonitor instead of
MetaLogicalMonitor. This means that mirrored tiled monitors will now be
represented correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
4e812410cc monitor-manager: Move logical monitor into its own file
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
0873e3812b backends: Rename MetaMonitorMode to MetaCrtcMode
The MetaMonitorMode referred to the mode of a CRTC, and with the future
introduction of a MetaMonitor, theh old name would be confusing.
Instead call it what it is.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
1650c35e38 monitor-manager: Rename MetaCRTC(Info) to MetaCrtc(Info)
Change to follow the naming convention used everywhere else. This means
changing CRTC to Crtc even though it is an abbreviation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
d188949101 backends/x11: Make the X11 backend derivable
Make the X11 backend derivable so that we can base a nested test backend
on it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
5a8509f895 Move current logical monitor retrieval to the backends
The method used for getting the current logical monitor (the monitor
where the pointer cursor is currently at) depends on the backend type,
so move that logic to the corresponding backends.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
f5b2d79f3b backends: Use macros for declaring the backend types
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
d644993a74 MetaBackend: Move fields from MetaBackend into MetaBackendPrivate
Lets prepare for being able to declare the MetaBackend type using
the macro helper.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
842ff5d6aa Rename MetaMonitorInfo MetaLogicalMonitor
In preparation for further refactorizations, rename the MetaMonitorInfo
struct to MetaLogicalMonitor. Eventually, part of MetaLogicalMonitor
will be split into a MetaMonitor type.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Rui Matos
925b1aec64 meta-input-settings-x11: Don't try setting unavailable scroll methods
Since doing so causes BadValue X errors.

https://bugzilla.gnome.org/show_bug.cgi?id=771744
2016-11-16 13:50:33 +01:00
Carlos Garnacho
ff9753688f backends/x11: Implement tablet settings based on the Wacom driver
This is a stopgap solution until libinput is the fallback driver
handling tablets and pads.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Rui Matos
2641b364e8 MetaInputSettings: fix two finger preference over edge scrolling logic
Enabling edge scrolling before disabling two finger would result in
edge scrolling not actually being enabled because two finger is still
enabled at the time and we bail out.

This patch moves this logic to common code for both the native and X
backends and fixes it by ensuring that both settings are never set at
the same time and still re-checking if edge scrolling should be
enabled after two finger scrolling gets disabled.

We also simplify the code by not checking for supported/available
settings since the underlying devices will just reject those values
and there isn't anything we can do about it here. It's the UI's job to
only show supported/available settings to users.

https://bugzilla.gnome.org/show_bug.cgi?id=771744
2016-11-02 14:07:13 +01: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
9b4e8695f3 MetaRendererX11: Allocate offscreen framebuffers up front
Allocate the offscreen stage view framebuffers up front; otherwise they
may get allocated after the viewport calculated by the stage is set,
which would cause the viewport to be incorrect until recalculated.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:20:55 +08:00
Jonas Ådahl
cc4a65fe94 x11/nested: Only paint monitor stage views when enabled
Only paint the per monitor stage views when enabled, otherwise bad
things happen.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:19:24 +08:00
Jonas Ådahl
23c4ac6c7f settings: Support mouse and trackball accel profile
Support changing the mouse and trackball acceleration profile. This
makes it possible to for example disable pointer acceleration by
choosing the 'flat' profile.

This adds an optional dependency on gudev. Gudev is used by the X11
backend to detect whether a device is a mouse or not. Without gudev
support, the accel profile settings has have effect for mouse devices.

Trackball still uses the "strstr" approach, since udev doesn't support
tagging devices as trackball devices yet.

https://bugzilla.gnome.org/show_bug.cgi?id=769179
2016-07-28 20:13:08 +08:00
Bastien Nocera
cfe5d7429a backends/x11: Add enum for scroll methods
This way the "libinput Scroll Method Enabled" property manipulation
is made clearer.
2016-07-27 19:42:14 +02:00
Bastien Nocera
36cd7177fd backends: Re-add support for edge scrolling with some touchpads
Add support for setting edge-scrolling separately from two-finger
scrolling. We now have 2 separate boolean settings for those, with the
Mouse panel in gnome-control-center allowing to set only one of those at
a time, but nothing precludes both being set in the configuration.

We need to handle:
- two-finger-scrolling-enabled and edge-scrolling-enabled settings both
  being set.
- those 2 settings being change out-of-order
- two-finger-scrolling being set on a device that doesn't support it
- edge-scrolling-enabled on a device that doesn't support it

And the combinations of one touchpad supporting just one of edge
scrolling and two-finger scrolling and another vice-versa.

https://bugzilla.gnome.org/show_bug.cgi?id=768245
2016-07-27 17:17:25 +02:00
Carlos Garnacho
220ac7c8f2 backends: Add empty stubs for tablet configuration
Those will be called when configuring tablets.
2016-07-22 13:31:09 +02:00
Rui Matos
daf5a112fb meta/boxes: typedef cairo_rectangle_int_t MetaRectangle
They are already effectively interchangeable so this should reduce
pointless casts.

Just like in GDK though, we need to keep the old definition for
instrospection to be able to include the struct's fields.
2016-07-20 14:11:25 +02:00
Jonas Ådahl
566c28bdaf Introduce regional stage rendering
Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
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