Commit Graph

2880 Commits

Author SHA1 Message Date
Giovanni Campagna
e9434732d4 MetaWayland: implement spawning dbus and gnome-session
If we launch gnome-session ourselves after setting up XWayland,
we then get gnome-settings-daemon and all the required session
stuff, which means we can run a full regular gnome session.
2013-08-14 10:03:50 +02:00
Giovanni Campagna
bbf07c9b17 MonitorManager: add EDID properties to the output DBus description
Add "edid-file", if we have one (in the KMS case, where we can point
people to the right sysfs file), or "edid" with inline data.
These are needed by colord to build the default ICC profile for
uncalibrated displays.
2013-08-14 10:03:50 +02:00
Giovanni Campagna
804c2be976 MetaWayland: or maybe don't do it for override redirect windows?
I don't know, OR windows are not appearing at all.
2013-08-14 10:03:50 +02:00
Giovanni Campagna
9bdcc9c418 meta-wayland: intersect the damage region with the window size before applying
According to the wayland documentation, damage outside the
window size is ignored.
This happened with xwayland+wlshm (causing a GL error when calling
TexSubImage2D), probably due to not resizing the buffer
until we receive the corresponding X event.
Might also be an off-by-one in xwayland, as the window size did
not actually change.

Note: we might want to take the configure_notify path instead,
and keep the GL/clutter size consistent with wayland rather than
X, because in the end that's what matters for events and composition.
2013-08-14 10:03:50 +02:00
Giovanni Campagna
cee22daf55 MonitorManager: split the XRandR parts in a subclass
Instead of keeping a forest of if backend else ..., use a subclass
and virtual functions to discriminate between XRandR and the
dummy backend (which lives in the parent class togheter with the
common code)
2013-08-14 10:03:49 +02:00
Giovanni Campagna
63fdf8bcb8 MetaWindow: don't set focus to unmanaged window
Closing the last window causes the no-focus window to gain
focus, which causes mutter to unfocus the just closed window,
and that crashes. As focusing a window that is about to be
destroyed does not make sense, avoid a crash in this case.

Note: this is probably a reference counting bug in MetaWayland
actually.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
62442cf0ce MetaPlugin: add a UI hook for confirming display changes
We want to show a dialog when a display change happens from the
control center. To do so, add a new vfunc to MetaPlugin and
call it when a configuration change is requested via DBus.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
c1549af840 MonitorConfig: handle changes in the laptop lid
This way we don't need to track the current and previous
configuration in gnome-settings-daemon, when we already do so
in mutter.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
8325f0eda5 MonitorManager: add gamma support
Add GetCrtcGamma() and SetCrtcGamma(), that wrap the similarly
named XRandR API. These are used by GnomeRR inside the color
plugin of the control center (and may go away if the color
plugin decides to do something different under wayland)
2013-08-14 10:03:49 +02:00
Giovanni Campagna
14931ed391 MetaWayland: don't destroy the output list, emit the right events instead
Destroying the output list causes toolkits to believe that all
monitors were unplugged, which then causes assertions in code
that have outside knowledge of this not having happened (like
in code using GnomeRR DBus API).
2013-08-14 10:03:49 +02:00
Giovanni Campagna
c06762518e MonitorManager: ignore configuration changes that disable all outputs
If we compute a screen size of 0 in either direction, we crash
later on, as it is invalid for clutter, cogl and X.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
8483dec921 MonitorManager: add support for backlight
GnomeRR needs that too.
The backlight is exported as a normalized 0-100 value, or -1 if not
supported. Clamping to HW limits is handled by the backend.
Changing backlight uses a different method call, to avoid recomputing
the full display configuration every time the user presses the
backlight keys.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
d7e970cb0a MonitorManager: further extend the dummy backend
The default configuration is extended, which is only possible
if there are as many CRTCs as outputs, so make sure that's true.

