Commit Graph

2653 Commits

Author SHA1 Message Date
Jonas Ådahl
463000d04d Change all g_memdup() to g_memdup2()
Using g_memdup() is dangerous due to the type of the size argument. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1637>
2021-02-04 20:17:04 +01:00
Robert Mader
e8f46f169c blur-effect: Silence compiler warning
Building with `debugoptimized` throws:
`'paint_opacity' may be used uninitialized in this function`

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1596>
2021-01-26 21:29:57 +01:00
Daniel van Vugt
bbb2f2603a shell/util: Don't compile in unused code when !HAVE_SYSTEMD
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3620
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1588>
2021-01-25 17:09:21 +08:00
Florian Müllner
4ff91aa1ce st/settings: Adjust to moved GSettings schema
Mouse settings moved from gnome-settings-daemon to
gsettings-desktop-schemas, and we missed adjusting
the shell side.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1573>
2021-01-15 16:55:05 +00:00
Florian Müllner
5d65a424a8 st/scroll-view-fade: Don't assume fade area at (0,0)
The shader code currently only accounts for padding for the
bottom and right fades, but not for top and left.

As a result, we only fade the right edge when swiping through app
picker pages, whoops.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1569>
2021-01-14 17:28:01 +01:00
Daniel van Vugt
eefed95fa7 st/private: Don't scale the framebuffer, only the blur pixels
Just as we did before e59069c012.

Callers already ensure the framebuffer is scaled so by scaling a second
time in `_st_create_shadow_pipeline` we actually got resource_scale² which
was visibly incorrect.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3505,
       https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3560

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1543>
2021-01-07 15:35:55 +08:00
Ivan Molodetskikh
b51be0e389 st/texture-cache: Move icon theme lookup out of the hot path
It was showing up on profile traces over at
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1547#note_996417
After this change it no longer does.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1558>
2021-01-05 16:50:59 +03:00
Ivan Molodetskikh
e73204b9fa st/texture-cache: Make key g_autofree
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1558>
2021-01-05 16:50:59 +03:00
Sebastian Keller
b3d57dc4bd calendar-server: Remove unused functions
These have been unused since tasks support was dropped when the calendar
integration was moved out of process in e9e30138. GCC did not complain
about this, because the functions were inlined.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1557>
2020-12-30 11:01:44 +01:00
LuK1337
1989a2f9f9 screenshot: Grab screenshot during paint on X11 for area type too
Turns out that shell_screenshot_screenshot_area was affected
by the same issue that shell_screenshot_screenshot used to have.
Adapting code changes from commit id c09be8b0:
"screenshot: Grab screenshot during paint on X11" fixes it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1549>
2020-12-27 22:17:48 +00:00
Sebastian Keller
087bd863b3 shell/network-agent: Add method to add VPN secrets to agent response
While most secrets are serialized as individual settings with a string
value, all VPN secrets are serialized together as a string dict which is
the value of a single setting. Incorrect serialization causes VPN
secrets to not be remembered by NetworkManager.

