Commit Graph

231 Commits

Author SHA1 Message Date
Florian Müllner
e9944350d3 delete: Share some code between X11 and wayland
In order to kill a window, on both X11 and wayland we first try to
kill(3) the corresponding process, so we can add the newly added
get_client_pid() method to share that code.

https://bugzilla.gnome.org/show_bug.cgi?id=772613
2016-10-10 23:35:02 +02:00
Florian Müllner
1fab6e69b7 window: Add get_client_pid() method
It is often useful to identify the client process that created
a particular window, however the existing meta_window_get_pid()
method relies on _NET_WM_PID, which is only available on X11 and
depends on applications to set it correctly (which may not even
be possible when the app runs in its own PID namespace as Flatpak
apps do). So add a get_client_pid() method that uses windowing
system facilities to resolve the PID associated with a particular
window.

https://bugzilla.gnome.org/show_bug.cgi?id=772613
2016-10-10 23:35:01 +02:00
Jonas Ådahl
8942e98e1d Revert "window: Make meta_window_has_pointer() per protocol implemented"
Windows from Xwayland still needs to use the Wayland path, but is
represented an MetaWindowX11, thus the abstraction introduced in
"window: Make meta_window_has_pointer() per protocol implemented"
is wrong. Lets turn back time, and reconsider how this can be
abstracted more correctly in the future.

This reverts commit 9fb891d216.
2016-08-26 06:51:19 +08:00
Jonas Ådahl
9fb891d216 window: Make meta_window_has_pointer() per protocol implemented
https://bugzilla.gnome.org/show_bug.cgi?id=769936
2016-08-25 12:19:40 +08:00
Jonas Ådahl
cd225c4e19 Always use the default screen
GDK doesn't support multiple screens, so effectively we don't either.
Lets stop pretending we do.

This fixes a few -Wdeprecated warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=769070
2016-07-23 10:55:02 +08:00
Jonas Ådahl
95a68854ad configure.ac: Add AC_GNU_SOURCE
We define it here and there already, and if we are to include private
cogl files, we need it in more places. Lets just add it everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Rui Matos
d62491f46e x11/window-props: Convert WM_NAME and WM_CLASS to UTF-8
gjs throws exceptions on non UTF-8 strings which, in some cases, crash
gnome-shell. ICCCM string properties are defined to be Latin-1 encoded
so we can try to convert them to avoid it.

Note that _NET_WM_NAME is defined to be UTF-8 and we already validate
it in utf8_string_from_results() .

https://bugzilla.gnome.org/show_bug.cgi?id=752788
2016-06-07 20:17:38 +02:00
Jonas Ådahl
417cb2b213 bell: Let the X11 caller deal with the X11 fallback
To support invoking the system bell on Wayland we shouldn't have paths
that fallback to X11. Let the X11 caller deal with the absence of
libcanberra, and change API to not take any X events.

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

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

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

Reported by ricotz on IRC.
2016-01-22 18:28:47 -08:00
Sebastian Keller
a7a376ae1f xprops: Null-terminate property reply values
Some of the mutter code using these properties expects them to be
null-terminated whereas xcb does not use null-terminated strings:

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=759658
2016-01-12 16:30:30 +01:00
Florian Müllner
3aea8d8ce6 Revert "Add "size states" which save window size information"
This reverts commit 2c7ef2269f.
2016-01-10 15:16:09 +01:00
Jasper St. Pierre
2c7ef2269f Add "size states" which save window size information
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:08:35 -08:00
Jasper St. Pierre
053f5088df window-x11: Fix unredirection for windows that explicitly set bounding
Some applications, like Chromium, explicitly set their bounding region
to the client area when full-screen. Detect this case, and allow us to
fullscreen when this happens.
2016-01-04 08:32:09 -08:00
Rui Matos
e7390cff83 x11/window: Ensure we send a ConfigureNotify to just mapped windows
When managing a non-OR window we're required by the ICCCM to behave as
if we received a ConfigureRequest which means that we must generate a
synthetic ConfigureNotify even if the window isn't moved or resized
from its current (initial) geometry.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=759492
2015-12-16 19:46:41 +01:00
Jasper St. Pierre
8cc345fcf5 window: Allow minimizing windows which don't advertise support for it
Wine removes the minimize func from its Motif hints on full-screen
windows, because, as the Win32 API literally says, the minimize button
is indeed not visible on full-screen windows.

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

