1
0
Fork 0
Commit graph

738 commits

Author SHA1 Message Date
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
Rui Matos
bb2e8ff09a window: Make move_to_monitor work for zero sized and offscreen windows
Wayland windows are initially zero sized until clients commit the
first buffer. Despite being invisible, clients are allowed to request
such windows to be fullscreened on a specific output before they
attach the first buffer which means we need to be able to move them.

meta_window_move_to_monitor() doesn't handle this case because these
windows' initial monitor is a placeholder since their initial
coordinates are 0,0+0+0, which results in us using a rectangle as
old_area for meta_window_move_between_rects() that might be to the "right"
of the window causing the move to go further out of the visible
screen's coordinates. This is later "corrected" by the constraints
system but the window might end up in the wrong monitor.

To fix this, we can make meta_window_move_between_rects() accept a
NULL old_area, meaning that we move the window to the new_area without
trying to keep a relative position.

https://bugzilla.gnome.org/show_bug.cgi?id=772525
2017-02-21 19:51:32 +01:00
Jonas Ådahl
4e812410cc monitor-manager: Move logical monitor into its own file
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
1fb0e8e9bb monitor-manager: Store logical monitors in a GList
Instead of storing the logical monitors in an array and having users
either look up them in the array given an index or iterate using
indices, put it in a GList, and use GList iterators when iterating and
alternative API where array indices were previously used.

This allows for more liberty regarding the type of the logical monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
016359ede2 window: Remove public meta_window_get_all_monitors API
It's not used anywhere and used monitor indices which is unoptimal.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
410bad88a8 screen: Don't use monitor indices in check_fullscreen_func
Rewrite check_fullscreen_func to not use indexes (and
offset-index-as-pointer) tricks. This also removes the usage of an API
constructing temporary logical monitor arrays carrying indices.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
98ee85ce82 Let the MetaWindow calculate its main logical monitor itself
There is no point in going via a MetaScreen API to calculate the "main
monitor" of a window, so let the window do that calculation itself.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
2df4ebff47 Put logical monitor grid lookup API in MetaMonitorManager
Don't falsely assume the screen has anything to do with the monitor
grid, and thus move the related API to MetaMonitorManager.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
317b734dcc Move cursor tracker ownership to the backend
Let the backend initialize the cursor tracker, and change all call
sites to get the cursor tracker from the backend instead of from the
screen. It wasn't associated with the screen anyway, so the API was
missleading.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
ecf796f82b window: Keep track of fullscreen monitors directly
Instead of keeping around array indexes, keep track of them by storing
a pointer instead. This also changes from using an array (imitating the
X11 behaviour) to more explicit storing.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
79fd91ec35 Add API for getting work area given a logical monitor
To complement the current API which takes an index referencing a
logical monitor in the logical monitor array, add API that takes a
direct reference to the logical monitor itself. The intention is to
replace the usage of the index based API with one that doesn't rely on
internal implementation details.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
c936056663 MetaMonitorManager: Track primary monitor by pointer instead of index
Instead of keeping an index in an array to keep track of the current
primary logical monitor, just keep a pointer instead.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
e22bbd4b14 MetaScreen: Remove redundant copy of logical monitors array
It was just pointer to the actual list; having to synchronize a list of
logical monitors with the actual monitors managed by the backend is
unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
103df63023 MetaWindow: Clear fullscreen monitors when monitors change
The fullscreen monitors state is set given a set of xinerama monitor
identification numbers. When the monitor configuration changes (e.g. by
a hotplug event) these are no longer valid, and may point to
uninitialized or unallocated data. Avoid accessing
uninitialized/unallocated memory by clearing the fullscreen monitor
state when the monitor configuration changes.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
842ff5d6aa Rename MetaMonitorInfo MetaLogicalMonitor
In preparation for further refactorizations, rename the MetaMonitorInfo
struct to MetaLogicalMonitor. Eventually, part of MetaLogicalMonitor
will be split into a MetaMonitor type.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Rui Matos
2b59b4c793 keybindings: Grab buttons with any modifier combo on unfocused windows
We currently only focus unfocused windows on button press if no
modifiers (or just ignored modifiers) are in effect. This behavior
seems surprising and counter-intuitive so let's do it for any modifier
combination instead.

https://bugzilla.gnome.org/show_bug.cgi?id=746642
2016-11-23 18:40:11 +01:00
Rui Matos
1956a6ae76 window: Use the target rect for the grab anchor position on unmaximize
A window's unconstrained_rect is essentially just the target rectangle
we hand to meta_window_move_resize_internal() except it's not updated
until the window actually moves or resizes.

