1
0
Fork 0
Commit graph

726 commits

Author SHA1 Message Date
Armin Krezović
1d5e37050d Stop using MetaScreen where it is unnecessary
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
b7c3dada81 Move workspace handling to MetaDisplay and MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
e1c67a1824 Move monitor management API to MetaDisplay
This includes changing various users to use MetaDisplay directly, who
used MetaScreen only for this before.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
68f261e8e2 Move rest of non-X11 specific objects from MetaScreen
This moves following objects from MetaScreen to MetaDisplay

- workareas_later and in_fullscreen_later signals and functions
- startup_sequences signals and functions
- tile_preview functions

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
05899596d1 Move X11 helper windows and xprops to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
98d912ba5f Move stack tracking and guard_window outside of MetaScreen
Move stack, stack_tracker to MetaDisplay guard_window to MetaX11Display

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
722c975aca Move alarm and xids management to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
cd8f4259be Move screen size and cursor setting to MetaDisplay
Split X11 specific parts into MetaX11Display. This also required
changing MetaScreen to stop listening to any signals by itself, but
instead relying on MetaDisplay forwarding them. This was to ensure the
ordering. MetaDisplay listens to both the internal and external
monitors-changed signal so that it can pass the external one via the
redundant MetaDisplay(prev MetaScreen)::monitors-changed.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
dacc041d0c Switch meta_error_trap functions to MetaX11Display
They are X11 specific functions, used for X11 code. They have been
improved per jadahl's suggestion to use gdk_x11_lookup_xdisplay and
gdk_x11_display_error_trap_* functions, instead of current code.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
18779109de Start populating MetaX11Display
- Moved xdisplay, name and various atoms from MetaDisplay
- Moved xroot, screen_name, default_depth and default_xvisual
  from MetaScreen

- Moved some X11 specific functions from screen.c and display.c
  to meta-x11-display.c

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Sam Spilsbury
8626c69c2f window: Return -1 if meta_window_get_monitor is called on an unmanaged window
As opposed to crashing. In this case, letting the caller deal with
it is the best policy, since this is public API.

https://bugzilla.gnome.org/show_bug.cgi?id=788834
2018-06-28 16:24:07 +00:00
Georges Basile Stavracas Neto
822c2666f5 window: Let implementations finish state changes
In the old, synchronous X.org world, we could assume that
a state change always meant a synchronizing the window
geometry right after. After firing an operation that
would change the window state, such as maximizing or
tiling the window,

With Wayland, however, this is not valid anymore, since
Wayland is asynchronous. In this scenario, we call
meta_window_move_resize_internal() twice: when the user
executes an state-changing operation, and when the server
ACKs this operation. This breaks the previous assumptions,
and as a consequence, it breaks the GNOME Shell animations
in Wayland.

The solution is giving the MetaWindow control over the time
when the window geometry is synchronized with the compositor.
That is done by introducing a new result flag. Wayland asks
for a compositor sync after receiving an ACK from the server,
while X11 asks for it right away.

Fixes #78
2018-04-25 21:55:05 -03:00
Georges Basile Stavracas Neto
63e2c0329f window: Fix a small memory leak 2018-03-21 21:16:23 -03:00
Georges Basile Stavracas Neto
00b8ca7aeb Revert "window: Raise and lower tile match in tandem"
Raising and lowering windows in tandem without a proper grouping
mechanism ended up being more annoying than functional.

This reverts commit e76a0f564c.
2018-03-09 20:13:14 +01:00
Egmont Koblinger
67bf936ef8 theme: Fix icon scaling
When painting the titlebar, button icons that aren't available in the
desired size need to be scaled. However the current code inverses the
scale factor, with the result that the adjusted icons are much worse
than the original icons, whoops.

This went unnoticed for a long time given that most icons are availa-
ble in the desired 16x16 size, and the most likely exceptions - window
icons - are not shown by default.

https://gitlab.gnome.org/GNOME/mutter/issues/23
2018-03-03 15:48:35 +00:00
Gwan-gyeong Mun
abd6b7affd Change naming of GParmSpec enum id string for naming consistency
GParamSpec enum string usually follows "PROP_" prefix and PROP_LAST is used
for last PROP string.

https://gitlab.gnome.org/GNOME/mutter/issues/28

Closes: #28
2018-02-10 13:49:14 +01:00
Olivier Fourdan
5f05112b9a wayland: update location prior to maximize
When maximizing a window, the previous location is saved so that
un-maximize would restore the same original window location.

However, if a Wayland client starts with a window maximized, the
previous location will be 0x0, so if we have to force placement in
xdg_toplevel_set_maximized(), we should update the location as well so
that the window is placed on the right monitor when un-maximizing.

