Commit Graph

2828 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
12bb3a601d shell-app-system: Give priority to .desktop IDs that should be shown
If we have multiple desktop ID's that share the same startup-wm class
and none of them is actually matching the desktop-id, then we should
exclude the ones that should not be shown in the current desktop.

This will help preventing cases such as the previous one in case no
desktop file ID would match the startup-wm-class exactly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2721>
2023-04-20 15:11:58 +00:00
Marco Trevisan (Treviño)
e7a09946ca shell-app-system: Do not compare startup-wm classes with full desktop IDs
When fetching the desktop ids into a map of startup-wm classes we meant
to give the ones that match the desktop ID more priority, however
this did not happen because we were always comparing a desktop
file id, including the `.desktop` suffix, with a wm-class that generally
does not include that.

This is the case of gnome-system-monitor, that provides two desktop
files, one of which is OnlyShowIn=KDE but both have the same
StartupWMClass and thus the first parsed is preferred, even though its
desktop-id is gnome-system-monitor-kde.

As per this, remove the .desktop suffix when comparing it with the
startup-wm-class, keeping the old check just in case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2721>
2023-04-20 15:11:58 +00:00
Jonas Ådahl
1da8df81c5 perf-helper: Allow creating window with text input
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
ff705fa902 shell: Make singletons owned by ShellGlobal
This means also means they will be cleaned up when disposing
ShellGlobal, which will then mean signals tied to the GObject lifetime
will be disconnected.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6536
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Jonas Ådahl
517482b562 shell/window-tracker: Disconnect signals on disposal
We always leak this, so this has no effect right now, but will in a
follow up commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Sebastian Keller
15048c1fcb st/icon-theme: Fix small memory leak when checking fallback theme path
This is a small one time leak if there is more than one entry in the
search path due to multiple iterations overwriting the old pointer
before finally going out of scope.

Fixes: 934faaace ("st/icon-theme: Start using g_autofree")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2737>
2023-04-17 10:38:33 +02:00
Florian Müllner
1ca5fc7de1 st/icon-theme: Fix transparent colors in symbolic SVGs
When loading a symbolic SVG, the original file is wrapped in
a header that includes a generated stylesheet with the
appropriate colors, plus an overall opacity.

The opacity value is clamped to values between 0 and 1, which
directly matched the alpha field of the GdkRGBA type. However
since we moved to StIconColors/ClutterColor, the alpha field
is now in the range [0..255], any alpha value other than 0 now
results in full opacity.

To fix, translate the [0..255] integer into a [0..1] double
before using it as opacity.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2731>
2023-04-05 18:55:56 +00:00
Marco Trevisan (Treviño)
69e7b8e79a st/icon-theme: Disconnect from settings signals on disposal
Icon themes can be created by extensions and thus are likely destroyed on
extension unload, so we must disconnect from StSettings signals to avoid
accessing to invalid memory.

See: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2012021
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2711>
2023-03-21 12:17:24 +00:00
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