1
0
Fork 0
Commit graph

3535 commits

Author SHA1 Message Date
Adel Gadllah
d85845426c window-actor: Fix culling
At some point meta_window_actor_cull_out stopped calling
meta_cullable_cull_out_children which caused the unobscured region
to never be set for the stex.

https://bugzilla.gnome.org/show_bug.cgi?id=725216
2014-02-26 15:01:07 +01:00
Giovanni Campagna
060e60f2a0 window: fix loading the window type initially
This code was lost in the window/window-x11 split.
2014-02-26 00:21:52 +01:00
Giovanni Campagna
26cf75d5a4 MetaWindowX11: fix listening for shape events
This code was lost when support for input shapes was originally
introduced.
2014-02-25 01:29:50 +01:00
Giovanni Campagna
9f5087e97d Fix input and bounding shapes
For decorated windows, we don't want to apply any input
shape, because the frame is always rectangular and eats
all the input.
The real check is in meta-window-actor, where we consider
if we need to apply the bounding shape and the input shape
(or the intersection of the two) to the surface-actor,
but as an optimization we avoid querying the server in
meta-window.
Additionally, for undecorated windows, the "has input shape"
check is wrong if the window has a bounding shape but not an
input shape.
2014-02-25 01:27:32 +01:00
Giovanni Campagna
45624f2edf MetaWindowActor: survive having no MetaSurfaceActor
We need a MetaWaylandSurface to build a MetaSurfaceActor, but
we don't have one until we get the set_window_xid() call from
XWayland. On the other hand, plugins expect to see the window
actor right from when the window is created, so we need this
empty state.

Based on a patch by Jasper St. Pierre.
2014-02-25 01:22:56 +01:00
Giovanni Campagna
153f843ea6 MetaSurfaceActor: move freeze accounting to MetaWindowActor
Turns out we only ever need to freeze/thaw whole windows, not
surfaces or subsurfaces.
This will allow removing the surface actor without losing
the count.
2014-02-25 01:20:22 +01:00
Jasper St. Pierre
f0cd9b0687 wayland-surface: Rework construction / destruction yet again
This time, to make way for MetaSurfaceActorEmpty. This also fixes
destroy effects as a side effect. It still has issues if we try
to re-assign an actor that's already toplevel (e.g. somebody
re-popping up a menu that's already being destroyed), but this
will be fixed soon.

The idea here is that MetaWindowActor will do the unparenting of
the surface actor when it itself is destroyed. To prevent bad issues
with picking, we only make the surface actor reactive when it's
toplevel.
2014-02-24 14:46:19 -05:00
Jasper St. Pierre
1783bf20ec Revert "window: Delay the showing of XWayland clients until set_window_id"
This reverts commit 59c8b949ad.
2014-02-24 14:46:19 -05:00
Jasper St. Pierre
9b24ae2033 Revert "compositor: Delay meta_compositor_add_window until the first show"
This reverts commit 4efe4483fb.
2014-02-24 14:46:18 -05:00
Jasper St. Pierre
0be4622e14 stack-tracker: Comment out bad warning
It triggers too often, making G_DEBUG=fatal-warnings quite useless.
Owen is going to rewrite this code sometime in the near future, so
I'm just gonna kill this warning for now.
2014-02-24 09:46:22 -05:00
Carlos Garnacho
bcd5446cdc core: prevent early MetaIdleMonitor destruction when its invoker vanishes
If the last reference of a MetaIdleMonitor is held by the caller, it may
happen that the last reference is lost when calling the GDestroyNotify,
if this happens when the watched DBus name vanishes, the object (and the
watches hashtable) are destroyed while manipulating the watches hashtable,
so bad things may happen then.

Fix this by wrapping the operation by a ref/unref pair, so the object would
be destroyed after operating on the hashtable.

https://bugzilla.gnome.org/show_bug.cgi?id=724969
2014-02-24 11:50:08 +01:00
Jasper St. Pierre
04b5232960 compositor: The stage is always focused when we're a Wayland compositor
gnome-shell has some complex tracking to set the X input focus
correctly, assuming various things about how the stage is set up in X11.
For instance, it assumes that all actors that get key focus are
gnome-shell Chrome actors that will get events through the stage, so
when one of them is focused, it will try to set the focus back to the
stage.

In Wayland, windows are considered chrome actors that will get key
events through the stage, so this only has the result of unfocusing any
windows that have just received key focus.

We should probably move this input focus moving to mutter instead of
gnome-shell so we can better use mutter's internal state and heuristics.
2014-02-23 12:34:53 -05:00
Jasper St. Pierre
f860df4b2d Revert "compositor: fix focusing the stage window"
This reverts commit 876f81db12.

This doesn't quite work properly, and is overcomplicated.
2014-02-23 12:34:52 -05:00
Jasper St. Pierre
ff8c4b1bcf pointer/keyboard: Fix segfault once more
If the resource is destroyed before the surface, then we'll kill
ourselves. Why can I never seem to write these correctly...
2014-02-23 10:00:31 -05:00
Jasper St. Pierre
337c69e223 pointer/keyboard: Unset focus_resource when the surface is destroyed
focus_resource is supposed to be set only if focus_surface is
as well.
2014-02-22 18:15:53 -05:00
Adel Gadllah
14841475b5 meta-window-actor: Fix paint_volume
We cannot intersect the the complete volume with the unobscured bounds
because it does not include the shadows. So just intersect it with the
windows's shape bounds and union it with the shadow bounds.

This also matches what the comment in the code says:
"We could compute an full clip region as we do for the window texture,
but the shadow is relatively cheap to draw, and a little more complex to clip,
so we just catch the case where the shadow is completely obscured
and doesn't need to be drawn at all."
2014-02-21 20:39:25 +01:00
Jasper St. Pierre
7283fb320f mutter-wayland: Add XKB VT switching keysyms.
It turns out XKB has keysyms for these for no real reason, and I
was hitting those instead of the <Primary><Alt>F1 path. This is
ridiculous, but key, so is the entirety of XKB.