As such, for wayland client resizes, since they're async, using
window->unconstrained_rect right after calling move_resize_internal()
to update the grab anchor position on unmaximize doesn't work as it
does for X clients.

To fix this, we can just use the target rectangle for the grab
anchor. Note that comment here was already wrong since it says we
should be taking constraints into account and yet the code used the
unconstrained rect anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=770345
2016-11-23 18:37:47 +01:00
Rui Matos
1d280d8fa1 window: Inform the compositor when a window effectively changes size
In order for the compositor plugin to be able to animate window size
changes properly we need to let it know of the starting and final
window sizes.

For X clients this can be done synchronously and thus with a single
call into the compositor plugin since it's us (the window manager)
who's in charge of the final window size.

Wayland clients though, have the final say over their window size
since it's determined from the client allocated buffer.

This patch moves the meta_compositor_size_change_window() calls before
move_resize_internal() which lets the compositor plugin know the old
window size and freezes the MetaWindowActor.

Then we get rid of the META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR flag
since it's not needed anymore as the window actor is frozen and that
means we can use meta_compositor_sync_window_geometry() as the point
where we inform the compositor plugin of the final window size.

https://bugzilla.gnome.org/show_bug.cgi?id=770345
2016-11-23 18:37:35 +01:00
Olivier Fourdan
998d921d41 window: Do not unfocus on new window
mutter would remove focus from a toplevel when showing one of its
transient window which is not on top and not focused.

When using xdg_popup without grab as allowed in xdg_shell v6, the popup
wouldn't be focused, and if an intermediate event occurs before the
popup is shown, it's not placed on top either, which could randomly
trigger a loss of focus in the corresponding toplevel window.

Remove that special case, it doesn't make much sense to globally unset
focus when mapping a new window.

https://bugzilla.gnome.org/show_bug.cgi?id=773210
2016-10-27 17:21:21 +02:00
Florian Müllner
bccff5bdd8 window: Expose Flatpak application ID
GNOME Shell's window matching currently fails frequently with Flatpak
applications, as one of the primary hints used to link windows with
.desktop files - the WM_CLASS - no longer matches when flatpak renames
the exported .desktop file. Luckily, Flatpak provides us with a fail-safe
way to map from the PID to the corresponding application ID, so expose an
appropriate method that allows GNOME Shell to reliably match windows to
the corresponding Flatpak app.

https://bugzilla.gnome.org/show_bug.cgi?id=772614
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
6c8f6afdc4 window: Fix focus of unmappable modal transient's parent
When a modal transient is unmanaging, most likely the parent of the
modal transient should be focused.

In Wayland, a MetaWindow is created when a shell surface role (like
xdg_toplevel) is created, but a window cannot be shown until a buffer
is attached. If a client would create two modal transients and make
them both have the same parent, but only one get a buffer attached
(i.e. shown), when unmanaging the modal transient that was showing,
when finding a new focus candidate, the stacking code will ignore the
not-to-be-shown buffer-less modal transient when finding a good
candidate for focusing. In the case described here, this means it will
find the parent of the unmanaging modal transient.

This newly chosen candidate will then be passed to meta_window_focus();
meta_window_focus() will then try to find any modal transient to focus
instead, will find the one without any buffer, then fail to focus it
because it cannot be mapped, thus making meta_window_focus() not focus
anything. Since meta_window_focus() didn't change any focus state, the
assert in meta_window_unmanage() checking that the unmanaging window
isn't focused anymore will be hit, causing mutter to abort.

For now, fix this by checking whether the modal transient can actually
be focused in meta_window_focus(). For X11 client windows, a window
will be defined to be focusable always, but for Wayland client windows,
a window will be determined focusable only if it has a buffer attached.

In the future, we should probably do a more thorough refactorization of
focus handling to get rid of any X11 - Wayland differences.

https://bugzilla.gnome.org/show_bug.cgi?id=757568
2016-09-01 21:09:10 +08:00
Florian Müllner
89f6fdce5d events: Only pass key events to Wayland if focus is on the stage
Even without a compositor grab, key events may still be expected to
be processed by the compositor and not applications, for instance
when using ctrl-alt-tab to keynav in the top bar. On X11, focus is
moved to the stage window in that case, so that events are processed
before they are dispatched by the window manager. On wayland, we need
to handle this case ourselves, so make sure to not pass key events to
wayland in that case, and move the key focus back to the stage when
appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=758167
2016-08-30 00:20:31 +02:00
Jonas Ådahl
658d97d00e window: Don't unmanage transient_for when attached
For some reason, when a modal dialog was made an attaching
transient-for, if the window wasn't "constructing", it would be
unmanaged and rely on some side effect to be recreated. This side
effect is not triggered for Wayland clients, thus if one happen to set
a surface as "modal" via gtk_surface.set_modal before
xdg_toplevel.set_parent, it'd be unmanaged and never show up.

