Commit Graph

2870 Commits

Author SHA1 Message Date
Florian Müllner
7250d9dea3 main: Add missing newlines
Unlike the various log macros, g_printerr() does not append '\n'
by itself.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2709>
2023-03-20 19:20:15 +01:00
Marco Trevisan (Treviño)
5bccd35906 tests: Add default test setup with common env settings
Add common test environment variables to a default test setup so that they
don't need to be repeated everywhere.

Also ensures that we're always using the gsettings memory backend to never
interfere with local environment.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2661>
2023-03-19 19:40:27 +00:00
Marco Trevisan (Treviño)
20a81d7866 na-xembed: Do not use same coordinates of mutter offscreen windows
We created the socket window using the same coordinates that mutter uses
for its own off-screen windows created via
meta_x11_display_create_offscreen_window() and that are filtered out in
MetaWindowX11's is_our_xwindow().

This caused these windows to be never tracked by mutter and then we
never received a "::window-created" signal that should lead a ShellTrayIcon
to associate itself as the clone of the created MetaWindow.

So, still keep it offscreen, but at different location.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2684>
2023-03-19 12:19:45 +00:00
Florian Müllner
02fc765baa st/icon-theme: Remove unnecessary CLAMP()
The ClutterColor struct members are 8-bit unsigned integers, so
they are always in the 0 to 255 range.

Spotted by coverity.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2679>
2023-03-19 11:51:01 +00:00
Florian Müllner
74c5bb270d st: Stop implementing custom refcounting
Glib has generic RcBox/ArcBox types nowadays that can be used to
add ref-counting to a plain struct types, use those instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2679>
2023-03-19 11:51:01 +00:00
Andy Holmes
e1faadf0d0 shell: Configure Shell to match its namespace version to Mutter
Shell has been stuck at version 0.1, which makes it difficult to
version	API documentation.

Configure it to	build with the same namespace version as
Mutter,	so documentation and API changes can be	tracked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2674>
2023-03-06 00:18:17 +00:00
Andy Holmes
62fac1ec24 st: Configure St to match its namespace version to Mutter
St has been stuck at version 1.0, which makes it difficult to
version API documentation.

Configure it to build with the same namespace version as
Mutter, so documentation and API changes can be tracked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2674>
2023-03-06 00:18:17 +00:00
Florian Müllner
0e0453a1a2 st/icon-theme: Initialize current theme
We currently only read the configured theme on changes, so we end
up always using the default theme initially, whoops.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2675>
2023-03-05 15:14:14 +01:00
Florian Müllner
a9b38ebd66 build: Add missing include
GdkPixbuf now appears in public API, so must be included.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2673>
2023-03-05 10:41:53 +00:00
Carlos Garnacho
8067065687 tray: Ensure tray children are disposed when unmanaging tray
These might survive, trigger signals and crashes. Dispose the
tray children and disconnect any remaining signals in order to
avoid that.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6465
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2669>
2023-03-05 09:12:53 +00:00
Florian Müllner
67facb8975 st: Introspect StIconTheme
StIconTheme was added as a private implementation detail of
StTextureCache, but it turns out that some extensions do
make heavy use of GtkIconTheme.

Allow them to port away from GTK by exposing StIconTheme to
introspection.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2671>
2023-03-04 20:17:04 +00:00
Carlos Garnacho
656efd33af Update to drop GTK3 dependency
There's a few things going on here, that unfortunately must
happen in lockstep:

- The gnome-desktop-3.0 dependency gets replaced by gnome-desktop-4
  and gnome-bg-4. The code in ui/background.js required minor updates.
- The libnma dependency gets replaced by a libnma4 dependency. The
  code in misc/modemManager.js required minor updates.
- The gtk3 dependency is torn down everywhere but tests. Some
  missing GdkPixbuf dependencies had to be added to compensate for
  its lack.
- gtk_init_check() is no longer called

