1
0
Fork 0
Commit graph

5593 commits

Author SHA1 Message Date
Jonas Ådahl
7fd585fe98 wayland: Split out shell surface code from meta-wayland-surface.c
Move xdg_shell related functionality to a new meta-wayland-xdg-shell.c
and wl_shell related functionality to a new meta-wayland-wl-shell.c,
and adapt role object tree.

Common functionality related to the surface being drawn as a
MetaSurfaceActor was moved to a MetaWaylandSurfaceRoleActorSurface role.

The subsurface role GObject is made to inherit the actor surface GObject.

Shell surface hooks (configure, ping, close, popup done) were added to
a MetaWaylandSurfaceRoleShellSurface GObject which inherits the
surface actor role GObject.

The shell surface roles (xdg_surface, xdg_popup, wl_shell_surface) are
made to inherit the shell surface GObject and implement the relevant
API.

https://bugzilla.gnome.org/show_bug.cgi?id=757623

https://bugzilla.gnome.org/show_bug.cgi?id=763431
2016-05-01 21:11:27 +08:00
Florian Müllner
b6092cf4db Revert "build: Set rpath of standalone executable"
Within the mutter module we use the .la file to link cogl/clutter,
so this isn't actually needed.

This reverts commit 576fe6e16b.
2016-04-28 20:15:48 +02:00
Florian Müllner
576fe6e16b build: Set rpath of standalone executable
We now link to cogl/clutter forks in a private location, so make
sure to point the runtime linker to the correct location.
2016-04-28 19:46:05 +02:00
Rui Matos
1fa540bcb7 Fix the merged build
https://bugzilla.gnome.org/show_bug.cgi?id=760439
2016-04-27 20:37:47 +02:00
Carlos Garnacho
a6cc35e595 wayland: remove pressed button checks from meta_wayland_pointer_can_grab_surface()
Leave these checks up to the callers, the only uses of this function
(indirect, through meta_wayland_seat_get_grab_info) are
[wl_shell|xdg]_surface.move/resize/show_window_menu.

In move/resize it makes sense to check for a button being pressed, because
we must expect a button release event. However for xdg_surface.show_window_menu
we 1) don't strictly need further events and 2) we must account for press+release
event pairs being processed at once in the compositor before the client sees
the former.

That is eg. the case of touchpad 2nd/3rd button tap emulation, multifinger
taps will emit the event pair at once, so when the client manages to request
xdg_surface.show_window_menu, it'll be too late in the compositor side, so the
request is ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=764519
2016-04-25 14:23:01 +02:00
Jonas Ådahl
08ac192b9d wayland: Handle wl_data_device being destroyed while focused
A wl_data_device object may be created while it is being focused,
either because the client destroyed it or because the client was
destroyed. Handle this by early out in focus handler vfuncs the case
where it was destroyed, so that we don't corrupt memory and/or cause
segmentation fault.

https://bugzilla.gnome.org/show_bug.cgi?id=765062
2016-04-25 20:17:24 +08:00
Florian Müllner
ed5c3b39ee monitor-manager: Add get_is_builtin_display_on()
Wrap the existing laptop_display_is_on() method in a public function
that gnome-shell can use to query whether a builtin output is present
and enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 21:16:16 +02:00
Florian Müllner
b6f11fa8b8 monitor-config: Update laptop heuristics to match GnomeRROutput
gnome-desktop's GnomeRROutput class has heuristics to classify a display
as builtin similar to our own[0]. The two heuristics don't quite match
though, so different core components can end up with a different view
on the current display configuration. Minimize that risk by adding a
couple of rules that bring the two heuristics closer together.

[0] https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-rr.c#n1674

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Florian Müllner
ab6c008e3e monitor-manager: Expose output_is_laptop() method
We currently duplicate the heuristics of whether an output is considered
a laptop or not. Avoid this by sharing a small helper method.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Victor Toso
ff312b6958 fix warning due implicit declaration of function
error: implicit declaration of function
  .x = (int)roundf (priv->current_x - (hot_x * texture_scale)),
            ^

https://bugzilla.gnome.org/show_bug.cgi?id=765252
2016-04-20 09:22:52 +02:00
Rui Matos
e284370013 wayland-keyboard: Notify clients of pending modifier state changes
If we get a key event but still have pending modifier state changes we
need to send a modifiers event right away so that the key event can be
interpreted by clients correctly modified.