Instead, simply just set the tranciency anyway for Wayland clients.
This makes GTK+ clients that set_modal() before set_transient_for()
work.

https://bugzilla.gnome.org/show_bug.cgi?id=770324
2016-08-26 09:59:55 +08: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
8833991201 core: Add support for custom window placement rules
Add support for assigning a window a custom window placement rule used
for calculating the initial window position as well as defining how a
window is constrained.

The custom rule is a declarative rule which defines a set of parameters
which the placing algorithm and constrain algorithm uses for
calculating the position of a window. It is meant to be used to
implement positioning of menus and other popup windows created via
Wayland.

A custom placement rule replaces any other placement or constraint
rule.

https://bugzilla.gnome.org/show_bug.cgi?id=769936
2016-08-25 12:19:40 +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
Rui Matos
5ee0f24ab9 window: Stop updating layers on focus changes
Commit 3a4ae679ea removed the
FOCUSED_WINDOW layer definition but it was already unused for a long
time. There's no layers to update on focus changes.

https://bugzilla.gnome.org/show_bug.cgi?id=768221
2016-07-06 19:11:30 +02:00
Rui Matos
fcc7501eb8 core: Remove META_LAYER_FULLSCREEN
This layer isn't really being used and in fact, it causes
meta_stack_get_default_focus_window() to return a fullscreen window
even if the naturally topmost window in the stack isn't a fullscreen
one.

Note that commit a3bf9b01aa changed how
we choose the default focus window from the MRU to the topmost in the
stack.

https://bugzilla.gnome.org/show_bug.cgi?id=768221
2016-07-06 19:11:30 +02:00
Olivier Fourdan
492854e14d window: Do not try to focus O-R windows in focus-follow-mouse
Doing so would raise a critical warning.

https://bugzilla.gnome.org/show_bug.cgi?id=767997
2016-07-06 09:14:56 +02:00
Rui Matos
8f7a36c53f window: Don't create invalid UTF-8 window description strings
printf string precision counts bytes so we may end up creating invalid
UTF-8 strings here. Instead, use glib's unicode aware methods to clip
the title.

https://bugzilla.gnome.org/show_bug.cgi?id=765535
2016-06-07 20:17:37 +02:00
Marek Chalupa
6cc688d575 wayland: don't send notify when window is being unmanaged
If we try to send notify event (either from surface_state_changed()
or from meta_window_wayland_move_resize_internal()),
we will crash, because we don't have a sufrace anymore.
There's no reason why to resize the window that is being
unmanaged anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=751847
2016-05-12 20:06:11 +02:00
Jonas Ådahl
10a0114856 wayland: Move buffer use count to MetaWaylandSurface
Each wl_surface.commit with a newly attached buffer should result in
one wl_buffer.release for the attached buffer. For example attaching
the same buffer to two different surfaces must always result in two
wl_buffer.release events being emitted by the server. The client is
responsible for counting the wl_buffer.release events and be sure to
have received as many release events as it has attached and committed
the buffer, before reusing it.

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

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

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759299
2016-02-18 09:03:56 +01:00
Florian Müllner
46eb682c83 Revert "window: Remove old tiling code"
This reverts commit 8bded7d497.
2016-01-10 15:16:09 +01:00
Florian Müllner
3aea8d8ce6 Revert "Add "size states" which save window size information"
This reverts commit 2c7ef2269f.
2016-01-10 15:16:09 +01:00
Florian Müllner
40c3c69435 Revert "window: Add new tiling code"
This reverts commit 50e3e3b929.
2016-01-10 15:16:08 +01:00
Jasper St. Pierre
50e3e3b929 window: Add new tiling code
The new tiling code, instead of based around "tiling states", is instead
based around constrained edges. This allows us to have windows that have
three constrained edges, but keep one free-floating, e.g. a window tiled
to the left has the left, top, and bottom edges constrained, but the
right edge can be left resizable.

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

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

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=756789
2016-01-05 20:42:04 +01:00
Jonas Ådahl
213f0fa160 window: Update the stack after setting the transient_for field
Don't update the stack until after setting the window->transient_for
field. Updating before will cause the stack transient-for constraint to
be missing until the next time constraints are applied.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=758186
2015-12-05 10:46:21 -08:00
Carlos Garnacho
c625d2ee9d core: Make meta_window_handle_ungrabbed_event() touch-aware
This fixes the effects of this function on touchscreens in wayland
(most notably, window raising & focusing).
2015-11-25 18:00:36 +01:00
Marek Chalupa
99c0b82b15 window: do not force placing window if it is not mapped
When managing window, we queue showing the window.
Under wayland, if we commit surface quickly enough,
the showing is unqueued and commit procedure takes care
of mapping and placing the window. In the oposite case,
queue is processed before client sets all we need and
then we have wrong size of window, which leads to broken placement.
Therefore force placement in queue only if the window should already
be mapped. If it is not mapped, we don't care where it is anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=751887
2015-11-16 10:21:09 +08:00
Rui Matos
76e816a14f window: Properly update window->monitor for the desktop window
We don't want to move the desktop window but we still need to update
window->monitor or otherwise we'll be left with a pointer to invalid
memory.

