1
0
Fork 0
Commit graph

116 commits

Author SHA1 Message Date
Robert Mader
92375c75f8 cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7 where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Jonas Ådahl
23fa59b77c display: Move finishing of touch sequence to the backend
We need to manipulate an X11 grab when a touch sequence ends; move that
logic to where it belongs - in the X11 backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
2019-10-28 18:40:43 +00:00
Georges Basile Stavracas Neto
160cc9182d Replace ClutterPoint by graphene_point_t
Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Carlos Garnacho
2b519cba36 backends: Move numlock persistence handling here
We used to have wayland-specific paths for this in src/wayland, now we
have ClutterKeymap that we can rely on in order to do state tracking,
and can do this all on src/backend domain.

This accomodates the feature in common code, so will work on both
Wayland and X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 18:24:57 +02:00
Jonas Ådahl
5c500ad402 backend: Move GPU ownership from the monitor manager to the backend
Lets work towards making MetaMonitorManager about managing monitors, and
not about managing GPUs. This changes other units to keep a pointer to
the backend instead of a monitor manager, in case their ownership
changed, or their main usage of the monitor manager was to look up GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Georges Basile Stavracas Neto
57945a730f
backend: Conditionally compile MetaProfiler
MetaProfiler is not built when -Dprofiler=false, and that
breaks the build since MetaBackend unconditionally imports
and uses it.

Fix that by wrapping MetaProfiler in compile-time checks.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/603
2019-05-31 12:54:13 -03:00
Georges Basile Stavracas Neto
17c5436f6e
profile: Add a Sysprof-based profiler
This exposes the /org/gnome/Sysprof3/Profiler object
inside Mutter to allow initiating a Sysprof capture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:07 -03:00
Jonas Ådahl
88e4ff7409 backend: Add API to freeze/thaw frame clock
It's just a thin wrapper around the ClutterStage API, with the intention
to hide the awkward nest of interdependent backends.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
Jonas Ådahl
3cc3b7526c renderer-native: Fake page flipping slower when power saving
We rely on the frame clock to compress input events, thus if the frame
clock stops, input events are not dispatched. At the same time, there
is no reason to redraw at a full frame rate, as nothing will be
presented anyway, so slow down to 10Hz (compared to the most common
60Hz). Note that we'll only actually reach 10Hz if there is an active
animation being displayed, which won't happen e.g. if there is a screen
shield in the way.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
Jonas Ådahl
0da0207eed screen-cast: Add getters to fetch object owners
MetaBackend owns MetaScreenCast which owns MetaScreenCastSession which
owns MetaScreenCastStream. Make it possible to fetch objects in the
oppositev direction too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Niels De Graef
0478c225b7 Add some gtk-doc comments. 2019-01-06 21:57:16 +01:00
Jonas Ådahl
25c53b2fb2 backend: Freeze frame clock when headless
Don't schedule redraws when being headless; there is nothing to draw so
don't attempt to draw. This also makes a flaky test become non-flaky, as
it previously spuriously got warnings due to windows being "painted"
when headless but lacking frame timings, as nothing was actually
painted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/170
2018-11-09 11:16:30 +01:00
Jonas Ådahl
f139360569 Make it possible to build without GLX support 2018-11-06 17:17:36 +01:00
Jonas Ådahl
2f4a68c8c3 Clean up include macros mess
The order and way include macros were structured was chaotic, with no
real common thread between files. Try to tidy up the mess with some
common scheme, to make things look less messy.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
5f37369adb Add remote access controller API
Add API to let GNOME Shell have the ability to get notified about remote
access sessions (remote desktop, remote control and screen cast), and
with a way to close them.

This is done by adding an abstraction above the remote desktop and
screen cast session objects, to avoid exposing their objects to outside
of mutter. Doing that would result in external parts holding references
to the objects, complicating their lifetimes. By using separate wrapper
objects, we avoid this issue all together.
2018-07-20 16:49:49 +02:00
Bastien Nocera
fa9e330f2c backend: Remove direct upower-glib usage
Monitor whether UPower is running ourselves. That allows us to keep the
same value for "lid-is-closed" throughout the process of UPower
restarting, preventing unwanted monitor re-configuration through the process.

