Commit Graph

2770 Commits

Author SHA1 Message Date
Jonas Dreßler
0b9b13942a st/scroll-view: Only update fade effect on CSS changes if CSS sets it
The fade effect can also be added to the scroll view programatically
instead of using CSS via the st_scroll_view_update_fade_effect() API.

We make use of this API in the appDisplay, but since commit ba547ec1d
the fade margins get overridden to 0.0 from the ::style-changed handler.
Fix this by only setting the fade margins when CSS actually defines a
custom vfade/hfade offset.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5079
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2189>
2022-02-16 20:15:28 +00:00
Jonas Dreßler
ba547ec1db st/widget: Emit "style-changed" on all theme changes
Since now the resource consumption of the "style-changed" signal
handlers should be significantly lower, we can start emitting the signal
in all cases again as it was originally intended. This fixes some small
visual issues, like the battery percentage in the panel only being shown
on hover or updating the size of StIcons on scale-factor changes.

This effectively reverts f74c07b9ac

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1708

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2099>
2022-02-14 13:50:03 +00:00
Jonas Dreßler
09903b6426 st/label: Compare shadow spec before invalidating shadow on style change
Just like with the last commit for StEntry, check whether the text
shadow actually changed before invalidating the pipeline on style
changes of StLabel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
ba774e1fa2 st/entry: Compare shadow spec before invalidating shadow on style change
Instead of doing a lot of useless work every time we receive the
style-changed signal, only invalidate our text shadow pipeline in case
the shadow actually changed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
3b4a1fcd51 st/shadow: Add a fast path to comparisons
We do this in most places in St, it's consistent to do it here, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
8b3e1e01f6 st/label: Invalidate text shadow on style changes to ClutterText
Just like with the last commit, listen to some ClutterText property
changes to catch style changes that were trigerred by
_st_set_text_from_style() and invalidate the shadow spec on changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
898334f31d st/entry: Invalidate text shadow on style changes to ClutterText
We update a few properties of ClutterText when the CSS changes via
_st_set_text_from_style() (which we call when receiving the
style-changed signal).

Right now we simply invalidate the text shadow every time we receive the
style-changed signal, but we're going to change that with the next
commits. To ensure the shadow still gets invalidated on CSS changed that
might affect the shadow, listen to a bunch of property changes that will
get notified when any property that affects the shadow changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
2bb36db9e8 st/entry: Invalidate shadow on cursor position/size changes
When text shadows are used, the cursor indicating the current position
also casts a shadow.

This means we have to regenerate the shadow texture after the cursor
position changed, so invalidate the shadow in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Carlos Garnacho
57d681863a shell: Shuffle ifdef to fix !HAVE_SYSTEMD build
The internal SystemdFlags enum is used from common code for
both systemd availability cases. Shuffle it outside the ifdef
so it's seen everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2177>
2022-02-13 12:06:11 +00:00
Carlos Garnacho
352c9695f3 shell: Add call to check the existence of a systemd unit
These checks will be handy while handling ibus-daemon startup, since
this is going to move to a systemd service soon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>
2022-02-11 23:51:24 +00:00
Carlos Garnacho
adc58ea743 shell: Refactor internal calls to systemd service
Add some parameters to make these calls useful beyond starting
and stopping units. We will need to query the existence of units
for starters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>
2022-02-11 23:51:24 +00:00
Florian Müllner
9a2505f18c shell: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate
Like we did in ST, opt out of g_object_set()'s implicit change
notifications, so that notify is only emitted when a property
*actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
17719352f3 shell: Use g_object_notify_by_pspec() where possible
It's slightly more efficient not having to do property lookups. While
that is unlikely to be a concern for the properties in question, it's
still good practice and makes the code base a bit more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
e3a3f79200 shell/app: Remove unused property ID
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
5a23c96bd9 st: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate
We are now consistently calling notify() when a property does change.

