Compare commits

...

113 Commits

Author SHA1 Message Date
790269db95 Bump version to 3.14.0
Update NEWS.
2014-09-22 20:12:08 +02:00
cb82bd8afa Updated Hindi translation 2014-09-22 13:23:07 +00:00
b1e06ed110 Update Czech translation 2014-09-22 15:02:04 +02:00
fabe66e65f Updated Kannada translation 2014-09-22 05:14:51 +00:00
4a965a37d1 Updated German translation 2014-09-21 19:20:16 +00:00
302ff7b95a update zh_CN translation 2014-09-21 10:15:01 +08:00
e2e241340c Updated Danish translation 2014-09-20 17:22:51 +02:00
461aea47dd window: Adjust the frame rect when _GTK_FRAME_EXTENTS is set on map 2014-09-19 17:35:38 -06:00
d87093fe29 window: Don't queue move/resizes if the extents are the same
GTK+ sets the frame extents on every allocation, so don't bother doing
any extra work if things are the same.
2014-09-19 17:35:38 -06:00
0cde7879d6 window: Move set_custom_frame_extents to be X11-only
Wayland doesn't use custom frame extents anymore -- it uses a full
geometry description.
2014-09-19 17:35:38 -06:00
89ffcee7ca Fix computation of window positions for StaticGravity
When adjust_for_gravity() was simplified (01b6445708), the correct
handling of StaticGravity dropped out - fix adjust_for_gravity() to do
nothing in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=736719
2014-09-19 15:41:22 -04:00
1250afef7b Revert "window-x11: Fix the coordinates we use in the synthetic ConfigureNotify"
The coordinates in ConfigureNotify *should* be the coordinates of the
client window; using the coordinates of the frame window compensated for
a problem with the interpretation of StaticGravity for some clients but
broke other clients.

This reverts commit f4f70afe31.

https://bugzilla.gnome.org/show_bug.cgi?id=736719
2014-09-19 15:41:22 -04:00
3a577edaa7 Updated German translation 2014-09-18 21:55:42 +00:00
48dfde2073 keyboard/pointer: Calculate the serial once per event
Some applications, like totem, create keyboard/pointer objects from the
same client, and expect it to work. We made this work a while ago, but
due to an oversight in the code, we increment the serial on button press
for every resource that we need to send events to.

Since operations like move/resize use the grab serial of the devices to
determine whether the operation is exact, we need to make sure the same
serial goes to all devices.

Restructure the code so that all that's in the resource loop is the
sending of the event -- all the calculation that's needed happens
outside.

This fixes moving / resizing the Totem window not working sometimes.

https://bugzilla.gnome.org/show_bug.cgi?id=736840
2014-09-18 09:15:13 -06:00
4a41d415f8 wayland: Fix the placement of popup windows
The fix in d61dde1 regressed the position of popup windows, since the
size was 0x0 when we wanted to do a sole move. Only fizzle out in the
path where we actually *do* resize.

https://bugzilla.gnome.org/show_bug.cgi?id=736812
2014-09-17 17:42:37 +02:00
1fb7ca398d Updated Oriya translation 2014-09-17 11:27:43 +00:00
2b79935fd8 Updated Slovak translation 2014-09-17 09:10:51 +00:00
e3c915350e Updated Bengali (India) translation 2014-09-17 06:30:41 +00:00
2e06a6765c Bump version to 3.13.92
Update NEWS.
2014-09-17 06:14:24 +02:00
b63291069d docs: Allow building without wayland 2014-09-17 05:37:54 +02:00
f10cb02cbf prefs: Show fallback app menu based on XSetting
Going through GSD's settings was done in context of patches that
did not land; it is simpler and more consistent with GTK+ to use
the corresponding XSetting instead.
2014-09-17 05:37:53 +02:00
276df8f18d keyboard/pointer: Make sure to move focused resources into the list
We only broadcast input to the focus_resource_list, so we need to make
sure it's put in the proper list on startup.

This fixes input not working for windows when they first appear.

Argh. There's always more stuff to fix with keyboard/pointer. Every
single time I think I've fixed it, more stuff pops up.
2014-09-16 21:25:26 -06:00
d61dde12cb window-wayland: Don't send 1x1 sizes to GTK+ windows
GTK+ requests get_xdg_surface before attaching a buffer, and since it
might take a long time for GTK+ to get around to attaching a buffer and
committing it, our idle for MOVE_RESIZE will kick in beforehand.

And our idle will try to resize the 0x0 window that currently exists,
constrain it to 1x1, which will send a configure event of 1x1 to the
window while it boots up, causing it to awkwardly resize to the minimum
size of the window.

Make sure that in this case, our idle doesn't cause any problems, and
that we fizzle out any idles like this.

The "proper" way to do this would be to delay the creation of the
MetaWindow until a surface is committed, but that's difficult for a
variety of reasons, and might cause unintended issues with focus.
2014-09-16 21:14:19 -06:00
c8cc4344f2 events: Only process Enter/Leave events when in the normal route
This prevents issues from happening when processing Enter/Leave events
while in another kind of grab op like a Wayland popup or resizing a
window.

This can't ever really happen except outside of a race condition,
with the X server, since we won't ever pass input events to the
X server in any of these cases, but it can't hurt to be more correct
about what the intended operation is.
2014-09-16 20:31:13 -06:00
ae292c856b events: Ignore normal FocusIn events on the root window
GTK+ focuses its own windows with RevertToParent, which means that when
a GTK+ CSD window is destroyed, the X server will set the focus back to
the root window. The event stream that we is an UnmapNotify followed by
a FocusOut event. Our own UnmapNotify-handling code unmanages the window
and forcibly changes the focus to the next default window in the stack.

Since UnmapNotify events don't come with timestamps, we query for one,
and set the window focus using that.

But there's *still* a FocusOut event in the stack, with an older
timestamp and serial than our own focusing. We see this, throw it out
since it's older than the most recent focus, but then our own code that
notices the root has been focused kicks in and tries to focus the
default window... using a timestamp older than our most recent focusing.

meta_display_sanity_check_timestamps notices this, and (rightly so)
puts a warning in our face, telling something is awry.

Only let our workarounds kick in when the event is new enough, otherwise
our code will get confused over old events.

This stops the:

Window manager warning: last_focus_time (367917173) is greater than comparison timestamp (367917170).  This most likely represents a buggy client sending inaccurate timestamps in messages such as _NET_ACTIVE_WINDOW.  Trying to work around...

warning spam when closing a CSD window.
2014-09-16 20:25:51 -06:00
35dd1e644d events: Remove our workarounds for broken libXi versions
We now depend on a recent enough libXi that fixes broken locking in
XIGrabTouchBegin, so we don't need to carry this around anymore.
2014-09-16 20:10:59 -06:00
be85ead2f8 events: Fix a typo preventing the None detection from working properly
XINotifyDetailNone is a value for detail, not for mode.
2014-09-16 19:53:33 -06:00
5c40345128 window-wayland: Don't bother checking if anything changed
This is a small fixup. We don't need the check here, since we don't do
anything extra if it actually changed.
2014-09-16 19:16:38 -06:00
43b3573c51 window-wayland: Always update the last_sent size
The last_sent size is effectively what size we should send in configure
requests where the size hasn't changed. Thus, if an app commits a new
size, we need to make sure we respect it and don't reconfigure it with
a size it wasn't expecting when the state changes.

This fixes apps being sent a configure event with 0, 0 on startup,
which was confusing Clutter into displaying a 0x0 viewport.
2014-09-16 19:11:56 -06:00
ac6ec168da pointer: Make coding style similar to keyboard 2014-09-16 18:55:49 -06:00
dbb7b9e85b events: Remove an overzealous ifdef 2014-09-16 18:55:46 -06:00
1de740955f wayland: Don't leak the existing texture if we already have one
We were missing a check in ensure_buffer_texture that checked if we
already had a CoglTexture bound for the buffer.
2014-09-16 12:12:21 -06:00
21f123c69f Don't restack windows while we are unmanaging them
Restacking the frame for a window while unmanaging the window is
harmless, but for undecorated (in particular, client-side-decorated)
windows, this causes problems because the window is typically
destroyed by the client immediately after withredrawing the window.

Skip windows flagged as being unmanaged when assembling the new
stack and when comparing the old order to the new stack.

Add a stacking test for this.
2014-09-16 13:44:42 -04:00
d6624b0a75 Cleanup xwayland/wayland window association from the "unmanage" signal
Windows can be freed at some point after they are unmanaged - because
there is an effect in progress, because a language binding is holding
a reference. Therefore, we need to clean up the later to associate
the xwayland and wayland windows deterministically in an "unamanaged"
handler.

https://bugzilla.gnome.org/show_bug.cgi?id=736694
2014-09-16 10:59:45 -04:00
9c465a2d5a Do xwayland/wayland window association in a later, not an idle
g_idle_add() makes no guarantee about when it will be run - if Mutter
is busy drawing and blocking glXSwapBuffers() it could happen only
minutes later.  Use meta_later_add (META_LATER_BEFORE_REDRAW) instead -
this will deterministically be run after the Wayland socket is read
from but before the next frame is painted.

https://bugzilla.gnome.org/show_bug.cgi?id=736694
2014-09-16 10:59:45 -04:00
e53456d87c mutter-test-runner: Make criticals and warnings failures
Tests should not be counted as successful if Mutter is spewing
warnings - hook to the log handler so that we can catch that.
2014-09-16 10:59:45 -04:00
5716fc4b90 test-runner: Add 'csd' keyword for window creation
Allow specifying 'csd' when creating a window to make the client
create a client-side-decorated window.
2014-09-16 10:59:45 -04:00
e926ebafdb Updated Swedish translation 2014-09-15 15:34:10 +00:00
7125b801f2 Makefile-tests: Our test framework requires Wayland 2014-09-15 09:11:38 -06:00
d20dae3553 prefs: Don't listen to the cursor-size key
It will only confuse the code if somebody changes
it. gnome-settings-daemon already listens to this, so just use that.
2014-09-14 23:26:06 -06:00
73a47cec2a [l10n] Updated Catalan (Valencian) translation 2014-09-14 22:15:28 +02:00
514d3b4bde [l10n] Update Catalan translation 2014-09-14 22:15:28 +02:00
6910ab5389 Updated Tamil translation 2014-09-14 19:53:05 +00:00
4052b0f048 Updated Marathi translations 2014-09-14 21:17:19 +05:30
493c0f71d2 prefs: Update cursor size based on xsettings
We shouldn't scale the cursor size in mutter we g-s-d exports
the correct size on hidpi so use gtk-cursor-theme-size.

This way we also catch changes on resolution updates.

https://bugzilla.gnome.org/show_bug.cgi?id=729337
2014-09-14 10:21:46 +02:00
ab40dfdd51 Revert "prefs: Scale the root window cursor by the scale factor"
This reverts commit 4fe66ce0a9.

This is wrong ... we should not scale the cursor size but read
the cursor xsettings that gets exported by gsd. Also this won't update on
resolution changes.

https://bugzilla.gnome.org/show_bug.cgi?id=729337
2014-09-14 10:21:46 +02:00
52678c39e6 update Punjabi Translation - back for 3.14 2014-09-13 21:58:41 -05:00
a676249c0c stack-tracker: Fix an off-by-one error in restack_managed
When restacking the last window alone, we would trigger this off-by-one
error. This would throw us off the end of the array, causing lower_below
warnings for nonsensical values.

Since the last window already is lowered below everything else, we
shouldn't need to lower it.
2014-09-12 17:10:34 -06:00
2833c702c6 stack-tracker: Make lower_below / raise_above internal as well
These are unused elsewhere.
2014-09-12 16:56:27 -06:00
611f6741c2 windows-x11.c: Fix leaked error trap
The merge of the commit af46ef3b 'meta_window_new: clean up error handling'
to the wayland branch accidentally added an extra call to meta_error_trap_push(),
meaning that we leaked one level of error traps for each new window.

Fixes warning:
  Gdk-WARNING **: XSetErrorHandler() called with a GDK error trap pushed.

https://bugzilla.gnome.org/show_bug.cgi?id=736589
2014-09-12 17:28:53 -04:00
df2587a61c Don't pass configure events on the composite overlay window to MetaStackTracker
When the screen resizes, we get a configure event for the composite overlay
window - don't pass that to MetaStackTracker, since the COW isn't in the
stack.

Fixes warning:
 mutter-WARNING **: STACK_OP_RAISE_ABOVE: window 0x65 not in stack
2014-09-12 16:37:20 -04:00
30e7044746 display: Refix return value of set_alarm_filter 2014-09-12 15:12:09 -04:00
458953268b MetaBackground: fix getting stuck in a bad state after monitor changes
After the ::monitors-changed signal, set the dirty flag on each new
monitor information struct so the per-monitor resources will be
recreated.
2014-09-12 14:59:20 -04:00
1c227baf81 display: Fix return value of set_alarm_filter 2014-09-12 12:55:07 -06:00
892699da73 edid: Remove unused declarations 2014-09-12 11:55:08 -06:00
f163a15b13 MetaStackTracker: optimize out unnecessary X restacking
We have a quite accurate view of the X stack, so there's no good reason to ask
the X server to do restacking that has no effect. (Restackings that have no
effect on either X windows or Wayland windows were generally optimized out in
the synchronization code, but in other cases like moving an X window that is
only beneath Wayland windows to the top of the stack we would make such
requests.)

Removing such requests:
 - Is a small efficiency win in itself
 - Allows us to immediately go ahead and apply Wayland changes to the verified stack
 - Prevents queued Wayland changes piling up waiting for an X event that will never
   be received, since the X server will not send confirmation of no-op restacks.

Since such operations may still have an effect on the relative stacking of X
and Wayland windows, we need to continue applying them to the local stack.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
87779ed34e MetaStackTracker: make functions used only internally static
Now that all actual stack shuffle is handled inside stack-tracker.c, we can make
meta_stack_tracker_record_[raise_above/lower_below] internal to that file and
remove the unused meta_stack_tracker_record_lower().

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
04bc846ef3 Move logic for syncing the stack to the X server into MetaStackTracker
stack.c:sync_stack_to_xserver had both code for assembling the desired stack, and
code for enforcing the desired stack on the actual stack of X and Wayland windows;
the latter part is properly the domain of stack-tracker.c; moving the code to
apply the stack there both simplifies it and keeps stack.c more manageable.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
301acac163 stack.c: remove obsolete handling of override-redirect windows
There was still code in stack.c to handle skipping override-redirect windows,
but since quite a while ago, meta_stack_add() is not called for OR windows
since they are outside our stacking control. Add an assertion and remove
unnecessary code.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
9401196e88 Remove cache of last stacking order in stack.c
stack.c kept it's own record of the last stacking it requested, so that
restacking could be done with minimal moves, but we already have a better
view of the stacking order with the stack tracker, so use that instead.

This allows eliminating the special case for the first restack.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
3457366066 Move manipulation of the X stack to MetaStackTracker
Since MetaStackTracker is the code that knows about the current X stacking order
and the relationship between X windows and Wayland windows, it's cleaner to
encapsulate stack manipulation in MetaStackTracker rather than have the calling
code make the X calls and only call into MetaStackTracker to inform it about
the changes.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
cb66cf6398 MetaStackTracker: eliminate the resynchronization process
The step where we requery the stacking order from the server than combine
it in an arbitrary fashion with Wayland windows can be eliminated by observing
that we are the final authority for Wayland window stacking - so if we
apply each X event that we receive from the X server to our stack in a
way that leaves the X windows ordered in the same way as on the server,
and apply events that we have stored locally in a way that doesn't affect
the ordering of X windows, than we have a fully correct ordering of windows.

Ordering this in the order of first applying the X event and then applying the
local portion also means that as long as we had an up-to-date view of the X
stack the composite operation will be identical to what was requested.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
73573a85de Replace MetaStackWindow with a 64-bit "stack ID"
Putting X windows and pointers to MetaWindows into a union had a number of
problems:

 - It caused awkward initialization and conditionalization
 - There was no way to refer to Wayland windows (represented by
   MetaWindow *) in the past, which is necessary for the MetaStackTracker
   algorithms
 - We never even cleaned up old MetaStackWindow so there could be
   records in MetaStackWindow pointing to freed MetaWindow.

Replace MetaStackWindow with a 64-bit "stack ID" which is:

 - The XID for X Windows
 - a "window stamp" for Wayland windows - window stamps are assigned
   for all MetaWindow and are unique across the life of the process.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
b49a4ae0bc Add missing file from test framework
mutter-all.test.in was accidentally not committed.
2014-09-12 13:40:33 -04:00
2f63c39fa6 Add a test framework and stacking tests
Add a basic framework for tests of Mutter handling of client behavior;
mutter-test-runner is a Mutter-based compositor that forks off instances
of mutter-test-client and sends commands to them based on scripts.
The scripts also include assertions.

mutter-test-runner always runs in nested-Wayland mode since the separate
copy of Xwayland is helpful in giving a reliably clean X server to
test against.

Initially the commands and assertions are designed to test the stacking
behavior of Mutter, but the framework should be extensible to test other
parts of client behavior like focus.

The tests are installed according to:

https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests

if --enable-installed-tests is passed to configure. You can run them
uninstalled with:

 cd src && make run-tests

(Not in 'make check' to avoid breaking 'make distcheck' if Mutter can't be
run nested.)

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 13:14:51 -04:00
95d9a95b2b Add meta_ui_window_is_dummy()
For reasons related to interaction between the GTK+ CSS code and the
frame sync protocol, the dummy GtkWindow that MetaUI creates to track
theme properties has to be mapped and have MetaWindow associated with it.
Add a private function so that the test framework can filter this out.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
44ecb1c050 Add meta_display_set_alarm_filter()
Add a private hook for the test framework to get XSyncAlarmEvent events -
this will be used to implement XSyncCounter based synchronization
so that the test framework can deterministically wait until Mutter
has seen actions performed by an X11 client.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
0706de5378 Add meta_wayland_get_[x]wayland_display_name
Add private functions for the test framework to use to find out the
wayland and x11 display names, so they can set up the environment for
children.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
9dd9938c38 Remove obsolete mutter-test script
mutter-test was a script that was used to run various test on the
Metacity source tree (build with different options, etc.) This likely
hasn't been run once since the Metacity/Mutter branch point; remove
it to avoid confusion with the new test framework in src/tests.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
e27bbdc769 Fix colors for horizontal background gradients
COGL_PIXEL_FORMAT_RGB_888 is packed 3-bytes per pixel.
2014-09-12 11:00:55 -04:00
09b46029fa Fix multi-monitor backgrounds
The texture area was meant to be in monitor-relative coordinates, but that
was not consistently followed throughout the code - fix.

https://bugzilla.gnome.org/show_bug.cgi?id=736568
2014-09-12 11:00:55 -04:00
5c289b7eab Updated gujarati translations 2014-09-12 11:50:14 +05:30
656573c5d2 wayland-keyboard: Handle keymap-layout-group-changed signal
We need to send a modifiers event to wayland clients when the layout
group changes.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
59c5ac0cb5 backends: Add a keymap-layout-group-changed signal
We'll need this in the wayland frontend to send a modifiers event to
clients.

Note that on X11 this isn't needed because key events include the
group index encoded in modifier state. If we ever want to make the
wayland frontend work with the X11 backend we'll handle it then.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
53092424e6 wayland-keyboard: Handle keymap-changed signal
We need to inform wayland clients of new keymaps.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
6ba0491adf keybindings: Freeze and ungrab the keyboard only on X11 backend
This isn't needed in the native backend because we control all the
input event flow there.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
e3fb9e4cee Updated Hungarian translation 2014-09-11 16:21:32 +00:00
8d53ae894b window-actor: Skip frame-sync when the corresponding window is gone
https://bugzilla.gnome.org/show_bug.cgi?id=735927
2014-09-11 16:50:23 +01:00
d50f8afa9e window-actor: Consider needs_destroy in is_destroyed()
According to the documentation, the method returns "whether the X window
that the actor was displaying has been destroyed" - that is very much
true when we delay the actual actor destruction for a destroy animation,
so update the method accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=735927
2014-09-11 16:50:23 +01:00
98fa343588 window-actor: Keep in compositor's window list until destroyed
When a window is destroyed, the corresponding actor may still be
kept around for the destroy effect. But as the actor is removed
from the compositor's stack list immediately, the compositor will
always stack it above "valid" window actors - this is not what we
want, so only update the compositor's list when the actor is
actually destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=735927
2014-09-11 16:50:23 +01:00
9ceb3fbb9a Updated Lithuanian translation 2014-09-10 20:22:58 +03:00
22d95546a7 Updated Russian translation 2014-09-09 16:58:50 +04:00
33689ec558 Moving setting of window-scaling-factor to meta_clutter_init()
Setting the scaling factor immediately after calling clutter_init()
avoids creating the stage at one size, then later resizing it to
a different size.

https://bugzilla.gnome.org/show_bug.cgi?id=736279
2014-09-08 14:40:50 -04:00
602dd7fdf2 MetaBackendX11: Don't XResizeWindow behind clutter's back
In the case of a nested Wayland compositor inside an X session,
Clutter is managing the toplevel window size, so don't call
XResizeWindow on it - this will confuse Clutter and get the size
and the hints out of sync on the toplevel window.

https://bugzilla.gnome.org/show_bug.cgi?id=736279
2014-09-08 14:40:50 -04:00
7f15c995b7 Finnish translation update by Jiri Grönroos 2014-09-07 13:44:39 +03:00
9be3e56b70 background: Fix monitor validation in get_texture()
Monitor indexes should be in the range [0, n], not [-1, 0] :-)
2014-09-06 18:22:56 +02:00
24119b8a9c Updated Norwegian bokmål translation. 2014-09-06 14:13:15 +02:00
4d75de006c wayland: Don't set_focus when the device has been released
It's possible for a released pointer to have repick / set_focus on it as
part of sync_input_focus. When the pointer is actually re-init'd, it
will memset 0, which can cause corruption as our destroy listener has
already been added.

Released devices should be idempotent, so just make sure method calls on
them don't have any effect.
2014-09-05 18:05:44 -07:00
e19516ec5a wayland: Don't set_focus for new resources
Otherwise, we can re-add the destroy listener, which can cause
corruption.

Instead, split out the broadcast function, and use that.
2014-09-05 17:58:15 -07:00
1ed607f398 wayland-surface: Make bad xdg-shell versions crash the client
Otherwise, we might continue with weird semantics.
2014-09-05 16:21:43 -07:00
7e0822c5b1 background-actor: Add missing paren 2014-09-05 13:51:21 -07:00
037c3438a3 meta-monitor-config: Fix small whitespace issue 2014-09-05 09:50:37 -07:00
cde5d4acfa Updated Korean translation 2014-09-05 06:28:38 +09:00
d79db68bf8 workspace: Clean up code style 2014-09-04 13:55:51 -07:00
b3b9d9e161 stack: Never focus unmanaging windows
We can enter weird states where get_default_window is called during
window unmanagement, before the window has been fully removed from
the stack. Make sure these windows are *never* returned from
get_default_window, as focusing them can cause an assertion fail,
or worse.
2014-09-04 13:53:06 -07:00
3f1f1645c7 backend: Fix build
I keep forgetting to squash.
2014-09-04 13:19:13 -07:00
18a82688e2 backend: Create the core device monitor
Otherwise, nothing will ever create it.
2014-09-04 13:15:03 -07:00
27d6b2645e meta-backend: Fix the max device calculation on removal
If we add device 2, then add device 254, then remove device 254, then
the max device ID will be 253. Scan through all the devices again on
removal to calculate a new max device ID.
2014-09-04 12:17:15 -07:00
fee40353e2 meta-backend: Fix build 2014-09-04 12:15:50 -07:00
659360d543 backend: Pre-emptively create idle monitors based on clutter events
Rather than have the DBus code control this, move this into
MetaBackend. This also lets us destroy idle monitors when appropriate,
rather than leaking them forever.
2014-09-04 12:06:03 -07:00
3ea6424b8f background: Fix meta_background_new
This is used by the default plugin.
2014-09-03 19:55:15 -07:00
96bee8e60d Conditionalize some more Wayland support 2014-09-03 19:51:02 -07:00
883c4a7b0f background-actor: Add a simple paint volume
Not having a paint volume causes every single paint to turn into
full-stage redraw, since otherwise culling won't properly work.

Since we don't paint outside of our allocation, just use the simple
default implementation, but also return TRUE inside it.
2014-09-03 11:08:48 -07:00
d4317ba1e4 background: Fix build
These warnings weren't properly working on Owen's machine, so they went
unchecked.
2014-09-03 11:03:17 -07:00
9d69b2a963 MetaBackground: add properties to set vignette settings
Make the vignette options properties so they can be animated;
modify the function-call API for meta_background_actor_set_vignette()
to correspond more closely to the 3 properties.

https://bugzilla.gnome.org/show_bug.cgi?id=735637
2014-09-03 13:43:40 -04:00
ef3b000050 MetaBackgroundActor: match total dimming if GLSL is not present
Without GLSL, we didn't apply the vignetting, which not only made the
background uniform in color, it made it much lighter. Adjust for this
and make the average brightness with the vignette effect the same
with or without GLSL.