For that purpose, add a new flag to force the update of the window
location, and use that flag from xdg_toplevel_set_maximized().

https://bugzilla.gnome.org/show_bug.cgi?id=783901
2018-01-11 11:03:04 +01:00
Olivier Fourdan
1139ace244 core: Add new unmaximize flag
Wayland clients know their size better, so for Wayland we'd rather not
try to resize the client on un-maximize, but for this to work we need a
new MetaMoveResizeFlags.

https://bugzilla.gnome.org/show_bug.cgi?id=783901
2018-01-11 11:03:04 +01:00
Olivier Fourdan
bd9a300801 window: Defer stack placement without a buffer
When closing a window and showing a new one, the new one may not be
granted input focus until it gets a buffer on Wayland.

If another window is chosen to receive focus and raised on top of stack,
the newly mapped window is focused but placed underneath that other
window.

Meaning that for Wayland surfaces, we need to defer adding the window to
the stack until we actually get to show it, once we have a buffer
attached.

Rather that checking the windowing backend prior to decide if a window
is stackable or not, introduce a new vfunc is_stackable() which tells
if a window should be added to the stack regardless of the underlying
windowing system.

Also add meta_window_is_in_stack() API rather than checking the stack
position directly (replacing the define WINDOW_IN_STACK only available
in stack.c) and remove a window from the stack only if it is present
in the stack, so that the test in meta_stack_remote() becomes
irrelevant.

https://bugzilla.gnome.org/show_bug.cgi?id=780820
2018-01-11 11:03:04 +01:00
Olivier Fourdan
1546989845 xwayland: Add MetaWindowXwayland
MetaWindowXwayland derives from MetaWindowX11 to allow for some Xwayland
specific vfunc that wouldn't apply to plain X11 windows, such as
shortcut inhibit routines.

https://bugzilla.gnome.org/show_bug.cgi?id=783342
2017-12-18 13:15:09 +01:00
Marco Trevisan (Treviño)
ab5ac21104 window: rename get_flatpack_id into get_sandboxed_app_id
This function can be more generic now.

https://bugzilla.gnome.org/show_bug.cgi?id=789277
2017-10-21 13:36:16 -05:00
Jonas Ådahl
6eb7d13894 window: Handle updating from no to no monitor
When we received two hot plug events that both resulted in headless
configuration, we tried to find a new window monitor given the old.
That resulted in a null pointer dereference; avoid that by only trying
to find the same monitor if there was an old one.

https://bugzilla.gnome.org/show_bug.cgi?id=788607
2017-10-07 00:36:03 -04:00
Georges Basile Stavracas Neto
a5f4ffa58c window: Track edge constraints
GTK has the ability to handle client-decorated windows
in such a way that the behavior of these windows must
match the behavior of the current window manager.

In Mutter, windows can be tiled horizontally (and, in
the future, vertically as well), which comes with a few
requirements that the toolkit must supply. Tiled windows
have their borders' behavior changed depending on the
tiled position, and the toolkit must be aware of this
information in order to properly match the window manager
behavior.

In order to provide toolkits with more precise and general
data regarding resizable and constrained edges, this patch
makes MetaWindow track its own edge constraints.

This will later be used by the backends to send information
to the toolkit.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
a1c39e142d window: Also consider touching edges for matching tiled windows
When computing a potential match for a tiled window, there is a
chance we face the case where 2 windows really complement each
other's tile mode (i.e. left and right) but they have different
sizes, and their borders don't really touch each other.

In that case, the current code would mistakenly assume they're
tile matches, and would resize them with either a hole or an
overlapping area between windows. This is clearly a misbehavior
that is a consequence of the previous assumptions pre-resizable
tiles.

This patch adapts the tile match algorithm to also consider the
touching edges when computing the matching tile, unless:

 * the window is not currently tiled (for example when computing
   the tile preview)
 * the window is currently resized in tandem with an existing
   tile match

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

bar
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
e76a0f564c window: Raise and lower tile match in tandem
When a pair of tiled windows are grouped together, they
are treated as parts of a whole and interacting with one
affects the other.

Following the idea that sibling tiled windows are treated
as part of the same group, they should also be raised and
lowered together.

It is still possible to break tiled windows grouping by
simply untiling the window with the keyboard or by grabbing
and resizing or moving the window with the cursor.

This patch makes sibling tiled windows be lowered and raised
in tandem. For future reference, this behavior is documented
in [1].

[1] https://wiki.gnome.org/GeorgesNeto/MinutesOfFeaneron/Tiling

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
1dbf6b096b edge-resistance: Add snapping for tiled windows
When windows are tiled, it improves the interaction with
them when they have a set of snapping edges relative to
the monitor. For example, when there's a document editor
and a PDF file opened, I might want to rescale the former
to 2/3 of the screen and the latter to 1/3.