https://bugzilla.gnome.org/show_bug.cgi?id=758186
2015-12-05 10:46:21 -08:00
Rui Matos
7606f79a1e x11/window-props: Initialize bypass compositor hint
If a client only ever sets the hint on window creation we'd never pick
the value. Also, include override redirect windows since the hint is
relevant to them too.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=746420
2015-10-19 17:21:59 -07:00
Florian Müllner
2feeb57dee iconcache: Mark surfaces as dirty after changing data
This is required to tell cairo to update its cached areas.
2015-10-16 04:04:31 +02:00
Florian Müllner
3a63d58d9e events: Don't use XIEvent serial numbers
XInput2 uses the raw sequence number for XIEvent serials[0], which only
matches the serial number in XEvents up to 16 bits[1]. So in order to
be able to make reliable comparisons with serials from other events or
calls to XNextRequest(), always use the field from the original XEvent
rather than the XIEvent serial (at least until we can get libXi fixed).

This (partially) reverts commit 35dd1e644d.

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

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=756074
2015-10-06 22:33:42 +02:00
Florian Müllner
25a796afc6 Fix constness warnings 2015-09-24 03:01:51 +02:00
Jasper St. Pierre
352cac3850 group: Convert code to XCB to prevent errors
Windows can disappear at any time because X11 is really cool and good,
so just use XCB so we won't crash if the window disappears.
2015-08-05 13:39:23 -07:00
Rui Matos
07f533f617 window: Remove fullscreen_after_placement special case
This was introduced in commit c6793d477a
to prevent window self-maximisation. It turns out that that bug seems
to have been fixed meanwhile in a different way since the reproducer
in https://bugzilla.gnome.org/show_bug.cgi?id=461927#c37 now works
fine with this special handling removed.

In fact, failing to set window->fullscreen immediately when loading
the initial set of X properties causes us to create a UI frame for a
window that sets _NET_WM_STATE_FULLSCREEN.

This, in turn, might cause the fullscreen constrain code to fail if
the window also sets min_width/min_height size hints to be the monitor
size since the UI frame size added to those makes the rectangle too
big to fit the monitor. If the window doesn't set these hints, we
fullscreen it but the window will get sized such that the UI frame is
taken into account while it really shouldn't (see the reproducer
above).

https://bugzilla.gnome.org/show_bug.cgi?id=753020
2015-07-30 15:27:01 +02:00
Florian Müllner
b41873dced window-x11: Remove duplicated code
meta_window_change_workspace_without_transients() already does
exactly that.
2015-07-23 12:13:45 +02:00
Jonas Ådahl
f6c9261bf6 wayland: Scale window geometry rects given the main output
Since we scale surface actors given what main output their toplevel
window is on, also scale the window geometry coordinates and sizes
(window->rect size and window->custom_frame_extents.top/left) in order
to make the window geometry represent what is being rendered on the
stage.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jasper St. Pierre
aea71fbd01 group: Select for property notifies on group leaders 2015-06-27 00:53:22 -07:00
Jasper St. Pierre
f041b35b9b xprops: Fix STRING types as well 2015-06-26 13:51:45 -07:00
Jasper St. Pierre
6dbec6f81b xprops: More Xlib / long cleanliness with Motif WM hints
Fixes some CSD windows sometimes getting frames when they totes
shouldn't.
2015-06-24 14:34:48 -07:00
Jasper St. Pierre
3962f1d982 xprops: Apply the same Xlib / 64-bit hygiene to atom lists 2015-06-23 15:37:58 -07:00
Jasper St. Pierre
414be07a69 xprops: Remove unused synchronous property getters
No reason to keep these around..
2015-06-23 15:37:23 -07:00
Jasper St. Pierre
7f3ada7831 xprops: Some more cardinal-related hygiene 2015-06-23 15:32:07 -07:00
Jasper St. Pierre
92d6a69153 xprops: Fix more gulong / 64-bit fallout from the xcb port 2015-06-23 15:09:32 -07:00
Jasper St. Pierre
734402e14d xprops: Cut off UTF-8 strings at n_items characters
There can be junk after here on some X servers.
2015-06-23 11:53:30 -07:00
Jasper St. Pierre
5d360a9bce xprops: Make sure that properties that failed to fetch are ignored 2015-06-23 11:52:49 -07:00
Jasper St. Pierre
f8cf5e373c mutter-Xatomtype: Fix the sizes of these structs
Since we're using xcb now, not Xlib, it doesn't have the stupid silly
thing where it copies all 32-bit data to 64-bit data to match the
long-y-ness of it.
2015-06-23 11:46:29 -07:00
Jonas Ådahl
bbf2b4e60e xprops: Don't pass ULONG_MAX as a uint32_t parameter
It seems the largest possible value is to be passed, so actually pass
that instead. Note that even though the name of the xcb_get_property
parameter is called 'long_length' its actually a uint32_t.