https://bugzilla.gnome.org/show_bug.cgi?id=735637
2014-09-03 13:43:40 -04:00
a4a688ed83 Rewrite background code
The old requirement that multiple MetaBackgroundActor objects be
layered on top of each to produce blended backgrounds resulted in
extremely inefficient drawing since the entire framebuffer had
to be read and written multiple times.

 * Replace the MetaBackground ClutterContent with a plain GObject
   that serves to hold the background parameters and prerender
   textures to be used to draw the background. It handles
   colors, gradients, and blended images, but does not handle
   vignetting

 * Add vignetting to MetaBackgroundActor directly.

 * Add MetaBackgroundImage and MetaBackgroundImageCache to allow
   multiple MetaBackground objects to share the same images

By removing the usage of ClutterContent, the following optimizations
were easy to add:

 Blending is turned off when the actor is fully opaque
 Nearest-neighbour filtering is used when drawing 1:1

The GLSL vignette code is slightly improved to use a vertex shader
snippet for computing the texture coordinate => position in actor
mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=735637
2014-09-03 13:43:40 -04:00
17dc5c57dd Use meta_actor_painting_untransformed() for MetaShapedTexture
The old check for using NEAREST by checking clutter_actor_is_in_clone_paint()
and meta_actor_is_untransformed (actor) doesn't work properly since
clutter_actor_is_in_clone_paint() does not look at ancestors of the
actor; it only applies to a direct clone of the actor. Using
meta_actor_painting_untransformed() allows us to check exactly what we
care about rather than using tricky approximations.

https://bugzilla.gnome.org/show_bug.cgi?id=735632
2014-09-03 13:43:40 -04:00
ef5f939db8 Factor out meta_actor_painting_untransformed()
The painting_untransformed() function in MetaWindowGroup is useful
elsewhere, in particular if we want to check whether we can avoid
bilinear filtering when painting a texture 1:1.

https://bugzilla.gnome.org/show_bug.cgi?id=735632
2014-09-03 13:43:40 -04:00
cb4751da4c Updated Polish translation 2014-09-03 16:02:48 +02:00
0685f17f73 Updated Indonesian translation 2014-09-03 13:56:49 +00:00
4b260d5d9f Bump version to 3.13.91
Update NEWS
2014-09-03 14:03:45 +02:00
c8f015c6d7 keybindings: Ignore extra modifier bits when matching iso_next_group
Clutter events include the layout index codified into modifier_state,
unlike XI2 device events, which means that we need to mask it out so
that we can match successfully.
2014-09-02 18:11:31 +02:00
87 changed files with 17969 additions and 19789 deletions

3
.gitignore vendored
View File