This took an embarassingly long time to figure out and debug.
2014-02-21 13:50:40 -05:00
Jasper St. Pierre
020cfa7283 surface-actor-x11: Recreate damage when the toplevel X window changes 2014-02-20 14:50:48 -05:00
Jasper St. Pierre
83aca0b53d window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:

  * X11 compositor. In this case, we're a traditional X11 compositor,
    not a Wayland compositor. We use XCompositeNameWindowPixmap to get
    the backing pixmap for the window, and deal with the COMPOSITE
    extension messiness.

    In this case, meta_is_wayland_compositor() is FALSE.

  * Wayland clients. In this case, we're a Wayland compositor managing
    Wayland surfaces. The rendering for this is fairly straightforward,
    as Cogl handles most of the complexity with EGL and SHM buffers...
    Wayland clients give us the input and opaque regions through
    wl_surface.

    In this case, meta_is_wayland_compositor() is TRUE and
    priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.

  * XWayland clients. In this case, we're a Wayland compositor, like
    above, and XWayland hands us Wayland surfaces. XWayland handles
    the COMPOSITE extension messiness for us, and hands us a buffer
    like any other Wayland client. We have to fetch the input and
    opaque regions from the X11 window ourselves.

    In this case, meta_is_wayland_compositor() is TRUE and
    priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.

We now split the rendering logic into two subclasses, which are:

  * MetaSurfaceActorX11, which handles the X11 compositor case, in that
    it uses XCompositeNameWindowPixmap to get the backing pixmap, and
    deal with all the COMPOSITE extension messiness.

  * MetaSurfaceActorWayland, which handles the Wayland compositor case
    for both native Wayland clients and XWayland clients. XWayland handles
    COMPOSITE for us, and handles pushing a surface over through the
    xf86-video-wayland DDX.

Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-20 14:44:31 -05:00
Jasper St. Pierre
0b055fae2e window-actor: Kill off needs_pixmap
It's mostly equivalent to the case where we've already detached
the pixmap, *except* for the x11_size_changed case. We can simply
detach the pixmap at the time the window changes size, though.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-20 11:51:52 -05:00
Jasper St. Pierre
bc79259398 window-actor: Don't queue a redraw when queueing a new pixmap
We guarantee ourselves that a valid pixmap will appear any time
that the window is painted. The window actor will be scheduled
for a repaint if it's added / removed from the scene graph, like
during construction, if the size changes, or if we receive damage,
which are the existing use cases where this function is called.

So, I can't see any reason that we queue a redraw in here.

With the split into surface actors, we don't have an easy place
we can use to queue a redraw, and since it's unnecessary, we can
just drop it on the floor.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-20 11:35:01 -05:00
Jasper St. Pierre
7ebf5aa69a pointer/keyboard: Properly handle destruction
If the client destroys the pointer resource, we shouldn't unfocus the
surface, and we should regrab it when the client gets the pointer
resource again.

This also fixes a crash at surface destruction because of the unchecked
wl_link_remove that will happen on both pointer and surface destroy.
2014-02-20 11:35:01 -05:00
Stefano Facchini
4de3f7ca29 Make tile preview a compositor plugin effect
https://bugzilla.gnome.org/show_bug.cgi?id=665758
2014-02-19 21:55:35 +01:00
Marek Chalupa
17462c21e8 pointer/keyboard: fix setting focus
Set focus to NULL after using the variable
2014-02-19 10:24:36 -05:00
Jasper St. Pierre
c964ef4e01 window-actor: Fix build
I'm bad.
2014-02-19 01:11:42 -05:00
Jasper St. Pierre
0dccc440b6 window-actor: Kill off a nonsensical edge case
We can never have a window actor that represents either the X root
window or the stage window, so it doesn't make sense to bail out
early in case we do.

I'd imagine that this came from a much earlier version of the code
where the compositor was much separate and had its own MapNotify
handling.
2014-02-18 23:36:46 -05:00
Jasper St. Pierre
48f7232492 pointer: Don't send modifiers on mouse enter
I talked to Kristian about this. It should be enough to simply
send it when we activate the surface and give it keyboard focus.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
ff5867e4d3 pointer: Make the code here a bit clearer 2014-02-18 23:21:06 -05:00
Jasper St. Pierre
a5d950f453 pointer/keyboard: Fix focus setting once again
Yet another large-scale restructuring... this is some messy code.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
7615d17293 wayland: Tie activate / deactivate to appears-focused
... rather than actual focus. This makes things behave better.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
374e30043b wayland: Remove width / height from MetaWaylandBuffer
They're in the texture.
2014-02-18 22:43:24 -05:00
Jasper St. Pierre
f771bb88d6 Revert "wayland: Explicitly destroy the surface actor"
This reverts commit 283a81eac0.

This can't be done yet, as it will crash when we try to do a destroy
effect from a plugin. The surface actor needs to outlive the surface
in this case.

Though, the unparenting happening is wrong anyway for a destroy effect.
We need to figure out a sane way of doing this unparenting only after
all effects have finished.
2014-02-18 22:23:08 -05:00
Jasper St. Pierre
7ef8d21e48 wayland: Allow destroying the wl_surface before the xdg_surface
As resource destruction can happen in any order at shutdown, we
need to be flexible here. A client disconnecting without cleaning
up all its resources should not assert fail.
2014-02-18 22:21:33 -05:00
Jasper St. Pierre
c251eb8ec0 window-group: Don't special-case the unredirected window
Since the unredirected window MetaWindowActor is stacked on top, it
will naturally get culled out of the process, so we can remove the
special casing here. Unfortunately, with the way that the code is
currently structured, it's too difficult to actually prevent setting
the clip / visible regions if the window is redirected, so just let
those be set for unredirected windows for now.
2014-02-18 21:29:50 -05:00
Jasper St. Pierre
1e6b3faa83 Fix the input region not working properly
The input region was set on the shaped texture, but the shaped texture
was never picked properly, as it was never set to be reactive. Move the
pick implementation and reactivity to the MetaSurfaceActor, and update
the code everywhere else to expect a MetaSurfaceActor.
2014-02-18 21:29:23 -05:00
Jasper St. Pierre
e62fe956fd window: Enable pinging on Wayland windows
I implemented pinging, but never actually enabled the feature
properly on Wayland surfaces by setting the net_wm_ping hint to
TRUE, causing the fallback path to always be hit.