Also, add more and bigger modes, so that different sizes will
be chosen for the three outputs.
A nice side effect of this is that with a real 1920x1080 + 1600x900
layout, if you disable the VGA you get a stage that matches the
screen size, which triggers the legacy fullscreen path in the
outside mutter.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
b383d55988 MonitorManager: store the presentation mode bit in XRandR
Use a private output property to store if the output is in
presentation mode or not, so that this information is not lost
after the configuration read back from the server.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
25f82424b8 MonitorConfig: add support for default configurations
Activate the presentation bit on new hotplugged monitors, while
making a fully extended setup when running for the first time.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
7764e1f3ff MonitorConfig: add CRTC assignment
Ripped off libgnome-desktop, trimming the parts that checked
that the configuration was plausible, as that should be done
in gnome-control-center before asking mutter for a change.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
ce3ec40036 MonitorManager: add support for persistent monitor configurations
Add a new object, MetaMonitorConfig, that takes care of converting
between the logical configurations stored in monitors.xml and
the HW resources exposed by MonitorManager.
This commit includes loading and saving of configurations, but
still missing is the actual CRTC assignments and a default
configuration when none is found in the file.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
22a668f2cf MonitorManager: remove Cogl backend
It was useful initially to evaluate the Cogl API, which might
be what we will use to wrap the low-level KMS API, but it's
incomplete and just getting in the way.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
97ff406102 MonitorManager: add support for DPMS levels
To the XRandR and dummy backend (and as usual the dummy backend
has no effect)
2013-08-14 10:03:49 +02:00
Giovanni Campagna
e2f06dfa8c MonitorManager: inherit directly from DisplayConfig instead of handling signals
This way we can handle properties too.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
ee6b729196 MonitorManager: fix handling of output transform
Read the current transform from XRandR, and expose the transforms
that are really supported on the bus.
The dummy backend now advertises all transforms, since it doesn't
actually apply them.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
0d1647cbc4 default plugin: add a random color background on each monitor
Instead of a full white background, make one with a random color.
This way the different "monitors" are visible and it's easier
to debug the DBus API.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
49a83138f4 Remove duplicate path for resizing clutter stage
Handle it in meta_compositor_sync_stage_size(), like we do under
X11.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
1e3aad2d8c DisplayConfig: make the dummy backend writable
Add a number of dummy outputs and modes to the dummy backend,
and implement the writing bits.
The only visible effect is that you can change the screen size,
which resizes the output window.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
33c0c1dc18 Reverse handling of XRandR events between Screen and MonitorManager
Now MonitorManager does its own handling of XRandR events, which
means we no longer handle ConfigureNotify on the root window.
MetaScreen reacts to MonitorManager::monitor-changed and updates
its internal state, including the new size.

This paves the way for doing display configuration using only
the dummy backend, which would allow testing wl_output interfaces.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
e261f0ac39 DisplayConfig: add the write side of the API
Implement ApplyConfiguration in terms of XRandR calls.
Error checking is done before actually committing the configuration.

If mutter is using one of the other monitor config backends, an
error is reported and nothing happens.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
528219fcbf Extend the DBus XRandR protocol to expose cloning restriction
Turns out that even if two outputs say that they can be controlled
by a given CRTC, you can't configure them in the same CRTC unless
they are marked as "possible clones" one of the other.
This can further restrict the configuration options, so we need
to expose this limitation in the DBus API.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
d9a5f2638a Add the write side of the DBus protocol too
This is just in the documentation for now, to attract wider feedback
before we start looking at how to implement this for real.
2013-08-14 10:03:49 +02:00
Giovanni Campagna
738b0eee1d Introduce a new DBus interface for display configuration
This new interface will be used by the control center and possibly
the settings daemon to configure the screens. It is designed to
resemble a simplified XRandR, while still exposing all the quirks
of the hardware, so that the panel can limit the user choices
appropriately.

To do so, MetaMonitorMode needs to track CRTCs, outputs and modes,
so the low level objects have been decoupled from the high-level
MetaMonitorInfo, which is used by core and API and offers a simplified
view of HW, that hides away the details of what is cloned and how.
This is still not efficient as it should be, because on every
HW change we drop all data structures and rebuild them from scratch
(which is not expensive because there aren't many of them, but
at least in the XRandR path it involves a few sync X calls)
2013-08-14 10:03:49 +02:00
Giovanni Campagna
0480d6c898 wayland: apply stage size according to the monitor config
Still 1024x768, because we don't have a way to configure that,
but at least now it's hardcoded in the right place.
2013-08-14 10:03:48 +02:00
Giovanni Campagna
2777dfc533 Split monitor handling into an helper object
Create a new singleton object, MetaMonitorManager, which deals
with reading the XRandR configuration and in the future applying
the new one.
This is required because xwayland will not bind the xserver interface
until he has seen the current wl_outputs, so we can't wait
until MetaScreen is built to expose them.
2013-08-14 10:03:48 +02:00
Giovanni Campagna
cf296f26b1 Rework and consolidate monitor handling between MetaScreen and MetaWaylandCompositor
Consolidate all places that deal with output configuration in
MetaScreen, which gets it either from XRandR or from Cogl (which
in turn would read it from XRandR or KMS, depending on the backend).
We still need to read the Xinerama config, even when running xwayland,
because we need the indices for _NET_WM_FULLSCREEN_MONITORS, but
now we do it only when needed.
Also, now MetaWaylandCompositor listens for MetaScreen::monitor-changed
and exports the real configuration on the wayland socket.
2013-08-14 10:03:48 +02:00
Giovanni Campagna
b8f6801d20 compositor: fix focusing the stage window
We can't use the X11 stage window, if clutter is not using the X11
backend (and even if it was, it would be bogus when the xwayland
server is not the one clutter is talking to). Instead, we introduce
the concept of "focus type", which we use to differentiate the
various meanings of None in the focus_xwindow field.
2013-08-14 10:03:48 +02:00
Giovanni Campagna
2a1c0429dd Add MetaCursorTracker, a new helper for tracking the cursor sprite
Under X, we need to use XFixes to watch the cursor changing, while
on wayland, we're in charge of setting and painting the cursor.
MetaCursorTracker provides the abstraction layer for gnome-shell,
which can thus drop ShellXFixesCursor. In the future, it may grow
the ability to watch for pointer position too, especially if
CursorEvents are added to the next version of XInput2, and thus
it would also replace the PointerWatcher we use for gnome-shell's
magnifier.