Fixes another screen black out when UPower restarts and the laptop lid
is closed.
2018-07-18 10:17:37 +00:00
Bastien Nocera
951219650f backend: Move lid-is-closed handling to MetaBackend
Rather than handle UpClient in both MetaBackend (to reset the idletime
when the lid is opened), and in MetaMonitorManager and
MetaMonitorConfigManager (to turn the screen under the lid on/off
depending on its status), move the ability to get the lid status from
UPower or mock it in one place, in MetaBackend.
2018-07-18 10:17:36 +00:00
Jonas Ådahl
d5203f170e Make screen cast and remote desktop non-experimental
It's time to make this feature more accessible by not requiring editing
an array in gsettings.
2018-06-07 12:57:51 +00:00
Florian Müllner
7655e09d00 build: Introspect some more types
While MetaStage, MetaWindowGroup and MetaDBusDisplayConfigSkeleton don't
appear explicitly in the public API, their gtypes are still exposed via
meta_get_stage_for_screen(), meta_get_*window_group_for_screen() and
MetaMonitorManager's parent type. Newer versions of gjs will warn about
undefined properties if it encounters a gtype without introspection
information, so expose those types to shut up the warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2018-05-07 21:44:47 +02:00
Mario Sanchez Prada
3bbff94878 backend: Don't center the pointers on monitor changes
As a follow up to the patch from a95cbd0a, we need to make sure
that the pointer is out of the way as well when monitors changed,
since that's the event that will prevail in some cases. Besides,
this is also consistent with what the code before a95cbd0a was,
which initialized the pointer position in the same way both in
this case and in the real_post_init() function.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/157
2018-04-24 21:58:38 +01:00
Mario Sanchez Prada
a95cbd0aca backends: Don't center the pointer on initialization
Centering the pointer at startup causes undesired behaviour if
it ends up hovering over reactive elements, that might react
to that positioning, causing confusion. This is the case of
the login dialog when a list of different users is shown, as
centering the pointer at startup in that case will get the
user in the center of the screen pre-selected, which is not
the expected behaviour (i.e. pre-selecting the first one).

Fix this by simply moving the pointer out of the way, close
to the bottom-right corner, during initialization.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/157
2018-04-18 19:14:26 +00:00
Bastien Nocera
657417a578 backend: Reset idle when lid is opened or resuming from suspend
There's no particular reason for this code to only ever be triggered on
Wayland, and allows removing X11-specific work-arounds from
gnome-settings-daemon.

See https://bugs.freedesktop.org/show_bug.cgi?id=59576

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Bastien Nocera
7945ee5beb backends: Remove X11 idle-monitor backend
And use the old "native" backend for both X11 and Wayland. This will
allow us to share fixes between implementations without having to delve
into the XSync X11 extension code.

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Benoit Gschwind
3ee1999c70 backend: Reset current device id when current device removed
Bluetooth mouse usually goes in sleep state after a timeout, when that
happen the mouse is disconnected and on_device_removed function is
called. Before the patch if a touch device is available the
on_device_removed function hide the cursor. The issue is that the cursor
does not reappear once the bluetooth mouse is reconnected because
MetaBackend::current_device_id is not invalidated when on_device_removed
was called.

The patch set MetaBackend::current_device_id to 0 if the current device
is removed. This will make update_last_device to be triggered as soon as
another input device is used or the bluetooth mouse reconnect, as
consequence that the cursor reappear. The id 0 is never given to devices
and can safely used as undefine id.

https://bugzilla.gnome.org/show_bug.cgi?id=761067
2017-11-09 17:42:45 +08:00
Marco Trevisan (Treviño)
a8c80ccece backend: move the cursor render update on screen changes here
https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 00:46:51 -05:00
Marco Trevisan (Treviño)
b31e545c9d backends: add 'monitors-updated-internal' signal to only update internal state
Adding an internal signal and use it to update the internal state before
emitting "monitors-changed" which will be repeated by the screen to the world.

https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 00:42:50 -05:00
Jonas Ådahl
16a6aef5a7 backends/native: Move KMS fd management to monitor manager
Move finding, opening and managment of the KMS file descriptor to
MetaMonitorManagerKms. This means that the monitor manager creation can
now fail, both if more than one GPU with connectors is discovered, or
if finding or opening the primary GPU fails.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
518fb9fb5e backends: Split monitor manager creation into create and setup
The monitor manager instance was created and setup in one step; at
construction. This is problematic if, in the future, the monitor manager
creation can fail, as the monitor manager is created quite late.

To make it possible to in the future fail creating a monitor manager,
create the instance very early when initiating the backend, then on
post init backend setup, "setup" the monitor manager state, i.e. read
the current state and setup the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
547ace3cf8 backend/native: Propogate error when creating renderer
The error was printed, then dropped, eventually resulting in another
generic error being printed. Lets just propogate the error all the way
up instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
a119e58773 backend: Only try to center pointer when there not headless
Don't attempt to center the pointer when there is nothing to center on.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
97f2c7c161 Add remote desktop and screen cast functionality
This commit adds basic screen casting and remote desktoping
functionalty. This works by exposing two D-Bus API services:
org.gnome.Mutter.ScreenCast and org.gnome.Mutter.RemoteDesktop.

