Commit Graph

2551 Commits

Author SHA1 Message Date
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
Andre Moreira Magalhaes
7ff7fb5d3b st/icon: Only load default fallback icon if an icon was set and failed to load
Commit c89d6a633 introduced a default fallback icon that would be displayed in
case the main gicon or the fallback gicon wasn't set or failed to load.

This broke the use case where a StIcon is created but no main icon or
fallback icon are set on purpose, for example the appindicator extension
which always creates a StIcon to represent icons in menu items but the
actual icons are only set if the application provides one, leaving the
menu showing the default fallback ("image-missing") icon for all menu
entries that don't actually have an icon provided by the application.

Fix that by only using the default fallback icon if the provided one
failed to load.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1173
2020-04-03 14:28:24 +00:00
Andre Moreira Magalhaes
343b3351f1 app-cache: Fix cache for folder translations
The app-cache code currently stores the folder translations in a hash
that can be accessed via shell_util_get_translated_folder_name().
This hash uses the filename (inc. extension) for the "desktop-directory"
as key which causes an issue when trying to find the translation
on AppDisplay._findBestFolderName() which gets categories (folder names)
from the app info which doesn't contain the ".directory" extension.

Fix that by storing the filename without extension as the hash key for
the cached folder translations.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1168
2020-04-02 20:37:20 +00:00
Florian Müllner
6d3c740b37 st/entry: Unset key focus when made unreactive
It seems reasonable that an entry shouldn't allow entering text when not
reactive. The same could be achieved by changing the text's :editable
property, however that will disable scrolling if the text doesn't fit,
which may result in an unwanted size change.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
2020-03-29 22:12:57 +02:00
Florian Müllner
34c4627db9 st/entry: Bind ClutterText reactivity to entry
The text is part of the entry, so it is surprising that it can
still be edited when the entry itself isn't reactive. Address
this by setting up a binding instead of expecting all consumers
to handle the case themselves.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
2020-03-29 22:12:57 +02:00
Florian Müllner
b08b125df6 st/entry: Remove unused macro
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
2020-03-29 22:12:57 +02:00
Carlos Garnacho
656168543f st: Honor alpha range specified by pango_attr_foreground_alpha_new()
This is documented as a value between 1 and 65536. However we were passing
a 0 value for 100% transparent colors, which is interpreted as "system
inherited" in pango_renderer_get_alpha() docs.

Ensure we respect this range by specifying the minimum allowed alpha (1)
if the color is fully transparent. If someone notices this 1/65535th change
I'll ask him how many pleiades can he count.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2504

(yes, again).
2020-03-28 16:58:30 +00:00
Carlos Garnacho
73472ba6a7 st: Forward CSS foreground alpha as a PangoAttribute to text
Let the PangoRenderer handle this.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2504
2020-03-27 22:47:48 +00:00
Jonas Dreßler
91748aedb7 blur-effect: Handle failure of background blitting gracefully
`paint_background` already provides a return value in case the blitting
of the framebuffer fails, handle that and fall back to only drawing the
actor in case something goes wrong.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1000
2020-03-27 22:31:57 +00:00
Jonas Dreßler
4783d767d6 blur-effect: Properly clear background framebuffer
We want to completely clear the background framebuffer when switching
back to ACTOR mode to make sure the `background_fb.framebuffer` check
will fail in `update_background_fbo` when switching to BACKGROUND mode
again. Otherwise the checks in `update_background_fbo` will return TRUE
and we will keep using the background framebuffer that was created
before switchig to ACTOR mode.

While at it, also clear the background framebuffer completely when
changing the actor to avoid the same issue here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1000
2020-03-27 22:31:57 +00:00
Jonas Dreßler
dedbf0cb09 blur-effect: Fix framebuffer sizes when stage-view scaling is used
When blurring only the actor (ACTOR mode), we don't want to apply any
scale, it looks fine without using the resource scale and it also seems
like `clutter_actor_continue_paint` in `paint_actor_offscreen` only
draws an unscaled texture anyway (ie. if the resource scale is 2, only a
quarter of the framebuffer is being drawn to).

