Commit Graph

2532 Commits

Author SHA1 Message Date
Daniel van Vugt
8e05fa2728 st: Don't leak st_describe_actor strings
Hopefully this code doesn't get hit much. And it does seem to be the
only user of the function.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1319
2020-06-18 14:10:59 +08:00
Florian Müllner
0db41a3773 st/scroll-bar: Fix horizontal bar in RTL locales
As the view now scrolls from right-to-left in RTL locales, the
scroll bar handle should reflect that.

Likewise the event handling needs adjusting as well: Scrolling
left should increase the adjustment value, and clicking the
trough to the left of the handle as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1318
2020-06-17 01:08:03 +02:00
Florian Müllner
8d7f7e61dd st/scroll-view: Adjust scroll events in RTL locales
In RTL locales, scrolling left should increase the adjustment value.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1318
2020-06-17 01:07:28 +02:00
Florian Müllner
3f4b253dac st/viewport: Fix horizontal translation in RTL locales
In RTL locales, the lowest value should correspond to the right-most
position and vice-versa.

That this went unnoticed for so long shows how we have avoided horizontal
scrolling so far :-)

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1318
2020-06-16 23:57:51 +02:00
Jonas Dreßler
dd8e1aef51 st-widget: Use clutter_input_device_get_actor() to get pointer actor
Use clutter_input_device_get_actor() since it replaces
clutter_input_device_get_pointer_actor().

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1285
2020-06-16 09:33:08 +00:00
Sebastian Keller
fdfcacf1db st/entry: Fix leak when copying or cutting text using shortcuts
clutter_text_get_selection() creates a copy of the selected text which
gets passed to st_clipboard_set_text() which creates its own copy. The
copy returned by clutter_text_get_selection() however never got free'd.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1306
2020-06-08 15:21:17 +00:00
Florian Müllner
12c7f693d0 calendar-server: Notify HasCalendar changes when updating views
The HasCalendar property reflects whether there are any views, and views
change either when clients appear/disappear or when the time range changes.

However we currently only emit the PropertiesChanged signal for the former,
fix that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1300
2020-06-05 22:56:16 +00:00
Florian Müllner
e0a8cb565e calendar-server: Move method
We'll need to call it from app_update_views(), so move it up to make
it available to that function without a prior declaration.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1300
2020-06-05 22:56:16 +00:00
Marco Trevisan (Treviño)
46547ae027 shell-mime-sniffer: Ignore invalid file content type
The shell mime sniffer goes through all the files in a directory,
however in case a file content type is not recognized, the GIO function
g_file_info_get_content_type() may return NULL, causing a crash when
looking up into the content type tables, as they are supposed to contain
strings only and they use `g_str_hash` has func, which doesn't support
NULL values.

So, in case we get an invalid content type, let's just ignore it,
without adding it to the cache as we do in the nautilus code that was
inspiring the sniffer.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2643
2020-06-05 16:27:29 +02:00
Florian Müllner
5d5ca80d17 st/box-layout: Fix gtk-doc comments
Commit 9dc421875 added a subtle syntax error: # is used to cross
reference symbols, but must not be used in the definition of the
symbols itself.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1281
2020-05-25 18:43:30 +00:00
Florian Müllner
d81237b9d6 st/texture-cache: Cancel pending requests on icon-theme changes
As outlined in commit 36b8dcbe07, we can end up with wrong icons
if the icon theme changes right after a GTK theme change to/from
HighContrast triggered a theme reload.

That's because when we reload icons for the new icon theme, there
are already pending requests due to the icon-style change; those
requests are simply re-used for the new icons, with the existing
icon infos from the old theme.

The above commit applied a simple work-around by changing the
icon theme before the GTK theme, but that only works for the
HighContrast switch in our own UI.

It turns out that Settings also uses the "wrong" order, so the
issue still reproduces with the Universal Access panel.

So instead of relying on everything changing the settings in the
order we expect, cancel all ongoing requests on icon-theme changes.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1277
2020-05-25 12:55:28 +02:00
Jonas Dreßler
b88ed3f251 Use pid_t for meta_window_get_pid()
The return value of meta_window_get_pid() changed again and it now
returns pid_t, which usually just resolves to int on most platforms. We
should still use pid_t now though, so do that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1188
2020-05-21 23:11:21 +00:00
Andy Holmes
669b0f193a StClipboard: add st_clipboard_get_mimetypes
Since the `MetaSelection` of the global `StClipboard` is private (and
should be), there is no reasonable way for extensions or external code
to query the supported mime-types.