This commit adds a new method that allows adding secrets as VPN secrets
specifically such that they can be correctly serialized.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1535>
2020-12-25 11:43:13 +01:00
Sebastian Keller
f0deb03bd4 shell/network-agent: Fix setting leak in get_secrets_keyring_cb
The setting GVariant was not consumed by anything in the VPN case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1535>
2020-12-25 11:43:13 +01:00
Jonas Dreßler
fc1d1e5362 st/widget: Switch to the new API to get actor from inputdevice
clutter_input_device_get_actor() was removed in favour of
clutter_stage_get_device_actor(), so use that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1537>
2020-12-18 15:21:29 +01:00
Georges Basile Stavracas Neto
fe90da82b4 st: Rename and fix blur sampling calculation
What the blur shader does is going n_steps in each direction (e.g. in case
we're in the horizontal pass that means left and right direction), sampling
the adjacent texels of the texel we're currently blurring. That means
n_steps actually is the amount of texels we're sampling in one direction,
not in both directions.

Make n_steps match what the blur shader does, and rename it to sampling_radius
to match what it really means. Do that for both st-theme-node-drawing.c and
st-private.c

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1542>
2020-12-17 11:39:38 -03:00
Georges Basile Stavracas Neto
ec1b099017 st: Fix painting unblurred texture
ClutterActorBox encapsulates (x1, y1, x2, y2), but the
second pair of values to the texture node are width and
height, leading to incorrectly rendering the unblurred
texture.

Fix that by properly making these values be x2 and y2.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1542>
2020-12-17 11:15:05 -03:00
Georges Basile Stavracas Neto
e59069c012 st: Use blur node to render shadow pipeline
It is generally faster than downloading the texture, blurring
with the CPU, and uploading the blurred texture. Notice that
'n_values' is calculated differently from the blur_pixels()
function; that's because it needs to match Clutter's blur
shader interpretation of sigma [1].

[1] https://gitlab.gnome.org/GNOME/mutter/-/blob/master/clutter/clutter/clutter-blur.c#L89

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1539>
2020-12-15 17:43:20 -03:00
Georges Basile Stavracas Neto
80a5b55a7a shell: Adapt to ClutterEffect vfunc changes
Add the new ClutterPaintNode argument to the vfuncs. No other
change is needed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1350>
2020-12-15 15:38:43 +00:00
Georges Basile Stavracas Neto
534f74b065 st/scroll-view-fade: Adapt to paint_target() API changes
It now receives a ClutterPaintNode to paint on. Fortunately,
StScrollViewFade doesn't do any drawing itself, so no changes
are needed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1350>
2020-12-15 15:38:43 +00:00
Georges Basile Stavracas Neto
715d39870d invert-lightness-effect: Switch to create_pipeline vfunc
Pretty much the exact same changes of the previous commit, applied
to the ShellInvertLightnessEffect subclass.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1350>
2020-12-15 15:38:43 +00:00
Georges Basile Stavracas Neto
99935c746a glsl-effect: Switch to create_pipeline vfunc
This new ClutterOffscreenEffect vastly simplifies subclasses
by allowing them to hand the parent class a CoglPipeline to
use.

Override the create_pipeline() vfunc and return the (cached)
pipeline. Remove the paint_target() override and the now
unnecessary texture size fields from the structure.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1350>
2020-12-15 15:38:43 +00:00
Jonas Ådahl
c09be8b0a9 screenshot: Grab screenshot during paint on X11
We might not be able to directly paint the stage to an offscreen, if
there currently is a fullscreen unredirected window. To make it possible
to take a screenshot in this situation, disable unredirecting, queue a
frame, and take a screenshot after having painted that frame, before we
go back being unredirected.

Don't do this on Wayland because it's a waste.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1453
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1534>
2020-12-14 15:21:03 +01:00
Georges Basile Stavracas Neto
f7019bdd0d blur-effect: Use ClutterBlurNode
With ClutterBlurNode available, we can remove our own implementation
and delegate the blur shader and framebuffers. This simply replaces
the pair of layer nodes (vblur and hblur) with a ClutterBlurNode,
and removes all dead code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1528>
2020-12-14 13:32:49 +00:00
Georges Basile Stavracas Neto
71807a4f10 blur-effect: Port to paint nodes
Port the blur effect to the new ClutterEffect.paint_node() vfunc.
Update the function names to match what they do, e.g. "apply_blur()"
now creates the blur subtree and thus was appropriately renamed to
"create_blur_nodes()".

There are 3 subtrees that can be generated by the blur effect:

 1. Actor mode (full subtree; no cache)

      Root
       |
       |
    Layer (brightness)
       |
    Layer (horizontal blur)
       |
    Layer (vertical blur)
       |
    Layer (actor)
       |
    Transform (downscale)
       |
     Actor

 2. Actor mode (partial subtree; cached contents)

      Root
       |
     Pipeline
  (final result)

 3. Background mode

      Root
       |-----------------------
       |                       |
    Layer (brightness)        Actor
       |
    Layer (horizontal blur)
       |
    Layer (vertical blur)
       |
    Layer (background)
       |
      Blit

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1339>
2020-12-10 16:15:49 +00:00
Jonas Ådahl
4e57119f40 st/viewport: Don't trigger relayout when picking
Calling clutter_actor_get_allocation_box() might still implicitly
trigger a full relayout, which has many side effects not expected to
occur during picking. Avoid a particular case which caused a reentry
issue by using the current allocation instead of forcing a relayout when
picking in StViewport.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1436
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1527>
2020-12-09 22:09:39 +01:00
Florian Müllner
cb8b19939d magnifier: Stop exposing D-Bus interface
Screen magnification is the compositor's business, not that of "random"
unprivileged tools. And for cases where a more specialised behavior is
wanted, an extension likely does a better job than a consumer of the
D-Bus API.

In addition to that, exporting the interface has been broken for an
unknown time, because the object that holds the implementation isn't
referenced and thus ends up being garbage collected, whoops.

And last but not least, this gets rid of the last public D-Bus name
that isn't clearly in the system namespace (org.gnome.Shell,
org.gnome.Mutter, org.gtk).

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1523>
2020-12-06 06:18:07 +01:00
Florian Müllner
f54ab9c9ee main: Stop owning the org.gnome.Panel name
This is a relict from the pre-3.0 days, when it was common to
replace a running GNOME 2 session with gnome-shell. There has
been no good reason to claim the name for many years, time to
drop it.

