Commit Graph

5654 Commits

Author SHA1 Message Date
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
Jasper St. Pierre
8c1c77482d Remove old, deprecated utilities that nobody has used in a million years
https://bugzilla.gnome.org/show_bug.cgi?id=704437
2013-08-13 09:39:02 -04:00
Jasper St. Pierre
e633606ca9 menu: Remove support for icon items from the window menu
We don't show these by default, and it uses deprecated API.
This also removes our only use of the stock icons, so remove
those as well.

https://bugzilla.gnome.org/show_bug.cgi?id=704437
2013-08-13 09:39:01 -04:00
Giovanni Campagna
9a5f243f73 wayland: refactor window destruction and focus
The previous code was leaving focus fields dirty in MetaWaylandPointer
and MetaWaylandKeyboard at time (which could crash the X server
because of invalid object IDs)
The new code is more tighly integrated in the normal X11 code
for handling keyboard focus (meaning that the core idea of input
focus is also correct now), so that meta_window_unmanage() can
do the right thing. As a side benefit, clicking on wayland clients
now unfocus X11 clients.
For the mouse focus, we need to clear the surface pointer when
the metawindowactor is destroyed (even if the actual actor is
kept alive for effects), so that a repick finds a different pointer
focus.

https://bugzilla.gnome.org/show_bug.cgi?id=705859
2013-08-13 09:42:55 +02:00
Giovanni Campagna
03f55b9485 wayland: fix a #warning
Remove window_surfaces, as the FIXME asks for. We don't need it
because we can obtain the surface from the MetaWindow, and
follow the wayland compositor path for both types of clients.

https://bugzilla.gnome.org/show_bug.cgi?id=705818
2013-08-13 09:42:55 +02:00
Jasper St. Pierre
ef9ef87d91 configure: Complete fix for removing clutter-wayland-compositor 2013-08-12 14:43:23 -04:00
Jasper St. Pierre
0ee2c21da7 meta-wayland: Remove get_surface_rect
It's the same as get_input_rect, which we already have in window.
2013-08-12 12:13:45 -04:00
Jasper St. Pierre
9b966561c4 configure.ac: Remove clutter-wayland-compositor dependency
It's not necessary.
2013-08-12 12:08:58 -04:00
Giovanni Campagna
8c0779a9db wayland: add missing file
A Makefile.am is required for the protocol/ directory

https://bugzilla.gnome.org/show_bug.cgi?id=705815
2013-08-12 09:49:17 +02:00
Robert Bragg
2c901cc015 wayland: implement shell surface move interface
This implements the shell surface move interface so now it's possible to
use the mouse to interactively move wayland based windows around the
screen.
2013-08-10 19:13:49 -04:00
Robert Bragg
85e66f69fa wayland: support left click to raise wayland surfaces
This adds support for raising wayland surfaces when clicked with the
left mouse button.
2013-08-10 19:13:49 -04:00
Neil Roberts
a5585327dc wayland: Add an actor for the cursor
When running Mutter under Cogl's KMS backend no cursor will be
provided so instead this makes it so the cursor will be painted as a
CoglTexture that gets moved in response to mouse motion events. The
painting is done in a subclass of ClutterStage so that we can
guarantee that the cursor will be painted on top of everything else.

This patch adds support for the set_cursor method on the pointer
interface so that clients can change the cursor image.

The set_pointer method sets a surface and a hotspot position to use
for the cursor image. The surface's buffer is converted to a
CoglTexture and attached to a pipeline to paint directly via Cogl. If
a new buffer is attached to the surface the image will be updated. The
cursor reverts back to the default image whenever to the pointer focus
is moved off of any surface.

The image for the pointer is taken from X. It gets installed into
a fixed data location for mutter.
2013-08-10 19:13:49 -04:00
Neil Roberts
268ebb1b18 wayland: Add basic input support
This copies the basic input support from the Clayland demo compositor.
It adds a basic wl_seat implementation which can convert Clutter mouse
events to Wayland events. For this to work all of the wayland surface
actors need to be made reactive.

The wayland keyboard input focus surface is updated whenever Mutter
sees a FocusIn event so that it will stay in synch with whatever
surface Mutter wants as the focus. Wayland surfaces don't get this
event so for now it will just give them focus whenever they are
clicked as a hack to test the code.

Authored-by: Neil Roberts <neil@linux.intel.com>
Authored-by: Giovanni Campagna <gcampagna@src.gnome.org>
2013-08-10 19:13:49 -04:00