Rename net_wm_ping to can_ping so it doesn't take on an
implementation-specific meaning, and set it for all Wayland windows.
2014-02-18 20:30:52 -05:00
Jasper St. Pierre
24c5290d7f main: Kill a runtime warning
g_setenv doesn't take NULL for a value.
2014-02-18 20:30:36 -05:00
Jasper St. Pierre
00c8d3c897 xdg-shell: Update to latest renames for focused_set / focused_unset 2014-02-18 19:02:17 -05:00
Jasper St. Pierre
cc13f8f65e wayland: Fix compile error
I tested this with meta_window_get_input_rect and decided to change
it at the last minute. Turns out meta_window_get_rect is unlike all
the others. Just access window->rect directly instead.
2014-02-18 19:01:50 -05:00
Jasper St. Pierre
47f4c9db7b wayland-surface: Correct xdg_popup placement
Now that we call set_custom_frame_extents, the frame rect corresponds
to the "visible window geometry" used for constrainment, while the
x/y fields in get_xdg_popup instead are relative to the surface.
2014-02-18 18:55:54 -05:00
Jasper St. Pierre
4c621cc30f pointer/keyboard: Make sure to clean up the destroy listeners when releasing 2014-02-18 18:39:19 -05:00
Jasper St. Pierre
756a412436 pointer: Make nested grabs work
Something noticed on code inspection. If we have a popup grab,
it will always return FALSE. The code here clearly meant to continue
if we had an existing popup grab from an existing client.
2014-02-18 18:06:55 -05:00
Jasper St. Pierre
be16c2fe71 pointer: Reindent 2014-02-18 18:06:17 -05:00
Jasper St. Pierre
a364c2a96b pointer/keyboard: Make sure not to get stale on client resources as well
Both the pointer/keyboard resource and surface resource can be destroyed
at any point in the destruction process, so we need to have destroy
listeners on both. To make the code easier to follow, rename ->focus
to ->focus_surface at the same time, and rearrange the code so that
the two of them are always grouped together.
2014-02-18 18:03:31 -05:00
Jasper St. Pierre
414259a7f8 wayland: Fix cast warning
It's sometimes hard to see around all the deprecation warnings. Sorry
about that...
2014-02-18 17:26:03 -05:00
Jasper St. Pierre
283a81eac0 wayland: Explicitly destroy the surface actor
This shouldn't change anything right now, but it's better to be
careful than anything else. This is where the actor should be
destroyed.
2014-02-18 17:07:36 -05:00
Jasper St. Pierre
2a145262c7 wayland: Rework how surface destruction works
To prevent the MetaSurfaceActor from being destroyed, we normally
unparent it before we unmanage the window. However, this doesn't
work for XWayland windows, which we unmanage when we get UnmapNotify
or DestroyNotify, not when we get the wl_surface_destroy.

To solve this, add an early hook in meta_window_unmanage that
unparents the surface actor if we have one. At the same time, clean
up the destruction code to remove old comments and assumptions about
how wl_shell behaves.
2014-02-18 17:01:33 -05:00
Jasper St. Pierre
57728b4322 Kill HAVE_WAYLAND 2014-02-17 21:50:32 -05:00
Jasper St. Pierre
ef24fb6296 wayland: Don't use WESTON_LAUNCHER_SOCK
We can simply check the windowing backend.
2014-02-17 21:50:32 -05:00
Jasper St. Pierre
86f057a712 monitor: Add a Wayland backend
We shouldn't crash when trying to run nested under Wayland. Just
use the dummy backend for now until we are able to run with a
system compositor.
2014-02-17 21:50:32 -05:00
Jasper St. Pierre
dcd628d289 wayland: Kill meta_wayland_compositor_is_native
It's unused. Squash the remaining functionality, setting the DRM FD,
into the main path.
2014-02-17 21:15:31 -05:00
Jasper St. Pierre
6038877c4c cursor-tracker: Kill off the last user of is_native 2014-02-17 21:11:57 -05:00
Jasper St. Pierre
4e6321c239 monitor: Kill off another use of is_native 2014-02-17 20:51:35 -05:00
Jasper St. Pierre
304a525744 wayland: Remove is_native from seat
We can easily do this with a Clutter backend check instead...
2014-02-17 20:49:04 -05:00
Jasper St. Pierre
f26de405dd main: Remove clutter / cogl option groups
Neither of these groups are too useful, and all the switches useful
for debugging can also be controlled by envvars.
2014-02-17 20:41:36 -05:00
Jasper St. Pierre
ed18580118 default: Improve the destroy effect as well 2014-02-17 19:27:33 -05:00
Jasper St. Pierre
b65649186d pointer/keyboard: Put the destroy listener on the right resource
We care about when the surface is destroyed, not when the wl_pointer
slash wl_keyboard resource is destroyed.
2014-02-17 19:22:30 -05:00
Jasper St. Pierre
515dc08a97 pointer/keyboard: Do a series of renames to our listener as well 2014-02-17 19:22:30 -05:00
Jasper St. Pierre
2e7a56a28f wayland: Rename resource_destroy_cb to wl_surface_destructor
So it doesn't seem like a wl_listener callback.
2014-02-17 19:22:30 -05:00
Jasper St. Pierre
c485637a61 default: Don't use anchor points
It doesn't work now that we set the pivot point. This breaks the
maximize effect, but it fixes the destroy effect. The maximize effect
looks bad anyway, so it's not too important to me.
2014-02-17 17:57:45 -05:00
Jasper St. Pierre
f9f2a82e18 xwayland: Don't -retro
This means we see black instead of checkerboard for now when resizing,
but that's better.
2014-02-17 17:57:40 -05:00
Jasper St. Pierre
2f4563132a default: Use a consistent rand() for monitor backgrounds
g_random_int() is seeded with /dev/urandom, so it's not consistent.
2014-02-17 14:02:13 -05:00
Jasper St. Pierre
e3a0f2c546 default: Don't wait to show the stage
We can show it immediately now...
2014-02-17 13:57:35 -05:00
Jasper St. Pierre
d39baeb8ad wayland-surface: Destroy the right thing
data is the wl_client, which we don't want to destroy. Destroy
our XdgShell pointer instead.
2014-02-17 12:53:56 -05:00
Jasper St. Pierre
f27f6aab78 Update to new xdg-shell pinging standards 2014-02-16 10:21:22 -05:00
Jasper St. Pierre
a66060e21a Revert "Move window pings to MetaWindow"
This was a bad idea, as ping/pong has moved to a client-specific
request/event pair, rather than a surface-specific one. Revert
the changes we made here and correct the code to make up for it.

This reverts commit aa3643cdde.
2014-02-16 10:21:22 -05:00
Jasper St. Pierre
11aa3c030b wayland-surface: Don't require we manually bump the version for xdg-shell
It's in the protocol as an enum.
2014-02-16 10:21:22 -05:00
Jasper St. Pierre
bd1bec5617 wayland-surface: Prefix xdg-shell methods with "xdg_shell_" 2014-02-16 10:21:22 -05:00
Adel Gadllah
d9659d4b36 wayland-surface: Don't crash when someone tries to run a native app using old gtk
This ends up calling set_dbus_properties with a NULL
window, instead of segfaulting the compositor return so that the broken
app dies instead.