If someone really wants to run gnome-panel alongside the shell,
they probably know what they are doing. Or cannot be helped anyway.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1521>
2020-12-04 22:02:55 +01:00
Daniel van Vugt
5492309755 st-theme-node-drawing: Render all shadow sections with thickness > 0
In some styles the top or left sections of box-shadows would go missing
even though they had non-zero thickness. This was because the inner
local coordinates could become very slightly negative and were then
incorrectly judged to be invisible.

Negative coordinates should not be ignored because that's where the
entire top/left sections of shadow are meant to exist. It's only the
sections of shadow with zero thickness that we should skip.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1417>
2020-12-02 00:01:30 +01:00
Daniel van Vugt
244c266c9f st-bin: Disallow st_bin_set_child with already-parented children
Not checking for this would result in `clutter_actor_add_child`
failing, but StBin keeping a copy in `priv->child`. So later on,
`st_bin_remove` would never be called on it and this assertion
would fail and crash the whole shell:

```
static void
st_bin_destroy (ClutterActor *actor)
{
  StBinPrivate *priv = st_bin_get_instance_private (ST_BIN (actor));

  if (priv->child)
    clutter_actor_destroy (priv->child);
  g_assert (priv->child == NULL);

```

By disallowing spurious `st_bin_set_child` calls we now prevent StBin
from entering such a corrupt state and the above assertion won't fail
anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1507>
2020-11-26 13:47:11 +01:00
Sebastian Keller
330b44ede5 st/button: Remove unused spacing member from private struct
It is only ever written, but never used anywhere.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1489>
2020-11-18 21:26:53 +01:00
Sebastian Keller
237e470238 st/entry: Don't set font twice on style changes
Setting the font is already handled by _st_set_text_from_style() since
be76b19300.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1489>
2020-11-18 21:26:53 +01:00
Georges Basile Stavracas Neto
69516a52c6 Adapt to pick changes
It turns out, StViewport's pick implementation was broken, since
Clutter stopped reading clipping from the framebuffer. Rejoice with
bugfixing by removing code!

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1470
2020-10-26 13:34:40 +00:00
Robert Mader
22f691939c Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues
with valgrind and potentially hides memory corruption.
Lets stop using it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1473
2020-10-19 20:18:11 +02:00
Florian Müllner
d72da7d246 screenshot: Handle window screenshot failures gracefully
meta_window_actor_get_image() may return NULL. Instead of crashing,
catch that case and return a proper error.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3258
2020-10-19 15:00:04 +00:00
Jonas Ådahl
bd710ff4fd Adapt to CoglFramebuffers turning into GObjects
Requires some more explicit type casting as things turned into 'void *'
less. Also memory management changes, as we can't use CoglObject
functions anymore for these objects.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1465
2020-10-16 16:18:48 +00:00
Carlos Garnacho
ff6c0ca68c shell: Update to MetaCursorTracker API change
The pointer coordinates in meta_cursor_tracker_get_pointer() are now
returned as a graphene_point_t.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1405
2020-10-06 18:17:30 +02:00
Georges Basile Stavracas Neto
2321ce2864 Replace CoglMatrix by graphene_matrix_t
Replace both the types, and the cogl_matrix_* API calls
with the corresponding graphene_matrix_* ones.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1436
2020-10-06 11:00:36 -03:00
Carlos Garnacho
daa3ddac94 shell: Do not use stack-allocated ClutterEvents
All events should be allocated.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1451
2020-09-30 22:47:11 +02:00
Florian Müllner
76b03647b3 st/entry: Only handle primary/secondary icon clicks when reactive
Just like the internal ClutterText, the icon actors are part of the
entry. It therefore makes sense for the icons to not react to clicks
when the entry itself is non-reactive; again, just like the text.