In BACKGROUND mode though, we need to scale the framebuffer using the
scale factor of the stage view (ie. the final scale factor for the
monitor) because the content of the framebuffer we blit is scaled using
that factor. Also, since the framebuffer we blit belongs to a stage view
and only includes the contents of this view, we need to adjust the
stage-coordinates of the actor to be relative to the stage-view.

To make sure we don't have to get the transformed actor size or position
multiple times during one paint-run and don't have to carefully floor()
or ceil() widths and positions, store the size of the actor (which is
also the size of the framebuffer) and its position relative to the stage
view inside a ClutterActorBox.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1000
2020-03-27 22:31:56 +00:00
Jonas Dreßler
e5b7462b94 blur-effect: Don't check whether effect is enabled when painting
A ClutterEffect is being painted as part of the paint cycle of
ClutterActor, where _clutter_effect_paint() is called before painting
the actual actor. With that, it's impossible that an effect gets painted
while it's disabled, so remove the check whether the ClutterActorMeta is
enabled before painting.

Also if everything works fine in Clutter, the ClutterActorMeta should
have an actor set and we've been notified about that actor in
shell_blur_effect_set_actor(), so assert that our cached actor is set
when painting the effect.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1000
2020-03-27 22:31:56 +00:00
Jonas Dreßler
48b0a91385 blur-effect: Fix alignment of function arguments
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1000
2020-03-27 22:31:56 +00:00
Florian Müllner
c89d6a633a st/icon: Add a default fallback icon
The idea behind commit 3dd8ffc2bb to try harder to avoid empty
icon actors because of missing icons was sound, so implement that
behavior in StIcon itself:

If the main gicon was not found, and the fallback gicon isn't set or
wasn't found either, fall back to the standard 'missing-image' icon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1127
2020-03-26 18:36:02 +00:00
Florian Müllner
fecc0c06ac Revert "texture-cache: Use image-missing image when no other icon was loaded"
The commit broke StIcon's :fallback-gicon property, as it relies on failure to load
an icon to determine that the fallback should be shown.

Luckily StIcon is the only user of st_texture_cache_load_gicon() (at least in
regular shell code), so we'll be able to implement the 'image-missing' fallback
there.

This reverts commit 3dd8ffc2bb.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1127
2020-03-26 18:36:02 +00:00
Florian Müllner
f52574bd28 shell/util: Add touch_file_async() helper
Add a small helper method to asynchronously "touch" a file and return
whether the file was created or not.

As g_file_make_directory_with_parents() doesn't have an async variant,
we need a C helper to make the entire operation non-blocking.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
2020-03-25 20:03:01 +00:00
Carlos Garnacho
66c4b1a8b6 st: Apply css foreground color to text as a PangoAttribute
Rely on the Pango renderer handling this properly, instead of tinting
the full ClutterText in the color specified through css.

Also set the caret color explicitly, since it used to be set as a side
effect of clutter_text_set_color(), but no longer is.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/850
2020-03-25 11:18:30 +00:00
Florian Müllner
35484151ce shell/screenshot: Throw error on failure
Commit da537cda43 moved the Shell.Screenshot API to GIO's async pattern,
but we never set the GError passed to the *_finish() functions and only
indicate failure by returning FALSE.

