1
0
Fork 0
Commit graph

2189 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
df7d8e2cbf Use free_full on GList's instead of foreach + free
GList's used in legacy code were free'd using a g_list_foreach + g_list_free,
while we can just use g_list_free_full as per GLib 2.28.

So replace code where we were using this legacy codepath.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
2019-05-15 14:42:25 -05:00
Daniel van Vugt
7738b5c00b core/window: Fix copy/paste error in size-changed docs
It appears it was copied from MetaWindow::position-changed and pasted
for MetaWindow::size-changed, without updating all the words.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/567
2019-05-08 09:28:16 +00:00
Carlos Garnacho
bf8bc65cc9 core: Check environment variables before giving to GAppLaunchContext
Depending on the type of session, one or the other might be NULL, which
is not meant to be handled by these functions. Check for both DISPLAY
envvars before setting them on the GAppLaunchContext.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/586
2019-05-06 17:27:56 +02:00
Jonas Dreßler
0d50a37091 display: Fix a possible bug in meta_display_sync_wayland_focus
The check for the focus xwindow is called, but not used. Fix that by
renaming the variable to reflect better what it does and actually using
the return value of the check.

This was the original intention of the author in commit
05899596d1 and got broken in commit
8e7e1eeef5.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/535
2019-05-02 23:54:22 +00:00
Marco Trevisan (Treviño)
ee4bb2240b workspace: Activate a window also if it's already in workspace
meta_workspace_activate_with_focus is supposed to focus the passed window after
switching the workspace.

However if the passed workspace is already the active one, we just return
without activating the window.
So fix this calling meta_window_activate on the foucs_this window if that is
valid.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/562
2019-05-02 17:33:17 -05:00
Carlos Garnacho
02c99524bf Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public
This exposes the base so that we can reimplement StClipboard on top. Some
gtk-docs have been added for documentation and introspection purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:31:45 +02:00
Carlos Garnacho
5c009c20ab core: Add clipboard manager
This is a simple clipboard manager implementation on top of MetaSelection.
It will inspect the clipboard content for UTF-8 text and image data whenever
any other selection source claims ownership, and claim it for itself
whenever the clipboard goes unowned.

The stored text has a maximum size of 4MB and images 200MB, to prevent the
compositor from allocating indefinite amounts of memory.

This is not quite a X11 clipboard manager, but also works there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:45 +02:00
Carlos Garnacho
535ce00abb core: Add memory-based selection source
This is a simple implementation of a MetaSelectionSource, able to hold a
single mimetype, provided as GBytes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:45 +02:00
Carlos Garnacho
ab76576340 core: Set up MetaSelection on MetaDisplay
https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
Carlos Garnacho
a984622cd1 core: Add MetaSelection and MetaSelectionSource
MetaSelectionSource represents a primary/clipboard/dnd selection owner,
it is an abstract type so wayland/x11/etc implementations can be provided.
These 3 selections are managed by the MetaSelection object, the current
selection owners will be set there, and signals will be emitted so the
previous selection owner can clean itself up.

The actual data transfer is done through the meta_selection_transfer_async()
call, which will take a GOutputStream and create a corresponding
GInputStream from the MetaSelectionSource in order to splice them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
Ray Strode
502da973eb window: free close dialog before unmanaging window from compositor
When an application stops responding, the shell darkens its windows.

If a window from a not-responding application gets unmanaged
then the shell will currently throw an exception trying to retrieve
the now-dissociated window actor.

That leads to a "stuck window" ghost on screen and a traceback
in the log.

This commit addresses the problem by making sure the effect is cleaned
up before the actor is disocciated from its window.

https://gitlab.gnome.org/GNOME/mutter/issues/575
2019-04-29 14:06:12 -04:00
Olivier Fourdan
d2ca5cc26b display: Fix inconsistent behavior with demand attention
When focus stealing prevention kicks in, mutter would set the demand
attention flag on the window.

Focus stealing prevention would also prevent the window from being
raised and focused, which is expected as its precisely its purpose.

Yet, when that occurs, the user expects the window which has just been
prevented from being focused to be the next one in the MRU list, so
that pressing [Alt]-[Tab] would raise and give focus to that window.

This works fine when the window is placed on the primary monitor, but
not when placed on another monitor, in which case the window which has
been denied focus is placed ahead of the MRU list and pressing
[Alt]-[Tab] would leave the focus on the current window.

This is because of a mechanism in `meta_display_get_tab_list()` which
forces the windows with the demand attention flag set to be placed first
in the MRU list when they're placed on a workspace different from the
current one.

But because workspaces apply only to the primary monitor (by default),
the windows placed on other outputs have their workspace set to `NULL`
which forces them ahead of the MRU list by mistake.