https://bugzilla.gnome.org/show_bug.cgi?id=724472
2014-02-16 16:19:23 +01:00
Ryan Lortie
d043d9943b idle-monitor: avoid XSyncBadAlarm X error
If we fail to find the IDLETIME counter, then the alarm variable will be
uninitialised.  Most code paths are careful to check this before
submitting XSync calls, but there is one check missing.

https://bugzilla.gnome.org/show_bug.cgi?id=724364
2014-02-15 13:14:01 +01:00
Jasper St. Pierre
a0ef7c7142 Move position-changed / size-changed signals to the MetaWindow
They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:44:39 -05:00
Jasper St. Pierre
4efe4483fb compositor: Delay meta_compositor_add_window until the first show
In order for the compositor to properly determine whether a client
is an X11 client or not, we need to wait until XWayland calls
set_window_id to mark the surface as an XWayland client. To prevent
the compositor from getting tripped up over this, make sure that
the window has been fully initialized by the time we call
meta_compositor_add_window.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:44:38 -05:00
Jasper St. Pierre
aec3edb1cc Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.

However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.

I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.

Remove this now.

The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.

At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:19:41 -05:00
Giovanni Campagna
0c5a6ad775 window: don't set _NET_WM_FULLSCREEN_MONITORS to bogus values
Prior to the DisplayConfig merge, we would set _NET_WM_FULLSCREEN_MONITORS
to (unsigned)-1 when unset. After that, we would have invalid
reads inside meta_screen_monitor_index_to_xinerama_index() (called
with -1).
The way I read the specification, the proper way to indicate
that the window is back to fullscreen on all monitors is to
remove the property, so do that.

Also, add an assertion that meta_screne_monitor_index_to_xinerama_index()
is doing the right thing.

https://bugzilla.gnome.org/show_bug.cgi?id=724258
2014-02-13 13:16:51 +01:00
Giovanni Campagna
2be5401b1e window: fix invalid read in computing the input shape
If we are reported only one rectangle in the input shape, we should
not try to read more.