The expected behavior is to throw an error in that situation, so make sure
we do that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1123
2020-03-24 11:29:53 +00:00
Florian Müllner
1bccbe7f11 shell/screenshot: Remove unnecessary NULL check
Since commit be5f5ec9d4, the output stream is created externally and
expected to be non-NULL, so the check is now pointless (in particular
*after* calling g_object_ref() on the stream).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1123
2020-03-24 11:29:53 +00:00
Florian Müllner
b4162afa65 shell/screenshot: Check preconditions of public API
It's good practice to guard public API against programmer errors,
so add the usual g_return*_if_fail() calls.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1123
2020-03-24 11:29:53 +00:00
Mario Sanchez Prada
3dd8ffc2bb texture-cache: Use image-missing image when no other icon was loaded
If a given icon is not available for neither the current theme nor any
of the fallback options (default theme -"Adwaita", "gnome"...), the
call to gtk_icon_theme_lookup_by_gicon() will return a NULL value, which
returned by the Shell Toolkit as is, causing trouble in the Shell's JS
code when calling shell_app_create_icon_texture() to create an icon.

To at least mitigate the chances of this having this issue happening, we
should at least try to load the standad 'image-missing' icon from the
Icon Naming Specification spec when we receive a NULL here, so that
at least we try to show something to the user, even if it's ugly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1121
2020-03-23 13:50:06 -03:00
Jan Tojnar
7cd37a4017 build: Add missing dependency to run-js-test
run-js-test requires girepository.h header file which is provided
by gobject-introspection. gobject-introspection is required by gjs,
another of our dependencies, so, usually, the header gets included
by inheriting the cflags from there but some distros interpret
pkg-config fields more strictly[1] so that will not be the case there.

Listing direct dependencies explicitly is a good practice any way
so let’s do that.

[1]: https://bugs.freedesktop.org/show_bug.cgi?id=105572

https://bugzilla.gnome.org/show_bug.cgi?id=787864
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1114
2020-03-21 02:58:17 +00:00
Florian Müllner
e572d5d08c extensionPrefs: Use imports.package.start()
We want to make the extensions app code more self-contained to make it
easier to build separately, and ultimately make it available on flathub.

One complication we are facing is that it is currently all over the source
tree:
 - js/extensionPrefs for the main code
 - src for the launcher process
 - data for .desktop file and icons

Switching from a C launcher to the imports.package module allows us to
consolidate the first two, and will also take care of the annoying
setup bits (defining JS search path, extending GI lookup, loading
resources).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1081
2020-03-19 14:27:35 +00:00
Florian Müllner
ea1adea24d shell/network-agent: Wrap nm_plugin_info_new_search_file()
While we can use the libnm API directly from JS, the call will
synchronously load the VPN service descriptions from disk.
Previously we were lowering the impact by caching the result,
but as we stopped doing that, it becomes more important to address
the issue properly and move it off to a thread.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2386
2020-03-17 14:07:15 +00:00
Florian Müllner
1aff64a38b main: Stop owning the public org.freedesktop.Notifications name
For sandboxed apps, permission to talk to org.freedesktop.Notifications
looks innocent enough. However as all exported services share the same
connection to the session bus, that permission actually grants an app
access to *any* shell D-Bus API.

While we want apps to use the notification portal, it is still common
for apps to use libnotify, raw D-Bus calls or even notify-send.

We don't want to give those apps a way to circumvent most of the sandbox
restrictions, so stop owning the org.freedesktop.Notifications name.

In a next step we will implement a separate notification-daemon that
exposes the API on the well-known address and proxies any requests to
the real implementation in gnome-shell.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/547
2020-03-12 16:09:27 +00:00
Christian Hergert
f8db5aa106 app-cache: add ShellAppCache for GAppInfo caching
This caches GAppInfo so that the compositor thread does not have to perform
costly disk access to load them. Instead, they are loaded from a worker
thread and the ShellAppCache notifies of changes.

To simplify maintenance, ShellAppCache manages this directly and the
existing ShellAppSystem wraps the cache. We may want to graft these
together in the future, but now it provides the easiest way to backport
changes to older Shell releases.

Another source of compositor thread disk access was in determining the
name for an application directory. Translations are provided via GKeyFile
installed in "desktop-directories". Each time we would build the name
for a label (or update it) we would have to load all of these files.

