1
0
Fork 0
Commit graph

1911 commits

Author SHA1 Message Date
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
Jonas Ådahl
e1b10769e5 screen: Remove unused function
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
0249993377 keybindings: Remove #if 0'd code
There's no reason to keep this ~15 year old piece of code around as
well as the preference handling that would only make sense if this
hunk was actually enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=746642
2016-11-23 18:40:05 +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
Rui Matos
d829fa19d2 keybindings: Factor out a function to determine XIGrabModifiers
This de-dups code and reduces the amount of protocol round trips.

https://bugzilla.gnome.org/show_bug.cgi?id=746642
2016-11-21 15:34:43 +01:00
Jonas Ådahl
2ed7ca5b6a constraints: Don't early out of custom rule if window can't fit
Still go through the rules. For example a tall menu might still be
positioned better, and/or shrunk to a better size if applicable.

https://bugzilla.gnome.org/show_bug.cgi?id=771297
2016-11-21 12:52:13 +08:00
Carlos Garnacho
1831a1dd9b core: Handle special actions associated to pad buttons in generic code
And remove the wayland-specific handling. This works for both Wayland and
X11 (provided the compositor receives pad events through a passive grab
there).

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
30fa764c90 core: Ensure there is an unique pad OSD actor
We kind of rely on the ::show-pad-osd handler to destroy the
previous actor. Just prevent the emission of multiple signals
till the actor has been destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=771067
2016-11-04 15:57:35 +01:00
Rui Matos
bfb46ff850 stack: Stack docks below other windows on fullscreen monitors
Commit fcc7501eb8 had the side-effect of
stacking fullscreen windows below docks which went unnoticed since we
don't use docks in GNOME anymore.

Instead of re-introducing the fullscreen layer, which we don't need
otherwise, we can fix this issue by ensuring we stack docks below all
other windows when the monitor they're on is marked fullscreen. This
has the added benefit that the visibility rule for 3rd party docks
becomes the same as gnome-shell's chrome.

https://bugzilla.gnome.org/show_bug.cgi?id=772937
2016-11-02 14:07:10 +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
Jonas Ådahl
8b0e9706ca constraints: Use ConstraintInfo window size when placing
The frame rect will at this point not be set for Wayland popups, since
the popup is placed and constrained before the actual buffer will be
attached. To still be able to calculate a proper monitor to be used for
constraining, use the ConstraintInfo::current dimensions instead, since
they will have the expected size. This should not cause any issues with
present paths since when a window is otherwise placed, it usually
doesn't change monitor calculation result.

This fixes opening a popup menu that would be positioned on the left
edge of a not-left-most monitor, for example a 'File' menu on a window
maximized on a second monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=773141
2016-10-19 15:14:23 +08:00
Landry MINOZA
ed52e17886 delete: Swap wait/force-quit actions
The order doesn't only affect the visual layout, but also which action
cancels the dialog (and therefore responds to Escape). It is completely
surprising that this triggers a destructive action like force-quit, so
swap the actions to wait when the dialog is cancelled.

https://bugzilla.gnome.org/show_bug.cgi?id=737109
2016-10-11 00:54:25 +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
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
e5a359a032 wayland: Make seat devices GObjects
This will make it possible to add signals and other GObject features.

https://bugzilla.gnome.org/show_bug.cgi?id=771050
2016-09-09 10:09:46 +08: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
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
Carlos Garnacho
76595af8af core: Add special case for the pad OSD in event handling
When it's active, we want wayland to stop handling (most notably key)
events.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
21c8911254 core: Add meta_display_request_pad_osd() function
There may be external/compositor-specific reasons to trigger the
pad OSD. Expose this call so the pad OSD can be triggered looking
up the right settings, monitor, etc...
2016-07-22 13:31:09 +02:00
Carlos Garnacho
35554555e0 core: Add MetaDisplay:show-pad-osd signal
This is intended to be caught in the gnome-shell code, in order to
show the OSD with the pad action mapping.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
6f7f98540f core: Add public MetaDisplay functions to get action labels for pad buttons
This API will be used from the gnome-shell pad OSD implementation, in order
to show the actions that currently apply to every button/ring/strip in the
tablet.
2016-07-22 13:31:09 +02:00
Jouke Witteveen
4ed59a020d Throw an error in case of unsupported session type
When launching a GNOME session from a text-mode VT, the logind session
type is unlikely to be set to either "wayland" or "x11". We search for a
supported session type first with logind and then with
$XDG_SESSION_TYPE. As a fallback, we also test $DISPLAY in case of a
"tty" logind session to support starting through xinit. Ideally, such
setups should set XDG_SESSION_TYPE=x11.
If no supported session type is found, we throw an error.