https://bugzilla.gnome.org/show_bug.cgi?id=724257
2014-02-13 13:13:35 +01:00
Jasper St. Pierre
f16e9b2ee7 wayland-surface: Make set_margin double-buffered as well 2014-02-10 14:16:06 -05:00
Jasper St. Pierre
06380938d4 wayland-surface: Make set_fullscreen / set_maximized and friends double-buffered 2014-02-09 18:23:39 -05:00
Jasper St. Pierre
593db0baee default: Make the map animation more friendly 2014-02-09 11:53:15 -05:00
Jasper St. Pierre
6b66553493 display: Remove unused variable 2014-02-09 11:53:15 -05:00
Adel Gadllah
ddaae9c923 Fix build
I broke it while cherry picking the last commit.
2014-02-09 16:39:04 +01:00
Adel Gadllah
0c7a7d7527 Disable clutter's high dpi scaling
mutter needs some work to work with high dpi scaling so disable
the scaling until that is fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=723931
2014-02-09 16:25:37 +01:00
Jasper St. Pierre
6561b53346 display: Clean up screen management code 2014-02-07 19:52:34 -05:00
Jasper St. Pierre
def5e86673 wayland: Add support for the set_margin request 2014-02-07 19:28:36 -05:00
Jasper St. Pierre
0c213c8fee wayland: Add support for the delete event 2014-02-07 19:28:36 -05:00
Jasper St. Pierre
912a0abd26 wayland: Remove edges
This is an upstream change to xdg-shell.
2014-02-07 19:28:36 -05:00
Jasper St. Pierre
d694260ad2 xwayland: Fix xwayland
Don't give us a freed pointer here.
2014-02-07 19:28:05 -05:00
Jasper St. Pierre
8566566451 xwayland: Split out the XWayland stuff into its own private struct 2014-02-07 16:21:27 -05:00
Jasper St. Pierre
0ce64e46e8 build: Don't build client-protocols for things
We don't use these.
2014-02-07 16:21:27 -05:00
Rico Tzschichholz
a8336669a3 shaped-texture: Fix unused variable warning
(cherry picked from commit 101a13c86d)
2014-02-05 22:51:46 +01:00
Jasper St. Pierre
f6db756326 shaped-texture: Move unobscured_region processing here
We want to remove a bunch of auxilliary duties from the MetaWindowActor
and MetaSurfaceActor, including some details of how culling is done.
Move the unobscured region culling code to the MetaShapedTexture, which
helps the actor become "more independent".

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-05 14:42:38 -05:00
Jasper St. Pierre
27ab516f41 cullable: Reset the culling state instead of skipping the traversal
When we traversed down to reset the culling state, previously we
would just skip any actors that wanted culling. In order to properly
reset the unobscured_region before painting, we need to traverse down
to these places as well. Do this by calling cull_out with NULL regions
for both arguments, and adapt existing cull_out implementations to
match.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-05 14:24:08 -05:00
Jasper St. Pierre
9542b464bf window-actor: Clean up whitespace 2014-02-05 14:14:41 -05:00
Jasper St. Pierre
1ebaaa1950 shaped-texture: Clean up code flow a bit
This is easier for me to read.
2014-02-05 14:10:50 -05:00
Jasper St. Pierre
71efbf0330 shaped-texture: Constify clip
This matches upstream
2014-02-05 14:10:49 -05:00
Jasper St. Pierre
a6539463be shaped-texture: Remove get_clip
It seems that this code is trying to transform from "surface coordinates"
(the size of texture that's being displayed) to "actor coordinates"
(the actor's allocation), but I can't find any place where the two are
different. As such, let's just go back to using "surface coordinates"
everywhere and see what breaks.
2014-02-05 14:05:18 -05:00
Jasper St. Pierre
3e98ffaf99 wayland-surface: Don't crash if a client destroys a buffer in use
This is considered "undefined" by upstream. Right now GTK+ does this
a lot, so we shouldn't crash. Let's make them crash instead and send
them an error instead.
2014-02-03 18:36:46 -05:00
Jasper St. Pierre
0a9754f305 main: Squash constness warning 2014-02-03 18:02:16 -05:00
Jasper St. Pierre
965a784c8a screen: Fix build
I thought I finished this patch last night... I guess not
2014-02-03 18:00:44 -05:00
Jonas Ådahl
2db9f55669 window-x11: Fix offscreen window match expression
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723564
2014-02-03 17:34:52 -05:00
Jasper St. Pierre
3e73babaf7 display: Clean up creation of the guard window a bit...
Do it consistently in all code paths...
2014-02-03 17:33:52 -05:00
Jasper St. Pierre
66c4555dc7 main: Use setenv() 2014-02-03 17:33:52 -05:00
Jonas Ådahl
183ad75603 default plugin: Fix workspace switch type error
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723563
2014-02-03 17:33:52 -05:00
Marek Ch
66fc32ee14 core: remove tautological condition
unsigned number is always greater than 0

https://bugzilla.gnome.org/show_bug.cgi?id=720818
2014-02-02 15:23:40 +01:00
Marek Ch
d6396cf2c4 window: fix coerced value
(int) 0.5 = 0, so there always was 0 instead of 50%
2014-02-02 15:17:29 +01:00
Adel Gadllah
c9b7104117 monitorManager: Fix logic bug in make_logical_config
The code that prevents the creation of multiple MonitorInfos for clones
wasn't working due to using the wrong index when getting the already
created info so fix that to use the correct one.

https://bugzilla.gnome.org/show_bug.cgi?id=710610
2014-02-02 15:15:28 +01:00
Adel Gadllah
6bf1a66b7c window_actor: Remove the frame_messages timeout in destroy
Otherwise it might fire off later and cause a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=723468
2014-02-02 15:15:20 +01:00
Jasper St. Pierre
7e7b671b8e keybindings: Simplify interface for VT switching 2014-02-01 19:38:01 -05:00
Jasper St. Pierre
e04a55d1a2 keybindings: Reindent 2014-02-01 19:22:56 -05:00
Jasper St. Pierre
8905bd2280 window-x11: Move meta_window_new to window-x11.c and rename 2014-02-01 19:19:22 -05:00
Jasper St. Pierre
b09e1399c0 window: Centralize WM_STATE management 2014-02-01 19:18:01 -05:00
Jasper St. Pierre
59c8b949ad window: Delay the showing of XWayland clients until set_window_id
Use our new "surface_mapped" field to delay the showing of XWayland clients
until we have associated together the window's XID and the Wayland surface ID.

This ensures that when we show this window to the compositor, it will properly
use the Wayland surface for rendering, rather than trying to use COMPOSITE and
crash.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:18:01 -05:00
Jasper St. Pierre
6dbb3fddce window: Fix build once more
Bad syntax here...
2014-02-01 19:08:27 -05:00
Jasper St. Pierre
f166240225 window: Clean up is_our_xwindow 2014-02-01 18:59:27 -05:00
Jasper St. Pierre
91b789c707 window: Split out logic for determining whether an X window is ours 2014-02-01 18:59:27 -05:00
Jasper St. Pierre
14db280fab window: Fix build
The proper function name is "meta_window_recalc_features"
2014-02-01 18:58:58 -05:00
Jasper St. Pierre
f7097e6f66 Start moving X11-specific code to window-x11.c
The goal here is to make MetaWindow represent a toplevel, managed window,
regardless of if it's X11 or Wayland, and build an abstraction layer up.
Right now, most of the X11 code is in core/ and the wayland code in wayland/,
but in the future, I want to move a lot of the X11 code to a new toplevel, x11/.
2014-02-01 18:39:12 -05:00
Jasper St. Pierre
ff89f1e271 window: Use window-props interface to load role/net_wm_type on init 2014-02-01 18:39:12 -05:00
Jasper St. Pierre
6a8a4bfdcd window: Remove internal recalc_window_type / recalc_window_features
Just use the public symbols for them.
2014-02-01 18:39:12 -05:00
Florian Müllner
cd35982d4e window: Remove duplicated function declaration 2014-02-01 18:38:54 -05:00
Jasper St. Pierre
2f6f0f252c wayland: Simply store a MetaWaylandBuffer
There's no need for the MetaWaylandBufferReference abstraction...
2014-02-01 17:55:16 -05:00
Jasper St. Pierre
13651949ed wayland-seat: Rename sprite to cursor_surface 2014-02-01 17:55:03 -05:00
Jasper St. Pierre
fdeb72224c wayland-seat: Fix pointer issues
Moving the mouse over weston-terminal, we can see several issues:

 * it often updates late, or not at all
 * the attachment of the pointer sprite is wrong

These are because we willy-nilly call seat_update_sprite all over the
place, and often in wrong areas. Set up a set_pointer_surface helper
method that will do the right thing for us in all cases, and call it
on transitions.
2014-02-01 17:54:47 -05:00
Jasper St. Pierre
92e36e7076 wayland-surface: Attach the buffer to a surface, even if it doesn't have a role
Currently, set_cursor isn't properly working. Often, the requests look
like this:

  cursor_surface = wl_compositor.create_surface()
  cursor_buffer = create_cursor_buffer()
  cursor_surface.attach(cursor_buffer, 0, 0)
  cursor_surface.commit()
  wl_pointer.set_cursor(cursor_surface, 7, 14)

But since the surface doesn't "have a role" when the commit comes in,
we ignore it, and don't do anything with the pending buffer. When
set_cursor is called, however, we don't immediately update anything
since it doesn't have a buffer.

This effectively means that set_cursor has unpredictable side effects.
Weston's toy toolkit reuses the same surface for every buffer, so it
only fails the first time. In clients that use a new surface for every
cursor sprite, the cursor is effectively invisible.

To solve this, change the code to always set the buffer for a surface,
even if it doesn't have any real role.
2014-02-01 17:24:13 -05:00
Jasper St. Pierre
d74796ee80 wayland-surface: Use the same commit() when commiting subsurface
Refactor our commit() implementation out of wl_surface_commit(),
and pass the double-buffered state around to all our implementation
methods. This allows us to drop a few lines destroying and
reinitializing list of frame callbacks. This is a big cleanup for
the next commit, though.
2014-02-01 16:44:18 -05:00
Jasper St. Pierre
3e35cac67a wayland-surface: Repick after cleaning up everything else
Just a code cleanup to keep all the freeing code together.
2014-02-01 16:29:36 -05:00
Jasper St. Pierre
1f7a6bf845 wayland-surface: Don't clean up the buffer_destroy_listener twice
double_buffered_state_destroy will do this for us.
2014-02-01 16:29:09 -05:00
Jasper St. Pierre
365442c1ff wayland-surface: Fix typo 2014-02-01 16:19:54 -05:00
Jasper St. Pierre
c8d185fc74 display: Revise Wayland event handling
X11 window frames use special UI grab ops, like META_GRAB_OP_CLICKING_MAXIMIZE,
in order to work properly. As the frames in this case are X11 clients, we need
to pass through X events in this case. So, similar to how handle_xevent works,
use two variables, bypass_clutter, and bypass_wayland, and set them when we
handle specific events.
2014-02-01 11:54:47 -05:00
Jasper St. Pierre
9567fa9c6a wayland: Check for launcher before freeing it
This prevents a segfault on shutdown.
2014-01-31 19:03:56 -05:00
Jasper St. Pierre
7a8de0c0af wayland: Reindent 2014-01-31 19:03:56 -05:00
Jasper St. Pierre
10fead9ba1 wayland-pointer: Fix infinite loop when leaving focus from a destroyed surface
To prevent corruption, our focus listener needs to be removed even when
the surface is destroyed. So, bailing out when pointer->focus->resource
is NULL just isn't good enough.
2014-01-31 18:21:04 -05:00
Jasper St. Pierre
d5d5c2167a compositor: Remove pending_input_region
Ever since the change to create the output window synchronously at startup,
there hasn't been any time where somebody could set a stage region the
output window was ready, so this was effectively dead code.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-31 17:21:00 -05:00
Jasper St. Pierre
b9755ea725 window-actor: Remove old unused APIs
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-31 17:19:27 -05:00
Jasper St. Pierre
39fee9f5a2 window-actor: Flip set_redirected around
I know it's confusing with the triple negative, but unredirected is how
we track it elsewhere: we have an 'unredirected' flag, and 'should_unredirect'.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-31 17:19:26 -05:00
Jasper St. Pierre
d6282716b2 compositor: Simplify the unredirected window management code
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-31 17:19:26 -05:00
Jasper St. Pierre
60d9bee3bf window-actor: Simplify the unredirected check in cull_out
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-31 17:19:26 -05:00
Jasper St. Pierre
a09fa3b0e4 wayland: Clean up the parallels between creating callbacks and surface extensions 2014-01-31 16:40:47 -05:00
Jasper St. Pierre
9edff6f250 wayland: Use wl_callback_send_done
For no specific reason...
2014-01-31 16:40:47 -05:00
Jasper St. Pierre
7d3012fd67 screen: Make the guard window an InputOnly window
Using a full InputOutput window causes us to make a full Wayland surface
for it, and go through the X server. As the goal of the guard window is
a window for us to stack minimized windows under so we can prevent them
from getting input, it makes sense to use an InputOnly window here.
2014-01-31 14:19:42 -05:00
Jasper St. Pierre
225e20a898 wayland: Remove superfluous "wayland_" from arguments 2014-01-31 11:38:37 -05:00
Jasper St. Pierre
1a62ac9276 xwayland: Shuffle some code around 2014-01-31 11:24:02 -05:00
Adel Gadllah
45cb151443 window-actor: Fix unobscured_region handling when computing paint volume
We currently ignore the unobscured region when we have mapped clones in
meta_window_actor_process_damage and meta_window_actor_damage_all but
use it unconditionally when computing the paint volume.

This is wrong. We should ignore it there as well or we will end up with
empty clones if the cloned window is completly obscured
(like the tray icons in gnome-shell).

https://bugzilla.gnome.org/show_bug.cgi?id=721596
2014-01-31 15:16:48 +01:00
Florian Müllner
55b18f9671 window: Add "skip-taskbar" property
We currently only have a method to query the skip-taskbar hint.
Add a corresponding property to allow listening for change
notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=723307
2014-01-31 13:33:38 +01:00
Jonas Ådahl
4f4b1bfc37 wayland: Support wl_subsurface.set_sync/set_desync
Implement support for synchronous subsurfaces commits. This means that
the client can, by calling wl_subsurface.set_sync, cause its surface
state to be commited not until its parent commits.

This will mean there will be will potentially be one more surface state
(regions, buffer) at the same time: the active surface state, the mutable
pending surface state, and the immutable surface state that was pending
on last surface commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 15:13:44 -05:00
Jonas Ådahl
9348c9bd4b wayland: Make wl_subsurface.place_(above|below) properly synchronized
The placement set by either wl_subsurface.place_above or
wl_subsurface.place_below should be applied when the parent surface
invokes wl_surface.commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 15:13:43 -05:00
Jonas Ådahl
16de7f66fb wayland: Make wl_subsurface.set_position properly synchronized
The position set by wl_subsurface.set_position should be applied when
the parent surface invokes wl_surface.commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 19:12:06 +01:00
Jonas Ådahl
799c27484d wayland: Report error when trying to stack subsurface incorrectly
Don't allow a client to stack a subsurface next to a subsurface with
another parent, or to a non-parent non-subsurface surface.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 19:12:06 +01:00
Jasper St. Pierre
c3b0faec82 main: Make sure to free any events that we get from Clutter 2014-01-29 14:03:43 -05:00
Jasper St. Pierre
9c876722a0 xwayland: Use server protocol wrappers instead of wl_resource_post_event 2014-01-29 10:27:16 -05:00
Jasper St. Pierre
96fc93d744 xwayland: Reindent 2014-01-29 10:23:58 -05:00
Jasper St. Pierre
20545941fa Revert unintentional merge from wip/surface-content to wayland
This reverts a lot of commits.
2014-01-22 09:18:13 -05:00
Jasper St. Pierre
59f79e8294 constraints: CSD windows need to have their titlebar kept onscreen too
GTK+ CSD windows are considered undecorated by the code, so we should
not force ourselves to only run on decorated windows.

https://bugzilla.gnome.org/show_bug.cgi?id=719772
2014-01-22 09:15:59 -05:00
Jasper St. Pierre
ac32b9ef95 get xwayland working again 2014-01-21 19:06:06 -05:00
Jasper St. Pierre
ba484be754 window-actor: Don't use TFP under XWayland
Simply have a NULL surface actor until the set_window_id arrives...
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
a318198ab4 xwayland: Update the surface actor for the window on set_window_id
We need to do this for XWayland windows, since we only get the event
telling us they're an XWayland window after the compositor knows about
the window.
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
e6391c2896 surface content 2014-01-21 19:01:34 -05:00
Jasper St. Pierre
7ea537fad7 Move position-changed / size-changed signals to the MetaWindow
They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
03146c2967 window-actor: Remove old unused APIs
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
0a81314337 window-actor: Flip set_redirected around
I know it's confusing with the triple negative, but unredirected is how
we track it elsewhere: we have an 'unredirected' flag, and 'should_unredirect'.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
fa7a5782c6 compositor: Simplify the unredirected window management code
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
e3b64912b6 window-actor: Simplify the unredirected check in cull_out
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
a0fe392665 surface-actor: Move unobscured_region processing here
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
0e5f365d55 compositor: Remove pending_input_region
Ever since the change to create the output window synchronously at startup,
there hasn't been any time where somebody could set a stage region the
output window was ready, so this was effectively dead code.
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
bfc906cbc4 compositor: Remove meta_compositor_window_[un]mapped
We no longer unmap the toplevel windows during normal operation. The
toplevel state is tied to the window's lifetime.

Call meta_compositor_add_window / meta_compositor_remove_window instead...
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
8e6f8087e8 Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.

However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.

I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.

Remove this now.

The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. Theoretically, we might want to
show previews of shaded windows in the overview and Alt-Tab, so we remove
the complex unmap tracking for this later.
2014-01-21 19:01:18 -05:00
Jasper St. Pierre
56207ddb6a window-actor: Never unredirect when under Wayland
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-20 16:14:56 -05:00
Jasper St. Pierre
8cb9cfb7b8 Revert "meta-weston-launch: Call VT_ACTIVATE ourselves"
This reverts commit ebe6e3180e.

This is wrong, as mutter's controlling TTY may not be the same
as the active VT, and in fact won't be in the case of systemd
spawning us.

The "correct" API for this is to use David Herrmann's
"Session Positions" system to switch to another VT:

  http://lists.freedesktop.org/archives/systemd-devel/2013-December/014956.html
2014-01-16 13:42:07 -05:00
Jonas Ådahl
be698b597b shaped-texture: Use a double when calculating clip
For x defined below, x == -INT32_MAX assuming that the arithmetic
expression actually uses the fpu.

float f = 1.0f;
int32_t x = INT32_MAX * f;

This would result in the calculated clip width/height to be -INT_MAX
if the damage width/height is INT_MAX. To solve this, use a double
variable instead.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-16 13:27:59 -05:00
Florian Müllner
788bd59857 cursor-tracker: Rely on gbm_bo_imports()'s buffer validation
cogl_texture_get_format() has been deprecated, so rather than using
it to figure out beforehand whether the buffer format is supported,
just rely on the import failing if it isn't.

https://bugzilla.gnome.org/show_bug.cgi?id=722347
2014-01-16 10:18:32 -05:00
Jasper St. Pierre
2391606cc5 cursor-tracker: Update for Cogl APIs as well 2014-01-13 13:55:58 -05:00
Jasper St. Pierre
7155d7e043 Properly set the number of components on the CoglTextureRectangle
We need to set the number of components on the CoglTextureRectangle to
prevent wasting too much GPU memory. As we need to do this before we call
cogl_texture_set_region, just remove the meta_texture_rectangle_new wrapper,
and make callers call cogl_texture_rectangle_new_with_size directly.
2014-01-13 13:28:38 -05:00
Jasper St. Pierre
419dfd333a Update for Cogl API breaks 2014-01-13 13:08:17 -05:00
Andika Triwidada
9b21346427 Changed obsolete FSF postal address into generic URL.
Fix https://bugzilla.gnome.org/show_bug.cgi?id=721517 #2
2014-01-13 11:35:47 -05:00
Debarshi Ray
7b15d21e40 monitor: Suppress -Werror=unused-variable
Fallout from 477acddf64

https://bugzilla.gnome.org/show_bug.cgi?id=721674
2014-01-13 11:35:47 -05:00
Cosimo Cecchi
7b597b8c62 monitor: improve heuristic to determine display output name
Under some circumstances, for example when the display controller driver
doesn't report back the correct EDID, or under VirtualBox, Mutter
returns suboptimal strings for an output display name, leading to funny
labels like 'Unknown 0"', or '(null) 0"' in the Settings panel.

This commit improves our heuristic in three ways:
- we now avoid putting inches in the display name if either dimension is
  zero
- we use the vendor name in case we're not able to lookup its PnP id
  from the database. Previously we would have passed over '(null)'
- as a special edge-case, when neither inches nor vendor are known, we
  use the string 'Unknown Display'

Finally, we make the combined vendor + inches string translatable, as
different languages might want to move the size part of the string to a
position different than the end.

https://bugzilla.gnome.org/show_bug.cgi?id=721674
2014-01-13 11:35:47 -05:00
Jasper St. Pierre
7a4adce44f window: Atomically unmaximize both directions from a _NET_WM_STATE ClientMessage
When GDK sends an unmaximize _NET_WM_STATE ClientMessage, it tells us to remove
the _NET_WM_STATE_MAXIMIZED_HORZ and _NET_WM_STATE_MAXIMIZED_VERT states. Before
this time, it would independently call:

  meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
  meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);

Which, besides being foolishly inefficient, would also mess up our saved_rect
tracking, causing the window to only look like it was unmaximized vertically.

Make this code more intelligent, so it causes us to unmaximize in one call.

https://bugzilla.gnome.org/show_bug.cgi?id=722108
2014-01-13 11:35:47 -05:00
Daniel Drake
a5f0db5ecb window: don't grab server during calc_showing
This grab was added in commit caf43a123f
https://bugzilla.gnome.org/show_bug.cgi?id=381127
to minimize window flickering when switching workspaces.

While this grab is held, some signals are emitted to the shell,
which can lead to deadlocks (reproduced under Mali binary OpenGLESv2
drivers).

Now that we are a compositing window manager, we do not have to
worry about flickers, this grab should no longer be necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=721709
2014-01-07 14:27:24 -06:00
Daniel Drake
577624adef Reduce server grabs during window creation
Remove some obvious server grabs from the window creation codepath,
also ones that are taken at startup.

During startup, there is no need to grab: we install the event handlers
before querying for the already-existing windows, so there is no danger
that we will 'lose' some window. We might try to create a window twice
(if it comes back in the original query and then we get an event for it)
but the code is already protected against such conditions.

When windows are created later, we also do not need grabs, we just need
appropriate error checking as the window may be destroyed at any time
(or it may have already been destroyed).

The stack tracker is unaffected here - as it listens to CreateNotify and
DestroyNotify events and responds directly, the internal stack
representation will always be consistent even if the window goes away while
we are processing MapRequest or similar.

Now that there are no grabs we don't have to worry about explicitly calling
display_notify_window after grabs have been dropped. Fold that into
meta_window_new_shared().

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:53:16 -06:00
Daniel Drake
af46ef3b96 meta_window_new: clean up error handling
The return code of XGetWindowAttributes() indicates whether an error
was encountered or not. There is no need to specifically check the error
trap.

The trap around XAddToSaveSet() was superfluous. We have a global error
trap to ignore any errors here, and there is no need to XSync() as GDK
will later ignore the error asynchronously if one is raised.

Also move common error exit path to an error label.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:44:31 -06:00
Daniel Drake
39d26be941 screen: use stack tracker for initial window query
In meta_screen_manage_all_windows() we can use our own stack
tracker to get the list of windows - no need to query X again.

A copy is needed because the stack gets modified as part of the loop.
Specifically, meta_stack_tracker_get_stack() at this time returns the
predicted stack, and meta_window_new() performs a few operations
(e.g. framing) which cause immediate changes to the predicted stack.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:44:31 -06:00
Daniel Drake
7bfc9109f7 frame: remove unnecessary server grab
meta_window_ensure_frame() creates its own grab and has a comment
claiming that it must be called under a grab too.

But the reasoning given in the comment does not seem relevant here.
We only frame non-override-redirect windows, so we are creating
the frame in response to MapRequest. There is no way that the child
could receive a MapNotify at this point, since that only happens
much later, once we go through the CALC_SHOWING queue and call
XMapWindow() from meta_window_show().

Remove the unnecessary grab.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:17:09 -06:00
Daniel Drake
becbad56ef Discourage server grabs
Server grabs are not as evil as you might expect, but there is agreement
in that their usage should be limited.

Server grabs can cause things to go rather wrong when mutter emits
a signal while it has grabbed the server. If the receiver of that signal
waits for a synchronous action performed by another client, then you
have a deadlock. This happens with Mali binary GLESv2 drivers :(

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:17:09 -06:00
Daniel Drake
384a34c27d Remove meta_window_new_with_attrs
The compositor code used to handle X windows that didn't have a
corresponding MetaWindow (see commit d538690b), which is why the
attribute query is separated.

As that doesn't happen any more, we can clean up. No functional changes.

Suggested by Owen Taylor.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:17:06 -06:00
Jasper St. Pierre
002c5b8f87 wayland: Don't keep track of the drm FD in the WaylandCompositor
As logind can give us a new FD at any time when it resumes. Theoretically,
this is still technically wrong, as the MetaCursorTracker holds onto it.
We'll fix this after we port to logind.
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
1d3dbea20c meta-weston-launch: Don't use a GObject here
We don't need a complicated API anymore.
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
ebe6e3180e meta-weston-launch: Call VT_ACTIVATE ourselves
We don't need any special permissions, so we don't need to go through
weston-launch to do so...
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
a3de799939 wayland-surface: Remove inappropriate meta-weston-launch.h include 2013-12-31 19:20:58 -05:00
Owen W. Taylor
0caf7381bb display: Don't leave focus on a window we are unmanaging when sending WM_TAKE_FOCUS
When we move focus elsewhere when unmanaging a window, we *need* to move
the focus, so if the target is globally active, move the focus to the
no-focus-window in anticipation that the focus will normally get moved
to the right window when the target window responds to WM_TAKE_FOCUS.

If the window doesn't respond to WM_TAKE_FOCUS, then focus will be left
on the no-focus-window, but there's no way to distinguish whether the
app will respond or not.

https://bugzilla.gnome.org/show_bug.cgi?id=711618
2013-12-24 11:30:14 -05:00
Owen W. Taylor
a42305edab Be willing to unfocus the grab window when we are unmanaging it
When we are unmanaging the grab window, we /need/ to unfocus it,
so we shouldn't bail out early from meta_window_focus().

https://bugzilla.gnome.org/show_bug.cgi?id=711618
2013-12-24 11:30:11 -05:00
Jasper St. Pierre
ef2b6e7d00 window-actor: Fix optimization in get_paint_volume
We need to clip the paint volume to the unobscured region, not the
other way around...

https://bugzilla.gnome.org/show_bug.cgi?id=720630
2013-12-18 18:43:39 -05:00
Owen W. Taylor
9c1b972ca1 Fix problems with focus tracking
When a client spontaneously focuses their window, perhaps in response
to WM_TAKE_FOCUS we'll get a FocusOut/FocusIn pair with same serial.
Updating display->focus_serial in response to FocusOut then was causing
us to ignore FocusIn and think that the focus was not on any window.

We need to distinguish this spontaneous case from the case where we
set the focus ourselves - when we set the focus ourselves, we're careful
to combine the SetFocus with a property change so that we know definitively
what focus events we have already accounted for.

https://bugzilla.gnome.org/show_bug.cgi?id=720558
2013-12-18 09:46:08 -05:00
Owen W. Taylor
cb33e1942a meta_window_move_resize_internal: handle border size changes
Initial placement during meta_window_constrain() can result in changes
to the borders, so we need to recompute our border sizes after
constraining. This fixes incorrect window borders on
initially maximized windows.

https://bugzilla.gnome.org/show_bug.cgi?id=720417
2013-12-18 09:30:22 -05:00
Jasper St. Pierre
7009d1e470 wayland: Update to latest xdg-shell
We don't use the new maximize / fullscreen request system yet, leading
to broken maximization / fullscreen. This will be fixed in a followup.
2013-12-17 15:04:16 -05:00
Florian Müllner
c54a19825b keybinding: Implement keybindings for moving windows between monitors
Currently the only way to move a window to another monitor via
keyboard is to start a move operation and move it manually using
arrow keys. We do have all the bits of a dedicated keybinding in
place already, so offer it as a more comfortable alternative.

https://bugzilla.gnome.org/show_bug.cgi?id=671054
2013-12-12 09:13:17 +01:00
Jasper St. Pierre
8131f34eb6 Move _NET_WM_WINDOW_OPACITY handling to the standard window-props interface 2013-12-09 15:53:23 -05:00
Jasper St. Pierre
f29241d90e compositor: Remove atom_x_root_pixmap
It's unused
2013-12-09 15:53:23 -05:00
Rui Matos
bad48ea815 introspection: Make MetaKeyHandlerFunc compatible with master
This allows gnome-shell's JS handlers work on the wayland branch.
2013-12-09 21:34:53 +01:00
Jasper St. Pierre
66af41f4a9 window-actor: Remove outdated code path
The shadow is added in the paint step, not as a separate actor,
so the raise is a no-op. It also gets rid of an annoying misspelling
that's driving me crazy.
2013-12-09 14:10:44 -05:00
Jasper St. Pierre
e30be380dd window-actor: Move signal handler connections to the meta-window setter 2013-12-09 14:08:01 -05:00
Jasper St. Pierre
65f2e29375 window-actor: Make the meta-window property construct-only
We don't deal with setting this property at all, and it's unlikely
to come up in future settings, so just don't allow setting it at all.

https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-09 14:08:01 -05:00