Instead, the ShellAppCache caches that information and updates the cache
in bulk when those change. We can reduce this in the future to do less
work, but chances are these will come together anyway so that is probably
worth fixing if we ever come across it.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2282
2020-03-11 18:06:15 -07:00
Carlos Garnacho
b18469427e St: Ensure to update entry hint visibility with IM preedit
Commit 88ac339774 changed StEntry behavior so the text hint would
stay visible while focused, as long as the text buffer is empty.
However, IMs that use preedit still should count as "started typing",
while the text buffer is still officially empty.

To fix this, check on st_entry_update_hint_visibility() that there's
indeed no preedit buffer before showing the hint. We can't directly
listen to internal preedit buffer changes in ClutterText, so handle
preedit buffer updates through the ::cursor-changed signal that will
be indirectly emitted.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1084
2020-03-11 14:07:07 +01:00
Sebastian Keller
1b872c1195 st/texture-cache: Fix invalid memory write related to X11 window icons
st_texture_cache_bind_weak_notify calls g_clear_signal_handler which
then calls st_texture_cache_free_bind. st_texture_cache_free_bind frees
the bind structure, so by the time g_clear_signal_handler tries to write
bind->notify_signal_id, bind has already been freed.

Fix this by using g_signal_handler_disconnect instead.

This partially reverts 135d178d08

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/2334
2020-03-09 17:34:56 +00:00
Sebastian Keller
c05098cd12 st/password-entry: Fix peek icon leak
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1078
2020-03-08 23:51:55 +01:00
Florian Müllner
bf367daaba build: Fix some harmless compiler warnings
Some (newer?) GCC versions complain when a g_auto variable isn't
initialized when declared, even when the initialization is guaranteed
to happen before the variable is used or goes out of scope.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2298
2020-03-08 00:34:36 +00:00
Florian Müllner
4ff94f80a0 shell/tray-manager: Delay managing screen if necessary
Now that Xwayland startup is asynchronous, the function may be called
before X11 is available, resulting in a crash.

Fix this by only managing the tray immediately if we already have an
X11 display, and wait for it to be set up otherwise.

Likewise, unmanage the screen when X11 becomes unavailable.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2308
2020-03-06 18:45:21 +00:00
Florian Müllner
e6d4581959 shell/tray-manager: Allow to unmanage screen
Since support for legacy status icons is implemented by extensions
nowadays, they need to undo the call to manage_screen() when they
are disabled.

Right now that means bypassing garbage collection with an explicit
call to run_dispose() on the Shell.TrayManager. That works, but is
rather ugly.