Add `st_clipboard_get_mimetypes()` so this can be queried without
poking around in private code.

closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2819
2020-05-21 22:24:59 +00:00
Florian Müllner
0ab34fe21f st: Remove BoxLayout child meta
They were deprecated last cycle in favor of ClutterActor's own
expand/align properties, time to retire them for good.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1274
2020-05-21 21:17:16 +00:00
Jonas Dreßler
0f947d4ff9 st/theme: Remove entry from files_by_stylesheet after emitting signal
Since e06109c23c we keep old theme nodes
valid during the emission of the "custom-stylesheets-changed" signal.

It turns out that we might still look up the file of a stylesheet using
the files_by_stylesheet hashtable during the emission of that signal,
causing a crash because the assertion in _st_theme_resolve_url() fails.

So fix that and remove the stylesheet entry from the files_by_stylesheet
hashtable after emitting the "custom-stylesheets-changed" signal. And to
be consistent, also remove the entry from the stylesheets_by_file
hashtable after emitting the signal.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2757
2020-05-21 20:59:35 +00:00
Andy Holmes
9dc421875b StBoxLayout: Fix up some documentation
`StBoxLayout` has a couple properties (`vertical` and `pack-start`)
improperly referenced as signals, and is somewhat unclear these
properties are wrappers around the underlying `ClutterBoxLayout`
properties.

Fix these up and add references to the underlying properties, rather
than redescribing them.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2816
2020-05-21 22:37:23 +02:00
Florian Müllner
9c3c9a155e st: Remove deprecated Bin properties
Those were deprecated last cycle in favor of ClutterActor's own
expand/align properties, and don't have any effect anymore.

Time to remove them for good.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1273
2020-05-21 14:36:59 +02:00
Jonas Dreßler
9b99b67fea Remove ClutterAllocationFlags
Those flags were removed from Clutter since they're pretty much unused,
so remove them here, too.

See https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1245
2020-05-20 15:12:03 +02:00
Carlos Garnacho
eed27a2a4c shell: Fix return value if the systemd unit is actually successfully run
This got broken by last minute changes in commit 2d56395921. There's no change
too simple.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1242
2020-05-08 19:21:32 +02:00
Carlos Garnacho
2d56395921 shell: Check we are in a systemd environment before starting systemd units
Avoid starting/stopping the gsd-xsettings systemd unit if the shell itself
was not started via systemd. In the lack of a user session manager, we
have no means to neatly start/stop services, so should rely on the good
ol' gnome-session to do this for us.

This changes the return value meaning slightly, TRUE means "service did
start", FALSE otherwise. The error is only raised if we ought to start,
but it produced an error somehow.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1238
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2755
2020-05-07 12:16:11 +02:00
Bastien Nocera
34da48453e shell-app: Add PrefersNonDefaultGPU support to shell_app_launch()
Read the "PrefersNonDefaultGPU" key in desktop files to figure out
whether the application prefers running on the discrete GPU, or the
default GPU, and apply that.

Update the "Launch..." contextual menu to allow launching on
the default GPU if the application "prefers [the] non default GPU".

