Compare commits

...

209 Commits

Author SHA1 Message Date
Florian Müllner
ceae5dceea Bump version to 3.19.91
Update NEWS.
2016-03-03 14:58:20 +01:00
Yosef Or Boczko
d694244f29 Updated Hebrew translation 2016-03-03 14:40:05 +02:00
Stas Solovey
c52f716115 Updated Russian translation 2016-03-03 10:53:12 +00:00
Daniel Mustieles
800c0c277e Updated Spanish translation 2016-03-02 21:37:17 +01:00
Aurimas Černius
ae3fad7155 Updated Lithuanian translation 2016-03-02 20:23:27 +02:00
Fran Dieguez
1e0abc5279 Updated Galician translations 2016-03-02 09:49:38 +01:00
Carlos Garnacho
1a3653765c wayland: Close primary selection fd after gtk_primary_selection_source.send
We leak the fd otherwise.
2016-03-01 21:07:56 +01:00
Dušan Kazik
f0b8dadb7d Updated Slovak translation 2016-03-01 19:41:13 +00:00
Jonas Ådahl
d340c3a6dd wayland: Don't unset surface->buffer when wl_buffer destroyed
Don't unset the surface->buffer if the associated wl_buffer object is
destroyed. The MetaWaylandBuffer doesn't really only represent a
wl_buffer object, but also the data (texture) created from the given
wl_buffer. Thus, for example destroying a released SHM wl_buffer should
not destroy the MetaWaylandBuffer instance, because the texture may
still be used.

This commit also fixes a race where calc_showing would hide a window
because, at the time of calculation whether it should be showing, the
surface's buffer had been destroyed as described above.

https://bugzilla.gnome.org/show_bug.cgi?id=762716
2016-03-01 13:33:13 +08:00
Carlos Garnacho
43bd057754 wayland: Ensure harder we're dealing with DnD offers/sources
In destroy_data_offer() there is code to ensure compatibility when
dragging from a v3 wl_data_device to a v2 one, it's however not checking
correctly that this is the DnD drag source. The other path should be
used otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=762878
2016-02-29 19:55:55 +01:00
Carlos Garnacho
66be0387ee wayland: Use separate destructor for the gtk_primary_selection_offer
Things don't mix well if we use the same destructor than wl_data_offer,
Use a separate destructor with no DnD paths whatsoever.

https://bugzilla.gnome.org/show_bug.cgi?id=762878
2016-02-29 19:55:55 +01:00
Mario Blättermann
837836a722 Updated German translation 2016-02-28 19:17:12 +01:00
Cédric Valmary
2c71a35b4c Updated Occitan translation 2016-02-28 16:26:09 +00:00
Marek Černocký
d3537c4dc6 Updated Czech translation 2016-02-27 18:38:00 +01:00
Carlos Garnacho
7c114360d0 wayland: Implement the (so far internal) primary selection protocol
Add an additional MetaWaylandDataSource implementation for primary selection
sources, and methods to set primary selection offers. Primary selection
sets altogether a different channel than the clipboard selection, those don't
cross in any way.

Also, the bridge for the X11 PRIMARY selection atom has been added, which
adds all the necessary handling to translate primary selection both ways
with wayland and X11 applications.

https://bugzilla.gnome.org/show_bug.cgi?id=762560
2016-02-26 19:51:32 +01:00
Carlos Garnacho
c6aad6e735 wayland: Add gtk-primary-selection protocol
This protocol is an internal mirror of the primary selection drafts
being proposed for wayland-protocols. No changes besides prefix/suffix
changes.

https://bugzilla.gnome.org/show_bug.cgi?id=762560
2016-02-26 19:51:32 +01:00
Carlos Garnacho
741dd674f6 backends: rate-filter the emission of MetaBackend::last-device-changed signal
It indirectly triggers expensive operations in gnome-shell
(js/ui/keyboard.js), which turns out too expensive if we happen to operate
the shell simultaneously with 2 devices that will trigger the operations
there.

So just rate limit the signal emission, defer to an idle and just emit
the last device gotten. Worst that will happen is that we may possibly
emit the signal on the same device consecutively.

https://bugzilla.gnome.org/show_bug.cgi?id=753527
2016-02-26 16:19:15 +01:00
Jonas Ådahl
821d737e2c tests: Test scheduling a later MetaLater from a later callback works
The added test tests for the bug fixed by "MetaLater: Invoke later
callbacks queued by earlier ones".

https://bugzilla.gnome.org/show_bug.cgi?id=755605
2016-02-26 17:52:01 +08:00
Jonas Ådahl
35da6a9078 MetaLater: Invoke later callbacks queued by earlier ones
If a MetaLater callback queued another MetaLater with a scheduling
later than the one currently being invoked, make it so that the newly
scheduled callback will actually be invoked.

The fact that it doesn't already do this is a regression from
cd7a968093.

https://bugzilla.gnome.org/show_bug.cgi?id=755605
2016-02-26 17:52:01 +08:00
Jonas Ådahl
00139755ff tests: Add unit tests framework runner
Separate from meta-test-runner which runs metatests testing window
manager operations, a new test program (mutter-unit-tests) is
introduced. This is meant to run unit test like tests on various units
in mutter.

An initial test testing the order of MetaLater callback invokation was
added.

https://bugzilla.gnome.org/show_bug.cgi?id=755605
2016-02-26 17:52:01 +08:00
Artur de Aquino Morais
95dd681d47 Updated Brazilian Portuguese translation 2016-02-25 17:24:12 +00:00
Piotr Drąg
2e5c8b3f11 Updated Polish translation 2016-02-25 17:33:12 +01:00
Jonas Ådahl
ad7e654a8b MetaWaylandPointerConstraint: Don't expose internal function
It was exposed via meta-wayland-pointer-constraints.h for no apparent
reason.
2016-02-25 11:47:17 +08:00
Jonas Ådahl
b01926dbfa MetaWaylandPointerConstraint: Ignore requests on defunct resource
The constraint may be destroyed before the client destroyes the
protocol object, for example if a oneshot constraint was disabled by
alt-tab. Therefore we need to NULL check the constraint in request
handlers and ignore any requests to defunct objects.
2016-02-25 11:32:20 +08:00
Jonas Ådahl
5001aa76d7 MetaWaylandPointerConstraint: Remove redundant typedef 2016-02-25 11:32:20 +08:00
Jonas Ådahl
f1730e488d MetaWaylandPointerConstraint: Remove unused function 2016-02-25 11:32:20 +08:00
Jonas Ådahl
c22bee19e1 Add --nested command line argument
As of "core: start as wayland display server when
XDG_SESSION_TYPE=wayland" it is no longer possible to run a nested
mutter Wayland session on top of another Wayland session. This patch
adds a command line argument to make it possible to force mutter to
start as a nested compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=758658
2016-02-22 17:03:07 +08:00
Tim Lunn
7fe2873750 build: Require clutter-1.0 >= 1.25.6
Needed since 5b0eabec51
2016-02-21 08:42:59 +11:00
Florian Müllner
d6e32a6ac5 Bump version to 3.19.90
Update NEWS.
2016-02-19 18:02:23 +01:00
Carlos Garnacho
3f60a2e48a wayland: Implement gtk-shell v3
Implement the gtk_shell.set_startup_id request, so that the ID is
removed from the sequences list, and feedback updated accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=762268
2016-02-19 17:41:03 +01:00
Carlos Garnacho
3729e592a6 wayland: Update gtk-shell protocol file to v3
Add a gtk_shell.set_startup_id request, so the application can communicate
to the compositor the startup id that it received through the
DESKTOP_STARTUP_ID envvar, or other means.

https://bugzilla.gnome.org/show_bug.cgi?id=762268
2016-02-19 17:41:03 +01:00
Carlos Garnacho
56beedf9f2 core: Refactor startup notification into a separate object
This is kind of in a middle ground at the moment. Even though it
handles sequences not coming from libsn, they're added nowhere at
the moment, we'll rely on the app launch context being in the x11
side at the moment.

Also, even though we do create internal sequence objects, we keep
exposing SnStartupSequences to make gnome-shell happy, we could
consider making this object "public" (and the sequence objects with
it), things stay private at the moment.

https://bugzilla.gnome.org/show_bug.cgi?id=762268
2016-02-19 17:41:03 +01:00
Ray Strode
bed82427c6 wayland: change accessible boolean to use_count counter
Since a buffer can be used by multiple surfaces at once,
we need to release the buffer only after all surfaces
are finished with it.  Currently we track whether or
not to release the buffer based on the accessible boolean.
This commit changes it to a counter to accomodate multiple
users.

Also, each surface needs to know whether not it is done with
the buffer, so this commit adds a buffer_used boolean to the
surface state.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-19 08:57:56 -05:00
Ray Strode
e097bc8353 wayland: get rid of buffer->copied_data boolean
We currently track whether or not a buffer can be released early
by looking at the copied_data boolean on the buffer.  This boolean
is, practically speaking, always set to TRUE for shm buffers and is
always false otherwise.

We can just as easily check if the buffer is a shm buffer to decide
whether or not to do an early release.  That's better from a
theoretical point of view since copied_data assumes a 1-to-1
relationship between surface and buffer, which may not actually hold.

This commit drops copied_data and changes the check to instead see
if the buffer is shm.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-19 08:57:56 -05:00
Olivier Fourdan
4e82a751fb window: check for possible loop in transients
If a broken or naughty application tries set up its windows to create
a loop in the transient relationship, mutter will hang, looping forever
in meta_window_foreach_ancestor()

To avoid looping infinitely at various point in the code, check for a
possible loop when setting the transient relationship and deny the
request to set a window transient for another if that would create a
loop.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759299
2016-02-18 09:03:56 +01:00
Ray Strode
acd50508dc wayland: return from toplevel commit early if no new buffer
meta_wayland_surface_toplevel_commit has a lot of logic to handle
a new buffer getting attached as part of the commit.  None of
that code needs to run if there is no new buffer attached.

This commit short-circuits that case.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-17 16:16:07 -05:00
Jonas Ådahl
9611661154 native: Don't wait for a new input event to wrap the pointer
If we rely on getting back an input event with the warped pointer
coordinates, we might draw a frame with the old coordinates if we warp
during the paint phase. Avoid that by moving the cursor immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
a70a2c3744 MetaPointerConfinementWayland: Support non-rectangular confinement regions
This patch adds support for confinement regions that are more complex
than a single rectangle. It relies on details about cairo regions not
explicitly in the API in order to generate the outer border of the
region.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
bc47b19c3f wayland: Use the event coordinates when sending pointer motion events
The x/y coordinates of the ClutterInputDevice were not the ones which was
the result of this event but whatever event was queued the last. The
correct coordinates can, however, be found in the event itself, so lets
use those.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
bc1dd1cee4 MetaBorder: Use float constants and functions instead of double variants
We calculate with floats, so lets use that type throughout.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
495c89401a Implement support for the wp_pointer_constraints protocol
The wp_pointer_constraints protocol is a protocol which enables clients
to manipulate the behavior of the pointer cursor associated with a seat.

Currently available constraints are locking the pointer to a static
position, and confining the pointer to a given region.

Currently locking is fully implemented, and confining is implemented for
rectangular confinement regions.

What else is lacking is less troublesome semantics for enabling the lock
or confinement; currently the only requirement implemented is that the
window that appears focused is the one that may aquire the lock.

This means that a pointer could be 'stolen' by creating a new window that
receives active focus, or when using focus-follows-mouse, a pointer
passes a window that has requested a lock. This semantics can be changed
and the protocol itself allows any semantics as seems fit.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
e2efc85b08 wayland: Make the pending surface state a GObject
Making the pending state an GObject makes it easier to extend it with
additional optional state without putting everything inside one big
struct.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
020ae58fe4 wayland: Add "painting" signal to surface actor
Make MetaWaylandSurface a listener and move output state updating to
the handler function.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
525644059d native: Update to new constrain callback API
https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
f0f638d2bd Move out generic math parts out of the native barrier implementation
In order to reuse some vector math for pointer confinement, move out
those parts to its own file, introducing the types old types
"MetaVector2" and "MetaLine2" outside of meta-barrier-native.c, as well
as introducing MetaBorder which is a line, with a blocking direction.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
bc8ec2d90d wayland: Add global to surface coordinate helper
https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:47 +08:00
Jonas Ådahl
5b0eabec51 wayland: Implement support for wp_relative_pointer
Add support for sending relative pointer motion deltas to clients who
request such events by creating wp_relative_pointer objects via
wp_relative_pointer_manager.

This currently implements the unstable version 1 from wayland-protocols.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:47 +08:00
Ray Strode
50099c4c10 wayland: use glib function for fetching timestamp
The code currently implements a function, get_time, that
fetches a timestamp.  That duplicates code already in glib,
and the glib implementation is better, anyway, since it doesn't
skew backward when the system clock is changed.

This commit changes the code to use g_get_monotonic_time and
drop the get_time function.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-08 17:01:58 -05:00
Rui Matos
55eef2deb3 cursor-renderer-native: Re-use cogl's gbm device
Instancing a gbm device without initializing EGL with it means that it
won't be able to import wl_drm buffers. Instead, let's re-use cogl's
gbm device which is already properly initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=761557
2016-02-04 18:22:05 +01:00
Florian Müllner
f9db65f47f theme: Take invisible borders required by the theme into account
GTK+ paints some elements like box shadows (which Adwaita likes to (ab)use
for borders) outside the rectangle passed to gtk_render_*. This is not
an issue if our own invisible frame border is big enough, but in case
of non-resizable windows we end up clipping away part of the decoration.
Use the newly added gtk_render_background_get_clip() to make sure we
always use a mask that is large enough to contain all decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=752794
2016-02-04 15:16:26 +01:00
Florian Müllner
a809055470 theme: Update style context hierarchy (again)
GtkWindow actually uses two CSS nodes, 'window' and 'decoration'.
Simulate that by using two separate style contexts for the frame.
2016-02-04 15:13:23 +01:00
Alberts Muktupāvels
247909e161 frames: don't force dark theme to all windows
Use global theme variant only if window does not have _GTK_THEME_VARIANT
property. This allows applications to request default theme variant when
global dark theme is enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=761543
2016-02-04 16:02:21 +02:00
Alberts Muktupāvels
e5ce6192f4 frames: default theme variant now is set as empty string
Related change in GTK+:
https://git.gnome.org/browse/gtk+/commit/?id=8eb261988869608604c78ed90de5579beb4ef2b0

https://bugzilla.gnome.org/show_bug.cgi?id=761543
2016-02-04 15:54:26 +02:00
Ray Strode
7adbb58736 wayland: don't prematurely release EGL buffers
commit 0165cb6974 changed
mutter to release committed shm buffers as soon as they were
uploaded to the GPU.

It also inadvertently changed mutter to prematurely
release EGL buffers (which never get copied, but get used
directly).

This commit corrects that mistake.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-02 11:15:43 -05:00
Ray Strode
0165cb6974 wayland: release buffer after processing commit
When a client is ready for the compositor to read a surface's
shared memory buffer, it tells the compositor via
wl_surface_commit.

From that point forward, the baton is given to the compositor:
it knows it can read the buffer without worring about the client
making changes out from under it.

After the compositor has uploaded the pixel contents to the video
card it is supposed to release the buffer back to the client so that
the client can reuse it for future use.

At the moment, mutter only releases the buffer when a new buffer
is attached.  This is problematic, since it means the client has
to have a second buffer prepared before the compositor gives the
first one back.  Preparing the second buffer potentially involves
copying megabytes of pixel data, so that's suboptimal, and there's
no reason mutter couldn't release the buffer earlier.

This commit changes mutter to release a surface's buffer as soon
as it's done processing the commit request.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-01 14:16:17 -05:00
Rui Matos
3cdcd3e9c1 meta-launcher: Use g_auto* macros
This fixes a couple of minor memory leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-25 13:59:53 +01:00
Jasper St. Pierre
6fc51e3723 window-x11: Fix checks for a bounding region input region
When cleaning up the logic in commit c408cf7, I forgot to properly apply
de Morgan's laws to an inverse.

Reported by ricotz on IRC.
2016-01-22 18:28:47 -08:00
Florian Müllner
af45a50cb1 Bump version to 3.19.4
Update NEWS.
2016-01-21 23:04:22 +01:00
Florian Müllner
72d6efc0d5 Shut up some compiler warnings 2016-01-21 23:04:22 +01:00
Florian Müllner
e0ffef06dd theme: Support margins on titlebar title/buttons
GTK+ improved its CSS support, and the default theme started to make
use of it, so we must update our theming code accordingly. Add support
for margins where they make sense.
2016-01-21 23:04:22 +01:00
Florian Müllner
d5b69bcd54 theme: Consider minimum sizes
GTK+ improved its CSS support, and the default theme started to make
use of it, so we must update our theming code accordingly. Start by
supporting min-width/min-height where it makes sense.
2016-01-21 23:04:22 +01:00
Rui Matos
ac8fe2d9b2 cursor-tracker: Port to GdkSeat API 2016-01-21 14:07:50 +01:00
Marek Chalupa
e7a88dc6b2 meta-launcher: don't call g_object_unref() on NULL
g_object_unref() was called no matter what we got for value

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-21 14:06:41 +01:00
Jonas Ådahl
bcdda506e1 MetaWaylandDataDevice: Don't set surface offset as anchor offset
Since we are using the surface actor to draw the DND icon, the offset
is already accounted for by MetaSurfaceActorWayland, and passing the
surface position offset would effectively double the actual offset,
causing the icon to be misplaced.

This patch always sets the anchor offset to (0, 0) when the icon is a
Wayland surface, and lets the surface actor deal with the offsetting.

https://bugzilla.gnome.org/show_bug.cgi?id=759222
2016-01-19 14:32:34 +01:00
Carlos Garnacho
9b26694bbc wayland: Implement DnD actions as per wl_data_device v3 changes
We now additionally send:
  - wl_data_offer.source_actions
  - wl_data_source.action
  - wl_data_offer.action
  - wl_data_source.dnd_drop_performed
  - wl_data_source.dnd_finished

The protocol changes allow for compositors to implement different policies
when chosing the action, mutter uses this to reimplement the same behavior
that GTK+ traditionally had:

  - Alt/Control/Shift modifiers change the chosen action to
    ask/copy/move respectively
  - Drags with middle button start out as "ask" by default

As mutter now also grabs the keyboard and unsets the window focus for these
purposes, the window focus is restored after the drag operation has
finished.

The Xdnd bridge code is also modified to cope with actions, so mixed
wayland-x11 scenarios are able to convey that information.

https://bugzilla.gnome.org/show_bug.cgi?id=760805
2016-01-19 13:55:33 +01:00
Carlos Garnacho
f053c09083 data-device: Refactor data source management by the drag grab
Move to a separate meta_wayland_drag_grab_set_source() so we keep
the weak pointer management in a single place.

https://bugzilla.gnome.org/show_bug.cgi?id=760805
2016-01-19 13:45:56 +01:00
Carlos Garnacho
ec9abaf1ef wayland: Add MetaWaylandKeyboardGrab and keyboard grab API
This will be useful during DnD, where mutter is expected to consume
keyboard events for either allowing changes in the selected DnD action,
or misc a11y features like keyboard-driven DnD.

Currently, the vtable contains 2 functions, key() will be used on every
key event we get from Clutter, modifiers() will notify of changes in the
keyboard modifiers (mouse buttons will never be set in the modifier mask)

https://bugzilla.gnome.org/show_bug.cgi?id=760805
2016-01-19 13:45:56 +01:00
Carlos Garnacho
6b88420465 wayland: Add "update" vfunc to MetaWaylandDragDestFuncs
This will be useful when an update is due but no motion event is to be
sent/received (eg. modifier changes during DnD).

https://bugzilla.gnome.org/show_bug.cgi?id=760805
2016-01-19 13:45:56 +01:00
Carlos Garnacho
fc0a834abb wayland: Emit wl_pointer.frame after .enter in pointer resource creation
This place was missing concordance with wl_pointer v5.
2016-01-19 11:51:36 +01:00
Carlos Garnacho
e30010b9f0 wayland: Rename meta_wayland_pointer_send_frame() to broadcast_frame
It's closer to what we mean here. And we can have a send_frame() helper
that does this for a single wl_resource.
2016-01-19 11:50:27 +01:00
Carlos Garnacho
935d76ba04 wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
As per the spec:
- wl_pointer.axis_source determines the current source of
  scroll events.
- wl_pointer.axis_stop determines when there's no further
  scroll events on the given axis.
- wl_pointer.axis_discrete is emitted on "wheel"
  scroll sources, measured in ticks.
- wl_pointer.frame is meant to coalesce events that logically belong
  together, e.g. axis events in this case.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>

https://bugzilla.gnome.org/show_bug.cgi?id=760637
2016-01-14 19:27:48 +01:00
Aurimas Černius
cc013e1daa Updated Lithuanian translation 2016-01-12 22:35:05 +02:00
Sebastian Keller
a7a376ae1f xprops: Null-terminate property reply values
Some of the mutter code using these properties expects them to be
null-terminated whereas xcb does not use null-terminated strings:

http://xcb.freedesktop.org/XcbRationale/

This was in some cases resulting in the WM_CLASS property containing
garbage data which broke application matching, caused the hot-corner and
window-switcher to stop working, or was exposed as text in the UI.

https://bugzilla.gnome.org/show_bug.cgi?id=759658
2016-01-12 16:30:30 +01:00
Rui Matos
5e57af6286 idle-monitor-native: Don't leak user active watches
This fixes an issue analogous to bug 760330 for the X11 backend,
except on this backend we wouldn't crash accessing free'd memory.

Instead we're leaking watches since we steal them from the hash table
which means that when they're removed in
_meta_idle_monitor_watch_fire() they're no longer there and thus
they're never free'd.

https://bugzilla.gnome.org/show_bug.cgi?id=760476
2016-01-11 11:23:54 -05:00
Ray Strode
42b3a34f7b idle-monitor-xsync: fix crash if watch callback removes different watch
Right now the XSync based idle monitoring code, will fetch all active
watches into a list, and then call their watch callbacks one by one
as necessary.  If one watch callback invalidates another watch, the
list will contain free'd memory.

This commit makes sure to consult the hash table after ever call
of a watch callback, to ensure mutter never looks at freed memory.

Fixes crash reported on IRC by Laine Stump with his synergy setup.

https://bugzilla.gnome.org/show_bug.cgi?id=760330
2016-01-11 11:23:39 -05:00
Rui Matos
19d814c887 cursor-renderer-native: Avoid a crash if we fail to allocate a gbm bo
https://bugzilla.gnome.org/show_bug.cgi?id=758613
2016-01-11 14:31:42 +01:00
Florian Müllner
46eb682c83 Revert "window: Remove old tiling code"
This reverts commit 8bded7d497.
2016-01-10 15:16:09 +01:00
Florian Müllner
3aea8d8ce6 Revert "Add "size states" which save window size information"
This reverts commit 2c7ef2269f.
2016-01-10 15:16:09 +01:00
Florian Müllner
40c3c69435 Revert "window: Add new tiling code"
This reverts commit 50e3e3b929.
2016-01-10 15:16:08 +01:00
Florian Müllner
8071e5b149 Revert "frame: Don't allow resizing of edges that are constrained"
This reverts commit 8a481b3e10.
2016-01-10 15:16:06 +01:00
Jasper St. Pierre
8a481b3e10 frame: Don't allow resizing of edges that are constrained
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:11:15 -08:00
Jasper St. Pierre
50e3e3b929 window: Add new tiling code
The new tiling code, instead of based around "tiling states", is instead
based around constrained edges. This allows us to have windows that have
three constrained edges, but keep one free-floating, e.g. a window tiled
to the left has the left, top, and bottom edges constrained, but the
right edge can be left resizable.

This system also is easily extended to support corner tiling. We also,
using the new "size state" system, also keep normal, tiled, and
maximized sizes independently, allowing the maximize button to bounce
between maximized and tiled states without reverting to normal in
between. Dragging from the top will always restore the normal state,
though.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:09:30 -08:00
Jasper St. Pierre
2c7ef2269f Add "size states" which save window size information
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:08:35 -08:00
Jasper St. Pierre
8bded7d497 window: Remove old tiling code
We'll soon replace this with a better scheme

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:08:32 -08:00
Jasper St. Pierre
9ebe3419c3 monitor-manager-xrandr: Don't query legacy properties
This never could have worked -- the Atom name it was querying was a root
window property, not an output property.
2016-01-09 18:06:18 -08:00
Rui Matos
9385c835b8 native: Don't leak DRM plane resources 2016-01-07 19:42:19 +01:00
Carlos Garnacho
efef0c993b native: Implement DRM-based crtc rotation
We can know the rotation modes supported by the driver, so
export these as our supported modes, and ensure these modes
are honored on the CRTC primary plane upon apply_configuration().

It is worth noting however that not all hardware will be
capable of supporting all rotation modes (in fact, most of
them won't). A driver independent solution should be in
place to back up the rotation modes unsupported by the
drivers, so this is still a partial solution.

The cursor renderer has also been changed to default to
software-based rendering anytime the cursor enters a
rotated CRTC. Another solution would be actually rotating
the DRM cursor planes, but then it requires applying rotation on
these per-CRTC, and actually transforming the pointer position by
the output matrix. This brings marginal gains, so we use the
"sw" rendered cursor, which will be transformed together with
the primary plane.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-01-07 17:03:44 +01:00
Rui Matos
3a2cd3389a window: Re-evaluate window visibility when making it transient
In case a window is hidden when we're ordered to make it transient to
a different parent we must re-evaluate its visibility status or we'll
get into an inconsistent state where the parent is visible and the
child isn't.

https://bugzilla.gnome.org/show_bug.cgi?id=759297
2016-01-06 18:56:07 +01:00
Rui Matos
88acfb8e60 window: Focus windows on button press regardless of modifier state
This seems like a more generally useful and intuitive behavior. Note
that, in X sessions, this is what already happened in practice since
meta_display_begin_grab_op() calls meta_window_grab_all_keys() which,
on X11, does meta_window_focus().

https://bugzilla.gnome.org/show_bug.cgi?id=756789
2016-01-05 20:42:05 +01:00
Rui Matos
8e22dce5d7 window: Remove a spurious meta_verbose()
This was duplicated here by mistake in the big re-work commit
7a109a18af .

https://bugzilla.gnome.org/show_bug.cgi?id=756789
2016-01-05 20:42:04 +01:00
Rui Matos
e0906a77aa ui/frames: Don't focus if the button press is on the client area
This is a really old behavior introduced in commit
585e362526 which is inconsistent since
it only applies to SSD windows.

If we really want this, we should focus the window elsewhere so that
it applies consistently to all windows.

https://bugzilla.gnome.org/show_bug.cgi?id=756789
2016-01-05 20:42:02 +01:00
Jasper St. Pierre
053f5088df window-x11: Fix unredirection for windows that explicitly set bounding
Some applications, like Chromium, explicitly set their bounding region
to the client area when full-screen. Detect this case, and allow us to
fullscreen when this happens.
2016-01-04 08:32:09 -08:00
Jonas Ådahl
75b992c7d0 tests: Add test for testing that setting a parent affects the stack
A new test is added that tests that xdg_surface.set_parent (referred to
as "transient for" in X11 terminology) affects the stack immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=755606
2015-12-23 14:59:36 +08:00
Jonas Ådahl
213f0fa160 window: Update the stack after setting the transient_for field
Don't update the stack until after setting the window->transient_for
field. Updating before will cause the stack transient-for constraint to
be missing until the next time constraints are applied.

https://bugzilla.gnome.org/show_bug.cgi?id=755606
2015-12-23 14:59:36 +08:00
Jonas Ådahl
5054b2a99c tests: Don't rely on latency for actually showing Wayland windows
The test runner sends a "show" command to the test clients and assumes
this was enough work done by the client to enable the compositor to map
the window. Now that we wait to show a Wayland window until the first
buffer is attached (see bug 750552), we need to make sure that we attach
a buffer before assuming that we have the final stacking order.

So, to in order to continue relying on "show" to be enough to actually
show a window, let the test client wait until it has drawn the first
frame.

This makes the tests using Wayland clients test non-flaky.

https://bugzilla.gnome.org/show_bug.cgi?id=754711
2015-12-23 12:19:36 +08:00
Florian Müllner
d455de32a0 Bump version to 3.19.3
Update NEWS.
2015-12-17 01:21:40 +01:00
Rui Matos
e7390cff83 x11/window: Ensure we send a ConfigureNotify to just mapped windows
When managing a non-OR window we're required by the ICCCM to behave as
if we received a ConfigureRequest which means that we must generate a
synthetic ConfigureNotify even if the window isn't moved or resized
from its current (initial) geometry.

During MetaWindow's x11/wayland split a slight behavior change for x11
windows crept in. Before the code split, MetaWindow->rect was
initialized with the X window's geometry, but now we're not
initializing MetaWindowX11Private->client_rect which causes the checks
for whether it's necessary to move/resize the window in
meta_window_x11_move_resize_internal() to tell us that we do need to
move/resize which means we do an XConfigureWindow() call and don't
send the sythetic ConfigureNotify. But since the X window isn't really
moving, the XConfigureWindow() call doesn't cause the X server to
generate a ConfigureNotify which breaks some clients such as Java's
AWT.

We can fix this by setting MetaWindowX11Privatew->client_rect for both
OR and non-OR windows. We can set buffer_rect for non-OR windows as
well to simplify the code since it will be assigned the correct value
in meta_window_x11_move_resize_internal() .

https://bugzilla.gnome.org/show_bug.cgi?id=759492
2015-12-16 19:46:41 +01:00
Marek Chalupa
49ea6486e2 wayland: bind wayland socket after xwayland is initialized
During xwayland initialization we run main loop and dispatch wayland
events, so that xwayland can initialize. If some client during this
phase connects and creates surface, mutter crashes because
it is not initialized yet. If we bind wayland socket after xwayland
is initialized and main loop is not running anymore, no client can
connect to mutter during initialization and that is what we want.

https://bugzilla.gnome.org/show_bug.cgi?id=751845
2015-12-15 15:49:13 +01:00
Bastien Nocera
996aeaef41 backends: Fix cut'n'paste error in click method setting
GDesktopTouchpadScrollMethod was used instead of GDesktopTouchpadClickMethod
which became visible now that the former has been removed from
gsettings-desktop-schemas.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:41:51 +01:00
Bastien Nocera
a27b2597b9 backends: Force 2-finger scroll by default if available
When the touchpad is two-finger scrolling capable, always enable it.

When the touchpad only supports edge scrolling (usually older devices, and
usually smaller devices), allow disabling the edge scrolling.

This requires a newer gsettings-desktop-schemas as the scroll-method key
was removed, and the edge-scroll-enabled key added.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:38:23 +01:00
Lionel Landwerlin
0e8ca1a042 default-plugin: port to non deprecated API
https://bugzilla.gnome.org/show_bug.cgi?id=759374
2015-12-15 08:39:57 +00:00
Jasper St. Pierre
f5f26c9cff Update .gitignore 2015-12-14 15:17:40 -08:00
Jasper St. Pierre
91ac69382d wayland: Fix up touch coordinates on HiDPI 2015-12-14 14:52:23 -08:00
Jasper St. Pierre
8cc345fcf5 window: Allow minimizing windows which don't advertise support for it
Wine removes the minimize func from its Motif hints on full-screen
windows, because, as the Win32 API literally says, the minimize button
is indeed not visible on full-screen windows.

Given that this code was added to prevent minimizing a panel by
accident, I don't necessarily think that it's relevant anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=758186
2015-12-05 10:46:21 -08:00
Carlos Garnacho
96b5042dda core: Unset "pointer emulating" sequence lazily
Unsetting it in meta_display_handle_event() will make the pointer
emulation checks fail on TOUCH_END event handlers across clutter
actors, the sequence should still be considered as pointer emulating
at that time.

As we don't have a way to hook this post clutter event handling,
instead unset/reset it lazily on the next pointer emulating TOUCH_BEGIN
event, the checks would already fail on other sequences, even if the
pointer emulating touch ended earlier. The only extra thing we need
to take care about is sequence collision, at which point it's safe to
just unset the stored sequence if its new incarnation isn't flagged/
deemed as pointer emulating.

https://bugzilla.gnome.org/show_bug.cgi?id=756754
2015-12-04 11:47:01 +01:00
Jonas Ådahl
428c687b5a wayland: Clean up wl_pointer_send_enter/leave code
Be consistent and always use a helper, and fix the naming so
broadcast means to actually broadcast.

https://bugzilla.gnome.org/show_bug.cgi?id=755503
2015-12-03 16:11:37 +08:00
Rui Matos
82bdd1e353 monitor-manager: Fix the max potential number of logical monitors
The max potential number of logical monitors (i.e. MetaMonitorInfos)
is the number of CRTCs, not the number of outputs.

In cases where we have more enabled CRTCs than connected outputs we
would end up appending more MetaMonitorInfos to the GArray than the
size it was initialized with which means the array would get
re-allocated rendering invalid some MetaCRTC->logical_monitor pointers
assigned previously and thus ending in crashes later on.

https://bugzilla.gnome.org/show_bug.cgi?id=751638
2015-11-29 19:15:37 +01:00
Marek Chalupa
4bebc5e5fa cursor-renderer: do not update cursor if it is out of monitor
if the cursor coordinates are out of monitor, just don't render the
cursor

https://bugzilla.gnome.org/show_bug.cgi?id=756698
2015-11-29 19:15:23 +01:00
Jonas Ådahl
be5643cee7 wayland: Use xdg shell protocol from wayland-protocols
Use the xdg_shell XML file installed by wayland-protocols instead of
our own copy. This protocol has yet to go through any unstable naming,
but since we had an outdated (though wire compatible) version, some
minor changes were needed.

https://bugzilla.gnome.org/show_bug.cgi?id=758633
2015-11-26 16:55:35 +08:00
Jonas Ådahl
2ee1c5fa61 wayland: Use pointer gestures protocol from wayand-protocols
Remove our own copy of the pointer gestures protocol, and us the one
installed by wayland-protocols. This also means the new fixed unstable
naming conventions are used for the new version of the protocol, which
is reflected in the change. No functional changes were made, it is only
a rename.

https://bugzilla.gnome.org/show_bug.cgi?id=758633
2015-11-26 16:55:35 +08:00
Carlos Garnacho
c625d2ee9d core: Make meta_window_handle_ungrabbed_event() touch-aware
This fixes the effects of this function on touchscreens in wayland
(most notably, window raising & focusing).
2015-11-25 18:00:36 +01:00
Carlos Garnacho
3078f70f90 wayland: Fetch keyboard event codes from ClutterEvents
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.

https://bugzilla.gnome.org/show_bug.cgi?id=758239
2015-11-25 18:00:36 +01:00
Carlos Garnacho
7309b20c25 wayland: Fetch pointer button event codes from the ClutterEvent
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.

Additionally, the fallback switch{} that transforms clutter 1-indexed
buttons into input.h event codes had to be adapted to the change introduced
in clutter commit 83b738c0e, where the 4-7 button range is kept clear for
compatibility with the X11 backend.

https://bugzilla.gnome.org/show_bug.cgi?id=758239
2015-11-25 17:56:51 +01:00
Daniel Stone
c16a5ec1cf KMS/Wayland: Correct refresh rate units
On the wire, Wayland specifies the refresh rate in milliHz. Mutter sends
the refresh rate in Hz, which confuses clients, e.g. weston-info:
interface: 'wl_output', version: 2, name: 4
	mode:
		width: 2560 px, height: 1440 px, refresh: 0 Hz,
		flags: current preferred
interface: 'wl_output', version: 2, name: 5
	mode:
		width: 3200 px, height: 1800 px, refresh: 0 Hz,
		flags: current preferred

and xrandr:
XWAYLAND0 connected 2560x1440+3200+0 600mm x 340mm
   2560x1440@0.1Hz   0.05*+
XWAYLAND1 connected 3200x1800+0+0 290mm x 170mm
   3200x1800@0.1Hz   0.03*+

Export the refresh rate in the correct units. For improved precision,
perform the KMS intermediate calculations in milliHz as well, and
account for interlaced/doublescan modes.

This is also consistent with what GTK+ expects:
      timings->refresh_interval = 16667; /* default to 1/60th of a second */

      /* We pick a random output out of the outputs that the window touches
       * The rate here is in milli-hertz */
      int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen,
                                                                      impl->outputs->data);
      if (refresh_rate != 0)
        timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;

Where the 'refresh_rate' given is exactly what's come off the wire.
1000000000/60000 comes out as 16667, whereas divided by 60 is ...
substantially less.

https://bugzilla.gnome.org/show_bug.cgi?id=758653
2015-11-25 15:35:25 +01:00
Florian Müllner
f3e1964362 Bump version to 3.19.2
Update NEWS.
2015-11-25 00:34:28 +01:00
Florian Müllner
9b9083180f theme: Shut up some GTK+ warnings
GTK+ started to complain when the state parameter passed to any
gtk_style_context_get*() method mismatches the context's current
state a while ago.
2015-11-24 23:46:14 +01:00
Rui Matos
7606f79a1e x11/window-props: Initialize bypass compositor hint
If a client only ever sets the hint on window creation we'd never pick
the value. Also, include override redirect windows since the hint is
relevant to them too.

https://bugzilla.gnome.org/show_bug.cgi?id=758544
2015-11-23 19:54:48 +01:00
Marek Chalupa
99c0b82b15 window: do not force placing window if it is not mapped
When managing window, we queue showing the window.
Under wayland, if we commit surface quickly enough,
the showing is unqueued and commit procedure takes care
of mapping and placing the window. In the oposite case,
queue is processed before client sets all we need and
then we have wrong size of window, which leads to broken placement.
Therefore force placement in queue only if the window should already
be mapped. If it is not mapped, we don't care where it is anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=751887
2015-11-16 10:21:09 +08:00
Alban Browaeys
ca7c1d5e02 launcher: Fix drm device detection for non pci devices
On Odroid U2 (exynos4412) the drm device is not bound to pci.
Open the detection to platform device of the drm subsystem, exclusive of
control devices.

https://bugzilla.gnome.org/show_bug.cgi?id=754911
2015-11-12 14:09:02 -05:00
Florian Müllner
4a770907c1 theme: Update style hierarchy (again)
GTK+ has updated some more widgets to use element names, so do some
catching up again ...
2015-11-12 01:04:24 +01:00
Piotr Drąg
049f1556dc Updated POTFILES.skip 2015-11-10 01:18:27 +01:00
Ray Strode
7b20d151ed data: drop mutter-wayland.desktop
It's not needed since we can automatically figure things out
based on logind.

https://bugzilla.gnome.org/show_bug.cgi?id=741666
2015-11-09 10:25:40 -05:00
Ray Strode
8ec0c99ff4 core: start as wayland display server when XDG_SESSION_TYPE=wayland
This commit gets rid of the need for --display-server and
--wayland when mutter detects that a wayland session is registered.

https://bugzilla.gnome.org/show_bug.cgi?id=741666
2015-11-09 10:25:11 -05:00
Ray Strode
cf3ee327a0 meta-backend: include stdlib.h
Otherwise build fails with missing declaration
warning for exit().
2015-11-06 23:10:41 -05:00
Owen W. Taylor
3ec3cc248d Exit, not abort, when we fail to initialize Clutter
Failing to initialize Clutter isn't something it's useful to report
into automatic bug tracking systems or get a backtrace for - in fact,
the most common case is that DISPLAY is unset or points to a
non-existent X server. So simply exit rather than calling g_error().

https://bugzilla.gnome.org/show_bug.cgi?id=757311
2015-11-06 17:03:59 -05:00
Owen W. Taylor
7fb3ecc12c MetaLauncher: Don't g_error() on failure
g_error() is the wrong thing to do when, for example, we can't find the
DRM device, since Mutter should just fail to start rather than reporting
a bug into automatic bug tracking systems. Rather than trying to decipher
which errors are "expected" and which not, just make all failure paths
in meta_launcher_new() return a GError out to the caller - which we make
exit(1).

https://bugzilla.gnome.org/show_bug.cgi?id=757311
2015-11-06 17:03:59 -05:00
Ray Strode
4c9af7267d Revert "Force cursor update after applying configuration"
This reverts commit 33150569cd.

This was a stow-a-away sitting in my local tree.
2015-11-06 16:24:34 -05:00
Ray Strode
db4355ba1e core: move backend setting to helper function
This paves the way for making the backend setting
be more automatic.

https://bugzilla.gnome.org/show_bug.cgi?id=741666
2015-11-06 16:22:40 -05:00
Ray Strode
33150569cd Force cursor update after applying configuration
The qxl kms driver has a bug where the cursor gets hidden
implicitly after a drmModeSetCrtc call.

This commit works around the bug by forcing a drmModeSetCursor2
call after the drmModeSetCrtc calls.

This is pretty hacky and won't ever go upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=746078
2015-11-06 14:26:46 -05:00
Rui Matos
af2a13ded4 monitor-manager-xrandr: Skip outputs with no crtcs
Outputs with no crtcs shouldn't happen, but if it does we should
ignore them, instead of possibly crashing later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
8b200de35a monitor-manager-xrandr: Skip outputs with no modes
If we can't find any valid modes for an output we need to unwind and
skip the output because trying to use a modeless output later will
crash us.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
57ae203aab Revert "monitor-manager-xrandr: Ignore outputs without modes"
This reverts commit 86a913d37a. It
introduced a memory leak, so we'll go for a cleaner approach.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
bff75b64be monitor-manager: Expose a few helpers to clear structs
These are useful for child classes to unwind cleanly when constructing
their structures.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Florian Müllner
8899b9da01 Bump version to 3.19.1
Update NEWS.
2015-10-29 14:56:06 +01:00
Rui Matos
76e816a14f window: Properly update window->monitor for the desktop window
We don't want to move the desktop window but we still need to update
window->monitor or otherwise we'll be left with a pointer to invalid
memory.

https://bugzilla.gnome.org/show_bug.cgi?id=757148
2015-10-27 14:33:34 +01:00
Florian Müllner
2750db2a89 theme: Set object-name on style contexts
The default theme started to use them in GTK+ commit 371f50, so
we need to update the style contexts to keep matching the style
of client-side decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=757101
2015-10-27 09:42:49 +01:00
Rui Matos
86a913d37a monitor-manager-xrandr: Ignore outputs without modes
In some cases we get outputs without any valid mode. We need to ignore
them or we'll crash later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-23 14:13:26 +02:00
Alberts Muktupāvels
2857fdbdb8 backend-x11: Ensure the Xkb group index remains properly set
Ubuntu ships a patch in the X server that makes the group switch
keybindings only work on key release, i.e. the X server internal group
locking happens on key release which means that mutter gets the
XKB_KEY_ISO_Next_Group key press event, does its XLockGroup() call
with a new index and then, on key release, the X server moves the
index further again.

We can work around this without affecting our behavior in unpatched X
servers by doing a XLockGroup() every time we're notified of the
locked group changing if it doesn't match what we requested.

https://bugzilla.gnome.org/show_bug.cgi?id=756543
2015-10-23 14:13:26 +02:00
Daniel Șerbănescu
69a7d5ff02 Updated Romanian Translation 2015-10-22 19:15:59 +02:00
Giovanni Campagna
a4f763ac3b wayland-surface: disconnect signals on destroy
Otherwise signal handlers will be called on garbage

https://bugzilla.gnome.org/show_bug.cgi?id=756548
2015-10-19 17:21:59 -07:00
Giovanni Campagna
f2afa7aa6c mutter: don't show the resize popup for 2 x 2 size increments
In a HiDPI environment, all gtk+ apps will report a 2 x 2 size
increment to avoid odd size. But that does not mean they are
resizing in cells like terminals, so they resize popup should
not be shown.

Ideally, we should ignore <= scale x scale increments, but in
practice scale is 1 or 2, and even in a lo-dpi setting a 2 x 2
increment makes little sense so let's keep the patch simple.

https://bugzilla.gnome.org/show_bug.cgi?id=746420
2015-10-19 17:21:59 -07:00
Carlos Garnacho
a5d2555196 wayland: Make it possible to trigger popups through pointer/keyboard/touch
Right now we just check the pointer serial, so the popup will be
immediately dismissed if the client passes a serial corresponding to
another input device.

Abstract this a bit further and add a meta_wayland_seat_can_popup() call
that will check the serial all input devices. This makes it possible to
trigger menus through touch or keyboard devices.

https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:52 +02:00
Carlos Garnacho
dd5a4ecdf9 wayland: Store key press/release serials on MetaWaylandKeyboard
https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:15 +02:00
Rui Matos
43a1d43f2b monitor-manager-xrandr: Be more robust when reading XRROutputInfos
We might get modes in XRROutputInfos that aren't in the
XRRScreenResources we get earlier. This always seems to be transient,
i.e. when it happens, the X server will usually send us a follow up
RRScreenChangeNotify where we then get a "stable" view of the world
again.

In any case, when these glitches happen, we end up with NULL pointers
in the MetaOutput->modes array which makes us crash later on. This
patch ensures that doesn't happen.

https://bugzilla.gnome.org/show_bug.cgi?id=756660
2015-10-16 13:57:26 +02:00
Jonas Ådahl
d6d377a447 wayland: Set the xdg_popup pointer even when not mapping
If we immediately dismiss the popup, we still need to set the
surface->xdg_popup pointer field in order for the destructor to
properly clean up the state. Not doing this may cause a crash if the
xdg_popup resource that was immediately dismissed is destoryed after
wl_surface during client destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=756675
2015-10-16 11:31:51 +08:00
Florian Müllner
ffd95c2ad5 theme: Complete removal of "fringe" titlebar button support
We have been ignoring those buttons since 3.16 after they had been
broken in the default theme for a couple of versions. As nobody
appears to miss them, it's time to remove them for good.
2015-10-16 04:13:14 +02:00
Florian Müllner
72be89dfb9 theme: Reset button style state when done drawing
We use a single style context to draw titlebar buttons, updating
its state according to each button's prelight state as necessary.
This assumes that the original state is neither ACTIVE nor PRELIGHT,
which means we need to reset the state after drawing to avoid
propagating the state of the last-drawn button.
2015-10-16 04:04:34 +02:00
Florian Müllner
2feeb57dee iconcache: Mark surfaces as dirty after changing data
This is required to tell cairo to update its cached areas.
2015-10-16 04:04:31 +02:00
Florian Müllner
9c81b718f9 Bump version to 3.18.1
Update NEWS.
2015-10-15 19:06:54 +02:00
Florian Müllner
3a63d58d9e events: Don't use XIEvent serial numbers
XInput2 uses the raw sequence number for XIEvent serials[0], which only
matches the serial number in XEvents up to 16 bits[1]. So in order to
be able to make reliable comparisons with serials from other events or
calls to XNextRequest(), always use the field from the original XEvent
rather than the XIEvent serial (at least until we can get libXi fixed).

This (partially) reverts commit 35dd1e644d.

[0] http://cgit.freedesktop.org/xorg/lib/libXi/commit?id=5d43d4914dcabb6d
[1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/XlibInt.c#n265

https://bugzilla.gnome.org/show_bug.cgi?id=756649
2015-10-15 18:50:51 +02:00
Florian Müllner
a95ae4d178 session: Fix crash when saving sticky windows
Since commit 527c53a2a0, window->workspace is set to %NULL when
the window is sticky (see comment[0]), so don't try to save the
workspace index in that case.

[0] https://git.gnome.org/browse/mutter/tree/src/core/window.c#n4307

https://bugzilla.gnome.org/show_bug.cgi?id=756642
2015-10-15 16:30:43 +02:00
Cosimo Cecchi
a692fd3808 compositor: add hooks for fullscreen and unfullscreen animations
https://bugzilla.gnome.org/show_bug.cgi?id=707248
2015-10-12 22:28:30 -04:00
Cosimo Cecchi
377ecdb864 compositor: pass correct parameter to meta_window_actor_size_change()
We were always passing the parameter for a maximize animation.
2015-10-12 15:39:51 -04:00
Owen W. Taylor
d7f544f42e META_DEBUG_STACK: Fix message about the dumped window order
A change in the code made the windows list bottom-to-top instead
of top-to-bottom, but the message printed out still said
"Top to bottom."
2015-10-12 09:52:25 -04:00
Owen W. Taylor
1ab8b854df Improve debug logging of Wayland windows
Displaying all Wayland windows with the XID of 0x0 makes it hard
to figure out what is going on ... use the recently-added
window->stamp to show Wayland windows as W1/W2/W3...
2015-10-12 09:52:25 -04:00
Owen W. Taylor
ae7aabd5de Protect against stray calls to meta_display_end_grab_op()
If end_grab_op() is called when there's a "compositor grab"
rather than a grab op is in effect, silently return.

https://bugzilla.gnome.org/show_bug.cgi?id=745785
2015-10-12 09:50:48 -04:00
Jasper St. Pierre
b975676c5d window-actor: Draw shadows around some CSD windows
Some windows, like Chromium and Steam, are technically CSD in that they
don't want a system titlebar and draw their own, but we should still
provide them with a shadow.
2015-10-07 12:09:30 -07:00
Florian Müllner
86d8c3954f theme: Stop hiding titlebar buttons in dialogs
As design patterns have evolved, dialogs that use CSD do use titlebar
buttons, so it's time to re-enable them for SSD as well.

https://bugzilla.gnome.org/show_bug.cgi?id=641630
2015-10-07 16:09:17 +02:00
Rui Matos
54557f062e xprops: Fix reading Window and XSyncCounter properties
Both Window and XSyncCounter are XIDs which on 64 bit X clients are 8
bytes wide. But the values on the wire are 32 bit so, for these types,
we always copy 4 bytes into results->prop. As such copying them out
with a cast such as *(Window *) means that we are actually reading 8
bytes which depending on whether the higher addressed 4 bytes are zero
means that sometimes this works while others it gives us a bogus
value.

https://bugzilla.gnome.org/show_bug.cgi?id=756074
2015-10-06 22:33:42 +02:00
Jonas Ådahl
130807a308 wayland: Don't pre-multiply root cursor sizes with primary monitor scale
We cannot use the XSETTINGS value for cursor theme size because
gnome-settings-daemon already multiplies it by the primary monitor's
scale.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Jonas Ådahl
e84f694668 wayland: Don't scale XWayland pointer cursor sprites
We don't have any way of knowing what the intended size of a XWayland
cursor is supposed to be, so lets do what we do with regular XWayland
surfaces and don't scale them. The result is that cursor sprites of
HiDPI aware X11 clients will show correctly, but non-aware clients may
have tiny cursor sprites.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Carlos Garnacho
b18542f2b6 wayland: Avoid resending new data offers on intra-client focus changes
Each keyboard focus change ends up calling the MetaWaylandDataDevice
counterpart, we don't need though to notify the current selection
again. In order to fix this, keep track of the current client, and
only emit the relevant signals when the focus switches to another
client.

The situations where wl_data_device.selection were emitted during
focus changes between surfaces of the same client was inocuous most
of the times, although it's prone to inducing confusing behavior
on context menu clipboard actions, as the closing menu triggers a
focus change, which triggers a whole new wl_data_offer being created
and given on wl_data_device.selection, at a time where there's already
ongoing requests on the previous data offer.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Carlos Garnacho
da0aac665f xwayland: Protect against crash on x11->wayland transfer cancellation
If the transfer is cancelled, the X11SelectionData will be cleared from
the MetaSelectionBridge, although x11_data_write_cb() was invariably
expecting it to be non-NULL.

If the write was cancelled, all the actions done in x11_data_write_cb()
are moot, so just return early. If there's other errors happening
(eg. "connection closed" if the target client happens to crash), we
should still attempt at clearing the data anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Jonas Ådahl
8b0b0cf028 MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow
When committing a toplevel surface we might no longer have a MetaWindow
associated with it. The reason may vary but some are: a popup was
dismissed, the client attached and committed a NULL buffer to a
wl_surface with the wl_shell_surface role, the client committed a
buffer to a wl_surface which previously had an toplevel window role
which extension object was destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=755490
2015-09-29 09:09:57 +08:00
Carlos Garnacho
6f64d6b0aa wayland: Check the drag focus before processing XDND dest-side messages
If the drag dest surface suddenly disappears, we may find ourselves
processing an XdndPosition message that was sent before the X11 drag
source had an opportunity to find out.

In that case mutter does know, so double check before processing the
messages.
2015-09-28 16:22:54 +02:00
Carlos Garnacho
ebeca983c7 wayland: Improve transformation of the UTF8_STRING atom to mimetype
We try to translate the atom with its corresponding mimetype both back
and forth, which actually breaks if the X11 client chose to announce the
mimetype atom. To do the translation properly, keep track on whether the
source announced the UTF8_STRING atom, and reply back with this only if
that happened.
2015-09-28 16:22:43 +02:00
Carlos Garnacho
cf88675807 wayland: Fix weak ref tracking on data sources
We may get a NULL one here, and we're wrongly attempting to remove
the old weak ref from the new data source object.
2015-09-28 16:22:32 +02:00
Carlos Garnacho
405f1ce3d0 wayland: Avoid use of struct data after destruction
data_device_end_drag_grab() will destroy the MetaWaylandDragGrab struct,
so we definitely must not use it after destruction.
2015-09-28 16:22:18 +02:00
Colin Walters
6190ae3873 window: Remove invalid (transfer) annnotations
This tripped a new g-i warning; see
https://bugzilla.gnome.org/show_bug.cgi?id=752047
2015-09-27 16:42:01 -04:00
Rui Matos
69c267b142 xwayland: Fix windows disappearing on reparenting
If the wayland surface isn't available yet when we process the
WL_SURFACE_ID ClientMessage, we schedule a later function to try the
association again after we get a chance to process wayland requests.

This works fine except on cases where the MetaWindow already had a
previous surface attached (i.e. when the xwindow is reparented) since
we only break the existing association on the later function which
means that when processing the old surface's destruction we destroy
the MetaWindow and cancel the pending later function leaving us
without a MetaWindow and an invisible surface.

Fix this by detaching the old surface as soon as possible so that the
MetaWindow survives.

https://bugzilla.gnome.org/show_bug.cgi?id=743339
2015-09-25 19:09:48 +02:00
Rui Matos
9abc071283 backend-x11: Fallback to a default keymap if getting it from X fails
This shouldn't fail but apparently sometimes it does and in that case
having a possibly wrong idea of the keymap is still better than
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=754979
2015-09-25 19:09:48 +02:00
Jonas Ådahl
a9df4bb81a wayland: Scale saved rect changing monitor scale
The saved rect is used to restore a saved window size. We need to
update this when the window is moved to a monitor with different scale,
so that if we unmaximize a window which was moved to a different
monitor while maximized (for example when unplugged) will restore to
the correct size.

https://bugzilla.gnome.org/show_bug.cgi?id=755097
2015-09-24 11:39:37 +08:00
Jonas Ådahl
bc9e63d3db wayland: Scale unconstrained rect changing monitor scale
When a window is moved across monitors with different scales, its
rectangle is scaled accordingly. We also need to scale the
unconstrained_rect rectangle, so that moving a window via
meta_window_move_resize() which uses the unconstrained_rect.

https://bugzilla.gnome.org/show_bug.cgi?id=755097
2015-09-24 11:39:37 +08:00
Florian Müllner
5b5ceede2b wayland: Fix variable declaration
Storage class always goes first.
2015-09-24 03:08:23 +02:00
Florian Müllner
4e63c95c02 testboxes: Don't avoid parameter list 2015-09-24 03:08:23 +02:00
Florian Müllner
67d3a7a2d7 meta-monitor-manager: Remove bogus condition from check
An unsigned number is never smaller than 0, so we don't have to
check for it.
2015-09-24 03:08:23 +02:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02:00
Florian Müllner
5801b5518f Annotate functions to improve compiler diagnostics 2015-09-24 03:01:51 +02:00
Florian Müllner
25a796afc6 Fix constness warnings 2015-09-24 03:01:51 +02:00
Florian Müllner
27b37407d0 Don't duplicate declarations from G_DEFINE_TYPE 2015-09-24 03:01:51 +02:00
Jonas Ådahl
e23e697043 wayland: Fix output destroyed callback vfunc type
It is not a callback on a parameter signal, and get no GParamSpec passed
to it. This fixes a crash when a surface is on a destroyed output.

https://bugzilla.gnome.org/show_bug.cgi?id=755096
2015-09-24 08:08:41 +08:00
Florian Müllner
35729e8659 Bump version to 3.18.0
Update NEWS.
2015-09-21 21:52:14 +02:00
Rūdolfs Mazurs
dc7e665de9 Updated Latvian translation 2015-09-20 18:53:28 +03:00
Rūdolfs Mazurs
2e3bfd1a11 Updated Latvian translation 2015-09-20 18:51:51 +03:00
Jonas Ådahl
b7aca07844 Revert "launcher: simplify getting session dbus proxy"
Signals are sent to a specific ID, so we can't use "self" here. After
this revert, VT switching works again.

This reverts commit 8e22bf5bc9.

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-17 12:17:45 +08:00
Florian Müllner
dc780d2c44 launcher: Don't pass variable as format string
We know the variable only contains one or another string literal,
but keep compilers happy as well.
2015-09-16 17:38:10 +02:00
Florian Müllner
c49b284643 Bump version to 3.17.92
Update NEWS.
2015-09-16 17:19:56 +02:00
Jonas Ådahl
0373b854c1 MetaCursorRenderer: Rely on update_cursor for redrawing
Calling queue_redraw() in _force_update() is not needed because
update_cursor() will do this when needed, i.e. when switching between
hardware cursor and texture cursor, or when drawing with texture cursor.

There is also no need to force _native_force_update() because
update_cursor() will cover this as well when needed. When not changing
cursor but only the gbm_bo, the "dirty" boolean on the gbm_bo will
trigger a redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
5d837a5c85 wayland: Support sending wl_surface.enter/leave to cursor surfaces
Support notifying clients about what outputs their cursor surfaces are
on so that they can attach appropriately scaled buffers to them.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
79c86ae890 Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that
cursor sprites changes appearance as it moves across the screen.
Renderers are adapted to handle the necessary functionality.

The logic for changing the cursor sprite appearance is done outside of
MetaCursorSprite, and actually where depends on what type of cursor it
is. In mutter we now have two types of cursors that may have their
appearance changed:

 - Themed cursors (aka root cursors)
 - wl_surface cursors

Themed cursors are created by MetaScreen and when created, when
applicable(*), it will extend the cursor via connecting to a signal
which is emitted everytime the cursor is moved. The signal handler will
calculate the expected scale given the monitor it is on and reload the
theme in a correct size when needed.

wl_surface cursors are created when a wl_surface is assigned the
"cursor" role, i.e. when a client calls wl_pointer.set_cursor. A
cursor role object is created which is connected to the cursor object
by the position signal, and will set a correct texture scale given what
monitor the cursor is on and what scale the wl_surface's active buffer
is in. It will also push new buffers to the same to the cursor object
when new ones are committed to the surface.

This commit also makes texture loading lazy, since the renderer doesn't
calculate a rectangle when the cursor position changes.

The native backend is refactored to be triple-buffered; see the comment
in meta-cursor-renderer-native.c for further explanations.

* when we are running as a Wayland compositor

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
7c7cf91c32 wayland: Move cursor surface role to meta-wayland-pointer.c
The wl_pointer assigns a role to a wl_surface, so it makes sense to put
the related logic there.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
e407f5bbae MetaCursorSprite: Squash MetaCurorImage into MetaCursorSprite
It fills little purpose on separating into a MetaCursorImage struct, so
lets squash in the three fields into the MetaCursorSprite object.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
8900bd2f5c backends/x11: Draw our own cursor sprite when running nested
Use a specialized cursor renderer when running as a nested Wayand
compositor. This new renderer sets an empty X11 cursor and draws the
cursor as part of the stage using the generic cursor renderer drawing
path.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
83c17134f1 wayland: GObject:ify surface roles
Make a surface roles into objects with vfuncs for things where there
before was a big switch statement. The declaration and definition
boilerplate is hidden behind C macros.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
8e5fb03611 MetaWaylandSurface: Don't respond to frame callback when role unassigned
If a surface doesn't have a role, the compositor will not know how, if
or when it will be painted. By adding it to the compositor frame
callback list, the compositor will respond to the client that the
surface has been drawn already which might not be true.

Instead, queue the frame callback in a list that is then processed when
the surface gets a role assigned. The compositor may then, given the
role the surface got, queue the frame callback accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
dece49b53d wayland: Introduce XWayland surface role
Being a "XWayland window" should be considered equivalent to a role,
even though it is not part of any protocol anywhere. The commit doesn't
have any functional difference, but just makes it clear that an
wl_surface managed by XWayland have the same type of special casing as
surface roles as defined by the Wayland protocol.

As the semantics are more explicit given the role is defined, a comment
explaining why the semantics need to be how they are was added.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Olivier Fourdan
443d579d40 wayland: do not crash if the surface is gone
If a queued event is being processed after the surface is
destroyed, trying to access the window associated with the surface
will lead to a segmentation fault.

This patch avoids the crash by first checking if the surface is not null.

https://bugzilla.gnome.org/show_bug.cgi?id=754715
2015-09-09 09:30:14 +02:00
Ting-Wei Lan
5066eaf691 build: Fix non-wayland build
This fixes build error caused by commit 614d6bd. We can simply remove
the usage of meta-wayland.c functions in non-wayland build because
META_BACKEND_X11_MODE_NESTED is only used in wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-08 01:50:03 +08:00
Javier Jardón
6ea7fa9973 xwayland: Add missing include
https://bugzilla.gnome.org/show_bug.cgi?id=754621
2015-09-07 14:13:48 +01:00
Marek Chalupa
79f755bf0f launcher: find the right drm device
Instead of hard-coding /dev/dri/card0, find the device
that has boot_vga flag set or has been explicitly
assigned a seat id other than seat0

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:42:21 -04:00
Marek Chalupa
1845bfe1b6 launcher: refactor handling errors in meta_launcher_new
Fill in missing error checks and use g_error, since any
error in this phase would lead to crash later anyway.
This way we'll at least know what went wrong.

Although it was not the patch's original intention, it fixes
https://bugzilla.gnome.org/show_bug.cgi?id=754520

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:40:49 -04:00
Marek Chalupa
8e22bf5bc9 launcher: simplify getting session dbus proxy
Use path "/org/freedesktop/login1/session/self" instead of
getting session id and building the path manually

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:40:20 -04:00
Marek Chalupa
c13ddafdb8 native: remove obsolete comment
There's not weston-launch anymore

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:39:38 -04:00
Jonas Ådahl
94513726de wayland: Clean up surface role assignment
Use a better name, use GNOME conventions for error handling, open code the
client error reporting and send the error to the correct resource.
wl_subcompositor doesn't have a role error yet, so continue use some
other error. The only effect of this is error received in the client will
be a bit confusing, it will still be disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=754215
2015-09-07 17:41:14 +08:00
Ting-Wei Lan
0aa4c4d43e build: Fix return value in meta-background.c
https://bugzilla.gnome.org/show_bug.cgi?id=754545
2015-09-04 11:47:34 +08:00
Owen W. Taylor
e3db4ab16a Avoid declaring variables in for loop to avoid upsetting older GCC
Older GCC only allows "for (int i" in explicit c99 mode - there's probably
no reason that we can't enable that, but avoiding the construct for
a fast fix.
2015-09-03 16:13:50 -04:00
Owen W. Taylor
614d6bd0f8 Nested X11: use KeymapNotify events to fix key state on FocusIn
If the user Alt-Tabs out of the window, we will be left thinking
the Alt key is still pressed since we don't see a release for it.

Solve this and other related issues for the nested X11 compositor
by selecting for KeymapStateMask which causes a KeymapNotify event
to be sent after each FocusIn, and when we get these events, update
the internal XKB state and send any necessary modifiers events to
clients.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-03 16:02:25 -04:00
Ray Strode
1d56d50fcd background: paint color matte for scaled and centered backgrounds
Some backgrounds don't fully fill the screen.  For those backgrounds
it's important to paint a color behind them to fill in the gaps.

This commit checks whether or not the background image textures take
up the entire monitor, and in the event they don't, draws a color
behind them (such as it would do if the background were
translucent).

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -04:00
Ray Strode
0ffd4254d9 background: simplify conditional in meta_background_get_texture
meta_background_get_texture only draws the bottom image texture
if
   1) the blend factor leaves the top image translucent
   or
   2) the top image is translucent from alpha

The latter case doesn't actually matter since we're using REPLACE
on the top image texture.

This commit drops the unnecessary check for the second case and
applies demorgans law to the conditional for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -04:00
132 changed files with 11336 additions and 9666 deletions

16
.gitignore vendored
View File

@@ -62,14 +62,18 @@ src/stamp-meta-enum-types.h
src/meta-dbus-display-config.[ch]
src/meta-dbus-idle-monitor.[ch]
src/meta-dbus-login1.[ch]
src/gtk-primary-selection-protocol.c
src/gtk-primary-selection-server-protocol.h
src/gtk-shell-protocol.c
src/gtk-shell-server-protocol.h
src/xdg-shell-protocol.c
src/xdg-shell-server-protocol.h
src/pointer-gestures-protocol.c
src/pointer-gestures-server-protocol.h
src/xserver-protocol.c
src/xserver-server-protocol.h
src/xdg-shell-unstable-v*-protocol.c
src/xdg-shell-unstable-v*-server-protocol.h
src/pointer-gestures-unstable-v*-protocol.c
src/pointer-gestures-unstable-v*-server-protocol.h
src/relative-pointer-unstable-v*-protocol.c
src/relative-pointer-unstable-v*-server-protocol.h
src/pointer-constraints-unstable-v*-protocol.c
src/pointer-constraints-unstable-v*-server-protocol.h
src/meta/meta-version.h
doc/reference/*.args
doc/reference/*.bak

127
NEWS
View File

@@ -1,3 +1,130 @@
3.19.91
=======
* Add --nested CLI argument to fix nested wayland session [Jonas; #758658]
* Fix stack - scene graph stacking synchronization issues [Jonas; #755605]
* Rate-limit last-device changes to fix freezes [Carlos; #753527]
* Implement primary selection protocol [Carlos; #762560]
* Misc. bug fixes [Carlos, Jonas; #762878, #762716]
Contributors:
Jonas Ådahl, Carlos Garnacho, Tim Lunn
Translations:
Piotr Drąg [pl], Artur de Aquino Morais [pt_BR], Marek Černocký [cs],
Cédric Valmary [oc], Mario Blättermann [de], Dušan Kazik [sk],
Fran Dieguez [gl], Aurimas Černius [lt], Daniel Mustieles [es],
Stas Solovey [ru], Yosef Or Boczko [he]
3.19.90
=======
* Release buffer after processing commit [Ray; #761312, #761613]
* Implement pointer motion, locks and confinement on wayland [Jonas; #744104]
* Add basic startup notification support on wayland [Carlos; #762268]
* Misc. bug fixes [Rui, Alberts, Florian; #760670, #761543, #752794, #761557]
Contributors:
Jonas Ådahl, Olivier Fourdan, Carlos Garnacho, Rui Matos,
Alberts Muktupāvels, Florian Müllner, Jasper St. Pierre, Ray Strode
3.19.4
======
* Fix updating stacking order when setting transient_for [Jonas; #755606]
* Support screen rotation when supported by the driver [Carlos; #745079]
* Protect against broken WM_CLASS property implementations [Sebastian; #759658]
* Handle wl_pointer v5 events on wayland [Carlos; #760637]
* Implement DND actions on wayland [Carlos; #760805]
* Misc. bug fixes [Jonas, Rui, Ray, Marek; #754711, #756789, #759297, #758613,
#760330, #760476, #759222, #760670]
Contributors:
Jonas Ådahl, Marek Chalupa, Carlos Garnacho, Sebastian Keller, Rui Matos,
Florian Müllner, Jasper St. Pierre, Ray Strode
Translations:
Aurimas Černius [lt]
3.19.3
======
* Correct refresh rate units on KMS/Wayland [Daniel; #758653]
* Fix crash when initial cursor position is not on a monitor [Marek; #756698]
* Fix crash when more CRTs are enabled than outputs connected [Rui; #751638]
* Fix touch pointer emulation on wayland [Carlos; #756754]
* Allow minimizing windows that don't advertise supporting it [Jasper; #758186]
* Force 2-finger scroll by default if available [Bastien; #759304]
* Fix crash during XWayland initialization [Marek; #751845]
* Ensure to send a ConfigureNotify to just mapped windows [Rui; #759492]
* Misc. bug fixes and cleanups [Carlos, Jonas, Lionel; #758239, #758633,
#755503, #759374]
Contributors:
Jonas Ådahl, Marek Chalupa, Carlos Garnacho, Lionel Landwerlin, Rui Matos,
Bastien Nocera, Daniel Stone, Jasper St. Pierre
3.19.2
======
* Fix crash on monitor unplug [Rui; #756796]
* Exit cleanly on initialization errors [Owen; #757311]
* Allow to determine backend setting from session type [Ray; #741666]
* Fix DRM device detection for non-PCI devices [Alban; #754911]
* Don't force placement of windows without buffer on wayland [Marek; #751887]
* Fix initialization of bypass compositor hint [Rui; #758544]
Contributors:
Alban Browaeys, Marek Chalupa, Rui Matos, Florian Müllner, Ray Strode,
Owen W. Taylor
3.19.1
======
* wayland: Allow to trigger popups through keyboard/touch [Carlos; #756296]
* Fix modifiers-only input source switching on Ubuntu [Alberts; #756543]
* Misc. bug fixes [Jonas, Rui, Giovanni, Florian; #756675, #756660, #746420,
#756548, #756796, #757101, #757148]
Contributors:
Jonas Ådahl, Giovanni Campagna, Carlos Garnacho, Rui Matos,
Alberts Muktupāvels, Florian Müllner
Translations:
Daniel Șerbănescu [ro]
3.18.1
======
* Misc. crash fixes [Jonas, Rui, Carlos, Owen, Florian; #755096, #754979,
#755490, #754357, #745785, #756642]
* Improve HiDPI support on wayland [Jonas; #755097]
* Fix doubly-scaled cursor on XWayland HiDPI [Jonas; #755099]
* Stop hiding titlebar buttons in dialogs [Florian; #641630]
* Add support for fullscreen/unfullscreen animations [Cosimo; #707248]
* Misc. bug fixes [Rui, Colin, Florian; #743339, #752047, #756074, #756649]
Contributors:
Jonas Ådahl, Cosimo Cecchi, Carlos Garnacho, Rui Matos, Florian Müllner,
Jasper St. Pierre, Colin Walters, Owen W. Taylor
3.18.0
======
* Misc. fixes [Florian, Jonas; #753434]
Contributors:
Jonas Ådahl, Florian Müllner
Translations:
Rūdolfs Mazurs [lv]
3.17.92
=======
* Don't omit the background color for backgrounds that don't fill the screen
[Ray; #754476]
* Fix up key state on FocusIn when running nested [Owen; #753948]
* Find the right DRM device instead of hardcoding card0 [Marek; #753434]
* Scale cursor on HiDPI screens [Jonas; #744932]
* Misc. fixes and cleanups [Lan, Jonas, Javier, Olivier; #754545, #754215,
#754621, #754715]
Contributors:
Jonas Ådahl, Marek Chalupa, Olivier Fourdan, Javier Jardón, Ting-Wei Lan,
Ray Strode, Owen W. Taylor
3.17.91
=======
* Send error on pointer-gesture protocol version mismatch [Jonas; #753855]

View File

@@ -1,7 +1,7 @@
AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [17])
m4_define([mutter_minor_version], [19])
m4_define([mutter_micro_version], [91])
m4_define([mutter_version],
@@ -46,6 +46,7 @@ IT_PROG_INTLTOOL([0.41])
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_SED
AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.21])
@@ -58,12 +59,12 @@ CANBERRA_GTK_VERSION=0.26
CLUTTER_PACKAGE=clutter-1.0
MUTTER_PC_MODULES="
gtk+-3.0 >= 3.9.11
gtk+-3.0 >= 3.19.8
gio-unix-2.0 >= 2.35.1
pango >= 1.2.0
cairo >= 1.10.0
gsettings-desktop-schemas >= 3.15.92
$CLUTTER_PACKAGE >= 1.23.4
gsettings-desktop-schemas >= 3.19.3
$CLUTTER_PACKAGE >= 1.25.6
cogl-1.0 >= 1.17.1
upower-glib >= 0.99.0
gnome-desktop-3.0
@@ -219,6 +220,10 @@ AS_IF([test "$have_wayland" = "yes"], [
[AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols])])
AC_SUBST([WAYLAND_SCANNER])
AC_DEFINE([HAVE_WAYLAND],[1],[Define if you want to enable Wayland support])
PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.1],
[ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
])
AM_CONDITIONAL([HAVE_WAYLAND],[test "$have_wayland" = "yes"])

View File

@@ -1,6 +1,5 @@
desktopfiles_in_files = \
mutter.desktop.in \
mutter-wayland.desktop.in
mutter.desktop.in
desktopfilesdir = $(datadir)/applications
desktopfiles_DATA = $(desktopfiles_in_files:.desktop.in=.desktop)

View File

@@ -1,17 +0,0 @@
[Desktop Entry]
Type=Application
_Name=Mutter (wayland compositor)
Exec=mutter --wayland --display-server
NoDisplay=true
# name of loadable control center module
X-GNOME-WMSettingsModule=metacity
# name we put on the WM spec check window
X-GNOME-WMName=Mutter
# back compat only
X-GnomeWMSettingsLibrary=metacity
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=mutter
X-GNOME-Bugzilla-Component=general
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true

View File

@@ -1 +1,2 @@
data/mutter-wayland.desktop.in
# List of source files that should NOT be translated.
# Please keep this file sorted alphabetically.

View File

@@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-03-24 23:25+0000\n"
"POT-Creation-Date: 2016-02-27 13:36+0000\n"
"PO-Revision-Date: 2014-09-22 15:01+0200\n"
"Last-Translator: Petr Kovar <pknbe@volny.cz>\n"
"Language-Team: Czech <gnome-cs-list@gnome.org>\n"
@@ -238,8 +238,7 @@ msgstr "Přepnout okno na všechny/jednu pracovní plochu"
#: ../data/50-mutter-windows.xml.in.h:13
msgid "Raise window if covered, otherwise lower it"
msgstr ""
"Když je okno zakryté vynést jej do popředí, jinak odsunout do pozadí"
msgstr "Když je okno zakryté vynést jej do popředí, jinak odsunout do pozadí"
#: ../data/50-mutter-windows.xml.in.h:14
msgid "Raise window above other windows"
@@ -457,22 +456,22 @@ msgstr "Přepnout na VT 11"
msgid "Switch to VT 12"
msgstr "Přepnout na VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Vestavěný displej"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Neznámý"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Neznámý displej"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -515,40 +514,44 @@ msgstr "_Počkat"
msgid "_Force Quit"
msgstr "_Vynutit ukončení"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Nelze otevřít displej X Window System „%s“\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Zakáže připojení ke správci sezení"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Nahradí běžícího správce oken"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Určení ID správy sezení"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Displej X, který použije"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Spustí sezení z uloženého souboru"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Provede volání X synchronně"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Spustit jako kompozitní program protokolu Wayland"
msgstr "Spustit jako kompozitor protokolu Wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Spustit jako podkladový kompozitor"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Spustit jako plnohodnotný server displeje, nikoliv vnořeně"
@@ -576,12 +579,12 @@ msgstr "Vypíše verzi"
msgid "Mutter plugin to use"
msgstr "Zásuvný modul Mutter, který se má použít"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Plocha %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -590,12 +593,12 @@ msgstr ""
"Displej „%s“ již správce oken má; zkuste prosím nahradit aktuálního správce "
"oken pomocí přepínače --replace."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Obrazovka %d na displeji „%s“ je neplatná\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter bylo přeloženo bez podpory podrobného režimu\n"
@@ -1272,32 +1275,3 @@ msgstr "%s (na %s)"
#~ msgid "Move to Another _Workspace"
#~ msgstr "Přes_unout na jinou plochu"
#~ msgid "Shift"
#~ msgstr "Shift"
#~ msgid "Ctrl"
#~ msgstr "Ctrl"
#~ msgid "Alt"
#~ msgstr "Alt"
#~ msgid "Meta"
#~ msgstr "Meta"
#~ msgid "Super"
#~ msgstr "Super"
#~ msgid "Hyper"
#~ msgstr "Hyper"
#~ msgid "Mod2"
#~ msgstr "Mod2"
#~ msgid "Mod3"
#~ msgstr "Mod3"
#~ msgid "Mod4"
#~ msgstr "Mod4"
#~ msgid "Mod5"
#~ msgstr "Mod5"

View File

@@ -3,7 +3,7 @@
# Matthias Warkus <mawarkus@gnome.org>, 2002.
# Christian Neumair <chris@gnome-de.org>, 2002-2004.
# Hendrik Richter <hendrikr@gnome.org>, 2005, 2006, 2007, 2008.
# Mario Blättermann <mario.blaettermann@gmail.com>, 2010-2013.
# Mario Blättermann <mario.blaettermann@gmail.com>, 2010-2013, 2016.
# Christian Kirbach <Christian.Kirbach@googlemail.com>, 2009, 2011, 2012.
# Wolfgang Stöggl <c72578@yahoo.de> 2011.
# Tobias Endrigkeit <tobiasendrigkeit@googlemail.com>, 2012.
@@ -13,16 +13,16 @@ msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-06-20 08:08+0000\n"
"PO-Revision-Date: 2015-06-18 20:59+0100\n"
"Last-Translator: Bernd Homuth <dev@hmt.im>\n"
"POT-Creation-Date: 2016-02-28 13:37+0000\n"
"PO-Revision-Date: 2016-02-28 19:15+0100\n"
"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
"Language-Team: Deutsch <gnome-de@gnome.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.1\n"
"X-Generator: Poedit 1.8.7\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -463,22 +463,22 @@ msgstr "Zum virtuellen Terminal 11 wechseln"
msgid "Switch to VT 12"
msgstr "Zum virtuellen Terminal 12 wechseln"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Eingebaute Anzeige"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Unbekannt"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Unbekannte Anzeige"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -523,40 +523,44 @@ msgstr "_Warten"
msgid "_Force Quit"
msgstr "_Beenden erzwingen"
#: ../src/core/display.c:563
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "X-Window-Systemanzeige »%s« konnte nicht geöffnet werden\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Verbindung zur Sitzungsverwaltung deaktivieren"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Den aktuellen Fensterverwalter ersetzen"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Kennung der Sitzungsverwaltung angeben"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Zu verwendende X-Anzeige"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Sitzung anhand gespeicherter Datei starten"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "X-Aufrufe abgleichen"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Als Wayland-Compositor ausführen"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Als eingebetteten Compositor ausführen"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Als vollwertigen Display-Server verwenden (nicht eingebettet)"
@@ -586,12 +590,12 @@ msgstr "Version ausgeben"
msgid "Mutter plugin to use"
msgstr "Zu benutzendes Mutter-Plugin"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Arbeitsfläche %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -600,12 +604,12 @@ msgstr ""
"Bildschirm »%s« hat bereits einen Fensterverwalter. Versuchen Sie die Option "
"»--replace«, um den aktuellen Fensterverwalter zu ersetzen."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Bildschirm %d auf Anzeige »%s« ist ungültig\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter wurde ohne Unterstützung für den redseligen Modus kompiliert\n"

View File

@@ -7,15 +7,15 @@
# Pablo Gonzalo del Campo <pablodc@bigfoot.com>,2002,2003.
# Francisco Javier F. Serrador <serrador@cvs.gnome.org>, 2004, 2005, 2006.
# Jorge González <jorgegonz@svn.gnome.org>, 2007, 2008, 2009, 2010, 2011.
# Daniel Mustieles <daniel.mustieles@gmail.com>, 2011, 2012, 2013, 2014, 2015.
# Daniel Mustieles <daniel.mustieles@gmail.com>, 2011, 2012, 2013, 2014, 2015, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: mutter.master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-02-23 11:10+0000\n"
"PO-Revision-Date: 2015-02-23 19:07+0100\n"
"POT-Creation-Date: 2016-02-28 13:37+0000\n"
"PO-Revision-Date: 2016-02-29 16:02+0100\n"
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
"Language-Team: Español; Castellano <gnome-es-list@gnome.org>\n"
"Language: \n"
@@ -445,46 +445,41 @@ msgid "Switch to VT 7"
msgstr "Cambiar al VT 7"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:8
#| msgid "Switch to VT 1"
msgid "Switch to VT 8"
msgstr "Cambiar al VT 8"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:9
#| msgid "Switch to VT 1"
msgid "Switch to VT 9"
msgstr "Cambiar al VT 9"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:10
#| msgid "Switch to VT 1"
msgid "Switch to VT 10"
msgstr "Cambiar al VT 10"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:11
#| msgid "Switch to VT 1"
msgid "Switch to VT 11"
msgstr "Cambiar al VT 11"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:12
#| msgid "Switch to VT 1"
msgid "Switch to VT 12"
msgstr "Cambiar al VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Pantalla integrada"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Desconocida"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Pantalla desconocida"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -529,40 +524,45 @@ msgstr "_Esperar"
msgid "_Force Quit"
msgstr "_Forzar la salida"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Ocurrió un error al abrir la pantalla de X Window System «%s»\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Desactivar conexión al gestor de sesión"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Reemplazar el gestor de ventanas en ejecución"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Especificar el ID se gestión de sesión"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Pantalla X que usar"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializar sesión desde el archivo de salvaguarda"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Hacer que las llamadas a las X sean síncronas"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Ejecutar como compositor Wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
#| msgid "Run as a wayland compositor"
msgid "Run as a nested compositor"
msgstr "Ejecutar como compositor anidado"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Ejecutar como servidor completo, en lugar de anidado"
@@ -589,12 +589,12 @@ msgstr "Imprimir versión"
msgid "Mutter plugin to use"
msgstr "Complemento de mutter que usar"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Área de trabajo %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -603,12 +603,12 @@ msgstr ""
"La pantalla «%s» ya tiene un gestor de ventanas; pruebe a usar la opción «--"
"replace» para reemplazar el gestor de ventanas activo."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "La ventana %d en la pantalla «%s» no es válida\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter fue compilado sin soporte para modo prolijo\n"

View File

@@ -9,22 +9,21 @@
# Mancomún - Centro de Referencia e Servizos de Software Libre <g11n@mancomun.org>, 2009.
# Fran Diéguez <frandieguez@gnome.org>, 2009, 2010, 2011, 2012.
# Leandro Regueiro <leandro.regueiro@gmail.com>, 2012.
# Fran Dieguez <frandieguez@gnome.org>, 2012, 2013, 2014, 2015.
#
# Fran Dieguez <frandieguez@gnome.org>, 2012, 2013, 2014, 2015, 2016.
msgid ""
msgstr ""
"Project-Id-Version: gl\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-28 22:43+0100\n"
"PO-Revision-Date: 2015-02-28 22:42+0100\n"
"POT-Creation-Date: 2016-03-02 09:49+0100\n"
"PO-Revision-Date: 2016-03-02 09:49+0200\n"
"Last-Translator: Fran Dieguez <frandieguez@gnome.org>\n"
"Language-Team: Galician <>\n"
"Language-Team: gnome-l10n-gl@gnome.org\n"
"Language: gl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Gtranslator 2.91.6\n"
"X-Generator: Virtaal 0.7.1\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -461,22 +460,22 @@ msgstr "Cambiar á VT 11"
msgid "Switch to VT 12"
msgstr "Cambiar á VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Pantalla embebida"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Descoñecido"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Pantalla descoñecida"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -521,40 +520,44 @@ msgstr "Espe_rar"
msgid "_Force Quit"
msgstr "_Forzar a saída"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Produciuse un erro ao abrir a visualización do X Window System «%s»\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Desactivar a conexión ao xestor de sesión"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Substituír o xestor de xanelas en execución"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Especificar o ID de xestión de sesión"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Pantalla X que se vai usar"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializar sesión desde o ficheiro de salvagarda"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Facer que as chamadas a X sexan sincrónicas"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Executar como compositor de wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Executar como compositor anidado"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Executar como un servidor de pantalla completo, fronte a un aniñado"
@@ -581,12 +584,12 @@ msgstr "Imprimir versión"
msgid "Mutter plugin to use"
msgstr "Engadido de mutter que usar"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Espazo de traballo %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -595,12 +598,12 @@ msgstr ""
"A pantalla «%s» ten xa un xestor de xanelas, tente usar a opción --replace "
"para substituír o xestor de xanelas."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "A pantalla %d na visualización «%s» non é válida\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter foi compilado sen compatibilidade para o modo detallado\n"

View File

@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: metacity.HEAD.he\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-24 19:33+0200\n"
"PO-Revision-Date: 2015-02-24 19:34+0200\n"
"POT-Creation-Date: 2016-03-03 14:39+0200\n"
"PO-Revision-Date: 2016-03-03 14:40+0200\n"
"Last-Translator: Yosef Or Boczko <yoseforb@gmail.com>\n"
"Language-Team: עברית <>\n"
"Language: he\n"
@@ -453,22 +453,22 @@ msgstr "מעבר ל־VT 11"
msgid "Switch to VT 12"
msgstr "מעבר ל־VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "תצוגה מובנית"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "לא ידוע"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "תצוגה לא ידועה"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -510,40 +510,44 @@ msgstr "ה_מתנה"
msgid "_Force Quit"
msgstr "_אילוץ סגירה"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Failed to open X Window System display '%s'\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Disable connection to session manager"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Replace the running window manager"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Specify session management ID"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "X Display to use"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Initialize session from savefile"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Make X calls synchronous"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Run as a wayland compositor"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Run as a nested compositor"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Run as a full display server, rather than nested"
@@ -569,12 +573,12 @@ msgstr "Print version"
msgid "Mutter plugin to use"
msgstr "תוסף ה־mutter לשימוש"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "מרחב עבודה %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -583,12 +587,12 @@ msgstr ""
"Display \"%s\" already has a window manager; try using the --replace option "
"to replace the current window manager."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Screen %d on display '%s' is invalid\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter הודר ללא תמיכה במצב פירוט\n"

124
po/lt.po
View File

@@ -13,8 +13,8 @@ msgstr ""
"Project-Id-Version: lt\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-02-28 11:14+0000\n"
"PO-Revision-Date: 2015-02-28 21:34+0200\n"
"POT-Creation-Date: 2016-02-26 09:54+0000\n"
"PO-Revision-Date: 2016-02-25 15:18+0200\n"
"Last-Translator: Aurimas Černius <aurisc4@gmail.com>\n"
"Language-Team: Lietuvių <gnome-lt@lists.akl.lt>\n"
"Language: lt\n"
@@ -23,7 +23,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
"%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Gtranslator 2.91.6\n"
"X-Generator: Poedit 1.8.7\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -31,39 +31,39 @@ msgstr "Navigacija"
#: ../data/50-mutter-navigation.xml.in.h:2
msgid "Move window to workspace 1"
msgstr "Perkelti langą į darbalaukį Nr.1"
msgstr "Perkelti langą į darbo sritį Nr.1"
#: ../data/50-mutter-navigation.xml.in.h:3
msgid "Move window to workspace 2"
msgstr "Perkelti langą į darbalaukį Nr.2"
msgstr "Perkelti langą į darbo sritį Nr.2"
#: ../data/50-mutter-navigation.xml.in.h:4
msgid "Move window to workspace 3"
msgstr "Perkelti langą į darbalaukį Nr.3"
msgstr "Perkelti langą į darbo sritį Nr.3"
#: ../data/50-mutter-navigation.xml.in.h:5
msgid "Move window to workspace 4"
msgstr "Perkelti langą į darbalaukį Nr.4"
msgstr "Perkelti langą į darbo sritį Nr.4"
#: ../data/50-mutter-navigation.xml.in.h:6
msgid "Move window to last workspace"
msgstr "Perkelti langą į pastarąjį darbalaukį"
msgstr "Perkelti langą į pastarąją darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:7
msgid "Move window one workspace to the left"
msgstr "Perkelti langą į kairiau esan darbalaukį"
msgstr "Perkelti langą į kairiau esančią darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:8
msgid "Move window one workspace to the right"
msgstr "Perkelti langą į dešiniau esan darbalaukį"
msgstr "Perkelti langą į dešiniau esančią darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:9
msgid "Move window one workspace up"
msgstr "Perkelti langą į aukščiau esan darbalaukį"
msgstr "Perkelti langą į aukščiau esančią darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:10
msgid "Move window one workspace down"
msgstr "Perkelti langą į žemiau esan darbalaukį"
msgstr "Perkelti langą į žemiau esančią darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:11
msgid "Move window one monitor to the left"
@@ -143,39 +143,39 @@ msgstr "Paslėpti visus įprastinius langus"
#: ../data/50-mutter-navigation.xml.in.h:30
msgid "Switch to workspace 1"
msgstr "Persijungti į darbalaukį Nr.1"
msgstr "Persijungti į darbo sritį Nr.1"
#: ../data/50-mutter-navigation.xml.in.h:31
msgid "Switch to workspace 2"
msgstr "Persijungti į darbalaukį Nr.2"
msgstr "Persijungti į darbo sritį Nr.2"
#: ../data/50-mutter-navigation.xml.in.h:32
msgid "Switch to workspace 3"
msgstr "Persijungti į darbalaukį Nr.3"
msgstr "Persijungti į darbo sritį Nr.3"
#: ../data/50-mutter-navigation.xml.in.h:33
msgid "Switch to workspace 4"
msgstr "Persijungti į darbalaukį Nr.4"
msgstr "Persijungti į darbo sritį Nr.4"
#: ../data/50-mutter-navigation.xml.in.h:34
msgid "Switch to last workspace"
msgstr "Persijungti į pastarąjį darbalaukį"
msgstr "Persijungti į pastarąją darbo sritį"
#: ../data/50-mutter-navigation.xml.in.h:35
msgid "Move to workspace left"
msgstr "Perkelti į darbalaukį kairėje"
msgstr "Perkelti į darbo sritį kairėje"
#: ../data/50-mutter-navigation.xml.in.h:36
msgid "Move to workspace right"
msgstr "Perkelti į darbalaukį dešinėje"
msgstr "Perkelti į darbo sritį dešinėje"
#: ../data/50-mutter-navigation.xml.in.h:37
msgid "Move to workspace above"
msgstr "Perkelti į darbalaukį viršuje"
msgstr "Perkelti į darbo sritį viršuje"
#: ../data/50-mutter-navigation.xml.in.h:38
msgid "Move to workspace below"
msgstr "Perkelti į darbalaukį apačioje"
msgstr "Perkelti į darbo sritį apačioje"
#: ../data/50-mutter-system.xml.in.h:1
msgid "System"
@@ -235,7 +235,7 @@ msgstr "Keisti lango dydį"
#: ../data/50-mutter-windows.xml.in.h:12
msgid "Toggle window on all workspaces or one"
msgstr "Perjungti lango buvimo visuose darbalaukiuose būseną"
msgstr "Perjungti lango buvimo visose darbo srityse būseną"
#: ../data/50-mutter-windows.xml.in.h:13
msgid "Raise window if covered, otherwise lower it"
@@ -272,7 +272,7 @@ msgstr "Mutter"
#: ../data/org.gnome.mutter.gschema.xml.in.h:1
msgid "Modifier to use for extended window management operations"
msgstr "Klavišas, naudojamas kartu su specialiais lango valdymo veiksmais"
msgstr "Klavišas, naudojamas kartu su specialiomis lango tvarkymo operacijomis"
#: ../data/org.gnome.mutter.gschema.xml.in.h:2
msgid ""
@@ -315,7 +315,7 @@ msgstr ""
#: ../data/org.gnome.mutter.gschema.xml.in.h:7
msgid "Workspaces are managed dynamically"
msgstr "Darbalaukiai valdomi dinamiškai"
msgstr "Darbo sritys tvarkomos dinamiškai"
#: ../data/org.gnome.mutter.gschema.xml.in.h:8
msgid ""
@@ -323,21 +323,21 @@ msgid ""
"static number of workspaces (determined by the num-workspaces key in org."
"gnome.desktop.wm.preferences)."
msgstr ""
"Nusako, ar darbastaliai yra valdomi dinamiškai, ar yra pastovus darbalaukių "
"skaičius (nusakomas raktu num-workspaces schemoje org.gnome.desktop.wm."
"preferences)."
"Nusako, ar darbo sritys yra tvarkomos dinamiškai, ar yra pastovus darbo "
"sričių skaičius (nusakomas raktu num-workspaces schemoje org.gnome.desktop."
"wm.preferences)."
#: ../data/org.gnome.mutter.gschema.xml.in.h:9
msgid "Workspaces only on primary"
msgstr "Darbalaukiai tik pagrindiniame"
msgstr "Darbo sritys tik pagrindiniame"
#: ../data/org.gnome.mutter.gschema.xml.in.h:10
msgid ""
"Determines whether workspace switching should happen for windows on all "
"monitors or only for windows on the primary monitor."
msgstr ""
"Nusako, ar darbalaukių perjungimas turi įvykti langams viusose monitoriuose, "
"ar tik langams pagrindiniame monitoriuje."
"Nusako, ar darbo sričių perjungimas turi įvykti langams visuose "
"monitoriuose, ar tik langams pagrindiniame monitoriuje."
#: ../data/org.gnome.mutter.gschema.xml.in.h:11
msgid "No tab popup"
@@ -438,46 +438,41 @@ msgid "Switch to VT 7"
msgstr "Persijungti į VT 7"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:8
#| msgid "Switch to VT 1"
msgid "Switch to VT 8"
msgstr "Persijungti į VT 8"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:9
#| msgid "Switch to VT 1"
msgid "Switch to VT 9"
msgstr "Persijungti į VT 9"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:10
#| msgid "Switch to VT 1"
msgid "Switch to VT 10"
msgstr "Persijungti į VT 10"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:11
#| msgid "Switch to VT 1"
msgid "Switch to VT 11"
msgstr "Persijungti į VT 11"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:12
#| msgid "Switch to VT 1"
msgid "Switch to VT 12"
msgstr "Persijungti į VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Integruotas vaizduoklis"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Nežinomas"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Nežinomas vaizduoklis"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -489,7 +484,7 @@ msgstr "%s %s"
msgid ""
"Another compositing manager is already running on screen %i on display \"%s"
"\"."
msgstr "Kita kompozicijos valdyklė jau veikia ekrane %i vaizduoklyje „%s“."
msgstr "Kita kompozicijos tvarkytuvė jau veikia ekrane %i vaizduoklyje „%s“."
#: ../src/core/bell.c:185
msgid "Bell event"
@@ -518,42 +513,46 @@ msgstr "_Laukti"
msgid "_Force Quit"
msgstr "_Priverstinai išeiti"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Nepavyko atverti X Window sistemos ekrano „%s“\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Išjungti susijungimą su sesijos valdykle"
msgstr "Išjungti susijungimą su sesijos tvarkytuve"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Pakeisti veikiančią langų valdyklę"
#: ../src/core/main.c:188
msgid "Specify session management ID"
msgstr "Nurodyti sesijos valdymo ID"
msgstr "Pakeisti veikiančią langų tvarkytuvę"
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Nurodyti sesijos tvarkymo ID"
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Naudotinas X ekranas"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializuoti sesiją iš išsaugojimo failo"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Sinchronizuoti X iškvietimus"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Vykdyti kaip wayland kompozitorių"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Vykdyti kaip įdėtinį kompozitorių"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Vykdyti kaip visą vaizduoklio serverį, o ne vidinį"
msgstr "Vykdyti kaip visą vaizduoklio serverį, o ne įdėtinį"
#: ../src/core/mutter.c:39
#, c-format
@@ -580,29 +579,26 @@ msgstr "Parodyti versiją"
msgid "Mutter plugin to use"
msgstr "Naudojamas Mutter įskiepis"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Darbalaukis %d"
msgstr "Darbo sritis %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
#| msgid ""
#| "Screen %d on display \"%s\" already has a window manager; try using the --"
#| "replace option to replace the current window manager.\n"
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
"to replace the current window manager."
msgstr ""
"Vaizduoklis „%s“ jau turi langų valdyklę; pabandykite pakeisti esamą langų "
"valdyklę naudodami parametrą --replace."
"Vaizduoklis „%s“ jau turi langų tvarkytuvę; pabandykite pakeisti esamą langų "
"tvarkytuvę, naudodami parametrą --replace."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Ekranas %d vaizduoklyje „%s“ netinkamas\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter buvo sukompiliuota be išsamaus veikimo veiksenos\n"

1867
po/lv.po

File diff suppressed because it is too large Load Diff

3420
po/oc.po

File diff suppressed because it is too large Load Diff

View File

@@ -9,14 +9,14 @@
# Marek Stępień <marcoos@aviary.pl>, 2007.
# Wadim Dziedzic <wdziedzic@aviary.pl>, 2007.
# Tomasz Dominikowski <dominikowski@gmail.com>, 2008-2009.
# Piotr Drąg <piotrdrag@gmail.com>, 2010-2015.
# Aviary.pl <gnomepl@aviary.pl>, 2007-2015.
# Piotr Drąg <piotrdrag@gmail.com>, 2010-2016.
# Aviary.pl <gnomepl@aviary.pl>, 2007-2016.
msgid ""
msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-08-26 18:49+0200\n"
"PO-Revision-Date: 2015-08-26 18:50+0200\n"
"POT-Creation-Date: 2016-02-25 17:29+0100\n"
"PO-Revision-Date: 2016-02-25 17:30+0100\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish <gnomepl@aviary.pl>\n"
"Language: pl\n"
@@ -285,10 +285,10 @@ msgid ""
"\"Windows key\" on PC hardware. It's expected that this binding either the "
"default or set to the empty string."
msgstr ""
"Ten klawisz inicjuje tryb „overlay”, który jest połączeniem podglądu okien i "
"systemu uruchamiania programów. Domyślnie jest przeznaczony do powiązania z "
"klawiszem „Windows” na komputerach typu PC. Ustawienie tego powiązania "
"powinno być domyślne lub puste."
"Ten klawisz inicjuje tryb „overlay” (nakładki), który jest połączeniem "
"podglądu okien i systemu uruchamiania programów. Domyślnie jest przeznaczony "
"do powiązania z klawiszem „Windows” na komputerach typu PC. Ustawienie tego "
"powiązania powinno być domyślne lub puste."
#: ../data/org.gnome.mutter.gschema.xml.in.h:3
msgid "Attach modal dialogs"
@@ -332,8 +332,8 @@ msgid ""
"gnome.desktop.wm.preferences)."
msgstr ""
"Określa, czy obszary robocze są zarządzane dynamicznie, czy istnieje "
"statyczna liczba obszarów (określona przez klucz „num-workspaces” w org."
"gnome.desktop.wm.preferences)."
"statyczna liczba obszarów (określona przez klucz „num-workspaces” w org."
"gnome.desktop.wm.preferences)."
#: ../data/org.gnome.mutter.gschema.xml.in.h:9
msgid "Workspaces only on primary"
@@ -468,22 +468,22 @@ msgstr "Przełączenie na 11. konsolę wirtualną"
msgid "Switch to VT 12"
msgstr "Przełączenie na 12. konsolę wirtualną"
#: ../src/backends/meta-monitor-manager.c:500
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Wbudowany ekran"
#: ../src/backends/meta-monitor-manager.c:526
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Nieznany"
#: ../src/backends/meta-monitor-manager.c:528
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Nieznany ekran"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:536
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -525,42 +525,46 @@ msgstr "_Czekaj"
msgid "_Force Quit"
msgstr "_Zakończ"
#: ../src/core/display.c:563
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Otwarcie połączenia z ekranem „%s” systemu X Window się nie powiodło\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Rozłącza połączenie z menedżerem sesji"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Zastępuje uruchomionego menedżera okien"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Podaje identyfikator zarządzania sesją"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Używany ekran X"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicjuje sesję z zapisanego pliku"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Synchroniczne wywołania X"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Uruchamia jako menedżer składania Wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Uruchamia jako osadzony menedżer składania"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Uruchamia pełny serwer wyświetlania zamiast osadzonego"
msgstr "Uruchamia jako pełny serwer wyświetlania zamiast osadzonego"
#: ../src/core/mutter.c:39
#, c-format
@@ -572,7 +576,7 @@ msgid ""
"PARTICULAR PURPOSE.\n"
msgstr ""
"mutter %s\n"
"Copyright (C) 2001%d Havoc Pennington, Red Hat, Inc., oraz inni\n"
"Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., oraz inni\n"
"Niniejszy program jest wolnym oprogramowaniem, aby poznać warunki, pod\n"
"jakimi dopuszczalne jest kopiowanie programu, zajrzyj do jego źródeł.\n"
"Na program nie udziela się ŻADNYCH GWARANCJI, nawet domyślnej gwarancji\n"
@@ -584,23 +588,23 @@ msgstr "Wyświetla wersję"
#: ../src/core/mutter.c:59
msgid "Mutter plugin to use"
msgstr "Używana wtyczka programu Mutter"
msgstr "Używana wtyczka menedżera Mutter"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Obszar roboczy %d"
msgstr "%d. obszar roboczy"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
"to replace the current window manager."
msgstr ""
"Na ekranie „%s” działa już menedżer okien. Aby zastąpić działającego "
"menedżera okien, proszę spróbować użyć opcji --replace."
"menedżera okien, należy użyć opcji --replace."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Podekran %d ekranu „%s” jest nieprawidłowy\n"
@@ -608,7 +612,7 @@ msgstr "Podekran %d ekranu „%s” jest nieprawidłowy\n"
#: ../src/core/util.c:118
msgid "Mutter was compiled without support for verbose mode\n"
msgstr ""
"Program Mutter został skompilowany bez obsługi trybu z obszerną informacją\n"
"Menedżer Mutter został skompilowany bez obsługi trybu z obszerną informacją\n"
#: ../src/x11/session.c:1815
msgid ""

View File

@@ -15,22 +15,23 @@
# Rodrigo Padula de Oliveira <contato@rodrigopadula.com>, 2011.
# Rafael Ferreira <rafael.f.f1@gmail.com>, 2013, 2014.
# Enrico Nicoletto <liverig@gmail.com>, 2012, 2014.
# Artur de Aquino Morais <artur.morais93@outlook.com>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-02-26 11:24+0000\n"
"PO-Revision-Date: 2015-02-26 17:36-0300\n"
"Last-Translator: Rafael Ferreira <rafael.f.f1@gmail.com>\n"
"POT-Creation-Date: 2016-02-25 13:40+0000\n"
"PO-Revision-Date: 2016-02-25 13:41-0300\n"
"Last-Translator: Artur de Aquino Morais <artur.morais93@outlook.com>\n"
"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 1.7.4\n"
"X-Generator: Poedit 1.8.4\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -472,22 +473,22 @@ msgstr "Trocar para o VT 11"
msgid "Switch to VT 12"
msgstr "Trocar para o VT 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Tela embutida"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Desconhecido"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Monitor desconhecido"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s de %s"
@@ -531,40 +532,44 @@ msgstr "_Esperar"
msgid "_Force Quit"
msgstr "_Forçar sair"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Falha ao abrir a exibição \"%s\" do sistema de janelas X\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Desabilitar a conexão com o gerenciador de sessões"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Substituir o gerenciador de janelas em execução"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Especificar o ID do gerenciador de sessões"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Exibição do X a ser utilizada"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializar a sessão a partir do arquivo salvo"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Fazer X chamadas síncronas"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Executar como um compositor wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Executar como um compositor aninhado"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Executar como um servidor de tela cheia, ao invés de aninhado"
@@ -592,12 +597,12 @@ msgstr "Versão impressa"
msgid "Mutter plugin to use"
msgstr "Plug-in do Mutter para usar"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Espaço de trabalho %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -606,7 +611,7 @@ msgstr ""
"A exibição \"%s\" já possui um gerenciador de janelas; tente usar a opção --"
"replace para substituir o gerenciador de janelas atual."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "A tela %d na exibição \"%s\" é inválida\n"

3395
po/ro.po

File diff suppressed because it is too large Load Diff

View File

@@ -9,15 +9,16 @@
# Yuri Kozlov <yuray@komyakino.ru>, 2011.
# Yuri Myasoedov <ymyasoedov@yandex.ru>, 2012-2014, 2015.
# Ivan Komaritsyn <vantu5z@mail.ru>, 2015.
# Stas Solovey <whats_up@tut.by>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: metacity ru\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-02-19 23:11+0000\n"
"PO-Revision-Date: 2015-02-20 13:59+0300\n"
"Last-Translator: Ivan Komaritsyn <vantu5z@mail.ru>\n"
"POT-Creation-Date: 2016-03-03 01:44+0000\n"
"PO-Revision-Date: 2016-03-03 13:51+0300\n"
"Last-Translator: Stas Solovey <whats_up@tut.by>\n"
"Language-Team: Русский <gnome-cyr@gnome.org>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
@@ -25,7 +26,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"X-Generator: Gtranslator 2.91.6\n"
"X-Generator: Gtranslator 2.91.7\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -441,46 +442,41 @@ msgid "Switch to VT 7"
msgstr "Переключиться на виртуальный терминал 7"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:8
#| msgid "Switch to VT 1"
msgid "Switch to VT 8"
msgstr "Переключиться на виртуальный терминал 8"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:9
#| msgid "Switch to VT 1"
msgid "Switch to VT 9"
msgstr "Переключиться на виртуальный терминал 9"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:10
#| msgid "Switch to VT 1"
msgid "Switch to VT 10"
msgstr "Переключиться на виртуальный терминал 10"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:11
#| msgid "Switch to VT 1"
msgid "Switch to VT 11"
msgstr "Переключиться на виртуальный терминал 11"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:12
#| msgid "Switch to VT 1"
msgid "Switch to VT 12"
msgstr "Переключиться на виртуальный терминал 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Встроенный дисплей"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Неизвестный"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Неизвестный дисплей"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -521,40 +517,45 @@ msgstr "_Подождать"
msgid "_Force Quit"
msgstr "Завер_шить"
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Не удалось открыть дисплей «%s» системы X Window\n"
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Запретить подключение к менеджеру сеансов"
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Заменить запущенный оконный менеджер"
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Указать идентификатор управления сеансом"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "Используемый дисплей X"
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Инициализировать сеанс из сохранённого файла"
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Сделать X-вызовы синхронными"
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Запустить в качестве композитора wayland"
#: ../src/core/main.c:220
#: ../src/core/main.c:223
#| msgid "Run as a wayland compositor"
msgid "Run as a nested compositor"
msgstr "Запустить в качестве встроенного композитора"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Запустить в качестве полноэкранного сервера вместо встроенного"
@@ -583,12 +584,12 @@ msgstr "Вывести версию"
msgid "Mutter plugin to use"
msgstr "Использовать модуль mutter"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Рабочее место %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -597,12 +598,12 @@ msgstr ""
"Дисплей «%s» уже использует менеджер окон; попробуйте использовать параметр "
"--replace, чтобы заменить текущий менеджер окон."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Недопустимый экран %d дисплея «%s»\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter собран без поддержки режима подробных сообщений\n"

View File

@@ -14,8 +14,8 @@ msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2015-02-21 23:27+0000\n"
"PO-Revision-Date: 2015-02-22 11:11+0100\n"
"POT-Creation-Date: 2016-03-01 13:42+0000\n"
"PO-Revision-Date: 2016-03-01 20:40+0100\n"
"Last-Translator: Dušan Kazik <prescott66@gmail.com>\n"
"Language-Team: Slovak <gnome-sk-list@gnome.org>\n"
"Language: sk\n"
@@ -23,7 +23,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;\n"
"X-Generator: Poedit 1.7.4\n"
"X-Generator: Poedit 1.8.7\n"
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
@@ -542,22 +542,22 @@ msgstr "Prepnúť na VT č. 11"
msgid "Switch to VT 12"
msgstr "Prepnúť na VT č. 12"
#: ../src/backends/meta-monitor-manager.c:364
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Vstavaný displej"
#: ../src/backends/meta-monitor-manager.c:391
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Neznámy"
#: ../src/backends/meta-monitor-manager.c:393
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Neznámy displej"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:401
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -602,46 +602,51 @@ msgid "_Force Quit"
msgstr "_Vynútiť ukončenie"
# X window system preloz, napr. system na spravu okien X
#: ../src/core/display.c:562
#: ../src/core/display.c:555
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Zlyhalo otvorenie displeja systému na správu okien X „%s“\n"
# cmd desc
#: ../src/core/main.c:176
#: ../src/core/main.c:181
msgid "Disable connection to session manager"
msgstr "Zakáže pripojenia k správcovi relácií"
# cmd desc
#: ../src/core/main.c:182
#: ../src/core/main.c:187
msgid "Replace the running window manager"
msgstr "Nahradí bežiaceho správcu okien"
# cmd desc
#: ../src/core/main.c:188
#: ../src/core/main.c:193
msgid "Specify session management ID"
msgstr "Zadá identifikátor správy relácií"
#: ../src/core/main.c:193
#: ../src/core/main.c:198
msgid "X Display to use"
msgstr "X displej, ktorý bude použitý"
# cmd desc
#: ../src/core/main.c:199
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializuje reláciu z uloženého súboru"
# cmd desc
#: ../src/core/main.c:205
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
msgstr "Použije synchrónne volania X"
# cmd desc
#: ../src/core/main.c:212
#: ../src/core/main.c:217
msgid "Run as a wayland compositor"
msgstr "Spustí ako kompozitor protokolu wayland"
#: ../src/core/main.c:220
# cmd desc
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Spustí ako kompozitor s vnoreným režimom"
#: ../src/core/main.c:231
msgid "Run as a full display server, rather than nested"
msgstr "Spustí ako plnohodnotný zobrazovací server, namiesto vnoreného režimu"
@@ -670,12 +675,12 @@ msgstr "Zobrazí verziu"
msgid "Mutter plugin to use"
msgstr "Použije zásuvný modul Mutter"
#: ../src/core/prefs.c:2004
#: ../src/core/prefs.c:1997
#, c-format
msgid "Workspace %d"
msgstr "Pracovný priestor č. %d"
#: ../src/core/screen.c:525
#: ../src/core/screen.c:521
#, c-format
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
@@ -684,12 +689,12 @@ msgstr ""
"Displej „%s“ už má správcu okien. Skúste použiť prepínač --replace, aby sa "
"aktuálny správca nahradil."
#: ../src/core/screen.c:607
#: ../src/core/screen.c:603
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Obrazovka č. %d na displeji „%s“ nie je platná\n"
#: ../src/core/util.c:118
#: ../src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter bol skompilovaný bez výpisu podrobností pri behu\n"

View File

@@ -9,6 +9,7 @@ dist_stacking_DATA = \
tests/stacking/basic-wayland.metatest \
tests/stacking/minimized.metatest \
tests/stacking/mixed-windows.metatest \
tests/stacking/set-parent.metatest \
tests/stacking/override-redirect.metatest
mutter-all.test: tests/mutter-all.test.in
@@ -18,9 +19,9 @@ installedtestsdir = $(datadir)/installed-tests/mutter
installedtests_DATA = mutter-all.test
installedtestsbindir = $(libexecdir)/installed-tests/mutter
installedtestsbin_PROGRAMS = mutter-test-client mutter-test-runner
installedtestsbin_PROGRAMS = mutter-test-client mutter-test-runner mutter-test-unit-tests
else
noinst_PROGRAMS += mutter-test-client mutter-test-runner
noinst_PROGRAMS += mutter-test-client mutter-test-runner mutter-test-unit-tests
endif
EXTRA_DIST += tests/mutter-all.test.in
@@ -31,11 +32,19 @@ mutter_test_client_LDADD = $(MUTTER_LIBS) libmutter.la
mutter_test_runner_SOURCES = tests/test-runner.c
mutter_test_runner_LDADD = $(MUTTER_LIBS) libmutter.la
.PHONY: run-tests
mutter_test_unit_tests_SOURCES = tests/unit-tests.c
mutter_test_unit_tests_LDADD = $(MUTTER_LIBS) libmutter.la
run-tests: mutter-test-client mutter-test-runner
.PHONY: run-tests run-test-runner-tests run-unit-tests
run-test-runner-tests: mutter-test-client mutter-test-runner
./mutter-test-runner $(dist_stacking_DATA)
run-unit-tests: mutter-test-unit-tests
./mutter-test-unit-tests
run-tests: run-test-runner-tests run-unit-tests
endif
# Some random test programs for bits of the code

View File

@@ -45,19 +45,24 @@ mutter_built_sources = \
if HAVE_WAYLAND
mutter_built_sources += \
pointer-gestures-protocol.c \
pointer-gestures-server-protocol.h \
pointer-gestures-unstable-v1-protocol.c \
pointer-gestures-unstable-v1-server-protocol.h \
gtk-shell-protocol.c \
gtk-shell-server-protocol.h \
xdg-shell-protocol.c \
xdg-shell-server-protocol.h \
gtk-primary-selection-protocol.c \
gtk-primary-selection-server-protocol.h \
xdg-shell-unstable-v5-protocol.c \
xdg-shell-unstable-v5-server-protocol.h \
relative-pointer-unstable-v1-protocol.c \
relative-pointer-unstable-v1-server-protocol.h \
pointer-constraints-unstable-v1-protocol.c \
pointer-constraints-unstable-v1-server-protocol.h \
$(NULL)
endif
wayland_protocols = \
wayland/protocol/pointer-gestures.xml \
wayland/protocol/gtk-shell.xml \
wayland/protocol/xdg-shell.xml \
wayland/protocol/gtk-primary-selection.xml \
$(NULL)
libmutter_la_SOURCES = \
@@ -86,6 +91,8 @@ libmutter_la_SOURCES = \
backends/meta-monitor-manager-private.h \
backends/meta-monitor-manager-dummy.c \
backends/meta-monitor-manager-dummy.h \
backends/meta-pointer-constraint.c \
backends/meta-pointer-constraint.h \
backends/meta-stage.h \
backends/meta-stage.c \
backends/edid-parse.c \
@@ -96,6 +103,8 @@ libmutter_la_SOURCES = \
backends/x11/meta-barrier-x11.h \
backends/x11/meta-cursor-renderer-x11.c \
backends/x11/meta-cursor-renderer-x11.h \
backends/x11/nested/meta-cursor-renderer-x11-nested.c \
backends/x11/nested/meta-cursor-renderer-x11-nested.h \
backends/x11/meta-idle-monitor-xsync.c \
backends/x11/meta-idle-monitor-xsync.h \
backends/x11/meta-input-settings-x11.c \
@@ -110,6 +119,8 @@ libmutter_la_SOURCES = \
core/boxes.c \
core/boxes-private.h \
meta/boxes.h \
core/meta-border.c \
core/meta-border.h \
compositor/clutter-utils.c \
compositor/clutter-utils.h \
compositor/cogl-utils.c \
@@ -190,6 +201,8 @@ libmutter_la_SOURCES = \
core/screen.c \
core/screen-private.h \
meta/screen.h \
core/startup-notification.c \
core/startup-notification-private.h \
meta/types.h \
core/restart.c \
core/stack.c \
@@ -264,6 +277,12 @@ libmutter_la_SOURCES += \
wayland/meta-wayland-keyboard.h \
wayland/meta-wayland-pointer.c \
wayland/meta-wayland-pointer.h \
wayland/meta-wayland-pointer-constraints.c \
wayland/meta-wayland-pointer-constraints.h \
wayland/meta-pointer-lock-wayland.c \
wayland/meta-pointer-lock-wayland.h \
wayland/meta-pointer-confinement-wayland.c \
wayland/meta-pointer-confinement-wayland.h \
wayland/meta-wayland-popup.c \
wayland/meta-wayland-popup.h \
wayland/meta-wayland-seat.c \
@@ -479,6 +498,20 @@ $(dbus_login1_built_sources) : Makefile.am org.freedesktop.login1.xml
--generate-c-code meta-dbus-login1 \
$(srcdir)/org.freedesktop.login1.xml
.SECONDEXPANSION:
define protostability
$(shell echo $1 | sed 's/.*\(\<unstable\>\|\<stable\>\).*/\1/')
endef
define protoname
$(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
endef
%-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
%-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
%-protocol.c : $(srcdir)/wayland/protocol/%.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
%-server-protocol.h : $(srcdir)/wayland/protocol/%.xml

View File

@@ -34,6 +34,7 @@
#include <meta/meta-idle-monitor.h>
#include "meta-cursor-renderer.h"
#include "meta-monitor-manager-private.h"
#include "backends/meta-pointer-constraint.h"
#define DEFAULT_XKB_RULES_FILE "evdev"
#define DEFAULT_XKB_MODEL "pc105+inet"
@@ -51,6 +52,8 @@ struct _MetaBackend
GHashTable *device_monitors;
gint current_device_id;
MetaPointerConstraint *client_pointer_constraint;
};
struct _MetaBackendClass
@@ -87,6 +90,13 @@ struct _MetaBackendClass
void (* update_screen_size) (MetaBackend *backend, int width, int height);
void (* select_stage_events) (MetaBackend *backend);
gboolean (* get_relative_motion_deltas) (MetaBackend *backend,
const ClutterEvent *event,
double *dx,
double *dy,
double *dx_unaccel,
double *dy_unaccel);
};
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
@@ -110,4 +120,14 @@ struct xkb_keymap * meta_backend_get_keymap (MetaBackend *backend);
void meta_backend_update_last_device (MetaBackend *backend,
int device_id);
gboolean meta_backend_get_relative_motion_deltas (MetaBackend *backend,
const ClutterEvent *event,
double *dx,
double *dy,
double *dx_unaccel,
double *dy_unaccel);
void meta_backend_set_client_pointer_constraint (MetaBackend *backend,
MetaPointerConstraint *constraint);
#endif /* META_BACKEND_PRIVATE_H */

View File

@@ -24,6 +24,8 @@
#include "config.h"
#include <stdlib.h>
#include <meta/meta-backend.h>
#include "meta-backend-private.h"
#include "meta-input-settings-private.h"
@@ -62,6 +64,8 @@ struct _MetaBackendPrivate
MetaInputSettings *input_settings;
ClutterActor *stage;
guint device_update_idle_id;
};
typedef struct _MetaBackendPrivate MetaBackendPrivate;
@@ -76,6 +80,9 @@ meta_backend_finalize (GObject *object)
g_clear_object (&priv->monitor_manager);
g_clear_object (&priv->input_settings);
if (priv->device_update_idle_id)
g_source_remove (priv->device_update_idle_id);
g_hash_table_destroy (backend->device_monitors);
G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object);
@@ -351,6 +358,17 @@ meta_backend_real_select_stage_events (MetaBackend *backend)
/* Do nothing */
}
static gboolean
meta_backend_real_get_relative_motion_deltas (MetaBackend *backend,
const ClutterEvent *event,
double *dx,
double *dy,
double *dx_unaccel,
double *dy_unaccel)
{
return FALSE;
}
static void
meta_backend_class_init (MetaBackendClass *klass)
{
@@ -364,6 +382,7 @@ meta_backend_class_init (MetaBackendClass *klass)
klass->ungrab_device = meta_backend_real_ungrab_device;
klass->update_screen_size = meta_backend_real_update_screen_size;
klass->select_stage_events = meta_backend_real_select_stage_events;
klass->get_relative_motion_deltas = meta_backend_real_get_relative_motion_deltas;
g_signal_new ("keymap-changed",
G_TYPE_FROM_CLASS (object_class),
@@ -503,12 +522,44 @@ meta_backend_get_stage (MetaBackend *backend)
return priv->stage;
}
static gboolean
update_last_device (MetaBackend *backend)
{
MetaCursorTracker *cursor_tracker = meta_cursor_tracker_get_for_screen (NULL);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterInputDeviceType device_type;
ClutterDeviceManager *manager;
ClutterInputDevice *device;
priv->device_update_idle_id = 0;
manager = clutter_device_manager_get_default ();
device = clutter_device_manager_get_device (manager,
backend->current_device_id);
device_type = clutter_input_device_get_device_type (device);
g_signal_emit_by_name (backend, "last-device-changed",
backend->current_device_id);
switch (device_type)
{
case CLUTTER_KEYBOARD_DEVICE:
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;
default:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
}
return G_SOURCE_REMOVE;
}
void
meta_backend_update_last_device (MetaBackend *backend,
int device_id)
{
ClutterInputDeviceType device_type;
MetaCursorTracker *cursor_tracker;
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *manager;
ClutterInputDevice *device;
@@ -522,26 +573,43 @@ meta_backend_update_last_device (MetaBackend *backend,
clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER)
return;
device_type = clutter_input_device_get_device_type (device);
cursor_tracker = meta_cursor_tracker_get_for_screen (NULL);
backend->current_device_id = device_id;
g_signal_emit_by_name (backend, "last-device-changed", device_id);
if (device_type == CLUTTER_KEYBOARD_DEVICE)
return;
switch (device_type)
if (priv->device_update_idle_id == 0)
{
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;
default:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
priv->device_update_idle_id =
g_idle_add ((GSourceFunc) update_last_device, backend);
g_source_set_name_by_id (priv->device_update_idle_id,
"[mutter] update_last_device");
}
}
gboolean
meta_backend_get_relative_motion_deltas (MetaBackend *backend,
const ClutterEvent *event,
double *dx,
double *dy,
double *dx_unaccel,
double *dy_unaccel)
{
MetaBackendClass *klass = META_BACKEND_GET_CLASS (backend);
return klass->get_relative_motion_deltas (backend,
event,
dx, dy,
dx_unaccel, dy_unaccel);
}
void
meta_backend_set_client_pointer_constraint (MetaBackend *backend,
MetaPointerConstraint *constraint)
{
g_assert (!constraint || (constraint && !backend->client_pointer_constraint));
g_clear_object (&backend->client_pointer_constraint);
if (constraint)
backend->client_pointer_constraint = g_object_ref (constraint);
}
static GType
get_backend_type (void)
{
@@ -626,7 +694,10 @@ meta_clutter_init (void)
meta_create_backend ();
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize Clutter.\n");
{
g_warning ("Unable to initialize Clutter.\n");
exit (1);
}
/*
* XXX: We cannot handle high dpi scaling yet, so fix the scale to 1

View File

@@ -26,6 +26,8 @@
#ifndef META_BARRIER_PRIVATE_H
#define META_BARRIER_PRIVATE_H
#include "core/meta-border.h"
G_BEGIN_DECLS
#define META_TYPE_BARRIER_IMPL (meta_barrier_impl_get_type ())
@@ -67,14 +69,7 @@ G_END_DECLS
struct _MetaBarrierPrivate
{
MetaDisplay *display;
int x1;
int y1;
int x2;
int y2;
MetaBarrierDirection directions;
MetaBorder border;
MetaBarrierImpl *impl;
};

View File

@@ -61,19 +61,20 @@ meta_barrier_get_property (GObject *object,
g_value_set_object (value, priv->display);
break;
case PROP_X1:
g_value_set_int (value, priv->x1);
g_value_set_int (value, priv->border.line.a.x);
break;
case PROP_Y1:
g_value_set_int (value, priv->y1);
g_value_set_int (value, priv->border.line.a.y);
break;
case PROP_X2:
g_value_set_int (value, priv->x2);
g_value_set_int (value, priv->border.line.b.x);
break;
case PROP_Y2:
g_value_set_int (value, priv->y2);
g_value_set_int (value, priv->border.line.b.y);
break;
case PROP_DIRECTIONS:
g_value_set_flags (value, priv->directions);
g_value_set_flags (value,
meta_border_get_allows_directions (&priv->border));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -95,19 +96,20 @@ meta_barrier_set_property (GObject *object,
priv->display = g_value_get_object (value);
break;
case PROP_X1:
priv->x1 = g_value_get_int (value);
priv->border.line.a.x = g_value_get_int (value);
break;
case PROP_Y1:
priv->y1 = g_value_get_int (value);
priv->border.line.a.y = g_value_get_int (value);
break;
case PROP_X2:
priv->x2 = g_value_get_int (value);
priv->border.line.b.x = g_value_get_int (value);
break;
case PROP_Y2:
priv->y2 = g_value_get_int (value);
priv->border.line.b.y = g_value_get_int (value);
break;
case PROP_DIRECTIONS:
priv->directions = g_value_get_flags (value);
meta_border_set_allows_directions (&priv->border,
g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -166,7 +168,8 @@ meta_barrier_constructed (GObject *object)
MetaBarrier *barrier = META_BARRIER (object);
MetaBarrierPrivate *priv = barrier->priv;
g_return_if_fail (priv->x1 == priv->x2 || priv->y1 == priv->y2);
g_return_if_fail (priv->border.line.a.x == priv->border.line.b.x ||
priv->border.line.a.y == priv->border.line.b.y);
#if defined(HAVE_NATIVE_BACKEND)
if (META_IS_BACKEND_NATIVE (meta_get_backend ()))

View File

@@ -27,6 +27,8 @@
#include "meta-cursor-renderer.h"
#include <meta/meta-backend.h>
#include <backends/meta-backend-private.h>
#include <backends/meta-monitor-manager-private.h>
#include <meta/util.h>
#include <cogl/cogl.h>
@@ -37,7 +39,6 @@
struct _MetaCursorRendererPrivate
{
int current_x, current_y;
MetaRectangle current_rect;
MetaCursorSprite *displayed_cursor;
gboolean handled_by_backend;
@@ -47,28 +48,33 @@ typedef struct _MetaCursorRendererPrivate MetaCursorRendererPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer, G_TYPE_OBJECT);
static void
queue_redraw (MetaCursorRenderer *renderer)
queue_redraw (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
CoglTexture *texture;
MetaRectangle rect = { 0 };
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
/* During early initialization, we can have no stage */
if (!stage)
return;
if (priv->displayed_cursor && !priv->handled_by_backend)
texture = meta_cursor_sprite_get_cogl_texture (priv->displayed_cursor,
NULL, NULL);
if (cursor_sprite && !priv->handled_by_backend)
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
else
texture = NULL;
meta_stage_set_cursor (META_STAGE (stage), texture, &priv->current_rect);
meta_stage_set_cursor (META_STAGE (stage), texture, &rect);
}
static gboolean
meta_cursor_renderer_real_update_cursor (MetaCursorRenderer *renderer)
meta_cursor_renderer_real_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
return FALSE;
}
@@ -84,35 +90,63 @@ meta_cursor_renderer_init (MetaCursorRenderer *renderer)
{
}
MetaRectangle
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
CoglTexture *texture;
int hot_x, hot_y;
int width, height;
float texture_scale;
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
if (!texture)
return (MetaRectangle) { 0 };
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
return (MetaRectangle) {
.x = (int)roundf (priv->current_x - (hot_x * texture_scale)),
.y = (int)roundf (priv->current_y - (hot_y * texture_scale)),
.width = (int)roundf (width * texture_scale),
.height = (int)roundf (height * texture_scale),
};
}
static gboolean
is_cursor_in_monitors_area (int x, int y)
{
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (meta_get_backend ());
return meta_monitor_manager_get_monitor_at_point (monitor_manager,
(gfloat) x, (gfloat) y) >= 0;
}
static void
update_cursor (MetaCursorRenderer *renderer)
update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
gboolean handled_by_backend;
gboolean should_redraw = FALSE;
if (priv->displayed_cursor)
{
CoglTexture *texture;
int hot_x, hot_y;
/* do not render cursor if it is not on any monitor. Such situation
* can occur e. g. after monitor hot-plug */
if (!is_cursor_in_monitors_area (priv->current_x, priv->current_y))
return;
texture = meta_cursor_sprite_get_cogl_texture (priv->displayed_cursor,
&hot_x, &hot_y);
if (cursor_sprite)
meta_cursor_sprite_prepare_at (cursor_sprite,
priv->current_x,
priv->current_y);
priv->current_rect.x = priv->current_x - hot_x;
priv->current_rect.y = priv->current_y - hot_y;
priv->current_rect.width = cogl_texture_get_width (COGL_TEXTURE (texture));
priv->current_rect.height = cogl_texture_get_height (COGL_TEXTURE (texture));
}
else
{
priv->current_rect.x = 0;
priv->current_rect.y = 0;
priv->current_rect.width = 0;
priv->current_rect.height = 0;
}
handled_by_backend = META_CURSOR_RENDERER_GET_CLASS (renderer)->update_cursor (renderer);
handled_by_backend =
META_CURSOR_RENDERER_GET_CLASS (renderer)->update_cursor (renderer,
cursor_sprite);
if (handled_by_backend != priv->handled_by_backend)
{
priv->handled_by_backend = handled_by_backend;
@@ -123,7 +157,7 @@ update_cursor (MetaCursorRenderer *renderer)
should_redraw = TRUE;
if (should_redraw)
queue_redraw (renderer);
queue_redraw (renderer, cursor_sprite);
}
MetaCursorRenderer *
@@ -140,16 +174,18 @@ meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
if (priv->displayed_cursor == cursor_sprite)
return;
priv->displayed_cursor = cursor_sprite;
update_cursor (renderer);
update_cursor (renderer, cursor_sprite);
}
void
meta_cursor_renderer_force_update (MetaCursorRenderer *renderer)
{
update_cursor (renderer);
queue_redraw (renderer);
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
update_cursor (renderer, priv->displayed_cursor);
}
void
@@ -163,7 +199,7 @@ meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
priv->current_x = x;
priv->current_y = y;
update_cursor (renderer);
update_cursor (renderer, priv->displayed_cursor);
}
MetaCursorSprite *
@@ -174,14 +210,6 @@ meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer)
return priv->displayed_cursor;
}
const MetaRectangle *
meta_cursor_renderer_get_rect (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
return &priv->current_rect;
}
#ifdef HAVE_WAYLAND
void
meta_cursor_renderer_realize_cursor_from_wl_buffer (MetaCursorRenderer *renderer,

View File

@@ -42,7 +42,8 @@ struct _MetaCursorRendererClass
{
GObjectClass parent_class;
gboolean (* update_cursor) (MetaCursorRenderer *renderer);
gboolean (* update_cursor) (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
#ifdef HAVE_WAYLAND
void (* realize_cursor_from_wl_buffer) (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite,
@@ -53,8 +54,6 @@ struct _MetaCursorRendererClass
XcursorImage *xc_image);
};
GType meta_cursor_renderer_get_type (void) G_GNUC_CONST;
MetaCursorRenderer * meta_cursor_renderer_new (void);
void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
@@ -65,7 +64,9 @@ void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer);
MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);
const MetaRectangle * meta_cursor_renderer_get_rect (MetaCursorRenderer *renderer);
MetaRectangle meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
#ifdef HAVE_WAYLAND
void meta_cursor_renderer_realize_cursor_from_wl_buffer (MetaCursorRenderer *renderer,

View File

@@ -246,10 +246,11 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
if (sprite != NULL)
{
MetaCursorSprite *cursor_sprite =
meta_cursor_sprite_from_texture (sprite,
cursor_image->xhot,
cursor_image->yhot);
MetaCursorSprite *cursor_sprite = meta_cursor_sprite_new ();
meta_cursor_sprite_set_texture (cursor_sprite,
sprite,
cursor_image->xhot,
cursor_image->yhot);
cogl_object_unref (sprite);
tracker->xfixes_cursor = cursor_sprite;
}
@@ -279,7 +280,7 @@ meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
}
if (cursor_sprite)
return meta_cursor_sprite_get_cogl_texture (cursor_sprite, NULL, NULL);
return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
else
return NULL;
}
@@ -311,7 +312,7 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
}
if (cursor_sprite)
meta_cursor_sprite_get_cogl_texture (cursor_sprite, x, y);
meta_cursor_sprite_get_hotspot (cursor_sprite, x, y);
else
{
if (x)
@@ -360,12 +361,12 @@ get_pointer_position_gdk (int *x,
int *y,
int *mods)
{
GdkDeviceManager *gmanager;
GdkSeat *gseat;
GdkDevice *gdevice;
GdkScreen *gscreen;
gmanager = gdk_display_get_device_manager (gdk_display_get_default ());
gdevice = gdk_x11_device_manager_lookup (gmanager, META_VIRTUAL_CORE_POINTER_ID);
gseat = gdk_display_get_default_seat (gdk_display_get_default ());
gdevice = gdk_seat_get_pointer (gseat);
gdk_device_get_position (gdevice, &gscreen, x, y);
if (mods)

View File

@@ -35,38 +35,33 @@
#include <X11/extensions/Xfixes.h>
#include <X11/Xcursor/Xcursor.h>
#ifdef HAVE_WAYLAND
#include <cogl/cogl-wayland-server.h>
#endif
enum {
PREPARE_AT,
typedef struct
{
CoglTexture2D *texture;
int hot_x, hot_y;
} MetaCursorImage;
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
struct _MetaCursorSprite
{
GObject parent;
MetaCursor cursor;
MetaCursorImage image;
CoglTexture2D *texture;
float texture_scale;
int hot_x, hot_y;
int current_frame;
XcursorImages *xcursor_images;
int theme_scale;
gboolean theme_dirty;
};
GType meta_cursor_sprite_get_type (void) G_GNUC_CONST;
G_DEFINE_TYPE (MetaCursorSprite, meta_cursor_sprite, G_TYPE_OBJECT)
static void
meta_cursor_image_free (MetaCursorImage *image)
{
if (image->texture)
cogl_object_unref (image->texture);
}
static const char *
translate_meta_cursor (MetaCursor cursor)
{
@@ -123,24 +118,26 @@ meta_cursor_create_x_cursor (Display *xdisplay,
}
static XcursorImages *
load_cursor_on_client (MetaCursor cursor)
load_cursor_on_client (MetaCursor cursor, int scale)
{
return XcursorLibraryLoadImages (translate_meta_cursor (cursor),
meta_prefs_get_cursor_theme (),
meta_prefs_get_cursor_size ());
meta_prefs_get_cursor_size () * scale);
}
static void
meta_cursor_sprite_load_from_xcursor_image (MetaCursorSprite *self,
XcursorImage *xc_image)
{
MetaCursorImage *image = &self->image;
MetaBackend *meta_backend = meta_get_backend ();
MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (meta_backend);
uint width, height, rowstride;
CoglPixelFormat cogl_format;
ClutterBackend *clutter_backend;
CoglContext *cogl_context;
CoglTexture *texture;
g_assert (self->texture == NULL);
width = xc_image->width;
height = xc_image->height;
@@ -152,17 +149,17 @@ meta_cursor_sprite_load_from_xcursor_image (MetaCursorSprite *self,
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888;
#endif
image->hot_x = xc_image->xhot;
image->hot_y = xc_image->yhot;
clutter_backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (clutter_backend);
image->texture = cogl_texture_2d_new_from_data (cogl_context,
width, height,
cogl_format,
rowstride,
(uint8_t *) xc_image->pixels,
NULL);
texture = cogl_texture_2d_new_from_data (cogl_context,
width, height,
cogl_format,
rowstride,
(uint8_t *) xc_image->pixels,
NULL);
meta_cursor_sprite_set_texture (self, texture,
xc_image->xhot, xc_image->yhot);
cogl_object_unref (texture);
meta_cursor_renderer_realize_cursor_from_xcursor (renderer, self, xc_image);
}
@@ -186,8 +183,9 @@ meta_cursor_sprite_tick_frame (MetaCursorSprite *self)
if (self->current_frame >= self->xcursor_images->nimage)
self->current_frame = 0;
meta_cursor_image_free (&self->image);
image = meta_cursor_sprite_get_current_frame_image (self);
g_clear_pointer (&self->texture, cogl_object_unref);
meta_cursor_sprite_load_from_xcursor_image (self, image);
}
@@ -208,94 +206,83 @@ meta_cursor_sprite_is_animated (MetaCursorSprite *self)
}
MetaCursorSprite *
meta_cursor_sprite_from_theme (MetaCursor cursor)
meta_cursor_sprite_new (void)
{
return g_object_new (META_TYPE_CURSOR_SPRITE, NULL);
}
static void
meta_cursor_sprite_load_from_theme (MetaCursorSprite *self)
{
MetaCursorSprite *self;
XcursorImage *image;
self = g_object_new (META_TYPE_CURSOR_SPRITE, NULL);
g_assert (self->cursor != META_CURSOR_NONE);
/* We might be reloading with a different scale. If so clear the old data. */
if (self->xcursor_images)
{
g_clear_pointer (&self->texture, cogl_object_unref);
XcursorImagesDestroy (self->xcursor_images);
}
self->cursor = cursor;
self->current_frame = 0;
self->xcursor_images = load_cursor_on_client (self->cursor);
self->xcursor_images = load_cursor_on_client (self->cursor,
self->theme_scale);
if (!self->xcursor_images)
meta_fatal ("Could not find cursor. Perhaps set XCURSOR_PATH?");
image = meta_cursor_sprite_get_current_frame_image (self);
meta_cursor_sprite_load_from_xcursor_image (self, image);
return self;
self->theme_dirty = FALSE;
}
MetaCursorSprite *
meta_cursor_sprite_from_texture (CoglTexture2D *texture,
int hot_x,
int hot_y)
meta_cursor_sprite_from_theme (MetaCursor cursor)
{
MetaCursorSprite *self;
self = g_object_new (META_TYPE_CURSOR_SPRITE, NULL);
self = meta_cursor_sprite_new ();
cogl_object_ref (texture);
self->image.texture = texture;
self->image.hot_x = hot_x;
self->image.hot_y = hot_y;
self->cursor = cursor;
self->theme_dirty = TRUE;
return self;
}
#ifdef HAVE_WAYLAND
static void
meta_cursor_sprite_load_from_buffer (MetaCursorSprite *self,
struct wl_resource *buffer,
int hot_x,
int hot_y)
void
meta_cursor_sprite_set_texture (MetaCursorSprite *self,
CoglTexture *texture,
int hot_x,
int hot_y)
{
MetaCursorImage *image = &self->image;
MetaBackend *meta_backend = meta_get_backend ();
MetaCursorRenderer *renderer =
meta_backend_get_cursor_renderer (meta_backend);
ClutterBackend *backend;
CoglContext *cogl_context;
image->hot_x = hot_x;
image->hot_y = hot_y;
backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (backend);
image->texture = cogl_wayland_texture_2d_new_from_buffer (cogl_context, buffer, NULL);
meta_cursor_renderer_realize_cursor_from_wl_buffer (renderer, self, buffer);
g_clear_pointer (&self->texture, cogl_object_unref);
if (texture)
self->texture = cogl_object_ref (texture);
self->hot_x = hot_x;
self->hot_y = hot_y;
}
MetaCursorSprite *
meta_cursor_sprite_from_buffer (struct wl_resource *buffer,
int hot_x,
int hot_y)
void
meta_cursor_sprite_set_texture_scale (MetaCursorSprite *self,
float scale)
{
MetaCursorSprite *self;
self = g_object_new (META_TYPE_CURSOR_SPRITE, NULL);
meta_cursor_sprite_load_from_buffer (self, buffer, hot_x, hot_y);
return self;
self->texture_scale = scale;
}
void
meta_cursor_sprite_set_theme_scale (MetaCursorSprite *self,
int theme_scale)
{
if (self->theme_scale != theme_scale)
self->theme_dirty = TRUE;
self->theme_scale = theme_scale;
}
#endif
CoglTexture *
meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *self,
int *hot_x,
int *hot_y)
meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *self)
{
if (hot_x)
*hot_x = self->image.hot_x;
if (hot_y)
*hot_y = self->image.hot_y;
return COGL_TEXTURE (self->image.texture);
return COGL_TEXTURE (self->texture);
}
MetaCursor
@@ -309,25 +296,35 @@ meta_cursor_sprite_get_hotspot (MetaCursorSprite *self,
int *hot_x,
int *hot_y)
{
*hot_x = self->image.hot_x;
*hot_y = self->image.hot_y;
*hot_x = self->hot_x;
*hot_y = self->hot_y;
}
guint
meta_cursor_sprite_get_width (MetaCursorSprite *self)
float
meta_cursor_sprite_get_texture_scale (MetaCursorSprite *self)
{
return cogl_texture_get_width (COGL_TEXTURE (self->image.texture));
return self->texture_scale;
}
guint
meta_cursor_sprite_get_height (MetaCursorSprite *self)
void
meta_cursor_sprite_prepare_at (MetaCursorSprite *self,
int x,
int y)
{
return cogl_texture_get_height (COGL_TEXTURE (self->image.texture));
g_signal_emit (self, signals[PREPARE_AT], 0, x, y);
}
void
meta_cursor_sprite_realize_texture (MetaCursorSprite *self)
{
if (self->theme_dirty)
meta_cursor_sprite_load_from_theme (self);
}
static void
meta_cursor_sprite_init (MetaCursorSprite *self)
{
self->texture_scale = 1.0f;
}
static void
@@ -337,7 +334,8 @@ meta_cursor_sprite_finalize (GObject *object)
if (self->xcursor_images)
XcursorImagesDestroy (self->xcursor_images);
meta_cursor_image_free (&self->image);
g_clear_pointer (&self->texture, cogl_object_unref);
G_OBJECT_CLASS (meta_cursor_sprite_parent_class)->finalize (object);
}
@@ -348,4 +346,13 @@ meta_cursor_sprite_class_init (MetaCursorSpriteClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_cursor_sprite_finalize;
signals[PREPARE_AT] = g_signal_new ("prepare-at",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_INT,
G_TYPE_INT);
}

View File

@@ -23,6 +23,7 @@
#define META_CURSOR_H
#include <meta/common.h>
#include <meta/boxes.h>
typedef struct _MetaCursorSprite MetaCursorSprite;
@@ -32,35 +33,40 @@ G_DECLARE_FINAL_TYPE (MetaCursorSprite,
META, CURSOR_SPRITE,
GObject);
MetaCursorSprite * meta_cursor_sprite_from_theme (MetaCursor cursor);
MetaCursorSprite * meta_cursor_sprite_new (void);
#ifdef HAVE_WAYLAND
#include <wayland-server.h>
MetaCursorSprite * meta_cursor_sprite_from_buffer (struct wl_resource *buffer,
int hot_x,
int hot_y);
#endif
MetaCursorSprite * meta_cursor_sprite_from_theme (MetaCursor cursor);
void meta_cursor_sprite_set_theme_scale (MetaCursorSprite *self,
int scale);
MetaCursor meta_cursor_sprite_get_meta_cursor (MetaCursorSprite *self);
MetaCursorSprite * meta_cursor_sprite_from_texture (CoglTexture2D *texture,
int hot_x,
int hot_y);
Cursor meta_cursor_create_x_cursor (Display *xdisplay,
MetaCursor cursor);
CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *self,
int *hot_x,
int *hot_y);
void meta_cursor_sprite_prepare_at (MetaCursorSprite *self,
int x,
int y);
void meta_cursor_sprite_realize_texture (MetaCursorSprite *self);
void meta_cursor_sprite_set_texture (MetaCursorSprite *self,
CoglTexture *texture,
int hot_x,
int hot_y);
void meta_cursor_sprite_set_texture_scale (MetaCursorSprite *self,
float scale);
CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *self);
void meta_cursor_sprite_get_hotspot (MetaCursorSprite *self,
int *hot_x,
int *hot_y);
guint meta_cursor_sprite_get_width (MetaCursorSprite *self);
guint meta_cursor_sprite_get_height (MetaCursorSprite *self);
float meta_cursor_sprite_get_texture_scale (MetaCursorSprite *self);
gboolean meta_cursor_sprite_is_animated (MetaCursorSprite *self);
void meta_cursor_sprite_tick_frame (MetaCursorSprite *self);

View File

@@ -63,9 +63,9 @@ struct _MetaInputSettingsClass
void (* set_invert_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean inverted);
void (* set_scroll_method) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadScrollMethod mode);
void (* set_edge_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_scroll_button) (MetaInputSettings *settings,
ClutterInputDevice *device,
guint button);

View File

@@ -395,11 +395,11 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
}
static void
update_touchpad_scroll_method (MetaInputSettings *input_settings,
ClutterInputDevice *device)
update_touchpad_edge_scroll (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsClass *input_settings_class;
GDesktopTouchpadScrollMethod method;
gboolean edge_scroll_enabled;
MetaInputSettingsPrivate *priv;
if (device &&
@@ -408,19 +408,19 @@ update_touchpad_scroll_method (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
method = g_settings_get_enum (priv->touchpad_settings, "scroll-method");
edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "edge-scrolling-enabled");
if (device)
{
settings_device_set_uint_setting (input_settings, device,
input_settings_class->set_scroll_method,
method);
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_edge_scroll,
edge_scroll_enabled);
}
else
{
settings_set_uint_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
(ConfigUintFunc) input_settings_class->set_scroll_method,
method);
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
(ConfigBoolFunc) input_settings_class->set_edge_scroll,
edge_scroll_enabled);
}
}
@@ -429,7 +429,7 @@ update_touchpad_click_method (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsClass *input_settings_class;
GDesktopTouchpadScrollMethod method;
GDesktopTouchpadClickMethod method;
MetaInputSettingsPrivate *priv;
if (device &&
@@ -523,15 +523,13 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
}
else if (!device)
{
MetaInputSettingsPrivate *priv;
const GSList *devices;
priv = meta_input_settings_get_instance_private (input_settings);
devices = clutter_device_manager_peek_devices (priv->device_manager);
while (devices)
{
ClutterInputDevice *device = devices->data;
device = devices->data;
if (device_is_trackball (device))
input_settings_class->set_scroll_button (input_settings, device, button);
@@ -647,8 +645,8 @@ meta_input_settings_changed_cb (GSettings *settings,
update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp (key, "send-events") == 0)
update_touchpad_send_events (input_settings, NULL);
else if (strcmp (key, "scroll-method") == 0)
update_touchpad_scroll_method (input_settings, NULL);
else if (strcmp (key, "edge-scrolling-enabled") == 0)
update_touchpad_edge_scroll (input_settings, NULL);
else if (strcmp (key, "click-method") == 0)
update_touchpad_click_method (input_settings, NULL);
}
@@ -773,7 +771,7 @@ apply_device_settings (MetaInputSettings *input_settings,
update_device_natural_scroll (input_settings, device);
update_touchpad_tap_enabled (input_settings, device);
update_touchpad_send_events (input_settings, device);
update_touchpad_scroll_method (input_settings, device);
update_touchpad_edge_scroll (input_settings, device);
update_touchpad_click_method (input_settings, device);
update_trackball_scroll_button (input_settings, device);

View File

@@ -1846,7 +1846,7 @@ crtc_assignment_assign (CrtcAssignment *assign,
}
else
{
MetaCRTCInfo *info = g_slice_new0 (MetaCRTCInfo);
info = g_slice_new0 (MetaCRTCInfo);
info->crtc = crtc;
info->mode = mode;

View File

@@ -197,7 +197,7 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
{
MetaMonitorMode *mode;
MetaOutput *output;
int i, n_outputs;
unsigned int j;
int width, height;
mode = crtc_info->mode;
@@ -223,10 +223,9 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
screen_width = MAX (screen_width, crtc_info->x + width);
screen_height = MAX (screen_height, crtc_info->y + height);
n_outputs = crtc_info->outputs->len;
for (i = 0; i < n_outputs; i++)
for (j = 0; j < crtc_info->outputs->len; j++)
{
output = ((MetaOutput**)crtc_info->outputs->pdata)[i];
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
output->is_dirty = TRUE;
output->crtc = crtc;

View File

@@ -174,7 +174,8 @@ struct _MetaCRTC
/* Used when changing configuration */
gboolean is_dirty;
MetaCursorSprite *cursor;
/* Used by cursor renderer backend */
void *cursor_renderer_private;
gpointer driver_private;
GDestroyNotify driver_notify;
@@ -413,6 +414,10 @@ gint meta_monitor_manager_get_monitor_at_point (MetaMonitorManager
gfloat x,
gfloat y);
void meta_monitor_manager_clear_output (MetaOutput *output);
void meta_monitor_manager_clear_mode (MetaMonitorMode *mode);
void meta_monitor_manager_clear_crtc (MetaCRTC *crtc);
/* Returns true if transform causes width and height to be inverted
This is true for the odd transforms in the enum */
static inline gboolean

View File

@@ -178,7 +178,7 @@ make_logical_config (MetaMonitorManager *manager)
unsigned int i, j;
monitor_infos = g_array_sized_new (FALSE, TRUE, sizeof (MetaMonitorInfo),
manager->n_outputs);
manager->n_crtcs);
/* Walk the list of MetaCRTCs, and build a MetaMonitorInfo
for each of them, unless they reference a rectangle that
@@ -346,6 +346,23 @@ meta_monitor_manager_constructed (GObject *object)
manager->in_init = FALSE;
}
void
meta_monitor_manager_clear_output (MetaOutput *output)
{
g_free (output->name);
g_free (output->vendor);
g_free (output->product);
g_free (output->serial);
g_free (output->modes);
g_free (output->possible_crtcs);
g_free (output->possible_clones);
if (output->driver_notify)
output->driver_notify (output);
memset (output, 0, sizeof (*output));
}
static void
meta_monitor_manager_free_output_array (MetaOutput *old_outputs,
int n_old_outputs)
@@ -353,22 +370,22 @@ meta_monitor_manager_free_output_array (MetaOutput *old_outputs,
int i;
for (i = 0; i < n_old_outputs; i++)
{
g_free (old_outputs[i].name);
g_free (old_outputs[i].vendor);
g_free (old_outputs[i].product);
g_free (old_outputs[i].serial);
g_free (old_outputs[i].modes);
g_free (old_outputs[i].possible_crtcs);
g_free (old_outputs[i].possible_clones);
if (old_outputs[i].driver_notify)
old_outputs[i].driver_notify (&old_outputs[i]);
}
meta_monitor_manager_clear_output (&old_outputs[i]);
g_free (old_outputs);
}
void
meta_monitor_manager_clear_mode (MetaMonitorMode *mode)
{
g_free (mode->name);
if (mode->driver_notify)
mode->driver_notify (mode);
memset (mode, 0, sizeof (*mode));
}
static void
meta_monitor_manager_free_mode_array (MetaMonitorMode *old_modes,
int n_old_modes)
@@ -376,16 +393,20 @@ meta_monitor_manager_free_mode_array (MetaMonitorMode *old_modes,
int i;
for (i = 0; i < n_old_modes; i++)
{
g_free (old_modes[i].name);
if (old_modes[i].driver_notify)
old_modes[i].driver_notify (&old_modes[i]);
}
meta_monitor_manager_clear_mode (&old_modes[i]);
g_free (old_modes);
}
void
meta_monitor_manager_clear_crtc (MetaCRTC *crtc)
{
if (crtc->driver_notify)
crtc->driver_notify (crtc);
memset (crtc, 0, sizeof (*crtc));
}
static void
meta_monitor_manager_free_crtc_array (MetaCRTC *old_crtcs,
int n_old_crtcs)
@@ -393,10 +414,7 @@ meta_monitor_manager_free_crtc_array (MetaCRTC *old_crtcs,
int i;
for (i = 0; i < n_old_crtcs; i++)
{
if (old_crtcs[i].driver_notify)
old_crtcs[i].driver_notify (&old_crtcs[i]);
}
meta_monitor_manager_clear_crtc (&old_crtcs[i]);
g_free (old_crtcs);
}
@@ -884,8 +902,7 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
crtc_info->y = 0;
}
if (transform < META_MONITOR_TRANSFORM_NORMAL ||
transform > META_MONITOR_TRANSFORM_FLIPPED_270 ||
if (transform > META_MONITOR_TRANSFORM_FLIPPED_270 ||
((crtc->all_transforms & (1 << transform)) == 0))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,

View File

@@ -0,0 +1,57 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include "backends/meta-pointer-constraint.h"
#include <glib-object.h>
G_DEFINE_TYPE (MetaPointerConstraint, meta_pointer_constraint, G_TYPE_OBJECT);
static void
meta_pointer_constraint_init (MetaPointerConstraint *constraint)
{
}
static void
meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
{
}
void
meta_pointer_constraint_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y)
{
META_POINTER_CONSTRAINT_GET_CLASS (constraint)->constrain (constraint,
device,
time,
prev_x, prev_y,
x, y);
}

View File

@@ -0,0 +1,60 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_POINTER_CONSTRAINT_H
#define META_POINTER_CONSTRAINT_H
#include <glib-object.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define META_TYPE_POINTER_CONSTRAINT (meta_pointer_constraint_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaPointerConstraint, meta_pointer_constraint,
META, POINTER_CONSTRAINT, GObject);
struct _MetaPointerConstraintClass
{
GObjectClass parent_class;
void (*constrain) (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y);
};
void meta_pointer_constraint_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y);
G_END_DECLS
#endif /* META_POINTER_CONSTRAINT_H */

View File

@@ -36,6 +36,10 @@
#include "meta-monitor-manager-kms.h"
#include "meta-cursor-renderer-native.h"
#include "meta-launcher.h"
#include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-pointer-constraint.h"
#include <stdlib.h>
struct _MetaBackendNativePrivate
{
@@ -137,6 +141,24 @@ constrain_to_barriers (ClutterInputDevice *device,
new_x, new_y);
}
static void
constrain_to_client_constraint (ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y)
{
MetaBackend *backend = meta_get_backend ();
MetaPointerConstraint *constraint = backend->client_pointer_constraint;
if (!constraint)
return;
meta_pointer_constraint_constrain (constraint, device,
time, prev_x, prev_y, x, y);
}
/*
* The pointer constrain code is mostly a rip-off of the XRandR code from Xorg.
* (from xserver/randr/rrcrtc.c, RRConstrainCursorHarder)
@@ -191,10 +213,12 @@ constrain_all_screen_monitors (ClutterInputDevice *device,
static void
pointer_constrain_callback (ClutterInputDevice *device,
guint32 time,
float *new_x,
float *new_y,
gpointer user_data)
guint32 time,
float prev_x,
float prev_y,
float *new_x,
float *new_y,
gpointer user_data)
{
MetaMonitorManager *monitor_manager;
MetaMonitorInfo *monitors;
@@ -203,6 +227,9 @@ pointer_constrain_callback (ClutterInputDevice *device,
/* Constrain to barriers */
constrain_to_barriers (device, time, new_x, new_y);
/* Constrain to pointer lock */
constrain_to_client_constraint (device, time, prev_x, prev_y, new_x, new_y);
monitor_manager = meta_monitor_manager_get ();
monitors = meta_monitor_manager_get_monitor_infos (monitor_manager, &n_monitors);
@@ -253,11 +280,16 @@ meta_backend_native_warp_pointer (MetaBackend *backend,
{
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (NULL);
/* XXX */
guint32 time_ = 0;
/* Warp the input device pointer state. */
clutter_evdev_warp_pointer (device, time_, x, y);
/* Warp displayed pointer cursor. */
meta_cursor_tracker_update_position (tracker, x, y);
}
static void
@@ -304,6 +336,19 @@ meta_backend_native_lock_layout_group (MetaBackend *backend,
g_signal_emit_by_name (backend, "keymap-layout-group-changed", idx, 0);
}
static gboolean
meta_backend_native_get_relative_motion_deltas (MetaBackend *backend,
const ClutterEvent *event,
double *dx,
double *dy,
double *dx_unaccel,
double *dy_unaccel)
{
return clutter_evdev_event_get_relative_motion (event,
dx, dy,
dx_unaccel, dy_unaccel);
}
static void
meta_backend_native_class_init (MetaBackendNativeClass *klass)
{
@@ -321,15 +366,21 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
backend_class->set_keymap = meta_backend_native_set_keymap;
backend_class->get_keymap = meta_backend_native_get_keymap;
backend_class->lock_layout_group = meta_backend_native_lock_layout_group;
backend_class->get_relative_motion_deltas = meta_backend_native_get_relative_motion_deltas;
}
static void
meta_backend_native_init (MetaBackendNative *native)
{
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native);
GError *error = NULL;
/* We're a display server, so start talking to weston-launch. */
priv->launcher = meta_launcher_new ();
priv->launcher = meta_launcher_new (&error);
if (priv->launcher == NULL)
{
g_warning ("Can't initialize KMS backend: %s\n", error->message);
exit (1);
}
priv->barrier_manager = meta_barrier_manager_native_new ();

View File

@@ -93,126 +93,18 @@ next_serial (void)
return barrier_serial;
}
typedef struct _Vector2
{
float x, y;
} Vector2;
static float
vector2_cross_product (Vector2 a, Vector2 b)
{
return a.x * b.y - a.y * b.x;
}
static Vector2
vector2_add (Vector2 a, Vector2 b)
{
return (Vector2) {
.x = a.x + b.x,
.y = a.y + b.y,
};
}
static Vector2
vector2_subtract (Vector2 a, Vector2 b)
{
return (Vector2) {
.x = a.x - b.x,
.y = a.y - b.y,
};
}
static Vector2
vector2_multiply_constant (float c, Vector2 a)
{
return (Vector2) {
.x = c * a.x,
.y = c * a.y,
};
}
typedef struct _Line2
{
Vector2 a;
Vector2 b;
} Line2;
static gboolean
lines_intersect (Line2 *line1, Line2 *line2, Vector2 *intersection)
{
Vector2 p = line1->a;
Vector2 r = vector2_subtract (line1->b, line1->a);
Vector2 q = line2->a;
Vector2 s = vector2_subtract (line2->b, line2->a);
float rxs;
float sxr;
float t;
float u;
/*
* The line (p, r) and (q, s) intersects where
*
* p + t r = q + u s
*
* Calculate t:
*
* (p + t r) × s = (q + u s) × s
* p × s + t (r × s) = q × s + u (s × s)
* p × s + t (r × s) = q × s
* t (r × s) = q × s - p × s
* t (r × s) = (q - p) × s
* t = ((q - p) × s) / (r × s)
*
* Using the same method, for u we get:
*
* u = ((p - q) × r) / (s × r)
*/
rxs = vector2_cross_product (r, s);
sxr = vector2_cross_product (s, r);
/* If r × s = 0 then the lines are either parallel or collinear. */
if (fabs ( rxs) < DBL_MIN)
return FALSE;
t = vector2_cross_product (vector2_subtract (q, p), s) / rxs;
u = vector2_cross_product (vector2_subtract (p, q), r) / sxr;
/* The lines only intersect if 0 ≤ t ≤ 1 and 0 ≤ u ≤ 1. */
if (t < 0.0 || t > 1.0 || u < 0.0 || u > 1.0)
return FALSE;
*intersection = vector2_add (p, vector2_multiply_constant (t, r));
return TRUE;
}
static gboolean
is_barrier_horizontal (MetaBarrier *barrier)
{
return barrier->priv->y1 == barrier->priv->y2;
return meta_border_is_horizontal (&barrier->priv->border);
}
static gboolean
is_barrier_blocking_directions (MetaBarrier *barrier,
MetaBarrierDirection directions)
{
/* Barriers doesn't block parallel motions. */
if (is_barrier_horizontal (barrier))
{
if ((directions & (META_BARRIER_DIRECTION_POSITIVE_Y |
META_BARRIER_DIRECTION_NEGATIVE_Y)) == 0)
return FALSE;
}
else
{
if ((directions & (META_BARRIER_DIRECTION_POSITIVE_X |
META_BARRIER_DIRECTION_NEGATIVE_X)) == 0)
return FALSE;
}
return (barrier->priv->directions & directions) != directions;
return meta_border_is_blocking_directions (&barrier->priv->border,
directions);
}
static void
@@ -224,31 +116,16 @@ dismiss_pointer (MetaBarrierImplNative *self)
priv->state = META_BARRIER_STATE_LEFT;
}
static Line2
barrier_to_line (MetaBarrier *barrier)
{
return (Line2) {
.a = (Vector2) {
.x = MIN (barrier->priv->x1, barrier->priv->x2),
.y = MIN (barrier->priv->y1, barrier->priv->y2),
},
.b = (Vector2) {
.x = MAX (barrier->priv->x1, barrier->priv->x2),
.y = MAX (barrier->priv->y1, barrier->priv->y2),
},
};
}
/*
* Calculate the hit box for a held motion. The hit box is a 2 px wide region
* in the opposite direction of every direction the barrier blocks. The purpose
* of this is to allow small movements without receiving a "left" signal. This
* heuristic comes from the X.org pointer barrier implementation.
*/
static Line2
static MetaLine2
calculate_barrier_hit_box (MetaBarrier *barrier)
{
Line2 hit_box = barrier_to_line (barrier);
MetaLine2 hit_box = barrier->priv->border.line;
if (is_barrier_horizontal (barrier))
{
@@ -273,7 +150,8 @@ calculate_barrier_hit_box (MetaBarrier *barrier)
}
static gboolean
is_within_box (Line2 box, Vector2 point)
is_within_box (MetaLine2 box,
MetaVector2 point)
{
return (point.x >= box.a.x && point.x < box.b.x &&
point.y >= box.a.y && point.y < box.b.y);
@@ -288,8 +166,8 @@ maybe_release_barrier (gpointer key,
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
Line2 *motion = user_data;
Line2 hit_box;
MetaLine2 *motion = user_data;
MetaLine2 hit_box;
if (priv->state != META_BARRIER_STATE_HELD)
return;
@@ -297,8 +175,10 @@ maybe_release_barrier (gpointer key,
/* Release if we end up outside barrier end points. */
if (is_barrier_horizontal (barrier))
{
if (motion->b.x > MAX (barrier->priv->x1, barrier->priv->x2) ||
motion->b.x < MIN (barrier->priv->x1, barrier->priv->x2))
if (motion->b.x > MAX (barrier->priv->border.line.a.x,
barrier->priv->border.line.b.x) ||
motion->b.x < MIN (barrier->priv->border.line.a.x,
barrier->priv->border.line.b.x))
{
dismiss_pointer (self);
return;
@@ -306,8 +186,10 @@ maybe_release_barrier (gpointer key,
}
else
{
if (motion->b.y > MAX (barrier->priv->y1, barrier->priv->y2) ||
motion->b.y < MIN (barrier->priv->y1, barrier->priv->y2))
if (motion->b.y > MAX (barrier->priv->border.line.a.y,
barrier->priv->border.line.b.y) ||
motion->b.y < MIN (barrier->priv->border.line.a.y,
barrier->priv->border.line.b.y))
{
dismiss_pointer (self);
return;
@@ -330,7 +212,7 @@ maybe_release_barriers (MetaBarrierManagerNative *manager,
float x,
float y)
{
Line2 motion = {
MetaLine2 motion = {
.a = {
.x = prev_x,
.y = prev_y,
@@ -350,7 +232,7 @@ typedef struct _MetaClosestBarrierData
{
struct
{
Line2 motion;
MetaLine2 motion;
MetaBarrierDirection directions;
} in;
@@ -371,8 +253,7 @@ update_closest_barrier (gpointer key,
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
MetaClosestBarrierData *data = user_data;
Line2 barrier_line;
Vector2 intersection;
MetaVector2 intersection;
float dx, dy;
float distance_2;
@@ -391,17 +272,9 @@ update_closest_barrier (gpointer key,
/* Check if the motion intersects with the barrier, and retrieve the
* intersection point if any. */
barrier_line = (Line2) {
.a = {
.x = barrier->priv->x1,
.y = barrier->priv->y1
},
.b = {
.x = barrier->priv->x2,
.y = barrier->priv->y2
},
};
if (!lines_intersect (&barrier_line, &data->in.motion, &intersection))
if (!meta_line2_intersects_with (&barrier->priv->border.line,
&data->in.motion,
&intersection))
return;
/* Calculate the distance to the barrier and keep track of the closest
@@ -570,9 +443,9 @@ clamp_to_barrier (MetaBarrierImplNative *self,
if (is_barrier_horizontal (barrier))
{
if (*motion_dir & META_BARRIER_DIRECTION_POSITIVE_Y)
*y = barrier->priv->y1;
*y = barrier->priv->border.line.a.y;
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_Y)
*y = barrier->priv->y1;
*y = barrier->priv->border.line.a.y;
priv->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_Y |
META_BARRIER_DIRECTION_NEGATIVE_Y);
@@ -582,9 +455,9 @@ clamp_to_barrier (MetaBarrierImplNative *self,
else
{
if (*motion_dir & META_BARRIER_DIRECTION_POSITIVE_X)
*x = barrier->priv->x1;
*x = barrier->priv->border.line.a.x;
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_X)
*x = barrier->priv->x1;
*x = barrier->priv->border.line.a.x;
priv->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_X |
META_BARRIER_DIRECTION_NEGATIVE_X);

View File

@@ -29,9 +29,13 @@
#include <string.h>
#include <gbm.h>
#include <xf86drm.h>
#include <errno.h>
#include <meta/util.h>
#include <meta/meta-backend.h>
#include "meta-monitor-manager-private.h"
#include "meta/boxes.h"
#ifndef DRM_CAP_CURSOR_WIDTH
#define DRM_CAP_CURSOR_WIDTH 0x8
@@ -40,6 +44,19 @@
#define DRM_CAP_CURSOR_HEIGHT 0x9
#endif
/* When animating a cursor, we usually call drmModeSetCursor2 once per frame.
* Though, testing shows that we need to triple buffer the cursor buffer in
* order to avoid glitches when animating the cursor, at least when running on
* Intel. The reason for this might be (but is not confirmed to be) due to
* the user space gbm_bo cache, making us reuse and overwrite the kernel side
* buffer content before it was scanned out. To avoid this, we keep a user space
* reference to each buffer we set until at least one frame after it was drawn.
* In effect, this means we three active cursor gbm_bo's: one that that just has
* been set, one that was previously set and may or may not have been scanned
* out, and one pending that will be replaced if the cursor sprite changes.
*/
#define HW_CURSOR_BUFFER_COUNT 3
static GQuark quark_cursor_sprite = 0;
struct _MetaCursorRendererNativePrivate
@@ -57,8 +74,25 @@ struct _MetaCursorRendererNativePrivate
};
typedef struct _MetaCursorRendererNativePrivate MetaCursorRendererNativePrivate;
typedef enum _MetaCursorGbmBoState
{
META_CURSOR_GBM_BO_STATE_NONE,
META_CURSOR_GBM_BO_STATE_SET,
META_CURSOR_GBM_BO_STATE_INVALIDATED,
} MetaCursorGbmBoState;
typedef struct _MetaCursorNativePrivate
{
guint active_bo;
MetaCursorGbmBoState pending_bo_state;
struct gbm_bo *bos[HW_CURSOR_BUFFER_COUNT];
} MetaCursorNativePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererNative, meta_cursor_renderer_native, META_TYPE_CURSOR_RENDERER);
static MetaCursorNativePrivate *
ensure_cursor_priv (MetaCursorSprite *cursor_sprite);
static void
meta_cursor_renderer_native_finalize (GObject *object)
{
@@ -68,32 +102,56 @@ meta_cursor_renderer_native_finalize (GObject *object)
if (priv->animation_timeout_id)
g_source_remove (priv->animation_timeout_id);
if (priv->gbm)
gbm_device_destroy (priv->gbm);
G_OBJECT_CLASS (meta_cursor_renderer_native_parent_class)->finalize (object);
}
static guint
get_pending_cursor_sprite_gbm_bo_index (MetaCursorSprite *cursor_sprite)
{
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
return (cursor_priv->active_bo + 1) % HW_CURSOR_BUFFER_COUNT;
}
static struct gbm_bo *
get_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
get_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
{
return g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
guint pending_bo;
if (!cursor_priv)
return NULL;
pending_bo = get_pending_cursor_sprite_gbm_bo_index (cursor_sprite);
return cursor_priv->bos[pending_bo];
}
static struct gbm_bo *
get_active_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
{
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
if (!cursor_priv)
return NULL;
return cursor_priv->bos[cursor_priv->active_bo];
}
static void
cursor_gbm_bo_free (gpointer data)
set_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite,
struct gbm_bo *bo)
{
if (!data)
return;
MetaCursorNativePrivate *cursor_priv;
guint pending_bo;
gbm_bo_destroy ((struct gbm_bo *)data);
}
cursor_priv = ensure_cursor_priv (cursor_sprite);
static void
set_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite, struct gbm_bo *bo)
{
g_object_set_qdata_full (G_OBJECT (cursor_sprite), quark_cursor_sprite,
bo, cursor_gbm_bo_free);
pending_bo = get_pending_cursor_sprite_gbm_bo_index (cursor_sprite);
cursor_priv->bos[pending_bo] = bo;
cursor_priv->pending_bo_state = META_CURSOR_GBM_BO_STATE_SET;
}
static void
@@ -104,55 +162,78 @@ set_crtc_cursor (MetaCursorRendererNative *native,
{
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
if (crtc->cursor == cursor_sprite && !force)
return;
crtc->cursor = cursor_sprite;
if (cursor_sprite)
{
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
struct gbm_bo *bo;
union gbm_bo_handle handle;
int hot_x, hot_y;
bo = get_cursor_sprite_gbm_bo (cursor_sprite);
if (cursor_priv->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
bo = get_pending_cursor_sprite_gbm_bo (cursor_sprite);
else
bo = get_active_cursor_sprite_gbm_bo (cursor_sprite);
if (!force && bo == crtc->cursor_renderer_private)
return;
crtc->cursor_renderer_private = bo;
handle = gbm_bo_get_handle (bo);
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, handle.u32,
priv->cursor_width, priv->cursor_height, hot_x, hot_y);
if (cursor_priv->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
{
cursor_priv->active_bo =
(cursor_priv->active_bo + 1) % HW_CURSOR_BUFFER_COUNT;
cursor_priv->pending_bo_state = META_CURSOR_GBM_BO_STATE_NONE;
}
}
else
{
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, 0, 0, 0, 0, 0);
if (force || crtc->cursor_renderer_private != NULL)
{
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, 0, 0, 0, 0, 0);
crtc->cursor_renderer_private = NULL;
}
}
}
static void
update_hw_cursor (MetaCursorRendererNative *native,
MetaCursorSprite *cursor_sprite,
gboolean force)
{
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
const MetaRectangle *cursor_rect = meta_cursor_renderer_get_rect (renderer);
MetaCursorSprite *cursor_sprite = meta_cursor_renderer_get_cursor (renderer);
MetaMonitorManager *monitors;
MetaCRTC *crtcs;
unsigned int i, n_crtcs;
MetaRectangle rect;
monitors = meta_monitor_manager_get ();
meta_monitor_manager_get_resources (monitors, NULL, NULL, &crtcs, &n_crtcs, NULL, NULL);
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
else
rect = (MetaRectangle) { 0 };
for (i = 0; i < n_crtcs; i++)
{
gboolean crtc_should_have_cursor;
gboolean crtc_should_use_cursor;
MetaCursorSprite *crtc_cursor;
MetaRectangle *crtc_rect;
crtc_rect = &crtcs[i].rect;
crtc_should_have_cursor = (priv->has_hw_cursor && meta_rectangle_overlap (cursor_rect, crtc_rect));
if (crtc_should_have_cursor)
crtc_should_use_cursor = (priv->has_hw_cursor &&
meta_rectangle_overlap (&rect, crtc_rect));
if (crtc_should_use_cursor)
crtc_cursor = cursor_sprite;
else
crtc_cursor = NULL;
@@ -162,49 +243,109 @@ update_hw_cursor (MetaCursorRendererNative *native,
if (crtc_cursor)
{
drmModeMoveCursor (priv->drm_fd, crtcs[i].crtc_id,
cursor_rect->x - crtc_rect->x,
cursor_rect->y - crtc_rect->y);
rect.x - crtc_rect->x,
rect.y - crtc_rect->y);
}
}
}
static gboolean
should_have_hw_cursor (MetaCursorRenderer *renderer)
has_valid_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
{
MetaCursorSprite *cursor_sprite = meta_cursor_renderer_get_cursor (renderer);
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
if (cursor_sprite)
return (get_cursor_sprite_gbm_bo (cursor_sprite) != NULL);
else
if (!cursor_priv)
return FALSE;
switch (cursor_priv->pending_bo_state)
{
case META_CURSOR_GBM_BO_STATE_NONE:
return get_active_cursor_sprite_gbm_bo (cursor_sprite) != NULL;
case META_CURSOR_GBM_BO_STATE_SET:
return TRUE;
case META_CURSOR_GBM_BO_STATE_INVALIDATED:
return FALSE;
}
g_assert_not_reached ();
return FALSE;
}
static gboolean
cursor_over_transformed_crtc (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaMonitorManager *monitors;
MetaCRTC *crtcs;
unsigned int i, n_crtcs;
MetaRectangle rect;
monitors = meta_monitor_manager_get ();
meta_monitor_manager_get_resources (monitors, NULL, NULL,
&crtcs, &n_crtcs, NULL, NULL);
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
for (i = 0; i < n_crtcs; i++)
{
if (!meta_rectangle_overlap (&rect, &crtcs[i].rect))
continue;
if (crtcs[i].transform != META_MONITOR_TRANSFORM_NORMAL)
return TRUE;
}
return FALSE;
}
static gboolean
should_have_hw_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
CoglTexture *texture;
if (!cursor_sprite)
return FALSE;
if (cursor_over_transformed_crtc (renderer, cursor_sprite))
return FALSE;
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
if (!texture)
return FALSE;
if (meta_cursor_sprite_get_texture_scale (cursor_sprite) != 1)
return FALSE;
if (!has_valid_cursor_sprite_gbm_bo (cursor_sprite))
return FALSE;
return TRUE;
}
static gboolean
meta_cursor_renderer_native_update_animation (MetaCursorRendererNative *native)
{
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
MetaCursorSprite *cursor_sprite;
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
MetaCursorSprite *cursor_sprite = meta_cursor_renderer_get_cursor (renderer);
priv->animation_timeout_id = 0;
cursor_sprite =
meta_cursor_renderer_get_cursor (META_CURSOR_RENDERER (native));
meta_cursor_sprite_tick_frame (cursor_sprite);
meta_cursor_renderer_force_update (META_CURSOR_RENDERER (native));
meta_cursor_renderer_native_force_update (native);
meta_cursor_renderer_force_update (renderer);
return G_SOURCE_REMOVE;
}
static void
meta_cursor_renderer_native_trigger_frame (MetaCursorRendererNative *native)
meta_cursor_renderer_native_trigger_frame (MetaCursorRendererNative *native,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
MetaCursorSprite *cursor_sprite;
gboolean cursor_change;
guint delay;
cursor_sprite =
meta_cursor_renderer_get_cursor (META_CURSOR_RENDERER (native));
cursor_change = cursor_sprite != priv->last_cursor;
priv->last_cursor = cursor_sprite;
@@ -234,15 +375,19 @@ meta_cursor_renderer_native_trigger_frame (MetaCursorRendererNative *native)
}
static gboolean
meta_cursor_renderer_native_update_cursor (MetaCursorRenderer *renderer)
meta_cursor_renderer_native_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererNative *native = META_CURSOR_RENDERER_NATIVE (renderer);
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
meta_cursor_renderer_native_trigger_frame (native);
if (cursor_sprite)
meta_cursor_sprite_realize_texture (cursor_sprite);
priv->has_hw_cursor = should_have_hw_cursor (renderer);
update_hw_cursor (native, FALSE);
meta_cursor_renderer_native_trigger_frame (native, cursor_sprite);
priv->has_hw_cursor = should_have_hw_cursor (renderer, cursor_sprite);
update_hw_cursor (native, cursor_sprite, FALSE);
return priv->has_hw_cursor;
}
@@ -257,6 +402,38 @@ get_hardware_cursor_size (MetaCursorRendererNative *native,
*height = priv->cursor_height;
}
static void
cursor_priv_free (gpointer data)
{
MetaCursorNativePrivate *cursor_priv = data;
guint i;
if (!data)
return;
for (i = 0; i < HW_CURSOR_BUFFER_COUNT; i++)
g_clear_pointer (&cursor_priv->bos[0], (GDestroyNotify) gbm_bo_destroy);
g_slice_free (MetaCursorNativePrivate, cursor_priv);
}
static MetaCursorNativePrivate *
ensure_cursor_priv (MetaCursorSprite *cursor_sprite)
{
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
if (!cursor_priv)
{
cursor_priv = g_slice_new0 (MetaCursorNativePrivate);
g_object_set_qdata_full (G_OBJECT (cursor_sprite),
quark_cursor_sprite,
cursor_priv,
cursor_priv_free);
}
return cursor_priv;
}
static void
load_cursor_sprite_gbm_buffer (MetaCursorRendererNative *native,
MetaCursorSprite *cursor_sprite,
@@ -288,17 +465,45 @@ load_cursor_sprite_gbm_buffer (MetaCursorRendererNative *native,
bo = gbm_bo_create (priv->gbm, cursor_width, cursor_height,
gbm_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
if (!bo)
{
meta_warning ("Failed to allocate HW cursor buffer\n");
return;
}
memset (buf, 0, sizeof(buf));
for (i = 0; i < height; i++)
memcpy (buf + i * 4 * cursor_width, pixels + i * rowstride, width * 4);
if (gbm_bo_write (bo, buf, cursor_width * cursor_height * 4) != 0)
{
meta_warning ("Failed to write cursors buffer data: %s",
g_strerror (errno));
gbm_bo_destroy (bo);
return;
}
gbm_bo_write (bo, buf, cursor_width * cursor_height * 4);
set_cursor_sprite_gbm_bo (cursor_sprite, bo);
set_pending_cursor_sprite_gbm_bo (cursor_sprite, bo);
}
else
meta_warning ("HW cursor for format %d not supported\n", gbm_format);
{
meta_warning ("HW cursor for format %d not supported\n", gbm_format);
}
}
static void
invalidate_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
{
MetaCursorNativePrivate *cursor_priv =
g_object_get_qdata (G_OBJECT (cursor_sprite), quark_cursor_sprite);
guint pending_bo;
if (!cursor_priv)
return;
pending_bo = get_pending_cursor_sprite_gbm_bo_index (cursor_sprite);
g_clear_pointer (&cursor_priv->bos[pending_bo],
(GDestroyNotify) gbm_bo_destroy);
cursor_priv->pending_bo_state = META_CURSOR_GBM_BO_STATE_INVALIDATED;
}
#ifdef HAVE_WAYLAND
@@ -312,10 +517,17 @@ meta_cursor_renderer_native_realize_cursor_from_wl_buffer (MetaCursorRenderer *r
meta_cursor_renderer_native_get_instance_private (native);
uint32_t gbm_format;
uint64_t cursor_width, cursor_height;
CoglTexture *texture;
uint width, height;
width = meta_cursor_sprite_get_width (cursor_sprite);
height = meta_cursor_sprite_get_height (cursor_sprite);
/* Destroy any previous pending cursor buffer; we'll always either fail (which
* should unset, or succeed, which will set new buffer.
*/
invalidate_pending_cursor_sprite_gbm_bo (cursor_sprite);
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (buffer);
if (shm_buffer)
@@ -384,7 +596,7 @@ meta_cursor_renderer_native_realize_cursor_from_wl_buffer (MetaCursorRenderer *r
return;
}
set_cursor_sprite_gbm_bo (cursor_sprite, bo);
set_pending_cursor_sprite_gbm_bo (cursor_sprite, bo);
}
}
#endif
@@ -396,6 +608,8 @@ meta_cursor_renderer_native_realize_cursor_from_xcursor (MetaCursorRenderer *ren
{
MetaCursorRendererNative *native = META_CURSOR_RENDERER_NATIVE (renderer);
invalidate_pending_cursor_sprite_gbm_bo (cursor_sprite);
load_cursor_sprite_gbm_buffer (native,
cursor_sprite,
(uint8_t *) xc_image->pixels,
@@ -423,12 +637,20 @@ meta_cursor_renderer_native_class_init (MetaCursorRendererNativeClass *klass)
quark_cursor_sprite = g_quark_from_static_string ("-meta-cursor-native");
}
static void
force_update_hw_cursor (MetaCursorRendererNative *native)
{
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
update_hw_cursor (native, meta_cursor_renderer_get_cursor (renderer), TRUE);
}
static void
on_monitors_changed (MetaMonitorManager *monitors,
MetaCursorRendererNative *native)
{
/* Our tracking is all messed up, so force an update. */
update_hw_cursor (native, TRUE);
force_update_hw_cursor (native);
}
static void
@@ -447,7 +669,7 @@ meta_cursor_renderer_native_init (MetaCursorRendererNative *native)
{
CoglRenderer *cogl_renderer = cogl_display_get_renderer (cogl_context_get_display (ctx));
priv->drm_fd = cogl_kms_renderer_get_kms_fd (cogl_renderer);
priv->gbm = gbm_create_device (priv->drm_fd);
priv->gbm = cogl_kms_renderer_get_gbm (cogl_renderer);
uint64_t width, height;
if (drmGetCap (priv->drm_fd, DRM_CAP_CURSOR_WIDTH, &width) == 0 &&
@@ -476,5 +698,5 @@ meta_cursor_renderer_native_get_gbm_device (MetaCursorRendererNative *native)
void
meta_cursor_renderer_native_force_update (MetaCursorRendererNative *native)
{
update_hw_cursor (native, TRUE);
force_update_hw_cursor (native);
}

View File

@@ -164,56 +164,36 @@ meta_idle_monitor_native_init (MetaIdleMonitorNative *monitor_native)
monitor->watches = g_hash_table_new_full (NULL, NULL, NULL, free_watch);
}
typedef struct {
MetaIdleMonitorNative *monitor_native;
GList *fired_watches;
} CheckNativeClosure;
static gboolean
check_native_watch (gpointer key,
gpointer value,
gpointer user_data)
{
MetaIdleMonitorWatchNative *watch_native = value;
MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) watch_native;
CheckNativeClosure *closure = user_data;
gboolean steal;
if (watch->timeout_msec == 0)
{
closure->fired_watches = g_list_prepend (closure->fired_watches, watch);
steal = TRUE;
}
else
{
g_source_set_ready_time (watch_native->timeout_source,
closure->monitor_native->last_event_time +
watch->timeout_msec * 1000);
steal = FALSE;
}
return steal;
}
static void
fire_native_watch (gpointer watch,
gpointer data)
{
_meta_idle_monitor_watch_fire (watch);
}
void
meta_idle_monitor_native_reset_idletime (MetaIdleMonitor *monitor)
{
MetaIdleMonitorNative *monitor_native = META_IDLE_MONITOR_NATIVE (monitor);
CheckNativeClosure closure;
GList *node, *watch_ids;
monitor_native->last_event_time = g_get_monotonic_time ();
closure.monitor_native = monitor_native;
closure.fired_watches = NULL;
g_hash_table_foreach_steal (monitor->watches, check_native_watch, &closure);
watch_ids = g_hash_table_get_keys (monitor->watches);
g_list_foreach (closure.fired_watches, fire_native_watch, NULL);
g_list_free (closure.fired_watches);
for (node = watch_ids; node != NULL; node = node->next)
{
guint watch_id = GPOINTER_TO_UINT (node->data);
MetaIdleMonitorWatchNative *watch;
watch = g_hash_table_lookup (monitor->watches, GUINT_TO_POINTER (watch_id));
if (!watch)
continue;
if (watch->base.timeout_msec == 0)
{
_meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
}
else
{
g_source_set_ready_time (watch->timeout_source,
monitor_native->last_event_time +
watch->base.timeout_msec * 1000);
}
}
g_list_free (watch_ids);
}

View File

@@ -154,30 +154,30 @@ device_set_click_method (struct libinput_device *libinput_device,
}
static void
meta_input_settings_native_set_scroll_method (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadScrollMethod mode)
meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean edge_scrolling_enabled)
{
enum libinput_config_scroll_method scroll_method = 0;
struct libinput_device *libinput_device;
enum libinput_config_scroll_method supported;
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
supported = libinput_device_config_scroll_get_methods (libinput_device);
switch (mode)
if (supported & LIBINPUT_CONFIG_SCROLL_2FG)
{
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_DISABLED:
scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
break;
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING:
scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE;
break;
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING:
scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
break;
default:
g_assert_not_reached ();
return;
}
}
else if (supported & LIBINPUT_CONFIG_SCROLL_EDGE &&
edge_scrolling_enabled)
{
scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE;
}
else
{
scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
}
device_set_scroll_method (libinput_device, scroll_method);
}
@@ -252,7 +252,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
input_settings_class->set_left_handed = meta_input_settings_native_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_native_set_tap_enabled;
input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll;
input_settings_class->set_scroll_method = meta_input_settings_native_set_scroll_method;
input_settings_class->set_edge_scroll = meta_input_settings_native_set_edge_scroll;
input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_native_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat;

View File

@@ -37,6 +37,7 @@
#include <unistd.h>
#include <systemd/sd-login.h>
#include <gudev/gudev.h>
#include "dbus-utils.h"
#include "meta-dbus-login1.h"
@@ -45,6 +46,12 @@
#include "meta-cursor-renderer-native.h"
#include "meta-idle-monitor-native.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevClient, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevEnumerator, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Login1Session, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Login1Seat, g_object_unref)
struct _MetaLauncher
{
Login1Session *session_proxy;
@@ -54,14 +61,21 @@ struct _MetaLauncher
};
static Login1Session *
get_session_proxy (GCancellable *cancellable)
get_session_proxy (GCancellable *cancellable,
GError **error)
{
char *proxy_path;
char *session_id;
g_autofree char *proxy_path = NULL;
g_autofree char *session_id = NULL;
Login1Session *session_proxy;
if (sd_pid_get_session (getpid (), &session_id) < 0)
return NULL;
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"Could not get session ID: %m");
return NULL;
}
proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session", session_id);
@@ -69,31 +83,37 @@ get_session_proxy (GCancellable *cancellable)
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
"org.freedesktop.login1",
proxy_path,
cancellable, NULL);
free (proxy_path);
cancellable, error);
if (!session_proxy)
g_prefix_error(error, "Could not get session proxy: ");
return session_proxy;
}
static Login1Seat *
get_seat_proxy (GCancellable *cancellable)
get_seat_proxy (GCancellable *cancellable,
GError **error)
{
return login1_seat_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
"org.freedesktop.login1",
"/org/freedesktop/login1/seat/self",
cancellable, NULL);
Login1Seat *seat = login1_seat_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
"org.freedesktop.login1",
"/org/freedesktop/login1/seat/self",
cancellable, error);
if (!seat)
g_prefix_error(error, "Could not get seat proxy: ");
return seat;
}
static void
session_unpause (void)
{
ClutterBackend *backend;
ClutterBackend *clutter_backend;
CoglContext *cogl_context;
CoglDisplay *cogl_display;
backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (backend);
clutter_backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (clutter_backend);
cogl_display = cogl_context_get_display (cogl_context);
cogl_kms_display_queue_modes_reset (cogl_display);
@@ -262,25 +282,111 @@ on_active_changed (Login1Session *session,
sync_active (self);
}
static gchar *
get_primary_gpu_path (const gchar *seat_name)
{
const gchar *subsystems[] = {"drm", NULL};
gchar *path = NULL;
GList *devices, *tmp;
g_autoptr (GUdevClient) gudev_client = g_udev_client_new (subsystems);
g_autoptr (GUdevEnumerator) enumerator = g_udev_enumerator_new (gudev_client);
g_udev_enumerator_add_match_name (enumerator, "card*");
g_udev_enumerator_add_match_tag (enumerator, "seat");
devices = g_udev_enumerator_execute (enumerator);
if (!devices)
goto out;
for (tmp = devices; tmp != NULL; tmp = tmp->next)
{
g_autoptr (GUdevDevice) platform_device = NULL;
g_autoptr (GUdevDevice) pci_device = NULL;
GUdevDevice *dev = tmp->data;
gint boot_vga;
const gchar *device_seat;
/* filter out devices that are not character device, like card0-VGA-1 */
if (g_udev_device_get_device_type (dev) != G_UDEV_DEVICE_TYPE_CHAR)
continue;
device_seat = g_udev_device_get_property (dev, "ID_SEAT");
if (!device_seat)
{
/* when ID_SEAT is not set, it means seat0 */
device_seat = "seat0";
}
else if (g_strcmp0 (device_seat, "seat0") != 0)
{
/* if the device has been explicitly assigned other seat
* than seat0, it is probably the right device to use */
path = g_strdup (g_udev_device_get_device_file (dev));
break;
}
/* skip devices that do not belong to our seat */
if (g_strcmp0 (seat_name, device_seat))
continue;
platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);
if (platform_device != NULL)
{
path = g_strdup (g_udev_device_get_device_file (dev));
break;
}
pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
if (pci_device != NULL)
{
/* get value of boot_vga attribute or 0 if the device has no boot_vga */
boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
if (boot_vga == 1)
{
/* found the boot_vga device */
path = g_strdup (g_udev_device_get_device_file (dev));
break;
}
}
}
g_list_free_full (devices, g_object_unref);
out:
return path;
}
static gboolean
get_kms_fd (Login1Session *session_proxy,
int *fd_out)
const gchar *seat_id,
int *fd_out,
GError **error)
{
int major, minor;
int fd;
GError *error = NULL;
/* XXX -- use udev to find the DRM master device */
if (!get_device_info_from_path ("/dev/dri/card0", &major, &minor))
g_autofree gchar *path = get_primary_gpu_path (seat_id);
if (!path)
{
g_warning ("Could not stat /dev/dri/card0: %m");
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"could not find drm kms device");
return FALSE;
}
if (!take_device (session_proxy, major, minor, &fd, NULL, &error))
if (!get_device_info_from_path (path, &major, &minor))
{
g_warning ("Could not open DRM device: %s\n", error->message);
g_error_free (error);
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"Could not get device info for path %s: %m", path);
return FALSE;
}
if (!take_device (session_proxy, major, minor, &fd, NULL, error))
{
g_prefix_error (error, "Could not open DRM device: ");
return FALSE;
}
@@ -289,28 +395,72 @@ get_kms_fd (Login1Session *session_proxy,
return TRUE;
}
MetaLauncher *
meta_launcher_new (void)
static gchar *
get_seat_id (GError **error)
{
MetaLauncher *self = NULL;
Login1Session *session_proxy;
GError *error = NULL;
int kms_fd;
g_autofree char *session_id = NULL;
char *seat_id = NULL;
int r;
session_proxy = get_session_proxy (NULL);
if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, &error))
r = sd_pid_get_session (0, &session_id);
if (r < 0)
{
g_warning ("Could not take control: %s", error->message);
g_error_free (error);
goto out;
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"Could not get session for PID: %s", g_strerror (-r));
return NULL;
}
if (!get_kms_fd (session_proxy, &kms_fd))
goto out;
r = sd_session_get_seat (session_id, &seat_id);
if (r < 0)
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"Could not get seat for session: %s", g_strerror (-r));
return NULL;
}
return seat_id;
}
MetaLauncher *
meta_launcher_new (GError **error)
{
MetaLauncher *self = NULL;
g_autoptr (Login1Session) session_proxy = NULL;
g_autoptr (Login1Seat) seat_proxy = NULL;
g_autofree char *seat_id = NULL;
gboolean have_control = FALSE;
int kms_fd;
session_proxy = get_session_proxy (NULL, error);
if (!session_proxy)
goto fail;
if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, error))
{
g_prefix_error (error, "Could not take control: ");
goto fail;
}
have_control = TRUE;
seat_id = get_seat_id (error);
if (!seat_id)
goto fail;
seat_proxy = get_seat_proxy (NULL, error);
if (!seat_proxy)
goto fail;
if (!get_kms_fd (session_proxy, seat_id, &kms_fd, error))
goto fail;
self = g_slice_new0 (MetaLauncher);
self->session_proxy = g_object_ref (session_proxy);
self->seat_proxy = get_seat_proxy (NULL);
self->seat_proxy = g_object_ref (seat_proxy);
self->session_active = TRUE;
@@ -320,11 +470,12 @@ meta_launcher_new (void)
self);
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
out:
g_object_unref (session_proxy);
return self;
fail:
if (have_control)
login1_session_call_release_control_sync (session_proxy, NULL, NULL);
return NULL;
}
void

View File

@@ -24,7 +24,7 @@
typedef struct _MetaLauncher MetaLauncher;
MetaLauncher *meta_launcher_new (void);
MetaLauncher *meta_launcher_new (GError **error);
void meta_launcher_free (MetaLauncher *self);
gboolean meta_launcher_activate_session (MetaLauncher *self,

View File

@@ -42,6 +42,8 @@
#include <gudev/gudev.h>
#define ALL_TRANSFORMS (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)
typedef struct {
drmModeConnector *connector;
@@ -66,6 +68,9 @@ typedef struct {
uint32_t underscan_prop_id;
uint32_t underscan_hborder_prop_id;
uint32_t underscan_vborder_prop_id;
uint32_t primary_plane_id;
uint32_t rotation_prop_id;
uint32_t rotation_map[ALL_TRANSFORMS];
} MetaCRTCKms;
struct _MetaMonitorManagerKms
@@ -429,6 +434,137 @@ get_output_scale (MetaMonitorManager *manager,
return compute_scale (output);
}
static int
find_property_index (MetaMonitorManager *manager,
drmModeObjectPropertiesPtr props,
const gchar *prop_name,
drmModePropertyPtr *found)
{
MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (manager);
unsigned int i;
for (i = 0; i < props->count_props; i++)
{
drmModePropertyPtr prop;
prop = drmModeGetProperty (manager_kms->fd, props->props[i]);
if (!prop)
continue;
if (strcmp (prop->name, prop_name) == 0)
{
*found = prop;
return i;
}
drmModeFreeProperty (prop);
}
return -1;
}
static void
parse_transforms (MetaMonitorManager *manager,
drmModePropertyPtr prop,
MetaCRTC *crtc)
{
MetaCRTCKms *crtc_kms = crtc->driver_private;
int i;
for (i = 0; i < prop->count_enums; i++)
{
int cur = -1;
if (strcmp (prop->enums[i].name, "rotate-0") == 0)
cur = META_MONITOR_TRANSFORM_NORMAL;
else if (strcmp (prop->enums[i].name, "rotate-90") == 0)
cur = META_MONITOR_TRANSFORM_90;
else if (strcmp (prop->enums[i].name, "rotate-180") == 0)
cur = META_MONITOR_TRANSFORM_180;
else if (strcmp (prop->enums[i].name, "rotate-270") == 0)
cur = META_MONITOR_TRANSFORM_270;
if (cur != -1)
{
crtc->all_transforms |= 1 << cur;
crtc_kms->rotation_map[cur] = 1 << prop->enums[i].value;
}
}
}
static gboolean
is_primary_plane (MetaMonitorManager *manager,
drmModeObjectPropertiesPtr props)
{
drmModePropertyPtr prop;
int idx;
idx = find_property_index (manager, props, "type", &prop);
if (idx < 0)
return FALSE;
drmModeFreeProperty (prop);
return props->prop_values[idx] == DRM_PLANE_TYPE_PRIMARY;
}
static void
init_crtc_rotations (MetaMonitorManager *manager,
MetaCRTC *crtc,
unsigned int idx)
{
MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (manager);
drmModeObjectPropertiesPtr props;
drmModePlaneRes *planes;
drmModePlane *drm_plane;
MetaCRTCKms *crtc_kms;
unsigned int i;
crtc_kms = crtc->driver_private;
planes = drmModeGetPlaneResources(manager_kms->fd);
if (planes == NULL)
return;
for (i = 0; i < planes->count_planes; i++)
{
drmModePropertyPtr prop;
drm_plane = drmModeGetPlane (manager_kms->fd, planes->planes[i]);
if (!drm_plane)
continue;
if ((drm_plane->possible_crtcs & (1 << idx)))
{
props = drmModeObjectGetProperties (manager_kms->fd,
drm_plane->plane_id,
DRM_MODE_OBJECT_PLANE);
if (props && is_primary_plane (manager, props))
{
int rotation_idx;
crtc_kms->primary_plane_id = drm_plane->plane_id;
rotation_idx = find_property_index (manager, props, "rotation", &prop);
if (rotation_idx >= 0)
{
crtc_kms->rotation_prop_id = props->props[rotation_idx];
parse_transforms (manager, prop, crtc);
drmModeFreeProperty (prop);
}
}
if (props)
drmModeFreeObjectProperties (props);
}
drmModeFreePlane (drm_plane);
}
drmModeFreePlaneResources (planes);
}
static void
meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
{
@@ -496,8 +632,18 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
meta_mode->name = g_strndup (mode->name, DRM_DISPLAY_MODE_LEN);
meta_mode->width = mode->hdisplay;
meta_mode->height = mode->vdisplay;
meta_mode->refresh_rate = (1000 * mode->clock /
((float)mode->htotal * mode->vtotal));
/* Calculate refresh rate in milliHz first for extra precision. */
meta_mode->refresh_rate = (mode->clock * 1000000LL) / mode->htotal;
meta_mode->refresh_rate += (mode->vtotal / 2);
meta_mode->refresh_rate /= mode->vtotal;
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
meta_mode->refresh_rate *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
meta_mode->refresh_rate /= 2;
if (mode->vscan > 1)
meta_mode->refresh_rate /= mode->vscan;
meta_mode->refresh_rate /= 1000.0;
meta_mode->driver_private = g_slice_dup (drmModeModeInfo, mode);
meta_mode->driver_notify = (GDestroyNotify)meta_monitor_mode_destroy_notify;
@@ -546,6 +692,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
meta_crtc->driver_private = g_new0 (MetaCRTCKms, 1);
meta_crtc->driver_notify = (GDestroyNotify) meta_crtc_destroy_notify;
find_crtc_properties (manager_kms, meta_crtc);
init_crtc_rotations (manager, meta_crtc, i);
drmModeFreeCrtc (crtc);
}
@@ -928,6 +1075,7 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
{
MetaCRTCInfo *crtc_info = crtcs[i];
MetaCRTC *crtc = crtc_info->crtc;
MetaCRTCKms *crtc_kms = crtc->driver_private;
CoglKmsCrtc *cogl_crtc;
crtc->is_dirty = TRUE;
@@ -1000,6 +1148,13 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
crtc->current_mode = mode;
crtc->transform = crtc_info->transform;
}
if (crtc->all_transforms & (1 << crtc->transform))
drmModeObjectSetProperty (manager_kms->fd,
crtc_kms->primary_plane_id,
DRM_MODE_OBJECT_PLANE,
crtc_kms->rotation_prop_id,
crtc_kms->rotation_map[crtc->transform]);
}
/* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE,
@@ -1152,6 +1307,8 @@ meta_monitor_manager_kms_init (MetaMonitorManagerKms *manager_kms)
manager_kms->fd = cogl_kms_renderer_get_kms_fd (cogl_renderer);
drmSetClientCap (manager_kms->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
const char *subsystems[2] = { "drm", NULL };
manager_kms->udev = g_udev_client_new (subsystems);
g_signal_connect (manager_kms->udev, "uevent",

View File

@@ -40,7 +40,11 @@
#include "meta-idle-monitor-xsync.h"
#include "meta-monitor-manager-xrandr.h"
#include "backends/meta-monitor-manager-dummy.h"
#include "backends/x11/nested/meta-cursor-renderer-x11-nested.h"
#include "meta-cursor-renderer-x11.h"
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland.h"
#endif
#include <meta/util.h>
#include "display-private.h"
@@ -78,6 +82,7 @@ struct _MetaBackendX11Private
gchar *keymap_layouts;
gchar *keymap_variants;
gchar *keymap_options;
int locked_group;
};
typedef struct _MetaBackendX11Private MetaBackendX11Private;
@@ -269,20 +274,47 @@ handle_host_xevent (MetaBackend *backend,
}
}
if (priv->mode == META_BACKEND_X11_MODE_NESTED && event->type == FocusIn)
{
#ifdef HAVE_WAYLAND
Window xwin = meta_backend_x11_get_xwindow(x11);
XEvent xev;
if (event->xfocus.window == xwin)
{
/* Since we've selected for KeymapStateMask, every FocusIn is followed immediately
* by a KeymapNotify event */
XMaskEvent(priv->xdisplay, KeymapStateMask, &xev);
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
meta_wayland_compositor_update_key_state (compositor, xev.xkeymap.key_vector, 32, 8);
}
#else
g_assert_not_reached ();
#endif
}
if (event->type == (priv->xsync_event_base + XSyncAlarmNotify))
handle_alarm_notify (backend, event);
if (event->type == priv->xkb_event_base)
{
XkbAnyEvent *xkb_ev = (XkbAnyEvent *) event;
XkbEvent *xkb_ev = (XkbEvent *) event;
if (xkb_ev->device == META_VIRTUAL_CORE_KEYBOARD_ID)
if (xkb_ev->any.device == META_VIRTUAL_CORE_KEYBOARD_ID)
{
switch (xkb_ev->xkb_type)
switch (xkb_ev->any.xkb_type)
{
case XkbNewKeyboardNotify:
case XkbMapNotify:
keymap_changed (backend);
break;
case XkbStateNotify:
if (xkb_ev->state.changed & XkbGroupLockMask)
{
if (priv->locked_group != xkb_ev->state.locked_group)
XkbLockGroup (priv->xdisplay, XkbUseCoreKbd, priv->locked_group);
}
break;
default:
break;
}
@@ -418,6 +450,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
int major, minor;
gboolean has_xi = FALSE;
priv->xdisplay = clutter_x11_get_default_display ();
@@ -427,27 +460,23 @@ meta_backend_x11_post_init (MetaBackend *backend)
!XSyncInitialize (priv->xdisplay, &major, &minor))
meta_fatal ("Could not initialize XSync");
{
int major = 2, minor = 3;
gboolean has_xi = FALSE;
if (XQueryExtension (priv->xdisplay,
"XInputExtension",
&priv->xinput_opcode,
&priv->xinput_error_base,
&priv->xinput_event_base))
{
major = 2; minor = 3;
if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
if (version >= 22)
has_xi = TRUE;
}
}
if (XQueryExtension (priv->xdisplay,
"XInputExtension",
&priv->xinput_opcode,
&priv->xinput_error_base,
&priv->xinput_event_base))
{
if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
if (version >= 22)
has_xi = TRUE;
}
}
if (!has_xi)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
}
if (!has_xi)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
/* We only take the passive touch grab if we are a X11 compositor */
if (priv->mode == META_BACKEND_X11_MODE_COMPOSITOR)
@@ -499,7 +528,20 @@ meta_backend_x11_create_monitor_manager (MetaBackend *backend)
static MetaCursorRenderer *
meta_backend_x11_create_cursor_renderer (MetaBackend *backend)
{
return g_object_new (META_TYPE_CURSOR_RENDERER_X11, NULL);
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
switch (priv->mode)
{
case META_BACKEND_X11_MODE_COMPOSITOR:
return g_object_new (META_TYPE_CURSOR_RENDERER_X11, NULL);
break;
case META_BACKEND_X11_MODE_NESTED:
return g_object_new (META_TYPE_CURSOR_RENDERER_X11_NESTED, NULL);
break;
default:
g_assert_not_reached ();
}
}
static gboolean
@@ -727,6 +769,9 @@ meta_backend_x11_get_keymap (MetaBackend *backend)
priv->xcb,
xkb_x11_get_core_keyboard_device_id (priv->xcb),
XKB_KEYMAP_COMPILE_NO_FLAGS);
if (priv->keymap == NULL)
priv->keymap = xkb_keymap_new_from_names (context, NULL, XKB_KEYMAP_COMPILE_NO_FLAGS);
xkb_context_unref (context);
}
@@ -740,6 +785,7 @@ meta_backend_x11_lock_layout_group (MetaBackend *backend,
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
priv->locked_group = idx;
XkbLockGroup (priv->xdisplay, XkbUseCoreKbd, idx);
}
@@ -759,8 +805,6 @@ meta_backend_x11_update_screen_size (MetaBackend *backend,
}
else
{
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
Window xwin = meta_backend_x11_get_xwindow (x11);
XResizeWindow (priv->xdisplay, xwin, width, height);
}
@@ -800,6 +844,20 @@ meta_backend_x11_select_stage_events (MetaBackend *backend)
}
XISelectEvents (priv->xdisplay, xwin, &mask, 1);
if (priv->mode == META_BACKEND_X11_MODE_NESTED)
{
/* We have no way of tracking key changes when the stage doesn't have
* focus, so we select for KeymapStateMask so that we get a complete
* dump of the keyboard state in a KeymapNotify event that immediately
* follows each FocusIn (and EnterNotify, but we ignore that.)
*/
XWindowAttributes xwa;
XGetWindowAttributes(priv->xdisplay, xwin, &xwa);
XSelectInput(priv->xdisplay, xwin,
xwa.your_event_mask | FocusChangeMask | KeymapStateMask);
}
}
static void

View File

@@ -107,6 +107,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
MetaDisplay *display = barrier->priv->display;
Display *dpy;
Window root;
unsigned int allowed_motion_dirs;
if (display == NULL)
{
@@ -121,12 +122,14 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
dpy = display->xdisplay;
root = DefaultRootWindow (dpy);
allowed_motion_dirs =
meta_border_get_allows_directions (&barrier->priv->border);
priv->xbarrier = XFixesCreatePointerBarrier (dpy, root,
barrier->priv->x1,
barrier->priv->y1,
barrier->priv->x2,
barrier->priv->y2,
barrier->priv->directions,
barrier->priv->border.line.a.x,
barrier->priv->border.line.a.y,
barrier->priv->border.line.b.x,
barrier->priv->border.line.b.y,
allowed_motion_dirs,
0, NULL);
g_hash_table_insert (display->xids, &priv->xbarrier, barrier);

View File

@@ -40,25 +40,29 @@ typedef struct _MetaCursorRendererX11Private MetaCursorRendererX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererX11, meta_cursor_renderer_x11, META_TYPE_CURSOR_RENDERER);
static gboolean
meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer)
meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererX11 *x11 = META_CURSOR_RENDERER_X11 (renderer);
MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11);
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
Window xwindow = meta_backend_x11_get_xwindow (backend);
if (xwindow == None)
return FALSE;
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
MetaCursorSprite *cursor_sprite = meta_cursor_renderer_get_cursor (renderer);
if (xwindow == None)
{
if (cursor_sprite)
meta_cursor_sprite_realize_texture (cursor_sprite);
return FALSE;
}
gboolean has_server_cursor = FALSE;
if (cursor_sprite)
{
MetaCursor cursor = meta_cursor_sprite_get_meta_cursor (cursor_sprite);
if (cursor != META_CURSOR_NONE)
{
Cursor xcursor = meta_cursor_create_x_cursor (xdisplay, cursor);
@@ -80,6 +84,9 @@ meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer)
priv->server_cursor_visible = has_server_cursor;
}
if (!priv->server_cursor_visible && cursor_sprite)
meta_cursor_sprite_realize_texture (cursor_sprite);
return priv->server_cursor_visible;
}

View File

@@ -107,20 +107,6 @@ set_alarm_enabled (Display *dpy,
XSyncChangeAlarm (dpy, alarm, XSyncCAEvents, &attr);
}
static void
check_x11_watch (gpointer data,
gpointer user_data)
{
MetaIdleMonitorWatchXSync *watch_xsync = data;
MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) watch_xsync;
XSyncAlarm alarm = (XSyncAlarm) user_data;
if (watch_xsync->xalarm != alarm)
return;
_meta_idle_monitor_watch_fire (watch);
}
static char *
counter_name_for_device (int device_id)
{
@@ -327,13 +313,38 @@ meta_idle_monitor_xsync_init (MetaIdleMonitorXSync *monitor_xsync)
monitor_xsync->alarms = g_hash_table_new (NULL, NULL);
}
static void
check_x11_watches (MetaIdleMonitor *monitor,
XSyncAlarm alarm)
{
GList *node, *watch_ids;
/* we get the keys and do explicit look ups in case
* an early iteration of the loop ends up leading
* to watches from later iterations getting invalidated
*/
watch_ids = g_hash_table_get_keys (monitor->watches);
for (node = watch_ids; node != NULL; node = node->next)
{
guint watch_id = GPOINTER_TO_UINT (node->data);
MetaIdleMonitorWatchXSync *watch;
watch = g_hash_table_lookup (monitor->watches, GUINT_TO_POINTER (watch_id));
if (watch && watch->xalarm == alarm)
_meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
}
g_list_free (watch_ids);
}
void
meta_idle_monitor_xsync_handle_xevent (MetaIdleMonitor *monitor,
XSyncAlarmNotifyEvent *alarm_event)
{
MetaIdleMonitorXSync *monitor_xsync = META_IDLE_MONITOR_XSYNC (monitor);
XSyncAlarm alarm;
GList *watches;
gboolean has_alarm;
if (alarm_event->state != XSyncAlarmActive)
@@ -358,10 +369,5 @@ meta_idle_monitor_xsync_handle_xevent (MetaIdleMonitor *monitor,
}
if (has_alarm)
{
watches = g_hash_table_get_values (monitor->watches);
g_list_foreach (watches, check_x11_watch, (gpointer) alarm);
g_list_free (watches);
}
check_x11_watches (monitor, alarm);
}

View File

@@ -199,9 +199,9 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
}
static void
meta_input_settings_x11_set_scroll_method (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadScrollMethod mode)
meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean edge_scroll_enabled)
{
guchar values[3] = { 0 }; /* 2fg, edge, button. The last value is unused */
guchar *available;
@@ -211,26 +211,21 @@ meta_input_settings_x11_set_scroll_method (MetaInputSettings *setting
if (!available)
return;
switch (mode)
if (available[0])
{
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_DISABLED:
break;
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING:
values[1] = 1;
break;
case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING:
values[0] = 1;
break;
default:
g_assert_not_reached ();
}
else if (available[1] && edge_scroll_enabled)
{
values[1] = 1;
}
else
{
/* Disabled */
}
if ((values[0] && !available[0]) || (values[1] && !available[1]))
g_warning ("Device '%s' does not support scroll mode %d\n",
clutter_input_device_get_device_name (device), mode);
else
change_property (device, "libinput Scroll Method Enabled",
XA_INTEGER, 8, &values, 3);
change_property (device, "libinput Scroll Method Enabled",
XA_INTEGER, 8, &values, 3);
meta_XFree (available);
}
@@ -321,7 +316,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled;
input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll;
input_settings_class->set_scroll_method = meta_input_settings_x11_set_scroll_method;
input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll;
input_settings_class->set_scroll_button = meta_input_settings_x11_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_x11_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_x11_set_keyboard_repeat;

View File

@@ -419,12 +419,6 @@ read_output_edid (MetaMonitorManagerXrandr *manager_xrandr,
result = get_edid_property (manager_xrandr->xdisplay, winsys_id, edid_atom, &len);
}
if (!result)
{
edid_atom = XInternAtom (manager_xrandr->xdisplay, "XFree86_DDC_EDID1_RAWDATA", FALSE);
result = get_edid_property (manager_xrandr->xdisplay, winsys_id, edid_atom, &len);
}
if (result)
{
if (len > 0 && len % 128 == 0)
@@ -637,6 +631,70 @@ output_get_connector_type (MetaMonitorManagerXrandr *manager_xrandr,
return META_CONNECTOR_TYPE_Unknown;
}
static void
output_get_modes (MetaMonitorManager *manager,
MetaOutput *meta_output,
XRROutputInfo *output)
{
guint j, k;
guint n_actual_modes;
meta_output->modes = g_new0 (MetaMonitorMode *, output->nmode);
n_actual_modes = 0;
for (j = 0; j < (guint)output->nmode; j++)
{
for (k = 0; k < manager->n_modes; k++)
{
if (output->modes[j] == (XID)manager->modes[k].mode_id)
{
meta_output->modes[n_actual_modes] = &manager->modes[k];
n_actual_modes += 1;
break;
}
}
}
meta_output->n_modes = n_actual_modes;
if (n_actual_modes > 0)
meta_output->preferred_mode = meta_output->modes[0];
}
static void
output_get_crtcs (MetaMonitorManager *manager,
MetaOutput *meta_output,
XRROutputInfo *output)
{
guint j, k;
guint n_actual_crtcs;
meta_output->possible_crtcs = g_new0 (MetaCRTC *, output->ncrtc);
n_actual_crtcs = 0;
for (j = 0; j < (unsigned)output->ncrtc; j++)
{
for (k = 0; k < manager->n_crtcs; k++)
{
if ((XID)manager->crtcs[k].crtc_id == output->crtcs[j])
{
meta_output->possible_crtcs[n_actual_crtcs] = &manager->crtcs[k];
n_actual_crtcs += 1;
break;
}
}
}
meta_output->n_possible_crtcs = n_actual_crtcs;
meta_output->crtc = NULL;
for (j = 0; j < manager->n_crtcs; j++)
{
if ((XID)manager->crtcs[j].crtc_id == output->crtc)
{
meta_output->crtc = &manager->crtcs[j];
break;
}
}
}
static char *
get_xmode_name (XRRModeInfo *xmode)
{
@@ -773,6 +831,8 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
MetaOutput *meta_output;
output = XRRGetOutputInfo (manager_xrandr->xdisplay, resources, resources->outputs[i]);
if (!output)
continue;
meta_output = &manager->outputs[n_actual_outputs];
@@ -796,44 +856,8 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
meta_output->connector_type = output_get_connector_type (manager_xrandr, meta_output);
output_get_tile_info (manager_xrandr, meta_output);
meta_output->n_modes = output->nmode;
meta_output->modes = g_new0 (MetaMonitorMode *, meta_output->n_modes);
for (j = 0; j < meta_output->n_modes; j++)
{
for (k = 0; k < manager->n_modes; k++)
{
if (output->modes[j] == (XID)manager->modes[k].mode_id)
{
meta_output->modes[j] = &manager->modes[k];
break;
}
}
}
meta_output->preferred_mode = meta_output->modes[0];
meta_output->n_possible_crtcs = output->ncrtc;
meta_output->possible_crtcs = g_new0 (MetaCRTC *, meta_output->n_possible_crtcs);
for (j = 0; j < (unsigned)output->ncrtc; j++)
{
for (k = 0; k < manager->n_crtcs; k++)
{
if ((XID)manager->crtcs[k].crtc_id == output->crtcs[j])
{
meta_output->possible_crtcs[j] = &manager->crtcs[k];
break;
}
}
}
meta_output->crtc = NULL;
for (j = 0; j < manager->n_crtcs; j++)
{
if ((XID)manager->crtcs[j].crtc_id == output->crtc)
{
meta_output->crtc = &manager->crtcs[j];
break;
}
}
output_get_modes (manager, meta_output, output);
output_get_crtcs (manager, meta_output, output);
meta_output->n_possible_clones = output->nclone;
meta_output->possible_clones = g_new0 (MetaOutput *, meta_output->n_possible_clones);
@@ -857,7 +881,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
else
meta_output->backlight = -1;
n_actual_outputs++;
if (meta_output->n_modes == 0 || meta_output->n_possible_crtcs == 0)
meta_monitor_manager_clear_output (meta_output);
else
n_actual_outputs++;
}
XRRFreeOutputInfo (output);
@@ -1133,17 +1160,16 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
if (crtc_info->mode != NULL)
{
MetaMonitorMode *mode;
g_autofree XID *outputs = NULL;
unsigned int j, n_outputs;
int width, height;
g_autofree XID *output_ids = NULL;
unsigned int j, n_output_ids;
Status ok;
mode = crtc_info->mode;
n_outputs = crtc_info->outputs->len;
outputs = g_new (XID, n_outputs);
n_output_ids = crtc_info->outputs->len;
output_ids = g_new (XID, n_output_ids);
for (j = 0; j < n_outputs; j++)
for (j = 0; j < n_output_ids; j++)
{
MetaOutput *output;
@@ -1152,7 +1178,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
output->is_dirty = TRUE;
output->crtc = crtc;
outputs[j] = output->winsys_id;
output_ids[j] = output->winsys_id;
}
ok = XRRSetCrtcConfig (manager_xrandr->xdisplay,
@@ -1162,7 +1188,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
crtc_info->x, crtc_info->y,
(XID)mode->mode_id,
meta_monitor_transform_to_xrandr (crtc_info->transform),
outputs, n_outputs);
output_ids, n_output_ids);
if (ok != Success)
{

View File

@@ -0,0 +1,89 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include "backends/x11/nested/meta-cursor-renderer-x11-nested.h"
#include "backends/x11/meta-backend-x11.h"
struct _MetaCursorRendererX11Nested
{
MetaCursorRenderer parent;
};
G_DEFINE_TYPE (MetaCursorRendererX11Nested, meta_cursor_renderer_x11_nested,
META_TYPE_CURSOR_RENDERER);
static gboolean
meta_cursor_renderer_x11_nested_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
if (cursor_sprite)
meta_cursor_sprite_realize_texture (cursor_sprite);
return FALSE;
}
static Cursor
create_empty_cursor (Display *xdisplay)
{
XcursorImage *image;
XcursorPixel *pixels;
Cursor xcursor;
image = XcursorImageCreate (1, 1);
if (image == NULL)
return None;
image->xhot = 0;
image->yhot = 0;
pixels = image->pixels;
pixels[0] = 0;
xcursor = XcursorImageLoadCursor (xdisplay, image);
XcursorImageDestroy (image);
return xcursor;
}
static void
meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
{
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
Window xwindow = meta_backend_x11_get_xwindow (backend);
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
Cursor empty_xcursor = create_empty_cursor (xdisplay);
XDefineCursor (xdisplay, xwindow, empty_xcursor);
XFreeCursor (xdisplay, empty_xcursor);
}
static void
meta_cursor_renderer_x11_nested_class_init (MetaCursorRendererX11NestedClass *klass)
{
MetaCursorRendererClass *renderer_class = META_CURSOR_RENDERER_CLASS (klass);
renderer_class->update_cursor = meta_cursor_renderer_x11_nested_update_cursor;
}

View File

@@ -0,0 +1,38 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_CURSOR_RENDERER_X11_NESTED_NESTED_H
#define META_CURSOR_RENDERER_X11_NESTED_NESTED_H
#include <glib-object.h>
#include "backends/meta-cursor-renderer.h"
#define META_TYPE_CURSOR_RENDERER_X11_NESTED (meta_cursor_renderer_x11_nested_get_type ())
G_DECLARE_FINAL_TYPE (MetaCursorRendererX11Nested,
meta_cursor_renderer_x11_nested,
META, CURSOR_RENDERER_X11_NESTED,
MetaCursorRenderer);
#endif /* META_CURSOR_RENDERER_X11_NESTED_NESTED_H */

View File

@@ -779,7 +779,7 @@ meta_compositor_size_change_window (MetaCompositor *compositor,
MetaRectangle *old_buffer_rect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
meta_window_actor_size_change (window_actor, META_SIZE_CHANGE_MAXIMIZE, old_frame_rect, old_buffer_rect);
meta_window_actor_size_change (window_actor, which_change, old_frame_rect, old_buffer_rect);
}
void

View File

@@ -22,6 +22,8 @@
#include "meta-background-private.h"
#include "cogl-utils.h"
#include <string.h>
enum
{
CHANGED,
@@ -71,6 +73,8 @@ enum
G_DEFINE_TYPE (MetaBackground, meta_background, G_TYPE_OBJECT)
static gboolean texture_has_alpha (CoglTexture *texture);
static GSList *all_backgrounds = NULL;
static void
@@ -474,7 +478,7 @@ get_texture_area (MetaBackground *self,
}
}
static void
static gboolean
draw_texture (MetaBackground *self,
CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -483,6 +487,7 @@ draw_texture (MetaBackground *self,
{
MetaBackgroundPrivate *priv = self->priv;
cairo_rectangle_int_t texture_area;
gboolean bare_region_visible;
get_texture_area (self, monitor_area, texture, &texture_area);
@@ -503,6 +508,9 @@ draw_texture (MetaBackground *self,
- texture_area.y / (float)texture_area.height,
(monitor_area->width - texture_area.x) / (float)texture_area.width,
(monitor_area->height - texture_area.y) / (float)texture_area.height);
bare_region_visible = texture_has_alpha (texture);
/* Draw just the texture */
break;
case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
@@ -513,11 +521,16 @@ draw_texture (MetaBackground *self,
texture_area.x + texture_area.width,
texture_area.y + texture_area.height,
0, 0, 1.0, 1.0);
bare_region_visible = texture_has_alpha (texture) || memcmp (&texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0;
break;
case G_DESKTOP_BACKGROUND_STYLE_NONE:
bare_region_visible = TRUE;
break;
default:
g_return_if_reached();
g_return_val_if_reached(FALSE);
}
return bare_region_visible;
}
static void
@@ -748,6 +761,7 @@ meta_background_get_texture (MetaBackground *self,
if (monitor->dirty)
{
CoglError *catch_error = NULL;
gboolean bare_region_visible = FALSE;
if (monitor->texture == NULL)
{
@@ -783,9 +797,9 @@ meta_background_get_texture (MetaBackground *self,
cogl_pipeline_set_layer_texture (pipeline, 0, texture2);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
draw_texture (self,
monitor->fbo, pipeline,
texture2, &monitor_area);
bare_region_visible = draw_texture (self,
monitor->fbo, pipeline,
texture2, &monitor_area);
cogl_object_unref (pipeline);
}
@@ -796,8 +810,7 @@ meta_background_get_texture (MetaBackground *self,
0.0, 0.0, 0.0, 0.0);
}
if (texture1 != NULL &&
!(texture2 != NULL && priv->blend_factor == 1.0 && !texture_has_alpha (texture2)))
if (texture1 != NULL && priv->blend_factor != 1.0)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_ADD);
cogl_pipeline_set_color4f (pipeline,
@@ -808,15 +821,14 @@ meta_background_get_texture (MetaBackground *self,
cogl_pipeline_set_layer_texture (pipeline, 0, texture1);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
draw_texture (self,
monitor->fbo, pipeline,
texture1, &monitor_area);
bare_region_visible = bare_region_visible || draw_texture (self,
monitor->fbo, pipeline,
texture1, &monitor_area);
cogl_object_unref (pipeline);
}
if (!((texture2 != NULL && priv->blend_factor == 1.0 && !texture_has_alpha (texture2)) ||
(texture1 != NULL && !texture_has_alpha (texture1))))
if (bare_region_visible)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_OVER_REVERSE);

View File

@@ -36,6 +36,14 @@
#include "compositor/region-utils.h"
enum {
PAINTING,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
struct _MetaSurfaceActorWaylandPrivate
{
MetaWaylandSurface *surface;
@@ -293,8 +301,12 @@ static MetaWindow *
meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (META_SURFACE_ACTOR_WAYLAND (actor));
MetaWaylandSurface *surface = priv->surface;
return priv->surface->window;
if (!surface)
return NULL;
return surface->window;
}
static void
@@ -343,12 +355,13 @@ meta_surface_actor_wayland_paint (ClutterActor *actor)
if (priv->surface)
{
MetaWaylandCompositor *compositor = priv->surface->compositor;
meta_wayland_surface_update_outputs (priv->surface);
wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
wl_list_init (&priv->frame_callback_list);
}
g_signal_emit (actor, signals[PAINTING], 0);
CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
}
@@ -384,6 +397,13 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
object_class->dispose = meta_surface_actor_wayland_dispose;
signals[PAINTING] = g_signal_new ("painting",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void

View File

@@ -832,21 +832,23 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
return TRUE;
/*
* Do not add shadows to non-opaque windows; eventually we should generate
* a shadow from the input shape for such windows.
* Do not add shadows to non-opaque (ARGB32) windows, as we can't easily
* generate shadows for them.
*/
if (is_non_opaque (self))
return FALSE;
/*
* Add shadows to override redirect windows on X11 unless the toolkit
* indicates that it is handling shadows itself (e.g., Gtk menus).
* If a window specifies that it has custom frame extents, that likely
* means that it is drawing a shadow itself. Don't draw our own.
*/
if (priv->window->override_redirect &&
!priv->window->has_custom_frame_extents)
return TRUE;
if (priv->window->has_custom_frame_extents)
return FALSE;
return FALSE;
/*
* Generate shadows for all other windows.
*/
return TRUE;
}
/**

View File

@@ -255,6 +255,31 @@ get_actor_private (MetaWindowActor *actor)
return priv;
}
static ClutterTimeline *
actor_animate (ClutterActor *actor,
ClutterAnimationMode mode,
guint duration,
const gchar *first_property,
...)
{
va_list args;
ClutterTransition *transition;
clutter_actor_save_easing_state (actor);
clutter_actor_set_easing_mode (actor, mode);
clutter_actor_set_easing_duration (actor, duration);
va_start (args, first_property);
g_object_set_valist (G_OBJECT (actor), first_property, args);
va_end (args);
transition = clutter_actor_get_transition (actor, first_property);
clutter_actor_restore_easing_state (actor);
return CLUTTER_TIMELINE (transition);
}
static void
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
{
@@ -271,7 +296,10 @@ on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
if (apriv->orig_parent)
{
clutter_actor_reparent (a, apriv->orig_parent);
g_object_ref (a);
clutter_actor_remove_child (clutter_actor_get_parent (a), a);
clutter_actor_add_child (apriv->orig_parent, a);
g_object_unref (a);
apriv->orig_parent = NULL;
}
@@ -360,11 +388,10 @@ switch_workspace (MetaPlugin *plugin,
MetaScreen *screen;
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
GList *l;
ClutterActor *workspace0 = clutter_group_new ();
ClutterActor *workspace1 = clutter_group_new ();
ClutterActor *workspace0 = clutter_actor_new ();
ClutterActor *workspace1 = clutter_actor_new ();
ClutterActor *stage;
int screen_width, screen_height;
ClutterAnimation *animation;
screen = meta_plugin_get_screen (plugin);
stage = meta_get_stage_for_screen (screen);
@@ -373,17 +400,15 @@ switch_workspace (MetaPlugin *plugin,
&screen_width,
&screen_height);
clutter_actor_set_anchor_point (workspace1,
screen_width,
screen_height);
clutter_actor_set_pivot_point (workspace1, 1.0, 1.0);
clutter_actor_set_position (workspace1,
screen_width,
screen_height);
clutter_actor_set_scale (workspace1, 0.0, 0.0);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace1);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace0);
clutter_actor_add_child (stage, workspace1);
clutter_actor_add_child (stage, workspace0);
if (from == to)
{
@@ -406,12 +431,15 @@ switch_workspace (MetaPlugin *plugin,
if (win_workspace == to || win_workspace == from)
{
ClutterActor *parent = win_workspace == to ? workspace1 : workspace0;
apriv->orig_parent = clutter_actor_get_parent (actor);
clutter_actor_reparent (actor,
win_workspace == to ? workspace1 : workspace0);
clutter_actor_show_all (actor);
clutter_actor_raise_top (actor);
g_object_ref (actor);
clutter_actor_remove_child (clutter_actor_get_parent (actor), actor);
clutter_actor_add_child (parent, actor);
clutter_actor_show (actor);
clutter_actor_set_child_below_sibling (parent, actor, NULL);
g_object_unref (actor);
}
else if (win_workspace < 0)
{
@@ -431,23 +459,21 @@ switch_workspace (MetaPlugin *plugin,
priv->desktop1 = workspace0;
priv->desktop2 = workspace1;
animation = clutter_actor_animate (workspace0, CLUTTER_EASE_IN_SINE,
SWITCH_TIMEOUT,
"scale-x", 1.0,
"scale-y", 1.0,
NULL);
priv->tml_switch_workspace1 = clutter_animation_get_timeline (animation);
priv->tml_switch_workspace1 = actor_animate (workspace0, CLUTTER_EASE_IN_SINE,
SWITCH_TIMEOUT,
"scale-x", 1.0,
"scale-y", 1.0,
NULL);
g_signal_connect (priv->tml_switch_workspace1,
"completed",
G_CALLBACK (on_switch_workspace_effect_complete),
plugin);
animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
SWITCH_TIMEOUT,
"scale-x", 0.0,
"scale-y", 0.0,
NULL);
priv->tml_switch_workspace2 = clutter_animation_get_timeline (animation);
priv->tml_switch_workspace2 = actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
SWITCH_TIMEOUT,
"scale-x", 0.0,
"scale-y", 0.0,
NULL);
}
@@ -504,19 +530,17 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (window_actor);
animation = clutter_actor_animate (actor,
CLUTTER_EASE_IN_SINE,
MINIMIZE_TIMEOUT,
"scale-x", 0.0,
"scale-y", 0.0,
"x", (double)icon_geometry.x,
"y", (double)icon_geometry.y,
NULL);
apriv->tml_minimize = clutter_animation_get_timeline (animation);
apriv->tml_minimize = actor_animate (actor,
CLUTTER_EASE_IN_SINE,
MINIMIZE_TIMEOUT,
"scale-x", 0.0,
"scale-y", 0.0,
"x", (double)icon_geometry.x,
"y", (double)icon_geometry.y,
NULL);
data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_minimize, "completed",
@@ -561,7 +585,6 @@ map (MetaPlugin *plugin, MetaWindowActor *window_actor)
if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (window_actor);
@@ -570,14 +593,13 @@ map (MetaPlugin *plugin, MetaWindowActor *window_actor)
clutter_actor_set_scale (actor, 0.5, 0.5);
clutter_actor_show (actor);
animation = clutter_actor_animate (actor,
CLUTTER_EASE_OUT_QUAD,
MAP_TIMEOUT,
"opacity", 255,
"scale-x", 1.0,
"scale-y", 1.0,
NULL);
apriv->tml_map = clutter_animation_get_timeline (animation);
apriv->tml_map = actor_animate (actor,
CLUTTER_EASE_OUT_QUAD,
MAP_TIMEOUT,
"opacity", 255,
"scale-x", 1.0,
"scale-y", 1.0,
NULL);
data->actor = actor;
data->plugin = plugin;
g_signal_connect (apriv->tml_map, "completed",
@@ -618,18 +640,16 @@ destroy (MetaPlugin *plugin, MetaWindowActor *window_actor)
if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (window_actor);
animation = clutter_actor_animate (actor,
CLUTTER_EASE_OUT_QUAD,
DESTROY_TIMEOUT,
"opacity", 0,
"scale-x", 0.8,
"scale-y", 0.8,
NULL);
apriv->tml_destroy = clutter_animation_get_timeline (animation);
apriv->tml_destroy = actor_animate (actor,
CLUTTER_EASE_OUT_QUAD,
DESTROY_TIMEOUT,
"opacity", 0,
"scale-x", 0.8,
"scale-y", 0.8,
NULL);
data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_destroy, "completed",
@@ -702,7 +722,9 @@ show_tile_preview (MetaPlugin *plugin,
clutter_actor_show (preview->actor);
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
clutter_actor_lower (preview->actor, window_actor);
clutter_actor_set_child_below_sibling (clutter_actor_get_parent (preview->actor),
preview->actor,
window_actor);
preview->tile_rect = *tile_rect;
}

View File

@@ -35,6 +35,7 @@
#include <meta/boxes.h>
#include <meta/display.h>
#include "keybindings-private.h"
#include "startup-notification-private.h"
#include "meta-gesture-tracker-private.h"
#include <meta/prefs.h>
#include <meta/barrier.h>
@@ -276,9 +277,8 @@ struct _MetaDisplay
int xinput_event_base;
int xinput_opcode;
#ifdef HAVE_STARTUP_NOTIFICATION
SnDisplay *sn_display;
#endif
MetaStartupNotification *startup_notification;
int xsync_event_base;
int xsync_error_base;
int shape_event_base;

View File

@@ -400,28 +400,6 @@ meta_display_remove_pending_pings_for_window (MetaDisplay *display,
}
#ifdef HAVE_STARTUP_NOTIFICATION
static void
sn_error_trap_push (SnDisplay *sn_display,
Display *xdisplay)
{
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_push (display);
}
static void
sn_error_trap_pop (SnDisplay *sn_display,
Display *xdisplay)
{
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_pop (display);
}
#endif
static void
enable_compositor (MetaDisplay *display)
{
@@ -527,6 +505,20 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
}
}
static void
on_startup_notification_changed (MetaStartupNotification *sn,
gpointer sequence,
MetaDisplay *display)
{
if (!display->screen)
return;
g_slist_free (display->screen->startup_sequences);
display->screen->startup_sequences =
meta_startup_notification_get_sequences (display->startup_notification);
g_signal_emit_by_name (display->screen, "startup-sequence-changed", sequence);
}
/**
* meta_display_open:
*
@@ -547,7 +539,7 @@ meta_display_open (void)
guint32 timestamp;
/* A list of all atom names, so that we can intern them in one go. */
char *atom_names[] = {
const char *atom_names[] = {
#define item(x) #x,
#include <x11/atomnames.h>
#undef item
@@ -605,14 +597,13 @@ meta_display_open (void)
meta_prefs_add_listener (prefs_changed_callback, display);
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
XInternAtoms (display->xdisplay, atom_names, G_N_ELEMENTS (atom_names),
XInternAtoms (display->xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names),
False, atoms);
{
int i = 0;
i = 0;
#define item(x) display->atom_##x = atoms[i++];
#include <x11/atomnames.h>
#undef item
}
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
@@ -631,12 +622,6 @@ meta_display_open (void)
display->screen = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION
display->sn_display = sn_display_new (display->xdisplay,
sn_error_trap_push,
sn_error_trap_pop);
#endif
/* Get events */
meta_display_init_events (display);
meta_display_init_events_x11 (display);
@@ -917,6 +902,10 @@ meta_display_open (void)
display->screen = screen;
display->startup_notification = meta_startup_notification_get (display);
g_signal_connect (display->startup_notification, "changed",
G_CALLBACK (on_startup_notification_changed), display);
meta_screen_init_workspaces (screen);
enable_compositor (display);
@@ -1101,6 +1090,7 @@ meta_display_close (MetaDisplay *display,
meta_display_remove_autoraise_callback (display);
g_clear_object (&display->startup_notification);
g_clear_object (&display->gesture_tracker);
if (display->focus_timeout_id)
@@ -1113,14 +1103,6 @@ meta_display_close (MetaDisplay *display,
meta_screen_free (display->screen, timestamp);
#ifdef HAVE_STARTUP_NOTIFICATION
if (display->sn_display)
{
sn_display_unref (display->sn_display);
display->sn_display = NULL;
}
#endif
/* Must be after all calls to meta_window_unmanage() since they
* unregister windows
*/
@@ -1964,9 +1946,12 @@ meta_display_end_grab_op (MetaDisplay *display,
meta_topic (META_DEBUG_WINDOW_OPS,
"Ending grab op %u at time %u\n", grab_op, timestamp);
if (display->event_route == META_EVENT_ROUTE_NORMAL)
if (display->event_route == META_EVENT_ROUTE_NORMAL ||
display->event_route == META_EVENT_ROUTE_COMPOSITOR_GRAB)
return;
g_assert (grab_window != NULL);
g_signal_emit (display, display_signals[GRAB_OP_END], 0,
display->screen, grab_window, grab_op);

View File

@@ -182,10 +182,25 @@ meta_display_handle_event (MetaDisplay *display,
sequence = clutter_event_get_event_sequence (event);
/* Set the pointer emulating sequence on touch begin, if eligible */
if (event->type == CLUTTER_TOUCH_BEGIN &&
!display->pointer_emulating_sequence &&
sequence_is_pointer_emulated (display, event))
display->pointer_emulating_sequence = sequence;
if (event->type == CLUTTER_TOUCH_BEGIN)
{
if (sequence_is_pointer_emulated (display, event))
{
/* This is the new pointer emulating sequence */
display->pointer_emulating_sequence = sequence;
}
else if (display->pointer_emulating_sequence == sequence)
{
/* This sequence was "pointer emulating" in a prior incarnation,
* but now it isn't. We unset the pointer emulating sequence at
* this point so the current sequence is not mistaken as pointer
* emulating, while we've ensured that it's been deemed
* "pointer emulating" throughout all of the event processing
* of the previous incarnation.
*/
display->pointer_emulating_sequence = NULL;
}
}
#ifdef HAVE_WAYLAND
MetaWaylandCompositor *compositor = NULL;
@@ -206,8 +221,8 @@ meta_display_handle_event (MetaDisplay *display,
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
{
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (NULL);
meta_cursor_tracker_update_position (tracker, event->motion.x, event->motion.y);
meta_cursor_tracker_update_position (meta_cursor_tracker_get_for_screen (NULL),
event->motion.x, event->motion.y);
display->monitor_cache_invalidated = TRUE;
}
@@ -335,11 +350,6 @@ meta_display_handle_event (MetaDisplay *display,
}
#endif
/* Unset the pointer emulating sequence after its end event is processed */
if (event->type == CLUTTER_TOUCH_END &&
display->pointer_emulating_sequence == sequence)
display->pointer_emulating_sequence = NULL;
display->current_time = CurrentTime;
return bypass_clutter;
}

View File

@@ -188,7 +188,7 @@ reload_modmap (MetaKeyBindingManager *keys)
/* Modifiers to find. */
struct {
char *name;
const char *name;
xkb_mod_mask_t *mask_p;
} mods[] = {
{ "ScrollLock", &scroll_lock_mask },

View File

@@ -80,6 +80,10 @@
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland.h"
# endif
#if defined(HAVE_NATIVE_BACKEND) && defined(HAVE_WAYLAND)
#include <systemd/sd-login.h>
#endif
/*
@@ -164,6 +168,7 @@ static gboolean opt_disable_sm;
static gboolean opt_sync;
#ifdef HAVE_WAYLAND
static gboolean opt_wayland;
static gboolean opt_nested;
#endif
#ifdef HAVE_NATIVE_BACKEND
static gboolean opt_display_server;
@@ -212,6 +217,12 @@ static GOptionEntry meta_options[] = {
N_("Run as a wayland compositor"),
NULL
},
{
"nested", 0, 0, G_OPTION_ARG_NONE,
&opt_nested,
N_("Run as a nested compositor"),
NULL
},
#endif
#ifdef HAVE_NATIVE_BACKEND
{
@@ -291,6 +302,104 @@ on_sigterm (gpointer user_data)
return G_SOURCE_REMOVE;
}
#if defined(HAVE_WAYLAND) && defined(HAVE_NATIVE_BACKEND)
static char *
find_logind_session_type (void)
{
char **sessions;
char *session_id;
char *session_type;
int ret, i;
ret = sd_pid_get_session (0, &session_id);
if (ret == 0 && session_id != NULL)
{
ret = sd_session_get_type (session_id, &session_type);
free (session_id);
if (ret < 0)
session_type = NULL;
goto out;
}
session_type = NULL;
ret = sd_uid_get_sessions (getuid (), TRUE, &sessions);
if (ret < 0 || sessions == NULL)
goto out;
for (i = 0; sessions[i] != NULL; i++)
{
ret = sd_session_get_type (sessions[i], &session_type);
if (ret < 0)
continue;
if (g_strcmp0 (session_type, "x11") == 0||
g_strcmp0 (session_type, "wayland") == 0)
break;
g_clear_pointer (&session_type, (GDestroyNotify) free);
}
for (i = 0; sessions[i] != NULL; i++)
free (sessions[i]);
free (sessions);
out:
return session_type;
}
static gboolean
check_for_wayland_session_type (void)
{
char *session_type = NULL;
gboolean is_wayland = FALSE;
session_type = find_logind_session_type ();
if (session_type != NULL)
{
is_wayland = g_strcmp0 (session_type, "wayland") == 0;
free (session_type);
}
return is_wayland;
}
#endif
static void
init_backend (void)
{
#ifdef HAVE_WAYLAND
gboolean run_as_wayland_compositor = opt_wayland;
#ifdef HAVE_NATIVE_BACKEND
if (opt_nested && opt_display_server)
{
meta_warning ("Can't run both as nested and as a display server\n");
meta_exit (META_EXIT_ERROR);
}
if (!run_as_wayland_compositor)
run_as_wayland_compositor = check_for_wayland_session_type ();
#ifdef CLUTTER_WINDOWING_EGL
if (opt_display_server || (run_as_wayland_compositor && !opt_nested))
clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
else
#endif
#endif
#endif
clutter_set_windowing_backend (CLUTTER_WINDOWING_X11);
#ifdef HAVE_WAYLAND
meta_set_is_wayland_compositor (run_as_wayland_compositor);
#endif
}
/**
* meta_init: (skip)
*
@@ -323,16 +432,7 @@ meta_init (void)
if (g_getenv ("MUTTER_DEBUG"))
meta_set_debugging (TRUE);
#if defined(CLUTTER_WINDOWING_EGL) && defined(HAVE_NATIVE_BACKEND)
if (opt_display_server)
clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
else
#endif
clutter_set_windowing_backend (CLUTTER_WINDOWING_X11);
#ifdef HAVE_WAYLAND
meta_set_is_wayland_compositor (opt_wayland);
#endif
init_backend ();
if (g_get_home_dir ())
if (chdir (g_get_home_dir ()) < 0)

154
src/core/meta-border.c Normal file
View File

@@ -0,0 +1,154 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include "core/meta-border.h"
#include <math.h>
static inline float
meta_vector2_cross_product (const MetaVector2 a,
const MetaVector2 b)
{
return a.x * b.y - a.y * b.x;
}
static inline MetaVector2
meta_vector2_add (const MetaVector2 a,
const MetaVector2 b)
{
return (MetaVector2) {
.x = a.x + b.x,
.y = a.y + b.y,
};
}
static inline MetaVector2
meta_vector2_multiply_constant (const float c,
const MetaVector2 a)
{
return (MetaVector2) {
.x = c * a.x,
.y = c * a.y,
};
}
gboolean
meta_line2_intersects_with (const MetaLine2 *line1,
const MetaLine2 *line2,
MetaVector2 *intersection)
{
MetaVector2 p = line1->a;
MetaVector2 r = meta_vector2_subtract (line1->b, line1->a);
MetaVector2 q = line2->a;
MetaVector2 s = meta_vector2_subtract (line2->b, line2->a);
float rxs;
float sxr;
float t;
float u;
/*
* The line (p, r) and (q, s) intersects where
*
* p + t r = q + u s
*
* Calculate t:
*
* (p + t r) × s = (q + u s) × s
* p × s + t (r × s) = q × s + u (s × s)
* p × s + t (r × s) = q × s
* t (r × s) = q × s - p × s
* t (r × s) = (q - p) × s
* t = ((q - p) × s) / (r × s)
*
* Using the same method, for u we get:
*
* u = ((p - q) × r) / (s × r)
*/
rxs = meta_vector2_cross_product (r, s);
sxr = meta_vector2_cross_product (s, r);
/* If r × s = 0 then the lines are either parallel or collinear. */
if (fabsf (rxs) < FLT_MIN)
return FALSE;
t = meta_vector2_cross_product (meta_vector2_subtract (q, p), s) / rxs;
u = meta_vector2_cross_product (meta_vector2_subtract (p, q), r) / sxr;
/* The lines only intersect if 0 ≤ t ≤ 1 and 0 ≤ u ≤ 1. */
if (t < 0.0 || t > 1.0 || u < 0.0 || u > 1.0)
return FALSE;
*intersection = meta_vector2_add (p, meta_vector2_multiply_constant (t, r));
return TRUE;
}
gboolean
meta_border_is_horizontal (MetaBorder *border)
{
return border->line.a.y == border->line.b.y;
}
gboolean
meta_border_is_blocking_directions (MetaBorder *border,
MetaBorderMotionDirection directions)
{
if (meta_border_is_horizontal (border))
{
if ((directions & (META_BORDER_MOTION_DIRECTION_POSITIVE_Y |
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y)) == 0)
return FALSE;
}
else
{
if ((directions & (META_BORDER_MOTION_DIRECTION_POSITIVE_X |
META_BORDER_MOTION_DIRECTION_NEGATIVE_X)) == 0)
return FALSE;
}
return (~border->blocking_directions & directions) != directions;
}
unsigned int
meta_border_get_allows_directions (MetaBorder *border)
{
return ~border->blocking_directions &
(META_BORDER_MOTION_DIRECTION_POSITIVE_X |
META_BORDER_MOTION_DIRECTION_POSITIVE_Y |
META_BORDER_MOTION_DIRECTION_NEGATIVE_X |
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
}
void
meta_border_set_allows_directions (MetaBorder *border, unsigned int directions)
{
border->blocking_directions =
~directions & (META_BORDER_MOTION_DIRECTION_POSITIVE_X |
META_BORDER_MOTION_DIRECTION_POSITIVE_Y |
META_BORDER_MOTION_DIRECTION_NEGATIVE_X |
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
}

84
src/core/meta-border.h Normal file
View File

@@ -0,0 +1,84 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_BORDER_H
#define META_BORDER_H
#include <glib.h>
typedef enum
{
META_BORDER_MOTION_DIRECTION_POSITIVE_X = 1 << 0,
META_BORDER_MOTION_DIRECTION_POSITIVE_Y = 1 << 1,
META_BORDER_MOTION_DIRECTION_NEGATIVE_X = 1 << 2,
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y = 1 << 3,
} MetaBorderMotionDirection;
typedef struct _MetaVector2
{
float x;
float y;
} MetaVector2;
typedef struct _MetaLine2
{
MetaVector2 a;
MetaVector2 b;
} MetaLine2;
typedef struct _MetaBorder
{
MetaLine2 line;
MetaBorderMotionDirection blocking_directions;
} MetaBorder;
static inline MetaVector2
meta_vector2_subtract (const MetaVector2 a,
const MetaVector2 b)
{
return (MetaVector2) {
.x = a.x - b.x,
.y = a.y - b.y,
};
}
gboolean
meta_line2_intersects_with (const MetaLine2 *line1,
const MetaLine2 *line2,
MetaVector2 *intersection);
gboolean
meta_border_is_horizontal (MetaBorder *border);
gboolean
meta_border_is_blocking_directions (MetaBorder *border,
MetaBorderMotionDirection directions);
unsigned int
meta_border_get_allows_directions (MetaBorder *border);
void
meta_border_set_allows_directions (MetaBorder *border, unsigned int directions);
#endif /* META_BORDER_H */

View File

@@ -44,7 +44,7 @@ print_version (const gchar *option_name,
exit (0);
}
static gchar *plugin = "default";
static const char *plugin = "default";
GOptionEntry mutter_options[] = {
{

View File

@@ -96,6 +96,10 @@ static gboolean bell_is_audible = TRUE;
static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
static char *cursor_theme = NULL;
/* cursor_size will, when running as an X11 compositing window manager, be the
* actual cursor size, multiplied with the global window scaling factor. On
* Wayland, it will be the actual cursor size retrieved from gsettings.
*/
static int cursor_size = 24;
static int draggable_border_width = 10;
static int drag_threshold;
@@ -123,6 +127,9 @@ static gboolean update_binding (MetaKeyPref *binding,
static gboolean update_key_binding (const char *key,
gchar **strokes);
static void wayland_settings_changed (GSettings *settings,
gchar *key,
gpointer data);
static void settings_changed (GSettings *settings,
gchar *key,
gpointer data);
@@ -134,9 +141,10 @@ static void shell_shows_app_menu_changed (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size_from_gtk (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size (void);
static void queue_changed (MetaPreference pref);
@@ -161,8 +169,8 @@ typedef struct
typedef struct
{
char *key;
char *schema;
const char *key;
const char *schema;
MetaPreference pref;
} MetaBasePreference;
@@ -963,14 +971,18 @@ meta_prefs_init (void)
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME,
G_CALLBACK (settings_changed), NULL);
if (meta_is_wayland_compositor ())
g_signal_connect (settings, "changed::cursor-size",
G_CALLBACK (wayland_settings_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
g_signal_connect (gtk_settings_get_default (),
"notify::gtk-shell-shows-app-menu",
G_CALLBACK (shell_shows_app_menu_changed), NULL);
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size), NULL);
if (!meta_is_wayland_compositor ())
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size_from_gtk), NULL);
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
@@ -992,7 +1004,7 @@ meta_prefs_init (void)
handle_preference_init_string_array ();
handle_preference_init_int ();
update_cursor_size (gtk_settings_get_default (), NULL, NULL);
update_cursor_size ();
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
init_bindings ();
@@ -1133,6 +1145,20 @@ meta_prefs_override_preference_schema (const char *key, const char *schema)
/****************************************************************************/
static void
wayland_settings_changed (GSettings *settings,
gchar *key,
gpointer data)
{
GVariant *value = g_settings_get_value (settings, key);
const GVariantType *type = g_variant_get_type (value);
g_return_if_fail (g_variant_type_equal (type, G_VARIANT_TYPE_INT32));
g_return_if_fail (g_str_equal (key, "cursor-size"));
update_cursor_size ();
}
static void
settings_changed (GSettings *settings,
gchar *key,
@@ -1216,9 +1242,29 @@ shell_shows_app_menu_changed (GtkSettings *settings,
}
static void
update_cursor_size (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
update_cursor_size (void)
{
if (meta_is_wayland_compositor ())
{
/* When running as a Wayland compositor, since we size of the cursor
* depends on what output it is on, we cannot use the GTK+
* "gtk-cursor-theme-size" setting because it has already been multiplied
* by the primary monitor scale. So, instead get the non-premultiplied
* cursor size value directly from gsettings instead.
*/
cursor_size =
g_settings_get_int (SETTINGS (SCHEMA_INTERFACE), "cursor-size");
}
else
{
update_cursor_size_from_gtk (gtk_settings_get_default (), NULL, NULL);
}
}
static void
update_cursor_size_from_gtk (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
{
GdkScreen *screen = gdk_screen_get_default ();
GValue value = G_VALUE_INIT;
@@ -1431,42 +1477,11 @@ button_function_from_string (const char *str)
return META_BUTTON_FUNCTION_MAXIMIZE;
else if (strcmp (str, "close") == 0)
return META_BUTTON_FUNCTION_CLOSE;
else if (strcmp (str, "shade") == 0)
return META_BUTTON_FUNCTION_SHADE;
else if (strcmp (str, "above") == 0)
return META_BUTTON_FUNCTION_ABOVE;
else if (strcmp (str, "stick") == 0)
return META_BUTTON_FUNCTION_STICK;
else
/* don't know; give up */
return META_BUTTON_FUNCTION_LAST;
}
static MetaButtonFunction
button_opposite_function (MetaButtonFunction ofwhat)
{
switch (ofwhat)
{
case META_BUTTON_FUNCTION_SHADE:
return META_BUTTON_FUNCTION_UNSHADE;
case META_BUTTON_FUNCTION_UNSHADE:
return META_BUTTON_FUNCTION_SHADE;
case META_BUTTON_FUNCTION_ABOVE:
return META_BUTTON_FUNCTION_UNABOVE;
case META_BUTTON_FUNCTION_UNABOVE:
return META_BUTTON_FUNCTION_ABOVE;
case META_BUTTON_FUNCTION_STICK:
return META_BUTTON_FUNCTION_UNSTICK;
case META_BUTTON_FUNCTION_UNSTICK:
return META_BUTTON_FUNCTION_STICK;
default:
return META_BUTTON_FUNCTION_LAST;
}
}
static gboolean
button_layout_handler (GVariant *value,
gpointer *result,
@@ -1510,12 +1525,6 @@ button_layout_handler (GVariant *value,
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
{
new_layout.left_buttons_has_spacer[i-1] = TRUE;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
{
new_layout.left_buttons_has_spacer[i-2] = TRUE;
}
}
else
{
@@ -1524,11 +1533,6 @@ button_layout_handler (GVariant *value,
new_layout.left_buttons[i] = f;
used[f] = TRUE;
++i;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
new_layout.left_buttons[i++] = f;
}
else
{
@@ -1572,11 +1576,6 @@ button_layout_handler (GVariant *value,
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
{
new_layout.right_buttons_has_spacer[i-1] = TRUE;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
{
new_layout.right_buttons_has_spacer[i-2] = TRUE;
}
}
else
{
@@ -1585,12 +1584,6 @@ button_layout_handler (GVariant *value,
new_layout.right_buttons[i] = f;
used[f] = TRUE;
++i;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
new_layout.right_buttons[i++] = f;
}
else
{

View File

@@ -85,11 +85,7 @@ struct _MetaScreen
/* Cache the current monitor */
int last_monitor_index;
#ifdef HAVE_STARTUP_NOTIFICATION
SnMonitorContext *sn_context;
GSList *startup_sequences;
guint startup_sequence_timeout;
#endif
Window wm_cm_selection_window;
guint work_area_later;
@@ -152,6 +148,10 @@ const MetaMonitorInfo* meta_screen_get_monitor_for_rect (MetaScreen *screen
const MetaMonitorInfo* meta_screen_calculate_monitor_for_window (MetaScreen *screen,
MetaWindow *window);
const MetaMonitorInfo* meta_screen_get_monitor_for_point (MetaScreen *screen,
int x,
int y);
const MetaMonitorInfo* meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,

View File

@@ -43,6 +43,7 @@
#include <meta/meta-enum-types.h>
#include "core.h"
#include "meta-cursor-tracker-private.h"
#include "boxes-private.h"
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xcomposite.h>
@@ -70,11 +71,6 @@ static void prefs_changed_callback (MetaPreference pref,
static void set_desktop_geometry_hint (MetaScreen *screen);
static void set_desktop_viewport_hint (MetaScreen *screen);
#ifdef HAVE_STARTUP_NOTIFICATION
static void meta_screen_sn_event (SnMonitorEvent *event,
void *user_data);
#endif
static void on_monitors_changed (MetaMonitorManager *manager,
MetaScreen *screen);
@@ -729,17 +725,6 @@ meta_screen_new (MetaDisplay *display,
meta_prefs_add_listener (prefs_changed_callback, screen);
#ifdef HAVE_STARTUP_NOTIFICATION
screen->sn_context =
sn_monitor_context_new (screen->display->sn_display,
screen->number,
meta_screen_sn_event,
screen,
NULL);
screen->startup_sequences = NULL;
screen->startup_sequence_timeout = 0;
#endif
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
screen->number, screen->screen_name, screen->xroot);
@@ -799,24 +784,6 @@ meta_screen_free (MetaScreen *screen,
meta_screen_ungrab_keys (screen);
#ifdef HAVE_STARTUP_NOTIFICATION
g_slist_foreach (screen->startup_sequences,
(GFunc) sn_startup_sequence_unref, NULL);
g_slist_free (screen->startup_sequences);
screen->startup_sequences = NULL;
if (screen->startup_sequence_timeout != 0)
{
g_source_remove (screen->startup_sequence_timeout);
screen->startup_sequence_timeout = 0;
}
if (screen->sn_context)
{
sn_monitor_context_unref (screen->sn_context);
screen->sn_context = NULL;
}
#endif
meta_ui_free (screen->ui);
meta_stack_free (screen->stack);
@@ -1255,6 +1222,31 @@ update_num_workspaces (MetaScreen *screen,
g_object_notify (G_OBJECT (screen), "n-workspaces");
}
static void
root_cursor_prepare_at (MetaCursorSprite *cursor_sprite,
int x,
int y,
MetaScreen *screen)
{
const MetaMonitorInfo *monitor;
monitor = meta_screen_get_monitor_for_point (screen, x, y);
/* Reload the cursor texture if the scale has changed. */
meta_cursor_sprite_set_theme_scale (cursor_sprite, monitor->scale);
}
static void
manage_root_cursor_sprite_scale (MetaScreen *screen,
MetaCursorSprite *cursor_sprite)
{
g_signal_connect_object (cursor_sprite,
"prepare-at",
G_CALLBACK (root_cursor_prepare_at),
screen,
0);
}
void
meta_screen_update_cursor (MetaScreen *screen)
{
@@ -1265,6 +1257,10 @@ meta_screen_update_cursor (MetaScreen *screen)
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
cursor_sprite = meta_cursor_sprite_from_theme (cursor);
if (meta_is_wayland_compositor ())
manage_root_cursor_sprite_scale (screen, cursor_sprite);
meta_cursor_tracker_set_root_cursor (tracker, cursor_sprite);
g_object_unref (cursor_sprite);
@@ -1454,6 +1450,25 @@ meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
return monitor->number;
}
const MetaMonitorInfo *
meta_screen_get_monitor_for_point (MetaScreen *screen,
int x,
int y)
{
int i;
if (screen->n_monitor_infos == 1)
return &screen->monitor_infos[0];
for (i = 0; i < screen->n_monitor_infos; i++)
{
if (POINT_IN_RECT (x, y, screen->monitor_infos[i].rect))
return &screen->monitor_infos[i];
}
return NULL;
}
const MetaMonitorInfo*
meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,
@@ -2051,7 +2066,7 @@ meta_screen_queue_workarea_recalc (MetaScreen *screen)
#ifdef WITH_VERBOSE_MODE
static char *
static const char *
meta_screen_corner_to_string (MetaScreenCorner corner)
{
switch (corner)
@@ -2489,208 +2504,6 @@ meta_screen_unshow_desktop (MetaScreen *screen)
meta_screen_update_showing_desktop_hint (screen);
}
#ifdef HAVE_STARTUP_NOTIFICATION
static gboolean startup_sequence_timeout (void *data);
static void
update_startup_feedback (MetaScreen *screen)
{
if (screen->startup_sequences != NULL)
{
meta_topic (META_DEBUG_STARTUP,
"Setting busy cursor\n");
meta_screen_set_cursor (screen, META_CURSOR_BUSY);
}
else
{
meta_topic (META_DEBUG_STARTUP,
"Setting default cursor\n");
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
}
}
static void
add_sequence (MetaScreen *screen,
SnStartupSequence *sequence)
{
meta_topic (META_DEBUG_STARTUP,
"Adding sequence %s\n",
sn_startup_sequence_get_id (sequence));
sn_startup_sequence_ref (sequence);
screen->startup_sequences = g_slist_prepend (screen->startup_sequences,
sequence);
/* our timeout just polls every second, instead of bothering
* to compute exactly when we may next time out
*/
if (screen->startup_sequence_timeout == 0)
{
screen->startup_sequence_timeout = g_timeout_add_seconds (1,
startup_sequence_timeout,
screen);
g_source_set_name_by_id (screen->startup_sequence_timeout,
"[mutter] startup_sequence_timeout");
}
update_startup_feedback (screen);
}
static void
remove_sequence (MetaScreen *screen,
SnStartupSequence *sequence)
{
meta_topic (META_DEBUG_STARTUP,
"Removing sequence %s\n",
sn_startup_sequence_get_id (sequence));
screen->startup_sequences = g_slist_remove (screen->startup_sequences,
sequence);
if (screen->startup_sequences == NULL &&
screen->startup_sequence_timeout != 0)
{
g_source_remove (screen->startup_sequence_timeout);
screen->startup_sequence_timeout = 0;
}
update_startup_feedback (screen);
sn_startup_sequence_unref (sequence);
}
typedef struct
{
GSList *list;
GTimeVal now;
} CollectTimedOutData;
/* This should be fairly long, as it should never be required unless
* apps or .desktop files are buggy, and it's confusing if
* OpenOffice or whatever seems to stop launching - people
* might decide they need to launch it again.
*/
#define STARTUP_TIMEOUT 15000
static void
collect_timed_out_foreach (void *element,
void *data)
{
CollectTimedOutData *ctod = data;
SnStartupSequence *sequence = element;
long tv_sec, tv_usec;
double elapsed;
sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec);
elapsed =
((((double)ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC +
(ctod->now.tv_usec - tv_usec))) / 1000.0;
meta_topic (META_DEBUG_STARTUP,
"Sequence used %g seconds vs. %g max: %s\n",
elapsed, (double) STARTUP_TIMEOUT,
sn_startup_sequence_get_id (sequence));
if (elapsed > STARTUP_TIMEOUT)
ctod->list = g_slist_prepend (ctod->list, sequence);
}
static gboolean
startup_sequence_timeout (void *data)
{
MetaScreen *screen = data;
CollectTimedOutData ctod;
GSList *l;
ctod.list = NULL;
g_get_current_time (&ctod.now);
g_slist_foreach (screen->startup_sequences,
collect_timed_out_foreach,
&ctod);
for (l = ctod.list; l != NULL; l = l->next)
{
SnStartupSequence *sequence = l->data;
meta_topic (META_DEBUG_STARTUP,
"Timed out sequence %s\n",
sn_startup_sequence_get_id (sequence));
sn_startup_sequence_complete (sequence);
}
g_slist_free (ctod.list);
if (screen->startup_sequences != NULL)
{
return TRUE;
}
else
{
/* remove */
screen->startup_sequence_timeout = 0;
return FALSE;
}
}
static void
meta_screen_sn_event (SnMonitorEvent *event,
void *user_data)
{
MetaScreen *screen;
SnStartupSequence *sequence;
screen = user_data;
sequence = sn_monitor_event_get_startup_sequence (event);
sn_startup_sequence_ref (sequence);
switch (sn_monitor_event_get_type (event))
{
case SN_MONITOR_EVENT_INITIATED:
{
const char *wmclass;
wmclass = sn_startup_sequence_get_wmclass (sequence);
meta_topic (META_DEBUG_STARTUP,
"Received startup initiated for %s wmclass %s\n",
sn_startup_sequence_get_id (sequence),
wmclass ? wmclass : "(unset)");
add_sequence (screen, sequence);
}
break;
case SN_MONITOR_EVENT_COMPLETED:
{
meta_topic (META_DEBUG_STARTUP,
"Received startup completed for %s\n",
sn_startup_sequence_get_id (sequence));
remove_sequence (screen,
sn_monitor_event_get_startup_sequence (event));
}
break;
case SN_MONITOR_EVENT_CHANGED:
meta_topic (META_DEBUG_STARTUP,
"Received startup changed for %s\n",
sn_startup_sequence_get_id (sequence));
break;
case SN_MONITOR_EVENT_CANCELED:
meta_topic (META_DEBUG_STARTUP,
"Received startup canceled for %s\n",
sn_startup_sequence_get_id (sequence));
break;
}
g_signal_emit (G_OBJECT (screen), screen_signals[STARTUP_SEQUENCE_CHANGED], 0, sequence);
sn_startup_sequence_unref (sequence);
}
/**
* meta_screen_get_startup_sequences: (skip)
* @screen:
@@ -2702,7 +2515,6 @@ meta_screen_get_startup_sequences (MetaScreen *screen)
{
return screen->startup_sequences;
}
#endif
/* Sets the initial_timestamp and initial_workspace properties
* of a window according to information given us by the

View File

@@ -1055,7 +1055,7 @@ stack_sync_to_xserver (MetaStack *stack)
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
x11_hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
meta_topic (META_DEBUG_STACK, "Top to bottom: ");
meta_topic (META_DEBUG_STACK, "Bottom to top: ");
meta_push_no_msg_prefix ();
for (tmp = g_list_last(stack->sorted); tmp != NULL; tmp = tmp->prev)
@@ -1088,11 +1088,7 @@ stack_sync_to_xserver (MetaStack *stack)
if (w->hidden)
{
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
guint64 stack_id = top_level_window;
g_array_append_val (x11_hidden_stack_ids, stack_id);
}
g_array_append_val (x11_hidden_stack_ids, top_level_window);
continue;
}

View File

@@ -0,0 +1,48 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001, 2002 Havoc Pennington
* Copyright (C) 2002, 2003 Red Hat Inc.
* Some ICCCM manager selection code derived from fvwm2,
* Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
* Copyright (C) 2003 Rob Adams
* Copyright (C) 2004-2006 Elijah Newren
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_STARTUP_NOTIFICATION_PRIVATE_H
#define META_STARTUP_NOTIFICATION_PRIVATE_H
#include "display-private.h"
#define META_TYPE_STARTUP_NOTIFICATION (meta_startup_notification_get_type ())
G_DECLARE_FINAL_TYPE (MetaStartupNotification,
meta_startup_notification,
META, STARTUP_NOTIFICATION,
GObject)
MetaStartupNotification *
meta_startup_notification_get (MetaDisplay *display);
gboolean meta_startup_notification_handle_xevent (MetaStartupNotification *sn,
XEvent *xevent);
void meta_startup_notification_remove_sequence (MetaStartupNotification *sn,
const gchar *id);
GSList * meta_startup_notification_get_sequences (MetaStartupNotification *sn);
#endif /* META_STARTUP_NOTIFICATION_PRIVATE_H */

View File

@@ -0,0 +1,767 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001, 2002 Havoc Pennington
* Copyright (C) 2002, 2003 Red Hat Inc.
* Some ICCCM manager selection code derived from fvwm2,
* Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
* Copyright (C) 2003 Rob Adams
* Copyright (C) 2004-2006 Elijah Newren
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <glib-object.h>
#include <meta/errors.h>
#include "display-private.h"
#include "screen-private.h"
#include "startup-notification-private.h"
/* This should be fairly long, as it should never be required unless
* apps or .desktop files are buggy, and it's confusing if
* OpenOffice or whatever seems to stop launching - people
* might decide they need to launch it again.
*/
#define STARTUP_TIMEOUT 15000000
typedef struct _MetaStartupNotificationSequence MetaStartupNotificationSequence;
typedef struct _MetaStartupNotificationSequenceClass MetaStartupNotificationSequenceClass;
enum {
PROP_SN_0,
PROP_SN_DISPLAY,
N_SN_PROPS
};
enum {
PROP_SEQ_0,
PROP_SEQ_ID,
PROP_SEQ_TIMESTAMP,
N_SEQ_PROPS
};
enum {
SN_CHANGED,
N_SN_SIGNALS
};
static guint sn_signals[N_SN_SIGNALS];
static GParamSpec *sn_props[N_SN_PROPS];
static GParamSpec *seq_props[N_SEQ_PROPS];
typedef struct
{
GSList *list;
gint64 now;
} CollectTimedOutData;
struct _MetaStartupNotification
{
GObject parent_instance;
MetaDisplay *display;
#ifdef HAVE_STARTUP_NOTIFICATION
SnDisplay *sn_display;
SnMonitorContext *sn_context;
#endif
GSList *startup_sequences;
guint startup_sequence_timeout;
};
#define META_TYPE_STARTUP_NOTIFICATION_SEQUENCE \
(meta_startup_notification_sequence_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaStartupNotificationSequence,
meta_startup_notification_sequence,
META, STARTUP_NOTIFICATION_SEQUENCE,
GObject)
typedef struct {
gchar *id;
time_t timestamp;
} MetaStartupNotificationSequencePrivate;
struct _MetaStartupNotificationSequenceClass {
GObjectClass parent_class;
void (* complete) (MetaStartupNotificationSequence *sequence);
};
G_DEFINE_TYPE (MetaStartupNotification,
meta_startup_notification,
G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (MetaStartupNotificationSequence,
meta_startup_notification_sequence,
G_TYPE_OBJECT)
#ifdef HAVE_STARTUP_NOTIFICATION
enum {
PROP_SEQ_X11_0,
PROP_SEQ_X11_SEQ,
N_SEQ_X11_PROPS
};
struct _MetaStartupNotificationSequenceX11 {
MetaStartupNotificationSequence parent_instance;
SnStartupSequence *seq;
};
static GParamSpec *seq_x11_props[N_SEQ_X11_PROPS];
#define META_TYPE_STARTUP_NOTIFICATION_SEQUENCE_X11 \
(meta_startup_notification_sequence_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaStartupNotificationSequenceX11,
meta_startup_notification_sequence_x11,
META, STARTUP_NOTIFICATION_SEQUENCE_X11,
MetaStartupNotificationSequence)
G_DEFINE_TYPE (MetaStartupNotificationSequenceX11,
meta_startup_notification_sequence_x11,
META_TYPE_STARTUP_NOTIFICATION_SEQUENCE)
static void meta_startup_notification_ensure_timeout (MetaStartupNotification *sn);
#endif
static void
meta_startup_notification_update_feedback (MetaStartupNotification *sn)
{
MetaScreen *screen = sn->display->screen;
if (sn->startup_sequences != NULL)
{
meta_topic (META_DEBUG_STARTUP,
"Setting busy cursor\n");
meta_screen_set_cursor (screen, META_CURSOR_BUSY);
}
else
{
meta_topic (META_DEBUG_STARTUP,
"Setting default cursor\n");
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
}
}
static void
meta_startup_notification_sequence_init (MetaStartupNotificationSequence *seq)
{
}
static void
meta_startup_notification_sequence_finalize (GObject *object)
{
MetaStartupNotificationSequence *seq;
MetaStartupNotificationSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq);
g_free (priv->id);
G_OBJECT_CLASS (meta_startup_notification_sequence_parent_class)->finalize (object);
}
static void
meta_startup_notification_sequence_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaStartupNotificationSequence *seq;
MetaStartupNotificationSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq);
switch (prop_id)
{
case PROP_SEQ_ID:
priv->id = g_value_dup_string (value);
break;
case PROP_SEQ_TIMESTAMP:
priv->timestamp = g_value_get_int64 (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_startup_notification_sequence_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaStartupNotificationSequence *seq;
MetaStartupNotificationSequencePrivate *priv;
seq = META_STARTUP_NOTIFICATION_SEQUENCE (object);
priv = meta_startup_notification_sequence_get_instance_private (seq);
switch (prop_id)
{
case PROP_SEQ_ID:
g_value_set_string (value, priv->id);
break;
case PROP_SEQ_TIMESTAMP:
g_value_set_int64 (value, priv->timestamp);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_startup_notification_sequence_class_init (MetaStartupNotificationSequenceClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_startup_notification_sequence_finalize;
object_class->set_property = meta_startup_notification_sequence_set_property;
object_class->get_property = meta_startup_notification_sequence_get_property;
seq_props[PROP_SEQ_ID] =
g_param_spec_string ("id",
"ID",
"ID",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_TIMESTAMP] =
g_param_spec_int64 ("timestamp",
"Timestamp",
"Timestamp",
G_MININT64, G_MAXINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_SEQ_PROPS, seq_props);
}
static const gchar *
meta_startup_notification_sequence_get_id (MetaStartupNotificationSequence *seq)
{
MetaStartupNotificationSequencePrivate *priv;
priv = meta_startup_notification_sequence_get_instance_private (seq);
return priv->id;
}
#ifdef HAVE_STARTUP_NOTIFICATION
static gint64
meta_startup_notification_sequence_get_timestamp (MetaStartupNotificationSequence *seq)
{
MetaStartupNotificationSequencePrivate *priv;
priv = meta_startup_notification_sequence_get_instance_private (seq);
return priv->timestamp;
}
static void
meta_startup_notification_sequence_complete (MetaStartupNotificationSequence *seq)
{
MetaStartupNotificationSequenceClass *klass;
klass = META_STARTUP_NOTIFICATION_SEQUENCE_GET_CLASS (seq);
if (klass->complete)
klass->complete (seq);
}
#endif
#ifdef HAVE_STARTUP_NOTIFICATION
static void
meta_startup_notification_sequence_x11_complete (MetaStartupNotificationSequence *seq)
{
MetaStartupNotificationSequenceX11 *seq_x11;
seq_x11 = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (seq);
sn_startup_sequence_complete (seq_x11->seq);
}
static void
meta_startup_notification_sequence_x11_finalize (GObject *object)
{
MetaStartupNotificationSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object);
sn_startup_sequence_unref (seq->seq);
G_OBJECT_CLASS (meta_startup_notification_sequence_x11_parent_class)->finalize (object);
}
static void
meta_startup_notification_sequence_x11_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaStartupNotificationSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object);
switch (prop_id)
{
case PROP_SEQ_X11_SEQ:
seq->seq = g_value_get_pointer (value);
sn_startup_sequence_ref (seq->seq);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_startup_notification_sequence_x11_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaStartupNotificationSequenceX11 *seq;
seq = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (object);
switch (prop_id)
{
case PROP_SEQ_X11_SEQ:
g_value_set_pointer (value, seq->seq);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_startup_notification_sequence_x11_init (MetaStartupNotificationSequenceX11 *seq)
{
}
static void
meta_startup_notification_sequence_x11_class_init (MetaStartupNotificationSequenceX11Class *klass)
{
MetaStartupNotificationSequenceClass *seq_class;
GObjectClass *object_class;
seq_class = META_STARTUP_NOTIFICATION_SEQUENCE_CLASS (klass);
seq_class->complete = meta_startup_notification_sequence_x11_complete;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_startup_notification_sequence_x11_finalize;
object_class->set_property = meta_startup_notification_sequence_x11_set_property;
object_class->get_property = meta_startup_notification_sequence_x11_get_property;
seq_x11_props[PROP_SEQ_X11_SEQ] =
g_param_spec_pointer ("seq",
"Sequence",
"Sequence",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_SEQ_X11_PROPS,
seq_x11_props);
}
static MetaStartupNotificationSequence *
meta_startup_notification_sequence_x11_new (SnStartupSequence *seq)
{
return g_object_new (META_TYPE_STARTUP_NOTIFICATION_SEQUENCE_X11,
"id", sn_startup_sequence_get_id (seq),
"timestamp", sn_startup_sequence_get_timestamp (seq) * 1000,
"seq", seq,
NULL);
}
static void
meta_startup_notification_add_sequence_internal (MetaStartupNotification *sn,
MetaStartupNotificationSequence *seq)
{
sn->startup_sequences = g_slist_prepend (sn->startup_sequences,
g_object_ref (seq));
meta_startup_notification_ensure_timeout (sn);
meta_startup_notification_update_feedback (sn);
}
static void
collect_timed_out_foreach (void *element,
void *data)
{
MetaStartupNotificationSequence *sequence = element;
CollectTimedOutData *ctod = data;
gint64 elapsed, timestamp;
timestamp = meta_startup_notification_sequence_get_timestamp (sequence);
elapsed = ctod->now - timestamp;
meta_topic (META_DEBUG_STARTUP,
"Sequence used %ld ms vs. %d max: %s\n",
elapsed, STARTUP_TIMEOUT,
meta_startup_notification_sequence_get_id (sequence));
if (elapsed > STARTUP_TIMEOUT)
ctod->list = g_slist_prepend (ctod->list, sequence);
}
static gboolean
startup_sequence_timeout (void *data)
{
MetaStartupNotification *sn = data;
CollectTimedOutData ctod;
GSList *l;
ctod.list = NULL;
ctod.now = g_get_monotonic_time ();
g_slist_foreach (sn->startup_sequences,
collect_timed_out_foreach,
&ctod);
for (l = ctod.list; l != NULL; l = l->next)
{
MetaStartupNotificationSequence *sequence = l->data;
meta_topic (META_DEBUG_STARTUP,
"Timed out sequence %s\n",
meta_startup_notification_sequence_get_id (sequence));
meta_startup_notification_sequence_complete (sequence);
}
g_slist_free (ctod.list);
if (sn->startup_sequences != NULL)
{
return TRUE;
}
else
{
/* remove */
sn->startup_sequence_timeout = 0;
return FALSE;
}
}
static void
meta_startup_notification_ensure_timeout (MetaStartupNotification *sn)
{
if (sn->startup_sequence_timeout != 0)
return;
/* our timeout just polls every second, instead of bothering
* to compute exactly when we may next time out
*/
sn->startup_sequence_timeout = g_timeout_add_seconds (1,
startup_sequence_timeout,
sn);
g_source_set_name_by_id (sn->startup_sequence_timeout,
"[mutter] startup_sequence_timeout");
}
#endif
static void
meta_startup_notification_remove_sequence_internal (MetaStartupNotification *sn,
MetaStartupNotificationSequence *seq)
{
sn->startup_sequences = g_slist_remove (sn->startup_sequences, seq);
meta_startup_notification_update_feedback (sn);
if (sn->startup_sequences == NULL &&
sn->startup_sequence_timeout != 0)
{
g_source_remove (sn->startup_sequence_timeout);
sn->startup_sequence_timeout = 0;
}
g_object_unref (seq);
}
static MetaStartupNotificationSequence *
meta_startup_notification_lookup_sequence (MetaStartupNotification *sn,
const gchar *id)
{
MetaStartupNotificationSequence *seq;
const gchar *seq_id;
GSList *l;
for (l = sn->startup_sequences; l; l = l->next)
{
seq = l->data;
seq_id = meta_startup_notification_sequence_get_id (seq);
if (g_str_equal (seq_id, id))
return l->data;
}
return NULL;
}
static void
meta_startup_notification_init (MetaStartupNotification *sn)
{
}
static void
meta_startup_notification_finalize (GObject *object)
{
MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object);
#ifdef HAVE_STARTUP_NOTIFICATION
sn_monitor_context_unref (sn->sn_context);
sn_display_unref (sn->sn_display);
#endif
if (sn->startup_sequence_timeout)
g_source_remove (sn->startup_sequence_timeout);
g_slist_foreach (sn->startup_sequences, (GFunc) g_object_unref, NULL);
g_slist_free (sn->startup_sequences);
sn->startup_sequences = NULL;
G_OBJECT_CLASS (meta_startup_notification_parent_class)->finalize (object);
}
static void
meta_startup_notification_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object);
switch (prop_id)
{
case PROP_SN_DISPLAY:
sn->display = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_startup_notification_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object);
switch (prop_id)
{
case PROP_SN_DISPLAY:
g_value_set_object (value, sn->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
#ifdef HAVE_STARTUP_NOTIFICATION
static void
sn_error_trap_push (SnDisplay *sn_display,
Display *xdisplay)
{
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_push (display);
}
static void
sn_error_trap_pop (SnDisplay *sn_display,
Display *xdisplay)
{
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_pop (display);
}
static void
meta_startup_notification_sn_event (SnMonitorEvent *event,
void *user_data)
{
MetaStartupNotification *sn = user_data;
MetaStartupNotificationSequence *seq;
SnStartupSequence *sequence;
sequence = sn_monitor_event_get_startup_sequence (event);
sn_startup_sequence_ref (sequence);
switch (sn_monitor_event_get_type (event))
{
case SN_MONITOR_EVENT_INITIATED:
{
const char *wmclass;
wmclass = sn_startup_sequence_get_wmclass (sequence);
meta_topic (META_DEBUG_STARTUP,
"Received startup initiated for %s wmclass %s\n",
sn_startup_sequence_get_id (sequence),
wmclass ? wmclass : "(unset)");
seq = meta_startup_notification_sequence_x11_new (sequence);
meta_startup_notification_add_sequence_internal (sn, seq);
g_object_unref (seq);
}
break;
case SN_MONITOR_EVENT_COMPLETED:
{
meta_topic (META_DEBUG_STARTUP,
"Received startup completed for %s\n",
sn_startup_sequence_get_id (sequence));
meta_startup_notification_remove_sequence (sn, sn_startup_sequence_get_id (sequence));
}
break;
case SN_MONITOR_EVENT_CHANGED:
meta_topic (META_DEBUG_STARTUP,
"Received startup changed for %s\n",
sn_startup_sequence_get_id (sequence));
break;
case SN_MONITOR_EVENT_CANCELED:
meta_topic (META_DEBUG_STARTUP,
"Received startup canceled for %s\n",
sn_startup_sequence_get_id (sequence));
break;
}
g_signal_emit (sn, sn_signals[SN_CHANGED], 0, sequence);
sn_startup_sequence_unref (sequence);
}
#endif
static void
meta_startup_notification_constructed (GObject *object)
{
MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object);
g_assert (sn->display != NULL);
#ifdef HAVE_STARTUP_NOTIFICATION
sn->sn_display = sn_display_new (sn->display->xdisplay,
sn_error_trap_push,
sn_error_trap_pop);
sn->sn_context =
sn_monitor_context_new (sn->sn_display,
sn->display->screen->number,
meta_startup_notification_sn_event,
sn,
NULL);
#endif
sn->startup_sequences = NULL;
sn->startup_sequence_timeout = 0;
}
static void
meta_startup_notification_class_init (MetaStartupNotificationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = meta_startup_notification_constructed;
object_class->finalize = meta_startup_notification_finalize;
object_class->set_property = meta_startup_notification_set_property;
object_class->get_property = meta_startup_notification_get_property;
sn_props[PROP_SN_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display",
META_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
sn_signals[SN_CHANGED] =
g_signal_new ("changed",
META_TYPE_STARTUP_NOTIFICATION,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_POINTER);
g_object_class_install_properties (object_class, N_SN_PROPS, sn_props);
}
MetaStartupNotification *
meta_startup_notification_get (MetaDisplay *display)
{
static MetaStartupNotification *notification = NULL;
if (!notification)
notification = g_object_new (META_TYPE_STARTUP_NOTIFICATION,
"display", display,
NULL);
return notification;
}
void
meta_startup_notification_remove_sequence (MetaStartupNotification *sn,
const gchar *id)
{
MetaStartupNotificationSequence *seq;
seq = meta_startup_notification_lookup_sequence (sn, id);
if (seq)
meta_startup_notification_remove_sequence_internal (sn, seq);
}
gboolean
meta_startup_notification_handle_xevent (MetaStartupNotification *sn,
XEvent *xevent)
{
#ifdef HAVE_STARTUP_NOTIFICATION
return sn_display_process_event (sn->sn_display, xevent);
#endif
return FALSE;
}
GSList *
meta_startup_notification_get_sequences (MetaStartupNotification *sn)
{
GSList *sequences = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION
GSList *l;
/* We return a list of SnStartupSequences here */
for (l = sn->startup_sequences; l; l = l->next)
{
MetaStartupNotificationSequenceX11 *seq_x11;
if (!META_IS_STARTUP_NOTIFICATION_SEQUENCE_X11 (l->data))
continue;
seq_x11 = META_STARTUP_NOTIFICATION_SEQUENCE_X11 (l->data);
sequences = g_slist_prepend (sequences, seq_x11->seq);
}
#endif
return sequences;
}

View File

@@ -30,7 +30,7 @@
#define NUM_RANDOM_RUNS 10000
static void
init_random_ness ()
init_random_ness (void)
{
srand(time(NULL));
}
@@ -99,7 +99,7 @@ new_monitor_edge (int x, int y, int width, int height, int side_type)
}
static void
test_area ()
test_area (void)
{
MetaRectangle temp;
int i;
@@ -116,7 +116,7 @@ test_area ()
}
static void
test_intersect ()
test_intersect (void)
{
MetaRectangle a = {100, 200, 50, 40};
MetaRectangle b = { 0, 50, 110, 152};
@@ -144,7 +144,7 @@ test_intersect ()
}
static void
test_equal ()
test_equal (void)
{
MetaRectangle a = {10, 12, 4, 18};
MetaRectangle b = a;
@@ -163,7 +163,7 @@ test_equal ()
}
static void
test_overlap_funcs ()
test_overlap_funcs (void)
{
MetaRectangle temp1, temp2;
int i;
@@ -186,7 +186,7 @@ test_overlap_funcs ()
}
static void
test_basic_fitting ()
test_basic_fitting (void)
{
MetaRectangle temp1, temp2, temp3;
int i;
@@ -357,7 +357,7 @@ get_monitor_edges (int which_monitor_set, int which_strut_set)
#if 0
static void
test_merge_regions ()
test_merge_regions (void)
{
/* logarithmically distributed random number of struts (range?)
* logarithmically distributed random size of struts (up to screen size???)
@@ -579,7 +579,7 @@ verify_lists_are_equal (GList *code, GList *answer)
}
static void
test_regions_okay ()
test_regions_okay (void)
{
GList* region;
GList* tmp;
@@ -665,7 +665,7 @@ test_regions_okay ()
}
static void
test_region_fitting ()
test_region_fitting (void)
{
GList* region;
MetaRectangle rect;
@@ -709,7 +709,7 @@ test_region_fitting ()
}
static void
test_clamping_to_region ()
test_clamping_to_region (void)
{
GList* region;
MetaRectangle rect;
@@ -826,7 +826,7 @@ rect_overlaps_region (const GList *spanning_rects,
gboolean time_to_print = FALSE;
static void
test_clipping_to_region ()
test_clipping_to_region (void)
{
GList* region;
MetaRectangle rect, temp;
@@ -888,7 +888,7 @@ test_clipping_to_region ()
}
static void
test_shoving_into_region ()
test_shoving_into_region (void)
{
GList* region;
MetaRectangle rect, temp;
@@ -1005,7 +1005,7 @@ verify_edge_lists_are_equal (GList *code, GList *answer)
}
static void
test_find_onscreen_edges ()
test_find_onscreen_edges (void)
{
GList* edges;
GList* tmp;
@@ -1138,7 +1138,7 @@ test_find_onscreen_edges ()
}
static void
test_find_nonintersected_monitor_edges ()
test_find_nonintersected_monitor_edges (void)
{
GList* edges;
GList* tmp;
@@ -1227,7 +1227,7 @@ test_find_nonintersected_monitor_edges ()
}
static void
test_gravity_resize ()
test_gravity_resize (void)
{
MetaRectangle oldrect, rect, temp;
@@ -1329,7 +1329,7 @@ test_gravity_resize ()
#define EPSILON 0.000000001
static void
test_find_closest_point_to_line ()
test_find_closest_point_to_line (void)
{
double x1, y1, x2, y2, px, py, rx, ry;
double answer_x, answer_y;
@@ -1381,7 +1381,7 @@ test_find_closest_point_to_line ()
}
int
main()
main(void)
{
init_random_ness ();
test_area ();

View File

@@ -46,9 +46,12 @@
static void
meta_topic_real_valist (MetaDebugTopic topic,
const char *format,
va_list args);
va_list args) G_GNUC_PRINTF(2, 0);
#endif
static gboolean
meta_later_remove_from_list (guint later_id, GSList **laters_list);
static gint verbose_topics = 0;
static gboolean is_debugging = FALSE;
static gboolean replace_current = FALSE;
@@ -739,7 +742,14 @@ typedef struct
gboolean run_once;
} MetaLater;
static GSList *laters = NULL;
static GSList *laters[] = {
NULL, /* META_LATER_RESIZE */
NULL, /* META_LATER_CALC_SHOWING */
NULL, /* META_LATER_CHECK_FULLSCREEN */
NULL, /* META_LATER_SYNC_STACK */
NULL, /* META_LATER_BEFORE_REDRAW */
NULL, /* META_LATER_IDLE */
};
/* This is a dummy timeline used to get the Clutter master clock running */
static ClutterTimeline *later_timeline;
static guint later_repaint_func = 0;
@@ -772,25 +782,14 @@ destroy_later (MetaLater *later)
unref_later (later);
}
/* Used to sort the list of laters with the highest priority
* functions first.
*/
static int
compare_laters (gconstpointer a,
gconstpointer b)
{
return ((const MetaLater *)a)->when - ((const MetaLater *)b)->when;
}
static gboolean
run_repaint_laters (gpointer data)
static void
run_repaint_laters (GSList **laters_list)
{
GSList *laters_copy;
GSList *l;
gboolean keep_timeline_running = FALSE;
laters_copy = NULL;
for (l = laters; l; l = l->next)
for (l = *laters_list; l; l = l->next)
{
MetaLater *later = l->data;
if (later->source == 0 ||
@@ -806,22 +805,41 @@ run_repaint_laters (gpointer data)
{
MetaLater *later = l->data;
if (later->func && later->func (later->data))
if (!later->func || !later->func (later->data))
meta_later_remove_from_list (later->id, laters_list);
unref_later (later);
}
g_slist_free (laters_copy);
}
static gboolean
run_all_repaint_laters (gpointer data)
{
guint i;
GSList *l;
gboolean keep_timeline_running = FALSE;
for (i = 0; i < G_N_ELEMENTS (laters); i++)
{
run_repaint_laters (&laters[i]);
}
for (i = 0; i < G_N_ELEMENTS (laters); i++)
{
for (l = laters[i]; l; l = l->next)
{
MetaLater *later = l->data;
if (later->source == 0)
keep_timeline_running = TRUE;
}
else
meta_later_remove (later->id);
unref_later (later);
}
if (!keep_timeline_running)
clutter_timeline_stop (later_timeline);
g_slist_free (laters_copy);
/* Just keep the repaint func around - it's cheap if the list is empty */
/* Just keep the repaint func around - it's cheap if the lists are empty */
return TRUE;
}
@@ -832,7 +850,7 @@ ensure_later_repaint_func (void)
later_timeline = clutter_timeline_new (G_MAXUINT);
if (later_repaint_func == 0)
later_repaint_func = clutter_threads_add_repaint_func (run_repaint_laters,
later_repaint_func = clutter_threads_add_repaint_func (run_all_repaint_laters,
NULL, NULL);
/* Make sure the repaint function gets run */
@@ -888,7 +906,7 @@ meta_later_add (MetaLaterType when,
later->data = data;
later->notify = notify;
laters = g_slist_insert_sorted (laters, later, compare_laters);
laters[when] = g_slist_prepend (laters[when], later);
switch (when)
{
@@ -920,6 +938,29 @@ meta_later_add (MetaLaterType when,
return later->id;
}
static gboolean
meta_later_remove_from_list (guint later_id, GSList **laters_list)
{
GSList *l;
for (l = *laters_list; l; l = l->next)
{
MetaLater *later = l->data;
if (later->id == later_id)
{
*laters_list = g_slist_delete_link (*laters_list, l);
/* If this was a "repaint func" later, we just let the
* repaint func run and get removed
*/
destroy_later (later);
return TRUE;
}
}
return FALSE;
}
/**
* meta_later_remove:
* @later_id: the integer ID returned from meta_later_add()
@@ -929,20 +970,12 @@ meta_later_add (MetaLaterType when,
void
meta_later_remove (guint later_id)
{
GSList *l;
guint i;
for (l = laters; l; l = l->next)
for (i = 0; i < G_N_ELEMENTS (laters); i++)
{
MetaLater *later = l->data;
if (later->id == later_id)
{
laters = g_slist_delete_link (laters, l);
/* If this was a "repaint func" later, we just let the
* repaint func run and get removed
*/
destroy_later (later);
return;
}
if (meta_later_remove_from_list (later_id, &laters[i]))
return;
}
}

View File

@@ -763,10 +763,22 @@ meta_window_update_desc (MetaWindow *window)
{
g_clear_pointer (&window->desc, g_free);
if (window->title)
window->desc = g_strdup_printf ("0x%lx (%.10s)", window->xwindow, window->title);
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
if (window->title)
window->desc = g_strdup_printf ("0x%lx (%.10s)", window->xwindow, window->title);
else
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
}
else
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
{
guint64 small_stamp = window->stamp - G_GUINT64_CONSTANT(0x100000000);
if (window->title)
window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT " (%.10s)", small_stamp, window->title);
else
window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT , small_stamp);
}
}
static void
@@ -1567,8 +1579,10 @@ implement_showing (MetaWindow *window,
* windows we might want to know where they are on the screen,
* so we should place the window even if we're hiding it rather
* than showing it.
* Force placing windows only when they should be already mapped,
* see #751887
*/
if (!window->placed)
if (!window->placed && client_window_should_be_mapped (window))
meta_window_force_placement (window);
meta_window_hide (window);
@@ -3183,12 +3197,23 @@ meta_window_make_fullscreen (MetaWindow *window)
if (!window->fullscreen)
{
meta_window_make_fullscreen_internal (window);
MetaRectangle old_frame_rect, old_buffer_rect;
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
meta_window_make_fullscreen_internal (window);
meta_window_move_resize_internal (window,
META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION | META_MOVE_RESIZE_STATE_CHANGED,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
NorthWestGravity,
window->unconstrained_rect);
meta_compositor_size_change_window (window->display->compositor,
window, META_SIZE_CHANGE_FULLSCREEN,
&old_frame_rect, &old_buffer_rect);
}
}
@@ -3199,7 +3224,7 @@ meta_window_unmake_fullscreen (MetaWindow *window)
if (window->fullscreen)
{
MetaRectangle target_rect;
MetaRectangle old_frame_rect, old_buffer_rect, target_rect;
meta_topic (META_DEBUG_WINDOW_OPS,
"Unfullscreening %s\n", window->desc);
@@ -3208,6 +3233,8 @@ meta_window_unmake_fullscreen (MetaWindow *window)
target_rect = window->saved_rect;
meta_window_frame_size_changed (window);
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
/* Window's size hints may have changed while maximized, making
* saved_rect invalid. #329152
@@ -3222,10 +3249,17 @@ meta_window_unmake_fullscreen (MetaWindow *window)
set_net_wm_state (window);
meta_window_move_resize_internal (window,
META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION | META_MOVE_RESIZE_STATE_CHANGED,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
NorthWestGravity,
target_rect);
meta_compositor_size_change_window (window->display->compositor,
window, META_SIZE_CHANGE_UNFULLSCREEN,
&old_frame_rect, &old_buffer_rect);
meta_window_update_layer (window);
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_FULLSCREEN]);
@@ -3502,10 +3536,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
{
const MetaMonitorInfo *old, *new;
if (window->type == META_WINDOW_DESKTOP)
return;
if (window->override_redirect)
if (window->override_redirect || window->type == META_WINDOW_DESKTOP)
{
meta_window_update_monitor (window, FALSE);
return;
@@ -4312,8 +4343,8 @@ set_workspace_state (MetaWindow *window,
GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next)
{
MetaWorkspace *workspace = l->data;
meta_workspace_remove_window (workspace, window);
MetaWorkspace *ws = l->data;
meta_workspace_remove_window (ws, window);
}
}
@@ -4327,8 +4358,8 @@ set_workspace_state (MetaWindow *window,
GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next)
{
MetaWorkspace *workspace = l->data;
meta_workspace_add_window (workspace, window);
MetaWorkspace *ws = l->data;
meta_workspace_add_window (ws, window);
}
}
@@ -5271,6 +5302,11 @@ meta_window_recalc_features (MetaWindow *window)
meta_window_recalc_skip_features (window);
/* To prevent users from losing windows, let's prevent users from
* minimizing skip-taskbar windows through the window decorations. */
if (window->skip_taskbar)
window->has_minimize_func = FALSE;
meta_topic (META_DEBUG_WINDOW_OPS,
"Window %s decorated = %d border_only = %d has_close = %d has_minimize = %d has_maximize = %d has_move = %d has_shade = %d skip_taskbar = %d skip_pager = %d\n",
window->desc,
@@ -6272,7 +6308,7 @@ find_ancestor_func (MetaWindow *window,
* so by traversing the @transient's ancestors until it either locates @window
* or reaches an ancestor that is not transient.
*
* Return Value: (transfer none): %TRUE if window is an ancestor of transient.
* Return Value: %TRUE if window is an ancestor of transient.
*/
gboolean
meta_window_is_ancestor_of_transient (MetaWindow *window,
@@ -7010,7 +7046,7 @@ meta_window_get_transient_for (MetaWindow *window)
* Returns pid of the process that created this window, if known (obtained from
* the _NET_WM_PID property).
*
* Return value: (transfer none): the pid, or -1 if not known.
* Return value: the pid, or -1 if not known.
*/
int
meta_window_get_pid (MetaWindow *window)
@@ -7352,10 +7388,31 @@ meta_window_set_gtk_dbus_properties (MetaWindow *window,
g_object_thaw_notify (G_OBJECT (window));
}
static gboolean
check_transient_for_loop (MetaWindow *window,
MetaWindow *parent)
{
while (parent)
{
if (parent->transient_for == window)
return TRUE;
parent = parent->transient_for;
}
return FALSE;
}
void
meta_window_set_transient_for (MetaWindow *window,
MetaWindow *parent)
{
if (check_transient_for_loop (window, parent))
{
meta_warning ("Setting %s transient for %s would create a loop.\n",
window->desc, parent->desc);
return;
}
if (meta_window_appears_focused (window) && window->transient_for != NULL)
meta_window_propagate_focus_appearance (window, FALSE);
@@ -7381,14 +7438,14 @@ meta_window_set_transient_for (MetaWindow *window,
}
}
/* update stacking constraints */
if (!window->override_redirect)
meta_stack_update_transient (window->screen->stack, window);
/* We know this won't create a reference cycle because we check for loops */
g_clear_object (&window->transient_for);
window->transient_for = parent ? g_object_ref (parent) : NULL;
/* update stacking constraints */
if (!window->override_redirect)
meta_stack_update_transient (window->screen->stack, window);
/* possibly change its group. We treat being a window's transient as
* equivalent to making it your group leader, to work around shortcomings
* in programs such as xmms-- see #328211.
@@ -7399,7 +7456,7 @@ meta_window_set_transient_for (MetaWindow *window,
meta_window_group_leader_changed (window);
if (!window->constructing && !window->override_redirect)
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
meta_window_queue (window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING);
if (meta_window_appears_focused (window) && window->transient_for != NULL)
meta_window_propagate_focus_appearance (window, TRUE);
@@ -7638,13 +7695,29 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
MetaDisplay *display = window->display;
gboolean unmodified;
gboolean is_window_grab;
ClutterModifierType grab_mods, event_mods;
gfloat x, y;
guint button;
if (window->frame && meta_ui_frame_handle_event (window->frame->ui_frame, event))
return;
if (event->type != CLUTTER_BUTTON_PRESS)
if (event->type != CLUTTER_BUTTON_PRESS &&
event->type != CLUTTER_TOUCH_BEGIN)
return;
if (event->type == CLUTTER_TOUCH_BEGIN)
{
ClutterEventSequence *sequence;
button = 1;
sequence = clutter_event_get_event_sequence (event);
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
return;
}
else
button = clutter_event_get_button (event);
if (display->grab_op != META_GRAB_OP_NONE)
return;
@@ -7655,6 +7728,22 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
if (window->override_redirect)
return;
/* Don't focus panels--they must explicitly request focus.
* See bug 160470
*/
if (window->type != META_WINDOW_DOCK)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing %s due to button %u press (display.c)\n",
window->desc, button);
meta_window_focus (window, event->any.time);
}
else
/* However, do allow terminals to lose focus due to new
* window mappings after the user clicks on a panel.
*/
display->allow_terminal_deactivation = TRUE;
/* We have three passive button grabs:
* - on any button, without modifiers => focuses and maybe raises the window
* - on resize button, with modifiers => start an interactive resizing
@@ -7675,9 +7764,12 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
* care about. Just let the event through.
*/
ClutterModifierType grab_mods = meta_display_get_window_grab_modifiers (display);
unmodified = (event->button.modifier_state & grab_mods) == 0;
is_window_grab = (event->button.modifier_state & grab_mods) == grab_mods;
grab_mods = meta_display_get_window_grab_modifiers (display);
event_mods = clutter_event_get_state (event);
unmodified = (event_mods & grab_mods) == 0;
is_window_grab = (event_mods & grab_mods) == grab_mods;
clutter_event_get_coords (event, &x, &y);
if (unmodified)
{
@@ -7686,27 +7778,8 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
else
meta_topic (META_DEBUG_FOCUS,
"Not raising window on click due to don't-raise-on-click option\n");
/* Don't focus panels--they must explicitly request focus.
* See bug 160470
*/
if (window->type != META_WINDOW_DOCK)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing %s due to unmodified button %u press (display.c)\n",
window->desc, event->button.button);
meta_window_focus (window, event->any.time);
}
else
/* However, do allow terminals to lose focus due to new
* window mappings after the user clicks on a panel.
*/
display->allow_terminal_deactivation = TRUE;
meta_verbose ("Allowing events time %u\n",
(unsigned int)event->button.time);
}
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_resize ())
else if (is_window_grab && (int) button == meta_prefs_get_mouse_button_resize ())
{
if (window->has_resize_func)
{
@@ -7717,10 +7790,10 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
meta_window_get_frame_rect (window, &frame_rect);
west = event->button.x < (frame_rect.x + 1 * frame_rect.width / 3);
east = event->button.x > (frame_rect.x + 2 * frame_rect.width / 3);
north = event->button.y < (frame_rect.y + 1 * frame_rect.height / 3);
south = event->button.y > (frame_rect.y + 2 * frame_rect.height / 3);
west = x < (frame_rect.x + 1 * frame_rect.width / 3);
east = x > (frame_rect.x + 2 * frame_rect.width / 3);
north = y < (frame_rect.y + 1 * frame_rect.height / 3);
south = y > (frame_rect.y + 2 * frame_rect.height / 3);
if (west)
op |= META_GRAB_OP_WINDOW_DIR_WEST;
@@ -7738,23 +7811,21 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
op,
TRUE,
FALSE,
event->button.button,
button,
0,
event->any.time,
event->button.x,
event->button.y);
x, y);
}
}
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_menu ())
else if (is_window_grab && (int) button == meta_prefs_get_mouse_button_menu ())
{
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
meta_window_show_menu (window,
META_WINDOW_MENU_WM,
event->button.x,
event->button.y);
x, y);
}
else if (is_window_grab && (int) event->button.button == 1)
else if (is_window_grab && (int) button == 1)
{
if (window->has_move_func)
{
@@ -7764,11 +7835,10 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
META_GRAB_OP_MOVING,
TRUE,
FALSE,
event->button.button,
button,
0,
event->any.time,
event->button.x,
event->button.y);
x, y);
}
}
}

View File

@@ -1055,7 +1055,7 @@ meta_workspace_get_onmonitor_region (MetaWorkspace *workspace,
}
#ifdef WITH_VERBOSE_MODE
static char *
static const char *
meta_motion_direction_to_string (MetaMotionDirection direction)
{
switch (direction)

View File

@@ -372,12 +372,6 @@ typedef enum
* @META_BUTTON_FUNCTION_MINIMIZE: Minimize
* @META_BUTTON_FUNCTION_MAXIMIZE: Maximize
* @META_BUTTON_FUNCTION_CLOSE: Close
* @META_BUTTON_FUNCTION_SHADE: Shade
* @META_BUTTON_FUNCTION_ABOVE: Above
* @META_BUTTON_FUNCTION_STICK: Stick
* @META_BUTTON_FUNCTION_UNSHADE: Unshade
* @META_BUTTON_FUNCTION_UNABOVE: Unabove
* @META_BUTTON_FUNCTION_UNSTICK: Unstick
* @META_BUTTON_FUNCTION_LAST: Marks the end of the #MetaButtonFunction enumeration
*
* Function a window button can have. Note, you can't add stuff here
@@ -390,12 +384,6 @@ typedef enum
META_BUTTON_FUNCTION_MINIMIZE,
META_BUTTON_FUNCTION_MAXIMIZE,
META_BUTTON_FUNCTION_CLOSE,
META_BUTTON_FUNCTION_SHADE,
META_BUTTON_FUNCTION_ABOVE,
META_BUTTON_FUNCTION_STICK,
META_BUTTON_FUNCTION_UNSHADE,
META_BUTTON_FUNCTION_UNABOVE,
META_BUTTON_FUNCTION_UNSTICK,
META_BUTTON_FUNCTION_APPMENU,
META_BUTTON_FUNCTION_LAST
} MetaButtonFunction;
@@ -405,10 +393,10 @@ typedef enum
/* Keep array size in sync with MAX_BUTTONS_PER_CORNER */
/**
* MetaButtonLayout:
* @left_buttons: (array fixed-size=11):
* @right_buttons: (array fixed-size=11):
* @left_buttons_has_spacer: (array fixed-size=11):
* @right_buttons_has_spacer: (array fixed-size=11):
* @left_buttons: (array fixed-size=5):
* @right_buttons: (array fixed-size=5):
* @left_buttons_has_spacer: (array fixed-size=5):
* @right_buttons_has_spacer: (array fixed-size=5):
*/
typedef struct _MetaButtonLayout MetaButtonLayout;
struct _MetaButtonLayout

View File

@@ -57,6 +57,8 @@ typedef enum
typedef enum {
META_SIZE_CHANGE_MAXIMIZE,
META_SIZE_CHANGE_UNMAXIMIZE,
META_SIZE_CHANGE_FULLSCREEN,
META_SIZE_CHANGE_UNFULLSCREEN,
} MetaSizeChange;
MetaCompositor *meta_compositor_new (MetaDisplay *display);

View File

@@ -49,7 +49,7 @@ typedef enum
} MetaExitCode;
/* exit immediately */
void meta_exit (MetaExitCode code);
void meta_exit (MetaExitCode code) G_GNUC_NORETURN;
/* g_main_loop_quit() then fall out of main() */
void meta_quit (MetaExitCode code);

View File

@@ -9,6 +9,8 @@
<method name="TakeControl">
<arg name="force" type="b"/>
</method>
<method name="ReleaseControl">
</method>
<method name="TakeDevice">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
<arg name="major" type="u" direction="in"/>

View File

@@ -0,0 +1,14 @@
new_client 1 wayland
create 1/1
show 1/1
create 1/2
show 1/2
wait
assert_stacking 1/1 1/2
set_parent 1/1 2
wait
assert_stacking 1/2 1/1
local_activate 1/2
assert_stacking 1/2 1/1

View File

@@ -25,7 +25,7 @@
#include <string.h>
#include <X11/extensions/sync.h>
char *client_id = "0";
const char *client_id = "0";
static gboolean wayland;
GHashTable *windows;
@@ -41,6 +41,16 @@ lookup_window (const char *window_id)
return window;
}
static void
on_after_paint (GdkFrameClock *clock,
GMainLoop *loop)
{
g_signal_handlers_disconnect_by_func (clock,
(gpointer) on_after_paint,
loop);
g_main_loop_quit (loop);
}
static void
process_line (const char *line)
{
@@ -126,6 +136,31 @@ process_line (const char *line)
}
}
else if (strcmp (argv[0], "set_parent") == 0)
{
if (argc != 3)
{
g_print ("usage: menu <window-id> <parent-id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
{
g_print ("unknown window %s", argv[1]);
goto out;
}
GtkWidget *parent_window = lookup_window (argv[2]);
if (!parent_window)
{
g_print ("unknown parent window %s", argv[2]);
goto out;
}
gtk_window_set_transient_for (GTK_WINDOW (window),
GTK_WINDOW (parent_window));
}
else if (strcmp (argv[0], "show") == 0)
{
if (argc != 2)
@@ -135,10 +170,25 @@ process_line (const char *line)
}
GtkWidget *window = lookup_window (argv[1]);
GdkWindow *gdk_window = gtk_widget_get_window (window);
if (!window)
goto out;
gtk_widget_show (window);
/* When a Wayland client, we cannot be really sure that the window has
* been mappable until after we have painted. So, in order to have the
* test runner rely on the "show" command to have done what the client
* needs to do in order for a window to be mappable compositor side, lets
* wait with returning until after the first frame.
*/
GdkFrameClock *frame_clock = gdk_window_get_frame_clock (gdk_window);
GMainLoop *loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (frame_clock, "after-paint",
G_CALLBACK (on_after_paint),
loop);
g_main_loop_run (loop);
g_main_loop_unref (loop);
}
else if (strcmp (argv[0], "hide") == 0)
{

View File

@@ -767,6 +767,23 @@ test_case_do (TestCase *test,
NULL))
return FALSE;
}
else if (strcmp (argv[0], "set_parent") == 0)
{
if (argc != 3)
BAD_COMMAND("usage: %s <client-id>/<window-id> <parent-window-id>",
argv[0]);
TestClient *client;
const char *window_id;
if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
return FALSE;
if (!test_client_do (client, error,
"set_parent", window_id,
argv[2],
NULL))
return FALSE;
}
else if (strcmp (argv[0], "show") == 0 ||
strcmp (argv[0], "hide") == 0 ||
strcmp (argv[0], "activate") == 0 ||
@@ -1094,7 +1111,6 @@ main (int argc, char **argv)
if (all_tests)
{
GFile *test_dir = g_file_new_for_path (MUTTER_PKGDATADIR "/tests");
GError *error = NULL;
if (!find_metatests_in_directory (test_dir, tests, &error))
{
@@ -1120,7 +1136,7 @@ main (int argc, char **argv)
/* Then initalize mutter with a different set of arguments */
char *fake_args[] = { NULL, "--wayland" };
char *fake_args[] = { NULL, (char *)"--wayland" };
fake_args[0] = argv[0];
char **fake_argv = fake_args;
int fake_argc = 2;

238
src/tests/unit-tests.c Normal file
View File

@@ -0,0 +1,238 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include <stdlib.h>
#include <meta/main.h>
#include <meta/util.h>
#include "compositor/meta-plugin-manager.h"
typedef struct _MetaTestLaterOrderCallbackData
{
GMainLoop *loop; /* Loop to terminate when done. */
int callback_num; /* Callback number integer. */
int *expected_callback_num; /* Pointer to the expected callback number. */
} MetaTestLaterOrderCallbackData;
static gboolean
test_later_order_callback (gpointer user_data)
{
MetaTestLaterOrderCallbackData *data = user_data;
g_assert_cmpint (data->callback_num, ==, *data->expected_callback_num);
if (*data->expected_callback_num == 0)
g_main_loop_quit (data->loop);
else
(*data->expected_callback_num)--;
return FALSE;
}
static void
meta_test_util_later_order (void)
{
GMainLoop *loop;
int expected_callback_num;
int i;
const int num_callbacks = 3;
MetaTestLaterOrderCallbackData callback_data[num_callbacks];
loop = g_main_loop_new (NULL, FALSE);
/* Schedule three BEFORE_DRAW callbacks each with its own number associated
* with it.
*/
for (i = 0; i < num_callbacks; i++)
{
callback_data[i] = (MetaTestLaterOrderCallbackData) {
.loop = loop,
.callback_num = i,
.expected_callback_num = &expected_callback_num,
};
meta_later_add (META_LATER_BEFORE_REDRAW,
test_later_order_callback,
&callback_data[i],
NULL);
}
/* Check that the callbacks are invoked in the opposite order that they were
* scheduled. Each callback will decrease the number by 1 after it checks the
* validity.
*/
expected_callback_num = num_callbacks - 1;
g_main_loop_run (loop);
g_assert_cmpint (expected_callback_num, ==, 0);
g_main_loop_unref (loop);
}
typedef enum _MetaTestLaterScheduleFromLaterState
{
META_TEST_LATER_EXPECT_CALC_SHOWING,
META_TEST_LATER_EXPECT_SYNC_STACK,
META_TEST_LATER_EXPECT_BEFORE_REDRAW,
META_TEST_LATER_FINISHED,
} MetaTestLaterScheduleFromLaterState;
typedef struct _MetaTestLaterScheduleFromLaterData
{
GMainLoop *loop;
MetaTestLaterScheduleFromLaterState state;
} MetaTestLaterScheduleFromLaterData;
static gboolean
test_later_schedule_from_later_sync_stack_callback (gpointer user_data);
static gboolean
test_later_schedule_from_later_calc_showing_callback (gpointer user_data)
{
MetaTestLaterScheduleFromLaterData *data = user_data;
g_assert_cmpint (data->state, ==, META_TEST_LATER_EXPECT_CALC_SHOWING);
meta_later_add (META_LATER_SYNC_STACK,
test_later_schedule_from_later_sync_stack_callback,
data,
NULL);
data->state = META_TEST_LATER_EXPECT_SYNC_STACK;
return FALSE;
}
static gboolean
test_later_schedule_from_later_sync_stack_callback (gpointer user_data)
{
MetaTestLaterScheduleFromLaterData *data = user_data;
g_assert_cmpint (data->state, ==, META_TEST_LATER_EXPECT_SYNC_STACK);
data->state = META_TEST_LATER_EXPECT_BEFORE_REDRAW;
return FALSE;
}
static gboolean
test_later_schedule_from_later_before_redraw_callback (gpointer user_data)
{
MetaTestLaterScheduleFromLaterData *data = user_data;
g_assert_cmpint (data->state, ==, META_TEST_LATER_EXPECT_BEFORE_REDRAW);
data->state = META_TEST_LATER_FINISHED;
g_main_loop_quit (data->loop);
return FALSE;
}
static void
meta_test_util_later_schedule_from_later (void)
{
MetaTestLaterScheduleFromLaterData data;
data.loop = g_main_loop_new (NULL, FALSE);
/* Test that scheduling a MetaLater with 'when' being later than the one being
* invoked causes it to be invoked before any callback with a later 'when'
* value being invoked.
*
* The first and last callback is queued here. The one to be invoked in
* between is invoked in test_later_schedule_from_later_calc_showing_callback.
*/
meta_later_add (META_LATER_CALC_SHOWING,
test_later_schedule_from_later_calc_showing_callback,
&data,
NULL);
meta_later_add (META_LATER_BEFORE_REDRAW,
test_later_schedule_from_later_before_redraw_callback,
&data,
NULL);
data.state = META_TEST_LATER_EXPECT_CALC_SHOWING;
g_main_loop_run (data.loop);
g_main_loop_unref (data.loop);
g_assert_cmpint (data.state, ==, META_TEST_LATER_FINISHED);
}
static gboolean
run_tests (gpointer data)
{
gboolean ret;
ret = g_test_run ();
meta_quit (ret != 0);
return FALSE;
}
static void
init_tests (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");
g_test_add_func ("/util/meta-later/order", meta_test_util_later_order);
g_test_add_func ("/util/meta-later/schedule-from-later",
meta_test_util_later_schedule_from_later);
}
int
main (int argc, char *argv[])
{
GOptionContext *ctx;
GError *error = NULL;
ctx = g_option_context_new (NULL);
if (!g_option_context_parse (ctx,
&argc, &argv, &error))
{
g_printerr ("%s", error->message);
return 1;
}
g_option_context_free (ctx);
char *fake_args[] = { NULL, "--wayland" };
fake_args[0] = argv[0];
char **fake_argv = fake_args;
int fake_argc = 2;
ctx = meta_get_option_context ();
if (!g_option_context_parse (ctx, &fake_argc, &fake_argv, &error))
{
g_printerr ("mutter: %s\n", error->message);
exit (1);
}
g_option_context_free (ctx);
meta_plugin_manager_load ("default");
meta_init ();
meta_register_with_session ();
init_tests (argc, argv);
g_idle_add (run_tests, NULL);
return meta_run ();
}

View File

@@ -447,7 +447,7 @@ meta_frames_new (int screen_number)
}
static const char *
get_theme_variant_override (MetaFrames *frames)
get_global_theme_variant (MetaFrames *frames)
{
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (frames));
GtkSettings *settings = gtk_settings_get_for_screen (screen);
@@ -474,19 +474,15 @@ meta_ui_frame_attach_style (MetaUIFrame *frame)
{
MetaFrames *frames = frame->frames;
const char *variant;
const char *variant_override;
if (frame->style_info != NULL)
meta_style_info_unref (frame->style_info);
variant_override = get_theme_variant_override (frame->frames);
variant = frame->meta_window->gtk_theme_variant;
if (variant == NULL)
variant = get_global_theme_variant (frame->frames);;
if (variant_override)
variant = variant_override;
else
variant = frame->meta_window->gtk_theme_variant;
if (variant == NULL || strcmp(variant, "normal") == 0)
if (variant == NULL || *variant == '\0')
frame->style_info = meta_style_info_ref (frames->normal_style);
else
frame->style_info = meta_style_info_ref (meta_frames_get_theme_variant (frames,
@@ -970,12 +966,6 @@ meta_frame_left_click_event (MetaUIFrame *frame,
case META_FRAME_CONTROL_UNMAXIMIZE:
case META_FRAME_CONTROL_MINIMIZE:
case META_FRAME_CONTROL_DELETE:
case META_FRAME_CONTROL_SHADE:
case META_FRAME_CONTROL_UNSHADE:
case META_FRAME_CONTROL_ABOVE:
case META_FRAME_CONTROL_UNABOVE:
case META_FRAME_CONTROL_STICK:
case META_FRAME_CONTROL_UNSTICK:
case META_FRAME_CONTROL_MENU:
case META_FRAME_CONTROL_APPMENU:
frame->grab_button = event->button;
@@ -1074,7 +1064,10 @@ handle_button_press_event (MetaUIFrame *frame,
control = get_control (frame, event->x, event->y);
/* focus on click, even if click was on client area */
/* don't do the rest of this if on client area */
if (control == META_FRAME_CONTROL_CLIENT_AREA)
return FALSE; /* not on the frame, just passed through from client */
if (event->button == 1 &&
!(control == META_FRAME_CONTROL_MINIMIZE ||
control == META_FRAME_CONTROL_DELETE ||
@@ -1086,10 +1079,6 @@ handle_button_press_event (MetaUIFrame *frame,
meta_window_focus (frame->meta_window, event->time);
}
/* don't do the rest of this if on client area */
if (control == META_FRAME_CONTROL_CLIENT_AREA)
return FALSE; /* not on the frame, just passed through from client */
/* We want to shade even if we have a GrabOp, since we'll have a move grab
* if we double click the titlebar.
*/
@@ -1154,24 +1143,6 @@ handle_button_release_event (MetaUIFrame *frame,
case META_FRAME_CONTROL_DELETE:
meta_window_delete (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_SHADE:
meta_window_shade (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_UNSHADE:
meta_window_unshade (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_ABOVE:
meta_window_make_above (frame->meta_window);
break;
case META_FRAME_CONTROL_UNABOVE:
meta_window_unmake_above (frame->meta_window);
break;
case META_FRAME_CONTROL_STICK:
meta_window_stick (frame->meta_window);
break;
case META_FRAME_CONTROL_UNSTICK:
meta_window_unstick (frame->meta_window);
break;
default:
break;
}
@@ -1220,18 +1191,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
break;
case META_FRAME_CONTROL_UNMAXIMIZE:
break;
case META_FRAME_CONTROL_SHADE:
break;
case META_FRAME_CONTROL_UNSHADE:
break;
case META_FRAME_CONTROL_ABOVE:
break;
case META_FRAME_CONTROL_UNABOVE:
break;
case META_FRAME_CONTROL_STICK:
break;
case META_FRAME_CONTROL_UNSTICK:
break;
case META_FRAME_CONTROL_RESIZE_SE:
cursor = META_CURSOR_SE_RESIZE;
break;
@@ -1270,12 +1229,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
case META_FRAME_CONTROL_MINIMIZE:
case META_FRAME_CONTROL_MAXIMIZE:
case META_FRAME_CONTROL_DELETE:
case META_FRAME_CONTROL_SHADE:
case META_FRAME_CONTROL_UNSHADE:
case META_FRAME_CONTROL_ABOVE:
case META_FRAME_CONTROL_UNABOVE:
case META_FRAME_CONTROL_STICK:
case META_FRAME_CONTROL_UNSTICK:
case META_FRAME_CONTROL_UNMAXIMIZE:
/* leave control set */
break;
@@ -1409,6 +1362,10 @@ meta_ui_frame_get_mask (MetaUIFrame *frame,
borders.invisible.left / scale,
borders.invisible.top / scale,
frame_rect.width / scale, frame_rect.height / scale);
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_TITLEBAR], cr,
borders.invisible.left / scale,
borders.invisible.top / scale,
frame_rect.width / scale, borders.total.top / scale);
}
/* XXX -- this is disgusting. Find a better approach here.
@@ -1487,24 +1444,6 @@ meta_ui_frame_paint (MetaUIFrame *frame,
case META_FRAME_CONTROL_UNMAXIMIZE:
button_type = META_BUTTON_TYPE_MAXIMIZE;
break;
case META_FRAME_CONTROL_SHADE:
button_type = META_BUTTON_TYPE_SHADE;
break;
case META_FRAME_CONTROL_UNSHADE:
button_type = META_BUTTON_TYPE_UNSHADE;
break;
case META_FRAME_CONTROL_ABOVE:
button_type = META_BUTTON_TYPE_ABOVE;
break;
case META_FRAME_CONTROL_UNABOVE:
button_type = META_BUTTON_TYPE_UNABOVE;
break;
case META_FRAME_CONTROL_STICK:
button_type = META_BUTTON_TYPE_STICK;
break;
case META_FRAME_CONTROL_UNSTICK:
button_type = META_BUTTON_TYPE_UNSTICK;
break;
case META_FRAME_CONTROL_DELETE:
button_type = META_BUTTON_TYPE_CLOSE;
break;
@@ -1624,24 +1563,6 @@ control_rect (MetaFrameControl control,
case META_FRAME_CONTROL_UNMAXIMIZE:
rect = &fgeom->max_rect.visible;
break;
case META_FRAME_CONTROL_SHADE:
rect = &fgeom->shade_rect.visible;
break;
case META_FRAME_CONTROL_UNSHADE:
rect = &fgeom->unshade_rect.visible;
break;
case META_FRAME_CONTROL_ABOVE:
rect = &fgeom->above_rect.visible;
break;
case META_FRAME_CONTROL_UNABOVE:
rect = &fgeom->unabove_rect.visible;
break;
case META_FRAME_CONTROL_STICK:
rect = &fgeom->stick_rect.visible;
break;
case META_FRAME_CONTROL_UNSTICK:
rect = &fgeom->unstick_rect.visible;
break;
case META_FRAME_CONTROL_RESIZE_SE:
break;
case META_FRAME_CONTROL_RESIZE_S:
@@ -1726,36 +1647,6 @@ get_control (MetaUIFrame *frame, int root_x, int root_y)
return META_FRAME_CONTROL_MAXIMIZE;
}
if (POINT_IN_RECT (x, y, fgeom.shade_rect.clickable))
{
return META_FRAME_CONTROL_SHADE;
}
if (POINT_IN_RECT (x, y, fgeom.unshade_rect.clickable))
{
return META_FRAME_CONTROL_UNSHADE;
}
if (POINT_IN_RECT (x, y, fgeom.above_rect.clickable))
{
return META_FRAME_CONTROL_ABOVE;
}
if (POINT_IN_RECT (x, y, fgeom.unabove_rect.clickable))
{
return META_FRAME_CONTROL_UNABOVE;
}
if (POINT_IN_RECT (x, y, fgeom.stick_rect.clickable))
{
return META_FRAME_CONTROL_STICK;
}
if (POINT_IN_RECT (x, y, fgeom.unstick_rect.clickable))
{
return META_FRAME_CONTROL_UNSTICK;
}
/* South resize always has priority over north resize,
* in case of overlap.
*/

View File

@@ -39,12 +39,6 @@ typedef enum
META_FRAME_CONTROL_MINIMIZE,
META_FRAME_CONTROL_MAXIMIZE,
META_FRAME_CONTROL_UNMAXIMIZE,
META_FRAME_CONTROL_SHADE,
META_FRAME_CONTROL_UNSHADE,
META_FRAME_CONTROL_ABOVE,
META_FRAME_CONTROL_UNABOVE,
META_FRAME_CONTROL_STICK,
META_FRAME_CONTROL_UNSTICK,
META_FRAME_CONTROL_RESIZE_SE,
META_FRAME_CONTROL_RESIZE_S,
META_FRAME_CONTROL_RESIZE_SW,

View File

@@ -53,6 +53,8 @@ typedef struct _MetaFrameGeometry MetaFrameGeometry;
**/
struct _MetaFrameLayout
{
/** Invisible border required by the theme */
GtkBorder invisible_border;
/** Border/padding of the entire frame */
GtkBorder frame_border;
/** Border/padding of the titlebar region */
@@ -60,6 +62,16 @@ struct _MetaFrameLayout
/** Border/padding of titlebar buttons */
GtkBorder button_border;
/** Margin of title */
GtkBorder title_margin;
/** Margin of titlebar buttons */
GtkBorder button_margin;
/** Min size of titlebar region */
GtkRequisition titlebar_min_size;
/** Min size of titlebar buttons */
GtkRequisition button_min_size;
/** Size of images in buttons */
guint icon_size;
@@ -115,7 +127,7 @@ struct _MetaFrameGeometry
/* used for a memset hack */
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, unstick_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, appmenu_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
/* The button rects (if changed adjust memset hack) */
MetaButtonSpace close_rect;
@@ -123,12 +135,6 @@ struct _MetaFrameGeometry
MetaButtonSpace min_rect;
MetaButtonSpace menu_rect;
MetaButtonSpace appmenu_rect;
MetaButtonSpace shade_rect;
MetaButtonSpace above_rect;
MetaButtonSpace stick_rect;
MetaButtonSpace unshade_rect;
MetaButtonSpace unabove_rect;
MetaButtonSpace unstick_rect;
/* End of button rects (if changed adjust memset hack) */
/* Saved button layout */
@@ -158,17 +164,12 @@ typedef enum
META_BUTTON_TYPE_MINIMIZE,
META_BUTTON_TYPE_MENU,
META_BUTTON_TYPE_APPMENU,
META_BUTTON_TYPE_SHADE,
META_BUTTON_TYPE_ABOVE,
META_BUTTON_TYPE_STICK,
META_BUTTON_TYPE_UNSHADE,
META_BUTTON_TYPE_UNABOVE,
META_BUTTON_TYPE_UNSTICK,
META_BUTTON_TYPE_LAST
} MetaButtonType;
typedef enum
{
META_STYLE_ELEMENT_WINDOW,
META_STYLE_ELEMENT_FRAME,
META_STYLE_ELEMENT_TITLEBAR,
META_STYLE_ELEMENT_TITLE,

View File

@@ -79,10 +79,14 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
if (!layout->has_title)
text_height = 0;
else
text_height = layout->title_margin.top + text_height + layout->title_margin.bottom;
buttons_height = layout->icon_size +
layout->button_border.top + layout->button_border.bottom;
content_height = MAX (buttons_height, text_height) +
buttons_height = MAX ((int)layout->icon_size, layout->button_min_size.height) +
layout->button_margin.top + layout->button_border.top +
layout->button_margin.bottom + layout->button_border.bottom;
content_height = MAX (buttons_height, text_height);
content_height = MAX (content_height, layout->titlebar_min_size.height) +
layout->titlebar_border.top + layout->titlebar_border.bottom;
borders->visible.top = layout->frame_border.top + content_height;
@@ -90,23 +94,28 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
borders->visible.right = layout->frame_border.right;
borders->visible.bottom = layout->frame_border.bottom;
borders->invisible = layout->invisible_border;
draggable_borders = meta_prefs_get_draggable_border_width ();
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
{
borders->invisible.left = MAX (0, draggable_borders - borders->visible.left);
borders->invisible.right = MAX (0, draggable_borders - borders->visible.right);
borders->invisible.left = MAX (borders->invisible.left,
draggable_borders - borders->visible.left);
borders->invisible.right = MAX (borders->invisible.right,
draggable_borders - borders->visible.right);
}
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
{
borders->invisible.bottom = MAX (0, draggable_borders - borders->visible.bottom);
borders->invisible.bottom = MAX (borders->invisible.bottom,
draggable_borders - borders->visible.bottom);
/* borders.visible.top is the height of the *title bar*. We can't do the same
* algorithm here, titlebars are expectedly much bigger. Just subtract a couple
* pixels to get a proper feel. */
if (type != META_FRAME_TYPE_ATTACHED)
borders->invisible.top = MAX (0, draggable_borders - 2);
borders->invisible.top = MAX (borders->invisible.top, draggable_borders - 2);
}
borders->total.left = borders->invisible.left + borders->visible.left;
@@ -177,17 +186,6 @@ rect_for_function (MetaFrameGeometry *fgeom,
return &fgeom->close_rect;
else
return NULL;
case META_BUTTON_FUNCTION_STICK:
case META_BUTTON_FUNCTION_SHADE:
case META_BUTTON_FUNCTION_ABOVE:
case META_BUTTON_FUNCTION_UNSTICK:
case META_BUTTON_FUNCTION_UNSHADE:
case META_BUTTON_FUNCTION_UNABOVE:
/* Fringe buttons that used to be supported by theme versions >v1;
* if we want to support them again, we need to return the
* correspondings rects here
*/
return NULL;
case META_BUTTON_FUNCTION_LAST:
return NULL;
@@ -245,6 +243,16 @@ get_padding_and_border (GtkStyleContext *style,
border->bottom += tmp.bottom;
}
static void
get_min_size (GtkStyleContext *style,
GtkRequisition *requisition)
{
gtk_style_context_get (style, gtk_style_context_get_state (style),
"min-width", &requisition->width,
"min-height", &requisition->height,
NULL);
}
static void
scale_border (GtkBorder *border,
double factor)
@@ -262,6 +270,8 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout,
{
GtkStyleContext *style;
GtkBorder border;
GtkRequisition requisition;
GdkRectangle clip_rect;
int border_radius, max_radius;
meta_style_info_set_flags (style_info, flags);
@@ -270,6 +280,12 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout,
get_padding_and_border (style, &layout->frame_border);
scale_border (&layout->frame_border, layout->title_scale);
gtk_render_background_get_clip (style, 0, 0, 0, 0, &clip_rect);
layout->invisible_border.left = -clip_rect.x;
layout->invisible_border.right = clip_rect.width + clip_rect.x;
layout->invisible_border.top = -clip_rect.y;
layout->invisible_border.bottom = clip_rect.height + clip_rect.y;
if (layout->hide_buttons)
layout->icon_size = 0;
@@ -292,14 +308,25 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout,
max_radius = MIN (layout->frame_border.bottom, layout->frame_border.right);
layout->bottom_right_corner_rounded_radius = MAX (border_radius, max_radius);
get_min_size (style, &layout->titlebar_min_size);
get_padding_and_border (style, &layout->titlebar_border);
scale_border (&layout->titlebar_border, layout->title_scale);
style = style_info->styles[META_STYLE_ELEMENT_TITLE];
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
&layout->title_margin);
scale_border (&layout->title_margin, layout->title_scale);
style = style_info->styles[META_STYLE_ELEMENT_BUTTON];
get_min_size (style, &layout->button_min_size);
get_padding_and_border (style, &layout->button_border);
scale_border (&layout->button_border, layout->title_scale);
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
&layout->button_margin);
scale_border (&layout->button_margin, layout->title_scale);
style = style_info->styles[META_STYLE_ELEMENT_IMAGE];
get_min_size (style, &requisition);
get_padding_and_border (style, &border);
scale_border (&border, layout->title_scale);
@@ -307,6 +334,18 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout,
layout->button_border.right += border.right;
layout->button_border.top += border.top;
layout->button_border.bottom += border.bottom;
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
&border);
layout->button_border.left += border.left;
layout->button_border.right += border.right;
layout->button_border.top += border.top;
layout->button_border.bottom += border.bottom;
layout->button_min_size.width = MAX(layout->button_min_size.width,
requisition.width);
layout->button_min_size.height = MAX(layout->button_min_size.height,
requisition.height);
}
static void
@@ -370,9 +409,9 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
(fgeom->content_border.right + borders.invisible.right);
content_height = borders.visible.top - fgeom->content_border.top - fgeom->content_border.bottom;
button_width = layout->icon_size +
button_width = MAX ((int)layout->icon_size, layout->button_min_size.width) +
layout->button_border.left + layout->button_border.right;
button_height = layout->icon_size +
button_height = MAX ((int)layout->icon_size, layout->button_min_size.height) +
layout->button_border.top + layout->button_border.bottom;
button_width *= scale;
button_height *= scale;
@@ -433,11 +472,15 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
space_used_by_buttons = 0;
space_used_by_buttons += layout->button_margin.left * scale * n_left;
space_used_by_buttons += button_width * n_left;
space_used_by_buttons += layout->button_margin.right * scale * n_left;
space_used_by_buttons += (button_width * 0.75) * n_left_spacers;
space_used_by_buttons += layout->titlebar_spacing * scale * MAX (n_left - 1, 0);
space_used_by_buttons += layout->button_margin.left * scale * n_right;
space_used_by_buttons += button_width * n_right;
space_used_by_buttons += layout->button_margin.right * scale * n_right;
space_used_by_buttons += (button_width * 0.75) * n_right_spacers;
space_used_by_buttons += layout->titlebar_spacing * scale * MAX (n_right - 1, 0);
@@ -457,22 +500,10 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
}
/* Otherwise we need to shave out a button. Shave
* above, stick, shade, min, max, close, then menu (menu is most useful);
* min, max, close, then menu (menu is most useful);
* prefer the default button locations.
*/
if (strip_button (left_func_rects, &n_left, &fgeom->above_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->above_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->stick_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->stick_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->shade_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->shade_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->min_rect))
if (strip_button (left_func_rects, &n_left, &fgeom->min_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->min_rect))
continue;
@@ -519,6 +550,8 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
if (x < 0) /* if we go negative, leave the buttons we don't get to as 0-width */
break;
x -= layout->button_margin.right * scale;
rect = right_func_rects[i];
rect->visible.x = x - button_width;
if (right_buttons_has_spacer[i])
@@ -544,7 +577,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
else
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
x = rect->visible.x;
x = rect->visible.x - layout->button_margin.left * scale;
if (i > 0)
x -= layout->titlebar_spacing;
@@ -563,6 +596,8 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
{
MetaButtonSpace *rect;
x += layout->button_margin.left * scale;
rect = left_func_rects[i];
rect->visible.x = x;
@@ -589,7 +624,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
else
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
x = rect->visible.x + rect->visible.width;
x = rect->visible.x + rect->visible.width + layout->button_margin.right * scale;
if (i < n_left - 1)
x += layout->titlebar_spacing * scale;
if (left_buttons_has_spacer[i])
@@ -643,30 +678,6 @@ get_button_rect (MetaButtonType type,
*rect = fgeom->close_rect.visible;
break;
case META_BUTTON_TYPE_SHADE:
*rect = fgeom->shade_rect.visible;
break;
case META_BUTTON_TYPE_UNSHADE:
*rect = fgeom->unshade_rect.visible;
break;
case META_BUTTON_TYPE_ABOVE:
*rect = fgeom->above_rect.visible;
break;
case META_BUTTON_TYPE_UNABOVE:
*rect = fgeom->unabove_rect.visible;
break;
case META_BUTTON_TYPE_STICK:
*rect = fgeom->stick_rect.visible;
break;
case META_BUTTON_TYPE_UNSTICK:
*rect = fgeom->unstick_rect.visible;
break;
case META_BUTTON_TYPE_MAXIMIZE:
*rect = fgeom->max_rect.visible;
break;
@@ -890,6 +901,7 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
cairo_restore (cr);
if (button_class)
gtk_style_context_remove_class (style, button_class);
gtk_style_context_set_state (style, state);
}
}
@@ -915,11 +927,9 @@ meta_theme_get_default (void)
switch (frame_type)
{
case META_FRAME_TYPE_NORMAL:
break;
case META_FRAME_TYPE_DIALOG:
case META_FRAME_TYPE_MODAL_DIALOG:
case META_FRAME_TYPE_ATTACHED:
layout->hide_buttons = TRUE;
break;
case META_FRAME_TYPE_MENU:
case META_FRAME_TYPE_UTILITY:
@@ -977,6 +987,7 @@ static GtkStyleContext *
create_style_context (GType widget_type,
GtkStyleContext *parent_style,
GtkCssProvider *provider,
const char *object_name,
const char *first_class,
...)
{
@@ -996,6 +1007,9 @@ create_style_context (GType widget_type,
gtk_widget_path_append_type (path, widget_type);
if (object_name)
gtk_widget_path_iter_set_object_name (path, -1, object_name);
va_start (ap, first_class);
for (name = first_class; name; name = va_arg (ap, const char *))
gtk_widget_path_iter_add_class (path, -1, name);
@@ -1031,40 +1045,48 @@ meta_theme_create_style_info (GdkScreen *screen,
style_info = g_new0 (MetaStyleInfo, 1);
style_info->refcount = 1;
style_info->styles[META_STYLE_ELEMENT_FRAME] =
style_info->styles[META_STYLE_ELEMENT_WINDOW] =
create_style_context (META_TYPE_FRAMES,
NULL,
provider,
"window",
GTK_STYLE_CLASS_BACKGROUND,
"window-frame",
"ssd",
NULL);
style_info->styles[META_STYLE_ELEMENT_FRAME] =
create_style_context (META_TYPE_FRAMES,
style_info->styles[META_STYLE_ELEMENT_WINDOW],
provider,
"decoration",
NULL);
style_info->styles[META_STYLE_ELEMENT_TITLEBAR] =
create_style_context (GTK_TYPE_HEADER_BAR,
style_info->styles[META_STYLE_ELEMENT_FRAME],
provider,
"headerbar",
GTK_STYLE_CLASS_TITLEBAR,
GTK_STYLE_CLASS_HORIZONTAL,
"default-decoration",
"header-bar",
NULL);
style_info->styles[META_STYLE_ELEMENT_TITLE] =
create_style_context (GTK_TYPE_LABEL,
style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
provider,
"label",
GTK_STYLE_CLASS_TITLE,
NULL);
style_info->styles[META_STYLE_ELEMENT_BUTTON] =
create_style_context (GTK_TYPE_BUTTON,
style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
provider,
GTK_STYLE_CLASS_BUTTON,
"button",
"titlebutton",
NULL);
style_info->styles[META_STYLE_ELEMENT_IMAGE] =
create_style_context (GTK_TYPE_IMAGE,
style_info->styles[META_STYLE_ELEMENT_BUTTON],
provider,
"image",
NULL);
return style_info;
}
@@ -1171,9 +1193,10 @@ meta_style_info_create_font_desc (MetaStyleInfo *style_info)
{
PangoFontDescription *font_desc;
const PangoFontDescription *override = meta_prefs_get_titlebar_font ();
GtkStyleContext *context = style_info->styles[META_STYLE_ELEMENT_TITLE];
gtk_style_context_get (style_info->styles[META_STYLE_ELEMENT_TITLE],
GTK_STATE_FLAG_NORMAL,
gtk_style_context_get (context,
gtk_style_context_get_state (context),
"font", &font_desc, NULL);
if (override)

View File

@@ -0,0 +1,707 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include "wayland/meta-pointer-confinement-wayland.h"
#include <glib-object.h>
#include <cairo.h>
#include "backends/meta-backend-private.h"
#include "core/meta-border.h"
#include "wayland/meta-wayland-seat.h"
#include "wayland/meta-wayland-pointer.h"
#include "wayland/meta-wayland-pointer-constraints.h"
#include "wayland/meta-wayland-surface.h"
#include "backends/meta-pointer-constraint.h"
#include "compositor/meta-surface-actor-wayland.h"
struct _MetaPointerConfinementWayland
{
MetaPointerConstraint parent;
MetaWaylandPointerConstraint *constraint;
};
typedef struct _MetaBox
{
int x1;
int y1;
int x2;
int y2;
} MetaBox;
G_DEFINE_TYPE (MetaPointerConfinementWayland, meta_pointer_confinement_wayland,
META_TYPE_POINTER_CONSTRAINT);
static MetaBorder *
add_border (GArray *borders,
float x1, float y1,
float x2, float y2,
MetaBorderMotionDirection blocking_directions)
{
MetaBorder border;
border = (MetaBorder) {
.line = (MetaLine2) {
.a = (MetaVector2) {
.x = x1,
.y = y1,
},
.b = (MetaVector2) {
.x = x2,
.y = y2,
},
},
.blocking_directions = blocking_directions,
};
g_array_append_val (borders, border);
return &g_array_index (borders, MetaBorder, borders->len - 1);
}
static gint
compare_lines_x (gconstpointer a, gconstpointer b)
{
const MetaBorder *border_a = a;
const MetaBorder *border_b = b;
if (border_a->line.a.x == border_b->line.a.x)
return border_a->line.b.x < border_b->line.b.x;
else
return border_a->line.a.x > border_b->line.a.x;
}
static void
add_non_overlapping_edges (MetaBox *boxes,
unsigned int band_above_start,
unsigned int band_below_start,
unsigned int band_below_end,
GArray *borders)
{
unsigned int i;
GArray *band_merge;
MetaBorder *border;
MetaBorder *prev_border;
MetaBorder *new_border;
band_merge = g_array_new (FALSE, FALSE, sizeof *border);
/* Add bottom band of previous row, and top band of current row, and
* sort them so lower left x coordinate comes first. If there are two
* borders with the same left x coordinate, the wider one comes first.
*/
for (i = band_above_start; i < band_below_start; i++)
{
MetaBox *box = &boxes[i];
add_border (band_merge, box->x1, box->y2, box->x2, box->y2,
META_BORDER_MOTION_DIRECTION_POSITIVE_Y);
}
for (i = band_below_start; i < band_below_end; i++)
{
MetaBox *box= &boxes[i];
add_border (band_merge, box->x1, box->y1, box->x2, box->y1,
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
}
g_array_sort (band_merge, compare_lines_x);
/* Combine the two combined bands so that any overlapping border is
* eliminated. */
prev_border = NULL;
for (i = 0; i < band_merge->len; i++)
{
border = &g_array_index (band_merge, MetaBorder, i);
g_assert (border->line.a.y == border->line.b.y);
g_assert (!prev_border ||
prev_border->line.a.y == border->line.a.y);
g_assert (!prev_border ||
(prev_border->line.a.x != border->line.a.x ||
prev_border->line.b.x != border->line.b.x));
g_assert (!prev_border ||
prev_border->line.a.x <= border->line.a.x);
if (prev_border &&
prev_border->line.a.x == border->line.a.x)
{
/*
* ------------ +
* ------- =
* [ ]-----
*/
prev_border->line.a.x = border->line.b.x;
}
else if (prev_border &&
prev_border->line.b.x == border->line.b.x)
{
/*
* ------------ +
* ------ =
* ------[ ]
*/
prev_border->line.b.x = border->line.a.x;
}
else if (prev_border &&
prev_border->line.b.x == border->line.a.x)
{
/*
* -------- +
* ------ =
* --------------
*/
prev_border->line.b.x = border->line.b.x;
}
else if (prev_border &&
prev_border->line.b.x >= border->line.a.x)
{
/*
* --------------- +
* ------ =
* -----[ ]----
*/
new_border = add_border (borders,
border->line.b.x,
border->line.b.y,
prev_border->line.b.x,
prev_border->line.b.y,
prev_border->blocking_directions);
prev_border->line.b.x = border->line.a.x;
prev_border = new_border;
}
else
{
g_assert (!prev_border ||
prev_border->line.b.x < border->line.a.x);
/*
* First border or non-overlapping.
*
* ----- +
* ----- =
* ----- -----
*/
g_array_append_val (borders, *border);
prev_border = &g_array_index (borders, MetaBorder, borders->len - 1);
}
}
g_array_free (band_merge, FALSE);
}
static void
add_band_bottom_edges (MetaBox *boxes,
int band_start,
int band_end,
GArray *borders)
{
int i;
for (i = band_start; i < band_end; i++)
{
add_border (borders,
boxes[i].x1, boxes[i].y2,
boxes[i].x2, boxes[i].y2,
META_BORDER_MOTION_DIRECTION_POSITIVE_Y);
}
}
static void
region_to_outline (cairo_region_t *region,
GArray *borders)
{
MetaBox *boxes;
int num_boxes;
int i;
int top_most, bottom_most;
int current_roof;
int prev_top;
int band_start, prev_band_start;
/*
* Remove any overlapping lines from the set of rectangles. Note that
* pixman regions are grouped as rows of rectangles, where rectangles
* in one row never touch or overlap and are all of the same height.
*
* -------- --- -------- ---
* | | | | | | | |
* ----------====---- --- ----------- ----- ---
* | | => | |
* ----==========--------- ----- ----------
* | | | |
* ------------------- -------------------
*
*/
num_boxes = cairo_region_num_rectangles (region);
boxes = g_new (MetaBox, num_boxes);
for (i = 0; i < num_boxes; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect);
boxes[i] = (MetaBox) {
.x1 = rect.x,
.y1 = rect.y,
.x2 = rect.x + rect.width,
.y2 = rect.y + rect.height,
};
}
prev_top = 0;
top_most = boxes[0].y1;
current_roof = top_most;
bottom_most = boxes[num_boxes - 1].y2;
band_start = 0;
prev_band_start = 0;
for (i = 0; i < num_boxes; i++)
{
/* Detect if there is a vertical empty space, and add the lower
* level of the previous band if so was the case. */
if (i > 0 &&
boxes[i].y1 != prev_top &&
boxes[i].y1 != boxes[i - 1].y2)
{
current_roof = boxes[i].y1;
add_band_bottom_edges (boxes,
band_start,
i,
borders);
}
/* Special case adding the last band, since it won't be handled
* by the band change detection below. */
if (boxes[i].y1 != current_roof && i == num_boxes - 1)
{
if (boxes[i].y1 != prev_top)
{
/* The last band is a single box, so we don't
* have a prev_band_start to tell us when the
* previous band started. */
add_non_overlapping_edges (boxes,
band_start,
i,
i + 1,
borders);
}
else
{
add_non_overlapping_edges (boxes,
prev_band_start,
band_start,
i + 1,
borders);
}
}
/* Detect when passing a band and combine the top border of the
* just passed band with the bottom band of the previous band.
*/
if (boxes[i].y1 != top_most && boxes[i].y1 != prev_top)
{
/* Combine the two passed bands. */
if (prev_top != current_roof)
{
add_non_overlapping_edges (boxes,
prev_band_start,
band_start,
i,
borders);
}
prev_band_start = band_start;
band_start = i;
}
/* Add the top border if the box is part of the current roof. */
if (boxes[i].y1 == current_roof)
{
add_border (borders,
boxes[i].x1, boxes[i].y1,
boxes[i].x2, boxes[i].y1,
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
}
/* Add the bottom border of the last band. */
if (boxes[i].y2 == bottom_most)
{
add_border (borders,
boxes[i].x1, boxes[i].y2,
boxes[i].x2, boxes[i].y2,
META_BORDER_MOTION_DIRECTION_POSITIVE_Y);
}
/* Always add the left border. */
add_border (borders,
boxes[i].x1, boxes[i].y1,
boxes[i].x1, boxes[i].y2,
META_BORDER_MOTION_DIRECTION_NEGATIVE_X);
/* Always add the right border. */
add_border (borders,
boxes[i].x2, boxes[i].y1,
boxes[i].x2, boxes[i].y2,
META_BORDER_MOTION_DIRECTION_POSITIVE_X);
prev_top = boxes[i].y1;
}
g_free (boxes);
}
static MetaBorder *
get_closest_border (GArray *borders,
MetaLine2 *motion,
uint32_t directions)
{
MetaBorder *border;
MetaVector2 intersection;
MetaVector2 delta;
float distance_2;
MetaBorder *closest_border = NULL;
float closest_distance_2 = DBL_MAX;
unsigned int i;
for (i = 0; i < borders->len; i++)
{
border = &g_array_index (borders, MetaBorder, i);
if (!meta_border_is_blocking_directions (border, directions))
continue;
if (!meta_line2_intersects_with (&border->line, motion, &intersection))
continue;
delta = meta_vector2_subtract (intersection, motion->a);
distance_2 = delta.x*delta.x + delta.y*delta.y;
if (distance_2 < closest_distance_2)
{
closest_border = border;
closest_distance_2 = distance_2;
}
}
return closest_border;
}
static void
clamp_to_border (MetaBorder *border,
MetaLine2 *motion,
uint32_t *motion_dir)
{
/*
* When clamping either rightward or downward motions, the motion needs to be
* clamped so that the destination coordinate does not end up on the border
* (see weston_pointer_clamp_event_to_region). Do this by clamping such
* motions to the border minus the smallest possible wl_fixed_t value.
*
* When clamping in either leftward or upward motion, the resulting coordinate
* needs to be clamped so that it is enough on the inside to avoid the
* inaccuracies of clutter's stage to actor transformation algorithm (the one
* used in clutter_actor_transform_stage_point) to make it end up outside the
* next motion. It also needs to be clamped so that to the wl_fixed_t
* coordinate may still be right on the border (i.e. at .0). Testing shows
* that the smallest wl_fixed_t value divided by 10 is small enough to make
* the wl_fixed_t coordinate .0 and large enough to avoid the inaccuracies of
* clutters transform algorithm.
*/
if (meta_border_is_horizontal (border))
{
if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_Y)
motion->b.y = border->line.a.y - wl_fixed_to_double (1);
else
motion->b.y = border->line.a.y + wl_fixed_to_double (1) / 10;
*motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_Y |
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
}
else
{
if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_X)
motion->b.x = border->line.a.x - wl_fixed_to_double (1);
else
motion->b.x = border->line.a.x + wl_fixed_to_double (1) / 10;
*motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_X |
META_BORDER_MOTION_DIRECTION_NEGATIVE_X);
}
}
static uint32_t
get_motion_directions (MetaLine2 *motion)
{
uint32_t directions = 0;
if (motion->a.x < motion->b.x)
directions |= META_BORDER_MOTION_DIRECTION_POSITIVE_X;
else if (motion->a.x > motion->b.x)
directions |= META_BORDER_MOTION_DIRECTION_NEGATIVE_X;
if (motion->a.y < motion->b.y)
directions |= META_BORDER_MOTION_DIRECTION_POSITIVE_Y;
else if (motion->a.y > motion->b.y)
directions |= META_BORDER_MOTION_DIRECTION_NEGATIVE_Y;
return directions;
}
static void
meta_pointer_confinement_wayland_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y)
{
MetaPointerConfinementWayland *self =
META_POINTER_CONFINEMENT_WAYLAND (constraint);
MetaWaylandSurface *surface;
cairo_region_t *region;
float sx, sy;
float prev_sx, prev_sy;
GArray *borders;
MetaLine2 motion;
MetaBorder *closest_border;
uint32_t directions;
surface = meta_wayland_pointer_constraint_get_surface (self->constraint);
meta_wayland_surface_get_relative_coordinates (surface, *x, *y, &sx, &sy);
meta_wayland_surface_get_relative_coordinates (surface, prev_x, prev_y,
&prev_sx, &prev_sy);
/* For motions in a positive direction on any axis, append the smallest
* possible value representable in a Wayland absolute coordinate. This is
* in order to avoid not clamping motion that as a floating point number
* won't be clamped, but will be rounded up to be outside of the range
* of wl_fixed_t. */
if (sx > prev_sx)
sx += (float)wl_fixed_to_double(1);
if (sy > prev_sy)
sy += (float)wl_fixed_to_double(1);
borders = g_array_new (FALSE, FALSE, sizeof (MetaBorder));
/*
* Generate borders given the confine region we are to use. The borders
* are defined to be the outer region of the allowed area. This means
* top/left borders are "within" the allowed area, while bottom/right
* borders are outside. This needs to be considered when clamping
* confined motion vectors.
*/
region =
meta_wayland_pointer_constraint_calculate_effective_region (self->constraint);
region_to_outline (region, borders);
cairo_region_destroy (region);
motion = (MetaLine2) {
.a = (MetaVector2) {
.x = prev_sx,
.y = prev_sy,
},
.b = (MetaVector2) {
.x = sx,
.y = sy,
},
};
directions = get_motion_directions (&motion);
while (directions)
{
closest_border = get_closest_border (borders,
&motion,
directions);
if (closest_border)
clamp_to_border (closest_border, &motion, &directions);
else
break;
}
meta_wayland_surface_get_absolute_coordinates (surface,
motion.b.x, motion.b.y,
x, y);
g_array_free (borders, FALSE);
}
static float
point_to_border_distance_2 (MetaBorder *border,
float x,
float y)
{
float orig_x, orig_y;
float dx, dy;
if (meta_border_is_horizontal (border))
{
if (x < border->line.a.x)
orig_x = border->line.a.x;
else if (x > border->line.b.x)
orig_x = border->line.b.x;
else
orig_x = x;
orig_y = border->line.a.y;
}
else
{
if (y < border->line.a.y)
orig_y = border->line.a.y;
else if (y > border->line.b.y)
orig_y = border->line.b.y;
else
orig_y = y;
orig_x = border->line.a.x;
}
dx = fabsf (orig_x - x);
dy = fabsf (orig_y - y);
return dx*dx + dy*dy;
}
static void
warp_to_behind_border (MetaBorder *border,
float *sx,
float *sy)
{
switch (border->blocking_directions)
{
case META_BORDER_MOTION_DIRECTION_POSITIVE_X:
case META_BORDER_MOTION_DIRECTION_NEGATIVE_X:
if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_X)
*sx = border->line.a.x - wl_fixed_to_double (1);
else
*sx = border->line.a.x + wl_fixed_to_double (1);
if (*sy < border->line.a.y)
*sy = border->line.a.y + wl_fixed_to_double (1);
else if (*sy > border->line.b.y)
*sy = border->line.b.y - wl_fixed_to_double (1);
break;
case META_BORDER_MOTION_DIRECTION_POSITIVE_Y:
case META_BORDER_MOTION_DIRECTION_NEGATIVE_Y:
if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_Y)
*sy = border->line.a.y - wl_fixed_to_double (1);
else
*sy = border->line.a.y + wl_fixed_to_double (1);
if (*sx < border->line.a.x)
*sx = border->line.a.x + wl_fixed_to_double (1);
else if (*sx > (border->line.b.x))
*sx = border->line.b.x - wl_fixed_to_double (1);
break;
}
}
static void
meta_pointer_confinement_wayland_maybe_warp (MetaPointerConfinementWayland *self)
{
MetaWaylandSeat *seat;
MetaWaylandSurface *surface;
ClutterPoint point;
float sx;
float sy;
cairo_region_t *region;
seat = meta_wayland_pointer_constraint_get_seat (self->constraint);
surface = meta_wayland_pointer_constraint_get_surface (self->constraint);
clutter_input_device_get_coords (seat->pointer.device, NULL, &point);
meta_wayland_surface_get_relative_coordinates (surface,
point.x, point.y,
&sx, &sy);
region =
meta_wayland_pointer_constraint_calculate_effective_region (self->constraint);
if (!cairo_region_contains_point (region, (int)sx, (int)sy))
{
GArray *borders;
float closest_distance_2 = FLT_MAX;
MetaBorder *closest_border = NULL;
unsigned int i;
float x;
float y;
borders = g_array_new (FALSE, FALSE, sizeof (MetaBorder));
region_to_outline (region, borders);
for (i = 0; i < borders->len; i++)
{
MetaBorder *border = &g_array_index (borders, MetaBorder, i);
float distance_2;
distance_2 = point_to_border_distance_2 (border, sx, sy);
if (distance_2 < closest_distance_2)
{
closest_border = border;
closest_distance_2 = distance_2;
}
}
warp_to_behind_border (closest_border, &sx, &sy);
meta_wayland_surface_get_absolute_coordinates (surface, sx, sy, &x, &y);
meta_backend_warp_pointer (meta_get_backend (), (int)x, (int)y);
}
cairo_region_destroy (region);
}
static void
surface_actor_painting (MetaSurfaceActorWayland *surface_actor,
MetaPointerConfinementWayland *self)
{
meta_pointer_confinement_wayland_maybe_warp (self);
}
MetaPointerConstraint *
meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint)
{
GObject *object;
MetaPointerConfinementWayland *confinement;
MetaWaylandSurface *surface;
object = g_object_new (META_TYPE_POINTER_CONFINEMENT_WAYLAND, NULL);
confinement = META_POINTER_CONFINEMENT_WAYLAND (object);
confinement->constraint = constraint;
surface = meta_wayland_pointer_constraint_get_surface (constraint);
g_signal_connect_object (surface->surface_actor,
"painting",
G_CALLBACK (surface_actor_painting),
confinement,
0);
return META_POINTER_CONSTRAINT (confinement);
}
static void
meta_pointer_confinement_wayland_init (MetaPointerConfinementWayland *confinement_wayland)
{
}
static void
meta_pointer_confinement_wayland_class_init (MetaPointerConfinementWaylandClass *klass)
{
MetaPointerConstraintClass *pointer_constraint_class =
META_POINTER_CONSTRAINT_CLASS (klass);
pointer_constraint_class->constrain = meta_pointer_confinement_wayland_constrain;
}

View File

@@ -0,0 +1,45 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_POINTER_CONFINEMENT_WAYLAND_H
#define META_POINTER_CONFINEMENT_WAYLAND_H
#include <glib-object.h>
#include "backends/meta-pointer-constraint.h"
#include "wayland/meta-wayland-pointer-constraints.h"
G_BEGIN_DECLS
#define META_TYPE_POINTER_CONFINEMENT_WAYLAND (meta_pointer_confinement_wayland_get_type ())
G_DECLARE_FINAL_TYPE (MetaPointerConfinementWayland,
meta_pointer_confinement_wayland,
META, POINTER_CONFINEMENT_WAYLAND,
MetaPointerConstraint);
MetaPointerConstraint *meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint);
G_END_DECLS
#endif /* META_CONFINEMENT_WAYLAND_H */

View File

@@ -0,0 +1,72 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include "wayland/meta-pointer-lock-wayland.h"
#include <glib-object.h>
#include "backends/meta-pointer-constraint.h"
struct _MetaPointerLockWayland
{
MetaPointerConstraint parent;
};
G_DEFINE_TYPE (MetaPointerLockWayland, meta_pointer_lock_wayland,
META_TYPE_POINTER_CONSTRAINT);
static void
meta_pointer_lock_wayland_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y)
{
*x = prev_x;
*y = prev_y;
}
MetaPointerConstraint *
meta_pointer_lock_wayland_new (void)
{
return g_object_new (META_TYPE_POINTER_LOCK_WAYLAND, NULL);
}
static void
meta_pointer_lock_wayland_init (MetaPointerLockWayland *lock_wayland)
{
}
static void
meta_pointer_lock_wayland_class_init (MetaPointerLockWaylandClass *klass)
{
MetaPointerConstraintClass *pointer_constraint_class =
META_POINTER_CONSTRAINT_CLASS (klass);
pointer_constraint_class->constrain = meta_pointer_lock_wayland_constrain;
}

View File

@@ -0,0 +1,42 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_POINTER_LOCK_WAYLAND_H
#define META_POINTER_LOCK_WAYLAND_H
#include <glib-object.h>
#include "backends/meta-pointer-constraint.h"
G_BEGIN_DECLS
#define META_TYPE_POINTER_LOCK_WAYLAND (meta_pointer_lock_wayland_get_type ())
G_DECLARE_FINAL_TYPE (MetaPointerLockWayland, meta_pointer_lock_wayland,
META, POINTER_LOCK_WAYLAND, MetaPointerConstraint);
MetaPointerConstraint *meta_pointer_lock_wayland_new (void);
G_END_DECLS
#endif /* META_LOCK_WAYLAND_H */

View File

@@ -30,6 +30,8 @@
#include <cogl/cogl-wayland-server.h>
#include <meta/util.h>
G_DEFINE_TYPE (MetaWaylandBuffer, meta_wayland_buffer, G_TYPE_OBJECT);
static void
meta_wayland_buffer_destroy_handler (struct wl_listener *listener,
void *data)
@@ -37,25 +39,28 @@ meta_wayland_buffer_destroy_handler (struct wl_listener *listener,
MetaWaylandBuffer *buffer =
wl_container_of (listener, buffer, destroy_listener);
buffer->resource = NULL;
wl_signal_emit (&buffer->destroy_signal, buffer);
g_slice_free (MetaWaylandBuffer, buffer);
g_object_unref (buffer);
}
void
meta_wayland_buffer_ref (MetaWaylandBuffer *buffer)
meta_wayland_buffer_ref_use_count (MetaWaylandBuffer *buffer)
{
buffer->ref_count++;
g_warn_if_fail (buffer->resource);
buffer->use_count++;
}
void
meta_wayland_buffer_unref (MetaWaylandBuffer *buffer)
meta_wayland_buffer_unref_use_count (MetaWaylandBuffer *buffer)
{
buffer->ref_count--;
if (buffer->ref_count == 0)
{
g_clear_pointer (&buffer->texture, cogl_object_unref);
wl_resource_queue_event (buffer->resource, WL_BUFFER_RELEASE);
}
g_return_if_fail (buffer->use_count != 0);
buffer->use_count--;
if (buffer->use_count == 0 && buffer->resource)
wl_resource_queue_event (buffer->resource, WL_BUFFER_RELEASE);
}
MetaWaylandBuffer *
@@ -74,7 +79,7 @@ meta_wayland_buffer_from_resource (struct wl_resource *resource)
}
else
{
buffer = g_slice_new0 (MetaWaylandBuffer);
buffer = g_object_new (META_TYPE_WAYLAND_BUFFER, NULL);
buffer->resource = resource;
wl_signal_init (&buffer->destroy_signal);
@@ -93,6 +98,9 @@ meta_wayland_buffer_ensure_texture (MetaWaylandBuffer *buffer)
CoglTexture *texture;
struct wl_shm_buffer *shm_buffer;
g_return_val_if_fail (buffer->use_count != 0, NULL);
g_return_val_if_fail (buffer->resource, NULL);
if (buffer->texture)
goto out;
@@ -126,6 +134,8 @@ meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
{
struct wl_shm_buffer *shm_buffer;
g_return_if_fail (buffer->use_count != 0);
shm_buffer = wl_shm_buffer_get (buffer->resource);
if (shm_buffer)
@@ -149,3 +159,26 @@ meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
wl_shm_buffer_end_access (shm_buffer);
}
}
static void
meta_wayland_buffer_finalize (GObject *object)
{
MetaWaylandBuffer *buffer = META_WAYLAND_BUFFER (object);
g_clear_pointer (&buffer->texture, cogl_object_unref);
G_OBJECT_CLASS (meta_wayland_buffer_parent_class)->finalize (object);
}
static void
meta_wayland_buffer_init (MetaWaylandBuffer *buffer)
{
}
static void
meta_wayland_buffer_class_init (MetaWaylandBufferClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_wayland_buffer_finalize;
}

View File

@@ -33,17 +33,23 @@
struct _MetaWaylandBuffer
{
GObject parent;
struct wl_resource *resource;
struct wl_signal destroy_signal;
struct wl_listener destroy_listener;
CoglTexture *texture;
uint32_t ref_count;
uint32_t use_count;
};
#define META_TYPE_WAYLAND_BUFFER (meta_wayland_buffer_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandBuffer, meta_wayland_buffer,
META, WAYLAND_BUFFER, GObject);
MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resource *resource);
void meta_wayland_buffer_ref (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_unref (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_ref_use_count (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_unref_use_count (MetaWaylandBuffer *buffer);
CoglTexture * meta_wayland_buffer_ensure_texture (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
cairo_region_t *region);

View File

@@ -31,4 +31,10 @@ G_DECLARE_FINAL_TYPE (MetaWaylandDataSourceWayland,
META, WAYLAND_DATA_SOURCE_WAYLAND,
MetaWaylandDataSource);
#define META_TYPE_WAYLAND_DATA_SOURCE_PRIMARY (meta_wayland_data_source_primary_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandDataSourcePrimary,
meta_wayland_data_source_primary,
META, WAYLAND_DATA_SOURCE_PRIMARY,
MetaWaylandDataSourceWayland);
#endif /* META_WAYLAND_DATA_DEVICE_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -45,23 +45,31 @@ struct _MetaWaylandDataSourceClass
void (* target) (MetaWaylandDataSource *source,
const gchar *mime_type);
void (* cancel) (MetaWaylandDataSource *source);
void (* action) (MetaWaylandDataSource *source,
uint32_t action);
void (* drop_performed) (MetaWaylandDataSource *source);
void (* drag_finished) (MetaWaylandDataSource *source);
};
struct _MetaWaylandDataDevice
{
uint32_t selection_serial;
uint32_t primary_serial;
MetaWaylandDataSource *selection_data_source;
MetaWaylandDataSource *dnd_data_source;
MetaWaylandDataSource *primary_data_source;
struct wl_listener selection_data_source_listener;
struct wl_list resource_list;
struct wl_list primary_resource_list;
MetaWaylandDragGrab *current_grab;
struct wl_client *focus_client;
struct wl_signal selection_ownership_signal;
struct wl_signal dnd_ownership_signal;
struct wl_signal primary_ownership_signal;
};
GType meta_wayland_data_source_get_type (void) G_GNUC_CONST;
void meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
void meta_wayland_data_device_init (MetaWaylandDataDevice *data_device);
@@ -70,13 +78,15 @@ void meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_de
gboolean meta_wayland_data_device_is_dnd_surface (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface);
void meta_wayland_data_device_update_dnd_surface (MetaWaylandDataDevice *data_device);
void meta_wayland_data_device_set_dnd_source (MetaWaylandDataDevice *data_device,
MetaWaylandDataSource *source);
void meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
MetaWaylandDataSource *source,
guint32 serial);
void meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
MetaWaylandDataSource *source,
guint32 serial);
gboolean meta_wayland_data_source_add_mime_type (MetaWaylandDataSource *source,
const gchar *mime_type);
@@ -96,6 +106,17 @@ void meta_wayland_data_source_send (MetaWaylandDataSource *source,
const gchar *mime_type,
gint fd);
void meta_wayland_data_source_notify_finish (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_actions (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_user_action (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_current_action (MetaWaylandDataSource *source);
void meta_wayland_data_source_set_actions (MetaWaylandDataSource *source,
uint32_t dnd_actions);
void meta_wayland_data_source_set_current_action (MetaWaylandDataSource *source,
uint32_t action);
const MetaWaylandDragDestFuncs *
meta_wayland_data_device_get_drag_dest_funcs (void);

View File

@@ -56,13 +56,19 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <clutter/evdev/clutter-evdev.h>
#include "backends/meta-backend-private.h"
#include "meta-wayland-private.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h"
#endif
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
static guint evdev_code (const ClutterKeyEvent *event);
static void
unbind_resource (struct wl_resource *resource)
@@ -240,8 +246,10 @@ keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
}
static gboolean
notify_key (MetaWaylandKeyboard *keyboard,
uint32_t time, uint32_t key, uint32_t state)
meta_wayland_keyboard_broadcast_key (MetaWaylandKeyboard *keyboard,
uint32_t time,
uint32_t key,
uint32_t state)
{
struct wl_resource *resource;
struct wl_list *l;
@@ -251,11 +259,12 @@ notify_key (MetaWaylandKeyboard *keyboard,
{
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource);
struct wl_display *display = wl_client_get_display (client);
uint32_t serial = wl_display_next_serial (display);
keyboard->key_serial = wl_display_next_serial (display);
wl_resource_for_each (resource, l)
{
wl_keyboard_send_key (resource, serial, time, key, state);
wl_keyboard_send_key (resource, keyboard->key_serial, time, key, state);
}
}
@@ -263,8 +272,15 @@ notify_key (MetaWaylandKeyboard *keyboard,
return (keyboard->focus_surface != NULL);
}
static gboolean
notify_key (MetaWaylandKeyboard *keyboard,
const ClutterEvent *event)
{
return keyboard->grab->interface->key (keyboard->grab, event);
}
static void
notify_modifiers (MetaWaylandKeyboard *keyboard)
meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard)
{
struct xkb_state *state;
struct wl_resource *resource;
@@ -289,6 +305,16 @@ notify_modifiers (MetaWaylandKeyboard *keyboard)
}
}
static void
notify_modifiers (MetaWaylandKeyboard *keyboard)
{
struct xkb_state *state;
state = keyboard->xkb_info.state;
keyboard->grab->interface->modifiers (keyboard->grab,
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE));
}
static void
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
{
@@ -368,6 +394,45 @@ settings_changed (GSettings *settings,
notify_key_repeat (keyboard);
}
static gboolean
default_grab_key (MetaWaylandKeyboardGrab *grab,
const ClutterEvent *event)
{
MetaWaylandKeyboard *keyboard = grab->keyboard;
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
guint32 code;
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *backend = meta_get_backend ();
#endif
/* Synthetic key events are for autorepeat. Ignore those, as
* autorepeat in Wayland is done on the client side. */
if (event->key.flags & CLUTTER_EVENT_FLAG_SYNTHETIC)
return FALSE;
#ifdef HAVE_NATIVE_BACKEND
if (META_IS_BACKEND_NATIVE (backend))
code = clutter_evdev_event_get_event_code (event);
else
#endif
code = evdev_code (&event->key);
return meta_wayland_keyboard_broadcast_key (keyboard, event->key.time,
code, is_press);
}
static void
default_grab_modifiers (MetaWaylandKeyboardGrab *grab,
ClutterModifierType modifiers)
{
meta_wayland_keyboard_broadcast_modifiers (grab->keyboard);
}
static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface = {
default_grab_key,
default_grab_modifiers
};
void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
struct wl_display *display)
@@ -385,6 +450,10 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
keyboard->xkb_info.keymap_fd = -1;
keyboard->default_grab.interface = &default_keyboard_grab_interface;
keyboard->default_grab.keyboard = keyboard;
keyboard->grab = &keyboard->default_grab;
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
g_signal_connect (keyboard->settings, "changed",
G_CALLBACK (settings_changed), keyboard);
@@ -461,7 +530,7 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
is_press ? "press" : "release",
event->hardware_keycode);
handled = notify_key (keyboard, event->time, evdev_code (event), is_press);
handled = notify_key (keyboard, (const ClutterEvent *) event);
if (handled)
meta_verbose ("Sent event to wayland client\n");
@@ -477,6 +546,34 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
return handled;
}
void
meta_wayland_keyboard_update_key_state (MetaWaylandKeyboard *keyboard,
char *key_vector,
int key_vector_len,
int offset)
{
gboolean mods_changed = FALSE;
int i;
for (i = offset; i < key_vector_len * 8; i++)
{
gboolean set = (key_vector[i/8] & (1 << (i % 8))) != 0;
/* The 'offset' parameter allows the caller to have the indices
* into key_vector to either be X-style (base 8) or evdev (base 0), or
* something else (unlikely). We subtract 'offset' to convert to evdev
* style, then add 8 to convert the "evdev" style keycode back to
* the X-style that xkbcommon expects.
*/
mods_changed |= xkb_state_update_key (keyboard->xkb_info.state,
i - offset + 8,
set ? XKB_KEY_DOWN : XKB_KEY_UP);
}
if (mods_changed)
notify_modifiers (keyboard);
}
static void
move_resources (struct wl_list *destination, struct wl_list *source)
{
@@ -644,3 +741,25 @@ meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
wl_list_insert (&keyboard->resource_list, wl_resource_get_link (cr));
}
}
gboolean
meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
uint32_t serial)
{
return keyboard->key_serial == serial;
}
void
meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard,
MetaWaylandKeyboardGrab *grab)
{
meta_wayland_keyboard_set_focus (keyboard, NULL);
keyboard->grab = grab;
grab->keyboard = keyboard;
}
void
meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
{
keyboard->grab = &keyboard->default_grab;
}

View File

@@ -49,6 +49,20 @@
#include <wayland-server.h>
#include <xkbcommon/xkbcommon.h>
struct _MetaWaylandKeyboardGrabInterface
{
gboolean (*key) (MetaWaylandKeyboardGrab *grab,
const ClutterEvent *event);
void (*modifiers) (MetaWaylandKeyboardGrab *grab,
ClutterModifierType modifiers);
};
struct _MetaWaylandKeyboardGrab
{
const MetaWaylandKeyboardGrabInterface *interface;
MetaWaylandKeyboard *keyboard;
};
typedef struct
{
struct xkb_keymap *keymap;
@@ -68,10 +82,14 @@ struct _MetaWaylandKeyboard
MetaWaylandSurface *focus_surface;
struct wl_listener focus_surface_listener;
uint32_t focus_serial;
uint32_t key_serial;
MetaWaylandXkbInfo xkb_info;
enum xkb_state_component mods_changed;
MetaWaylandKeyboardGrab *grab;
MetaWaylandKeyboardGrab default_grab;
GSettings *settings;
};
@@ -85,6 +103,10 @@ void meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
gboolean meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
const ClutterKeyEvent *event);
void meta_wayland_keyboard_update_key_state (MetaWaylandKeyboard *compositor,
char *key_vector,
int key_vector_len,
int offset);
void meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface);
@@ -96,4 +118,11 @@ void meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
struct wl_resource *seat_resource,
uint32_t id);
gboolean meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
uint32_t serial);
void meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard,
MetaWaylandKeyboardGrab *grab);
void meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard);
#endif /* META_WAYLAND_KEYBOARD_H */

Some files were not shown because too many files have changed in this diff Show More