https://bugzilla.gnome.org/show_bug.cgi?id=751136
2015-06-18 11:38:00 +08:00
Jasper St. Pierre
2345b9c6ad xprops: Fix syntax error 2015-06-17 18:19:53 -07:00
Jasper St. Pierre
af7cc87bfa xprops: More XFree => g_free compatibility 2015-06-17 18:18:43 -07:00
Jasper St. Pierre
af3b599cbb xprops: Remove cvtINT32toInt
These are awful compatibility hacks for systems without native 64-bit
support. We can trash these now.
2015-06-17 18:18:03 -07:00
Jasper St. Pierre
0e73ceb4bd x11: Remove async-getprop
xcb can do this for us now.
2015-06-17 18:08:11 -07:00
Carlos Garnacho
4fc1811c15 wayland: Add X11/wayland selection interoperation
This piece of code hooks in both wl_data_device and the relevant X
selection events, an X11 Window is set up so it can act as the clipboard
owner when any wayland client owns the selection, reacting to
SelectionRequest events, and returning the data from the wayland client
FD to any X11 requestor through X properties.

In the opposite direction, SelectionNotify messages are received,
which results in the property contents being converted then written
into the wayland requestor's FD.

This code also takes care of the handling incremental transfers through
the INCR property type, reading/writing data chunk by chunk.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-15 17:43:53 +02:00
Jasper St. Pierre
ca6e799b97 Move atomnames.h to x11/
This should *not* be part of the public API.
2015-04-27 16:36:56 -07:00
Florian Müllner
67a30b7a89 window-x11: Fix height computation of shaded windows
Since commit 6e06648f7, we start out with the invisible frame parts
only, and then add the unconstrained rect's height (which consists of
the visible parts of both frame and client window) *unless* the window
is shaded. While we indeed don't want to add the client height in that
case, we need to explicitly include the visible frame parts now.

https://bugzilla.gnome.org/show_bug.cgi?id=746145
2015-03-13 14:08:12 +01:00
Carlos Garnacho
68ba45bcb2 Revert "x11: Cut some slack to clients doing slow draws/resizes"
As per https://bugzilla.gnome.org/show_bug.cgi?id=740424#c12

This reverts commit 94c3c8f412.
2015-03-12 18:41:57 +01:00
Carlos Garnacho
94c3c8f412 x11: Cut some slack to clients doing slow draws/resizes
The timer to blacklist the window from frame sync is set at the time of
issuing the sync request, but not removed until the client replies to
the most recent wait serial.

This means that if the client is slowly catching up, the timeout would
fire up regardless of the client slowly updating the alarm to older
values.

Fix this by ensuring the timeout is reset everytime the sync request
counter is updated, to acknowledge the client is not irresponsive,
just slow.

https://bugzilla.gnome.org/show_bug.cgi?id=740424
2015-03-05 17:07:32 +01:00
Jonas Ådahl
fffb863f37 wayland: Sync surface actor state when changing main monitor
In order to switch to the correct surface actor scale given the monitor
the surface is on, without relying on the client committing a new state
given some other side effect, sync the surface actor state when the main
monitor associated with the corresponding window changed.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05:00
Jasper St. Pierre
9b903e93e3 iconcache: Fix the icon of Kerbel Space Program
Kerbel Space Program, and perhaps some other SDL-based programs, use
a really dumb way of specifying icons, which is totally
non-standards-compliant.

The ICCCM specifies that the icon_pixmap field of WM_HINTS should be a
1-bit-deep Pixmap, but we've seen applications set it to a pixmap of the
root depth as well, so we support that.

Kerbel Space Program seems to use it with a 32-bit depth Pixmap,
signifying ARGB32 (which it is), along with a 1-bit icon_mask, which
crashes us.

Keep in mind that Pixmaps, by definition, have no Visual attached, so
we simply have to make a guess at the correct visual based on the
depth. Do that by assuming that a depth-32 visual always means ARGB32,
which is a pretty safe bet.
2015-02-17 23:45:02 -08:00
Jasper St. Pierre
7966f00a18 iconcache: Fix a dumb thinko
This is an xlib surface, not an image surface.
2015-02-17 23:45:02 -08:00
Cosimo Cecchi
11a9b4baa0 window-props: use memcmp() to compare GtkBorder structs
Saves some code.