See:
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1804
2020-05-04 16:22:03 +02:00
Bastien Nocera
13dcd78be1 shell-app: Downgrade not finding a discrete GPU to debug
As we'll want to call this unconditionally soon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
2020-05-04 16:22:03 +02:00
Bastien Nocera
b17017679b shell/global: Notify when switcheroo-control prop changes
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
2020-05-04 16:22:03 +02:00
Bastien Nocera
9d7832ea44 shell/global: Make switcheroo-control available from JS
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
2020-05-04 16:22:03 +02:00
Bastien Nocera
49605c7b00 shell/global: Watch for switcheroo-control appearing
Rather than staticly expecting switcheroo-control to already be running
on the system, wait for it appearing and disappearing.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
2020-05-04 16:22:03 +02:00
Jonas Dreßler
e06109c23c st/theme: Unref CRStylesheet after removing old theme nodes
Since we now remove all theme nodes on a stylesheet change (ie.
StTheme's "custom-stylesheets-changed" signal) instead of only
invalidating them, those nodes may not be accessed anymore as soon as
"custom-stylesheets-changed" is emitted.

It turned out though that when comparing them to the newly generated
nodes in `st_widget_recompute_style()` using the
`st_theme_node_paint/geometry_equal()` functions, the properties of the
old nodes will still be accessed, causing a crash since the
CRDeclarations are already freed.

To fix that, keep the reference to the CRStylesheet, which owns the
CRDeclarations used by the theme nodes, around a bit longer, so it's
still possible to access the CRDeclarations inside the
"custom-stylesheets-changed" signal handler. This allows us to compare
the old theme nodes to the new ones since the CSS properties of both are
still valid.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2709
2020-05-01 14:24:16 +00:00
Jonas Dreßler
4dfa39457e st/theme-context: Also remove theme nodes on stylesheet changes
StThemeNodes are built around the assumption that they're "immutable",
that means they are created once with certain parameters (that resolve
to certain css properties) and then replaced with new ones in case those
parameters changed.

Changes to the internal information stored by theme nodes (i.e. the css
properties, font names or the cached scale-factor) are not all handled
the same though: For changes to the font or the scale-factor we remove
all theme nodes from the cache and let the widgets which are on stage
generate new theme nodes. For changes to the css properties/the
stylesheet, we invalidate the properties of all theme nodes but keep
them in the cache using `_st_theme_node_reset_for_stylesheet_change()`.

So be a bit more consistent and handle changes to the css-properties/the
stylesheet stored by StThemeNodes the same way as changes to the font or
scale-factor.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1218
2020-04-28 19:53:58 +00:00
Carlos Garnacho
325ff73c5b st: Ensure to reset all widget theme nodes
Theme node invalidation stops at unmapped widgets, and widgets
that forget to chain up to the default ::style-changed implementation.
This may leave stale nodes that were invalidated on
StThemeContext::changed, but are still set on widgets, and maybe
used for CSS property lookups.

Make sure that theme node invalidation happens always by moving
propagation outside the vfunc, and ensure the theme nodes are reset
across the full actor tree. Emission of ::style-changed, and obtaining
a new theme node may be delayed till when the actor is mapped.

The theme node is also cleared after unparenting an actor to avoid
stale references.

This ensures that all widgets get their theme node cleared after
stylesheet changes, instead of maybe being left with a theme node
that's been cleared of all its properties.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1223
2020-04-28 18:46:13 +00:00
Florian Müllner
55f74bb863 Add small gnome-shell-extension-prefs script
Commit d76162c1c0 removed the ability to pass an extension UUID to
the Extensions app, when we moved the dialog to a portal and made
gnome-shell use it instead of spawning the extensions app.

However that missed that many extensions called out to the app to
open their own prefs.

While extensions are encouraged to switch to the new openPrefs()
convenience method added in commit 8030d9ad32, restore the old
behavior with a small script under the old gnome-shell-extension-prefs
name that either calls out to the portal or launches the app.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1220
2020-04-28 00:06:19 +02:00
Milan Crha
c00d79bae2 calendar-server: Improve performance by properly using ECalClientView
The previous code always restarted whole ECalClientView when it received
any changes in it, which could sometimes lead to constant repeated restarts
of the view.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1875
2020-04-27 16:14:57 +00:00
Florian Müllner
30d902f898 calendar-server: Drop separate private struct
CalendarSources is a final type, so the regular instance struct is
already non-public. No need for a separate private struct and priv
pointer ...

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1875
2020-04-27 16:14:57 +00:00
Florian Müllner
8f9da6f801 calendar-server: Add missing spaces
... according to coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1875
2020-04-27 16:14:57 +00:00
Florian Müllner
20648e9207 calendar-server: Replace tabs with spaces
... according to the coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1875
2020-04-27 16:14:57 +00:00
Jonas Ådahl
772df91762 shell/global: Add 'backend' property
Replace all Meta.get_backend() with global.backend. Maybe sooner or
later we can further decrease the amount of singletons handled by
libmutter.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
2020-04-27 15:18:18 +00:00
qarmin
c90910731f croco: Remove duplicated conditions
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1219
2020-04-27 16:23:46 +02:00
Jonas Ådahl
0dba12193d st: Update to new API for creating paint context
It now takes a redraw clip and flags.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1207
2020-04-23 14:46:03 +00:00
Will Thompson
6f881f232e test-theme: Check return value of chdir()
I noticed the following warning while building the .deb package for
gnome-shell on Endless OS:

      ../src/st/test-theme.c: In function ‘main’:
      ../src/st/test-theme.c:549:3: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result]
         chdir (cwd);
         ^~~~~~~~~~~