That behavior is also consistent with icons in GTK entries.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3138
2020-09-21 22:51:48 +02:00
Andy Holmes
ee3eaf0c0e StAdjustment: note when 'changed' is not emitted
Like `GtkAdjustment`, `StAdjustment:changed` is not emitted for the
`value` property except when changed with `st_adjustment_set_values()`.

Note this behaviour in the signal documentation

closes https://gitlab.gnome.org/GNOME/gnome-shell/issues/3147
2020-09-07 15:58:14 -07:00
Björn Daase
2fc6384bca *: Fix spelling mistakes found by codespell
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1416
2020-08-21 18:25:09 +00:00
Florian Müllner
923d926345 st: Remove invalid introspection annotation
(optional) is only valid for (out) or (inout) parameters (that are
marked as such).

However GError** arguments appear as throws="1" in the GIR anyway
instead of an explicit parameter, so we don't need any annotation
at all here.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1408
2020-08-13 22:44:45 +00:00
Florian Müllner
3c6f59ae6d st: Fix typo in doc comment
Spotted by g-ir-scanner.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1408
2020-08-13 22:44:44 +00:00
Jonas Ådahl
beddbc0583 st/test-theme: Use stage from mutter
Clutter application style stages not supported anymore.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1359
2020-08-13 12:46:22 +00:00
Michael Catanzaro
44cbd1e718 libcroco: Limit recursion in block and any productions (CVE-2020-12825)
If we don't have any limits, we can recurse forever and overflow the
stack.

This is per https://gitlab.gnome.org/Archive/libcroco/-/issues/8

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1404
2020-08-12 15:06:27 -05:00
Florian Müllner
1029e683d3 perf-tool: Expose --x11 option
Running with the X11 backend is no longer as easy as not specifying
wayland, so expose mutter's --x11 option to allow enforcing the X11
backend for testing.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1396
2020-08-12 15:43:38 +00:00
Andy Holmes
9168f6055e St Documentation: add and improve documentation for public classes
Much of St is undocumented, aside from input/output arguments. This is
no doubt because a lot of it parallels Gtk closely, but is worth
improving since many new programmers are not familiar with Gtk.

closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2983
2020-08-08 11:26:41 +00:00
Jonas Ådahl
757e4b6731 shell-screenshot: Change to use clutter_stage_paint_to*() API
This eliminates the need to wait for redraws, drawing cursors, and
stiching together cairo images in case the screenshot covers multiple
monitors.

All of that is now handled by mutter itself.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1383
2020-08-06 16:26:59 +00:00
Jonas Dreßler
18155fc6ea st/private: Multiply position in fb coordinates with resource scale
The framebuffer we use for rendering shadows is scaled by the resource
scale, that means we also need to offset coordinates when translating
them to the framebuffers coordinate system.

So far we forgot to do that when translating the framebuffer using the
position of the actor, which lead to small rendering bugs of
text-shadows for actors allocated at non-zero origins. To fix that,
simply multiply those positions with the actors resource scale.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1390
2020-08-03 21:57:50 +00:00
Benjamin Berg
01a927f388 windowManager: Wait for X11 services using systemd
To do this, we now wait for the start/stop job to complete. We also have
two targets in gnome-session to ensure that everything is working as
expected.

In order to start the services, we simply request the
gnome-session-x11-services-ready.target unit, and wait for it to become
available. To stop, we use the gnome-session-x11-services.target unit
which should stop all services in a way that is entirely race free.