As a result, we replace a hard gtk3 dependency with a soft gtk4
run-time linking one, only added indirectly through gnome-bg-4
and libnma4.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
1a06d93e95 shell: Avoid use of gdk_pixbuf_get_from_surface()
Unlike one might think, this function does not come from
GdkPixbuf but GDK. Also adopt this conversion code between
surface formats.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
d3545a3b53 st: Drop usage of gdk_cairo_set_source_pixbuf()
Avoid using it by... guess it... yes! Copying the function
into an utility. This helper function to convert between
pixel formats is quite self-contained and unrelated to the
rest of GTK, so may be copied in place.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
32eff6bbde shell: Drop unnecessary gtk header includes
These have survived the	code changes that made the
various GTK helpers and enums unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
bb54a32d1c st: Drop unnecessary gtk header includes
These have survived the code changes that made the
various GTK helpers and enums unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
def818fd31 shell: Add missing gdkpixbuf dependency to run-test-js
This executable only got the dependency indirectly through
mutter linking to GTK3. When that is gone this dependency will
be missing, so add it explicitly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00
Carlos Garnacho
3716deaa42 shell: Move tray icon event emulation to NaTrayChild
Just so that all X11 fiddling stays within src/tray.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2590>
2023-03-03 13:34:44 +00:00
Carlos Garnacho
b8e3f5a536 shell: Move _NET_WM_PID query to NaTrayChild
It already does some other poking on the plug window, it
can do this as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2590>
2023-03-03 13:34:44 +00:00
Carlos Garnacho
ab60902058 shell: Move tray implementation away from GtkSocket
Reimplement tray icon support on top of NaXembed. NaTrayIcon now
becomes a subclass of this type, replacing GtkSocket. The
ShellTrayIcon wrapper now embeds directly a NaTrayIcon, the
ShellEmbeddedWindow GTK widget and ShellGtkEmbed ClutterClone
objects are no longer necessary to wrap a NaXembed socket window.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2590>
2023-03-03 13:34:44 +00:00
Carlos Garnacho
f9519f4a55 tray: Add NaXembed object
This GObject subclass is a minimal wrapper similar to GtkSocket,
meant to replace the GTK widgetry involved in the tray manager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2590>
2023-03-03 13:34:44 +00:00
Florian Müllner
628866f7d2 shell/app: Also make recent when raising other windows
Mutter no longer picks the next focus window based on the stacking
order, but on the active workspace's MRU list. So to keep the old
activating behavior, raising other windows is no longer enough.

Use the newly added raise_and_make_recent() method to also move the
window to the front of the MRU list.

https://gitlab.gnome.org/GNOME/mutter/-/issues/2540

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2659>
2023-02-23 20:45:31 +01:00
Florian Müllner
661356766b dateMenu: Use desktop action to open Evolution calendar
We include a private hidden .desktop file for evolution's calendar
component, so that we can explicitly open that component when
evolution is configured as the default calendar application.

That's because the evolution developers didn't want to ship
additional .desktop files at the time, but they have since
then included a desktop action that can be used for the same
purpose.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2479>
2023-02-12 20:14:02 +00:00
Carlos Garnacho
41c91c7a3b window-tracker: Only emit ::tracked-windows-changed on title changes
Since commit a1d650ce27, window title changes are listened for in the
ShellWindowTracker in order to emit ::tracked-windows-changed when
there are window title changes.

The rest of the things that happen in between (removing the window
from a ShellApp, possibly have it destroyed, and possibly creating a
new ShellApp to re-insert the window) are superfluous and even result
in the altTab switcher popup ending up confused about the applications
available.

Only emit the signal so changes can be followed on D-Bus, but avoid
the ShellApp fiddling otherwise.

Fixes: a1d650ce27 - window-tracker: Emit 'tracked-windows-changed' on title changes

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6385
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2634>
2023-02-10 15:12:08 +01:00
Jonas Dreßler
bd202c1847 Add ClutterFrame arguments to after-paint signal handlers
The ClutterFrame argument was added to several signals with mutter commit
08b0e563d4d0088e19d24f3199626a2d27349d09. We have a bunch of after-paint
handlers in gnome-shell too, and updating those was apparently forgotten,
introducing subtle memory corruption that was luckily easy to track down by
running gnome-shell with ASAN enabled. Let's fix that and add the additional
argument to all the signal handlers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2629>
2023-02-08 16:27:48 +00:00
Sebastian Wick
4c8648fb59 st/test-theme: Use the gsettings memory backend
Mutter test context now make sure that they are run with the gsettings
memory backend to avoid the local environment to affect the tests.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2628>
2023-02-08 16:48:35 +01:00
Jonas Ådahl
644dd90785 perf-tool: Add --hotplug option
The --hotplug option works together with --headless and makes the perf
tool not add a persistant virtual monitor, allowing the perf test
themselves able to handle monitors.