(Of course this is very unlikely to fail in practice.)

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1208
2020-04-21 15:00:23 +02:00
Jonas Ådahl
b3b91f1699 js: Drop tweener.js
We're using clutter's animation framework now, so lets drop the old
tweener support layer.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1200
2020-04-15 13:25:14 +00:00
Florian Müllner
c2b518929d Revert "app-cache: Fix cache for folder translations"
Existing folders as created by gnome-software (including the
default ones) all have the .directory suffix, so dropping
the suffix from the keys broke those folders.

This reverts commit 343b3351f1.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2623
2020-04-13 14:56:34 +00:00
Florian Müllner
7d7a15f978 st/entry: Allow hint actor to shrink
We currently always ignore the minimum width of the hint actor and
request/allocate the preferred width. This can be problematic with
labels with long text, where we should rather ellipsize the text
than allow the entry to grow indefinively.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2607
2020-04-08 22:41:19 +00:00
Philip Withnall
b82039e324 util: Add a wrapper around getuid()
So we can use it from JS in an upcoming commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465
2020-04-07 17:46:39 +02:00
Jonas Dreßler
d4db5a59c1 shell-app: Ignore invalid window PIDs
When building the list of window PIDs, it's possible Mutter doesn't know
about the PID the client has and meta_window_get_pid() will return 0. We
should handle this case by not adding the PID to the list of PIDs
instead of adding an invalid one to it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1184
2020-04-06 21:53:37 +00:00
Jonas Dreßler
4aee87a31b shell-window-tracker: Detect invalid PID values of 0
MetaWindows get_pid() API changed to use the client PID, which also
works for Wayland clients instead of only X11 clients now. This API
returns 0 instead of -1 for invalid PIDs, so update our check according
to that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1184
2020-04-06 21:53:37 +00:00
Georges Basile Stavracas Neto
9f870aa1c7 st/theme-node: Use the node's scale factor
Each node stores the scale factor in place when it was created.
Creating nodes with the same style, but with different scale
factors, yields different nodes.

Use the node's scale factor instead of retrieving the context's
one.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176
2020-04-06 11:24:30 -03:00
Georges Basile Stavracas Neto
c9cfeb8318 st/theme-node: Consider scale factor when comparing
The CSS engine of St is scale-aware, which means every length
and size it produces is multiplied by the current scale factor.

However, the individual nodes aren't aware of the scale factor
when they compare to each other.

Store and compare the scale factors in the nodes themselves.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176
2020-04-06 11:24:30 -03:00
Georges Basile Stavracas Neto
497e66ce6a st/theme-context: Add a getter for the scale-factor property
Will be used by the next commit to avoid going through the GObject
machinery when retrieving the scale factor.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176
2020-04-06 11:24:30 -03:00
Jonas Dreßler
bc973b80d7 st/theme-context: Also invalidate root node on stylesheet changes
Since commit 6a42d77261 we invalidate the
cached properties for each theme node on stylesheet changes by iterating
over the hashtable of the theme context instead of listening to the
signal in each individual theme node.

That commit forgot one particular node though that's not stored in the
hashtable, but using the `priv->root_node` property instead: The theme
node that belongs to the stage.

So make sure we also invalidate the cached properties of the stage theme
node on stylesheet changes. This fixes various crashes that happened
with extensions providing custom stylesheets (emitting the
"custom-stylesheets-changed" signal on every extension enable/disable),
trying to access an already freed CSS property of the stage.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2584
2020-04-06 10:45:55 +00:00
Jonas Dreßler
85846d88f0 shell-app: Use container widget for fallback X11 app icons
Just like StIcon does, we should use a container widget for the fallback
app icon that we get using the cairo surface property. It's needed
because the widget returned by shell_app_create_icon_texture() can be
resized freely, while we want the aspect ratio of the actual texture to
remain the same.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2578
2020-04-06 08:28:26 +00:00
Jonas Dreßler
07deda593a st/icon: Always show empty texture if both gicons are NULL
Commit 7ff7fb5d3b forgot to clear the
`priv->icon_texture` actor when returning from st_icon_update(), which
means we don't always switch to an empty icon if both gicon properties
are set to NULL.

Fix this and destroy the actor before returning early from
st_icon_update().

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1178
2020-04-04 16:20:35 +02:00
Jonas Dreßler
1ca39e8586 st/icon: Use a static GIcon for the missing-image icon
Don't create a new GIcon for the "missing-image" texture but simply
create it once statically instead and always use that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1179
2020-04-04 13:21:54 +02:00