1
0
Fork 0
Commit graph

133 commits

Author SHA1 Message Date
Neil Roberts
e6790038dd wayland: Use an event filter instead of the captured event signal
In order to see all Clutter events, Mutter was previously installing a
signal handler on the ‘captured-event’ signal on the stage and
additionally using a signal emission hook to cope with grabs. This
changes it to use the new clutter_event_add_filter API so that we can
avoid the signal emission hook hack.
2013-11-12 16:53:14 -05:00
Neil Roberts
429583ae8b display: Rename meta_display_handle_event to meta_display_handle_xevent
The plan is to make a new version of meta_display_handle_event that
will accept Clutter events instead of X events and then gradually move
over the events to the new function and finally remove the X version.
2013-11-12 16:53:14 -05:00
Giovanni Campagna
776a86a65f wayland: heavily refactor pointer grabs
Grabs are now slice allocated structures that are handled by
whoever starts the grab. They contain a generic grab structure
with the interface and a backpointer to the MetaWaylandPointer.
The grab interface has been changed to pass full clutter events,
which allowed to remove the confusion between grab->focus and
pointer->focus. Invidual grabs are now required to keep their
focus, and choose whoever gets the events.

https://bugzilla.gnome.org/show_bug.cgi?id=707863
2013-09-16 14:51:12 +02:00
Giovanni Campagna
a7eaf43e18 wayland: implement resizing and maximization for wayland clients
To properly resize clients, we need to send them configure events
with the size we computed from the constraint system, and
then check if the new size they ask is compatible with
our expectation.

Note that this does not handle interactive resizing yet, it
merely makes the API calls work for wayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=707401
2013-09-16 14:46:34 +02:00
Giovanni Campagna
65db8efbe8 MonitorManager: add a KMS backend
Using the new Cogl API to actually modeset (because we can't
use the DRM API directly without controlling buffer swap), we
can finally have a KMS monitor backend, which means full display
configuration when running on bare metal.

https://bugzilla.gnome.org/show_bug.cgi?id=706308
2013-09-16 00:34:48 +02:00
Giovanni Campagna
b5f3238f6f Stop messing with process groups
We can be launched by gnome-session now, which implies gdb must be
attached from outside, and the Ctrl-C problem is gone.

https://bugzilla.gnome.org/show_bug.cgi?id=706421
2013-09-11 16:01:09 +02:00
Giovanni Campagna
227fb56103 Set DISPLAY and WAYLAND_DISPLAY for dbus activated services and for autostarted apps
Call the appropriate method on gnome-session so that autostarted
and bus activated apps see the X server and wayland socket.

https://bugzilla.gnome.org/show_bug.cgi?id=706421
2013-09-11 16:01:09 +02:00
Giovanni Campagna
168ea64a45 wayland: use symbolic constants for interface version
Replace magic numbers scattered around the code with proper
macros collected in one header file.

https://bugzilla.gnome.org/show_bug.cgi?id=707851
2013-09-10 15:55:11 +02:00
Giovanni Campagna
73ee491281 wayland: fix interface versioning
Add MIN(...) with the interface version actually implemented
to all resource constructor, so that we never risk seeing requests
we don't implement (and consequently segfault)

https://bugzilla.gnome.org/show_bug.cgi?id=707851
2013-09-10 15:54:42 +02:00
Giovanni Campagna
450afbaf51 wayland: reimplement keyboard state handling properly
We can't rely on clutter's xkb_state, because that's updated
when events are pulled from the kernel, not when we see them.
Instead, use the new clutter API to get the full modifier state
from the event (which, as a side effect, also works when clutter
is using the X11 backend for running nested).

https://bugzilla.gnome.org/show_bug.cgi?id=706963
2013-09-09 17:59:45 +02:00
Giovanni Campagna
cad9e14463 Move surface state tracking and surface interface to a separate file
Move everything surface related from meta-wayland.c to meta-wayland-surface.c

https://bugzilla.gnome.org/show_bug.cgi?id=707128
2013-09-03 10:57:28 -04:00
Giovanni Campagna
0f0c23fbab wayland: generalize ShellSurface to SurfaceExtension
We want to implement new shells and new extension interfaces
for wl_surface, so generalize the book-keeping structures.