This is needed for hotplug tests.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2623>
2023-02-06 18:10:01 +00:00
Florian Müllner
e86a0b32c2 croco: Use g_string_free() return value
glib now warns if the return value is not used, so use the API as
intended instead of assigning the character data separately before
freeing the GString.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2625>
2023-02-03 14:54:59 +00:00
Florian Müllner
e12a0443e9 st/texture-cache: Port to StIconTheme
It's finally time to pull the switch and replace GtkIconTheme with
out modified copy. This removes another Gtk dependency that ties
us to the old Gtk3.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
69caefc541 st/icon-theme: Stop using GdkRGBA for coloring symbolics
We already have ClutterColor to represent a color, and StIconColors
to hold color information for symbolics from CSS. Now that we moved
GtkIconTheme in-tree, we can make use of those types instead of
translating back and forth from GdkRGBA.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
bf00a7957b st/icon-theme: Change namespace to ST
We are still linking to GTK, and extensions may import GTK for
whatever reason, so avoid conflicts by moving the copied GTK
code into our namespace.

With that and the previous adjustments, the new code is now
finally buildable.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
934faaacef st/icon-theme: Start using g_autofree
We don't have to refrain from g_auto for compatibility reasons,
so start using it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
c908e220db st/icon-theme: Replace slice allocator
Its use has been discouraged for years, and glib recently deprecated
it officially (while turning it around a small wrapper around malloc).

Don't let it sneak back in through some old GTK3 code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
b10a0ec45b st/icon-theme: Replace g_get_current_time ()
GTimeVal has been deprecated a while ago, don't let it sneak back
in via some old GTK code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
d65de0df60 st/icon-theme: Use standard GObject macros
The GTK code predates the G_DECLARE_*() macros, so it's under- standable
that it still does all the boilerplate manually. We
don't have that excuse in 2023, so move the the standard macros.