With that we can opt out of g_object_set()'s implicit change notifications,
so that notify is only emitted when a property *actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
bfb52aaf9d st: Use g_object_notify_by_pspec() where possible
It's slightly more efficient not having to do property lookups. While
that is unlikely to be a concern for the properties in question, it's
still good practice and makes the code base a bit more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
76e5e22dac st: Add static setters
Even where properties can only be set via g_object_set(), separate
setters help with code organization and consistency with other
properties.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
6a6b7eb341 st/scroll-view: Add missing notify call
Another property where changes aren't notified when going through
the public setter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
621c8606df st/entry: Add missing notify calls
Whoops, at the moment changes of most properties are only notified
when going through g_object_set() and not when using the public
setters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Sebastian Wick
170f3ee089 glsl-effect: Allow to set uniform matrices
Add support for setting a uniform matrix on GLSLEffect because the color
vision deficiency simulation extension requires it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2164>
2022-02-08 21:55:31 +01:00
Olivier Fourdan
5b8a32ca71 main: Raise the NOFILE limit if a Wayland compositor
When being run as a Wayland compositor, raise the NOFILE limit to
mitigate the risk of running out of file descriptors.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Olivier Fourdan
9862ee9b25 shell/app: Restore NOFILE limit
Restore the nofile limit when launching apps so that they do not
inherit from the Shell's own limit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Olivier Fourdan
1bb05c33be shell: Restore NOFILE limit before restarting
When restarting Shell, make sure to restore the original nofile limit so
that the new instance starts with the original value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Sam Hewitt
0e3ddb1f02 theme: Remove icon resources from theme
- move all icons to the icons directory
- rename some icons to be more meaningful
- put all icons on a resource sheet
- update references to icon name changes
- deprecate icons for those in standard set

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2141>
2022-02-04 13:59:20 +00:00
Milan Crha
42b3b85460 calendar-server: Read timezone from the calendar, not its timezone cache
The calendar's timezone cache holds only timezones already received
or added to the calendar, thus when asking it for a timezone for "the first
time", it returns NULL and a wrong timezone is used instead.
The get_timezone() does not do any I/O when the timezone is already cached
on the client side, thus it's fine to use it.

This could exhibit with non-recurring events, which use custom time zones,
in which case the event is shown in a wrong time.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2145>
2022-02-03 17:18:48 +00:00
Florian Müllner
c85643d9d5 st/settings: Switch icon-theme when "high-contrast" is active
This is in line with how GTK handles the setting. Since we are not
using GtkSettings for the icon theme, we have to replicate the
behavior ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2069>
2022-02-01 14:11:07 +00:00
Alexander Mikhaylenko
f67418c682 st/settings: Use the new high-contrast gsettings key
We now have a dedicated "high-contrast" setting that we can
use instead of a "magic" theme name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2069>
2022-02-01 14:11:07 +00:00
Carlos Garnacho
643e8aec5f shell: Drop shell_global_begin/end_modal()
These are no longer used nor necessary, we now use have ClutterGrab()
which notify the internals about the changes in event handling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2046>
2022-01-29 02:19:14 +01:00
Carlos Garnacho
a8a9d4f806 st: Use ClutterGrab for StScrollBar implicit grab
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:29 +01:00
Carlos Garnacho
bcfcacdb56 st: Use ClutterGrab for StButton implicit grab
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:29 +01:00
Ivan Molodetskikh
27bcf0da48 screenshot-ui: Use ImageContent for notification icon
StImageContent specifically, when used as a notification icon, preserves
the screenshot aspect ratio and avoids ugly scaling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
941774b786 screenshot-ui: Add cursor capturing option
The cursor texture, scale and position is captured separately and
overlaid on top of the preview, and on top of the final screenshot
image. This allows toggling it on and off post-factum.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
deb614a031 screenshot: Add API to screenshot stage to a ClutterContent
As mentioned in the last commit, we'll split up taking screenshots into
creating a GPU texture first, and later saving that to disk as a PNG.

For individual windows it's already easy to get a ClutterContent with
the texture using meta_window_actor_paint_to_content (), for the stage
it's not that easy and involves a few extra steps including X11 specific
ones.

So introduce a new ShellScreenshot API which does all that and provides
the caller with a ClutterContent of the stage:
shell_screenshot_screenshot_stage_to_content ()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
71c6918588 screenshot: Add API to get PNG stream from a texture
With the new screenshot UI we're introducing, we'll be capturing all
screenshots to textures on the GPU at first, and then create a PNG
stream from those textures at a later point. This will allow us to
present screenshots immediately to the user so they can inspect them and
select the right area before actually saving them to disk.