This requires both gnome-session and gnome-settings-daemon changes to
work (which are in the corresponding merge requests).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/895
2020-07-31 13:53:31 +00:00
Jonas Ådahl
2b0731ab81 Move screencasting into a separate service process
Move the screencasting into a separate D-Bus service process, using
PipeWire instead of Clutter API. The service is implemented in
Javascript using the dbusService.js helper, and implements the same API
as was done by screencast.js and the corresponding C code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1372
2020-07-31 10:51:12 +02:00
Daniel García Moreno
71d37bffdf util: Remove shell_util_get_transformed_allocation
This helper function could be replaced with the new
clutter_actor_get_transformed_extents, that does the same.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1380
2020-07-29 18:09:53 +02:00
Sebastian Keller
f50205e9b4 calendar-server: Remove delay before event emission
The timeout seems to have been carried over from the old code that
relied on gnome-shell calling 'GetEvents' after every 'Changed' signal
where it was used to throttle the signal. In the new code where
calendar-server is sending the changes themselves via signals this is no
longer necessary and actually causes a delay when switching between
months.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2992
2020-07-20 13:50:21 +02:00
Jonas Ådahl
95bb194356 layout: Remove redundant background refresh
When using the NVIDIA driver, textures tend to loose their pixels when
suspending. In the past we handled this by figuring out when the NVIDIA
driver was used, and reload the background whenever we noticed we
resumed from suspend.

This shouldn't be needed anymore after
https://gitlab.gnome.org/GNOME/mutter/merge_requests/600, as it should
handle this by listening to video-memory-purged signal. Thus remove our
special handling here.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1358
2020-07-14 23:14:39 +00:00
Florian Müllner
0ad242a81e shell/window-tracker: Tighten sandbox ID prefix check
Since commit b60836932 we only allow WM_CLASS matches for sandboxed
applications if the found app's ID is prefixed by the sandbox ID.

The existing check still has a hole in it though: "org.example.Foo"
and "org.example.FooDevel" are different applications, yet the former
is a prefix of the latter.

So tighten the check by including a trailing "." in the checked prefix;
this excludes cases like the above, while still working for the regular
case of a single .desktop file because our app IDs include the ".desktop"
suffix.

Spotted by wjt.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1357
2020-07-08 12:23:10 +02:00
Florian Müllner
f29dbd1f18 shell/window-tracker: Match on WM_CLASS first
Currently our heuristics for matching a window to its app check
for the application ID before the WM_CLASS, as the ID is more
reliable in so far that it is outside the application's control
and so it cannot use it to spoof a different application.

However this also prevents applications with multiple .desktop
files like LibreOffice from matching any .desktop files other
than the one under the main ID.

Since we now no longer allow the WM_CLASS to match a .desktop
file that doesn't belong to the sandboxed application, we can
fix that issue by checking the WM_CLASS first, without opening
the door to spoofing.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/219
2020-07-06 14:59:51 +00:00
Florian Müllner
b60836932a shell/window-tracker: Enforce prefix for sandboxed applications
At least flatpak (no idea about snap, sorry) enforces that all .desktop
files exported by a sandboxed app use the application ID as prefix.

Add the same check when trying to find a match based on the WM_CLASS,
to prevent sandboxed apps from matching a .desktop file they do not
own.

At the moment this is unlikely as we check for a match on the
sandboxed app ID first, but we are about to change that.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/219
2020-07-06 14:59:51 +00:00
Florian Müllner
bf47d1b22d shell/window-tracker: Minor simplification
Switching to autocleanup gives us a better separation between the
app/no-app cases.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/219
2020-07-06 14:59:51 +00:00
Jonas Ådahl
5ea54426b9 st/adjustment: Add ::actor property
Will be used by transitions to set the timeline actor.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1299
2020-07-02 20:50:03 +00:00
Jonas Ådahl
4aabcd9e7d shell/global: Adapt to after-paint signal type signature
A stage view parameter was added.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1299
2020-07-02 20:50:03 +00:00
Jonas Ådahl
918b3eeb42 st/theme-node-transition: Pass actor when constructing timeline
Timelines now take an actor, to be able to derive an appropriate frame
clock, so pass the one of the actor we're transitioning on.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1299
2020-07-02 20:50:03 +00:00
Florian Müllner
86b5a43008 shell/app: Add new get_icon() method
Now that we can always associate a GIcon with the app, add a method
to access it. While create_icon_texture() is still likely to be more
convenient in most cases, exposing the icon can still be useful, for
example to add it to a different kind of actor or to compare it with
other GIcons.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1342
2020-07-01 12:42:57 +02:00
Florian Müllner
d7cb2eeebc st/texture-cache: Return a GIcon from bind_cairo_surface_property()
We still load the surface into an StImageContent, but instead of
adding the content to an actor we hand out, return the content
itself (as GIcon).

That means we lose the ability to specify an icon size, but as we
get the pixel data from a fixed-size surface anyway, that shouldn't
matter much in practice.