https://bugzilla.gnome.org/show_bug.cgi?id=744500
2015-02-13 15:49:03 -08:00
Florian Müllner
e294f6df8c window-x11: Fix typo 2015-01-21 13:27:09 +01:00
Florian Müllner
422ddeddb9 window-x11: Remove duplicated condition
The outer block already checks for window->frame, so don't repeat
it.
2015-01-21 13:27:09 +01:00
Jasper St. Pierre
5c66bee84b display: Remove ungrab_should_not_cause_focus_window
It's been unused ever since we removed tabpopup.c
2015-01-17 17:55:36 -08:00
Jonas Ådahl
152b2dab59 barrier: Make X related hook more clearly named
https://bugzilla.gnome.org/show_bug.cgi?id=706655
2015-01-17 17:22:56 -08:00
Rui Matos
6609d9c6a4 iconcache: Fix icon data copy into cairo surface
The stride is in bytes but we're copying ints.

https://bugzilla.gnome.org/show_bug.cgi?id=742825
2015-01-13 16:01:13 +01:00
Jasper St. Pierre
90111c03a1 Only poke the frames UI code from inside frame.c
Add frame.c wrappers for the missing calls, then adapt.
2014-12-31 22:35:29 -08:00
Jasper St. Pierre
23681800d9 frame: Remove extra argument from sync_to_window 2014-12-31 22:35:29 -08:00
Jasper St. Pierre
af7f51b992 x11: Change the iconcache / window icons to being cairo surfaces
This simplifies the drawing codepath and makes us able to delete
a bunch of GdkPixbuf manipulation.
2014-12-31 21:11:21 -08:00
Jasper St. Pierre
2dd1f37820 Move the resizepopup to a compositor-side feature
This is the last big feature that requires X11 on Wayland, so let's just
trash it and make GNOME Shell reimplement it.
2014-12-29 17:44:41 -08:00
Jasper St. Pierre
b10a017446 events: Don't bother free-guarding
free already takes NULL just fine.
2014-12-28 19:51:22 -08:00
Jasper St. Pierre
d393cba39e events: Add a quick method to return a spewed event
For easy gcc debugging
2014-12-28 19:51:21 -08:00
Jasper St. Pierre
578f593d56 events: Remove unnecessary G_GNUC_UNUSED from spew subfunctions
Being used by an unused function is good enough for gcc to not complain.
2014-12-28 19:43:11 -08:00
Jasper St. Pierre
c782078e00 Rename MetaMoveResizeFlags items to fit with the theme
Use a proper prefix, even if more wordy, instead of META_IS.
2014-12-15 13:30:39 -08:00
Jasper St. Pierre
c408cf7aac window-x11: Fix windows that set empty input shapes
Windows that set empty input shapes get n_rects of 0 when querying them
later, which makes sense, but the code that interpreted the result
translated it into a NULL input shape, which meant it was the same as
the bounding region. As such, an empty input shape would actually get
interpreted as a full input shape!

We, ourselves, set an empty input shape on tray icon windows in
gnome-shell since we would handle the picking ourselves. This meant that
we'd actually get the MetaSurfaceActorX11 when hovering over the tray
icon, instead of the ShellGTKEmbed that we capture events on and react
to.

This fixes weird tray icon behavior in gnome-shell.
2014-11-26 12:51:35 -08:00
Jasper St. Pierre
5c80c4b006 window-x11: Update the input region after setting the client rect
We clip the input region to the client rect, so the client rect should
be up to date before we fetch the input region.

This fixes popup windows not working in GTK+2 under Wayland.

We should also update the shape / input regions when the window is
reconfigured for a complete fix, so that making an O-R window bigger
doesn't confuse mutter, but let's leave that to a future commit.
2014-10-12 16:14:17 -07:00
Jasper St. Pierre
461aea47dd window: Adjust the frame rect when _GTK_FRAME_EXTENTS is set on map 2014-09-19 17:35:38 -06:00
Jasper St. Pierre
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
Jasper St. Pierre
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
Owen W. Taylor
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
Owen W. Taylor
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
Jasper St. Pierre
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
Jasper St. Pierre
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
Jasper St. Pierre
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
Jasper St. Pierre
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
Owen W. Taylor
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
Owen W. Taylor
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
Owen W. Taylor
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
Jasper St. Pierre
96bee8e60d Conditionalize some more Wayland support 2014-09-03 19:51:02 -07:00
Jasper St. Pierre
f4f70afe31 window-x11: Fix the coordinates we use in the synthetic ConfigureNotify
Before, we were using the root window coordinates of the client window,
rather than the toplevel frame window. This caused various Java programs
and programs like VirtualBox and WINE to get confused about where their
window actually is, and make bad ConfigureRequests when trying to
position their windows in the future.