https://bugzilla.gnome.org/show_bug.cgi?id=705911
2013-08-14 10:03:09 +02:00
Giovanni Campagna
5ae9457176 wayland: fix a compiler warning
Implicit declaration of memset
2013-08-14 09:43:38 +02:00
Giovanni Campagna
e158500ef0 MetaWaylandKeyboard: use the new clutter-evdev support for xkbcommon
We need to track the full xkb_state to have the necessary information
to send to the clients, otherwise they may get confused and lock
or invert the modifiers. In the evdev backend, we just retrieve the
same state object that clutter is using, while in the other backends
we fake the state using what clutter is providing (which is a subset
of what X11 provides, which would be necessary to have full state)

https://bugzilla.gnome.org/show_bug.cgi?id=705862
2013-08-14 09:43:38 +02:00
Giovanni Campagna
b29d8046b0 MetaWayland: redirect stdin/stdout/stderr when running on bare metal
We need to spawn background processes for gnome-session and friends,
so we need to make sure they don't try to read or write from our
terminal.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
fa3ca2bf10 Add a crash handler to restore the TTY and keyboard mode
If mutter crashes on secondary VT, it leaves you with a raw keyboard
that doesn't switch with Alt+FN and no way to get out. At least,
let's provide a decent error message that we crash and let's
restore everything to sane defaults.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
fc42b478bd Fix handling SIGTERM while DRM-locked
And at the same time, clean up the signal handling in the regular
case.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
0e0e0a4c7e Add keybindings for switching VTs
Once mutter is started from weston-launch on its own VT, there is
no way to change VT again (for example to actually start an application),
because the keyboard is put in raw mode.
So introduce some keybindings mimicking the standard X ones (Ctrl+Alt+Fn)
that switch the VT manually when activated.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
c96fd23e79 Improve handling while VT switched
When we don't have the DRM master, there is absolutely nothing
we can do (no event processing, no video output), so emulate
the old X DRM lock with a nested GMainContext without sources.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
045d03014d wayland: add input device handling too
Use the new hook in clutter-evdev to ask weston-launch for the
FDs of the input devices we need.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
a83049c103 wayland: add TTY and DRM master management through weston-launch
To run mutter as a display server, one needs to acquire and
release the DRM master, which is only possible for root, so
we take advantage of weston-launch, a small setuid helper binary
written for the weston project. We import our own slightly
modified copy of it, because weston-launch only launches weston,
for security reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-14 09:43:38 +02:00
Giovanni Campagna
5f4121830c MetaWayland: install an X io error handler
This way can detect X disconnections correctly, crash with a core
dump and reset the tty.
2013-08-14 09:43:38 +02:00
Giovanni Campagna
43d499318f wayland: move XWayland support code to its own file
Given that xwayland code is already split in meta-xwayland, it
makes sense to have there the implementation of the private
xserver protocol too.

https://bugzilla.gnome.org/show_bug.cgi?id=705816
2013-08-14 09:43:12 +02:00
Giovanni Campagna
f2fab33551 wayland: don't use fork() and SIGCHLD to spawn processes
It is a very bad idea in a glib program (especially one heavily
using glib child watching facilities, like gnome-shell) to handle
SIGCHLD. While we're there, let's also use g_spawn_async, which
solves some malloc-after-fork problems and makes the code generally
cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=705816
2013-08-14 09:43:08 +02:00
Jasper St. Pierre
0e098249b1 Merge remote-tracking branch 'origin/master' into wayland 2013-08-13 10:44:09 -04:00
Jasper St. Pierre
12d2e1f600 Support _GTK_FRAME_EXTENTS
https://bugzilla.gnome.org/show_bug.cgi?id=705766
2013-08-13 10:40:15 -04:00
Jasper St. Pierre
c20b007985 Reintroduce mutter binary
I accidentally deleted one too many things.
2013-08-13 10:16:01 -04:00
Jasper St. Pierre
ef480e9120 theme: Fix build breakage 2013-08-13 09:50:59 -04:00