The remote desktop API is used to create remote desktop sessions. For
each session, a D-Bus object is created, and an application can manage
the session by sending messages to the session object. A remote desktop
session the user to emit input events using the D-Bus methods on the
session object. To get framebuffer content, the application should
create an associated screen cast session.

The screen cast API is used to create screen cast sessions. One can so
far either create stand-alone screen cast sessions, or a screen cast
session associated with a remote desktop session. A remote desktop
associated screen cast session is managed by the remote desktop session.

So far only remote desktop managed screen cast sessions are implemented.

Each screen cast session may have one or more streams. A screen cast
stream is a stream of buffers of some part of the compositor content.
So far API exists for creating streams of monitors and windows, but
only monitor streams are implemented.

When a screen cast session is started, the one PipeWire stream is
created for each screen cast stream created for the session. When this
has happened, a PipeWireStreamAdded signal is emitted on the stream
object, passing a unique identifier. The application may use this
identifier to find the associated stream being advertised by the
PipeWire daemon.

The remote desktop and screen cast functionality must be explicitly be
enabled at ./configure time by passing --enable-remote-desktop to
./configure. Doing this will build both screen cast and remote desktop
support.

To actually enable the screen casting and remote desktop, the user must
enable the experimental feature. See
org.gnome.mutter.experimental-features.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
33f1706634 backend: Add API to get layout group
Add API to get the layout group (layout index) currently active. In the
native backend this is done by fetching the state directly from the
evdev backend; on X11 this works by listening for XkbStateNotify
events, caching the layout group value.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +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
Rui Matos
aad2280309 backends: Add a MetaOrientationManager class
This basically moves g-s-d's orientation plugin into mutter so that
eventually g-s-d doesn't need to build monitor configurations by
itself anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Jonas Ådahl
2718699ccc backend: Move settings into a new MetaSettings object
Introduce MetaSettings and add the settings managed by MetaBackend into
the new object. These settings include: experimental-features and UI
scaling factor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
be175558c3 backend: Make X11 display opened function explicitly named
It didn't say anything about being the X11 display, so make it say so.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
43cdf81f6b backend: Make the getter use the cached ui scale
The cached ui scale is kept up to date, so don't recalculate it
everytime meta_backend_get_ui_scaling() is called.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
efc190789f backend: Couple of whitespace fixes
https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +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
755755a2f3 backend: Move out some code from post_init()
meta_backend_real_post_init() had some open coded initialization with
some unexpected interdependencies. Split these up and move them to their
own functions in order to make meta_backend_real_post_init() a bit more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:17:46 +08:00
Carlos Garnacho
f2309cdb55 backends: Store MUTTER_STAGE_VIEWS envvar content just once
No need to poke this regularly while drawing the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-09 11:53:46 +02:00
Jonas Ådahl
e6eac46629 backend: Get the UI scaling factor from the logical monitors
Instead of looking at the GTK+ settings, check the logical monitor
state and determine the UI scaling factor given the maximum logical
monitor scale. This is only enabled when the monitor config manager
feature is enabled, as only then can a scale be explicitly configured.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
de61da16ae monitor-manager: Reconfigure when 'scale-monitor-framebuffer' is toggled
When the experimental feature 'scale-monitor-framebuffer' is enabled or
disabled, reconfigure the monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
1bdadfa3e1 backend: Add API to get UI scaling
The UI scaling depends on whether the framebuffers are scaled. Enable
the caller to determine the what scale its UI should be drawn in, in
relation to the stage coordinate space by calling this function. A new
singal "ui-scaling-factor-changed" is added in order to liston for for
changes.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
20fcb88632 clutter: Remove window scaling feature
Window scaling is a clutter feature used to enable automatic scaling of
stage windows when running under as an application in windowing system.
Clutter in mutter does not support running as a stand-alone application
toolkit, so lets remove this unused feature.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
6791d1b8e2 backend: Use g_signal_emit instead of g_signal_emit_by_name
No functional changes, just a minor cleanup.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
0c64c35a8a monitor-manager: Make the config manager an 'experimental feature'
Instead of using a environment variable, add a new 'experimental
feature' gsetting keyword "monitor-config-manager" that enables the use
of the new MetaMonitorConfigManager. This commit also makes it possible
to switch between the two systems without restarting mutter.

The D-Bus API is disabled when the experimental feature is not enabled,
and clients trying to access it will get a access-denied error in
response. A new property 'IsExperimentalApiEnabled' is added to let the
D-Bus client know whether it is possible to use the experimental API or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +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
094e0356e8 backend: Add 'experimental-features' gsetting
This gsetting will allow the adding of keywords to a array, where each
keyword may enable an experimental feauter, if the given mutter version
supports that particular experimental feature. Emphasis is put on the
lack of guarantee that any such keyword has any effect. Currently no
keywords are defined.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +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