There is no reason for GtkIconTheme to be derivable, and as that
means that the instance struct itself is private, stop adding
separate private instance data.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
bdd14e3431 st/icon-theme: Replace GTK's custom i18n support
GTK uses its own private i18n header, which most notably defines
an I_() macro for interning static strings. That may be a worthwhile
idea for the entire codebase, but as it's out of scope for this
change set, just use the standard i18n support from glib for now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
0c3ce595b9 st/icon-theme: Remove GdkScreen/GtkStyleContext integration
Those are GTK internals that don't apply to us. Without the distinct
"screen's default icon theme", we also don't need custom theme support,
and can just always track the theme from StSettings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
57f67224bb st/icon-theme: Remove deprecated API
We aren't subject to GTK3's API stability, so there's no reason
for dragging old stuff along.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
5e44e2f3cd st/icon-theme: Replace GTK debug code
We won't copy GTK's debug logging, so either remove messages or
turn them into reglar g_debug() calls.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
0919932f4b st/icon-theme: Remove Win32 compatibility
gnome-shell does not run on Windows, and if someone was crazy enough
to try to make it work, the icon theme support would be the least
of their worries.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
88b26996ec st/icon-theme: Standard types
The GTK code dates back to a time when "gchar" and friends were
still considered a good idea. Replace them with standard types
except for "guint" (I'm lazy) and GtkIconCache code that relies
on glib's byte order macros.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
3dc3170f92 st/icon-theme: Use regular idle source over gdk_threads
The shell code isn't threaded, so there's no reason for pulling
in Gdk's thread support.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
8d2e40f8bd st/icon-theme: Define default icon theme
In GTK, the value comes from another private header. It doesn't
make sense to copy it in its entirety, just define the one value
we actually need ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
ace40b625f st/icon-theme: Remove unused header
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
6607bf0928 st/icon-theme: Merge private header
GtkIconTheme's headers are split between a public and a private
one. We won't expose the icon theme API at all, nor do we need
to access anything beyond what the texture cache is currently
using, so merge the private header into the implementation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
b9280b0f39 st/icon-theme: Copy GdkPixbuf utility code
GTK includes a couple of shared private GdkPixbuf utilities
functions. We don't have a need for sharing that code, just
for the bits that are used by the IconTheme code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
93319e7c11 st/icon-theme: Copy GTK3 code in-tree
GTK4 changed icon loading significantly, it is now closely tied
to snapshots and paintables. This makes a port highly unrealistic,
so to avoid staying stuck on GTK3 forever, copy the relevant code
into the tree.

The code is unmodified except for the include names and replacing
some stray tab indentation. It is still full of GTK internals, so
it will take a while before we can actually build it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
83d427fc2b st/texture-cache: Remove unused struct member
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
2023-02-02 20:45:06 +00:00
Florian Müllner
888a0ad623 shell/window-preview-layout: Add precondition checks
It's good practice to guard public API against programmer errors,
so do that.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2622>
2023-02-02 19:56:08 +00:00
Florian Müllner
1993f362d2 shell/window-preview-layout: Mark return value as nullable
The function may return null, so we should mark it as such, even
if that information is currently unused.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2622>
2023-02-02 19:56:08 +00:00
Jonas Ådahl
9da02ea6f0 st/test-theme: Get backend from context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
2022-12-16 22:12:59 +01:00
Jonas Ådahl
387317aadc shell/global: Add 'compositor' property
This is a convenience property for accessing the MetaCompositor
instance.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
2022-12-16 22:12:59 +01:00
Jonas Ådahl
a1d650ce27 window-tracker: Emit 'tracked-windows-changed' on title changes
This means the screen share window view gets updated also when the title
of a window changes. This is important since it often changes shortly
after mapping, which would otherwise go unnoticed by
xdg-desktop-portal-gnome.

An example is launching Files and it showing up as 'Loading..', or
launching a terminal, and it not showing the proper title (current
directory), but some place holder that is never visible on the
application window.

Adding it to the window tracker instead of in introspect.js itself is
for convenience - there is no per window signal tracking there, and it
already listens to the signal emissions about changed windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2578>
2022-12-12 19:32:51 +00:00
Jonas Ådahl
cfaf6601e9 perf-tool: Force animations when running perf tests
This ensures we, unless there is a remote desktop connection explicitly
asking to disable animations, we'll run with animations despite e.g.
hardware acceleration is missing.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2560>
2022-11-29 17:52:56 +01:00
Jonas Ådahl
08d4addeef shell-global: Add 'force-animations' property
Set via a command line argument to gnome-shell. Will allow enabling
animations despite e.g. lack of hardware acceleration otherwise
inhibiting it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2560>
2022-11-29 17:52:56 +01:00
Jonas Ådahl
a13a2dca66 perf-tool: Add --wrap to wrap the gnome-shell call
This allows neat tricks like first arranging the script `fakegdb`:

```sh

function ignore_gdb_arg() {
    if [[ "$1" == "--quiet" ]] || [[ "$1" == "--args" ]]; then
	    return 1
    else
	    return 0
    fi
}

ignore_gdb_arg "$1" || shift
ignore_gdb_arg "$1" || shift

echo exec "$@"
```

then running

```sh
meson test -C build -v perf-basic --test-args '--wrap "gdb --args"' --gdb --gdb-path `which fakegdb`
```

To make it possible to run the perf test case with gdb running the
actual gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:54 +01:00
Jonas Ådahl
4c6bc1ed00 perf-tool: Port to argparse
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:54 +01:00
Jonas Ådahl
f4934c0421 tests/perf: Use custom solid background in tests
They don't measure performance, and we don't want to have to install
gnome-backgrounds, so bundle a solid color background image to use
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:54 +01:00
Jonas Ådahl
bcc4d15fdf tests: Add test running basic perf test
This test runs all of GNOME Shell using the headless backend inside a
mocked D-Bus environment. The basic test tests, well, basic things, like
the panel menu, the overview, showing the app grid view, as well as
going back to the session view.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:53 +01:00
Jonas Ådahl
2ca6e2e7e8 shell/window-tracker: Disassociate windows on shutdown
This avoids trying to deal with handling windows being unmanaged one by
one after we destroyed the ShellGlobal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
210754f1e9 st/widget: Remove transitions when unmapped
This avoids having animating timelines on invisible and detached actors.
This also silences some warnings about the timeline being running
without being attached to the stage.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
9bc89b821c main: Prepend RPATH or RUNPATH paths to gir search paths
If one wants to run tests the non-installed gnome-shell, that currently
fails as gnome-shell the executable attempts to link against
./build/src/libgnome-shell.so, but when GObject introspection tries to
find what library to link to for Shell, it goes to the installed
libgnome-shell.so, causing two different versions of libgnome-shell.so
to be loaded.

This, however, can be avoided thanks to meson adding $ORIGIN paths to
relevant libraries before installing an executable. What this means in
practice is that we can inspect ourself upon startup, discover whether
the RPATH/RUNPATH header contains $ORIGIN, and if so, expand it to the
directory containing the executable, and prepend the introspection
search paths with said directory.

This effectively means that the introspection machinery now finds the
same library that the linker linked the gnome-shell executable with,
making it run successfully.

It's not possible to use $GI_TYPELIB_PATH since
g_irepository_prepend_library_path() takes precedence. There is no
"append" variant of that API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
1559f03a82 main: Tear down the gjs context before the mutter context
Tearing down gjs means that we won't have any dangling references kept
alive by GC or otherwise alive Javascript objects, when we finally tear
down the mutter context. This allows for a clean shutdown of GNOME
Shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
f6a5093c09 main: Notify about shutdown before tearing down
This will allow the shell to tear things down more gracefully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
009da0df64 shell-global: Get backend from context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
f171f92522 shell-global: Add MetaContext getter
Start to use it instead of using g_object_get().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
13ac25b0c5 perf-tool: Add --headless
This will use the headless mode of the native backend, and create a
1280x720 virtual monitor, for running the perf test in.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
b56f853103 perf-tool: Only 'restore' gnome-shell if run with --replace
Otherwise the perf tool will fork and spawn a gnome-shell process
that'll just go and fail.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Florian Müllner
d7dc50da71 shell/app-system: Retrack windows if necessary
We currently don't update running apps when the set of installed
apps changes. However we should, as the change could mean that

 - the app got uninstalled, and the running app should become
   window-backed

 - a newly installed app got launched before the app cache was
   updated, and we replace the window-backed fallback with the
   proper app

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2480>
2022-10-18 19:20:26 +00:00
Florian Müllner
329a286303 st/label: Don't guard against NULL text
Commit 9168f6055e marked the parameter as nullable, which is in
conflict with the precondition check. But given that NULL is
valid for the underlying ClutterText (and GtkLabel accepts it
as well), there's no strong argument for disallowing NULL, so
remove the precondition check.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2465>
2022-09-02 18:59:07 +02:00
Milan Crha
a6244e34de calendar: Correct handling of recurring events
When a recurring event has deleted a single instance, it's received
as an event modification, thus make sure all of the old instances
are removed before adding the event to the list of events.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2328>
2022-08-31 16:35:14 +00:00
Florian Müllner
66ae4c7ff3 shell/screenshot: Plug memory leak
grab_screenshot_content() does not follow the usual pattern of
```
  task = g_task_new (...);
  g_task_run_in_thread (task, ...);
  g_object_unref (task);
```

That means we hold the original reference throughout the operation,
and must release it ourselves when done.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2461>
2022-08-31 13:25:43 +00:00
msizanoen1
2d589ec365 Revert "shell: Fix pixbuf reference leak saving screenshots"
This reverts commit f5754adb68 in
accordance with https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449#note_1539435.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2452>
2022-08-29 21:54:30 +07:00
Dmitrii Naidolinskii
f5754adb68 shell: Fix pixbuf reference leak saving screenshots
When saving a screenshot, the GdkPixbuf created would be left
with a dangling reference after saving to disk (either leaked
on errors, or via an extra reference on success). Always unref
the pixbuf so it's either destroyed on error or there is a single
reference fully transferred to the caller of the function.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5501
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449>
2022-08-28 16:37:54 +05:00
Georges Basile Stavracas Neto
078aca220d Revert "st/scrollview: Add ::content-padding property to StScrollView"
This reverts commit 0d62dadfbc.

The only consumer of such API is now gone.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Daniel van Vugt
9b3ee774f6 st/theme-node-drawing: Conditionally paint the center shadow rectangle
Only when part of it is actually visible.

Because the central rectangle is generally the largest part, this
eliminates most of the shadow's render time. For example, animating
`.workspace-background` by tapping Super, the shell's overall render
time is reduced about 15%.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1915>
2022-08-09 07:11:44 +00:00
Florian Müllner
71d503dc6e st/theme-node-transition: Guard against 0-sized offscreen box
We know beforehand that setting up the framebuffers will fail in
that case, so we can avoid cluttering the log with warnings.

(Although the warning would likely indicate a stylesheet bug)

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/289

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2326>
2022-08-04 18:12:31 +00:00
Alessandro Bono
77d0471bc4 st/settings: Connect to mouse settings
This is likely a typo.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2402>
2022-08-04 16:59:33 +00:00
Ivan Molodetskikh
83564e59b3 workspace: Port WorkspaceBackground allocate to C
WorkspaceBackground's allocate is a hot function called every frame
during overview animations. Port it to C.

While we're at it, cache the work area and the monitor geometry, which
do not need to be re-fetched on every allocation.

This reduces the average WorkspaceBackground allocation time from
0.134 ms to 0.017 ms. With four workspaces, scrolling the overview sees
an average WorkspacesView allocation time improvement from
1.104 ms to 0.678 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2394>
2022-08-03 12:30:31 +00:00
Ivan Molodetskikh
1fd08e80ed Add shell_global_get_workspace_manager ()
It will be used in the subsequent commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2394>
2022-08-03 12:30:31 +00:00
Milan Crha
5c935af7d3 build: Port to gcr4
The gcr4 is going to replace gcr3. As only base functions are used,
the port to gcr4 is trivial.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2386>
2022-08-02 16:13:54 +00:00
Sebastian Keller
fb75120a39 shell/app: Fix small memory leak in get_pids()
The iterator was pointing to NULL when going out of scope, leading to
autofree not clearing the list.

==300183== 32 bytes in 2 blocks are definitely lost in loss record 14,798 of 38,939
==300183==    at 0x484586F: malloc (vg_replace_malloc.c:381)
==300183==    by 0x4D7D980: g_malloc (gmem.c:127)
==300183==    by 0x4D95AB3: g_slice_alloc (gslice.c:1074)
==300183==    by 0x4D96D96: g_slist_prepend (gslist.c:282)
==300183==    by 0x487854F: shell_app_get_windows (shell-app.c:794)
==300183==    by 0x48791A1: shell_app_get_pids (shell-app.c:1201)
==300183==    by 0x488B293: shell_window_tracker_get_app_from_pid (shell-window-tracker.c:702)
==300183==    by 0x488B632: get_app_from_window_pid (shell-window-tracker.c:370)
==300183==    by 0x488B632: get_app_for_window (shell-window-tracker.c:436)
==300183==    by 0x488B632: track_window (shell-window-tracker.c:549)
==300183==    by 0x4CDBB75: g_cclosure_marshal_VOID__OBJECTv (gmarshal.c:1910)
==300183==    by 0x4CD8BE9: _g_closure_invoke_va (gclosure.c:893)
==300183==    by 0x4CF2A28: g_signal_emit_valist (gsignal.c:3406)
==300183==    by 0x4CF2C2C: g_signal_emit (gsignal.c:3553)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2367>
2022-07-06 18:13:46 +00:00
Marco Trevisan (Treviño)
1bd9076590 main: Define a custom log writer to dump on structured messages
Even though GNOME Shell is not explicitly using structured logging via
G_LOG_USE_STRUCTURED, GLib uses it as default since 2016 [1], and so
we're de facto using it.

As per this, if backtrace on warnings is enabled, it is ignored since the
log handler isn't used anymore, and no dump is printed.

Thus, replace the default log handlers with writer functions instead, honoring
backtrace-warnings debug string.

[1] https://gitlab.gnome.org/GNOME/glib/-/commit/fce7cfaf40b6e1e50c9140aa0397f5

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/697>
2022-07-06 17:14:56 +00:00
Florian Müllner
a06b469fbb st: Only notify on property changes
Since commit 5a23c96bd9 we use EXPLICIT_NOTIFY for properties,
however there are still cases where we still notify unconditionally
from the setter, because we don't check the existing value first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2325>
2022-06-08 14:16:28 +00:00
msizanoen1
afcd58e3ba shell: Do not create a systemd scope when using D-Bus app launching
Applications launched using D-Bus activation will have a returned PID of
0, which systemd interprets as moving the requesting process to a new
scope, causing GNOME Shell to be moved to another scope. Fix this by not
creating a systemd scope when PID is 0.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2305>
2022-06-07 14:35:02 +00:00
Florian Müllner
88441c35c9 build: Remove gst dependencies
Those are left-overs from the built-in Shell.Recorder.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2297>
2022-05-20 12:00:22 +00:00
Florian Müllner
1d0a08b5e2 build: Do not redefine polkit autocleanup
PolkitAgent recently added autocleanup functions itself, so check
for their existence at configure time and only define our own when
they don't exist upstream.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2296>
2022-05-17 14:04:01 +00:00
Florian Müllner
d72abf5268 st/button: Add :icon-name property
GTK4 added a convenience property for icon-only buttons. While that
use case is not quite as common in the shell as in GTK apps, it still
seems common enough to mirror the GTK API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2254>
2022-05-06 13:39:40 +00:00
Sebastian Keller
f0a0471927 st/theme-node: Only try to parse non-empty inline styles
Otherwise cr_parser_new_from_buf() will fail creating a parser for a
buffer of length 0, resulting in further errors due to the parser being
NULL. This could happen when extensions were trying to set the style of
a widget to an empty string.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4634
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2286>
2022-04-29 21:50:55 +00:00
Sebastian Keller
8c40b48a09 shell/window-preview-layout: Fix memory leaks
The WindowInfo allocated when adding a window was not getting free'd
when the window was getting removed again or the layout was getting
disposed. Also the hash table in which the WindowInfos are stored was
not getting free'd on destruction either. Both could result in small
leaks after closing the overview.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5238
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2256>
2022-04-22 15:02:29 +00:00
Jakub Steiner
e831a9240d HC: Do not set icon theme from gnome-icon-theme-extra
- High contrast icons are regular symbolic icons

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2243>
2022-03-30 17:11:37 +02:00
Florian Müllner
e4446cd15c Revert "shell/app: Do not try to activate OR windows"
Now that shell_app_get_windows() itself filters out OR windows, this is
no longer needed.

This reverts commit f9037f5889.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2252>
2022-03-28 15:54:33 +00:00
Florian Müllner
c02ca54943 shell/app: Do not include OR windows in get_windows()
We started tracking all windows to make sure the assumption that any
window can be match to an app holds. It is not expected however to
ever represent OR windows in the UI, so it seems better to exclude
them from get_windows() instead of expecting everyone to filter the
return value themselves.

(The returned list still includes "uninteresting" windows like attached
dialogs, which can be important for cases like the correct MRU order in
alt-tab)

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2252>
2022-03-28 15:54:33 +00:00
Florian Müllner
35120dd69c st/theme-node: Default to right text-align in RTL
When neither the theme node itself nor any of its parents specifies
an explicit text direction, we default to aligning to the left.

That's a good default for LTR locales, but for RTL aligning to the
right is a better one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2247>
2022-03-28 15:49:39 +00:00
Daniel van Vugt
918c063693 st: Generate shadows from the silhouette of the source texture
As first mentioned in commit 672171093, the CSS spec defines shadow
colors independently from the colors casting the shadow. It's not
a physical light simulation so a shadow is allowed to be a different
color from texture casting it.

This means we only care about the shape of the source where alpha
values of zero are adjacent to alpha values of non-zero. And all such
non-zero pixels should be treated as fully opaque for the purpose of
shadow generation. While this would be wrong for a physical light
simulation it does allow us to cast shadows around semi-translucent
shapes and better support CSS.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4477
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1918>
2022-03-05 13:55:37 +00:00
Carlos Garnacho
a595fc6d47 st: Move StWidget away from clutter_event_get_source()
Ask the stage about the device actor instead for hover tracking.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Carlos Garnacho
6064a3e020 st: Move StEntry away from clutter_event_get_source()
Ask the stage about the device actor instead. Since leaving the
StEntry also means leaving the contained ClutterText, the checks
on LEAVE can be just removed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Carlos Garnacho
7b7e5ac0de st: Move StButton away from clutter_event_get_source()
Ask the stage about the device actor instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Florian Müllner
574594ec22 st/theme-node: Add missing precondition checks
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4851

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2207>
2022-02-22 12:43:06 +01:00
Jonas Dreßler
8f4427f87b st/scroll-view: Don't queue redraw in update_fade_effect()
ClutterEffects are responsible for queueing redraws when their
properties change (and StScrollViewFade is a good citizen already), also
Clutter itself should queue a redraw when adding/removing an effect.

Users of Clutter should never have to queue redraws themselves (unless
they're implementing a custom ClutterEffect or ClutterContent), so don't
queue a redraw here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2189>
2022-02-16 20:15:28 +00:00