As a first step to make this work, introduce a new ShellScreenshot API
that writes an existing CoglTexture to a PNG output stream:
shell_screenshot_composite_to_stream ()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Florian Müllner
f9037f5889 shell/app: Do not try to activate OR windows
Since https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029,
we track all windows, including OR ones. While this means that we can
now assume that any window can be matched to an app, it also means
we have to be more careful to not perform an unsupported action like
focus or raise on an OR window.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4973

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2131>
2022-01-27 14:30:49 +01:00
Florian Müllner
88a8bc7419 st/box-layout: Deprecate :pack-start property
A property for reversing the visible order of children is a bit odd.

It has also been unused by actual gnome-shell code since 2010, and the
somewhat related pack_start()/pack_end() API in GtkBox(Layout) is gone
in GTK4.

With that in mind, turn the property into a no-op and deprecate it,
so that it can be dropped next cycle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2085>
2022-01-07 21:47:47 +00:00
Nate Graham
a13b2358a9 shell/app: Honor XDG SingleMainWindow key
This is the upstreamed version of X-GNOME-SingleWindow which is now a
part of the XDG desktop file spec as of version 1.5; see
https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/53

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2084>
2022-01-05 18:14:09 +00:00
Florian Müllner
65450a836e build: Drop incorrect positional arg
Unlike other targets that take a name, i18n.merge_file() does not.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2078>
2021-12-23 18:43:25 +00:00
Florian Müllner
daf729de11 build: Replace deprecated meson functions
Replace deprecated functions with their direct replacements:

 - dep.get_pkgconfig_variable() → dep.get_variable()
 - prg.path() → prg.full_path()
 - source/build_root() → project_source/build_root()

In one case we need meson.global_source_root() that was only
added in meson 0.58, so bump the requirement to that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2077>
2021-12-23 15:52:21 +00:00
Florian Müllner
331454a757 shell/app: Re-order running-state cleanup
Since commit 1807be1, we clear the fallback icon when a window is
removed, and notify the icon change. The notify call currently
happens after removing the window from the running state, but
before syncing the state (and possibly clear the running state
altogether).

That state is inconsistent and results in an assertion hit when
some code tries to re-fetch the icon in response to the notify
call.

Address this by updating the state before clearing the fallback
icon, so that the app will be in the correct STOPPED state after
removing the last window.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4888

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2073>
2021-12-22 01:55:05 +01:00
Sebastian Keller
7e0c6dc2c1 st/scroll-view-fade: Simplify shader a bit
The shader was using too many ALU instructions for Intel 945GM hardware,
so simplify it a bit. The resulting math is the same, but a few
redundant operations have been removed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4883
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2072>
2021-12-21 15:04:01 +00:00
Benjamin Berg
1807be1277 shell/app: Correctly track the window used for the fallback icon
We were not properly tracking the window used for the fallback icon.
This could trigger a crash, as disconnection of the signal handler might
happen on the wrong window, which in turn could cause the icon change
notification to happen on a destroyed ShellApp instance.

Fix this by tracking the window used for the fallback icon. Disconnect
the icon notify callback explicitly for this window only when it is
removed.

Also, just to be extra safe, make sure that the icon is never NULL even
if x11_window_create_fallback_gicon should return NULL for some reason.