These snapping sections are not really tied to any other
window, and only depend on the current work area of the
window. Thus, it is not necessary to adapt the current
snapping edge detection algorithm.

This patch adds the necessary code in edge-resistance.c
to special-case tiled windows and allow them to cover
1/4, 1/3 and 1/2 (horizontally) of the screen. These
values are hardcoded.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
6fe71ecc01 window: Tile and resize considering the tile match
After the introduction of the possibility to resize tiled windows,
it is a sensible decision to make windows aware of their tiling
match. A tiling match is another window that is tiled in such a
way that is the complement of the current window.

The newly introduced behavior attepts to make tiling as smooth as
possible, with the following rules:

 * Windows now compute their tile match when tiling and, if there's
   a match, they automatically complement the sibling's width.
 * Resizing a window with a sibling automatically resizes the sibling
   too to be the complement of the window's width.
 * It is not possible to resize below windows' minimum widths.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
57e58eaf2a window: Maximize tiled windows when resizing to work area
Now that tiled windows are resizable, the user may grow a tiled
windows until it covers the entire work area. As this makes the
window state mostly indistinguishable from maximization, avoid
subtle differences by properly maximizing the window in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Florian Müllner
00a5db71cf window: Allow resizing of tiled windows
Currently tiled windows are not resizable and their size is fixed
to half the screen width. Adjust the code to work with fractions
other than half, and allow users to adjust the split by dragging
the window edge that is not constrained by a monitor edge.

Follow-up patches will improve on that by resizing neighboring
tiled windows by a shared edge, and making the functionality
available to client-side decorated windows implementing the
new edge constraints protocol.
2017-10-03 19:38:31 -03:00
Florian Müllner
c7fa57cd28 window: Pass mode as parameter to tile() operation
Now that the preview tile mode has been split from the window's
tile_mode property, it is much more natural to pass the requested
tile_mode to the tile() function instead of setting it externally
and calling the function to apply the state.
2017-10-03 19:38:31 -03:00
Florian Müllner
8f2c86d79e window: Split out preview_tile_mode
The existing semantics of the tile_mode property are terribly confusing,
as it depends on some other property whether it represents the requested
or current mode. Clear this up by just using separate variables for the
two. As it is unlikely that we will ever support more than one tile
preview, we can track the requested mode globally instead of adding
another per-window variable.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
56f1da5c66 window: Update tile monitor before move
The actual move may involve the tile monitor, so make sure to not use
an outdated value by setting it before calling move_between_rects().

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Florian Müllner
30a205c0e3 window: Remove obsolete code
Commit 91b7dedf36 removed the ability to temporarily break out
of maximization/tiling during grab operations, so this code is no
longer necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Jonas Ådahl
6dd819a61e window: Don't try to auto-maximize when headless
Automatic maximization is done when a window is almost the size of the
work area of a monitor. This makes no sense to try when there is no
monitor available, so skip trying to do this when headless.

https://bugzilla.gnome.org/show_bug.cgi?id=787637
2017-10-02 18:02:19 -04:00
Jonas Ådahl
39aae19ed7 window: Treat being headless as not monitor sized
When we are headless, treat this as if the window is always not monitor
sized. This might cause windows to temporarly become redirected while
being headless, but this is harmless as when a new monitor is
connected, we'll recalculate weather it should be redirected or not.

https://bugzilla.gnome.org/show_bug.cgi?id=787637
2017-10-02 18:02:16 -04:00
Vasilis Liaskovitis
e3d59832c5 x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling
Implement _NET_RESTACK_WINDOW, based on metacity commit 0b5a50c8.

Also respect "above" field (sibling) of XConfigureRequestEvent. When it is
set, perform a stack operation relative to that sibling.

https://bugzilla.gnome.org/show_bug.cgi?id=786363
https://bugzilla.gnome.org/show_bug.cgi?id=786365
2017-09-29 18:30:26 +02:00
Jonas Ådahl
2c85bb4178 window: Make should_be_on_all_workspaces() handle being headless
Also adds a soft assert to meta_window_is_on_primary_monitor() to make
it easier to spot when callers might want to handle headless
in a certain way.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-09-29 10:35:13 -04:00
Marco Trevisan (Treviño)
6dc499f305 window: Support snap packages for sandboxed app IDs
For now we abuse of meta_window_get_flatpak_id not to break the APIs,
so that it's working seamlessly in gnone shell too.

Rename flatpak_id to sandboxed_app_id internally to get prepared to the future
API.