https://bugzilla.gnome.org/show_bug.cgi?id=759388
2016-07-22 10:52:04 +08:00
Jonas Ådahl
ad7ec6b979 main: Fix compilation with wayland disabled
https://bugzilla.gnome.org/show_bug.cgi?id=769024
2016-07-21 20:34:28 +08:00
Rui Matos
daf5a112fb meta/boxes: typedef cairo_rectangle_int_t MetaRectangle
They are already effectively interchangeable so this should reduce
pointless casts.

Just like in GDK though, we need to keep the old definition for
instrospection to be able to include the struct's fields.
2016-07-20 14:11:25 +02:00
Jonas Ådahl
a75e2ace82 Revert "main: Add --x11 command line argument"
This reverts commit feb4c36659.
2016-07-20 17:45:18 +08:00
Jonas Ådahl
566c28bdaf Introduce regional stage rendering
Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
feb4c36659 main: Add --x11 command line argument
Make it possible to force mutter to start as a X11 compositing/window
manager. This is needed when intending to start mutter as an X11 window
manager while running inside a Wayland session, for example when
intending to debug it in Xephyr.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +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
Jonas Ådahl
90de521799 Make mutter manage its own clutter backends
Introduce two new clutter backends: MetaClutterBackendX11 and
MetaClutterBackendNative. They are so far only wrap ClutterBackendX11
and ClutterBackendEglNative respectively, but the aim is to move things
from the original clutter backends when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +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
Luca Bruno
c325a0bebf Fix string format in startup notification to be a gint64
https://bugzilla.gnome.org/show_bug.cgi?id=762407
2016-07-04 22:34:31 +02:00
Owen W. Taylor
b112d98278 Improve handling of tracking the old focused window during restart
When restarting (X compositor only, obviously), we want to keep
the same window focused. There is code that tries to do this by
calling XGetInputFocus() but the previously focused window will
almost certainly not still be focused by the time we get to the
point where we call XGetInputFocus(), and in fact, probably was
no longer correct after the previous window manager exited, so
the net result is that we tend to focus no window on restart.

A better approach is to leave the _NET_ACTIVE_WINDOW property
set on the root window during exit, and if we find it set when
starting, use that to initialize focus.

https://bugzilla.gnome.org/show_bug.cgi?id=766243
2016-06-29 10:22:55 -04:00
Rui Matos
7f6bcea331 compositor: Handle GL video memory purged errors
Emit a signal so that interested parties can recreate their FBOs and
queue a full scene graph redraw to ensure we don't end up showing
graphical artifacts.

This relies on the GL driver supporting the
NV_robustness_video_memory_purge extension and cogl creating a
suitable GL context. For now we only make use of it with the X backend
since the only driver with which this is useful is NVIDIA.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:50 +02:00
Rui Matos
7ed14e0ee8 restart: Make meta_restart() work without a message
In some cases there's no meaningful message to show.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:49 +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
Rui Matos
bbb83d4cd0 stack: Don't add wayland windows to _NET_CLIENT_LIST
Window->xwindow is None (i.e. 0) for wayland windows and there's no
point in adding them to these X specific properties.

https://bugzilla.gnome.org/show_bug.cgi?id=764844
2016-05-12 20:06:20 +02:00
Rui Matos
c5637c52bd stack: Stack both wayland and X hidden windows below the guard window
Stacking hidden X windows below the guard window is a necessity to
ensure input events aren't delivered to them. Wayland windows don't
need this because the decision to send them input events is done by us
looking at the clutter scene graph.

But, since we don't stack hidden wayland windows along with their X
siblings we lose their relative stack positions while hidden. As
there's no ill side effect to re-stacking hidden wayland windows below
the X guard window we can fix this by just doing it regardless of
window type.

https://bugzilla.gnome.org/show_bug.cgi?id=764844
2016-05-12 20:06:19 +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
Rui Matos
e160babe3f keybindings: Avoid using unitialized memory and grabbing random keys
meta_parse_accelerator() considers 0 length accelerator strings as
valid, meaning that the keybinding should be disabled. Unfortunately,
it doesn't initialize the MetaKeyCombo so if the caller doesn't
initialize it either, we end up using random values and possibly
grabbing random keys.

https://bugzilla.gnome.org/show_bug.cgi?id=766270
2016-05-12 20:06:02 +02:00
Victor Toso
f8eb05ca6d core: fix build without wayland
introduced by 806f930a16

https://bugzilla.gnome.org/show_bug.cgi?id=766306
2016-05-12 09:33:26 +02:00