Not to mention that the function is only used for fallback X11 icons,
which are already shit more often than not.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1342
2020-07-01 12:42:57 +02:00
Florian Müllner
770231c2d7 st/image-content: Implement GIcon interface
On the one hand, this is a bit of a stretch: StImageContent is what
we create from GIcons.

But on the other hand, there's some justification: StImageContent does
represent an image (and likely icon) after all, and there's some
precedent with GdkPixbuf.

In the end as we don't care about serialization or loading from other
API, we can go with a very crude implementation that allows us to
pass out a content as GIcon and use it directly when "loading" it.

We will use that soon to represent X11 window icons as GIcons, which
in turn will allow us to unify app icon handling.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1342
2020-07-01 12:42:57 +02:00
Jonas Dreßler
ecdf62d63e st/viewport: Invalidate transform when it changes
Since ClutterActor now caches the whole transformation matrix for an
actor, we need to invalidate the cached transform if the matrix returned
by apply_transform() implementations changes.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1308
2020-06-30 19:17:58 +02:00
Jonas Dreßler
d885486397 st/widget: Remove get_resource_scale function
ClutterActor provides the same function, but with a different return
value. So since we already switched to the ClutterActor implementation
in our C code, we can now safely remove st_widget_get_resource_scale()
and update the JS code that's still using the old API.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1287
2020-06-30 13:42:18 +00:00
Jonas Dreßler
1524abc947 Switch to ClutterActors resource-scale-changed signal
Instead of using the "notify::resource-scale" signal and StWidgets
"resource-scale-changed" signal, use the new "resource-scale-changed"
signal of ClutterActor, which replaces its "resource-scale" property.

Since we'd now have two "resource-scale-changed" signals, one on
ClutterActor and one on StWidget, remove the StWidget one in favour of
the new one.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1287
2020-06-30 13:42:18 +00:00
Jonas Dreßler
cb9842e4a4 Use new clutter_actor_get_resource_scale() API
Update the existing users of clutter_actor_get_resource_scale() to the
new API which doesn't return a boolean value.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1287
2020-06-30 13:42:18 +00:00
Florian Müllner
481014ac9e st/viewport: Only extend child allocation when scrolled
When scrolled, the container's allocation is smaller than the allocation
of the content. To account for that, commit 2717ca9d08 added the
additional size reported by the layout manager to the content allocation.

However as it did so unconditionally, we now allow children to extend
outside the parent even when *not* scrolled, which breaks any constraints
set on the container (like "width" or "max-height").

Fix this by only extending the child allocation in scrollable dimensions.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2491
2020-06-29 00:42:03 +02:00
Georges Basile Stavracas Neto
c1f06daf88 st/tests: Replace ClutterGroup by ClutterActor
ClutterGroup is deprecated and can be 1:1 replaced by ClutterActor,
so let's do it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1334
2020-06-26 21:03:57 +00:00
Daniel van Vugt
ae338af1e8 st-label: Keep labels fully pre-rendered on the GPU
The performance of the icon grid was being hindered by a large number
of primitives (a few hundred) being copied from the CPU to the GPU on
each frame. This was first noticed in mutter#971 but we failed to
investigate all the issues at the time.

You can also see the high number using `COGL_DEBUG=batching` or
`COGL_DEBUG=disable-texturing`. So now it's obvious that high number is
every letter of every label being uploaded as a separate quad. Let's not
do that and instead treat the whole label as a single quad/texture.

Measured performance on an i7-7700 at UHD 3840x2160:

Journal entries per frame on the icon grid:
 * Before: 288 (18 KB copied from CPU to GPU)
 * After:   73 ( 4 KB copied from CPU to GPU)

Spring animation:
 * Before: 20-30 FPS, avg 22/peak 45 milliseconds per frame
 * After:  30-40 FPS, avg 14/peak 28 milliseconds per frame

Scrolling the icon grid:
 * Before: 15 FPS, 50 milliseconds per frame
 * After:  30 FPS, 28 milliseconds per frame

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1329
2020-06-25 09:09:36 +00:00
Carlos Garnacho
ec36762309 st: Add st_clipboard_get_content()
Complementing st_clipboard_set_content(), this function allows retrieving
specific mimetypes from the selection as GBytes.

Related: https://gitlab.gnome.org/GNOME/nautilus/-/issues/634

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1321
2020-06-19 13:44:15 +02:00
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