Closes: #4436
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2065>
2021-12-21 14:34:38 +00:00
Florian Müllner
54f803dfee shell/window-tracker: Track all initial windows
meta_workspace_list_windows() doesn't include OR windows, so go
through the newly added meta_display_list_all_windows() instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-16 22:56:09 +01:00
Florian Müllner
acee68c5da shell/window-tracker: Track ::window-created
We currently track windows via MetaWorkspace's ::window-added and
::window-removed signals. Those aren't emitted for override-redirect
windows though, as those aren't actually located on any workspace
(see https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-41/src/core/window.c#L1322).

While that shouldn't be an issue as there's no good reason to look up
the ShellApp of an OR window, extensions can make modifications that
result in OR windows ending up in places that assume that every window
has an associated ShellApp.

We can either
 - accept that extensions break stuff (including badly)
 - carefully handle app-less windows everywhere
 - extend tracking to OR windows

Opt for the last option, as that's the most user-friendly and least
disruptive one.

It's also simpler to track ::window-created and ::unmanaged, as we
don't have to track workspaces or windows moving between workspaces.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-16 22:44:35 +01:00
Florian Müllner
f8e531b52d shell/window-tracker: Track windows getting unmanaged
It makes sense to not rely on workspaces' ::window-removed
signal, and we already do that in ShellApp.

However it is odd to remove a tracked window from the app,
but still track it in the window tracker. Move the code
to remove unmanaged windows from both.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-15 19:07:07 +01:00
Florian Müllner
4f91cfb5a6 shell/window-tracker: Do not filter tracked windows by type
The window-type property may change, and with it the skip-taskbar
property that decides whether we consider it "interesting".

As a result we can end up showing untracked window, i.e. one
which does not have an associated app.

Cover this case by simply tracking all windows regardless of
their type. This won't change the app's running state, as that
is solely based on the skip-taskbar property (which is enforced
for all previously excluded window types).

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-15 19:07:07 +01:00
Sebastian Keller
b37fa61eb0 calendar-server: Calculate event end according to spec if missing
The ical specification allows events to omit an end, which for dates
means the end is start + 1 day and for date times it is equal to the
start.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4753
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2023>
2021-11-30 02:13:24 +00:00
Sebastian Keller
72a6450017 calendar-server: Remove the all-day property of events
The way it is currently calculated is broken for days with DST changes
or leap seconds and it is not needed anymore anyway. This will also make
the fix in the following commit simpler.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2023>
2021-11-30 02:13:24 +00:00
Sebastian Keller
bc32a52108 shell/app: Don't move all workspace windows to their startup workspace
Windows from some applications, such as guake, are created as showing on
all workspaces. When these windows are put on the workspaces via
set_workspace_state() during construction, the first time the window is
added to a workspace in the loop triggers the shell app tracker which
then tries to move the window to its startup workspace. This makes the
window unsticky which triggers another set_workspace_state() which
tries to remove the window from all workspaces, but currently it is only
on the first one and then adds it to the startup workspace. Once that is
finished, the first set_workspace_state() continues adding the window
to the remaining workspaces, despite the window now no longer having
on_all_workspaces set to true.

When the window is now unmanaged, the window according to its internal
state is only found on the startup workspace, so it will only be removed
from that. This causes the assertion to fail that checks that the window
is no longer present on any workspace after this.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4720

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2014>
2021-10-30 13:21:17 +02:00
Carlos Garnacho
ff4ff66498 Revert "st: Only use clutter_actor_invalidate_paint_volume() if the API exists"
Since we are past the 40 API change hurdle, it is safe to revert this
commit.

This reverts commit 1cefd589da.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2010>
2021-10-27 19:51:27 +02:00
Ray Strode
ddb6276a49 st/password-entry: Fix crash when DConf changes after StEntry is destroyed
commit 8721c5db37 made StPasswordEntry
honor the 'disable-show-password' setting.

Unfortunately, it introduced a lifecycle bug where the signal handler
for noticing setting changes can out live the entry itself.

This commit fixes the problem by using g_signal_connect_object

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2004>
2021-10-12 15:27:35 -04:00
Marco Trevisan (Treviño)
2bcc6c09ed st/icon: Ensure icons are updated if theme node is invalid
Icons that are changed while an actor is not mapped may not have a theme
node associated with, and thus we'd end up not updating them at all.
In fact we return early in st_update_icon(), and this was not an issue
until commit 0b1dfbf6f3, because we'd end up to update the icon anyways
once the style was changed (and so with a valid theme node), but since
such change we might not updating the icon if no theme detail changed.

To prevent this, add a flag to require an icon update when the theme
changed, if no successfully update happened earlier.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4568
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1983>
2021-09-30 18:55:11 +02:00
Jonas Ådahl
563437de91 Always assume GLSL is supported
The support for GLSL has been advertised as unconditionally supported by
mutter for a while, and has now lost the 'GLSL' feature completely. Lets
remove the checks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1985>
2021-09-21 16:37:01 +02:00
Florian Müllner
0eff22ebcd build: Add option to turn off tests
St's theme test now requires the libmutter-test library, which is only
built when tests are enabled. Instead of mandating a particular build
configuration in mutter, add a corresponding option in gnome-shell as
well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1975>
2021-09-07 12:53:47 +00:00
Robert Mader
483d1b3177 shell/util: Remove get_content_for_window_actor()
It got replaced by `meta_window_actor_paint_to_content()`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1879>
2021-09-04 12:10:51 +02:00
Evan Welsh
0d8e0025d6 init: Set console log domain
GJS added a console module that extensions may start using. To ensure that
extensions using console.log() and similar functions don't show up as
'Gjs-Console' in users' system logs, we should call setConsoleLogdomain()
with 'GNOME Shell'.

This GJS API addition is only accessible using ECMAScript Modules (ESM),
this commit moves shell startup to a small init.js module and adapts
CI jobs to either handle or ignore it.

We can drop the .jscheckignore file when future versions of SpiderMonkey
allow for compile checks without validating module specifiers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1958>
2021-09-01 14:55:47 +00:00
Florian Müllner
f719ea8d69 st/scroll-bar: Remove pointless condition
Both branches are identical (which is correct - orientation or
text direction is irrelevant for the trough).

Spotted by coverity in CID 351261.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
506001ebc2 src/shell: Plug some small leaks
Spotted by coverity in CID 351284 and 351288.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
6e629c0f10 st/icon: Only get resource-scale after peeking theme node
If an actor is not on any stage view, then it doesn't have a valid
resource scale, which will hit an assert later.

When that is the case (for example when running headless), we expect
that there is no valid theme node (yet) either, so simply moving
the clutter_actor_get_resource_scale() call after peeking at the
theme node is enough to avoid the crash.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1935>
2021-08-05 10:03:51 +00:00
Ray Strode
8721c5db37 st/password-entry: Honor disable-show-password key
StPasswordEntry provides an optional icon for the user to
show their password in clear text.

This commit disables that icon if password showing is locked
down.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/687>
2021-07-30 14:17:07 +00:00
Ray Strode
162d694d9a st/settings: Add new disable-show-password setting
There's now a setting

org.gnome.desktop.lockdown disable-show-password

that ostensibly lets admins prevent from users from
showing their password in password dialogs.

gnome-shell currently ignores this key.

As a first step, this commit adds the setting to StSettings.

Future commits will use the new setting.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/687>
2021-07-30 14:17:07 +00:00
Ray Strode
4ae06a2879 st/settings: Fix indentation on settings keys
Most of the keys are aligned, but "screen-magnifier-enabled" isn't.

This commit lines all the keys up, giving a little more breathing
room for future keys that have longer names.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/687>
2021-07-30 14:17:07 +00:00
Jonas Dreßler
ba428ed6b0 st/scroll-bar: Remove unneeded style-changed handler
Same reasoning as the last commit, this is already handled in the
default vfunc override of StWidget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/953>
2021-07-30 13:59:18 +00:00
Jonas Dreßler
85ffb96924 st/scroll-view: Don't emit superfluous style-changed events on children
Since we correctly call the `style_changed` vfunc superclass at the end
of our own function anyway, the style changes will get propagated to the
children of the scrollView inside `st_widget_real_style_changed` anyway.

So remove those unneeded and quite expensive (because they cause the
theme node to be regenerated) calls to `st_widget_style_changed`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/953>
2021-07-30 13:59:18 +00:00
Jonas Dreßler
f6553ef5f0 st/icon: Chain up to parent vfunc in override
GObject vfunc overrides are always supposed to call their parent vfunc,
this was forgotten here, so fix it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/953>
2021-07-30 13:59:18 +00:00
Jonas Dreßler
0b1dfbf6f3 st/icon: Check icon properties for changes before regenerating texture
Properly compare the new icon properties of StIcon to the old ones on
style-changes and only update the icon texture in case something
changed. This should help reduce the amount of texture cache requests
when we start emitting all "style-changed" signals again.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/953>
2021-07-30 13:59:18 +00:00
Jonas Dreßler
13562033d7 st/icon: Store paint scaled icon size instead of normal size
This makes it easier to track size changes when the paint scale changes,
since in those cases we basically want to do the same thing as when the
normal icon size changes: Request a new texture from the cache.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/953>
2021-07-30 13:59:18 +00:00
Florian Müllner
e726527604 shell/global: Expose MetaContext as property
We'll likely have to interact a bit with the newly added Meta.Context
object, so add a convenience property that gives us direct access
instead of getting it from the display every time we need it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1917>
2021-07-18 23:11:43 +02:00
Jonas Ådahl
d265dabe03 main: Take over setting signal handlers and changing dir
MetaContext isn't doing this for us anymore, so do it ourself.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1840>
2021-07-15 12:42:17 +00:00
Jonas Ådahl
5acab6c300 Port to MetaContext
This ports over gnome-shell and the theme test case to MetaContext,
instead of the various functions that were available before.

The test case is changed to use the special test context, used to
construct contexts for testing. It's part of a shared libary separate
from the main libmutter one.

This enables building mutter tests during CI, as the test framework is
needed by some of gnome-shell's tests.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1840>
2021-07-15 12:42:17 +00:00
Jonas Ådahl
4340170e94 st/test-theme: Rename theme context variable
We will later get a pointer to a MetaContext, so avoid that future
naming conflict.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1840>
2021-07-15 12:42:17 +00:00
Florian Müllner
0e72579364 st/scroll-bar: Fix vertical scrollbars in RTL locales
Commit 0db41a3773 fixed the handling of horizontal scrollbars in
RTL locales, but accidentally applied the translation to *all*
scrollbars when handling handle drags and paging. Fix this by
limiting the mirroring to horizontal bars.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4458

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1910>
2021-07-08 23:12:26 +00:00
Robert Mader
3cfbb48f46 main: Use mallinfo2 when available at build time
`mallinfo` has been deprecated in favor of `mallinfo2`:
```
The fields of the mallinfo structure that is returned by the
older mallinfo() function are typed as int.  However, because
some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1786>
2021-07-07 14:44:30 +00:00
Daniel van Vugt
6721710932 st/theme-node-drawing: Render box-shadow independently of background-color
Until now, the absence of a `background-color` would cause `box-shadow`s
to be invisible. That was a bug because `box-shadow` is meant to be either
the color specified in `box-shadow`, or if none was specified then the
foreground `color`.

There is nothing in the spec that says the `box-shadow` rendering should
depend on `background-color`, so separate them. This ensures `box-shadow`
is rendered even when `background-color` is absent or transparent.

https://www.w3.org/TR/css-backgrounds-3/#box-shadow

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1904>
2021-06-30 12:28:08 +00:00
Carlos Garnacho
82450e1060 shell: Drop dependency on ClutterX11 headers/gir
This can be replaced with MetaX11Display nowadays.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1841>
2021-06-29 22:47:41 +00:00
Daniel van Vugt
48d5740443 st/private: Set sampling_radius to match the blur radius
From [the spec](https://www.w3.org/TR/css-backgrounds-3/#shadow-blur):

> the resulting shadow must approximate (with each pixel being within 5%
> of its expected value) the image that would be generated by applying to
> the shadow a Gaussian blur with a standard deviation [sigma] equal to
> half the blur radius

This does not change the value of `sigma`, it only corrects the value of
`sampling_radius` used to size the shadow texture. Since the texture is
no longer being slightly oversized it won't get scaled down when rendered
according to the dimensions provided by `st_shadow_get_box` in
`_st_paint_shadow_with_opacity`.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4409
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1897>
2021-06-29 22:32:24 +00:00
Daniel van Vugt
c08c142f95 st/widget: Include the shadow in the paint volume
Having an inaccurate paint volume didn't matter until ae338af1e8, but
after that having too small a paint volume resulted in apparent clipping.
Not because `clip_to_allocation` is set, but because the offscreen
framebuffer is sized to fit the paint volume only.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1897>
2021-06-29 22:32:24 +00:00
Florian Müllner
3f2db31d7e shell/app: Keep cancellable after cancelled proxy request
When a GTK app is started, we create a corresponding GtkApplication
proxy to monitor the app's busy state. If the app is stopped before
the proxy request finishes, we cancel the cancellable before clearing
the running state.

Usually we clear the cancellable once it is no longer needed, namely
when we got the proxy. However when the request was cancelled, the
cancellable has already been cleared, and if there's a cancellable,
it belongs to another request (because the window was added again,
for example when moving between monitors).

Leave that cancellable alone in that case, so we can cancel the
second request as well if necessary to avoid a crash when trying
to set the proxy on a cleared running state.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1962

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1885>
2021-06-14 20:37:26 +02:00
Daniel van Vugt
a21058e6c9 st/icon: Rebuild shadows when the texture dimensions change
Not when the main actor dimensions change. So now the shadows don't get
constantly regenerated during the overview animation. In my case this
reduces the render time of the overview animation (tapping Super) by
approximately 10% with 2 windows, or 20% with 10 windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1869>
2021-06-03 20:27:57 +08:00
Gustavo Noronha Silva
404ca91941 calendar-server: Fix double-free detection abort
app_notify_events_added uses an intermediate builder to construct an
array that is then added to the main variant using g_variant_builder_add
which should clear the intermediate, but doesn't due to the way it is
passed: by value, rather than as a pointer.

This was debugged with the help of Eduardo Habkost, who believes it
works on x86 due to big structs being passed as pointers.

Fixed: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3440
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1848>
2021-05-18 23:06:50 +00:00
Carlos Garnacho
279db3f168 st/button: Consider touch sequences for ::pressed state
We do notify on the ::pressed property after touch begin/end and
recording the event sequence, but we do not return the correct value
if the button was triggered via touch.

Consider the event sequence also in the ::pressed getter, so the
button is considered pressed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1774>
2021-05-11 16:13:49 +00:00
Florian Müllner
3eda672929 st/scroll-view-fade: Add :extend-fade-area property
Since commit f60a469a34, everything outside the fade area is painted
fully transparent. That is required for the fade effect during app
grid navigation, to prevent unfaded parts of surrounding pages
becoming visible on wide-screen displays.

However in most other cases, that behavior is the exact opposite
of what we want: Elements outside the fade area (like scroll bars)
should never fade.

In order to fix the regular case, hide the new behavior behind a
property.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4234

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1831>
2021-05-11 13:21:40 +00:00
Jonas Dreßler
1cefd589da st: Only use clutter_actor_invalidate_paint_volume() if the API exists
With commits fab39bbea5 and
62e40a1350 we started depending on a new
ClutterActor API: clutter_actor_invalidate_paint_volume()

Given that this commit was applied to the 40 stable release, it broke
ABI compatibility with mutter, which is something we guarantee between
stable releases. So use GModule to dynamically find the symbol in our
loaded libraries. If it exists, use it and invalidate the paint volume.
If it doesn't exist, libmutter is still at version 40.0 and we don't
need to invalidate the paint volume.

This also adds a dependency on gmodule. We need to link against gmodule
to use g_module_open() and g_module_symbol() APIs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1807>
2021-04-26 12:18:52 +00:00
Frederic Crozat
d9e953e93c st/scroll-view: Ensure float are used explictly
Pineview needs explicit float to prevent error when shader is compiled.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4127
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1815>
2021-04-16 19:23:06 +00:00
Jonas Dreßler
62e40a1350 st/widget: Invalidate paint volume on style changes
StWidget is overriding ClutterActors get_paint_volume() vfunc to adjust
for overpaint of things like box shadows that get set in CSS, it does
that by setting the paint volume to the theme nodes paint box.

Since StWidget can't really get notified when the paint box changes, we
just invalidate the paint volume when the theme nodes paint_equal()
returns FALSE.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1484>
2021-04-12 17:08:23 +00:00
Jonas Dreßler
fab39bbea5 st/viewport: Invalidate the cached paint volume of ClutterActor
Since StViewport uses the value of the StAdjustment to create its custom
paint volume, ClutterActors newly introduced proper caching of paint
volumes doesn't get notifed about changes to that paint volume and will
simply reuse the cached old one.

So make use of the newly introduced
clutter_actor_invalidate_paint_volume() method to make sure ClutterActor
will ask for the paint volume again on the next paint.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1484>
2021-04-12 17:08:23 +00:00
Carlos Garnacho
4dfc53cade hotplug-sniffer: Drop "volatile" from g_once_init_enter() sentinels
As documented in g_once_init_enter(): "While @location has a volatile qualifier,
this is a historical artifact and the pointer passed to it should not be
volatile.". And effectively this now warns with modern glibc.

Drop this from our logging function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1770>
2021-03-22 11:12:23 +00:00
Carlos Garnacho
554d76a200 calendar-server: Drop "volatile" from g_once_init_enter() sentinels
As documented in g_once_init_enter(): "While @location has a volatile qualifier,
this is a historical artifact and the pointer passed to it should not be
volatile.". And effectively this now warns with modern glibc.

Drop this from our logging function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1770>
2021-03-22 11:12:23 +00:00
Florian Müllner
4a7c5890a8 shell/app: Explicitly handle (X11) fallback icon changes
Since commit 770231, StImageContent implements the GIcon interface, which
allowed us to represent all application icons as GIcon (app-info, X11 icon
property or themed fallback icon).

While that change made for a nicer ShellApp API, it did introduce a
conceptual issue in st_texture_cache_bind_cairo_surface_property():
GIcons usually represent static icons, while the ClutterContent
returned by that method updates automatically when the bound property
changes.

Address this by tracking the MetaWindow:icon property in ShellApp, and
update the fallback icon when it changes. With that, a GIcon object
always represents the same icon, and any icon change is reflected
by a corresponding GIcon change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1761>
2021-03-14 20:36:41 +00:00
Florian Müllner
16b0d0d07c shell/app: Expose icon as property
A property can be more convenient than a method. More importantly,
we are about to allow the icon to change, so a property will be
useful to get notified about those changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1761>
2021-03-14 20:36:41 +00:00
Florian Müllner
0cf22f4a1b shell/app: Only release window ref when we are done
We hold a reference to all windows we track for the app. While that
reference is unlikely to be the last remaining one, we still shouldn't
release it until we are done with the window.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1761>
2021-03-14 20:36:41 +00:00
Florian Müllner
07a819f62b st/texture-cache: Split out load_cairo_surface_to_gicon() method
This is essentially st_texture_cache_bind_cairo_surface_property()
without the binding part.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1761>
2021-03-14 20:36:41 +00:00
Florian Müllner
5652550688 st/texture-cache: Fail loading invalid StImageContent
Creating a content object from a cairo surface may fail, in which case
we return an empty content with a 0x0 preferred size.

However when we treat such a content object as GIcon, we happily load
it anyway. Don't do that, so consumers like StIcon can fall back properly
to an alternative.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1761>
2021-03-14 20:36:41 +00:00
Sebastian Keller
5062c4c9c2 st/texture-cache: Ensure icons keep their aspect ratio when scaled down
Window preview icons can get scaled down if the window they belong to is
very small and/or there are a lot of open windows. When scaled down this
way the icons would get scaled without keeping the aspect ratio. Fix
this by using a content gravity that keeps the aspect ratio.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3865

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1751>
2021-03-14 01:06:30 +00:00
Sebastian Keller
07f2d32087 st/texture-cache: Don't use content size request mode for surface icons
While most GIcons passed to this function cause a StImageContent to be
created with the requested size, cairo surface based icons already are
passed as StImageContent with a preferred size corresponding to the
size of the surface they were created from. As a result icons of window
backed applications were never scaled up like the other icons. Fix this
by ignoring the content size for these case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1751>
2021-03-14 01:06:30 +00:00
Jonas Dreßler
d21a0b186e iconGrid: Subclass a C actor for BaseIcon
We create a lot of BaseIcons for the appGrid, one for every app, and for
all of those we have to hop through JS to get the preferred width. That
makes it another obvious target for moving to C, so let's do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
afb56df55c windowPreview: Subclass a C actor
Move the get_preferred_width/height() and allocate() vfunc
implementations of WindowPreview to C, subclassing the C GObject from
JS.

This gets us another significant performance gain, allocating a
workspace with 20 windows now only takes 1.2 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
04c781674c Move WindowPreviewLayout from JS to C
This layout manager is used quite often and the time we spend calling
it's allocate and get_preferred_width/heigth functions increases with
every open window.

We can save a lot of precious time during the layout cycle by moving
this layout manager from JS to C, thus avoiding the overhead of
trampolining between C and JS land.

In a measurement where the average time spent in vfunc_allocate() of the
Workspace actor was measured while opening an overview with 20 windows,
the average time spent went down from 3.1 ms to 2.3 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Sebastian Keller
99dd5ece55 st/texture-cache: Change bind_cairo_surface_property to transfer full
This is how the code works and how it is already used from the C side.
There would also be no point in keeping this transfer none, because
textures generated from this function will not be shared and are not
kept in the cache.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1718>
2021-03-08 09:21:25 +00:00
Sebastian Keller
19e5f35569 Revert "st: Keep weak ref on texture cache bound texture source"
This reverts commit 87558efbf1.

The commit did not fix the bug it was supposed to fix, it just
complicated the code. The hopefully correct fix is in the previous
commit.

The point of this commit was to ensure everything gets removed when
bind->source gets removed. This however was already the case since the
signal handler was already connected to bind->source and has a
destructor registered that takes care of everything. And since gobject
destroys its signal handlers before it clears the weak refs, this new
weak ref was effectively never being used.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1718>
2021-03-08 09:21:25 +00:00