Fix this by using the appropriate `meta_window_located_on_workspace()
function to check if the window is on another workspace.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/523
2019-04-17 18:53:04 +02:00
Carlos Garnacho
3de6f7ebfe core: Emit MetaStartupNotification::changed on sequence completion
This way handlers that want to know the get_complete() status will be able
to do so without further delays.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:09 +02:00
Carlos Garnacho
38ff01d6d0 core: Add MetaStartupSequence::complete signal
It was a vfunc so far, but we want things subscribing to it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:04 +02:00
Carlos Garnacho
40103d6f41 core: Account for completed sequences in feedback updates
The sequences may stay completed in the list (eg. pending a focus request),
it's then confusing to show the "wait" cursor icon until they are really
gone.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:00 +02:00
Carlos Garnacho
ab7ef5f8bf core: Fix differing sequence timestamp precision expectations
Calculations were being done at places accounting on usec precision,
however those are still treated as having msec precision at places. Let's
consolidate for the latter since it requires less changes across the board
and usec precision doesn't buy us anything here.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:41:13 +02:00
Jonas Dreßler
6ec330ccfa keybindings: Stop keybinding if a touch happens while Super is pressed
We use the combination of pressing Super and clicking+moving the mouse
to drag windows around and we also support pressing Super and using the
touchscreen to drag windows.

Since we don't want to show the overview when the Super key was used to
initiate a window drag, prevent showing the overview in case a
TOUCH_BEGIN or TOUCH_END event happened during the key was pressed.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/228

https://gitlab.gnome.org/GNOME/mutter/merge_requests/495
2019-04-15 11:10:47 +00:00
Daniel van Vugt
9d49e8abd0 launch-context: Swap reversed timestamp/workspace
The parameters had been mixed up for X11 sessions.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/505
2019-04-01 10:34:51 +00:00
Carlos Garnacho
f0b9654deb core: Remove startup sequences after timeout
The complete/remove semantics were split to cater for presenting windows,
so we must now separately do both here.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/501
2019-03-18 18:06:01 +00:00
Jonas Ådahl
00b4556051 constraints: Don't use intersection when sliding with custom rule
If an intersection is empty, the (x, y) coordinates are undefined, so
just use the work area and in-progress constrained window rect when
sliding according to the SLIDE_X or SLIDE_Y custom placement rule.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
86b5247770 constraints: Only get parent rect once when placement rule constraining
We got it in a switch case, then again when finalizing. Only get it once
instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
23f31e518e constraints: Only readjust placement constraint when not checking
When check_only is TRUE, the constraint should not be applied, just
checked. We failed to comply here when a placed transient window was
to be moved together with its parent, updating the window position
directly even if check_only was TRUE.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
f580b28a27 window: Replace placement constrained bool with state
Using an actual state instead of a boolean makes it clearer it's a state
that changes. Eventually we might add more state too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
b4f1569640 window: Unmanage rule placed window if ending up outside of parent
If a client maps a persistent popup with a placement rule, then resizes
the parent window so that the popup ends up outside of the parent,
unmanage the popup and log a warning about the client being buggy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
f2d7165a52 window: Don't try to move hidden attached windows
When a parent window is moved, attached windows (attached modal dialogs
or popups) is moved with it. This is problematic when such a window
hasn't been shown yet (e.g. a popup that has been configured but not
shown), as it'll mean we try to constrain an empty window. Avoid this
issue by not trying to auto-move empty windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Jonas Ådahl
5d1eccfb6f boxes: Fix spelling in API
Change adjecent to adjacent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Pablo Barciela
318164779c boxes: Actually check for rectangle containment
Fixes condition duplicated:

          /* If a contains b, just remove b */
          if (meta_rectangle_contains_rect (a, b))
            {
              delete_me = other;
            }
          /* If b contains a, just remove a */
          else if (meta_rectangle_contains_rect (a, b))
            {
              delete_me = compare;
            }

Closes https://gitlab.gnome.org/GNOME/mutter/issues/480
2019-03-12 05:03:53 +01:00
Florian Müllner
7bd33e7b00 frame: Remove flashing support
It's now unused.

https://gitlab.gnome.org/GNOME/mutter/issues/491
2019-03-12 00:27:07 +00:00
Florian Müllner
f8d62da2dc bell: Always flash window instead of frame
Traditionally visual alerts were implemented by flashing the focus
window's frame. As that only works for windows that we decorate,
flashing the whole window was added as a fallback for client-decorated
windows.

However that introduces some confusing inconsistency, better to just
always flash the entire window.

https://gitlab.gnome.org/GNOME/mutter/issues/491
2019-03-12 00:27:07 +00:00
Benjamin Berg
80ceeb2848 keybindings: Fix theoretical memory leak while ungrabbing
In the unlikely event that one tries to ungrab an action which does not
exist, a small leak could occur. Fix this by using g_autofree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/478
2019-03-11 23:39:25 +00:00
Florian Müllner
1574099449 prefs: Change default of show-fallback-app-menu
The app menu always was a GNOME-only thing, so after it was removed this
cycle, assuming that it is not displayed by the environment is a better
default.

https://gitlab.gnome.org/GNOME/mutter/issues/493
2019-03-11 23:30:10 +00:00
Andrea Azzarone
8856a396fd sound-player: Don't deadlock in finish_cb
The function finish_cb can be called as a result of a call to ca_context_cancel
in cancelled_cb. This will result in a deadlock because, as per documentation,
g_cancellable_disconnect cannot be called inside the cancellable handler.

It is possible to detect if the call to finish_cb is caused by ca_context_cancel
checking if error_code == CA_ERROR_CANCELED. To avoid the deadlock we should
call g_signal_handler_disconnect instead g_cancellable_disconnect if this is the
case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/474
2019-03-05 12:07:41 +00:00
Florian Müllner
7abceb434d x11-display: Split out restoring of active workspace
Splitting out the X11 display initialization from display_open() broke
restoring the previously active workspace in two ways:

 - when dynamic workspaces are used, the old workspaces haven't
   been restored yet, so we stay on the first workspace

 - when static workspaces are used, the code tries to access
   the compositor that hasn't been initialized yet, resulting
   in a segfault

Fix both those issues by splitting out restoring of the active workspace.

https://gitlab.gnome.org/GNOME/mutter/issues/479
2019-03-04 19:42:00 +00:00
Marco Trevisan (Treviño)
8b09542fd9 boxes: Crop rectangle converting to integer with grow strategy
Reuse meta_rectangle_from_clutter_rect with growing strategy to properly cast
the clutter floating rectangle to integer MetaRectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
Marco Trevisan (Treviño)
a8c972cd6b boxes: Add function to create a rectangle from floating clutter rect
Meta rectangles are integer based while clutter works in floating coordinates,
so when converting to integers we need a strategy.

Implement the shrink strategy by ceiling the coordinates and flooring the width,
and the grow strategy reusing clutter facility for this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:07 +01:00
Marco Trevisan (Treviño)
7442de81bb display: Add meta_display_get_monitor_scale
This will return the monitor scaling for the requested logical screen

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:46:49 +00:00
Niels De Graef
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
Andrea Azzarone
1c2e8fcf06 keybinding: Store flags in MetaKeyGrab
The external grab handler is shared across all external bindings and external
bindings have now different binding flags. For this reason, when rebuilding the
binding table there could be loss of information if we assign the bindings flags
of the external handler to all external bindings. Let's store the bindings flags
in MetaKeyGrab too and use this when rebuilding the binding table to avoid the
above issue.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169
2019-02-20 14:36:24 +00:00
Andrea Azzarone
00ca387ec7 keybindings: Add flag param to grab_accelerator
Add a 'flags' parameters to meta_display_grab_accelerator. This will allow
e.g. gnome-settings-daemon (through the gnome-shell's GrabAccelerator API) to
create shorcuts that should descard auto-repeated key events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169

Closes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68
2019-02-20 14:36:24 +00:00
Olivier Fourdan
7bd668e6d0 window: Do not restore shortcuts on a NULL window
The "force restore shortcuts" being triggered by a key-combo, there is
no guarantee that the currently focused window is actually non-NULL in
which case we would crash.

Make sure there is a window currently focused before trying to restore
the shortcuts on that window.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/464
2019-02-18 11:23:59 +01:00
Marco Trevisan (Treviño)
58d2a674c4 window: Return focusable ability looking at properties only
As per commit 43633d6b, we mark an unmanaging window as not focusable, while
this is true, it might cause not resetting the current focused window when
unmanaging it causing a crash.

Also this wouldn't allow to check if a window can be focused when unmanaging it,
so let's revert the previous behavior.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/462
2019-02-14 13:49:51 +01:00
Marco Trevisan (Treviño)
f798912cbd window: Move can_ping to a function and implement in X11
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
Marco Trevisan (Treviño)
3bf80a967c window-x11: Move delete_window to MetaWindowX11Private
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
Marco Trevisan (Treviño)
6c3b0cfc36 window-x11: Move take_focus to MetaWindowX11Private
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
Marco Trevisan (Treviño)
43633d6b2f window: Add is_focusable class method
Implement is_focusable for both x11 and wayland and just use this check
so that we can abstract things more and be less dependent on window backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
Robert Mader
d574cf59f1 boxes: Add API to crop and scale a MetaRectangle
https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
2019-02-06 12:24:02 +00:00
Josh Triplett
b4ae6cdd62 Don't include potentially sensitive window titles in logs
For various error and warning messages, mutter includes a description of
the window, and that description includes a snippet of the title of the
window. Those snippets find their way into system logs, which then means
they can potentially find their way into bug reports and similar. Remove
the window title information to eliminate this potential privacy issue.
2019-02-03 06:32:14 +01:00
Florian Müllner
de76074336 ui: Remove fallback app menu
The app menu is in the process of being retired[0], and the shell
stopped displaying it while applications are in the process of
dropping it. It therefore doesn't make sense to always show a
fallback menu in server-side decorations, applications that still
set the menu can rely on GTK+'s own fallback instead.

[0] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-01-30 18:39:42 +00:00
Florian Müllner
d5a7bbd094 Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
Iain Lane
2e53ce8e75
meta, startup-notification: Make type declarations public
Shell is using these, which was revealed by
1bbb5c8107 breaking its build when
generating its introspection due to meta_startup_notification_get_type()
not being found.

We keep the class structs private, so in practice MetaStartupSequence
and MetaBackend can't be derived from (the are semi-private).
2019-01-24 16:38:09 +00:00