Remove the mass of code here by just using window->rect.
2014-08-18 14:41:36 -04:00
Jasper St. Pierre
527c53a2a0 workspace: Rewrite workspace management code
The existing workspace management code is quite hairy, with plenty of
logic inline in all of window.c, workspace.c, and screen.c, making it
hard to understand or make changes to, since you might forget to change
several of the other places the code was around.

Rewrite the internal workspace management logic so that it's
centralized and all in window.c. Document the invariants we need to
maintain, and ensure that these invariants are properly kept, with
asserts in various places.

Extensive testing on gnome-shell did not bring up any issues, and this
is a considerable cleanup.
2014-08-16 14:59:13 -04:00
Jasper St. Pierre
f8dcea3975 window-x11: Simplify some grab op code 2014-08-15 13:46:54 -04:00
Jasper St. Pierre
b8c13cc426 window-x11: Fix stage window check when running under non-X11 backends
This code also runs when under the native backend for XWayland, so we
can't crash on an invalid cast there.
2014-08-15 12:38:15 -04:00
Adel Gadllah
38253a9f73 window-x11: The x11 backend window is our window as well
Since commit 467465c99c we use meta_stage even on x11 which sets
clutter_stage_set_user_resizable to FALSE.

This messes things up because we ought to ignore the properties on the window
but we apperently didn't.

There is no reason why we'd want to manage the stage window.

https://bugzilla.gnome.org/show_bug.cgi?id=734852
2014-08-15 17:53:27 +02:00
Jasper St. Pierre
39f65f9f86 backend: Add a keymap-changed signal 2014-08-14 17:36:29 -04:00
Jasper St. Pierre
e830b66604 Remove a few extra HAVE_XKBs 2014-08-14 14:19:31 -04:00
Jasper St. Pierre
5f0fab2156 Conditionalize Wayland support again 2014-08-13 20:28:22 -04:00
Jasper St. Pierre
879407c10c window: Kill off a now-unnecessary state variable 2014-08-13 18:25:46 -04:00
Rui Matos
513628e4ad wayland-keyboard: Use the backend's keymap
Instead of getting it from xwayland, let's just keep a reference to
the backend's keymap.

https://bugzilla.gnome.org/show_bug.cgi?id=734301
2014-08-07 11:24:24 +02:00
Florian Müllner
b7119c55a6 window-props: Add FORCE_INIT flag to force hooks for unset properties
Since commit a7b7213017, we rely on the standard property
system to initialize the window type (and likewise for the window
role since commit 031154a400). However as property hooks are
never run for properties that are not set, we end up not initializing
the window type correctly for windows with no _NET_WM_WINDOW_TYPE
property (which includes virtually all OR windows, causing them to
show up in pagers and the Shell overview and resulting in frequent
crashes due to breaking reasonable assumptions all over the place).

Introduce a new FORCE_INIT flag to allow forcing hooks to run
even when the corresponding property is unset, and use it for
both _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_ROLE.
2014-08-02 20:26:00 +02:00
Jasper St. Pierre
7159d3bc35 window: Remove the concept of surface_mapped
The implementation was just wrong. We now consider it an error to attach
a NULL buffer to an xdg_surface. Users should destroy the surface properly.
2014-07-14 14:49:58 -04:00
Jasper St. Pierre
941d202938 window: Move X11-specific icon code to MetaWindowX11 2014-07-14 12:15:23 -04:00
Jasper St. Pierre
5ea0cf8bab iconcache: Remove a useless icon_cache_free
All it does is poke a few fields. There is no point to it.
2014-07-14 12:02:58 -04:00
Jasper St. Pierre
06e4778072 iconcache: Group declarations where they're used 2014-07-14 11:30:03 -04:00
Jasper St. Pierre
92388892b3 iconcache: Remove dead code 2014-07-14 11:27:51 -04:00
Jasper St. Pierre
5d124ac00a iconcache: Remove commented out code 2014-07-14 11:27:51 -04:00
Jasper St. Pierre
a57c3ae105 iconcache: Remove want_fallback hint
It's unused, and if it was ever set, it would cause an assert fail.
2014-07-14 11:27:50 -04:00
Jasper St. Pierre
39357fc242 window-props: Don't make another round-trip to fetch the opaque region
We already have the property value from our property fetching.
2014-07-13 22:51:25 -04:00
Jasper St. Pierre
46361c3e28 events: Return early if we close the display
This is so we won't poke into the MetaDisplay, which is invalid memory,
and crash. This can sometimes work right now because GSlice might not
deallocate the object immediately, but it's still not a fun thing to do.
2014-07-13 11:43:28 -04:00
Jasper St. Pierre
bee97ab6a7 window-props: Make sure that recalc_window_type is always called 2014-07-10 17:07:52 -04:00