This case could happen when mutter/gnome-shell itself consumes the
modifier key press event such as with the overview key which by
default is triggered on super press.

https://bugzilla.gnome.org/show_bug.cgi?id=748526
2016-04-19 18:02:25 +02:00
Rui Matos
0fa9751b31 wayland-keyboard: Include virtual modifiers along with real modifiers
The wayland protocol has enough space to send both virtual and real
modifiers on modifiers events which saves clients the work of
resolving virtual modifiers themselves.

https://bugzilla.gnome.org/show_bug.cgi?id=748526
2016-04-19 18:02:25 +02:00
Rui Matos
82a247ccf5 keybindings: Keep virtual modifier masks around
Besides the resolved real modifier masks, having the virtual masks
around will be useful too.

https://bugzilla.gnome.org/show_bug.cgi?id=748526
2016-04-19 18:02:25 +02:00
Olivier Fourdan
5d6af70bc9 keybindings: Fix keyboard move/resize on Wayland
Rework the code to keep the grab/ungrab logic when running as a Wayland
compositor.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=758076
2016-04-19 09:02:06 +02:00
Florian Müllner
8842bdfb11 Do not skip CoglError parameters
While CoglError is a define to GError, it doesn't follow the convention
of ignoring errors when NULL is passed, but rather treats the error as
fatal :-(
That's clearly unwanted for a compositor, so make sure to always pass
an error parameter where a runtime error is possible (i.e. any CoglError
that is not a malformed blend string).

https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:22:24 +02:00
Florian Müllner
bdc72dd9d7 Do not try to unref NULL CoglObjects
https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:21:22 +02:00
Rui Matos
8587f0e80d monitor-config: Handle invalid previous configurations
The previous configuration might not apply because the number of
enabled outputs when trying to apply it might have changed. This isn't
a bug so we shouldn't assert. Instead, we can handle it by falling
back as we would if we didn't have a previous configuration to start
with.

https://bugzilla.gnome.org/show_bug.cgi?id=764286
2016-04-13 18:16:36 +02:00
Cosimo Cecchi
150732a894 theme: set RTL/LTR flags on the style context
https://bugzilla.gnome.org/show_bug.cgi?id=764807
2016-04-09 10:03:27 -07:00
Jasper St. Pierre
75e6029206 stack: Fix 32-bit issues
Since g_array_append_val isn't smart enough to do a proper upcast, we
have to do it manually, lest we get junk.

This fixes various RAISE_ABOVE: window not in stack: 0x8100c8003
warnings that appear on 32-bit systems.
2016-04-08 17:28:26 -07:00
Rui Matos
e017148208 wayland: Make wayland move/resizes be constrained the same as X11
Just like we do for _NET_WM_MOVERESIZE messages on X11, consider
wayland client move/resizes as "frame actions" so that the same
constraints are applied to them, in particular the titlebar visibility
constraint.

https://bugzilla.gnome.org/show_bug.cgi?id=748819
2016-04-06 17:58:18 +02:00
Jonas Ådahl
7173937a7d wayland/cursor: Keep a private use count and reference to active buffer
In order for the native cursor renderer to be able to create a hw
cursor in response to wl_pointer.set_cursor(), keep a private use-count
and reference to the active buffer, stopping it from being released
until it is consumed, replaced, or the surface is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Jonas Ådahl
f44238a72f MetaWaylandSurface: Keep an extra buffer use count for role-less surfaces
Whether a surface needs to keep the committed wl_buffer un-released
depends on what role the surface gets assigned to. For example a cursor
role may need an unreleased shm buffer in order to create a hw cursor from
it.

In order to support this, keep a separate reference and use count to
the buffer on behalf of the in the future assigned role, and release
those references after the surface was assigned a role. A role that
needs its own references and use counts, must in its assign function
make sure to add those.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Jonas Ådahl
10a0114856 wayland: Move buffer use count to MetaWaylandSurface
Each wl_surface.commit with a newly attached buffer should result in
one wl_buffer.release for the attached buffer. For example attaching
the same buffer to two different surfaces must always result in two
wl_buffer.release events being emitted by the server. The client is
responsible for counting the wl_buffer.release events and be sure to
have received as many release events as it has attached and committed
the buffer, before reusing it.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Jonas Ådahl
aa7bc501d5 wayland: Replace buffer destroy wl_signal with a GObject signal
Don't use the libwayland-* utilities when we have our own that do the
same thing.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:02:31 +08:00
Jasper St. Pierre
3a4ae679ea common: Remove META_LAYER_FOCUSED_WINDOW
Usage of this was removed 14 years ago in 25ca0e2. Let's remove the
constant, too.
2016-03-21 13:45:11 -07:00
Jasper St. Pierre
190357c561 surface-actor-x11: Unredirect ARGB32 windows with full opaque regions
We can detect that these windows are already fully opaque, so allow them
to unredirect. Allows unredirecting Totem during video playback, giving
a significant speed boost.
2016-03-21 13:44:44 -07:00
Jonas Ådahl
92c8a51ba6 bell: Fallback to fullscreen flash if no window was passed
We allow to flash without providing a window. In this case we should
flash the whole screen, instead of crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=763858
2016-03-21 11:38:31 +08:00
Carlos Garnacho
3d67bfda14 wayland: Implement support for the x-rootwindow-drop target
This target is set whenever DnD moves towards an area between surfaces.
Although no offer is set and data is actually not read, drag sources
offering this mimetype will be able to behave just like they used to
do in X11.

https://bugzilla.gnome.org/show_bug.cgi?id=762104
2016-03-11 14:47:02 +01:00
Carlos Garnacho
51e4491a9f wayland: Force an initial focus in meta_wayland_drag_grab_set_focus()
We want some initial processing, even if the current focus didn't change.
This could be for example the case of starting DnD too close to the window
edge and out of it. At the point start_drag() is called, the current
pointer focus is already NULL, so set_focus() would simply bail out here.

https://bugzilla.gnome.org/show_bug.cgi?id=762104
2016-03-11 14:47:02 +01:00
Carlos Garnacho
82153ff23f wayland: Always send focus() when starting a pointer grab
Even if the focus is NULL, we may want the current grab focus code
to be run.

https://bugzilla.gnome.org/show_bug.cgi?id=762104
2016-03-11 14:47:01 +01:00
Florian Müllner
9b39325244 display: Fix typo 2016-03-11 12:27:00 +01:00
Florian Müllner
868b3fd01e unit-tests: Fix const compiler warning 2016-03-11 12:26:38 +01:00
Rui Matos
8b801aac77 Handle meta_screen_get_monitor_for_point() returning NULL
On the X11 backend we don't track the pointer position in
priv->current_x/y which remain set to zero. That means we never set
the clutter stage cursor if point 0,0 isn't covered by any monitor
since we return early.

Commit 4bebc5e5fa introduced this to
avoid crashing on the prepare-at handlers when the cursor position
doesn't fall inside any monitor area but we can handle that higher up
in the stack. In that case, the sprite's scale doesn't matter since
the cursor won't be shown anyway so we can skip setting it.

https://bugzilla.gnome.org/show_bug.cgi?id=763159
2016-03-10 16:01:54 +01:00
Rui Matos
c380f2e03f wayland-pointer: Drop a phony signal disconnect
cursor_sprite_prepare_at() is never connected to a MetaCursorTracker
signal.

https://bugzilla.gnome.org/show_bug.cgi?id=763159
2016-03-10 15:58:46 +01:00
Rui Matos
ca1b4382c0 shaped-texture: Invalidate mask texture when main texture changes size
We currently rely only on MetaWindowActor to update the mask
texture. This isn't good enough since we might get asked to use the
mask (e.g. via meta_shaped_texture_get_image() ) after having a new
texture size but before MetaWindowActor decides to update the mask in
which case we might crash since cogl_texture_new_from_sub_texture()
might fail with an early return such as

Cogl-CRITICAL **: cogl_sub_texture_new: assertion 'sub_x + sub_width
<= next_width' failed

https://bugzilla.gnome.org/show_bug.cgi?id=762639
2016-03-10 15:56:41 +01:00
Jonas Ådahl
f6ba3bdfc2 wayland: Add gtk_surface.present to gtk-shell
This commits adds a gtk_surface.present request and its implementation.
The timestamp is assumed to be from some input event that the client
responded to. The timestamps we deal with when managing windows will
usually come from two different clocks: CLOCK_MONOTONIC if they come
from libinput/evdev, or CLOCK_MONOTONIC_COARSE if they come from the
X server.

Luckily these are quite similar, the difference beeing that the X server
timestamps having lower resolution, so we can just pass the timestamps
no matter where they came from and it'll most likely work fine, except
for the race condition described in bug 756272 which might happen here
too until it is properly fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=763295
2016-03-10 12:34:56 +08:00
Jonas Ådahl
99bba9e56c bell: Flash whole window if the window had no frame
CSD X11 clients and Wayland clients don't have a window frame drawn by
the compositor to flash. So instead of flashing the whole screen when
configured to just flash the window, flash just the window region.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
2016-03-10 12:34:56 +08:00
Jonas Ådahl
4af908a970 wayland: Add system bell support via gtk_shell
Add a system_bell request to gtk_shell. A client can use this to invoke
the system bell, be it aural, visual or none at all. Currently per
window visual bell support is not implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
2016-03-10 12:34:56 +08:00
Jonas Ådahl
417cb2b213 bell: Let the X11 caller deal with the X11 fallback
To support invoking the system bell on Wayland we shouldn't have paths
that fallback to X11. Let the X11 caller deal with the absence of
libcanberra, and change API to not take any X events.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
2016-03-10 12:34:56 +08:00
Jonas Ådahl
9f1d1151b7 wayland: Namespace gtk_shell request handlers
https://bugzilla.gnome.org/show_bug.cgi?id=763284
2016-03-10 12:34:56 +08:00
Jonas Ådahl
fea1ddcd29 wayland: Don't invent our own unstable protocol semantics
The gtk_shell protocol used some half baked unstable protocol semantics
that worked by only allowing binding the exact version of the
interface. This hack is a bit too confusing and it makes it impossible
to do any compatible changes without breaking things.

So, instead rename it to include a number in the interface names. This
way we can add requests and events without causing compatibility issues,
and we can later remove requests and events by bumping the number in
the interface names.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
2016-03-10 12:29:43 +08:00
Carlos Garnacho
3b023ea994 wayland: Start drags from the press position
Using the current position to set the origin x/y of the DnD icon
is wrong, it should still be used in order to move the icon besides
the current pointer position though.

Fixes possible drag-start-x/y property constraint warnings when
starting a drag too close to the window edge, and towards outside
of it.
2016-03-09 18:31:50 +01:00
Carlos Garnacho
f8c70491b9 wayland: Small code cleanup in meta_wayland_drag_grab_set_focus()
There's enough instances of drag_grab->drag_data_source to make it
nicer getting a "source" variable first.
2016-03-09 18:19:23 +01:00
Jonas Ådahl
d4b0c21d06 MetaWaylandPointerConstraint: Maybe enable on window 'raise'
If a MetaWindow's 'appears-focused' state changed to true, but the
window did not have pointer focus, the constraint did not enable. Thus,
make it possible for the user to also click the window to enable it.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:29:22 +08:00
Jonas Ådahl
517078d142 MetaWaylandPointerConstraint: Disable if 'appears-focused' is false
Disable a constraint if the associated MetaWindow's 'appears-focused'
state changed to false.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:27:43 +08:00
Jonas Ådahl
1c94d0e598 MetaWaylandPointerConstraint: Require 'appears-focused' to enable
Instead of relying on the keyboard focus surface, use the
'appears-focused' state of the corresponding MetaWindow to determine if
a constraint should enable or not.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:26:53 +08:00
Jonas Ådahl
b04747b174 MetaWaylandPointerConstraint: Unset is_enabled state when disabling
If we don't set the is_disabled state to FALSE when disabling,
re-enabling will fail.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:26:53 +08:00
Jonas Ådahl
6396974eae MetaWaylandPointerConstraint: Use own 'appears-focused' signal handler
Instead of having MetaWindowWayland having hooks into pointer
constraints subsystem, have the pointer constraints subsystem listen
for the signal itself and enable/disable itself.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:26:53 +08:00
Jonas Ådahl
20908b9c2c MetaWaylandPointerConstraint: Make per surface state a quark
Make the per surface pointer constraint related state (list of
constraints on given surface) a quark managed from the pointer
constraints unit.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:24:28 +08:00
Jonas Ådahl
4abfb299e2 MetaWaylandPointerConstraint: Use NULL for infinite region
Instead of having a very large region represent an infinitely large
region, use NULL, and use the calculated input region from the
MetaWaylandSurface if the constraint region was not set.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
2016-03-09 14:24:28 +08:00