https://bugzilla.gnome.org/show_bug.cgi?id=788217
2017-09-27 22:08:57 +08:00
Jonas Ådahl
2df4ccd1cd window: Handle being headless better
This avoids updating state (such as position, size etc) when going
headless. Eventually, when non-headless, things will be updated again,
and not until then will we be able to update to a valid state.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
7562eb6006 core/window: Don't set a preferred output when there is none
If there are no active logical monitors, don't try to dereference a
NULL one to get a preferred output winsys id. Instead just set an
invalid one.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Olivier Fourdan
dd12f569d9 wayland: add inhibit shortcut mechanism
Add a mechanism to MetaWaylandSurface that inhibits compositor's own
shortcuts when the surface has input focus, so that clients can receive
all key events regardless of the compositor own shortcuts.

This will help with implementing "fake" active grabs in Wayland and
XWayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=783342
2017-08-02 11:58:55 +02:00
Jonas Ådahl
4afa66fe41 wayland/window: Update toplevel main monitor before non-toplevel
When updating the main monitor, make sure to update the toplevel main
monitor before trying to use that as the main monitor for non-toplevel
windows (such as popups). Without this, when the main monitor is
updated as a side effect to monitors being changed (for example due to
a hot plug event, or coming back from being suspended) the
main monitor pointer may, after 'monitors-changed' has completed, point to
freed memory resulting in undefined behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=784867
2017-07-17 09:59:34 +08:00
Carlos Garnacho
408292959e core: Add meta_close_dialog_focus() vmethod
This is used to request key focus on the close dialog whenever
a window that is frozen would receive key focus. Also, ensure
that the dialog gets focus when first shown if the window was
meant to receive input.

https://bugzilla.gnome.org/show_bug.cgi?id=762083
2017-07-16 19:21:41 +02:00
Jonas Ådahl
7bd69f0b32 window: Don't crash when moving across non-adjecent logical monitors
When moving a window between two non-adjecent logical monitors, don't
try to tile a window when the window position is outside of any logical
monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=783630
2017-07-12 12:30:54 +08:00
Florian Müllner
5f49bda591 window: Include window itself in transient loop check
While it doesn't make sense to set a window as transient to
itself, our existing check whether making a window transient
doesn't cover it, so it's still possible to create an infinite
loop.

https://bugzilla.gnome.org/show_bug.cgi?id=783502
2017-06-22 08:49:40 +02:00
Florian Müllner
4d7329a7e2 window: Include STATE_CHANGED flag when tiling
For size change animations, plugins rely on the size change effect being
followed by size changed signal (or effects being kill altogether).
However unless the move_resize operation included the STATE_CHANGED flag,
the size changed event emitted when the compositor syncs the window
geometry only happens when the operation resulted in an actual change.

To avoid animations getting stuck in that case, make sure to include the
flag when tiling a window.

https://bugzilla.gnome.org/show_bug.cgi?id=783293
2017-06-06 15:35:06 +02:00
Alessandro Bono
270da95cbc window: Notify about size-change when tiling
Call meta_compositor_size_change_window while tiling in order
to emit the size-change signal. Since the untiling action is
considered a unmaximize size change, treat tiling as a maximize
size change for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=782968
2017-05-24 09:51:29 +02:00
Jonas Ådahl
05d15f8885 window/wayland: Don't try to resize window on tear down
When terminating mutter running as a display server, don't try to resize
maximized windows when unmanaging, as at this point, they will have no
MetaWaylandSurface. Originally this was done instead of setting the
net_wm_state to not mess with future window managers, but when we're a
Wayland compositor, this does not matter.

https://bugzilla.gnome.org/show_bug.cgi?id=782156
2017-05-22 21:17:39 +08:00
Carlos Garnacho
fe5138dfc4 core: Replace close dialog implementation with MetaCloseDialog
src/core/delete.c now entirely relies on MetaCloseDialog in order
to handle the "Application is not responding" dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=711619
2017-05-15 15:09:15 +02:00
Jonas Ådahl
5d3e7d6ffd window: Always sync window geometry on state change
When a state changed, e.g. a window went from unfullscreen to
fullscreen, always sync the window geometry, otherwise a compositor
application (e.g. gnome-shell) might end up with an unfinished window
state transition effect.

Without always syncing, the compositor plugin will see a 'size-change'
event, as a result of the state change, but if the size didn't change,
it would never see the 'size-changed' event. If an effect, for example
gnome-shell's fullscreen effect, is triggered on 'size-change' it might
rely on the actual size change to not get stuck. This commit allows it
to have this dependency.

This fixes a bug where a fullscreen effect gets "stuck" when a window
goes fullscreen without changing the window geometry.

https://bugzilla.gnome.org/show_bug.cgi?id=780292
2017-03-23 22:12:25 +08:00