https://bugzilla.gnome.org/show_bug.cgi?id=757148
2015-10-27 14:33:34 +01:00
Cosimo Cecchi
a692fd3808 compositor: add hooks for fullscreen and unfullscreen animations
https://bugzilla.gnome.org/show_bug.cgi?id=707248
2015-10-12 22:28:30 -04:00
Owen W. Taylor
1ab8b854df Improve debug logging of Wayland windows
Displaying all Wayland windows with the XID of 0x0 makes it hard
to figure out what is going on ... use the recently-added
window->stamp to show Wayland windows as W1/W2/W3...
2015-10-12 09:52:25 -04:00
Colin Walters
6190ae3873 window: Remove invalid (transfer) annnotations
This tripped a new g-i warning; see
https://bugzilla.gnome.org/show_bug.cgi?id=752047
2015-09-27 16:42:01 -04:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02: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
0a9511b24b window: 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
Jonas Ådahl
14b0a83f64 Don't calculate the main window monitor every time it`s needed
The main monitor of a window is maintained as 'window->monitor' and is
updated when the window is resized or moved. Lets avoid calculating it
every time it`s needed.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jasper St. Pierre
4d3419607a window: Don't reference a dead function
meta_window_move_resize has been gone for a while now.
2015-07-06 00:52:49 -07:00
Jasper St. Pierre
9f04c58ffe Implement a generic "size change" mechanism
A much less hacky version of maximize / unmaximize is reimplemented
in terms of this, but it could also eventually be used for fullscreen /
unfullscreen, and tile / untile.
2015-07-05 23:03:36 -07:00
Jasper St. Pierre
8979e52a6c Install enum types 2015-07-05 22:01:59 -07:00
Jasper St. Pierre
91b7dedf36 Remove the ability to grab resize unmaximize
This is an extremely niche feature, and conflicts with the rest of our
interface being consistent about not allowing resizing while tiled or
maximized.
2015-07-01 16:27:19 -07:00
Jasper St. Pierre
d74b0d5be8 window: Clear the frame borders before calculating the unfullscreen rect
Going from fullscreen to unfullscreen involves a frame border size, so
in order to properly interpret the saved rect size, we need to make sure
that the frame borders are fully up to date.
2015-06-23 17:05:27 -07:00
Ting-Wei Lan
6b82f61dba build: Fix non-wayland build
This fixes error introduced in 09120132ef.

https://bugzilla.gnome.org/show_bug.cgi?id=750552
2015-06-23 16:37:40 -07:00
Carlos Garnacho
09120132ef core: Refrain from showing wayland windows when we don't have a buffer yet
The "calc showing" operation is queued in a few places alongside MetaWindow
creation, we should be ignoring these until there is a buffer to show.

https://bugzilla.gnome.org/show_bug.cgi?id=750552
2015-06-16 20:35:25 +02:00
Jasper St. Pierre
9f13033f15 window-wayland.[ch] => meta-window-wayland.[ch]
This finishes off the meta- prefix for wayland/.
2015-04-27 18:09:16 -07:00
Jasper St. Pierre
4fc684b2ed window: Don't use C++-style comments 2015-03-14 16:03:44 -07:00
Jasper St. Pierre
0bc6cb2aeb window: Remove the legacy get_outer_rect
It's unused in gnome-shell, and we don't care about compatibility in the
API. Don't expose it.
2015-03-08 20:38:30 -07: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
d561b3b18f frames: Clutterify frame event handling
This lets us remove our horrible X11-based, GDK-based hacky frame event
handling in favor of a more sane one in Clutter.
2015-01-19 21:56:08 -08: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
Rui Matos
0484ef142d MetaWindow: Change icon properties to be of pointer type
Follow up to commit af7f51b992 .

https://bugzilla.gnome.org/show_bug.cgi?id=742824
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
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
f3d30d897f window: Refactor the default image lookup 2014-12-31 20:48:32 -08:00
Jasper St. Pierre
b24cd5ae08 window: Force state changes on maximized / fullscreen 2014-12-15 13:52:40 -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
286a6ada5a window: Make sure size hints are applied in client rect on unfullscreen 2014-11-12 17:53:44 -08:00
Jasper St. Pierre
b3544f8ec1 window: Placate new gcc
It thinks remaining can be used uninitialized. It's wrong, but let's
help it out by initializing the variable.
2014-10-23 16:04:42 -07:00
Carlos Garnacho
8819d9ce66 core: end-of-grab button releases must be consumed by the window
Returning FALSE here gets the button release event propagated to the
client on wayland, which is unexpected after xdg_surface.move/resize()
have been called.

https://bugzilla.gnome.org/show_bug.cgi?id=738888
2014-10-23 16:53:44 +02:00
Florian Müllner
5664c703b7 screen: Always consider monitors with fullscreen windows "in-fullscreen"
Fullscreen windows look weird when they are overlapped by system chrome,
which currently happens when another window is stacked above. We used to
auto-minimize fullscreen windows in that case, which proved to be both
unreliable and unpopular. So instead, keep the system chrome hidden even
when the fullscreen window is not stacked at the top.

https://bugzilla.gnome.org/show_bug.cgi?id=693991
2014-10-14 18:42:38 +02:00
Jasper St. Pierre
166668adc4 window: Remove duplicate case value 2014-10-06 19:39:38 -07:00
Jasper St. Pierre
ec797b055d window: Mark all override-redirect window types as appears-focused 2014-10-06 19:30:12 -07:00
Jasper St. Pierre
993bec37d7 window: Ensure that popup window types propagate their focus appearance
In Wayland, popup window types are not override-redirect, and thus can
steal window focus away from their parent window when clicked on.

This means that we need to make sure their appearance is properly
propagated to the parent windows so the parent windows don't lose their
focus while they're propagated.
2014-10-06 17:01:08 -07:00
Florian Müllner
482a97466d window: Fix typo 2014-09-27 07:41:10 +02:00
Florian Müllner
4e14bb9df3 window: Fix corner case in set_demands_attention()
We only grant requests to set the demands-attention hint if the window
is at least partially obscured; so for non-minimized windows on the
active workspace, we check if any other window on the same workspace
that is higher in the stack overlaps.
However in the case of a sticky window, window->workspace is NULL, so
we end up considering any non-sticky window on a different workspace.

At this point we have already established that the window is showing
on the active workspace, so use that to filter for windows that may
overlap.
2014-09-27 06:43:16 +02:00
Florian Müllner
df90545258 window: Fix crash when mapping sticky window
Since the introduction of set_workspace_state(), window->workspace
will always be NULL when on_all_workspaces is set - passing that
to a workspace function that does not validate its input will then
result in a crash.
Use the get_workspace() function instead, which will always return
a valid workspace.
2014-09-27 06:41:35 +02:00
Florian Müllner
d06b39d13c window: Fix another case of uninitialized workspace state
Since commit 2eec11b445, windows without a __NET_WM_DESKTOP property
that should be on all workspaces are not added to the active workspace;
this is correct, however not adding them to any workspace is not ...
2014-09-26 11:48:11 +01:00
Florian Müllner
1e1ca47ec1 window: Always set workspace state while constructing
set_workspace_state () returns early when the desired sticky state
and workspace match the current property values, assuming that the
corresponding MRU lists are already correct in that case.
However that might not be the case when we are setting the initial
state, so don't take the shortcut in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=737178
2014-09-25 15:16:09 +01:00
Florian Müllner
2eec11b445 window: Be more careful when setting initial workspace state
A window may either be sticky because it has been requested as such,
or because it is placed on a non-primary monitor (and the corresponding
preference is set). While we do take the latter into account, we
currently override the sticky state later during initialization;
be a bit more careful there to get the initial state right.

https://bugzilla.gnome.org/show_bug.cgi?id=737178
2014-09-25 15:16:09 +01:00
Florian Müllner
73ca0efaeb window: Fix titlebar_is_onscreen() test
The titlebar rect is in window coordinates, while screen regions are
obviously not. Fix by translating into screen coordinates before
testing for overlaps.

https://bugzilla.gnome.org/show_bug.cgi?id=736915
2014-09-22 20:12:08 +02:00