@ -44,6 +44,9 @@ po/*.pot
libmutter.pc
mutter
mutter-restart-helper
mutter-test-client
mutter-test-runner
mutter-all.test
org.gnome.mutter.gschema.valid
org.gnome.mutter.gschema.xml
org.gnome.mutter.wayland.gschema.valid

48
NEWS
View File

@ -1,3 +1,51 @@
3.14.0
======
* Fix placement of popup windows on wayland [Jasper; #736812]
* Only increment serial once per event [Jasper; #736840]
* Fix window positioning regression with non-GTK+ toolkits [Owen; #736719]
Contributors:
Jasper St. Pierre, Owen W. Taylor
Translations:
Saibal Ray [bn_IN], Dušan Kazik [sk], Manoj Kumar Giri [or],
Christian Kirbach [de], Ask H. Larsen [da], YunQiang Su [zh_CN],
Bernd Homuth [de], Shankar Prasad [kn], Petr Kovar [cs], Rajesh Ranjan [hi]
3.13.92
=======
* Rewrite background code [Owen; #735637, #736568]
* Fix size in nested mode [Owen; #736279]
* Fix destroy animation of background windows [Florian; #735927]
* Wire keymap changes up to the wayland frontend [Rui; #736433]
* Add a test framework and stacking tests [Owen; #736505]
* Simplify handling of the merged X and wayland stack [Owen; #736559]
* Fix cursor size on HiDPI [Adel; #729337]
* Misc. bug fixes [Owen; #735632, #736589, #736694]
Contributors:
Adel Gadllah, Rui Matos, Florian Müllner, Jasper St. Pierre, Owen W. Taylor
Translations:
Andika Triwidada [id], Piotr Drąg [pl], Changwoo Ryu [ko],
Kjartan Maraas [nb], Ville-Pekka Vainio [fi], Yuri Myasoedov [ru],
Aurimas Černius [lt], Balázs Úr [hu], Sweta Kothari [gu], A S Alam [pa],
Sandeep Sheshrao Shedmake [mr], Shantha kumar [ta], Gil Forcada [ca],
Carles Ferrando [ca@valencia], Mattias Eriksson [sv]
3.13.91
=======
* Misc. bug fixes [Carlos; #735452]
Contributors:
Adel Gadllah, Carlos Garnacho, Rui Matos, Jasper St. Pierre,
Rico Tzschichholz
Translations:
Chao-Hsiung Liao po/zh_HK, zh_TW.po, Enrico Nicoletto [pt_BR],
Kjartan Maraas [nb], Fran Diéguez [gl], Yosef Or Boczko [he],
Maria Mavridou [el], Claude Paroz [fr]
3.13.90
=======
* Only call XSync() once per frame [Rui; #728464]

View File

@ -1,8 +1,8 @@
AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [13])
m4_define([mutter_micro_version], [90])
m4_define([mutter_minor_version], [14])
m4_define([mutter_micro_version], [0])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@ -127,6 +127,12 @@ AC_ARG_WITH([xwayland-path],
[XWAYLAND_PATH="$withval"],
[XWAYLAND_PATH="$bindir/Xwayland"])
AC_ARG_ENABLE(installed_tests,
AS_HELP_STRING([--enable-installed-tests],
[Install test programs (default: no)]),,
[enable_installed_tests=no])
AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
## here we get the flags we'll actually use
# Unconditionally use this dir to avoid a circular dep with gnomecc

View File

@ -111,6 +111,13 @@ IGNORE_HFILES= \
xprops.h \
$(NULL)
if !HAVE_WAYLAND
IGNORE_HFILES += \
meta-surface-actor-wayland.h \
wayland \
$(NULL)
endif
MKDB_OPTIONS+=--ignore-files="$(IGNORE_HFILES)"
# Images to copy into HTML directory.

File diff suppressed because it is too large Load Diff

1068
po/ca.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1284
po/cs.po

File diff suppressed because it is too large Load Diff

1298
po/da.po

File diff suppressed because it is too large Load Diff

1530
po/de.po

File diff suppressed because it is too large Load Diff

176
po/fi.po
View File

@ -7,15 +7,15 @@
# Gnome 2012-03 Finnish translation sprint participants:
# Pauli Virtanen <pauli.virtanen@hut.fi>, 2003-2005.
# Tommi Vainikainen <thv@iki.fi>, 2011.
# Jiri Grönroos <jiri.gronroos+l10n@iki.fi>, 2012, 2013.
# Jiri Grönroos <jiri.gronroos+l10n@iki.fi>, 2012, 2013, 2014.
#
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: 2014-08-08 21:51+0000\n"
"PO-Revision-Date: 2013-09-06 22:23+0300\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2014-09-06 21:56+0000\n"
"PO-Revision-Date: 2014-09-07 12:25+0300\n"
"Last-Translator: Jiri Grönroos <jiri.gronroos+l10n@iki.fi>\n"
"Language-Team: suomi <gnome-fi-laatu@lists.sourceforge.net>\n"
"Language: fi\n"
@ -47,10 +47,9 @@ msgid "Move window to workspace 4"
msgstr "Siirrä ikkuna työtilaan 4"
#: ../data/50-mutter-navigation.xml.in.h:6
#, fuzzy
#| msgid "Move window to workspace 1"
msgid "Move window to last workspace"
msgstr "Siirrä ikkuna työtilaan 1"
msgstr "Siirrä ikkuna viimeiseen työtilaan"
#: ../data/50-mutter-navigation.xml.in.h:7
msgid "Move window one workspace to the left"
@ -69,98 +68,128 @@ msgid "Move window one workspace down"
msgstr "Siirrä ikkunaa yksi työtila alas"
#: ../data/50-mutter-navigation.xml.in.h:11
#, fuzzy
#| msgid "Move window one workspace to the left"
msgid "Move window one monitor to the left"
msgstr "Siirrä ikkunaa yksi työtila vasemmalle"
msgstr "Siirrä ikkuna yhden näytön verran vasemmalle"
#: ../data/50-mutter-navigation.xml.in.h:12
#, fuzzy
#| msgid "Move window one workspace to the right"
msgid "Move window one monitor to the right"
msgstr "Siirrä ikkunaa yksi työtila oikealle"
msgstr "Siirrä ikkuna yhden näytön verran oikealle"
#: ../data/50-mutter-navigation.xml.in.h:13
#, fuzzy
#| msgid "Move window one workspace up"
msgid "Move window one monitor up"
msgstr "Siirrä ikkunaa yksi työtila ylös"
msgstr "Siirrä ikkuna yhden näytön verran ylös"
#: ../data/50-mutter-navigation.xml.in.h:14
#, fuzzy
#| msgid "Move window one workspace down"
msgid "Move window one monitor down"
msgstr "Siirrä ikkunaa yksi työtila alas"
msgstr "Siirrä ikkuna yhden näytön verran alas"
#: ../data/50-mutter-navigation.xml.in.h:15
msgid "Switch applications"
msgstr "Vaihda sovelluksia"
#: ../data/50-mutter-navigation.xml.in.h:16
#| msgid "Switch applications"
msgid "Switch to previous application"
msgstr "Vaihda edelliseen sovellukseen"
#: ../data/50-mutter-navigation.xml.in.h:17
msgid "Switch windows"
msgstr "Vaihda ikkunoita"
#: ../data/50-mutter-navigation.xml.in.h:17
#: ../data/50-mutter-navigation.xml.in.h:18
#| msgid "Switch windows"
msgid "Switch to previous window"
msgstr "Vaihda edelliseen ikkunaan"
#: ../data/50-mutter-navigation.xml.in.h:19
msgid "Switch windows of an application"
msgstr "Vaihda sovelluksen ikkunoiden välillä"
#: ../data/50-mutter-navigation.xml.in.h:18
#: ../data/50-mutter-navigation.xml.in.h:20
#| msgid "Switch windows of an application"
msgid "Switch to previous window of an application"
msgstr "Vaihda sovelluksen edelliseen ikkunaan"
#: ../data/50-mutter-navigation.xml.in.h:21
#, fuzzy
msgid "Switch system controls"
msgstr "Vaihda järjestelmän kontrolleja"
#: ../data/50-mutter-navigation.xml.in.h:19
#: ../data/50-mutter-navigation.xml.in.h:22
#, fuzzy
msgid "Switch to previous system control"
msgstr "Vaihda järjestelmän kontrolleja"
#: ../data/50-mutter-navigation.xml.in.h:23
msgid "Switch windows directly"
msgstr "Vaihda ikkunoita suoraan"
#: ../data/50-mutter-navigation.xml.in.h:20
#: ../data/50-mutter-navigation.xml.in.h:24
msgid "Switch directly to previous window"
msgstr "Vaihda suoraan edelliseen ikkunaan"
#: ../data/50-mutter-navigation.xml.in.h:25
msgid "Switch windows of an app directly"
msgstr "Vaihda sovelluksen ikkunoiden välillä suoraan"
#: ../data/50-mutter-navigation.xml.in.h:21
#: ../data/50-mutter-navigation.xml.in.h:26
#, fuzzy
#| msgid "Switch windows of an application"
msgid "Switch directly to previous window of an app"
msgstr "Vaihda sovelluksen ikkunoiden välillä"
#: ../data/50-mutter-navigation.xml.in.h:27
#, fuzzy
msgid "Switch system controls directly"
msgstr "Vaihda järjestelmän kontrolleja suoraan"
#: ../data/50-mutter-navigation.xml.in.h:22
#: ../data/50-mutter-navigation.xml.in.h:28
#, fuzzy
msgid "Switch directly to previous system control"
msgstr "Vaihda järjestelmän kontrolleja"
#: ../data/50-mutter-navigation.xml.in.h:29
msgid "Hide all normal windows"
msgstr "Piilota kaikki tavalliset ikkunat"
#: ../data/50-mutter-navigation.xml.in.h:23
#: ../data/50-mutter-navigation.xml.in.h:30
msgid "Switch to workspace 1"
msgstr "Siirry työtilaan 1"
#: ../data/50-mutter-navigation.xml.in.h:24
#: ../data/50-mutter-navigation.xml.in.h:31
msgid "Switch to workspace 2"
msgstr "Siirry työtilaan 2"
#: ../data/50-mutter-navigation.xml.in.h:25
#: ../data/50-mutter-navigation.xml.in.h:32
msgid "Switch to workspace 3"
msgstr "Siirry työtilaan 3"
#: ../data/50-mutter-navigation.xml.in.h:26
#: ../data/50-mutter-navigation.xml.in.h:33
msgid "Switch to workspace 4"
msgstr "Siirry työtilaan 4"
#: ../data/50-mutter-navigation.xml.in.h:27
#, fuzzy
#: ../data/50-mutter-navigation.xml.in.h:34
#| msgid "Switch to workspace 1"
msgid "Switch to last workspace"
msgstr "Siirry työtilaan 1"
msgstr "Siirry viimeiseen työtilaan"
#: ../data/50-mutter-navigation.xml.in.h:28
#: ../data/50-mutter-navigation.xml.in.h:35
msgid "Move to workspace left"
msgstr "Siirrä vasemmalla olevaan työtilaan"
#: ../data/50-mutter-navigation.xml.in.h:29
#: ../data/50-mutter-navigation.xml.in.h:36
msgid "Move to workspace right"
msgstr "Siirrä oikealla olevaan työtilaan"
#: ../data/50-mutter-navigation.xml.in.h:30
#: ../data/50-mutter-navigation.xml.in.h:37
msgid "Move to workspace above"
msgstr "Siirrä yllä olevaan työtilaan"
#: ../data/50-mutter-navigation.xml.in.h:31
#: ../data/50-mutter-navigation.xml.in.h:38
msgid "Move to workspace below"
msgstr "Siirrä alla olevaan työtilaan"
@ -369,7 +398,7 @@ msgstr ""
#: ../data/org.gnome.mutter.gschema.xml.in.h:19
msgid "Place new windows in the center"
msgstr ""
msgstr "Aseta uudet ikkunat keskelle näyttöä"
#: ../data/org.gnome.mutter.gschema.xml.in.h:20
msgid ""
@ -387,62 +416,53 @@ msgid "Cancel tab popup"
msgstr ""
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:1
#, fuzzy
#| msgid "Switch to workspace 1"
msgid "Switch to VT 1"
msgstr "Siirry työtilaan 1"
msgstr "Siirry virtuaalikonsoliin 1"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:2
#, fuzzy
#| msgid "Switch to workspace 2"
msgid "Switch to VT 2"
msgstr "Siirry työtilaan 2"
msgstr "Siirry virtuaalikonsoliin 2"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:3
#, fuzzy
#| msgid "Switch to workspace 3"
msgid "Switch to VT 3"
msgstr "Siirry työtilaan 3"
msgstr "Siirry virtuaalikonsoliin 3"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:4
#, fuzzy
#| msgid "Switch to workspace 4"
msgid "Switch to VT 4"
msgstr "Siirry työtilaan 4"
msgstr "Siirry virtuaalikonsoliin 4"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:5
#, fuzzy
#| msgid "Switch to workspace 1"
msgid "Switch to VT 5"
msgstr "Siirry työtilaan 1"
msgstr "Siirry virtuaalikonsoliin 5"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:6
#, fuzzy
#| msgid "Switch to workspace 1"
msgid "Switch to VT 6"
msgstr "Siirry työtilaan 1"
msgstr "Siirry virtuaalikonsoliin 6"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:7
#, fuzzy
#| msgid "Switch to workspace 1"
msgid "Switch to VT 7"
msgstr "Siirry työtilaan 1"
msgstr "Siirry virtuaalikonsoliin 7"
#: ../src/backends/meta-monitor-manager.c:412
msgid "Built-in display"
msgstr "Sisäänrakennettu näyttö"
#: ../src/backends/meta-monitor-manager.c:437
#, fuzzy
#| msgid "Unknown %s"
msgid "Unknown"
msgstr "Tuntematon %s"
msgstr "Tuntematon"
#: ../src/backends/meta-monitor-manager.c:439
#, fuzzy
#| msgid "Unknown %s"
msgid "Unknown Display"
msgstr "Tuntematon %s"
msgstr "Tuntematon näyttö"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
@ -450,23 +470,19 @@ msgstr "Tuntematon %s"
#: ../src/backends/meta-monitor-manager.c:447
#, c-format
msgid "%s %s"
msgstr ""
msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: ../src/compositor/compositor.c:450
#: ../src/compositor/compositor.c:443
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display \""
"%s\"."
"Another compositing manager is already running on screen %i on display \"%s"
"\"."
msgstr ""
"Näytön ”%2$s” ruudullä %1$d on jo käynnissä toinen ikkunoidenladontaohjelman."
#: ../src/compositor/meta-background.c:1044
msgid "background texture could not be created from file"
msgstr ""
#: ../src/core/bell.c:214
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "Äänimerkki"
@ -494,49 +510,49 @@ msgstr "_Odota"
msgid "_Force Quit"
msgstr "Sulje _väkisin"
#: ../src/core/display.c:539
#: ../src/core/display.c:547
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "X-ikkunointijärjestelmän näytön ”%s” avaaminen epäonnistui\n"
#: ../src/core/main.c:172
#: ../src/core/main.c:176
msgid "Disable connection to session manager"
msgstr "Estä yhteys sessionhallintaan"
#: ../src/core/main.c:178
#: ../src/core/main.c:182
msgid "Replace the running window manager"
msgstr "Vaihda käytössä oleva ikkunanhallinta"
#: ../src/core/main.c:184
#: ../src/core/main.c:188
msgid "Specify session management ID"
msgstr "Anna sessionhallinnan ID"
#: ../src/core/main.c:189
#: ../src/core/main.c:193
msgid "X Display to use"
msgstr "Käytettävä X-näyttö"
#: ../src/core/main.c:195
#: ../src/core/main.c:199
msgid "Initialize session from savefile"
msgstr "Alusta sessio tiedostosta"
#: ../src/core/main.c:201
#: ../src/core/main.c:205
msgid "Make X calls synchronous"
msgstr "Käytä synkronisia X-kutsuja"
#: ../src/core/main.c:207
#: ../src/core/main.c:212
msgid "Run as a wayland compositor"
msgstr ""
msgstr "Suorita wayland-koostajana"
#: ../src/core/main.c:214
#: ../src/core/main.c:220
msgid "Run as a full display server, rather than nested"
msgstr ""
#: ../src/core/main.c:450
#: ../src/core/main.c:459
#, c-format
msgid "Failed to scan themes directory: %s\n"
msgstr "Teemakansion lukeminen epäonnistui: %s\n"
#: ../src/core/main.c:466
#: ../src/core/main.c:475
#, c-format
msgid ""
"Could not find a theme! Be sure %s exists and contains the usual themes.\n"
@ -567,17 +583,17 @@ msgstr "Näytä versio"
msgid "Mutter plugin to use"
msgstr "Käytettävä Mutter-liitännäinen"
#: ../src/core/prefs.c:2102
#: ../src/core/prefs.c:2101
#, c-format
msgid "Workspace %d"
msgstr "Työtila %d"
#: ../src/core/screen.c:553
#: ../src/core/screen.c:548
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Näytön ”%2$s” ruutu %1$d ei ole kelvollinen\n"
#: ../src/core/screen.c:569
#: ../src/core/screen.c:564
#, c-format
msgid ""
"Screen %d on display \"%s\" already has a window manager; try using the --"
@ -586,7 +602,7 @@ msgstr ""
"Näytön ”%2$s” ruudulla %1$d on jo ikkunointiohjelma: kokeile valitsinta --"
"replace, jos haluat korvata nykyisen ikkunointiohjelman.\n"
#: ../src/core/screen.c:662
#: ../src/core/screen.c:657
#, c-format
msgid "Screen %d on display \"%s\" already has a window manager\n"
msgstr "Näytön ”%2$s” ruudulla %1$d on jo ikkunointiohjelma\n"
@ -650,8 +666,8 @@ msgid ""
"GTK custom color specification must have color name and fallback in "
"parentheses, e.g. gtk:custom(foo,bar); could not parse \"%s\""
msgstr ""
"GTK-värimääritteessä täytyy olla värin nimi ja vara-arvo suluissa, esim. "
"gtk:custom(foo,bar). ”%s” ei jäsenny"
"GTK-värimääritteessä täytyy olla värin nimi ja vara-arvo suluissa, esim. gtk:"
"custom(foo,bar). ”%s” ei jäsenny"
#: ../src/ui/theme.c:1227
#, c-format
@ -683,8 +699,8 @@ msgstr ""
#: ../src/ui/theme.c:1300
#, c-format
msgid ""
"GTK color specification must have a close bracket after the state, e.g. "
"gtk:fg[NORMAL] where NORMAL is the state; could not parse \"%s\""
"GTK color specification must have a close bracket after the state, e.g. gtk:"
"fg[NORMAL] where NORMAL is the state; could not parse \"%s\""
msgstr ""
"GTK-värimääritteessä täytyy olla loppuhakasulku tilan jälkeen. Esimerkiksi "
"gtk:fg[NORMAL], jossa NORMAL on tila. ”%s” ei jäsenny"

1751
po/gu.po

File diff suppressed because it is too large Load Diff

1942
po/hi.po

File diff suppressed because it is too large Load Diff

1333
po/hu.po

File diff suppressed because it is too large Load Diff

926
po/id.po

File diff suppressed because it is too large Load Diff

1966
po/kn.po

File diff suppressed because it is too large Load Diff

1022
po/ko.po

File diff suppressed because it is too large Load Diff

157
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: 2014-07-05 09:54+0000\n"
"PO-Revision-Date: 2014-07-05 13:56+0300\n"
"POT-Creation-Date: 2014-09-10 09:53+0000\n"
"PO-Revision-Date: 2014-09-10 20:22+0300\n"
"Last-Translator: Aurimas Černius <aurisc4@gmail.com>\n"
"Language-Team: Lietuvių <gnome-lt@lists.akl.lt>\n"
"Language: lt\n"
@ -46,7 +46,6 @@ msgid "Move window to workspace 4"
msgstr "Perkelti langą į darbalaukį Nr.4"
#: ../data/50-mutter-navigation.xml.in.h:6
#| msgid "Move window to workspace 1"
msgid "Move window to last workspace"
msgstr "Perkelti langą į pastarąjį darbalaukį"
@ -84,70 +83,103 @@ msgstr "Perkelti langą į žemiau esantį monitorių"
#: ../data/50-mutter-navigation.xml.in.h:15
msgid "Switch applications"
msgstr "Persijungti tarp programų"
msgstr "Pereiti tarp programų"
#: ../data/50-mutter-navigation.xml.in.h:16
msgid "Switch windows"
msgstr "Persijungti tarp langų"
#| msgid "Switch applications"
msgid "Switch to previous application"
msgstr "Pereiti į ankstesnę programą"
#: ../data/50-mutter-navigation.xml.in.h:17
msgid "Switch windows of an application"
msgstr "Persijungti tarp programos langų"
msgid "Switch windows"
msgstr "Pereiti tarp langų"
#: ../data/50-mutter-navigation.xml.in.h:18
msgid "Switch system controls"
msgstr "Persijungti tarp sistemos valdiklių"
#| msgid "Switch windows"
msgid "Switch to previous window"
msgstr "Pereiti į ankstesnį langą"
#: ../data/50-mutter-navigation.xml.in.h:19
msgid "Switch windows directly"
msgstr "Tiesiogiai persijungti tarp langų"
msgid "Switch windows of an application"
msgstr "Pereiti tarp programos langų"
#: ../data/50-mutter-navigation.xml.in.h:20
msgid "Switch windows of an app directly"
msgstr "Tiesiogiai persijungti tarp programos langų"
#| msgid "Switch windows of an application"
msgid "Switch to previous window of an application"
msgstr "Pereiti į ankstesnį programos langą"
#: ../data/50-mutter-navigation.xml.in.h:21
msgid "Switch system controls directly"
msgstr "Tiesiogiai persijungti tarp sistemos valdiklių"
msgid "Switch system controls"
msgstr "Pereiti tarp sistemos valdiklių"
#: ../data/50-mutter-navigation.xml.in.h:22
#| msgid "Switch system controls"
msgid "Switch to previous system control"
msgstr "Pereiti prie ankstesnio sistemos valdiklio"
#: ../data/50-mutter-navigation.xml.in.h:23
msgid "Switch windows directly"
msgstr "Tiesiogiai pereiti tarp langų"
#: ../data/50-mutter-navigation.xml.in.h:24
msgid "Switch directly to previous window"
msgstr "Tiesiogiai pereiti į ankstesnį langą"
#: ../data/50-mutter-navigation.xml.in.h:25
msgid "Switch windows of an app directly"
msgstr "Tiesiogiai pereiti tarp programos langų"
#: ../data/50-mutter-navigation.xml.in.h:26
#| msgid "Switch windows of an application"
msgid "Switch directly to previous window of an app"
msgstr "Tiesiogiai pereiti prie ankstesnio programos lango"
#: ../data/50-mutter-navigation.xml.in.h:27
msgid "Switch system controls directly"
msgstr "Tiesiogiai pereiti tarp sistemos valdiklių"
#: ../data/50-mutter-navigation.xml.in.h:28
#| msgid "Switch system controls"
msgid "Switch directly to previous system control"
msgstr "Tiesiogiai pereiti prie ankstesnio sistemos valdiklio"
#: ../data/50-mutter-navigation.xml.in.h:29
msgid "Hide all normal windows"
msgstr "Paslėpti visus įprastinius langus"
#: ../data/50-mutter-navigation.xml.in.h:23
#: ../data/50-mutter-navigation.xml.in.h:30
msgid "Switch to workspace 1"
msgstr "Persijungti į darbalaukį Nr.1"
#: ../data/50-mutter-navigation.xml.in.h:24
#: ../data/50-mutter-navigation.xml.in.h:31
msgid "Switch to workspace 2"
msgstr "Persijungti į darbalaukį Nr.2"
#: ../data/50-mutter-navigation.xml.in.h:25
#: ../data/50-mutter-navigation.xml.in.h:32
msgid "Switch to workspace 3"
msgstr "Persijungti į darbalaukį Nr.3"
#: ../data/50-mutter-navigation.xml.in.h:26
#: ../data/50-mutter-navigation.xml.in.h:33
msgid "Switch to workspace 4"
msgstr "Persijungti į darbalaukį Nr.4"
#: ../data/50-mutter-navigation.xml.in.h:27
#| msgid "Switch to workspace 1"
#: ../data/50-mutter-navigation.xml.in.h:34
msgid "Switch to last workspace"
msgstr "Persijungti į pastarąjį darbalaukį"
#: ../data/50-mutter-navigation.xml.in.h:28
#: ../data/50-mutter-navigation.xml.in.h:35
msgid "Move to workspace left"
msgstr "Perkelti į darbalaukį kairėje"
#: ../data/50-mutter-navigation.xml.in.h:29
#: ../data/50-mutter-navigation.xml.in.h:36
msgid "Move to workspace right"
msgstr "Perkelti į darbalaukį dešinėje"
#: ../data/50-mutter-navigation.xml.in.h:30
#: ../data/50-mutter-navigation.xml.in.h:37
msgid "Move to workspace above"
msgstr "Perkelti į darbalaukį viršuje"
#: ../data/50-mutter-navigation.xml.in.h:31
#: ../data/50-mutter-navigation.xml.in.h:38
msgid "Move to workspace below"
msgstr "Perkelti į darbalaukį apačioje"
@ -384,37 +416,30 @@ msgid "Cancel tab popup"
msgstr "Atšaukti tab iššokimą"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:1
#| msgid "Switch to workspace 1"
msgid "Switch to VT 1"
msgstr "Persijungti į VT 1"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:2
#| msgid "Switch to workspace 2"
msgid "Switch to VT 2"
msgstr "Persijungti į VT 2"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:3
#| msgid "Switch to workspace 3"
msgid "Switch to VT 3"
msgstr "Persijungti į VT 3"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:4
#| msgid "Switch to workspace 4"
msgid "Switch to VT 4"
msgstr "Persijungti į VT 4"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:5
#| msgid "Switch to workspace 1"
msgid "Switch to VT 5"
msgstr "Persijungti į VT 5"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:6
#| msgid "Switch to workspace 1"
msgid "Switch to VT 6"
msgstr "Persijungti į VT 6"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:7
#| msgid "Switch to workspace 1"
msgid "Switch to VT 7"
msgstr "Persijungti į VT 7"
@ -440,87 +465,83 @@ msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: ../src/compositor/compositor.c:464
#: ../src/compositor/compositor.c:443
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display \"%s"
"\"."
msgstr "Kita kompozicijos valdyklė jau veikia ekrane %i vaizduoklyje „%s“."
#: ../src/compositor/meta-background.c:990
msgid "background texture could not be created from file"
msgstr "nepavyko sukurti fono tekstūros iš failo"
#: ../src/core/bell.c:215
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "Skambučio įvykis"
#: ../src/core/delete.c:129
#: ../src/core/delete.c:127
#, c-format
msgid "“%s” is not responding."
msgstr "%s neatsiliepia į komandas."
#: ../src/core/delete.c:131
#: ../src/core/delete.c:129
msgid "Application is not responding."
msgstr "Programa neatsiliepia į komandas."
#: ../src/core/delete.c:136
#: ../src/core/delete.c:134
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr "Galite šiek tiek palaukti arba priverstinai uždaryti programą."
#: ../src/core/delete.c:143
#: ../src/core/delete.c:141
msgid "_Wait"
msgstr "_Laukti"
#: ../src/core/delete.c:143
#: ../src/core/delete.c:141
msgid "_Force Quit"
msgstr "_Priverstinai išeiti"
#: ../src/core/display.c:448
#: ../src/core/display.c:547
#, 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:172
#: ../src/core/main.c:176
msgid "Disable connection to session manager"
msgstr "Išjungti susijungimą su sesijos valdykle"
#: ../src/core/main.c:178
#: ../src/core/main.c:182
msgid "Replace the running window manager"
msgstr "Pakeisti veikiančią langų valdyklę"
#: ../src/core/main.c:184
#: ../src/core/main.c:188
msgid "Specify session management ID"
msgstr "Nurodyti sesijos valdymo ID"
#: ../src/core/main.c:189
#: ../src/core/main.c:193
msgid "X Display to use"
msgstr "Naudotinas X ekranas"
#: ../src/core/main.c:195
#: ../src/core/main.c:199
msgid "Initialize session from savefile"
msgstr "Inicializuoti sesiją iš išsaugojimo failo"
#: ../src/core/main.c:201
#: ../src/core/main.c:205
msgid "Make X calls synchronous"
msgstr "Sinchronizuoti X iškvietimus"
#: ../src/core/main.c:207
#: ../src/core/main.c:212
msgid "Run as a wayland compositor"
msgstr "Vykdyti kaip wayland kompozitorių"
#: ../src/core/main.c:214
#: ../src/core/main.c:220
msgid "Run as a full display server, rather than nested"
msgstr "Vykdyti kaip visą vaizduoklio serverį, o ne vidinį"
#: ../src/core/main.c:448
#: ../src/core/main.c:451
#, c-format
msgid "Failed to scan themes directory: %s\n"
msgstr "Nepavyko nuskanuoti temų aplanko: %s\n"
#: ../src/core/main.c:464
#: ../src/core/main.c:467
#, c-format
msgid ""
"Could not find a theme! Be sure %s exists and contains the usual themes.\n"
@ -553,17 +574,17 @@ msgstr "Parodyti versiją"
msgid "Mutter plugin to use"
msgstr "Naudojamas Mutter įskiepis"
#: ../src/core/prefs.c:2086
#: ../src/core/prefs.c:2101
#, c-format
msgid "Workspace %d"
msgstr "Darbalaukis %d"
#: ../src/core/screen.c:539
#: ../src/core/screen.c:548
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Ekranas %d vaizduoklyje „%s“ netinkamas\n"
#: ../src/core/screen.c:555
#: ../src/core/screen.c:564
#, c-format
msgid ""
"Screen %d on display \"%s\" already has a window manager; try using the --"
@ -572,7 +593,7 @@ msgstr ""
"Ekranas %d vaizduoklyje „%s“ jau turi langų valdyklę; pabandykite "
"pasinaudoti parinktimi --replace, jei norite pakeisti esamą langų valdyklę.\n"
#: ../src/core/screen.c:660
#: ../src/core/screen.c:657
#, c-format
msgid "Screen %d on display \"%s\" already has a window manager\n"
msgstr "Ekranas %d vaizduoklyje „%s“ jau turi langų valdyklę\n"
@ -840,7 +861,7 @@ msgstr "Koordinačių išraiška neturi jokių operatorių ar operandų"
msgid "Theme contained an expression that resulted in an error: %s\n"
msgstr "Temoje esanti išraiška sukėlė klaidą: %s\n"
#: ../src/ui/theme.c:4467
#: ../src/ui/theme.c:4455
#, c-format
msgid ""
"<button function=\"%s\" state=\"%s\" draw_ops=\"whatever\"/> must be "
@ -849,25 +870,25 @@ msgstr ""
"Šiam rėmelio stiliui turi būti nurodytas <button function=\"%s\" state=\"%s"
"\" draw_ops=\"kažkokswhatever\"/> požymis"
#: ../src/ui/theme.c:4982 ../src/ui/theme.c:5007
#: ../src/ui/theme.c:4970 ../src/ui/theme.c:4995
#, c-format
msgid ""
"Missing <frame state=\"%s\" resize=\"%s\" focus=\"%s\" style=\"whatever\"/>"
msgstr ""
"Trūksta <frame state=\"%s\" resize=\"%s\" focus=\"%s\" style=\"kažkoks\"/>"
#: ../src/ui/theme.c:5053
#: ../src/ui/theme.c:5041
#, c-format
msgid "Failed to load theme \"%s\": %s\n"
msgstr "Nepavyko paleisti temos \"%s\": %s\n"
#: ../src/ui/theme.c:5189 ../src/ui/theme.c:5196 ../src/ui/theme.c:5203
#: ../src/ui/theme.c:5210 ../src/ui/theme.c:5217
#: ../src/ui/theme.c:5177 ../src/ui/theme.c:5184 ../src/ui/theme.c:5191
#: ../src/ui/theme.c:5198 ../src/ui/theme.c:5205
#, c-format
msgid "No <%s> set for theme \"%s\""
msgstr "Temoje \"%2$s\" trūksta <%1$s> nustatymų"
#: ../src/ui/theme.c:5225
#: ../src/ui/theme.c:5213
#, c-format
msgid ""
"No frame style set for window type \"%s\" in theme \"%s\", add a <window "
@ -876,7 +897,7 @@ msgstr ""
"Rėmelio stilius nenurodytas lango tipui \"%s\" temoje \"%s\", pridėkite "
"<window type=\"%s\" style_set=\"kažkoks\"/> elementą"
#: ../src/ui/theme.c:5632 ../src/ui/theme.c:5694 ../src/ui/theme.c:5757
#: ../src/ui/theme.c:5620 ../src/ui/theme.c:5682 ../src/ui/theme.c:5745
#, c-format
msgid ""
"User-defined constants must begin with a capital letter; \"%s\" does not"
@ -884,7 +905,7 @@ msgstr ""
"Naudotojo nustatytos konstantos turi prasidėti didžiąja raide; „%s“ nėra "
"didžioji"
#: ../src/ui/theme.c:5640 ../src/ui/theme.c:5702 ../src/ui/theme.c:5765
#: ../src/ui/theme.c:5628 ../src/ui/theme.c:5690 ../src/ui/theme.c:5753
#, c-format
msgid "Constant \"%s\" has already been defined"
msgstr "Konstanta „%s“ jau aprašyta"
@ -1281,7 +1302,7 @@ msgstr ""
"Šie langai nepalaiko &quot;išsaugoti esamus nustatymus&quot; komandos ir "
"turi būti paleisti rankiniu būdu, kai prisijungsite kitą kartą."
#: ../src/x11/window-props.c:465
#: ../src/x11/window-props.c:515
#, c-format
msgid "%s (on %s)"
msgstr "%s (kompiuteryje %s)"

1802
po/mr.po

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter 3.13.x\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-23 13:36+0200\n"
"POT-Creation-Date: 2014-09-06 14:13+0200\n"
"PO-Revision-Date: 2014-08-23 13:37+0200\n"
"Last-Translator: Kjartan Maraas <kmaraas@gnome.org>\n"
"Language-Team: Norwegian bokmål <i18n-no@lister.ping.uio.no>\n"
@ -445,17 +445,13 @@ msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: ../src/compositor/compositor.c:441
#: ../src/compositor/compositor.c:443
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display \"%s"
"\"."
msgstr "En annen compositing manager kjører skjerm %i på display «%s»."
#: ../src/compositor/meta-background.c:1044
msgid "background texture could not be created from file"
msgstr "bakgrunnstekstur kunne ikke lages fra fil"
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "Klokkehendelse"
@ -1269,3 +1265,6 @@ msgstr ""
#, c-format
msgid "%s (on %s)"
msgstr "%s (på %s)"
#~ msgid "background texture could not be created from file"
#~ msgstr "bakgrunnstekstur kunne ikke lages fra fil"

1800
po/or.po

File diff suppressed because it is too large Load Diff

1299
po/pa.po

File diff suppressed because it is too large Load Diff

1052
po/pl.po

File diff suppressed because it is too large Load Diff

612
po/ru.po

File diff suppressed because it is too large Load Diff

502
po/sk.po

File diff suppressed because it is too large Load Diff

2152
po/sv.po

File diff suppressed because it is too large Load Diff

1836
po/ta.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

50
src/Makefile-tests.am Normal file
View File

@ -0,0 +1,50 @@
# A framework for running scripted tests
if HAVE_WAYLAND
if BUILDOPT_INSTALL_TESTS
stackingdir = $(pkgdatadir)/tests/stacking
dist_stacking_DATA = \
tests/stacking/basic-x11.metatest \
tests/stacking/basic-wayland.metatest \
tests/stacking/mixed-windows.metatest \
tests/stacking/override-redirect.metatest
mutter-all.test: tests/mutter-all.test.in
$(AM_V_GEN) sed -e "s|@libexecdir[@]|$(libexecdir)|g" $< > $@.tmp && mv $@.tmp $@
installedtestsdir = $(datadir)/installed-tests/mutter
installedtests_DATA = mutter-all.test
installedtestsbindir = $(libexecdir)/installed-tests/mutter
installedtestsbin_PROGRAMS = mutter-test-client mutter-test-runner
else
noinst_PROGRAMS += mutter-test-client mutter-test-runner
endif
EXTRA_DIST += tests/mutter-all.test.in
mutter_test_client_SOURCES = tests/test-client.c
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
run-tests: mutter-test-client mutter-test-runner
./mutter-test-runner $(dist_stacking_DATA)
endif
# Some random test programs for bits of the code
testboxes_SOURCES = core/testboxes.c
testgradient_SOURCES = ui/testgradient.c
testasyncgetprop_SOURCES = x11/testasyncgetprop.c
noinst_PROGRAMS+=testboxes testgradient testasyncgetprop
testboxes_LDADD = $(MUTTER_LIBS) libmutter.la
testgradient_LDADD = $(MUTTER_LIBS) libmutter.la
testasyncgetprop_LDADD = $(MUTTER_LIBS) libmutter.la

View File

@ -5,6 +5,8 @@ lib_LTLIBRARIES = libmutter.la
SUBDIRS=compositor/plugins
EXTRA_DIST =
AM_CPPFLAGS = \
-DCLUTTER_ENABLE_COMPOSITOR_API \
-DCLUTTER_ENABLE_EXPERIMENTAL_API \
@ -100,8 +102,10 @@ libmutter_la_SOURCES = \
compositor/compositor.c \
compositor/compositor-private.h \
compositor/meta-background.c \
compositor/meta-background-private.h \
compositor/meta-background-actor.c \
compositor/meta-background-actor-private.h \
compositor/meta-background-image.c \
compositor/meta-background-group.c \
compositor/meta-cullable.c \
compositor/meta-cullable.h \
@ -133,6 +137,7 @@ libmutter_la_SOURCES = \
meta/compositor.h \
meta/meta-background.h \
meta/meta-background-actor.h \
meta/meta-background-image.h \
meta/meta-background-group.h \
meta/meta-plugin.h \
meta/meta-shadow-factory.h \
@ -282,9 +287,10 @@ libmutterinclude_headers = \
meta/keybindings.h \
meta/main.h \
meta/meta-backend.h \
meta/meta-background-actor.h \
meta/meta-background-group.h \
meta/meta-background.h \
meta/meta-background-actor.h \
meta/meta-background-image.h \
meta/meta-background-group.h \
meta/meta-cursor-tracker.h \
meta/meta-idle-monitor.h \
meta/meta-plugin.h \
@ -321,6 +327,7 @@ nodist_libmutterinclude_HEADERS = \
$(libmutterinclude_built_headers)
bin_PROGRAMS=mutter
noinst_PROGRAMS=
mutter_SOURCES = core/mutter.c
mutter_LDADD = $(MUTTER_LIBS) libmutter.la
@ -329,6 +336,8 @@ libexec_PROGRAMS = mutter-restart-helper
mutter_restart_helper_SOURCES = core/restart-helper.c
mutter_restart_helper_LDADD = $(MUTTER_LIBS)
include Makefile-tests.am
if HAVE_INTROSPECTION
include $(INTROSPECTION_MAKEFILE)
@ -362,16 +371,6 @@ Meta-$(api_version).gir: libmutter.la
endif
testboxes_SOURCES = core/testboxes.c
testgradient_SOURCES = ui/testgradient.c
testasyncgetprop_SOURCES = x11/testasyncgetprop.c
noinst_PROGRAMS=testboxes testgradient testasyncgetprop
testboxes_LDADD = $(MUTTER_LIBS) libmutter.la
testgradient_LDADD = $(MUTTER_LIBS) libmutter.la
testasyncgetprop_LDADD = $(MUTTER_LIBS) libmutter.la
dbus_idle_built_sources = meta-dbus-idle-monitor.c meta-dbus-idle-monitor.h
CLEANFILES = \
@ -385,7 +384,7 @@ DISTCLEANFILES = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libmutter.pc
EXTRA_DIST = \
EXTRA_DIST += \
$(wayland_protocols) \
libmutter.pc.in \
mutter-enum-types.h.in \

View File

@ -189,7 +189,5 @@ struct MonitorInfo
};
MonitorInfo *decode_edid (const uchar *data);
char *make_display_name (const MonitorInfo *info);
char *make_display_size_string (int width_mm, int height_mm);
#endif

View File

@ -97,6 +97,62 @@ on_monitors_changed (MetaMonitorManager *monitors,
meta_backend_sync_screen_size (backend);
}
static MetaIdleMonitor *
meta_backend_create_idle_monitor (MetaBackend *backend,
int device_id)
{
return META_BACKEND_GET_CLASS (backend)->create_idle_monitor (backend, device_id);
}
static void
create_device_monitor (MetaBackend *backend,
int device_id)
{
g_assert (backend->device_monitors[device_id] == NULL);
backend->device_monitors[device_id] = meta_backend_create_idle_monitor (backend, device_id);
backend->device_id_max = MAX (backend->device_id_max, device_id);
}
static void
destroy_device_monitor (MetaBackend *backend,
int device_id)
{
g_clear_object (&backend->device_monitors[device_id]);
if (device_id == backend->device_id_max)
{
/* Reset the max device ID */
int i, new_max = 0;
for (i = 0; i < backend->device_id_max; i++)
if (backend->device_monitors[i] != NULL)
new_max = i;
backend->device_id_max = new_max;
}
}
static void
on_device_added (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
gpointer user_data)
{
MetaBackend *backend = META_BACKEND (user_data);
int device_id = clutter_input_device_get_device_id (device);
create_device_monitor (backend, device_id);
}
static void
on_device_removed (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
gpointer user_data)
{
MetaBackend *backend = META_BACKEND (user_data);
int device_id = clutter_input_device_get_device_id (device);
destroy_device_monitor (backend, device_id);
}
static void
meta_backend_real_post_init (MetaBackend *backend)
{
@ -113,6 +169,30 @@ meta_backend_real_post_init (MetaBackend *backend)
meta_backend_sync_screen_size (backend);
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
{
ClutterDeviceManager *manager;
GSList *devices, *l;
/* Create the core device monitor. */
create_device_monitor (backend, 0);
manager = clutter_device_manager_get_default ();
g_signal_connect_object (manager, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (manager, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
devices = clutter_device_manager_list_devices (manager);
for (l = devices; l != NULL; l = l->next)
{
ClutterInputDevice *device = l->data;
on_device_added (manager, device, backend);
}
g_slist_free (devices);
}
}
static MetaCursorRenderer *
@ -174,6 +254,12 @@ meta_backend_class_init (MetaBackendClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_signal_new ("keymap-layout-group-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_UINT);
}
static void
@ -182,23 +268,6 @@ meta_backend_init (MetaBackend *backend)
_backend = backend;
}
/* FIXME -- destroy device monitors at some point */
G_GNUC_UNUSED static void
destroy_device_monitor (MetaBackend *backend,
int device_id)
{
g_clear_object (&backend->device_monitors[device_id]);
if (device_id == backend->device_id_max)
backend->device_id_max--;
}
static MetaIdleMonitor *
meta_backend_create_idle_monitor (MetaBackend *backend,
int device_id)
{
return META_BACKEND_GET_CLASS (backend)->create_idle_monitor (backend, device_id);
}
static void
meta_backend_post_init (MetaBackend *backend)
{
@ -214,12 +283,6 @@ meta_backend_get_idle_monitor (MetaBackend *backend,
{
g_return_val_if_fail (device_id >= 0 && device_id < 256, NULL);
if (!backend->device_monitors[device_id])
{
backend->device_monitors[device_id] = meta_backend_create_idle_monitor (backend, device_id);
backend->device_id_max = MAX (backend->device_id_max, device_id);
}
return backend->device_monitors[device_id];
}
@ -397,6 +460,7 @@ static GSourceFuncs event_funcs = {
void
meta_clutter_init (void)
{
ClutterSettings *clutter_settings;
GSource *source;
meta_create_backend ();
@ -404,6 +468,13 @@ meta_clutter_init (void)
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize Clutter.\n");
/*
* XXX: We cannot handle high dpi scaling yet, so fix the scale to 1
* for now.
*/
clutter_settings = clutter_settings_get_default ();
g_object_set (clutter_settings, "window-scaling-factor", 1, NULL);
source = g_source_new (&event_funcs, sizeof (GSource));
g_source_attach (source, NULL);
g_source_unref (source);

View File

@ -1789,7 +1789,6 @@ real_assign_crtcs (CrtcAssignment *assignment,
output_config->transform,
pass);
if (crtc_assignment_assign (assignment, crtc, &modes[j],
output_config->rect.x, output_config->rect.y,
output_config->transform,

View File

@ -229,6 +229,7 @@ meta_backend_native_lock_layout_group (MetaBackend *backend,
{
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
clutter_evdev_set_keyboard_layout_index (manager, idx);
g_signal_emit_by_name (backend, "keymap-layout-group-changed", idx, 0);
}
static void

View File

@ -631,10 +631,20 @@ static void
meta_backend_x11_update_screen_size (MetaBackend *backend,
int width, int height)
{
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);
if (meta_is_wayland_compositor ())
{
/* For a nested wayland session, we want to go through Clutter to update the
* toplevel window size, rather than doing it directly.
*/
META_BACKEND_CLASS (meta_backend_x11_parent_class)->update_screen_size (backend, width, height);
}
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);
}
}
static void

View File

@ -51,6 +51,12 @@ round_to_fixed (float x)
return roundf (x * 256);
}
/* Help macros to scale from OpenGL <-1,1> coordinates system to
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
*/
#define MTX_GL_SCALE_X(x,w,v1,v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
/* This helper function checks if (according to our fixed point precision)
* the vertices @verts form a box of width @widthf and height @heightf
* located at integral coordinates. These coordinates are returned
@ -118,3 +124,67 @@ meta_actor_is_untransformed (ClutterActor *actor,
return meta_actor_vertices_are_untransformed (verts, widthf, heightf, x_origin, y_origin);
}
/**
* meta_actor_painting_untransformed:
* @paint_width: the width of the painted area
* @paint_height: the height of the painted area
* @x_origin: if the transform is only an integer translation
* then the X coordinate of the location of the origin under the transformation
* from drawing space to screen pixel space is returned here.
* @y_origin: if the transform is only an integer translation
* then the X coordinate of the location of the origin under the transformation
* from drawing space to screen pixel space is returned here.
*
* Determines if the current painting transform is an integer translation.
* This can differ from the result of meta_actor_is_untransformed() when
* painting an actor if we're inside a inside a clone paint. @paint_width
* and @paint_height are used to determine the vertices of the rectangle
* we check to see if the painted area is "close enough" to the integer
* transform.
*/
gboolean
meta_actor_painting_untransformed (int paint_width,
int paint_height,
int *x_origin,
int *y_origin)
{
CoglMatrix modelview, projection, modelview_projection;
ClutterVertex vertices[4];
float viewport[4];
int i;
cogl_get_modelview_matrix (&modelview);
cogl_get_projection_matrix (&projection);
cogl_matrix_multiply (&modelview_projection,
&projection,
&modelview);
vertices[0].x = 0;
vertices[0].y = 0;
vertices[0].z = 0;
vertices[1].x = paint_width;
vertices[1].y = 0;
vertices[1].z = 0;
vertices[2].x = 0;
vertices[2].y = paint_height;
vertices[2].z = 0;
vertices[3].x = paint_width;
vertices[3].y = paint_height;
vertices[3].z = 0;
cogl_get_viewport (viewport);
for (i = 0; i < 4; i++)
{
float w = 1;
cogl_matrix_transform_point (&modelview_projection, &vertices[i].x, &vertices[i].y, &vertices[i].z, &w);
vertices[i].x = MTX_GL_SCALE_X (vertices[i].x, w,
viewport[2], viewport[0]);
vertices[i].y = MTX_GL_SCALE_Y (vertices[i].y, w,
viewport[3], viewport[1]);
}
return meta_actor_vertices_are_untransformed (vertices, paint_width, paint_height, x_origin, y_origin);
}

View File

@ -31,4 +31,9 @@ gboolean meta_actor_is_untransformed (ClutterActor *actor,
int *x_origin,
int *y_origin);
gboolean meta_actor_painting_untransformed (int paint_width,
int paint_height,
int *x_origin,
int *y_origin);
#endif /* __META_CLUTTER_UTILS_H__ */

View File

@ -64,3 +64,78 @@ meta_create_texture_pipeline (CoglTexture *src_texture)
return pipeline;
}
static gboolean is_pot(int x)
{
return x > 0 && (x & (x - 1)) == 0;
}
/**
* meta_create_texture:
* @width: width of the texture to create
* @height: height of the texture to create
* @components; components to store in the texture (color or alpha)
* @flags: flags that affect the allocation behavior
*
* Creates a texture of the given size with the specified components
* for use as a frame buffer object.
*
* If non-power-of-two textures are not supported on the system, then
* the texture will be created as a texture rectangle; in this case,
* hardware repeating isn't possible, and texture coordinates are also
* different, but Cogl hides these issues from the application, except from
* GLSL shaders. Since GLSL is never (or at least almost never)
* present on such a system, this is not typically an issue.
*
* If %META_TEXTURE_ALLOW_SLICING is present in @flags, and the texture
* is larger than the texture size limits of the system, then the texture
* will be created as a sliced texture. This also will cause problems
* with using the texture with GLSL, and is more likely to be an issue
* since all GL implementations have texture size limits, and they can
* be as small as 2048x2048 on reasonably current systems.
*/
CoglTexture *
meta_create_texture (int width,
int height,
CoglTextureComponents components,
MetaTextureFlags flags)
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CoglTexture *texture;
gboolean should_use_rectangle = FALSE;
if (!(is_pot (width) && is_pot (height)) &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
{
if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
should_use_rectangle = TRUE;
else
g_error ("Cannot create texture. Support for GL_ARB_texture_non_power_of_two or "
"ARB_texture_rectangle is required");
}
if (should_use_rectangle)
texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
else
texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
cogl_texture_set_components (texture, components);
if ((flags & META_TEXTURE_ALLOW_SLICING) != 0)
{
/* To find out if we need to slice the texture, we have to go ahead and force storage
* to be allocated
*/
CoglError *catch_error = NULL;
if (!cogl_texture_allocate (texture, &catch_error))
{
cogl_error_free (catch_error);
cogl_object_unref (texture);
texture = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width, height, COGL_TEXTURE_MAX_WASTE));
cogl_texture_set_components (texture, components);
}
}
return texture;
}

View File

@ -25,4 +25,14 @@
CoglPipeline * meta_create_texture_pipeline (CoglTexture *texture);
typedef enum {
META_TEXTURE_FLAGS_NONE = 0,
META_TEXTURE_ALLOW_SLICING = 1 << 1
} MetaTextureFlags;
CoglTexture *meta_create_texture (int width,
int height,
CoglTextureComponents components,
MetaTextureFlags flags);
#endif /* __META_COGL_UTILS_H__ */

View File

@ -920,7 +920,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
old_actor = old_stack->data;
old_window = meta_window_actor_get_meta_window (old_actor);
if (old_window->hidden &&
if ((old_window->hidden || old_window->unmanaging) &&
!meta_window_actor_effect_in_progress (old_actor))
{
old_stack = g_list_delete_link (old_stack, old_stack);
@ -954,7 +954,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
* filtered out non-animating hidden windows above.
*/
if (old_actor &&
(!stack_actor || old_window->hidden))
(!stack_actor || old_window->hidden || old_window->unmanaging))
{
actor = old_actor;
window = old_window;

View File

@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright 2009 Sander Dijkhuis
* Copyright 2010 Red Hat, Inc.
* Copyright 2014 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
@ -26,23 +26,122 @@
*
*/
#include <config.h>
/*
* The overall model drawing model of this widget is that we have one
* texture, or two interpolated textures, possibly with alpha or
* margins that let the underlying background show through, blended
* over a solid color or a gradient. The result of that combination
* can then be affected by a "vignette" that darkens the background
* away from a central point (or as a no-GLSL fallback, simply darkens
* the background) and by overall opacity.
*
* As of GNOME 3.14, GNOME is only using a fraction of this when the
* user sets the background through the control center - what can be
* set is:
*
* A single image without a border
* An animation of images without a border that blend together,
* with the blend changing every 4-5 minutes
* A solid color with a repeated noise texture blended over it
*
* This all is pretty easy to do in a fragment shader, except when:
*
* A) We don't have GLSL - in this case, the operation of
* interpolating the two textures and blending the result over the
* background can't be expressed with Cogl's fixed-function layer
* combining (which is confined to what GL's texture environment
* combining can do) So we can only handle the above directly if
* there are no margins or alpha.
*
* B) The image textures are sliced. Texture size limits on older
* hardware (pre-965 intel hardware, r300, etc.) is often 2048,
* and it would be common to use a texture larger than this for a
* background and expect it to be scaled down. Cogl can compensate
* for this by breaking the texture up into multiple textures, but
* can't multitexture with sliced textures. So we can only handle
* the above if there's a single texture.
*
* However, even when we *can* represent everything in a single pass,
* it's not necessarily efficient. If we want to draw a 1024x768
* background, it's pretty inefficient to bilinearly texture from
* two 2560x1440 images and mix that. So the drawing model we take
* here is that MetaBackground generates a single texture (which
* might be a 1x1 texture for a solid color, or a 1x2 texture for a
* gradient, or a repeated texture for wallpaper, or a pre-rendered
* texture the size of the screen), and we draw with that, possibly
* adding the vignette and opacity.
*/
#include <cogl/cogl-texture-pixmap-x11.h>
#include <config.h>
#include <clutter/clutter.h>
#include <X11/Xatom.h>
#include "cogl-utils.h"
#include "compositor-private.h"
#include "clutter-utils.h"
#include <meta/errors.h>
#include <meta/meta-background.h>
#include "meta-background-actor-private.h"
#include "meta-background-private.h"
#include "meta-cullable.h"
enum
{
PROP_META_SCREEN = 1,
PROP_MONITOR,
PROP_BACKGROUND,
PROP_VIGNETTE,
PROP_VIGNETTE_SHARPNESS,
PROP_BRIGHTNESS
};
typedef enum {
CHANGED_BACKGROUND = 1 << 0,
CHANGED_EFFECTS = 1 << 2,
CHANGED_VIGNETTE_PARAMETERS = 1 << 3,
CHANGED_ALL = 0xFFFF
} ChangedFlags;
#define VERTEX_SHADER_DECLARATIONS \
"uniform vec2 scale;\n" \
"uniform vec2 offset;\n" \
"varying vec2 position;\n" \
#define VERTEX_SHADER_CODE \
"position = cogl_tex_coord0_in.xy * scale + offset;\n" \
#define FRAGMENT_SHADER_DECLARATIONS \
"uniform float vignette_sharpness;\n" \
"varying vec2 position;\n" \
#define FRAGMENT_SHADER_CODE \
"float t = 2.0 * length(position);\n" \
"t = min(t, 1.0);\n" \
"float pixel_brightness = 1 - t * vignette_sharpness;\n" \
"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
typedef struct _MetaBackgroundLayer MetaBackgroundLayer;
typedef enum {
PIPELINE_VIGNETTE = (1 << 0),
PIPELINE_BLEND = (1 << 1),
} PipelineFlags;
struct _MetaBackgroundActorPrivate
{
MetaScreen *screen;
int monitor;
MetaBackground *background;
gboolean vignette;
double brightness;
double vignette_sharpness;
ChangedFlags changed;
CoglPipeline *pipeline;
PipelineFlags pipeline_flags;
cairo_rectangle_int_t texture_area;
gboolean force_bilinear;
cairo_region_t *clip_region;
};
@ -66,27 +165,45 @@ static void
meta_background_actor_dispose (GObject *object)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
MetaBackgroundActorPrivate *priv = self->priv;
set_clip_region (self, NULL);
meta_background_actor_set_background (self, NULL);
if (priv->pipeline)
{
cogl_object_unref (priv->pipeline);
priv->pipeline = NULL;
}
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
}
static void
get_preferred_size (MetaBackgroundActor *self,
gfloat *width,
gfloat *height)
{
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (self)->priv;
MetaRectangle monitor_geometry;
meta_screen_get_monitor_geometry (priv->screen, priv->monitor, &monitor_geometry);
if (width != NULL)
*width = monitor_geometry.width;
if (height != NULL)
*height = monitor_geometry.height;
}
static void
meta_background_actor_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
ClutterContent *content;
gfloat width;
content = clutter_actor_get_content (actor);
if (content)
clutter_content_get_preferred_size (content, &width, NULL);
else
width = 0;
get_preferred_size (META_BACKGROUND_ACTOR (actor), &width, NULL);
if (min_width_p)
*min_width_p = width;
@ -101,15 +218,9 @@ meta_background_actor_get_preferred_height (ClutterActor *actor,
gfloat *natural_height_p)
{
ClutterContent *content;
gfloat height;
content = clutter_actor_get_content (actor);
if (content)
clutter_content_get_preferred_size (content, NULL, &height);
else
height = 0;
get_preferred_size (META_BACKGROUND_ACTOR (actor), NULL, &height);
if (min_height_p)
*min_height_p = height;
@ -117,43 +228,430 @@ meta_background_actor_get_preferred_height (ClutterActor *actor,
*natural_height_p = height;
}
static CoglPipeline *
make_pipeline (PipelineFlags pipeline_flags)
{
static CoglPipeline *templates[4];
CoglPipeline **templatep;
templatep = &templates[pipeline_flags];
if (*templatep == NULL)
{
/* Cogl automatically caches pipelines with no eviction policy,
* so we need to prevent identical pipelines from getting cached
* separately, by reusing the same shader snippets.
*/
*templatep = COGL_PIPELINE (meta_create_texture_pipeline (NULL));
if ((pipeline_flags & PIPELINE_VIGNETTE) != 0)
{
static CoglSnippet *vertex_snippet;
static CoglSnippet *fragment_snippet;
if (!vertex_snippet)
vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
VERTEX_SHADER_DECLARATIONS, VERTEX_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, vertex_snippet);
if (!fragment_snippet)
fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
FRAGMENT_SHADER_DECLARATIONS, FRAGMENT_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, fragment_snippet);
}
if ((pipeline_flags & PIPELINE_BLEND) == 0)
cogl_pipeline_set_blend (*templatep, "RGBA = ADD (SRC_COLOR, 0)", NULL);
}
return cogl_pipeline_copy (*templatep);
}
static void
setup_pipeline (MetaBackgroundActor *self,
cairo_rectangle_int_t *actor_pixel_rect)
{
MetaBackgroundActorPrivate *priv = self->priv;
PipelineFlags pipeline_flags = 0;
guint8 opacity;
float color_component;
CoglPipelineFilter filter;
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
if (opacity < 255)
pipeline_flags |= PIPELINE_BLEND;
if (priv->vignette && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_VIGNETTE;
if (priv->pipeline &&
pipeline_flags != priv->pipeline_flags)
{
cogl_object_unref (priv->pipeline);
priv->pipeline = NULL;
}
if (priv->pipeline == NULL)
{
priv->pipeline_flags = pipeline_flags;
priv->pipeline = make_pipeline (pipeline_flags);
priv->changed = CHANGED_ALL;
}
if ((priv->changed & CHANGED_BACKGROUND) != 0)
{
CoglPipelineWrapMode wrap_mode;
CoglTexture *texture = meta_background_get_texture (priv->background,
priv->monitor,
&priv->texture_area,
&wrap_mode);
priv->force_bilinear = texture &&
(priv->texture_area.width != (int)cogl_texture_get_width (texture) ||
priv->texture_area.height != (int)cogl_texture_get_height (texture));
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0, wrap_mode);
}
if ((priv->changed & CHANGED_VIGNETTE_PARAMETERS) != 0)
{
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
"vignette_sharpness"),
priv->vignette_sharpness);
}
if (priv->vignette)
{
color_component = priv->brightness * opacity / 255.;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* Darken everything to match the average brightness that would
* be there if we were drawing the vignette, which is
* (1 - (pi/12.) * vignette_sharpness) [exercise for the reader :]
*/
color_component *= (1 - 0.74 * priv->vignette_sharpness);
}
}
else
color_component = opacity / 255.;
cogl_pipeline_set_color4f (priv->pipeline,
color_component,
color_component,
color_component,
opacity / 255.);
if (!priv->force_bilinear &&
meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
else
filter = COGL_PIPELINE_FILTER_LINEAR;
cogl_pipeline_set_layer_filters (priv->pipeline, 0, filter, filter);
}
static void
set_glsl_parameters (MetaBackgroundActor *self,
cairo_rectangle_int_t *actor_pixel_rect)
{
MetaBackgroundActorPrivate *priv = self->priv;
float scale[2];
float offset[2];
/* Compute a scale and offset for transforming texture coordinates to the
* coordinate system from [-0.5 to 0.5] across the area of the actor
*/
scale[0] = priv->texture_area.width / (float)actor_pixel_rect->width;
scale[1] = priv->texture_area.height / (float)actor_pixel_rect->height;
offset[0] = priv->texture_area.x / (float)actor_pixel_rect->width - 0.5;
offset[1] = priv->texture_area.y / (float)actor_pixel_rect->height - 0.5;
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
"scale"),
2, 1, scale);
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
"offset"),
2, 1, offset);
}
static void
paint_clipped_rectangle (CoglFramebuffer *fb,
CoglPipeline *pipeline,
cairo_rectangle_int_t *rect,
cairo_rectangle_int_t *texture_area)
{
float x1, y1, x2, y2;
float tx1, ty1, tx2, ty2;
x1 = rect->x;
y1 = rect->y;
x2 = rect->x + rect->width;
y2 = rect->y + rect->height;
tx1 = (x1 - texture_area->x) / texture_area->width;
ty1 = (y1 - texture_area->y) / texture_area->height;
tx2 = (x2 - texture_area->x) / texture_area->width;
ty2 = (y2 - texture_area->y) / texture_area->height;
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
x1, y1, x2, y2,
tx1, ty1, tx2, ty2);
}
static gboolean
meta_background_actor_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
return clutter_paint_volume_set_from_allocation (volume, actor);
}
static void
meta_background_actor_paint (ClutterActor *actor)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
MetaBackgroundActorPrivate *priv = self->priv;
ClutterActorBox actor_box;
cairo_rectangle_int_t actor_pixel_rect;
CoglFramebuffer *fb;
int i;
if ((priv->clip_region && cairo_region_is_empty (priv->clip_region)))
return;
clutter_actor_get_content_box (actor, &actor_box);
actor_pixel_rect.x = actor_box.x1;
actor_pixel_rect.y = actor_box.y1;
actor_pixel_rect.width = actor_box.x2 - actor_box.x1;
actor_pixel_rect.height = actor_box.y2 - actor_box.y1;
setup_pipeline (self, &actor_pixel_rect);
set_glsl_parameters (self, &actor_pixel_rect);
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
#define MAX_RECTS 64
fb = cogl_get_draw_framebuffer ();
/* Now figure out what to actually paint.
*/
if (priv->clip_region != NULL)
{
int n_rects = cairo_region_num_rectangles (priv->clip_region);
if (n_rects <= MAX_RECTS)
{
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (priv->clip_region, i, &rect);
if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
continue;
paint_clipped_rectangle (fb, priv->pipeline, &rect, &priv->texture_area);
}
return;
}
}
paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect, &priv->texture_area);
}
static void
meta_background_actor_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
MetaBackgroundActorPrivate *priv = self->priv;
switch (prop_id)
{
case PROP_META_SCREEN:
priv->screen = g_value_get_object (value);
break;
case PROP_MONITOR:
priv->monitor = g_value_get_int (value);
break;
case PROP_BACKGROUND:
meta_background_actor_set_background (self, g_value_get_object (value));
break;
case PROP_VIGNETTE:
meta_background_actor_set_vignette (self,
g_value_get_boolean (value),
priv->brightness,
priv->vignette_sharpness);
break;
case PROP_VIGNETTE_SHARPNESS:
meta_background_actor_set_vignette (self,
priv->vignette,
priv->brightness,
g_value_get_double (value));
break;
case PROP_BRIGHTNESS:
meta_background_actor_set_vignette (self,
priv->vignette,
g_value_get_double (value),
priv->vignette_sharpness);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_background_actor_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (object)->priv;
switch (prop_id)
{
case PROP_META_SCREEN:
g_value_set_object (value, priv->screen);
break;
case PROP_MONITOR:
g_value_set_int (value, priv->monitor);
break;
case PROP_BACKGROUND:
g_value_set_object (value, priv->background);
break;
case PROP_VIGNETTE:
g_value_set_boolean (value, priv->vignette);
break;
case PROP_BRIGHTNESS:
g_value_set_double (value, priv->brightness);
break;
case PROP_VIGNETTE_SHARPNESS:
g_value_set_double (value, priv->vignette_sharpness);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_background_actor_class_init (MetaBackgroundActorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *param_spec;
g_type_class_add_private (klass, sizeof (MetaBackgroundActorPrivate));
object_class->dispose = meta_background_actor_dispose;
object_class->set_property = meta_background_actor_set_property;
object_class->get_property = meta_background_actor_get_property;
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
actor_class->paint = meta_background_actor_paint;
param_spec = g_param_spec_object ("meta-screen",
"MetaScreen",
"MetaScreen",
META_TYPE_SCREEN,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class,
PROP_META_SCREEN,
param_spec);
param_spec = g_param_spec_int ("monitor",
"monitor",
"monitor",
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class,
PROP_MONITOR,
param_spec);
param_spec = g_param_spec_object ("background",
"Background",
"MetaBackground object holding background parameters",
META_TYPE_BACKGROUND,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_BACKGROUND,
param_spec);
param_spec = g_param_spec_boolean ("vignette",
"Vignette",
"Whether vignette effect is enabled",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_VIGNETTE,
param_spec);
param_spec = g_param_spec_double ("brightness",
"Brightness",
"Brightness of vignette effect",
0.0, 1.0, 1.0,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_BRIGHTNESS,
param_spec);
param_spec = g_param_spec_double ("vignette-sharpness",
"Vignette Sharpness",
"Sharpness of vignette effect",
0.0, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_VIGNETTE_SHARPNESS,
param_spec);
}
static void
meta_background_actor_init (MetaBackgroundActor *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_BACKGROUND_ACTOR,
MetaBackgroundActorPrivate);
MetaBackgroundActorPrivate *priv;
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_BACKGROUND_ACTOR,
MetaBackgroundActorPrivate);
priv->vignette = FALSE;
priv->brightness = 1.0;
priv->vignette_sharpness = 0.0;
}
/**
* meta_background_actor_new:
* @monitor: Index of the monitor for which to draw the background
*
* Creates a new actor to draw the background for the given monitor.
* This actor should be associated with a #MetaBackground using
* clutter_actor_set_content()
*
* Return value: the newly created background actor
*/
ClutterActor *
meta_background_actor_new (void)
meta_background_actor_new (MetaScreen *screen,
int monitor)
{
MetaBackgroundActor *self;
self = g_object_new (META_TYPE_BACKGROUND_ACTOR, NULL);
self = g_object_new (META_TYPE_BACKGROUND_ACTOR,
"meta-screen", screen,
"monitor", monitor,
NULL);
return CLUTTER_ACTOR (self);
}
@ -195,3 +693,89 @@ meta_background_actor_get_clip_region (MetaBackgroundActor *self)
MetaBackgroundActorPrivate *priv = self->priv;
return priv->clip_region;
}
static void
invalidate_pipeline (MetaBackgroundActor *self,
ChangedFlags changed)
{
MetaBackgroundActorPrivate *priv = self->priv;
priv->changed |= changed;
}
static void
on_background_changed (MetaBackground *background,
MetaBackgroundActor *self)
{
invalidate_pipeline (self, CHANGED_BACKGROUND);
}
void
meta_background_actor_set_background (MetaBackgroundActor *self,
MetaBackground *background)
{
MetaBackgroundActorPrivate *priv;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
g_return_if_fail (background == NULL || META_IS_BACKGROUND (background));
priv = self->priv;
if (background == priv->background)
return;
if (priv->background)
{
g_signal_handlers_disconnect_by_func (priv->background,
(gpointer)on_background_changed,
self);
g_object_unref (priv->background);
priv->background = NULL;
}
if (background)
{
priv->background = g_object_ref (background);
g_signal_connect (priv->background, "changed",
G_CALLBACK (on_background_changed), self);
}
invalidate_pipeline (self, CHANGED_BACKGROUND);
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
void
meta_background_actor_set_vignette (MetaBackgroundActor *self,
gboolean enabled,
double brightness,
double sharpness)
{
MetaBackgroundActorPrivate *priv;
gboolean changed = FALSE;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
g_return_if_fail (brightness >= 0. && brightness <= 1.);
g_return_if_fail (sharpness >= 0.);
priv = self->priv;
enabled = enabled != FALSE;
if (enabled != priv->vignette)
{
priv->vignette = enabled;
invalidate_pipeline (self, CHANGED_EFFECTS);
changed = TRUE;
}
if (brightness != priv->brightness || sharpness != priv->vignette_sharpness)
{
priv->brightness = brightness;
priv->vignette_sharpness = sharpness;
invalidate_pipeline (self, CHANGED_VIGNETTE_PARAMETERS);
changed = TRUE;
}
if (changed)
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}

View File

@ -0,0 +1,344 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright 2014 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/>.
*/
/**
* SECTION:meta-background-image
* @title: MetaBackgroundImage
* @short_description: objects holding images loaded from files, used for backgrounds
*/
#include <config.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter.h>
#include <meta/meta-background-image.h>
#include "cogl-utils.h"
enum
{
LOADED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
struct _MetaBackgroundImageCache
{
GObject parent_instance;
GHashTable *images;
};
struct _MetaBackgroundImageCacheClass
{
GObjectClass parent_class;
};
struct _MetaBackgroundImage
{
GObject parent_instance;
char *filename;
MetaBackgroundImageCache *cache;
gboolean in_cache;
gboolean loaded;
CoglTexture *texture;
};
struct _MetaBackgroundImageClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
static void
meta_background_image_cache_init (MetaBackgroundImageCache *cache)
{
cache->images = g_hash_table_new (g_str_hash, g_str_equal);
}
static void
meta_background_image_cache_finalize (GObject *object)
{
MetaBackgroundImageCache *cache = META_BACKGROUND_IMAGE_CACHE (object);
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, cache->images);
while (g_hash_table_iter_next (&iter, &key, &value))
{
MetaBackgroundImage *image = value;
image->in_cache = FALSE;
}
g_hash_table_destroy (cache->images);
G_OBJECT_CLASS (meta_background_image_cache_parent_class)->finalize (object);
}
static void
meta_background_image_cache_class_init (MetaBackgroundImageCacheClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_background_image_cache_finalize;
}
/**
* meta_background_image_cache_get_default:
*
* Return value: (transfer none): the global singleton background cache
*/
MetaBackgroundImageCache *
meta_background_image_cache_get_default (void)
{
static MetaBackgroundImageCache *cache;
if (cache == NULL)
cache = g_object_new (META_TYPE_BACKGROUND_IMAGE_CACHE, NULL);
return cache;
}
static void
load_file (GTask *task,
MetaBackgroundImage *image,
gpointer task_data,
GCancellable *cancellable)
{
GError *error = NULL;
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_file (image->filename,
&error);
if (pixbuf == NULL)
{
g_task_return_error (task, error);
return;
}
g_task_return_pointer (task, pixbuf, (GDestroyNotify) g_object_unref);
}
static void
file_loaded (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object);
GError *error = NULL;
GTask *task;
CoglTexture *texture;
GdkPixbuf *pixbuf;
int width, height, row_stride;
guchar *pixels;
gboolean has_alpha;
task = G_TASK (result);
pixbuf = g_task_propagate_pointer (task, &error);
if (pixbuf == NULL)
{
g_warning ("Failed to load background '%s': %s",
image->filename, error->message);
g_clear_error (&error);
goto out;
}
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
row_stride = gdk_pixbuf_get_rowstride (pixbuf);
pixels = gdk_pixbuf_get_pixels (pixbuf);
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
texture = meta_create_texture (width, height,
has_alpha ? COGL_TEXTURE_COMPONENTS_RGBA : COGL_TEXTURE_COMPONENTS_RGB,
META_TEXTURE_ALLOW_SLICING);
if (!cogl_texture_set_data (texture,
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
row_stride,
pixels, 0,
NULL))
{
g_warning ("Failed to create texture for background");
cogl_object_unref (texture);
}
image->texture = texture;
out:
image->loaded = TRUE;
g_signal_emit (image, signals[LOADED], 0);
}
/**
* meta_background_image_cache_load:
* @cache: a #MetaBackgroundImageCache
* @filename: filename to load
*
* Loads an image to use as a background, or returns a reference to an
* image that is already in the process of loading or loaded. In either
* case, what is returned is a #MetaBackgroundImage which can be derefenced
* to get a #CoglTexture. If meta_background_image_is_loaded() returns %TRUE,
* the background is loaded, otherwise the MetaBackgroundImage::loaded
* signal will be emitted exactly once. The 'loaded' state means that the
* loading process finished, whether it succeeded or failed.
*
* Return value: (transfer full): a #MetaBackgroundImage to dereference to get the loaded texture
*/
MetaBackgroundImage *
meta_background_image_cache_load (MetaBackgroundImageCache *cache,
const char *filename)
{
MetaBackgroundImage *image;
GTask *task;
g_return_val_if_fail (META_IS_BACKGROUND_IMAGE_CACHE (cache), NULL);
g_return_val_if_fail (filename != NULL, NULL);
image = g_hash_table_lookup (cache->images, filename);
if (image != NULL)
return g_object_ref (image);
image = g_object_new (META_TYPE_BACKGROUND_IMAGE, NULL);
image->cache = cache;
image->in_cache = TRUE;
image->filename = g_strdup (filename);
g_hash_table_insert (cache->images, image->filename, image);
task = g_task_new (image, NULL, file_loaded, NULL);
g_task_run_in_thread (task, (GTaskThreadFunc) load_file);
g_object_unref (task);
return image;
}
/**
* meta_background_image_cache_purge:
* @cache: a #MetaBackgroundImageCache
* @filename: filename to remove from the cache
*
* Remove an entry from the cache; this would be used if monitoring
* showed that the file changed.
*/
void
meta_background_image_cache_purge (MetaBackgroundImageCache *cache,
const char *filename)
{
MetaBackgroundImage *image;
g_return_if_fail (META_IS_BACKGROUND_IMAGE_CACHE (cache));
g_return_if_fail (filename != NULL);
image = g_hash_table_lookup (cache->images, filename);
if (image == NULL)
return;
g_hash_table_remove (cache->images, image->filename);
image->in_cache = FALSE;
}
G_DEFINE_TYPE (MetaBackgroundImage, meta_background_image, G_TYPE_OBJECT);
static void
meta_background_image_init (MetaBackgroundImage *image)
{
}
static void
meta_background_image_finalize (GObject *object)
{
MetaBackgroundImage *image = META_BACKGROUND_IMAGE (object);
if (image->in_cache)
g_hash_table_remove (image->cache->images, image->filename);
if (image->texture)
cogl_object_unref (image->texture);
if (image->filename)
g_free (image->filename);
G_OBJECT_CLASS (meta_background_image_parent_class)->finalize (object);
}
static void
meta_background_image_class_init (MetaBackgroundImageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_background_image_finalize;
signals[LOADED] =
g_signal_new ("loaded",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
/**
* meta_background_image_is_loaded:
* @image: a #MetaBackgroundImage
*
* Return value: %TRUE if loading has already completed, %FALSE otherwise
*/
gboolean
meta_background_image_is_loaded (MetaBackgroundImage *image)
{
g_return_val_if_fail (META_IS_BACKGROUND_IMAGE (image), FALSE);
return image->loaded;
}
/**
* meta_background_image_get_success:
* @image: a #MetaBackgroundImage
*
* This function is a convenience function for checking for success,
* without having to call meta_background_image_get_texture() and
* handle the return of a Cogl type.
*
* Return value: %TRUE if loading completed successfully, otherwise %FALSE
*/
gboolean
meta_background_image_get_success (MetaBackgroundImage *image)
{
g_return_val_if_fail (META_IS_BACKGROUND_IMAGE (image), FALSE);
return image->texture != NULL;
}
/**
* meta_background_image_get_texture:
* @image: a #MetaBackgroundImage
*
* Return value: (transfer none): a #CoglTexture if loading succeeded; if
* loading failed or has not yet finished, %NULL.
*/
CoglTexture *
meta_background_image_get_texture (MetaBackgroundImage *image)
{
g_return_val_if_fail (META_IS_BACKGROUND_IMAGE (image), NULL);
return image->texture;
}

View File

@ -0,0 +1,15 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#ifndef META_BACKGROUND_PRIVATE_H
#define META_BACKGROUND_PRIVATE_H
#include <config.h>
#include "meta-background-private.h"
CoglTexture *meta_background_get_texture (MetaBackground *self,
int monitor_index,
cairo_rectangle_int_t *texture_area,
CoglPipelineWrapMode *wrap_mode);
#endif /* META_BACKGROUND_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -343,7 +343,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
filter = COGL_PIPELINE_FILTER_LINEAR;
if (!clutter_actor_is_in_clone_paint (actor) && meta_actor_is_untransformed (actor, NULL, NULL))
if (meta_actor_painting_untransformed (tex_width, tex_height, NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());

View File

@ -865,7 +865,7 @@ meta_window_actor_get_surface (MetaWindowActor *self)
gboolean
meta_window_actor_is_destroyed (MetaWindowActor *self)
{
return self->priv->disposed;
return self->priv->disposed || self->priv->needs_destroy;
}
static gboolean
@ -927,7 +927,12 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
gboolean no_delay_frame)
{
MetaWindowActorPrivate *priv = self->priv;
FrameData *frame = g_slice_new0 (FrameData);
FrameData *frame;
if (meta_window_actor_is_destroyed (self))
return;
frame = g_slice_new0 (FrameData);
priv->needs_frame_drawn = TRUE;
@ -1171,7 +1176,6 @@ meta_window_actor_destroy (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
MetaCompositor *compositor = priv->compositor;
MetaWindowType window_type = meta_window_get_window_type (window);
meta_window_set_compositor_private (window, NULL);
@ -1182,12 +1186,6 @@ meta_window_actor_destroy (MetaWindowActor *self)
priv->send_frame_messages_timer = 0;
}
/*
* We remove the window from internal lookup hashes and thus any other
* unmap events etc fail
*/
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
if (window_type == META_WINDOW_DROPDOWN_MENU ||
window_type == META_WINDOW_POPUP_MENU ||
window_type == META_WINDOW_TOOLTIP ||
@ -1910,6 +1908,9 @@ meta_window_actor_pre_paint (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
GList *l;
if (meta_window_actor_is_destroyed (self))
return;
meta_window_actor_handle_updates (self);
for (l = priv->frames; l != NULL; l = l->next)
@ -1959,6 +1960,9 @@ meta_window_actor_post_paint (MetaWindowActor *self)
priv->repaint_scheduled = FALSE;
if (meta_window_actor_is_destroyed (self))
return;
/* This window had damage, but wasn't actually redrawn because
* it is obscured. So we should wait until timer expiration
* before sending _NET_WM_FRAME_* messages.
@ -2046,6 +2050,9 @@ meta_window_actor_frame_complete (MetaWindowActor *self,
MetaWindowActorPrivate *priv = self->priv;
GList *l;
if (meta_window_actor_is_destroyed (self))
return;
for (l = priv->frames; l;)
{
GList *l_next = l->next;

View File

@ -31,64 +31,6 @@ static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
/* Help macros to scale from OpenGL <-1,1> coordinates system to
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
*/
#define MTX_GL_SCALE_X(x,w,v1,v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
/* Check if we're painting the MetaWindowGroup "untransformed". This can
* differ from the result of actor_is_untransformed(window_group) if we're
* inside a clone paint. The integer translation, if any, is returned.
*/
static gboolean
painting_untransformed (MetaWindowGroup *window_group,
int *x_origin,
int *y_origin)
{
CoglMatrix modelview, projection, modelview_projection;
ClutterVertex vertices[4];
int width, height;
float viewport[4];
int i;
cogl_get_modelview_matrix (&modelview);
cogl_get_projection_matrix (&projection);
cogl_matrix_multiply (&modelview_projection,
&projection,
&modelview);
meta_screen_get_size (window_group->screen, &width, &height);
vertices[0].x = 0;
vertices[0].y = 0;
vertices[0].z = 0;
vertices[1].x = width;
vertices[1].y = 0;
vertices[1].z = 0;
vertices[2].x = 0;
vertices[2].y = height;
vertices[2].z = 0;
vertices[3].x = width;
vertices[3].y = height;
vertices[3].z = 0;
cogl_get_viewport (viewport);
for (i = 0; i < 4; i++)
{
float w = 1;
cogl_matrix_transform_point (&modelview_projection, &vertices[i].x, &vertices[i].y, &vertices[i].z, &w);
vertices[i].x = MTX_GL_SCALE_X (vertices[i].x, w,
viewport[2], viewport[0]);
vertices[i].y = MTX_GL_SCALE_Y (vertices[i].y, w,
viewport[3], viewport[1]);
}
return meta_actor_vertices_are_untransformed (vertices, width, height, x_origin, y_origin);
}
static void
meta_window_group_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
@ -119,10 +61,13 @@ meta_window_group_paint (ClutterActor *actor)
int paint_x_offset, paint_y_offset;
int paint_x_origin, paint_y_origin;
int actor_x_origin, actor_y_origin;
int screen_width, screen_height;
MetaWindowGroup *window_group = META_WINDOW_GROUP (actor);
ClutterActor *stage = clutter_actor_get_stage (actor);
meta_screen_get_size (window_group->screen, &screen_width, &screen_height);
/* Normally we expect an actor to be drawn at it's position on the screen.
* However, if we're inside the paint of a ClutterClone, that won't be the
* case and we need to compensate. We look at the position of the window
@ -136,7 +81,7 @@ meta_window_group_paint (ClutterActor *actor)
* painting currently, and never worry about how actors are positioned
* on the stage.
*/
if (!painting_untransformed (window_group, &paint_x_origin, &paint_y_origin) ||
if (!meta_actor_painting_untransformed (screen_width, screen_height, &paint_x_origin, &paint_y_origin) ||
!meta_actor_is_untransformed (actor, &actor_x_origin, &actor_y_origin))
{
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class)->paint (actor);

View File

@ -303,15 +303,16 @@ on_monitors_changed (MetaScreen *screen,
for (i = 0; i < n; i++)
{
MetaRectangle rect;
ClutterActor *background;
ClutterActor *background_actor;
MetaBackground *background;
ClutterColor color;
meta_screen_get_monitor_geometry (screen, i, &rect);
background = meta_background_actor_new ();
background_actor = meta_background_actor_new (screen, i);
clutter_actor_set_position (background, rect.x, rect.y);
clutter_actor_set_size (background, rect.width, rect.height);
clutter_actor_set_position (background_actor, rect.x, rect.y);
clutter_actor_set_size (background_actor, rect.width, rect.height);
/* Don't use rand() here, mesa calls srand() internally when
parsing the driconf XML, but it's nice if the colors are
@ -322,9 +323,13 @@ on_monitors_changed (MetaScreen *screen,
g_rand_int_range (rand, 0, 255),
g_rand_int_range (rand, 0, 255),
255);
clutter_actor_set_background_color (background, &color);
clutter_actor_add_child (self->priv->background_group, background);
background = meta_background_new (screen);
meta_background_set_color (background, &color);
meta_background_actor_set_background (META_BACKGROUND_ACTOR (background_actor), background);
g_object_unref (background);
clutter_actor_add_child (self->priv->background_group, background_actor);
}
g_rand_free (rand);

View File

@ -97,6 +97,10 @@ typedef enum {
META_EVENT_ROUTE_WINDOW_OP,
} MetaEventRoute;
typedef gboolean (*MetaAlarmFilter) (MetaDisplay *display,
XSyncAlarmNotifyEvent *event,
gpointer data);
struct _MetaDisplay
{
GObject parent_instance;
@ -162,6 +166,7 @@ struct _MetaDisplay
/*< private-ish >*/
MetaScreen *screen;
GHashTable *xids;
GHashTable *stamps;
GHashTable *wayland_windows;
/* serials of leave/unmap events that may
@ -256,6 +261,9 @@ struct _MetaDisplay
MetaGestureTracker *gesture_tracker;
ClutterEventSequence *pointer_emulating_sequence;
MetaAlarmFilter alarm_filter;
gpointer alarm_filter_data;
int composite_event_base;
int composite_error_base;
int composite_major_version;
@ -334,6 +342,29 @@ void meta_display_register_x_window (MetaDisplay *display,
void meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow);
/* Each MetaWindow is uniquely identified by a 64-bit "stamp"; unlike a
* a MetaWindow *, a stamp will never be recycled
*/
MetaWindow* meta_display_lookup_stamp (MetaDisplay *display,
guint64 stamp);
void meta_display_register_stamp (MetaDisplay *display,
guint64 *stampp,
MetaWindow *window);
void meta_display_unregister_stamp (MetaDisplay *display,
guint64 stamp);
/* A "stack id" is a XID or a stamp */
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
MetaWindow* meta_display_lookup_stack_id (MetaDisplay *display,
guint64 stack_id);
/* for debug logging only; returns a human-description of the stack
* ID - a small number of buffers are recycled, so the result must
* be used immediately or copied */
const char *meta_display_describe_stack_id (MetaDisplay *display,
guint64 stack_id);
void meta_display_register_wayland_window (MetaDisplay *display,
MetaWindow *window);
void meta_display_unregister_wayland_window (MetaDisplay *display,
@ -453,4 +484,8 @@ void meta_display_cancel_touch (MetaDisplay *display);
gboolean meta_display_windows_are_interactable (MetaDisplay *display);
void meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data);
#endif

View File

@ -627,6 +627,8 @@ meta_display_open (void)
display->xids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal);
display->stamps = g_hash_table_new (g_int64_hash,
g_int64_equal);
display->wayland_windows = g_hash_table_new (NULL, NULL);
i = 0;
@ -1581,6 +1583,68 @@ meta_display_unregister_wayland_window (MetaDisplay *display,
g_hash_table_remove (display->wayland_windows, window);
}
MetaWindow*
meta_display_lookup_stamp (MetaDisplay *display,
guint64 stamp)
{
return g_hash_table_lookup (display->stamps, &stamp);
}
void
meta_display_register_stamp (MetaDisplay *display,
guint64 *stampp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (display->stamps, stampp) == NULL);
g_hash_table_insert (display->stamps, stampp, window);
}
void
meta_display_unregister_stamp (MetaDisplay *display,
guint64 stamp)
{
g_return_if_fail (g_hash_table_lookup (display->stamps, &stamp) != NULL);
g_hash_table_remove (display->stamps, &stamp);
}
MetaWindow*
meta_display_lookup_stack_id (MetaDisplay *display,
guint64 stack_id)
{
if (META_STACK_ID_IS_X11 (stack_id))
return meta_display_lookup_x_window (display, (Window)stack_id);
else
return meta_display_lookup_stamp (display, stack_id);
}
/* We return a pointer into a ring of static buffers. This is to make
* using this function for debug-logging convenient and avoid tempory
* strings that must be freed. */
const char *
meta_display_describe_stack_id (MetaDisplay *display,
guint64 stack_id)
{
/* 0x<64-bit: 16 characters> (<10 characters of title>)\0' */
static char buffer[5][32];
MetaWindow *window;
static int pos = 0;
char *result;
result = buffer[pos];
pos = (pos + 1) % 5;
window = meta_display_lookup_stack_id (display, stack_id);
if (window && window->title)
snprintf (result, sizeof(buffer[0]), "%#" G_GINT64_MODIFIER "x (%.10s)", stack_id, window->title);
else
snprintf (result, sizeof(buffer[0]), "%#" G_GINT64_MODIFIER "x", stack_id);
return result;
}
/* We store sync alarms in the window ID hash table, because they are
* just more types of XIDs in the same global space, but we have
* typesafe functions to register/unregister for readability.
@ -2954,3 +3018,14 @@ meta_display_is_pointer_emulating_sequence (MetaDisplay *display,
return display->pointer_emulating_sequence == sequence;
}
void
meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data)
{
g_return_if_fail (filter == NULL || display->alarm_filter == NULL);
display->alarm_filter = filter;
display->alarm_filter_data = data;
}

View File

@ -188,13 +188,11 @@ meta_display_handle_event (MetaDisplay *display,
}
#endif
#ifdef HAVE_WAYLAND
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);
}
#endif
handle_idletime_for_event (event);

View File

@ -39,7 +39,6 @@ meta_window_ensure_frame (MetaWindow *window)
XSetWindowAttributes attrs;
Visual *visual;
gulong create_serial;
MetaStackWindow stack_window;
if (window->frame)
return;
@ -95,10 +94,8 @@ meta_window_ensure_frame (MetaWindow *window)
frame->rect.height,
frame->window->screen->number,
&create_serial);
stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
stack_window.x11.xwindow = frame->xwindow;
meta_stack_tracker_record_add (window->screen->stack_tracker,
&stack_window,
frame->xwindow,
create_serial);
meta_verbose ("Frame for %s is 0x%lx\n", frame->window->desc, frame->xwindow);
@ -132,9 +129,8 @@ meta_window_ensure_frame (MetaWindow *window)
window->unmaps_pending += 1;
}
stack_window.x11.xwindow = window->xwindow;
meta_stack_tracker_record_remove (window->screen->stack_tracker,
&stack_window,
window->xwindow,
XNextRequest (window->display->xdisplay));
XReparentWindow (window->display->xdisplay,
window->xwindow,
@ -179,7 +175,6 @@ meta_window_destroy_frame (MetaWindow *window)
{
MetaFrame *frame;
MetaFrameBorders borders;
MetaStackWindow stack_window;
if (window->frame == NULL)
return;
@ -206,10 +201,8 @@ meta_window_destroy_frame (MetaWindow *window)
"Incrementing unmaps_pending on %s for reparent back to root\n", window->desc);
window->unmaps_pending += 1;
}
stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
stack_window.x11.xwindow = window->xwindow;
meta_stack_tracker_record_add (window->screen->stack_tracker,
&stack_window,
window->xwindow,
XNextRequest (window->display->xdisplay));
XReparentWindow (window->display->xdisplay,
window->xwindow,

View File

@ -1629,12 +1629,22 @@ meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp)
void
meta_display_freeze_keyboard (MetaDisplay *display, Window window, guint32 timestamp)
{
MetaBackend *backend = meta_get_backend ();
if (!META_IS_BACKEND_X11 (backend))
return;
grab_keyboard (window, timestamp, XIGrabModeSync);
}
void
meta_display_ungrab_keyboard (MetaDisplay *display, guint32 timestamp)
{
MetaBackend *backend = meta_get_backend ();
if (!META_IS_BACKEND_X11 (backend))
return;
ungrab_keyboard (timestamp);
}
@ -1877,6 +1887,8 @@ process_iso_next_group (MetaDisplay *display,
{
MetaKeyBindingManager *keys = &display->key_binding_manager;
gboolean activate;
guint32 keycode;
guint32 modifiers;
int i;
if (event->type == CLUTTER_KEY_RELEASE)
@ -1884,10 +1896,13 @@ process_iso_next_group (MetaDisplay *display,
activate = FALSE;
keycode = event->hardware_keycode;
modifiers = event->modifier_state & 0xff & ~keys->ignored_modifier_mask;
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
{
if (event->hardware_keycode == keys->iso_next_group_combos[i].keycode &&
event->modifier_state == (unsigned int)keys->iso_next_group_combos[i].modifiers)
if (keycode == keys->iso_next_group_combos[i].keycode &&
modifiers == keys->iso_next_group_combos[i].modifiers)
{
/* If the signal handler returns TRUE the keyboard will
remain frozen. It's the signal handler's responsibility

View File

@ -302,7 +302,6 @@ meta_init (void)
{
struct sigaction act;
sigset_t empty_mask;
ClutterSettings *clutter_settings;
sigemptyset (&empty_mask);
act.sa_handler = SIG_IGN;
@ -377,13 +376,6 @@ meta_init (void)
meta_ui_init ();
meta_restart_init ();
/*
* XXX: We cannot handle high dpi scaling yet, so fix the scale to 1
* for now.
*/
clutter_settings = clutter_settings_get_default ();
g_object_set (clutter_settings, "window-scaling-factor", 1, NULL);
}
/**

View File

@ -52,9 +52,7 @@
#define KEY_GNOME_ACCESSIBILITY "toolkit-accessibility"
#define KEY_GNOME_ANIMATIONS "enable-animations"
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
#define KEY_GNOME_CURSOR_SIZE "cursor-size"
#define KEY_XKB_OPTIONS "xkb-options"
#define KEY_XSETTINGS_OVERRIDES "overrides"
#define KEY_OVERLAY_KEY "overlay-key"
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
@ -133,9 +131,13 @@ static void bindings_changed (GSettings *settings,
gchar *key,
gpointer data);
static void xsettings_overrides_changed (GSettings *settings,
gchar *key,
gpointer data);
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 queue_changed (MetaPreference pref);
@ -479,13 +481,6 @@ static MetaIntPreference preferences_int[] =
},
&auto_raise_delay
},
{
{ "cursor-size",
SCHEMA_INTERFACE,
META_PREF_CURSOR_SIZE,
},
&cursor_size
},
{
{ "draggable-border-width",
SCHEMA_MUTTER,
@ -951,24 +946,6 @@ queue_changed (MetaPreference pref)
/* Initialisation. */
/****************************************************************************/
static GSettings *
get_xsettings_settings (void)
{
GSettings *settings = NULL;
GSettingsSchema *schema;
schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
SCHEMA_XSETTINGS, FALSE);
if (schema)
{
settings = g_settings_new_full (schema, NULL, NULL);
g_settings_schema_unref (schema);
}
return settings;
}
void
meta_prefs_init (void)
{
@ -998,19 +975,14 @@ meta_prefs_init (void)
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME,
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_SIZE,
G_CALLBACK (settings_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
settings = get_xsettings_settings ();
if (settings)
{
g_signal_connect (settings, "changed::" KEY_XSETTINGS_OVERRIDES,
G_CALLBACK (xsettings_overrides_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_XSETTINGS), settings);
g_signal_connect (gtk_settings_get_default (),
"notify::gtk-shell-shows-app-menu",
G_CALLBACK (shell_shows_app_menu_changed), NULL);
xsettings_overrides_changed (settings, KEY_XSETTINGS_OVERRIDES, NULL);
}
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size), NULL);
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
@ -1032,6 +1004,9 @@ meta_prefs_init (void)
handle_preference_init_string_array ();
handle_preference_init_int ();
update_cursor_size (gtk_settings_get_default (), NULL, NULL);
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
init_bindings ();
}
@ -1232,44 +1207,49 @@ bindings_changed (GSettings *settings,
g_strfreev (strokes);
}
/* The fallback app menu should be enabled if either we are not
* showing the app menu (e.g. when using the default plugin) or
* with a corresponding XSettings override; we ignore the former
* and assume that we always show the app menu, not least
* because we rely on the compositor implementation to display
* the fallback ...
*/
static void
xsettings_overrides_changed (GSettings *settings,
gchar *key,
gpointer data)
shell_shows_app_menu_changed (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
{
GVariant *value;
GVariantDict overrides;
int shell_shows_app_menu = 1;
gboolean changed = FALSE;
if (!g_settings_get_boolean (settings, "active"))
goto out;
g_object_get (settings,
"gtk-shell-shows-app-menu", &shell_shows_app_menu,
NULL);
value = g_settings_get_value (settings, KEY_XSETTINGS_OVERRIDES);
g_variant_dict_init (&overrides, value);
g_variant_unref (value);
g_variant_dict_lookup (&overrides,
"Gtk/ShellShowsAppMenu", "i", &shell_shows_app_menu);
g_variant_dict_clear (&overrides);
changed = (show_fallback_app_menu == !!shell_shows_app_menu);
out:
show_fallback_app_menu = !shell_shows_app_menu;
if (changed)
queue_changed (META_PREF_BUTTON_LAYOUT);
}
static void
update_cursor_size (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
{
GdkScreen *screen = gdk_screen_get_default ();
GValue value = G_VALUE_INIT;
int xsettings_cursor_size = 24;
g_value_init (&value, G_TYPE_INT);
if (gdk_screen_get_setting (screen, "gtk-cursor-theme-size", &value))
{
xsettings_cursor_size = g_value_get_int (&value);
}
if (xsettings_cursor_size != cursor_size)
{
cursor_size = xsettings_cursor_size;
queue_changed (META_PREF_CURSOR_SIZE);
}
}
/**
* maybe_give_disable_workaround_warning:
*
@ -1347,26 +1327,10 @@ meta_prefs_get_cursor_theme (void)
return cursor_theme;
}
static int
get_scale_factor (void)
{
GdkScreen *screen;
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_INT);
/* XXX: Should this be in ui/ ? Or MetaMonitorManager? */
screen = gdk_screen_get_default ();
if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
return g_value_get_int (&value);
else
return 1;
}
int
meta_prefs_get_cursor_size (void)
{
return cursor_size * get_scale_factor ();
return cursor_size;
}

View File

@ -441,7 +441,6 @@ create_guard_window (Display *xdisplay, MetaScreen *screen)
XSetWindowAttributes attributes;
Window guard_window;
gulong create_serial;
MetaStackWindow stack_window;
attributes.event_mask = NoEventMask;
attributes.override_redirect = True;
@ -487,16 +486,12 @@ create_guard_window (Display *xdisplay, MetaScreen *screen)
}
}
stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
stack_window.x11.xwindow = guard_window;
meta_stack_tracker_record_add (screen->stack_tracker,
&stack_window,
guard_window,
create_serial);
meta_stack_tracker_record_lower (screen->stack_tracker,
&stack_window,
XNextRequest (xdisplay));
XLowerWindow (xdisplay, guard_window);
meta_stack_tracker_lower (screen->stack_tracker,
guard_window);
XMapWindow (xdisplay, guard_window);
return guard_window;
}
@ -884,19 +879,20 @@ meta_screen_create_guard_window (MetaScreen *screen)
void
meta_screen_manage_all_windows (MetaScreen *screen)
{
MetaStackWindow *_children;
MetaStackWindow *children;
guint64 *_children;
guint64 *children;
int n_children, i;
meta_stack_freeze (screen->stack);
meta_stack_tracker_get_stack (screen->stack_tracker, &_children, &n_children);
/* Copy the stack as it will be modified as part of the loop */
children = g_memdup (_children, sizeof (MetaStackWindow) * n_children);
children = g_memdup (_children, sizeof (guint64) * n_children);
for (i = 0; i < n_children; ++i)
{
meta_window_x11_new (screen->display, children[i].x11.xwindow, TRUE,
g_assert (META_STACK_ID_IS_X11 (children[i]));
meta_window_x11_new (screen->display, children[i], TRUE,
META_COMP_EFFECT_NONE);
}

File diff suppressed because it is too large Load Diff

View File

@ -39,51 +39,30 @@
typedef struct _MetaStackTracker MetaStackTracker;
typedef union _MetaStackWindow
{
struct {
MetaWindowClientType type;
} any;
struct {
MetaWindowClientType type;
Window xwindow;
} x11;
struct {
MetaWindowClientType type;
MetaWindow *meta_window;
} wayland;
} MetaStackWindow;
gboolean meta_stack_window_equal (const MetaStackWindow *a,
const MetaStackWindow *b);
MetaStackTracker *meta_stack_tracker_new (MetaScreen *screen);
void meta_stack_tracker_free (MetaStackTracker *tracker);
/* These functions are called when we make an X call that changes the
* stacking order; this allows MetaStackTracker to predict stacking
* order before it receives events back from the X server */
void meta_stack_tracker_record_add (MetaStackTracker *tracker,
const MetaStackWindow *window,
gulong serial);
void meta_stack_tracker_record_remove (MetaStackTracker *tracker,
const MetaStackWindow *window,
gulong serial);
void meta_stack_tracker_record_restack_windows (MetaStackTracker *tracker,
const MetaStackWindow *windows,
int n_windows,
gulong serial);
void meta_stack_tracker_record_raise_above (MetaStackTracker *tracker,
const MetaStackWindow *window,
const MetaStackWindow *sibling,
gulong serial);
void meta_stack_tracker_record_lower_below (MetaStackTracker *tracker,
const MetaStackWindow *window,
const MetaStackWindow *sibling,
gulong serial);
void meta_stack_tracker_record_lower (MetaStackTracker *tracker,
const MetaStackWindow *window,
gulong serial);
void meta_stack_tracker_record_add (MetaStackTracker *tracker,
guint64 window,
gulong serial);
void meta_stack_tracker_record_remove (MetaStackTracker *tracker,
guint64 window,
gulong serial);
/* We also have functions that also go ahead and do the work
*/
void meta_stack_tracker_lower (MetaStackTracker *tracker,
guint64 window);
void meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
const guint64 *windows,
int n_windows);
void meta_stack_tracker_restack_at_bottom (MetaStackTracker *tracker,
const guint64 *new_order,
int n_new_order);
/* These functions are used to update the stack when we get events
* reflecting changes to the stacking order */
@ -96,9 +75,9 @@ void meta_stack_tracker_reparent_event (MetaStackTracker *tracker,
void meta_stack_tracker_configure_event (MetaStackTracker *tracker,
XConfigureEvent *event);
void meta_stack_tracker_get_stack (MetaStackTracker *tracker,
MetaStackWindow **windows,
int *n_entries);
void meta_stack_tracker_get_stack (MetaStackTracker *tracker,
guint64 **windows,
int *n_entries);
void meta_stack_tracker_sync_stack (MetaStackTracker *tracker);
void meta_stack_tracker_queue_sync_stack (MetaStackTracker *tracker);

View File

@ -76,8 +76,6 @@ meta_stack_new (MetaScreen *screen)
stack->removed = NULL;
stack->freeze_count = 0;
stack->last_all_root_children_stacked = NULL;
stack->n_positions = 0;
stack->need_resort = FALSE;
@ -87,13 +85,6 @@ meta_stack_new (MetaScreen *screen)
return stack;
}
static void
free_last_all_root_children_stacked_cache (MetaStack *stack)
{
g_array_free (stack->last_all_root_children_stacked, TRUE);
stack->last_all_root_children_stacked = NULL;
}
void
meta_stack_free (MetaStack *stack)
{
@ -103,9 +94,6 @@ meta_stack_free (MetaStack *stack)
g_list_free (stack->added);
g_list_free (stack->removed);
if (stack->last_all_root_children_stacked)
free_last_all_root_children_stacked_cache (stack);
g_free (stack);
}
@ -113,6 +101,8 @@ void
meta_stack_add (MetaStack *stack,
MetaWindow *window)
{
g_return_if_fail (!window->override_redirect);
meta_topic (META_DEBUG_STACK, "Adding window %s to the stack\n", window->desc);
if (window->stack_position >= 0)
@ -1030,194 +1020,6 @@ stack_ensure_sorted (MetaStack *stack)
stack_do_resort (stack);
}
static MetaStackWindow *
find_top_most_managed_window (MetaScreen *screen,
const MetaStackWindow *ignore)
{
MetaStackTracker *stack_tracker = screen->stack_tracker;
MetaStackWindow *windows;
int n_windows;
int i;
meta_stack_tracker_get_stack (stack_tracker,
&windows, &n_windows);
/* Children are in order from bottom to top. We want to
* find the topmost managed child, then configure
* our window to be above it.
*/
for (i = n_windows -1; i >= 0; i--)
{
MetaStackWindow *other_window = &windows[i];
if (other_window->any.type == ignore->any.type &&
((other_window->any.type == META_WINDOW_CLIENT_TYPE_X11 &&
other_window->x11.xwindow == ignore->x11.xwindow) ||
other_window->wayland.meta_window == ignore->wayland.meta_window))
{
/* Do nothing. This means we're already the topmost managed
* window, but it DOES NOT mean we are already just above
* the topmost managed window. This is important because if
* an override redirect window is up, and we map a new
* managed window, the new window is probably above the old
* popup by default, and we want to push it below that
* popup. So keep looking for a sibling managed window
* to be moved below.
*/
}
else
{
if (other_window->any.type == META_WINDOW_CLIENT_TYPE_X11)
{
MetaWindow *other = meta_display_lookup_x_window (screen->display,
other_window->x11.xwindow);
if (other != NULL && !other->override_redirect)
return other_window;
}
else
{
/* All wayland windows are currently considered "managed"
* TODO: consider wayland pop-up windows like override
* redirect windows here. */
return other_window;
}
}
}
return NULL;
}
/* When moving an X window we sometimes need an X based sibling.
*
* If the given sibling is X based this function returns it back
* otherwise it searches downwards looking for the nearest X window.
*
* If no X based sibling could be found return NULL. */
static MetaStackWindow *
find_x11_sibling_downwards (MetaScreen *screen,
MetaStackWindow *sibling)
{
MetaStackTracker *stack_tracker = screen->stack_tracker;
MetaStackWindow *windows;
int n_windows;
int i;
if (sibling->any.type == META_WINDOW_CLIENT_TYPE_X11)
return sibling;
meta_stack_tracker_get_stack (stack_tracker,
&windows, &n_windows);
/* NB: Children are in order from bottom to top and we
* want to search downwards for the nearest X window.
*/
for (i = n_windows - 1; i >= 0; i--)
if (meta_stack_window_equal (&windows[i], sibling))
break;
for (; i >= 0; i--)
{
if (windows[i].any.type == META_WINDOW_CLIENT_TYPE_X11)
return &windows[i];
}
return NULL;
}
/**
* raise_window_relative_to_managed_windows:
*
* This function is used to avoid raising a window above popup
* menus and other such things.
*
* The key to the operation of this function is that we are expecting
* at most one window to be added at a time. If xwindow is newly added,
* then its own stack position will be too high (the frame window
* is created at the top of the stack), but if we ignore xwindow,
* then the *next* managed window in the stack will be a window that
* we've already stacked.
*
* We could generalize this and remove the assumption that windows
* are added one at a time by keeping an explicit ->stacked flag in
* MetaWindow.
*
* An alternate approach would be to reverse the stacking algorithm to
* work by placing each window above the others, and start by lowering
* a window to the bottom (instead of the current way, which works by
* placing each window below another and starting with a raise)
*/
static void
raise_window_relative_to_managed_windows (MetaScreen *screen,
const MetaStackWindow *window)
{
gulong serial = 0;
MetaStackWindow *sibling;
sibling = find_top_most_managed_window (screen, window);
if (!sibling)
{
if (window->any.type == META_WINDOW_CLIENT_TYPE_X11)
{
serial = XNextRequest (screen->display->xdisplay);
meta_error_trap_push (screen->display);
XLowerWindow (screen->display->xdisplay,
window->x11.xwindow);
meta_error_trap_pop (screen->display);
}
/* No sibling to use, just lower ourselves to the bottom
* to be sure we're below any override redirect windows.
*/
meta_stack_tracker_record_lower (screen->stack_tracker,
window,
serial);
return;
}
/* window is the topmost managed child */
meta_topic (META_DEBUG_STACK,
"Moving 0x%lx above topmost managed child window 0x%lx\n",
window->any.type == META_WINDOW_CLIENT_TYPE_X11 ? window->x11.xwindow: 0,
sibling->any.type == META_WINDOW_CLIENT_TYPE_X11 ? sibling->x11.xwindow: 0);
if (window->any.type == META_WINDOW_CLIENT_TYPE_X11)
{
XWindowChanges changes;
MetaStackWindow *x11_sibling = find_x11_sibling_downwards (screen, sibling);
serial = XNextRequest (screen->display->xdisplay);
if (x11_sibling)
{
changes.sibling = x11_sibling->x11.xwindow;
changes.stack_mode = Above;
meta_error_trap_push (screen->display);
XConfigureWindow (screen->display->xdisplay,
window->x11.xwindow,
CWSibling | CWStackMode,
&changes);
meta_error_trap_pop (screen->display);
}
else
{
/* No sibling to use, just lower ourselves to the bottom
* to be sure we're below any override redirect windows.
*/
meta_error_trap_push (screen->display);
XLowerWindow (screen->display->xdisplay,
window->x11.xwindow);
meta_error_trap_pop (screen->display);
}
}
meta_stack_tracker_record_raise_above (screen->stack_tracker,
window,
sibling,
serial);
}
/**
* stack_sync_to_server:
*
@ -1235,13 +1037,9 @@ static void
stack_sync_to_xserver (MetaStack *stack)
{
GArray *x11_stacked;
GArray *x11_root_children_stacked;
GArray *all_root_children_stacked; /* wayland OR x11 */
GList *tmp;
GArray *x11_hidden;
GArray *x11_hidden_stack_windows;
int n_override_redirect = 0;
MetaStackWindow guard_stack_window;
GArray *x11_hidden_stack_ids;
/* Bail out if frozen */
if (stack->freeze_count > 0)
@ -1251,42 +1049,33 @@ stack_sync_to_xserver (MetaStack *stack)
stack_ensure_sorted (stack);
/* Create stacked xwindow arrays.
* Painfully, "stacked" is in bottom-to-top order for the
* _NET hints, and "root_children_stacked" is in top-to-bottom
* order for XRestackWindows()
/* Create stacked xwindow arrays, in bottom-to-top order
*/
x11_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (MetaStackWindow));
x11_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
x11_hidden_stack_windows = g_array_new (FALSE, FALSE, sizeof (MetaStackWindow));
x11_hidden = g_array_new (FALSE, FALSE, sizeof (Window));
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
x11_hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
/* The screen guard window sits above all hidden windows and acts as
* a barrier to input reaching these windows. */
g_array_append_val (x11_hidden, stack->screen->guard_window);
g_array_append_val (x11_hidden_stack_ids, stack->screen->guard_window);
meta_topic (META_DEBUG_STACK, "Top to bottom: ");
meta_push_no_msg_prefix ();
for (tmp = stack->sorted; tmp != NULL; tmp = tmp->next)
for (tmp = g_list_last(stack->sorted); tmp != NULL; tmp = tmp->prev)
{
MetaWindow *w = tmp->data;
Window top_level_window;
MetaStackWindow stack_window;
guint64 stack_id;
stack_window.any.type = w->client_type;
if (w->unmanaging)
continue;
meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
w->layer, w->stack_position, w->desc);
/* remember, stacked is in reverse order (bottom to top) */
if (w->override_redirect)
n_override_redirect++;
else
g_array_prepend_val (x11_stacked, w->xwindow);
g_array_append_val (x11_stacked, w->xwindow);
if (w->frame)
top_level_window = w->frame->xwindow;
@ -1294,9 +1083,9 @@ stack_sync_to_xserver (MetaStack *stack)
top_level_window = w->xwindow;
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
stack_window.x11.xwindow = top_level_window;
stack_id = top_level_window;
else
stack_window.wayland.meta_window = w;
stack_id = w->stamp;
/* We don't restack hidden windows along with the rest, though they are
* reflected in the _NET hints. Hidden windows all get pushed below
@ -1305,267 +1094,30 @@ stack_sync_to_xserver (MetaStack *stack)
{
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
MetaStackWindow stack_window;
guint64 stack_id = top_level_window;
stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
stack_window.x11.xwindow = top_level_window;
g_array_append_val (x11_hidden_stack_windows, stack_window);
g_array_append_val (x11_hidden, top_level_window);
g_array_append_val (x11_hidden_stack_ids, stack_id);
}
continue;
}
g_array_append_val (all_root_children_stacked, stack_window);
/* build XRestackWindows() array from top to bottom */
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
g_array_append_val (x11_root_children_stacked, top_level_window);
g_array_append_val (all_root_children_stacked, stack_id);
}
meta_topic (META_DEBUG_STACK, "\n");
meta_pop_no_msg_prefix ();
/* All X windows should be in some stacking order */
if (x11_stacked->len != stack->xwindows->len - n_override_redirect)
meta_bug ("%u windows stacked, %u windows exist in stack\n",
x11_stacked->len, stack->xwindows->len);
/* Sync to server */
meta_topic (META_DEBUG_STACK, "Restacking %u windows\n",
all_root_children_stacked->len);
meta_error_trap_push (stack->screen->display);
if (stack->last_all_root_children_stacked == NULL)
{
/* Just impose our stack, we don't know the previous state.
* This involves a ton of circulate requests and may flicker.
*/
meta_topic (META_DEBUG_STACK, "Don't know last stack state, restacking everything\n");
if (all_root_children_stacked->len > 1)
{
gulong serial = 0;
if (x11_root_children_stacked->len > 1)
{
serial = XNextRequest (stack->screen->display->xdisplay);
XRestackWindows (stack->screen->display->xdisplay,
(Window *) x11_root_children_stacked->data,
x11_root_children_stacked->len);
}
meta_stack_tracker_record_restack_windows (stack->screen->stack_tracker,
(MetaStackWindow *) all_root_children_stacked->data,
all_root_children_stacked->len,
serial);
}
}
else if (all_root_children_stacked->len > 0)
{
/* Try to do minimal window moves to get the stack in order */
/* A point of note: these arrays include frames not client windows,
* so if a client window has changed frame since last_root_children_stacked
* was saved, then we may have inefficiency, but I don't think things
* break...
*/
const MetaStackWindow *old_stack = (MetaStackWindow *) stack->last_all_root_children_stacked->data;
const MetaStackWindow *new_stack = (MetaStackWindow *) all_root_children_stacked->data;
const int old_len = stack->last_all_root_children_stacked->len;
const int new_len = all_root_children_stacked->len;
const MetaStackWindow *oldp = old_stack;
const MetaStackWindow *newp = new_stack;
const MetaStackWindow *old_end = old_stack + old_len;
const MetaStackWindow *new_end = new_stack + new_len;
Window last_xwindow = None;
const MetaStackWindow *last_window = NULL;
while (oldp != old_end &&
newp != new_end)
{
if (meta_stack_window_equal (oldp, newp))
{
/* Stacks are the same here, move on */
++oldp;
if (newp->any.type == META_WINDOW_CLIENT_TYPE_X11)
last_xwindow = newp->x11.xwindow;
last_window = newp;
++newp;
}
else if ((oldp->any.type == META_WINDOW_CLIENT_TYPE_X11 &&
meta_display_lookup_x_window (stack->screen->display,
oldp->x11.xwindow) == NULL) ||
(oldp->any.type == META_WINDOW_CLIENT_TYPE_WAYLAND &&
oldp->wayland.meta_window == NULL))
{
/* *oldp is no longer known to us (probably destroyed),
* so we can just skip it
*/
++oldp;
}
else
{
/* Move *newp below the last_window */
if (!last_window)
{
meta_topic (META_DEBUG_STACK, "Using window 0x%lx as topmost (but leaving it in-place)\n",
newp->x11.xwindow);
raise_window_relative_to_managed_windows (stack->screen, newp);
}
else if (newp->any.type == META_WINDOW_CLIENT_TYPE_X11 &&
last_xwindow == None)
{
/* In this case we have an X window that we need to
* put below a wayland window and this is the
* topmost X window. */
/* In X terms (because this is the topmost X window)
* we want to
* raise_window_relative_to_managed_windows() to
* ensure the X window is below override-redirect
* pop-up windows.
*
* In Wayland terms we just want to ensure
* newp is lowered below last_window (which
* notably doesn't require an X request because we
* know last_window isn't an X window).
*/
raise_window_relative_to_managed_windows (stack->screen, newp);
meta_stack_tracker_record_lower_below (stack->screen->stack_tracker,
newp, last_window,
0); /* no x request serial */
}
else
{
gulong serial = 0;
/* This means that if last_xwindow is dead, but not
* *newp, then we fail to restack *newp; but on
* unmanaging last_xwindow, we'll fix it up.
*/
meta_topic (META_DEBUG_STACK, "Placing window 0x%lx below 0x%lx\n",
newp->any.type == META_WINDOW_CLIENT_TYPE_X11 ? newp->x11.xwindow : 0,
last_xwindow);
if (newp->any.type == META_WINDOW_CLIENT_TYPE_X11)
{
XWindowChanges changes;
serial = XNextRequest (stack->screen->display->xdisplay);
changes.sibling = last_xwindow;
changes.stack_mode = Below;
XConfigureWindow (stack->screen->display->xdisplay,
newp->x11.xwindow,
CWSibling | CWStackMode,
&changes);
}
meta_stack_tracker_record_lower_below (stack->screen->stack_tracker,
newp, last_window,
serial);
}
if (newp->any.type == META_WINDOW_CLIENT_TYPE_X11)
last_xwindow = newp->x11.xwindow;
last_window = newp;
++newp;
}
}
if (newp != new_end)
{
const MetaStackWindow *x_ref;
unsigned long serial = 0;
/* Restack remaining windows */
meta_topic (META_DEBUG_STACK, "Restacking remaining %d windows\n",
(int) (new_end - newp));
/* rewind until we find the last stacked X window that we can use
* as a reference point for re-stacking remaining X windows */
if (newp != new_stack)
for (x_ref = newp - 1;
x_ref->any.type != META_WINDOW_CLIENT_TYPE_X11 && x_ref > new_stack;
x_ref--)
;
else
x_ref = new_stack;
/* If we didn't find an X window looking backwards then walk forwards
* through the remaining windows to find the first remaining X window
* instead. */
if (x_ref->any.type != META_WINDOW_CLIENT_TYPE_X11)
{
for (x_ref = newp;
x_ref->any.type != META_WINDOW_CLIENT_TYPE_X11 && x_ref < new_end;
x_ref++)
;
}
/* If there are any X windows remaining unstacked then restack them */
if (x_ref->any.type == META_WINDOW_CLIENT_TYPE_X11)
{
int i;
for (i = x11_root_children_stacked->len - 1; i; i--)
{
Window *reference = &g_array_index (x11_root_children_stacked, Window, i);
if (*reference == x_ref->x11.xwindow)
{
int n = x11_root_children_stacked->len - i;
/* There's no point restacking if there's only one X window */
if (n == 1)
break;
serial = XNextRequest (stack->screen->display->xdisplay);
XRestackWindows (stack->screen->display->xdisplay,
reference, n);
break;
}
}
}
/* We need to include an already-stacked window
* in the restack call, so we get in the proper position
* with respect to it.
*/
if (newp != new_stack)
newp = MIN (newp - 1, x_ref);
meta_stack_tracker_record_restack_windows (stack->screen->stack_tracker,
newp, new_end - newp,
serial);
}
}
/* Push hidden X windows to the bottom of the stack under the guard window */
guard_stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
guard_stack_window.x11.xwindow = stack->screen->guard_window;
meta_stack_tracker_record_lower (stack->screen->stack_tracker,
&guard_stack_window,
XNextRequest (stack->screen->display->xdisplay));
XLowerWindow (stack->screen->display->xdisplay, stack->screen->guard_window);
meta_stack_tracker_record_restack_windows (stack->screen->stack_tracker,
(MetaStackWindow *)x11_hidden_stack_windows->data,
x11_hidden_stack_windows->len,
XNextRequest (stack->screen->display->xdisplay));
XRestackWindows (stack->screen->display->xdisplay,
(Window *)x11_hidden->data,
x11_hidden->len);
g_array_free (x11_hidden, TRUE);
g_array_free (x11_hidden_stack_windows, TRUE);
meta_error_trap_pop (stack->screen->display);
/* on error, a window was destroyed; it should eventually
* get removed from the stacking list when we unmanage it
* and we'll fix stacking at that time.
*/
meta_stack_tracker_restack_managed (stack->screen->stack_tracker,
(guint64 *)all_root_children_stacked->data,
all_root_children_stacked->len);
meta_stack_tracker_restack_at_bottom (stack->screen->stack_tracker,
(guint64 *)x11_hidden_stack_ids->data,
x11_hidden_stack_ids->len);
/* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */
@ -1585,14 +1137,7 @@ stack_sync_to_xserver (MetaStack *stack)
x11_stacked->len);
g_array_free (x11_stacked, TRUE);
if (stack->last_all_root_children_stacked)
free_last_all_root_children_stacked_cache (stack);
stack->last_all_root_children_stacked = all_root_children_stacked;
g_array_free (x11_root_children_stacked, TRUE);
/* That was scary... */
g_array_free (all_root_children_stacked, TRUE);
}
MetaWindow*
@ -1730,6 +1275,9 @@ get_default_focus_window (MetaStack *stack,
if (window->minimized)
continue;
if (window->unmanaging)
continue;
if (!(window->input || window->take_focus))
continue;

View File

@ -92,6 +92,7 @@ struct _MetaWindow
MetaDisplay *display;
MetaScreen *screen;
guint64 stamp;
const MetaMonitorInfo *monitor;
MetaWorkspace *workspace;
MetaWindowClientType client_type;
@ -652,9 +653,6 @@ void meta_window_set_transient_for (MetaWindow *window,
void meta_window_set_opacity (MetaWindow *window,
guint8 opacity);
void meta_window_set_custom_frame_extents (MetaWindow *window,
GtkBorder *extents);
void meta_window_handle_enter (MetaWindow *window,
guint32 timestamp,
guint root_x,

View File

@ -71,6 +71,10 @@
static int destroying_windows_disallowed = 0;
// Each window has a "stamp" which is a non-recycled 64-bit ID. They
// start after the end of the XID space so that, for stacking
// we can keep a guint64 that represents one or the other
static guint64 next_window_stamp = G_GUINT64_CONSTANT(0x100000000);
static void invalidate_work_areas (MetaWindow *window);
static void set_wm_state (MetaWindow *window);
@ -642,6 +646,7 @@ meta_window_class_init (MetaWindowClass *klass)
static void
meta_window_init (MetaWindow *self)
{
self->stamp = next_window_stamp++;
meta_prefs_add_listener (prefs_changed_callback, self);
}
@ -803,6 +808,8 @@ _meta_window_shared_new (MetaDisplay *display,
* type
*/
window->display = display;
meta_display_register_stamp (window->display, &window->stamp, window);
window->workspace = NULL;
window->sync_request_counter = None;
@ -1239,6 +1246,8 @@ meta_window_unmanage (MetaWindow *window,
meta_bug ("Tried to destroy window %s while destruction was not allowed\n",
window->desc);
meta_display_unregister_stamp (window->display, window->stamp);
window->unmanaging = TRUE;
if (meta_prefs_get_attach_modal_dialogs ())
@ -1296,9 +1305,7 @@ meta_window_unmanage (MetaWindow *window,
meta_topic (META_DEBUG_FOCUS,
"Focusing default window since we're unmanaging %s\n",
window->desc);
meta_workspace_focus_default_window (window->screen->active_workspace,
window,
timestamp);
meta_workspace_focus_default_window (window->screen->active_workspace, NULL, timestamp);
}
else
{
@ -7880,24 +7887,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
}
}
void
meta_window_set_custom_frame_extents (MetaWindow *window,
GtkBorder *extents)
{
if (extents)
{
window->has_custom_frame_extents = TRUE;
window->custom_frame_extents = *extents;
}
else
{
window->has_custom_frame_extents = FALSE;
memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
}
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
gboolean
meta_window_can_maximize (MetaWindow *window)
{

View File

@ -1159,11 +1159,8 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
guint32 timestamp)
{
if (timestamp == CurrentTime)
{
meta_warning ("CurrentTime used to choose focus window; "
"focus window may not be correct.\n");
}
meta_warning ("CurrentTime used to choose focus window; "
"focus window may not be correct.\n");
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
!workspace->screen->display->mouse_mode)

View File

@ -22,10 +22,8 @@
#define META_BACKGROUND_ACTOR_H
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include <meta/gradient.h>
#include <meta/screen.h>
#include <meta/meta-background.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
@ -63,6 +61,15 @@ struct _MetaBackgroundActor
GType meta_background_actor_get_type (void);
ClutterActor *meta_background_actor_new (void);
ClutterActor *meta_background_actor_new (MetaScreen *screen,
int monitor);
void meta_background_actor_set_background (MetaBackgroundActor *self,
MetaBackground *background);
void meta_background_actor_set_vignette (MetaBackgroundActor *self,
gboolean enabled,
double brightness,
double sharpness);
#endif /* META_BACKGROUND_ACTOR_H */

View File

@ -0,0 +1,76 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* MetaBackgroundImageCache:
*
* Simple cache for background textures loaded from files
*
* Copyright 2014 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/>.
*/
#ifndef __META_BACKGROUND_IMAGE_H__
#define __META_BACKGROUND_IMAGE_H__
#include <glib-object.h>
#include <cogl/cogl.h>
#define META_TYPE_BACKGROUND_IMAGE (meta_background_image_get_type ())
#define META_BACKGROUND_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImage))
#define META_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImageClass))
#define META_IS_BACKGROUND_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_IMAGE))
#define META_IS_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_IMAGE))
#define META_BACKGROUND_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImageClass))
/**
* MetaBackgroundImage:
*
* #MetaBackgroundImage is an object that represents a loaded or loading background image.
*/
typedef struct _MetaBackgroundImage MetaBackgroundImage;
typedef struct _MetaBackgroundImageClass MetaBackgroundImageClass;
GType meta_background_image_get_type (void);
gboolean meta_background_image_is_loaded (MetaBackgroundImage *image);
gboolean meta_background_image_get_success (MetaBackgroundImage *image);
CoglTexture *meta_background_image_get_texture (MetaBackgroundImage *image);
#define META_TYPE_BACKGROUND_IMAGE_CACHE (meta_background_image_cache_get_type ())
#define META_BACKGROUND_IMAGE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCache))
#define META_BACKGROUND_IMAGE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCacheClass))
#define META_IS_BACKGROUND_IMAGE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE))
#define META_IS_BACKGROUND_IMAGE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_IMAGE_CACHE))
#define META_BACKGROUND_IMAGE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCacheClass))
/**
* MetaBackgroundImageCache:
*
* #MetaBackgroundImageCache caches loading of textures for backgrounds; there's actually
* nothing background specific about it, other than it is tuned to work well for
* large images as typically are used for backgrounds.
*/
typedef struct _MetaBackgroundImageCache MetaBackgroundImageCache;
typedef struct _MetaBackgroundImageCacheClass MetaBackgroundImageCacheClass;
MetaBackgroundImageCache *meta_background_image_cache_get_default (void);
GType meta_background_image_cache_get_type (void);
MetaBackgroundImage *meta_background_image_cache_load (MetaBackgroundImageCache *cache,
const char *filename);
void meta_background_image_cache_purge (MetaBackgroundImageCache *cache,
const char *filename);
#endif /* __META_BACKGROUND_IMAGE_H__ */

View File

@ -1,8 +1,8 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* meta-background.h: CoglTexture for paintnig the system background
* meta-background-actor.h: for painting the root window background
*
* Copyright 2013 Red Hat, Inc.
* Copyright 2010 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
@ -21,20 +21,16 @@
#ifndef META_BACKGROUND_H
#define META_BACKGROUND_H
#include <cogl/cogl.h>
#include <clutter/clutter.h>
#include <meta/gradient.h>
#include <meta/screen.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include <meta/screen.h>
/**
* MetaBackground:
*
* This class handles loading a background from file, screenshot, or
* color scheme. The resulting object can be associated with one or
* more #MetaBackgroundActor objects to handle loading the background.
* This class handles tracking and painting the root window background.
* By integrating with #MetaWindowGroup we can avoid painting parts of
* the background that are obscured by other windows.
*/
#define META_TYPE_BACKGROUND (meta_background_get_type ())
@ -48,20 +44,6 @@ typedef struct _MetaBackground MetaBackground;
typedef struct _MetaBackgroundClass MetaBackgroundClass;
typedef struct _MetaBackgroundPrivate MetaBackgroundPrivate;
/**
* MetaBackgroundEffects:
* @META_BACKGROUND_EFFECTS_NONE: No effect
* @META_BACKGROUND_EFFECTS_VIGNETTE: Vignette
*
* Which effects to enable on the background
*/
typedef enum
{
META_BACKGROUND_EFFECTS_NONE = 0,
META_BACKGROUND_EFFECTS_VIGNETTE = 1 << 1,
} MetaBackgroundEffects;
struct _MetaBackgroundClass
{
/*< private >*/
@ -70,7 +52,6 @@ struct _MetaBackgroundClass
struct _MetaBackground
{
/*< private >*/
GObject parent;
MetaBackgroundPrivate *priv;
@ -78,33 +59,21 @@ struct _MetaBackground
GType meta_background_get_type (void);
MetaBackground *meta_background_new (MetaScreen *screen,
int monitor,
MetaBackgroundEffects effects);
MetaBackground *meta_background_copy (MetaBackground *self,
int monitor,
MetaBackgroundEffects effects);
MetaBackground *meta_background_new (MetaScreen *screen);
void meta_background_load_gradient (MetaBackground *self,
GDesktopBackgroundShading shading_direction,
ClutterColor *color,
ClutterColor *second_color);
void meta_background_load_color (MetaBackground *self,
ClutterColor *color);
void meta_background_load_file_async (MetaBackground *self,
const char *filename,
GDesktopBackgroundStyle style,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean meta_background_load_file_finish (MetaBackground *self,
GAsyncResult *result,
GError **error);
const char *meta_background_get_filename (MetaBackground *self);
GDesktopBackgroundStyle meta_background_get_style (MetaBackground *self);
GDesktopBackgroundShading meta_background_get_shading (MetaBackground *self);
const ClutterColor *meta_background_get_color (MetaBackground *self);
const ClutterColor *meta_background_get_second_color (MetaBackground *self);
void meta_background_set_color (MetaBackground *self,
ClutterColor *color);
void meta_background_set_gradient (MetaBackground *self,
GDesktopBackgroundShading shading_direction,
ClutterColor *color,
ClutterColor *second_color);
void meta_background_set_filename (MetaBackground *self,
const char *filename,
GDesktopBackgroundStyle style);
void meta_background_set_blend (MetaBackground *self,
const char *filename1,
const char *filename2,
double blend_factor,
GDesktopBackgroundStyle style);
#endif /* META_BACKGROUND_H */

86
src/tests/README Normal file
View File

@ -0,0 +1,86 @@
This directory implements a framework for automated tests of Mutter. The basic
idea is that mutter-test-runner acts as the window manager and compositor, and
forks off instances of mutter-test-client to act as clients.
There's a simple scripting language for tests. A very small test would look like:
---
# Start up a new X11 client with the client id 1 (doesn't have to be an integer)
# Windows for this client will be referred to as 1/<window-id>
new_client 1 x11
# Create and show two windows - again the IDs don't have to be integers
create 1/1
show 1/1
create 1/2
show 1/2
# Wait for the commands we've executed in the clients to reach Mutter
wait
# Check that the windows are in the order we expect
assert_stacking 1/1 1/2
---
Running
=======
The tests are installed according to:
https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests
if --enable-installed-tests is passed to configure. You can run them
uninstalled with:
cd src && make run-tests
Command reference
=================
The following commands are supported. Quoting and comments follow shell rules.
new_client <client-id> [wayland|x11]
Starts a client, connecting by either Wayland or X11. The client
will subsequently be known with the given client-id (an arbitrary
string)
quit_client <client-id>
Destroys all windows for the client, waits for that to be processed,
then instructs the client to exit.
create <client-id>/<window-id> [override|csd]
Creates a new window. For the X11 backend, the keyword 'override'
can be given to create an override-redirect and the keyword 'csd'
can be given to create a client-side decorated window.
show <client-id>/<window-id>
hide <client-id>/<window-id>
Ask the client to show (map) or hide (unmap) the given window
activate <client-id>/<window-id>
Ask the client to raise and focus the given window. This is currently a no-op
for Wayland, where this capability is not supported in the protocol.
local_activate <client-id>-<window-id>
The same as 'activate', but the operation is done directly inside Mutter
and works for both backends
raise <client-id>/<window-id>
lower <client-id>/<window-id>
Ask the client to raise or lower the given window ID. This is a no-op
for Wayland clients. (It's also considered discouraged, but supported, for
non-override-redirect X11 clients.)
destroy <client-id>/<window-id>
Destroy the given window
wait
Wait until all requests sent by Mutter to clients have been received by Mutter,
and then wait until all requests by Mutter have been processed by the X server.
assert_stacking <client-id>/<window-id> <client-id>/<window-id> ...
Assert that the list of client windows known to Mutter is as given and in
the given order, bottom to top.
This function also queries the X server stack and verifies that Mutter's
expectation of the X server stack matches reality.

View File

@ -0,0 +1,5 @@
[Test]
Description=All Mutter tests
Exec=@libexecdir@/installed-tests/mutter/mutter-test-runner --all
Type=session
Output=TAP

View File

@ -0,0 +1,22 @@
new_client 1 wayland
create 1/1
show 1/1
create 1/2
show 1/2
wait
assert_stacking 1/1 1/2
# Currently Wayland clients have no wait to bring themselves to the user's
# attention; gtk_window_present() is a no-op with the X11 backend of GTK+
# activate 1/1
# wait
# assert_stacking 1/2 1/1
# activate 1/2
# wait
# assert_stacking 1/1 1/2
local_activate 1/1
assert_stacking 1/2 1/1
local_activate 1/2
assert_stacking 1/1 1/2

View File

@ -0,0 +1,19 @@
new_client 1 x11
create 1/1
show 1/1
create 1/2
show 1/2
wait
assert_stacking 1/1 1/2
activate 1/1
wait
assert_stacking 1/2 1/1
activate 1/2
wait
assert_stacking 1/1 1/2
local_activate 1/1
assert_stacking 1/2 1/1
local_activate 1/2
assert_stacking 1/1 1/2

View File

@ -0,0 +1,22 @@
new_client 1 x11
create 1/1
show 1/1
create 1/2 csd
show 1/2
wait
assert_stacking 1/1 1/2
destroy 1/2
wait
assert_stacking 1/1
create 1/2 csd
show 1/2
create 1/3 csd
show 1/3
wait
assert_stacking 1/1 1/2 1/3
destroy 1/2
wait
assert_stacking 1/1 1/3

View File

@ -0,0 +1,26 @@
new_client w wayland
new_client x x11
create w/1
show w/1
create w/2
show w/2
wait
create x/1
show x/1
create x/2
show x/2
wait
assert_stacking w/1 w/2 x/1 x/2
local_activate w/1
assert_stacking w/2 x/1 x/2 w/1
local_activate x/1
assert_stacking w/2 x/2 w/1 x/1
lower x/1
wait
assert_stacking x/1 w/2 x/2 w/1

View File

@ -0,0 +1,19 @@
new_client 1 x11
create 1/1
show 1/1
create 1/2 override
show 1/2
wait
assert_stacking 1/1 1/2
activate 1/1
wait
assert_stacking 1/1 1/2
lower 1/2
wait
assert_stacking 1/2 1/1
raise 1/2
wait
assert_stacking 1/1 1/2

357
src/tests/test-client.c Normal file
View File

@ -0,0 +1,357 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2014 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 <gio/gunixinputstream.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <X11/extensions/sync.h>
char *client_id = "0";
static gboolean wayland;
GHashTable *windows;
static void read_next_line (GDataInputStream *in);
static GtkWidget *
lookup_window (const char *window_id)
{
GtkWidget *window = g_hash_table_lookup (windows, window_id);
if (!window)
g_print ("Window %s doesn't exist", window_id);
return window;
}
static void
process_line (const char *line)
{
GError *error = NULL;
int argc;
char **argv;
if (!g_shell_parse_argv (line, &argc, &argv, &error))
{
g_print ("error parsing command: %s", error->message);
g_error_free (error);
return;
}
if (argc < 1)
{
g_print ("Empty command");
goto out;
}
if (strcmp (argv[0], "create") == 0)
{
int i;
if (argc < 2)
{
g_print ("usage: create <id> [override|csd]");
goto out;
}
if (g_hash_table_lookup (windows, argv[1]))
{
g_print ("window %s already exists", argv[1]);
goto out;
}
gboolean override = FALSE;
gboolean csd = FALSE;
for (i = 2; i < argc; i++)
{
if (strcmp (argv[i], "override") == 0)
override = TRUE;
if (strcmp (argv[i], "csd") == 0)
csd = TRUE;
}
if (override && csd)
{
g_print ("override and csd keywords are exclusie");
goto out;
}
GtkWidget *window = gtk_window_new (override ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL);
g_hash_table_insert (windows, g_strdup (argv[1]), window);
if (csd)
{
GtkWidget *headerbar = gtk_header_bar_new ();
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_widget_show (headerbar);
}
gtk_window_set_default_size (GTK_WINDOW (window), 100, 100);
gchar *title = g_strdup_printf ("test/%s/%s", client_id, argv[1]);
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
gtk_widget_realize (window);
if (!wayland)
{
/* The cairo xlib backend creates a window when initialized, which
* confuses our testing if it happens asynchronously the first
* time a window is painted. By creating an Xlib surface and
* destroying it, we force initialization at a more predictable time.
*/
GdkWindow *window_gdk = gtk_widget_get_window (window);
cairo_surface_t *surface = gdk_window_create_similar_surface (window_gdk,
CAIRO_CONTENT_COLOR,
1, 1);
cairo_surface_destroy (surface);
}
}
else if (strcmp (argv[0], "show") == 0)
{
if (argc != 2)
{
g_print ("usage: show <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
gtk_widget_show (window);
}
else if (strcmp (argv[0], "hide") == 0)
{
if (argc != 2)
{
g_print ("usage: hide <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
gtk_widget_hide (window);
}
else if (strcmp (argv[0], "activate") == 0)
{
if (argc != 2)
{
g_print ("usage: activate <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
gtk_window_present (GTK_WINDOW (window));
}
else if (strcmp (argv[0], "raise") == 0)
{
if (argc != 2)
{
g_print ("usage: raise <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
gdk_window_raise (gtk_widget_get_window (window));
}
else if (strcmp (argv[0], "lower") == 0)
{
if (argc != 2)
{
g_print ("usage: lower <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
gdk_window_lower (gtk_widget_get_window (window));
}
else if (strcmp (argv[0], "destroy") == 0)
{
if (argc != 2)
{
g_print ("usage: destroy <id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
goto out;
g_hash_table_remove (windows, argv[1]);
gtk_widget_destroy (window);
}
else if (strcmp (argv[0], "destroy_all") == 0)
{
if (argc != 1)
{
g_print ("usage: destroy_all");
goto out;
}
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, windows);
while (g_hash_table_iter_next (&iter, &key, &value))
gtk_widget_destroy (value);
g_hash_table_remove_all (windows);
}
else if (strcmp (argv[0], "sync") == 0)
{
if (argc != 1)
{
g_print ("usage: sync");
goto out;
}
gdk_display_sync (gdk_display_get_default ());
}
else if (strcmp (argv[0], "set_counter") == 0)
{
XSyncCounter counter;
int value;
if (argc != 3)
{
g_print ("usage: set_counter <counter> <value>");
goto out;
}
if (wayland)
{
g_print ("usage: set_counter can only be used for X11");
goto out;
}
counter = strtoul(argv[1], NULL, 10);
value = atoi(argv[2]);
XSyncValue sync_value;
XSyncIntToValue (&sync_value, value);
XSyncSetCounter (gdk_x11_display_get_xdisplay (gdk_display_get_default ()),
counter, sync_value);
}
else
{
g_print ("Unknown command %s", argv[0]);
goto out;
}
g_print ("OK\n");
out:
g_strfreev (argv);
}
static void
on_line_received (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GDataInputStream *in = G_DATA_INPUT_STREAM (source);
GError *error = NULL;
gsize length;
char *line = g_data_input_stream_read_line_finish_utf8 (in, result, &length, &error);
if (line == NULL)
{
if (error != NULL)
g_printerr ("Error reading from stdin: %s\n", error->message);
gtk_main_quit ();
return;
}
process_line (line);
g_free (line);
read_next_line (in);
}
static void
read_next_line (GDataInputStream *in)
{
g_data_input_stream_read_line_async (in, G_PRIORITY_DEFAULT, NULL,
on_line_received, NULL);
}
const GOptionEntry options[] = {
{
"wayland", 0, 0, G_OPTION_ARG_NONE,
&wayland,
"Create a wayland client, not an X11 one",
NULL
},
{
"client-id", 0, 0, G_OPTION_ARG_STRING,
&client_id,
"Identifier used in Window titles for this client",
"CLIENT_ID",
},
{ NULL }
};
int
main(int argc, char **argv)
{
GOptionContext *context = g_option_context_new (NULL);
GError *error = NULL;
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context,
&argc, &argv, &error))
{
g_printerr ("%s", error->message);
return 1;
}
if (wayland)
gdk_set_allowed_backends ("wayland");
else
gdk_set_allowed_backends ("x11");
gtk_init (NULL, NULL);
windows = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
GInputStream *raw_in = g_unix_input_stream_new (0, FALSE);
GDataInputStream *in = g_data_input_stream_new (raw_in);
read_next_line (in);
gtk_main ();
return 0;
}

1107
src/tests/test-runner.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -653,3 +653,11 @@ meta_ui_window_is_widget (MetaUI *ui,
else
return FALSE;
}
gboolean
meta_ui_window_is_dummy (MetaUI *ui,
Window xwindow)
{
GdkWindow *frames_window = gtk_widget_get_window (GTK_WIDGET (ui->frames));
return xwindow == gdk_x11_window_get_xid (frames_window);
}

View File

@ -116,5 +116,7 @@ gboolean meta_ui_have_a_theme (void);
gboolean meta_ui_window_is_widget (MetaUI *ui,
Window xwindow);
gboolean meta_ui_window_is_dummy (MetaUI *ui,
Window xwindow);
#endif

View File

@ -62,9 +62,7 @@
#include "meta-wayland-private.h"
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
static void notify_modifiers (MetaWaylandKeyboard *keyboard, uint32_t serial,
uint32_t mods_depressed, uint32_t mods_latched,
uint32_t mods_locked, uint32_t group);
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
static void
unbind_resource (struct wl_resource *resource)
@ -190,12 +188,8 @@ meta_wayland_keyboard_take_keymap (MetaWaylandKeyboard *keyboard,
inform_clients_of_new_keymap (keyboard);
notify_modifiers (keyboard,
wl_display_next_serial (keyboard->display),
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout (xkb_info->state, XKB_STATE_LAYOUT_EFFECTIVE));
notify_modifiers (keyboard);
return;
err_dev_zero:
@ -206,6 +200,37 @@ err_keymap_str:
return;
}
static void
on_keymap_changed (MetaBackend *backend,
gpointer data)
{
MetaWaylandKeyboard *keyboard = data;
meta_wayland_keyboard_take_keymap (keyboard, meta_backend_get_keymap (backend));
}
static void
on_keymap_layout_group_changed (MetaBackend *backend,
guint idx,
gpointer data)
{
MetaWaylandKeyboard *keyboard = data;
xkb_mod_mask_t depressed_mods;
xkb_mod_mask_t latched_mods;
xkb_mod_mask_t locked_mods;
struct xkb_state *state;
state = keyboard->xkb_info.state;
depressed_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED);
latched_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED);
locked_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED);
xkb_state_update_mask (state, depressed_mods, latched_mods, locked_mods, 0, 0, idx);
notify_modifiers (keyboard);
}
static void
keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
{
@ -239,18 +264,28 @@ notify_key (MetaWaylandKeyboard *keyboard,
}
static void
notify_modifiers (MetaWaylandKeyboard *keyboard, uint32_t serial,
uint32_t mods_depressed, uint32_t mods_latched,
uint32_t mods_locked, uint32_t group)
notify_modifiers (MetaWaylandKeyboard *keyboard)
{
struct xkb_state *state;
struct wl_resource *resource;
struct wl_list *l;
state = keyboard->xkb_info.state;
l = &keyboard->focus_resource_list;
wl_resource_for_each (resource, l)
if (!wl_list_empty (l))
{
wl_keyboard_send_modifiers (resource, serial, mods_depressed,
mods_latched, mods_locked, group);
uint32_t serial = wl_display_next_serial (keyboard->display);
wl_resource_for_each (resource, l)
{
wl_keyboard_send_modifiers (resource,
serial,
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
}
}
}
@ -337,6 +372,8 @@ void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
struct wl_display *display)
{
MetaBackend *backend = meta_get_backend ();
memset (keyboard, 0, sizeof *keyboard);
keyboard->display = display;
@ -354,8 +391,11 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
g_signal_connect (keyboard->settings, "changed",
G_CALLBACK (settings_changed), keyboard);
meta_wayland_keyboard_take_keymap (keyboard,
meta_backend_get_keymap (meta_get_backend ()));
g_signal_connect (backend, "keymap-changed",
G_CALLBACK (on_keymap_changed), keyboard);
g_signal_connect (backend, "keymap-layout-group-changed",
G_CALLBACK (on_keymap_layout_group_changed), keyboard);
meta_wayland_keyboard_take_keymap (keyboard, meta_backend_get_keymap (backend));
}
static void
@ -380,6 +420,8 @@ meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard)
wl_array_release (&keyboard->pressed_keys);
g_object_unref (keyboard->settings);
keyboard->display = NULL;
}
static void
@ -440,12 +482,7 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
if (changed_state == 0)
return;
notify_modifiers (keyboard,
wl_display_next_serial (keyboard->display),
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
notify_modifiers (keyboard);
}
gboolean
@ -497,11 +534,30 @@ move_resources_for_client (struct wl_list *destination,
}
}
static void
broadcast_focus (MetaWaylandKeyboard *keyboard,
struct wl_resource *resource)
{
struct xkb_state *state = keyboard->xkb_info.state;
wl_keyboard_send_modifiers (resource, keyboard->focus_serial,
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
wl_keyboard_send_enter (resource, keyboard->focus_serial,
keyboard->focus_surface->resource,
&keyboard->pressed_keys);
}
void
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface)
{
if (keyboard->focus_surface == surface && !wl_list_empty (&keyboard->focus_resource_list))
if (keyboard->display == NULL)
return;
if (keyboard->focus_surface == surface)
return;
if (keyboard->focus_surface != NULL)
@ -545,21 +601,12 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
{
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource);
struct wl_display *display = wl_client_get_display (client);
struct xkb_state *state = keyboard->xkb_info.state;
uint32_t serial = wl_display_next_serial (display);
keyboard->focus_serial = wl_display_next_serial (display);
wl_resource_for_each (resource, l)
{
wl_keyboard_send_modifiers (resource, serial,
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
wl_keyboard_send_enter (resource, serial, keyboard->focus_surface->resource,
&keyboard->pressed_keys);
broadcast_focus (keyboard, resource);
}
keyboard->focus_serial = serial;
}
}
}
@ -594,7 +641,6 @@ meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
cr = wl_resource_create (client, &wl_keyboard_interface, wl_resource_get_version (seat_resource), id);
wl_resource_set_implementation (cr, &keyboard_interface, keyboard, unbind_resource);
wl_list_insert (&keyboard->resource_list, wl_resource_get_link (cr));
wl_keyboard_send_keymap (cr,
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
@ -604,5 +650,12 @@ meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
notify_key_repeat_for_resource (keyboard, cr);
if (keyboard->focus_surface && wl_resource_get_client (keyboard->focus_surface->resource) == client)
meta_wayland_keyboard_set_focus (keyboard, keyboard->focus_surface);
{
wl_list_insert (&keyboard->focus_resource_list, wl_resource_get_link (cr));
broadcast_focus (keyboard, cr);
}
else
{
wl_list_insert (&keyboard->resource_list, wl_resource_get_link (cr));
}
}

View File

@ -142,7 +142,7 @@ default_grab_button (MetaWaylandPointerGrab *grab,
event_type = clutter_event_type (event);
l = &grab->pointer->focus_resource_list;
wl_resource_for_each(resource, l)
if (!wl_list_empty (l))
{
struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource);
struct wl_display *display = wl_client_get_display (client);
@ -168,9 +168,13 @@ default_grab_button (MetaWaylandPointerGrab *grab,
}
serial = wl_display_next_serial (display);
wl_pointer_send_button (resource, serial,
clutter_event_get_time (event), button,
event_type == CLUTTER_BUTTON_PRESS ? 1 : 0);
wl_resource_for_each(resource, l)
{
wl_pointer_send_button (resource, serial,
clutter_event_get_time (event), button,
event_type == CLUTTER_BUTTON_PRESS ? 1 : 0);
}
}
if (pointer->button_count == 0 && event_type == CLUTTER_BUTTON_RELEASE)
@ -216,6 +220,8 @@ meta_wayland_pointer_release (MetaWaylandPointer *pointer)
{
meta_wayland_pointer_set_focus (pointer, NULL);
set_cursor_surface (pointer, NULL);
pointer->display = NULL;
}
static int
@ -462,14 +468,27 @@ move_resources_for_client (struct wl_list *destination,
}
}
static void
broadcast_focus (MetaWaylandPointer *pointer,
struct wl_resource *resource)
{
wl_fixed_t sx, sy;
meta_wayland_pointer_get_relative_coordinates (pointer, pointer->focus_surface, &sx, &sy);
wl_pointer_send_enter (resource, pointer->focus_serial, pointer->focus_surface->resource, sx, sy);
}
void
meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface)
{
if (pointer->focus_surface == surface && !wl_list_empty (&pointer->focus_resource_list))
if (pointer->display == NULL)
return;
if (pointer->focus_surface)
if (pointer->focus_surface == surface)
return;
if (pointer->focus_surface != NULL)
{
struct wl_resource *resource;
struct wl_list *l;
@ -518,17 +537,12 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
{
struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource);
struct wl_display *display = wl_client_get_display (client);
uint32_t serial = wl_display_next_serial (display);
pointer->focus_serial = wl_display_next_serial (display);
wl_resource_for_each (resource, l)
{
wl_fixed_t sx, sy;
meta_wayland_pointer_get_relative_coordinates (pointer, pointer->focus_surface, &sx, &sy);
wl_pointer_send_enter (resource, serial, pointer->focus_surface->resource, sx, sy);
broadcast_focus (pointer, resource);
}
pointer->focus_serial = serial;
}
}
}
@ -807,10 +821,16 @@ meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
cr = wl_resource_create (client, &wl_pointer_interface, wl_resource_get_version (seat_resource), id);
wl_resource_set_implementation (cr, &pointer_interface, pointer, unbind_resource);
wl_list_insert (&pointer->resource_list, wl_resource_get_link (cr));
if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)
meta_wayland_pointer_set_focus (pointer, pointer->focus_surface);
{
wl_list_insert (&pointer->focus_resource_list, wl_resource_get_link (cr));
broadcast_focus (pointer, cr);
}
else
{
wl_list_insert (&pointer->resource_list, wl_resource_get_link (cr));
}
}
gboolean

View File

@ -151,6 +151,9 @@ ensure_buffer_texture (MetaWaylandBuffer *buffer)
CoglError *catch_error = NULL;
CoglTexture *texture;
if (buffer->texture)
return;
texture = COGL_TEXTURE (cogl_wayland_texture_2d_new_from_buffer (ctx,
buffer->resource,
&catch_error));
@ -752,7 +755,8 @@ xdg_shell_use_unstable_version (struct wl_client *client,
int32_t version)
{
if (version != XDG_SHELL_VERSION_CURRENT)
g_warning ("Bad xdg_shell version: %d", version);
wl_resource_post_error (resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"bad xdg-shell version: %d\n", version);
}
static void

View File

@ -446,8 +446,20 @@ meta_wayland_init (void)
if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
g_error ("Failed to start X Wayland");
set_gnome_env ("DISPLAY", compositor->xwayland_manager.display_name);
set_gnome_env ("WAYLAND_DISPLAY", compositor->display_name);
set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
}
const char *
meta_wayland_get_wayland_display_name (MetaWaylandCompositor *compositor)
{
return compositor->display_name;
}
const char *
meta_wayland_get_xwayland_display_name (MetaWaylandCompositor *compositor)
{
return compositor->xwayland_manager.display_name;
}
void

View File

@ -44,5 +44,8 @@ void meta_wayland_compositor_set_input_focus (MetaWaylandComp
void meta_wayland_compositor_paint_finished (MetaWaylandCompositor *compositor);
const char *meta_wayland_get_wayland_display_name (MetaWaylandCompositor *compositor);
const char *meta_wayland_get_xwayland_display_name (MetaWaylandCompositor *compositor);
#endif

View File

@ -76,29 +76,43 @@ typedef struct {
MetaXWaylandManager *manager;
MetaWindow *window;
guint32 surface_id;
guint idle_id;
guint later_id;
} AssociateWindowWithSurfaceOp;
static void associate_window_with_surface_window_unmanaged (MetaWindow *window,
AssociateWindowWithSurfaceOp *op);
static void
associate_window_with_surface_window_destroyed (gpointer user_data,
GObject *obj)
associate_window_with_surface_op_free (AssociateWindowWithSurfaceOp *op)
{
AssociateWindowWithSurfaceOp *op = user_data;
g_source_remove (op->idle_id);
if (op->later_id != 0)
meta_later_remove (op->later_id);
g_signal_handlers_disconnect_by_func (op->window,
(gpointer) associate_window_with_surface_window_unmanaged,
op);
g_free (op);
}
static void
associate_window_with_surface_window_unmanaged (MetaWindow *window,
AssociateWindowWithSurfaceOp *op)
{
associate_window_with_surface_op_free (op);
}
static gboolean
associate_window_with_surface_idle (gpointer user_data)
associate_window_with_surface_later (gpointer user_data)
{
AssociateWindowWithSurfaceOp *op = user_data;
op->later_id = 0;
if (!associate_window_with_surface_id (op->manager, op->window, op->surface_id))
{
/* Not here? Oh well... nothing we can do */
g_warning ("Unknown surface ID %d (from window %s)", op->surface_id, op->window->desc);
}
g_object_weak_unref (G_OBJECT (op->window), associate_window_with_surface_window_destroyed, op);
g_free (op);
associate_window_with_surface_op_free (op);
return G_SOURCE_REMOVE;
}
@ -113,17 +127,20 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window,
if (!associate_window_with_surface_id (manager, window, surface_id))
{
/* No surface ID yet... it should arrive after the next
* iteration through the loop, so queue an idle and see
* iteration through the loop, so queue a later and see
* what happens.
*/
AssociateWindowWithSurfaceOp *op = g_new0 (AssociateWindowWithSurfaceOp, 1);
op->manager = manager;
op->window = window;
op->surface_id = surface_id;
op->idle_id = g_idle_add (associate_window_with_surface_idle, op);
g_source_set_name_by_id (op->idle_id, "[mutter] associate_window_with_surface_idle");
op->later_id = meta_later_add (META_LATER_BEFORE_REDRAW,
associate_window_with_surface_later,
op,
NULL);
g_object_weak_ref (G_OBJECT (op->window), associate_window_with_surface_window_destroyed, op);
g_signal_connect (op->window, "unmanaged",
G_CALLBACK (associate_window_with_surface_window_unmanaged), op);
}
}

View File

@ -60,11 +60,8 @@ meta_window_wayland_manage (MetaWindow *window)
meta_display_register_wayland_window (display, window);
{
MetaStackWindow stack_window;
stack_window.any.type = META_WINDOW_CLIENT_TYPE_WAYLAND;
stack_window.wayland.meta_window = window;
meta_stack_tracker_record_add (window->screen->stack_tracker,
&stack_window,
window->stamp,
0);
}
}
@ -73,11 +70,8 @@ static void
meta_window_wayland_unmanage (MetaWindow *window)
{
{
MetaStackWindow stack_window;
stack_window.any.type = META_WINDOW_CLIENT_TYPE_WAYLAND;
stack_window.wayland.meta_window = window;
meta_stack_tracker_record_remove (window->screen->stack_tracker,
&stack_window,
window->stamp,
0);
}
@ -197,8 +191,16 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
if (constrained_rect.width != window->rect.width ||
constrained_rect.height != window->rect.height)
{
wl_window->last_sent_width = constrained_rect.width;
wl_window->last_sent_height = constrained_rect.height;
/* If we get a 0x0 size, this means that we're trying to resize
* a surface that doesn't have any buffer attached. This can happen
* when a client requests an xdg surface before bringing it up.
* The constrained_rect will be 1x1 because of how our constraints
* code works, and sending that to the window would cause it to
* redraw itself, so just don't send anything.
*/
if (unconstrained_rect.width == 0 &&
unconstrained_rect.height == 0)
return;
meta_wayland_surface_configure_notify (window->surface,
constrained_rect.width,
@ -216,6 +218,9 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
}
}
wl_window->last_sent_width = constrained_rect.width;
wl_window->last_sent_height = constrained_rect.height;
if (can_move_now)
{
int new_x = constrained_rect.x;
@ -302,8 +307,8 @@ meta_window_wayland_new (MetaDisplay *display,
attrs.x = 0;
attrs.y = 0;
attrs.width = 1;
attrs.height = 1;
attrs.width = 0;
attrs.height = 0;
attrs.border_width = 0;
attrs.depth = 24;
attrs.visual = NULL;

View File

@ -35,8 +35,11 @@
#include "x11/window-x11.h"
#include "x11/xprops.h"
#ifdef HAVE_WAYLAND
#include "wayland/meta-xwayland.h"
#include "wayland/meta-wayland-private.h"
#endif
static XIEvent *
get_input_event (MetaDisplay *display,
@ -672,11 +675,10 @@ meta_spew_event (MetaDisplay *display,
g_free (extra);
}
static void
static gboolean
handle_window_focus_event (MetaDisplay *display,
MetaWindow *window,
XIEnterEvent *event,
unsigned long serial)
XIEnterEvent *event)
{
MetaWindow *focus_window;
#ifdef WITH_VERBOSE_MODE
@ -749,13 +751,13 @@ handle_window_focus_event (MetaDisplay *display,
{
meta_topic (META_DEBUG_FOCUS,
"Ignoring focus event generated by a grab or other weirdness\n");
return;
return FALSE;
}
if (event->evtype == XI_FocusIn)
{
display->server_focus_window = event->event;
display->server_focus_serial = serial;
display->server_focus_serial = event->serial;
focus_window = window;
}
else if (event->evtype == XI_FocusOut)
@ -765,15 +767,15 @@ handle_window_focus_event (MetaDisplay *display,
/* This event means the client moved focus to a subwindow */
meta_topic (META_DEBUG_FOCUS,
"Ignoring focus out with NotifyInferior\n");
return;
return FALSE;
}
display->server_focus_window = None;
display->server_focus_serial = serial;
display->server_focus_serial = event->serial;
focus_window = NULL;
}
else
g_return_if_reached ();
g_assert_not_reached ();
/* If display->focused_by_us, then the focus_serial will be used only
* for a focus change we made and have already accounted for.
@ -789,6 +791,11 @@ handle_window_focus_event (MetaDisplay *display,
focus_window ? focus_window->xwindow : None,
display->server_focus_serial,
FALSE);
return TRUE;
}
else
{
return FALSE;
}
}
@ -810,8 +817,7 @@ crossing_serial_is_ignored (MetaDisplay *display,
static gboolean
handle_input_xevent (MetaDisplay *display,
XIEvent *input_event,
gulong serial)
XIEvent *input_event)
{
XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
Window modified;
@ -842,13 +848,13 @@ handle_input_xevent (MetaDisplay *display,
switch (input_event->evtype)
{
case XI_Enter:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
if (display->event_route != META_EVENT_ROUTE_NORMAL)
break;
/* Check if we've entered a window; do this even if window->has_focus to
* avoid races.
*/
if (window && !crossing_serial_is_ignored (display, serial) &&
if (window && !crossing_serial_is_ignored (display, input_event->serial) &&
enter_event->mode != XINotifyGrab &&
enter_event->mode != XINotifyUngrab &&
enter_event->detail != XINotifyInferior &&
@ -861,7 +867,7 @@ handle_input_xevent (MetaDisplay *display,
}
break;
case XI_Leave:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
if (display->event_route != META_EVENT_ROUTE_NORMAL)
break;
if (window != NULL &&
@ -873,15 +879,11 @@ handle_input_xevent (MetaDisplay *display,
break;
case XI_FocusIn:
case XI_FocusOut:
handle_window_focus_event (display, window, enter_event, serial);
if (!window)
if (handle_window_focus_event (display, window, enter_event) &&
enter_event->event == enter_event->root)
{
/* Check if the window is a root window. */
if (enter_event->root != enter_event->event)
break;
if (enter_event->evtype == XI_FocusIn &&
enter_event->mode == XINotifyDetailNone)
enter_event->detail == XINotifyDetailNone)
{
meta_topic (META_DEBUG_FOCUS,
"Focus got set to None, probably due to "
@ -903,7 +905,6 @@ handle_input_xevent (MetaDisplay *display,
NULL,
meta_display_get_current_time_roundtrip (display));
}
}
break;
}
@ -1185,6 +1186,14 @@ handle_other_xevent (MetaDisplay *display,
meta_window_x11_update_sync_request_counter (alarm_window, new_counter_value);
bypass_gtk = TRUE; /* GTK doesn't want to see this really */
}
else
{
if (display->alarm_filter &&
display->alarm_filter (display,
(XSyncAlarmNotifyEvent*)event,
display->alarm_filter_data))
bypass_gtk = TRUE;
}
goto out;
}
@ -1351,7 +1360,8 @@ handle_other_xevent (MetaDisplay *display,
case ConfigureNotify:
if (event->xconfigure.event != event->xconfigure.window)
{
if (event->xconfigure.event == display->screen->xroot)
if (event->xconfigure.event == display->screen->xroot &&
event->xconfigure.window != display->screen->composite_overlay_window)
meta_stack_tracker_configure_event (display->screen->stack_tracker,
&event->xconfigure);
}
@ -1714,11 +1724,7 @@ meta_display_handle_xevent (MetaDisplay *display,
}
#endif /* HAVE_XI23 */
/* libXi does not properly copy the serial to XI2 events, so pull it
* from the parent XAnyEvent and pass it to handle_input_xevent.
* See: https://bugs.freedesktop.org/show_bug.cgi?id=64687
*/
if (handle_input_xevent (display, input_event, event->xany.serial))
if (handle_input_xevent (display, input_event))
{
bypass_gtk = bypass_compositor = TRUE;
goto out;

View File

@ -338,6 +338,52 @@ reload_icon_geometry (MetaWindow *window,
}
}
static gboolean
gtk_border_equal (GtkBorder *a,
GtkBorder *b)
{
return (a->left == b->left &&
a->right == b->right &&
a->top == b->top &&
a->bottom == b->bottom);
}
static void
meta_window_set_custom_frame_extents (MetaWindow *window,
GtkBorder *extents,
gboolean is_initial)
{
if (extents)
{
if (window->has_custom_frame_extents && gtk_border_equal (&window->custom_frame_extents, extents))
return;
window->has_custom_frame_extents = TRUE;
window->custom_frame_extents = *extents;
/* If we're setting the frame extents on map, then this is telling
* us to adjust our understanding of the frame rect to match what
* GTK+ thinks it is. Future changes to the frame extents should
* trigger a resize and send a ConfigureRequest to the application.
*/
if (is_initial)
{
meta_window_client_rect_to_frame_rect (window, &window->rect, &window->rect);
meta_window_client_rect_to_frame_rect (window, &window->unconstrained_rect, &window->unconstrained_rect);
}
}
else
{
if (!window->has_custom_frame_extents)
return;
window->has_custom_frame_extents = FALSE;
memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
}
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
static void
reload_gtk_frame_extents (MetaWindow *window,
MetaPropValue *value,
@ -357,16 +403,13 @@ reload_gtk_frame_extents (MetaWindow *window,
extents.right = (int)value->v.cardinal_list.cardinals[1];
extents.top = (int)value->v.cardinal_list.cardinals[2];
extents.bottom = (int)value->v.cardinal_list.cardinals[3];
meta_window_set_custom_frame_extents (window, &extents);
meta_window_set_custom_frame_extents (window, &extents, initial);
}
}
else
{
meta_window_set_custom_frame_extents (window, NULL);
meta_window_set_custom_frame_extents (window, NULL, initial);
}
if (!initial)
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
}
static void

View File

@ -214,8 +214,29 @@ send_configure_notify (MetaWindow *window)
event.xconfigure.display = window->display->xdisplay;
event.xconfigure.event = window->xwindow;
event.xconfigure.window = window->xwindow;
event.xconfigure.x = window->rect.x - priv->border_width;
event.xconfigure.y = window->rect.y - priv->border_width;
event.xconfigure.x = priv->client_rect.x - priv->border_width;
event.xconfigure.y = priv->client_rect.y - priv->border_width;
if (window->frame)
{
if (window->withdrawn)
{
MetaFrameBorders borders;
/* We reparent the client window and put it to the position
* where the visible top-left of the frame window currently is.
*/
meta_frame_calc_borders (window->frame, &borders);
event.xconfigure.x = window->frame->rect.x + borders.invisible.left;
event.xconfigure.y = window->frame->rect.y + borders.invisible.top;
}
else
{
/* Need to be in root window coordinates */
event.xconfigure.x += window->frame->rect.x;
event.xconfigure.y += window->frame->rect.y;
}
}
event.xconfigure.width = priv->client_rect.width;
event.xconfigure.height = priv->client_rect.height;
event.xconfigure.border_width = priv->border_width; /* requested not actual */
@ -249,6 +270,17 @@ adjust_for_gravity (MetaWindow *window,
int frame_width, frame_height;
MetaFrameBorders borders;
/* We're computing position to pass to window_move, which is
* the position of the client window (StaticGravity basically)
*
* (see WM spec description of gravity computation, but note that
* their formulas assume we're honoring the border width, rather
* than compensating for having turned it off)
*/
if (gravity == StaticGravity)
return;
if (coords_assume_border)
bw = priv->border_width;
else
@ -261,14 +293,6 @@ adjust_for_gravity (MetaWindow *window,
frame_width = child_x + rect->width + borders.visible.right;
frame_height = child_y + rect->height + borders.visible.bottom;
/* We're computing position to pass to window_move, which is
* the position of the client window (StaticGravity basically)
*
* (see WM spec description of gravity computation, but note that
* their formulas assume we're honoring the border width, rather
* than compensating for having turned it off)
*/
/* Calculate the the reference point, which is the corner of the
* outer window specified by the gravity. So, NorthEastGravity
* would have the reference point as the top-right corner of the
@ -2869,8 +2893,6 @@ meta_window_x11_new (MetaDisplay *display,
wm_state_to_string (existing_wm_state));
}
meta_error_trap_push (display);
/*
* XAddToSaveSet can only be called on windows created by a different
* client. with Mutter we want to be able to create manageable windows

View File

@ -1,332 +0,0 @@
#!/usr/bin/python
#
# mutter-test.py -- testing for Mutter
#
# Copyright (C) 2008 Thomas Thurman
#
# 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/>.
#
# ---------------------
#
# This code is copied in from the test-system branch to trunk; it is
# here because it's useful, with no guarantees (well, not that GPL
# software comes with guarantees in the first place). The test-system
# branch is the place to look if you want the real version of this.
#
# ---------------------
import sys
import inspect
import getopt
import os
import tempfile
import commands
import traceback
class Test(object):
"""Grandfather of all tests. (Yes, I know about the 'unittest'
module; I think what we're doing here isn't terribly similar.)"""
# If when we get this working I'm shown to be wrong, well,
# that's fine too.
def prerequisites(self):
return []
tests_by_name = {}
tests_by_bug_number = {}
pristine_copy = '/usr/local/src/mutter'
working_directory = pristine_copy
homepath = os.getcwd ()
def run(verb, command):
"""Prints the verb, then executes the command.
It's here so we can toggle dry runs
(although this isn't currently implemented).
If the command is None, writes the command in brackets and exits.
"""
if command is None:
sys.stdout.write('(%s) ' % verb)
return True
sys.stdout.write('%s ' % verb)
sys.stdout.flush()
os.chdir (working_directory)
(status, output) = commands.getstatusoutput(command)
os.chdir (homepath) # in case it matters to anyone
if status!=0:
(fd, name) = tempfile.mkstemp(suffix='.txt', text=True)
# Can't do this in one line. No idea why not.
temp = os.fdopen(fd, 'w')
temp.write("%s - %s\n\n%s\n\nReturn result is: %d" % (verb, command, output, status))
del temp
sys.stdout.write('(See %s ): ' % name)
sys.stdout.flush()
return False
else:
return True
class TestFailure(Exception):
"Houston, we have a problem."
def __init__(self, problem):
self.problem = problem
def __str__(self):
return self.problem
def message(self):
return self.problem
#################
#
# These belong in a file, one of several in a subdirectory
# which gets scanned, so we can easily do plugins, and so
# we get precompilation.
#
# There will be class decorators in Python 2.6, but until
# we get them, we will make do with adding the classes to
# dictionaries directly.
class BuildTest(Test):
"Convenience class to build others around"
# Should this go in the included files, or the main file?
def executable_name(self):
name = self.__class__.__name__
if name.startswith('test_'):
name = name[5:]
return name
def run_build(self, **params):
"""Generalised routine to attempt to build Mutter.
Parameters are:
action = (string) -- run "make (string)" rather than "make"
autogen = (string) -- opts for autogen (or its kids)
c = (string) -- C flags
"""
working_directory = pristine_copy
if False:
# This is an idea I had about copying everything into /tmp
# so we could work with -r being a r/o directory.
# It slows everything down to turn it on by default, though.
# XXX allow people to turn it on.
temp_directory = tempfile.mkdtemp(prefix='metatest_')
if not run('copy', 'cp -LpR %s %s' % (pristine_copy, temp_directory)):
raise('There were errors during copying (your repository is probably '+\
'a little untidy). Please go and tidy up and then come back.')
working_directory = temp_directory
makefile = os.path.join(working_directory, 'Makefile')
targetdir = os.path.abspath ('.built')
# TODO -- if not run(...) raise TestFailure (...) is common and could be
# an extra param on run() instead.
if os.path.lexists (makefile):
if not run ('clean', "make distclean"):
raise TestFailure('Could not clean up; this is bad')
else:
run('clean', None)
autogen_opts = ''
if params.has_key ('autogen'):
autogen_opts = params['autogen']
if not run('config', './autogen.sh %s' % autogen_opts):
raise TestFailure('Autogen failed; can\'t really go on from here.')
flags = []
if params.has_key ('cflags'):
flags.append ('CFLAGS=%s' % params['cflags'].replace(' ','\ '))
command = ''
if params.has_key ('action'):
command = params['action']
if not run('make', 'env %s make %s' % (' '.join(flags), command)):
raise TestFailure('Build failed; can\'t really go on from here.')
binary = 'src/mutter' # or 'mutter/src/mutter' sometimes. hmm....
if not os.path.lexists(binary):
raise TestFailure('Binary was not built.')
output = commands.getoutput("env LANG=C %s --version" % binary)
if not output.startswith('mutter '):
raise TestFailure('Built program fails to identify itself: ['+output+']')
# Should also test what it says about its flags
# (and make it show its flags)
if not run ('recopy', 'cp %s %s/mutter-%s' % (binary, homepath, self.executable_name())):
raise TestFailure('Couldn\'t copy binary somewhere safe')
# Should clear up build if it's temp directory
return True
class test_ansi(BuildTest):
def run(self):
return self.run_build(c='ansi')
class test_compositoroff(BuildTest):
def run(self):
return self.run_build(autogen='--disable-compositor')
class test_teston(BuildTest):
def run(self):
return self.run_build(autogen='--enable-testing')
class test_distcheck(BuildTest):
def run(self):
return self.run_build(action='distcheck')
class test_warningerrors(BuildTest):
def run(self):
return self.run_build(cflags='-Wall')
class test_pedantic(BuildTest):
def run(self):
return self.run_build(cflags='-Wall -Werror -pedantic')
# Populate tests_by_name by introspection
for (name, klass) in inspect.getmembers(sys.modules['__main__']):
if not name.startswith('test_'): continue
tests_by_name[name[5:]] = klass
#################
#
# And back in the ordinary world...
def show_help():
print ' --- mutter-test --- a test system for mutter.'
print 'There are three kinds of test: unit, regression, or build.'
print 'Only build tests are currently implemented.'
print
print 'Syntax:'
print ' mutter-test <switches> <test names>'
print 'where <switches> can be:'
print ' -h Show this help and exit'
print ' -l List all known tests and exit'
print ' -r=n Use revision n, or directory n as pristine'
print ' (defaults to %s if you have it)' % pristine_copy
print
def show_tests():
print 'Build tests:'
for name in tests_by_name.keys():
test = tests_by_name[name]
if test.__doc__:
print ' %s - %s' % (name, test.__doc__)
else:
print ' %s' % (name)
print
print 'Unit tests:'
print ' -- Not yet implemented.'
print
print 'Regression tests:'
print ' -- Not yet implemented.'
def main():
try:
(opts, testlist) = getopt.gnu_getopt(
sys.argv[1:],
'lhr=',
)
except getopt.GetoptError, e:
print 'Error:', e
print 'Use -h for help, or -l to list all tests.'
sys.exit(1)
if (len(opts)==0 and len(testlist)==0) or (('-h', '') in opts):
show_help()
elif ('-l', '') in opts:
show_tests()
elif ('-r', '') in opts:
print 'Sorry, actual parsing of -r isn\'t written yet; use %s.' % pristine_copy
sys.exit(1)
elif not testlist:
print "Warning: You didn't specify any tests to run."
else:
# Later we need to add
# - .foo = all with the tag "foo"
# - .build, etc., which are implicit tags
# - for regression tests, selection by bug number
# - very simple dependencies (you need the output of a particular build
# test before you can run a given unit test on it!)
tests_to_run = {}
tests_that_dont_exist = []
switch_polarity = 0
if not os.path.lexists('.built'):
os.mkdir ('.built')
for test in testlist:
if test in ('all', 'allbut'):
switch_polarity = 1
elif tests_by_name.has_key(test):
tests_to_run[test] = tests_by_name[test]
else:
tests_that_dont_exist.append(test)
if tests_that_dont_exist:
print 'You asked for these tests which don\'t exist:', ' '.join(tests_that_dont_exist)
print 'Stopping now until you decide what you really want.'
print 'Try the -l option, maybe.'
sys.exit(1)
if switch_polarity:
temp = {}
for test in tests_by_name.keys():
if not tests_to_run.has_key(test):
temp[test] = tests_by_name[test]
tests_to_run = temp
# okay, kick it off
for name in tests_to_run.keys():
sys.stdout.write('%s... ' % name)
test = tests_to_run[name]()
try:
result = test.run()
if result:
print 'PASS'
else:
print 'FAIL'
except TestFailure, tf:
print 'FAIL (%s)' % tf
except:
# obviously not good
print 'FAIL'
traceback.print_exception(*sys.exc_info())
if __name__=='__main__':
main()