https://bugzilla.gnome.org/show_bug.cgi?id=707128
2013-09-03 10:57:28 -04:00
Giovanni Campagna
cbe5b6b3bc 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.

https://bugzilla.gnome.org/show_bug.cgi?id=706289
2013-09-03 10:16:47 -04:00
Jasper St. Pierre
b1206ceb66 wayland: Ensure that opaque / input regions are set at commit time
The protocol specification says that opaque / input regions should be
considered pending state and should only be actually swapped out when
the surface is committed, so it can be set atomically.
2013-08-31 13:29:02 -04:00
Giovanni Campagna
ad4053ab84 wayland: fix pointer focus for destroyed surfaces
We had an assertion in meta_wayland_surface_free() that after
a repick() we would not choose the freed surface, but that didn't
consider surfaces destroyed while holding the implicit pointer
grab (ie, because the user clicked on the X button). In that case,
we need to bypass the grab infrastructure and explicitly unfocus
the dead surface.

https://bugzilla.gnome.org/show_bug.cgi?id=706982
2013-08-30 16:07:00 +02:00
Giovanni Campagna
deeb1db1ac wayland: don't free surfaces that have a window associated
After a MetaWaylandSurface is associated with a MetaWindow, it
should be freed only when the MetaWindow is unmanaged. For wayland
clients, the window is unmanaged when the resource is destroyed,
but for X11 clients we want to wait for the unmap event.

https://bugzilla.gnome.org/show_bug.cgi?id=705917
2013-08-30 10:37:25 +02:00
Giovanni Campagna
59b274f12f 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-30 10:37:25 +02:00
Giovanni Campagna
e72f81c24f wayland: add TTY and DRM master management
Now that we have a setuid launcher binary, we can make use of
using a private protocol through the socket we're passed at startup.

We also use the new hook in clutter-evdev to ask mutter-launch for
the FDs of the input devices we need, and we emulate the old X
DRM lock with a nested GMainContext without sources.

In the future, mutter-launch will be replaced with the new logind
API currently in development.

https://bugzilla.gnome.org/show_bug.cgi?id=705861
2013-08-30 10:32:55 +02:00
Jasper St. Pierre
2d35e07fae wayland: Add support for set_opaque_region / set_input_region
https://bugzilla.gnome.org/show_bug.cgi?id=707019
2013-08-29 15:31:52 -04:00
Giovanni Campagna
7d9141c56f Revert "MetaWaylandKeyboard: use the new clutter-evdev support for xkbcommon"
This reverts commit 519a06b93d.
Depends on unreviewed stuff and breaks the build.
2013-08-28 18:04:01 +02:00
Giovanni Campagna
519a06b93d 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-28 17:45:25 +02:00
Giovanni Campagna
9a4783e364 Integrate the monitor manager with wayland
Use the right backend when running as a wayland compositor,
export the data to wayland clients, and use it to keep the stage
appropriately sized.
2013-08-27 10:09:39 +02:00
Giovanni Campagna
9affbf10a6 MetaIdleMonitor: add wayland support
Keep a timer source that we reset when we capture an event in
MetaWayland, and fire watches accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=706005
2013-08-23 16:34:02 +02:00
Giovanni Campagna
2ae7454f36 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-19 16:09:53 +02:00
Giovanni Campagna
18a21b67c2 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-15 17:42:19 +02:00
Giovanni Campagna
3803fd9511 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-15 17:41:34 +02: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
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
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
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
Robert Bragg
f9a11b3b18 wayland: Adds basic hybrid X + Wayland support
This adds support for running mutter as a hybrid X and Wayland
compositor. It runs a headless XWayland server for X applications
that presents wayland surfaces back to mutter which mutter can then
composite.

This aims to not break Mutter's existing support for the traditional X
compositing model which means a single build of Mutter can be
distributed supporting the traditional model and the new Wayland based
compositing model.

TODO: although building with --disable-wayland has at least been tested,
I still haven't actually verified that running as a traditional
compositor isn't broken currently.

Note: At this point no input is supported

Note: multiple authors have contributed to this patch:
Authored-by: Robert Bragg <robert@linux.intel.com>
Authored-by: Neil Roberts <neil@linux.intel.com>
Authored-by: Rico Tzschichholz.
Authored-by: Giovanni Campagna <gcampagna@src.gnome.org>
2013-08-10 19:13:48 -04:00