An explicit unmanage_screen() method is a nicer option, and will be
useful to us as well to deal with X11 going away (once Xwayland
crashes don't bring down the entire session).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2308
2020-03-06 18:45:21 +00:00
Florian Müllner
07bbcb1b48 shell/tray-manager: Only create resources when needed
NaTrayManager in particular is deeply tied to X11. We currently assume
that X11 support is always available, but that is already not true
anymore - Xwayland startup is now asynchronous.

It will be even less true once we handle Xwayland crashes gracefully.

Start addressing that by not creating the corresponding resources once
and assume they exist for the lifetime of Shell.TrayManager, but make
sure they exist when actually needed.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2308
2020-03-06 18:45:21 +00:00
Christian Hergert
d0226c7897 shell: fix typo in comment
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1050
2020-02-26 19:00:05 -08:00
Christian Hergert
19e084036a global: force fsync() to worker thread when saving state
The g_file_replace_contents_async() API can potentially call fsync() from
the thread calling into it upon completion. This can have disasterous
effects when run from the compositor main thread such as complete stalls.

This is a followup to 86a00b6872 which
assumed (like the rest of us) that the fsync() would be performed on the
thread that was doing the I/O operations.

You can verify this with an strace -e fsync and cause terminal to display
a command completed notification (eg: from a backdrop window).

This also fixes a lifecycle bug for the variant, as
g_file_replace_contents_async() does not copy the data during the operation
as that is the responsibility of the caller. Instead, we just use a GBytes
variant and reference the variant there.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1050
2020-02-26 15:33:30 -08:00
Florian Müllner
cc3f439323 calendar-server: Remove unused defines
The file doesn't contain any translatable strings, so the i18n
macros are unused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1016
2020-02-26 22:53:00 +00:00
Christian Hergert
24a3fd4c4d st: implement ClutterActorClass.has_accessible()
Implement ClutterActorClass.has_accessible() to ensure that CallyActor does not
recreate accessibles during the removal/destruction of an actor.  This relies
on GNOME/mutter!1083 for the ClutterActorClass.has_accessible virtual function.

Running GNOME Shell for about 30 seconds results in a difference between
the two runs.

Before:

    ALLOCATED      TOTAL    FUNCTION
[   52.2 KiB] [   0.05%]    cally_actor_real_remove_actor
[   36.3 KiB] [   0.04%]      st_widget_get_accessible
[    9.8 KiB] [   0.01%]      atk_gobject_accessible_for_object
[    3.2 KiB] [   0.00%]      g_signal_emit_by_name
[    2.9 KiB] [   0.00%]      clutter_actor_get_children

After:

    ALLOCATED      TOTAL    FUNCTION
[    1.8 KiB] [   0.00%]    cally_actor_real_remove_actor
[    1.1 KiB] [   0.00%]      clutter_actor_get_children
[  659 bytes] [   0.00%]      g_signal_emit_by_name

Obviously 50KiB isn't a huge savings.

Although fixing things to avoid re-entrancy on destruction can be very useful
from a correctness standpoint.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/2263
2020-02-24 22:20:26 +00:00
Florian Müllner
120b907c33 shell/stack: Ignore hidden children for focus navigation
ShellStack implements custom focus navigation, and will only ever
navigate into its top-most child. That kind of makes sense as long
as that child is actually visible, but not when it is hidden.

Descend into the stack to look for a focusable child instead.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2210
2020-02-24 12:29:44 +00:00
Florian Müllner
574ab04e9f st/texture-cache: Heap-allocate saved scales
Otherwise we end up reading random junk later, with the result that
we fail to evict textures with scaled keys.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2244
2020-02-20 23:06:58 +01:00
Jonas Ådahl
f4f8982825 st/settings: Add API to inhibit animations
There may be situations where we shouldn't enable animations. Make it
possible for the Shell to decide when there are such situations and in
when needed inhibit animations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Ådahl
7220f6d25b shell-util: Add API to check for X11 extensions
Will be used to disable animations when running inside Xvnc. This was
done in gsd-xsettings before.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Dreßler
7c8ed95330 blur-effect: Remove modify_paint_volume vfunc override
If we modify the paint volume to make it larger and include the blur
radius, we should also use the gained size and draw something there.
Since the framebuffers are only the size of the actor to blur, we're not
doing that right now anyway, so remove the vfunc override.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 11:11:02 -03:00
Jonas Dreßler
f351cfa2f7 blur-effect: Use sigma value instead of blur radius
Almost all implementations, including CSS [1] of gaussian blurs use the
sigma/standard deviation value as the input parameter, even if they call
that value "radius". Since using sigma is more correct mathematically
and avoids confusion for people used to other blur implementations, use
that parameter here, too.

[1] https://www.w3.org/TR/filter-effects-1/#funcdef-filter-blur

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 11:10:38 -03:00
Jonas Dreßler
d26bb38be9 blur-effect: Implement incremental calculation of gauss coefficient
Use the shader for linear sampling and incremental calculation of the
gaussian kernel values as it was implemented by Patrick Walton in
webrender.

The sigma value for the blur (the standard deviation) is calculated by
taking the blur radius and dividing it by 3, this value is used by most
implementations of gaussian blurs since it covers a high percentage of
the gaussian shape.

The linear sampling optimization is implemented by skipping every second
texel (i += 2) in the for-loop that's sampling adjacent texels.

https://github.com/servo/webrender/blob/master/webrender/res/cs_blur.glsl
38ec7db6f1

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 11:07:55 -03:00
Jonas Dreßler
b75e61d5c8 blur-effect: Only apply paint opacity once when blurring actor
We don't want to apply the opacity multiple times, because this would
also multiply the opacity we're applying.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
ca35ae4364 blur-effect: Only apply paint opacity to actor blur
We don't want to apply the opacity of the actor when blurring the
background.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
f6fa08fa75 blur-effect: Don't paint background using actor opacity
The background should always be painted fully opaque, the opacity of the
actor does not change the one of the background.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
46f94241eb blur-effect: Use int for opacity override
The opacity override can be -1 if no override is set, so use the
appropriate datatype here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
ea2ddaa9dd blur-effect: Floor downscaled frambuffer sizes
Floor the downscaled size of the new framebuffer to make sure we don't
initialize a framebuffer with a floating point value that might be
interpreted wrong by `cogl_texture_2d_new_with_size` and end up with a
slightly wrong aspect ratio of the framebuffer.

This fixes situations where the widths or heights of downscaled
framebuffers sometimes miss some pixels at the border.

While at it, remove the `downscale_factor` argument from
`setup_projection_matrix` since that function doesn't need the initial
size of the actor anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
b4d491a4d2 blur-effect: Add some more documentation about performance
Explicitly mention that this effect works best for large blur radii and
can be slow if the blurred actor/image is large and not being scaled.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Jonas Dreßler
463dcc6b93 blur-effect: Fix crash when switching to ACTOR mode
The `clear_framebuffer()` function takes a CoglFramebuffer, not a
FramebufferData object.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/991
2020-02-12 14:02:28 +00:00
Sebastian Keller
7287ee3651 texture-cache: Fix invalid reads when storing used resource scales
The used_scales hash table uses g_double_hash and g_double_equal which
try to read a double from the passed pointers. The pointers however were
pointing to a float, leading to an invalid read.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/974
2020-02-06 19:47:24 +00:00
Florian Müllner
fc36837606 st/theme-node: Support "auto" in lengths
This allows resetting a fixed size to the default in a more specific
selector.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/971
2020-02-01 00:22:24 +01:00
Carlos Garnacho
b86ef8cde5 st: Use ClutterSeat to get pointer device
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/760
2020-01-30 17:49:08 +00:00
Carlos Garnacho
bd48b0641f shell: Use ClutterSeat to get pointer device
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/760
2020-01-30 17:49:08 +00:00
Olivier Fourdan
68598f7c0c perf-tool: Allow to run as a Wayland compositor
`gnome-shell-perf-tool` is initially designed to run on X11, using the
`--replace` option which does not work when gnome-shell is a Wayland
compositor.

A solution would be to run `gnome-shell-perf-tool` in place of just
`gnome-shell` to run the entire perf session under Wayland, but the
script `gnome-shell-perf-tool` does not spawn `gnome-shell` as a Wayladn
compositor, so that fails as well.

Add a `--wayland` option to `gnome-shell-perf-tool` so that it can
optionally spawn gnome-shell as a Wayland compositor so the whole perf
tool can be starred from a console with:

```
  $ dbus-run-session -- gnome-shell-perf-tool --wayland
```

Alternatively, for testing purposes, it can also be started nested with:

```
  $ dbus-run-session -- gnome-shell-perf-tool --nested
```

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2139
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/941
2020-01-27 13:43:06 +00:00
Olivier Fourdan
ee7e62c9c8 perf-tool: Spawn perf-tool-helper from gnome-shell
On Wayland, the display server is the Wayland compositor, i.e.
`gnome-shell` itself.

As a result, we cannot spawn `gnome-shell-perf-helper` before
`gnome-shell` is started, as `gnome-shell-perf-helper` needs to connect
to the display server.

So, instead of spawning `gnome-shell-perf-helper` from the perf tool,
start it from `gnome-shell` itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/941
2020-01-27 13:43:06 +00:00
Björn Daase
c61685e617 Revert "recorder: Switch to vp9"
This reverts commit d183f13456.
Switching to the vp9 encoder seemed like a good idea at the time but
unfortunately it also has the major drawback, that it leaks a serious
amount of memory every time it is used. See
https://gitlab.gnome.org/GNOME/gnome-shell/issues/256#note_692743
for more details.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/256
2020-01-24 18:01:45 +00:00
Florian Müllner
d9b3d6745c app: Use better icon for wayland window-backed apps
For window-backed apps (read: windows we can't match to a .desktop
file), we use the window's icon property as icon. However there is
no such property on wayland (at least in the protocols we support),
so we end up with a blank actor in that case.

Do better than that, and pick a generic fallback icon instead.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1779
2020-01-23 18:25:28 +00:00
Jonas Dreßler
c2956e8bd2 st/entry: Notify "text" prop on every change in the ClutterText
Notifying the "text" property inside `st_entry_set_text()` misses all
the text changes done by ClutterText itself, including those that happen
on key-presses. Fix that by notifying that property inside the
"notify::text" handler connected to the ClutterText.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/951
2020-01-23 19:16:59 +01:00
Jonas Dreßler
49170585b3 st/entry: Add css class name to hint-text label
Allow styling the hint text of the entry using css easily.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/944
2020-01-23 17:30:46 +00:00
Jonas Dreßler
88ac339774 st/entry: Show hint actor while entry is focused
Also show the hint actor of an StEntry while the entry is focused but
has no text inside it. This is part of the new dialog and lock-screen
design where there are no labels before entries anymore and labels are
instead shown as a hint-text of the entry.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/944
2020-01-23 17:30:46 +00:00
Sebastian Keller
b49023c31c st/icon: Fix GIcon leak in set_fallback_icon_name
set_fallback_icon_name() leaks a GIcon by using the set_icon method
which adds a ref to the GIcon without removing its own ref after calling
the method.

Related to https://gitlab.gnome.org/GNOME/gnome-shell/issues/2146
2020-01-22 23:34:23 +01:00
Sebastian Keller
6eacbeb203 st/icon: Fix GIcon leak in set_icon_name
set_icon_name() leaks a GIcon by using the set_icon method which adds a
ref to the GIcon without removing its own ref after calling the method.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/2146
2020-01-22 20:20:50 +01:00
Georges Basile Stavracas Neto
479c14c766 st/box-layout: Reimplement as a StViewport subclass
With StViewport doing most of the heavy-lifting, StBoxLayout
can be cleaned up as a StViewport subclass.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/929
2020-01-20 16:15:32 -03:00
Georges Basile Stavracas Neto
56805a4c85 Introduce StViewport
St has the regular abstractions to handle actors that are bigger
than their parent could handle: StScrollable, StScrollView, and
StAdjustment.

However, the only StScrollable implementation available currently
is StBoxLayout, which forces a ClutterBoxLayout as the layout
manager (and relies on it not being unset).

Introduce StViewport, which is a minimal StScrollable implementation
that doesn't rely on any specific layout manager.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/929
2020-01-20 16:15:22 -03:00
Jonas Dreßler
8b15519160 st/icon: Check icon name for empty string in setter function
Don't try to create a GIcon if the given icon name is empty, it will
lead to failure when loading the icon anyway, instead set the gicon to
NULL just as we do in the `set_gicon()` API when unsetting an icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
69a5e89096 st/icon: Use own methods for updating GIcon when setting icon names
Instead of reimplementing the functions to set the GIcon inside the
`set_*_icon_name` functions, just use the already defined methods for
that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
e784afe9ac st/icon: Add API to set the fallback GIcon
Let's support the fallback icon a bit better and allow setting its GIcon
just as we do for the normal icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
8b8d3e28b2 st/icon: Update GtkDoc and annotations
Add missing documentation for some functions and make existing
documentation a bit more precise.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
9b673dc98b st/icon: Use existing method for getting gicon property
We have an existing method for this, let's use it instead of accessing
the private property here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
c0fcf2d3a8 st/icon: Simplify property setting in set_gicon()
We can easily use `g_set_object()` to set the gicon property here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Jonas Dreßler
3b46c3910c st/icon: Reorder header file
The order of the functions is currently quite messy, change the order of
the headers so it makes more sense and correct a wrong argument name
while at it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:44:08 +01:00
Georges Basile Stavracas Neto
e169e5a30a shell/blur-effect: Set float brightness property
The brightness property of ShellBlurEffect is of float type, but
we are calling g_value_set_int() in the GObject::get_property()
handler, which throws warnings when trying to set the property
via g_object_set() and family.

Use g_value_set_float() instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/924
2020-01-09 22:03:55 +00:00
Georges Basile Stavracas Neto
248eb7419e Introduce ShellBlurEffect
This is a moderately fast two-pass gaussian blur implementation.
It downscales the framebuffer dynamically before applying the
gaussian shader, which cuts down rendering time quite considerably.

The blur shader takes 2 uniforms as input: the blur radius; and
whether to blur vertically or horizontally.

The blur radius is treated as an integer in C land to simplify
calculations. The vertical parameter is treated as an integer by
the shader simply due to Cogl not having proper boolean support
in snippets.

At last, brightness is also added to avoid needing to use an extra
effect to achieve that. Brightness is applied in a different pipeline
than blur, so we can control it more tightly.

ShellBlurEffect also implements a "background" mode, where the contents
beneath the actor are blurred, but not the actor itself. This mode is
performance-heavy.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1848

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/864
2020-01-08 15:59:15 -03:00
Florian Müllner
c1d738d60c st/password-entry: Initialize :show-peek-icon property
The icon is shown by default, but the struct member that backs the
property starts out as FALSE.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/910
2019-12-21 04:12:03 +01:00
Florian Müllner
c2609227ff st/password-entry: Fix memory leak
The peek-password icon is currently created twice, whoops.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/910
2019-12-21 04:12:03 +01:00
Florian Müllner
15d74c9cd4 st: Fix generated GLSL dependency
StScrollViewFade depends on st-scroll-view-fade-generated.c, but
that dependency isn't expressed to the build system; we just hope
that the custom target runs before compiling the effect.

Instead, add the generated source to the st target so the dependency
is expressed properly.

(The change from .c to .h is to prevent the file from being both
included and compiled, resulting in a duplicated symbol)

https://bugzilla.gnome.org/show_bug.cgi?id=789937
2019-12-20 21:02:45 +01:00
Florian Müllner
51518d4d96 extensions-tool: Move to a subproject
The gnome-extensions tool code is really independent from the rest of the
code base, and could be used either as part of the gnome-shell build or as
stand-alone project (for example for the extension-ci docker image).

We can actually support both cases by moving the code to a subproject.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/877
2019-12-18 19:13:24 +00:00
Florian Müllner
26dc2a439d build: Remove left-over file
The file was generated when importing gnome-extensions-tool from
a standalone repository. It isn't used by the build system, and
really shouldn't have ended up in the repository at all.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/877
2019-12-18 19:13:24 +00:00
Umang Jain
60721a7c23 StPasswordEntry: Add the peek-password-icon for show/hide passwords
Also introduce a "show-peek-icon" property to enable/disable
the peek-password-icon in the password entry. This is useful
in cases where the peeking the password functionality needs
to be avoided.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
2019-12-17 23:08:43 +01:00
Umang Jain
df230989b1 st-entry: Remove caps-lock feedback warning
This frees the entry's secondary icon that for other uses.
Caps-lock-warning feedback has been moved to be shown in
the various dialogs instead in the password-entries itself.
StPasswordEntry can now use a peek-password icon as the
secondary icon to show/hide the password present in the
entry.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
2019-12-17 23:08:43 +01:00