Commit Graph

2770 Commits

Author SHA1 Message Date
Florian Müllner
c89d6a633a st/icon: Add a default fallback icon
The idea behind commit 3dd8ffc2bb to try harder to avoid empty
icon actors because of missing icons was sound, so implement that
behavior in StIcon itself:

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

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

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

This reverts commit 3dd8ffc2bb.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix this by using g_signal_handler_disconnect instead.

This partially reverts 135d178d08

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

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

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

Likewise, unmanage the screen when X11 becomes unavailable.

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

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

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

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

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

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

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

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

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

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

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

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

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

Before:

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

After:

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

Obviously 50KiB isn't a huge savings.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Use g_value_set_float() instead.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
2019-12-17 23:08:43 +01:00
Umang Jain
281c87d11b St: Add a StPasswordEntry subclass based on StEntry
StPasswordEntry will be put to use for password entries
in various shell dialogs. This is done to have a consistent
behaviour for all password entries and introduce a peek
password functionality for these password entries in the
subsequent commits.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
2019-12-17 23:08:43 +01:00
Bastien Nocera
0223d38602 shell-app: Add discrete GPU support for NVidia drivers
Use data from switcheroo-control to know which environment variables
to use to launch an application on the discrete GPU. switcheroo-control
version 2.0 or newer should be installed on Linux platforms.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1810
2019-12-13 00:44:28 +01:00
Bastien Nocera
33c10e9180 shell: Prime the GPUs property cache for switcheroo-control
See: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/781
2019-12-13 00:44:28 +01:00
Bastien Nocera
c7dec4130d shell: Add API to access switcheroo-control D-Bus proxy
See: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/781
2019-12-13 00:44:28 +01:00
Bastien Nocera
512130172c main: Add switcheroo-control generated code
See: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/781
2019-12-13 00:44:28 +01:00
Benjamin Berg
086ba11621 shell-global: Place launched applications into a systemd scope
This improves separation from the shells service scope for applications
launched using an XDG desktop file.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/863
2019-12-11 09:34:36 +01:00
Florian Müllner
0185c288c3 perf-helper: Remove unused atoms
Those aren't used for anything, but make the helper dependent on X11.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/887
2019-12-05 16:51:00 +01:00
Florian Müllner
3c4c37e4d0 perf-helper: Add content for custom drawing
Drawing windows got a lot more involved with the advent of client-side
decorations. Instead of accounting for visible and invisible borders,
titlebar and shadows when necessary, just add an empty child for the
custom drawing.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/887
2019-12-05 16:51:00 +01:00
Jonas Ådahl
632a643994 Use paint and pick context to get framebuffer
Mutter and Clutter was changed to pass around the current target
framebuffer via the paint context instead of via the deprecated Cogl
framebuffer stack.

The framebuffer stack has also been removed from Cogl so change to use
the one in the paint context instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827
2019-12-03 19:07:15 +00:00
Jonas Ådahl
988a0e7314 Adapt to painting and picking API change
While still leaving them unused, pass around ClutterPaintContext and
ClutterPickContext when painting and picking.

The reason for splitting this change up in two is to make it possible to
bisect easier in between the API change and the change to using the
framebuffer passed around with the temporary contexts.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827
2019-12-03 19:07:15 +00:00
Federico Mena Quintero
73776508b3 st: Remove broken parsing of @media rules
This code didn't even pay attention to the
cur_stmt->kind.media_rule->media_list, and unconditonally considered
each statement in the ->ruleset to be of kind ruleset.  That seems
broken.

(The theme doesn't use any @media queries, and they are unsupported
anyway.)

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1979
2019-12-03 18:53:36 +01:00
Federico Mena Quintero
01c0803a4a Fix always-true condition
CrCascadePrivate->sheets is a statically-sized array inside the
struct; it can't be NULL.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/861#note_659216
2019-12-02 08:04:51 -06:00
Federico Mena Quintero
582bfe830a cr-rgb: remove handling of "inherit" and "transparent"
st-theme-node.c already handles those by itself.

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Federico Mena Quintero
236bdaa53c Handle "color: inherit" directly in get_color_from_term(), not in libcroco
The idea is to move handling of "inherit" as early in the parsing as possible.

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Federico Mena Quintero
52f5793c9b Use get_color_from_term() instead of get_background_color_from_term()
The former already checks for term_is_transparent() as its first
thing.

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Federico Mena Quintero
1e8e08ce61 Simplify if statement
And make the end of st_theme_node_lookup_length() consistent with
st_theme_node_lookup_color() and st_theme_node_lookup_shadow().

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Federico Mena Quintero
05c3ac2359 get_length_internal() - remove unused argument 'suffixed'
It was passed as NULL in the single caller of this function.

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Federico Mena Quintero
47758d16ff Include the libcroco sources directly under src/st/croco
This is all of the original libcroco, minus these two which we don't use:

  - cr-sel-eng - the CSS selection engine for xmlNode.
  - cr-style.

Part of https://gitlab.gnome.org/GNOME/gnome-shell/issues/1934
2019-11-29 17:50:03 +00:00
Florian Müllner
5f9036e815 calendar-server: Use correct timezone for all-day events
Since commit 28c535e34, we use the timezone associated with the ICalTime
instead of the default timezone when converting to time_t. However while
that is correct for most events, for ICalTimes that don't have a timezone
associated we still want to fall back to the default timezone instead of
UTC.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1895
2019-11-28 01:42:50 +01:00
Daniel García Moreno
e642e1c106 texture-cache: Remove also scaled keys from the cache
We're storing in the texture cache images and scaled images appending
the scaling factor to the key. When a file changes the cache key
corresponding to that file is removed, but not the keys for the scaled
ones so that images in the cache are never reloaded.

This patch removes all keys from the cache related to the file that
changes, including those with the scaling factor.

A new set (hash table) was added to keep track of scale used to be able
to remove all possible images in the cache.

When the KEY is removed from the cache, we can look now in the scale set
for and each scale we also remove the key "KEY1.000000", "KEY2.000000",
etc.

Assuming that the number of used scales is small (I would typically
expect one or two), the overhead should be negligible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/567
2019-11-26 08:28:21 +01:00
Florian Müllner
bb48205aae extensions-tool: Fix removing from settings list
When removing a string from a settings list, we iterate over all
existing entries and copy all strings except the one that's being
removed to a new list, which is then written to GSettings.

However we currently always increment the index, so we end up with
a NULL entry in place of the removed entry, which is then interpreted
as the end of the list. In other words, we also remove all entries
that follow the removed string.

Fix this by looping over the list entries instead of the index, and
only increment the index for entries we copy.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1946
2019-11-25 16:18:08 +01:00
Florian Müllner
9790b0ee5d st/button: Notify :pressed changes
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/846
2019-11-22 18:55:40 +01:00
Robert Mader
c48330a986 cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/845
2019-11-22 01:45:25 +01:00
Robert Mader
135d178d08 cleanup: Use g_clear_signal_handler() where possible
`g_clear_signal_handler()` is usually cleaner and saver than
`g_signal_handler_disconnect()`. We use it new code, lets also
adopt the existing one.

See also https://gitlab.gnome.org/GNOME/mutter/merge_requests/868
and https://gitlab.gnome.org/GNOME/mutter/merge_requests/940

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/842
2019-11-21 22:37:37 +00:00
Jonas Ådahl
88bcaafe86 Stop referring to ClutterTexture
ClutterTexture is removed from mutter's clutter fork, so lets stop
referring to it. This also happens to fix an incorrect type cast.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/822
2019-11-12 22:05:13 +01:00
Florian Müllner
f28f041a95 theme-context: Use interface font instead of hardcoded default
With this, gnome-shell will now follow the interface setting instead
of hardcoding a default font, unless when overwritten by the CSS.

https://bugzilla.gnome.org/show_bug.cgi?id=688288
2019-11-08 23:48:42 +00:00
Florian Müllner
cd84fa824f st: Add Settings:font-name property
This maps to the corresponding interface setting and will be used to
replace the hard-coded font in the CSS.

https://bugzilla.gnome.org/show_bug.cgi?id=688288
2019-11-08 23:48:42 +00:00
Florian Müllner
40bd65c9ba st: Fix a minor leak
StSetting is used as a singleton, so this leak does not matter in
practise.

Spotted by Jonas Dreßler.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486
2019-11-08 23:48:42 +00:00
Carlos Garnacho
be5f5ec9d4 shell: Make screenshot API stream based
Instead of dealing with filenames, make the low-level API use streams
so the target remains generic.

This so far means JS code now determines the appropriate filename to
use for storing the screenshot, but will be used in other ways in
future commits.

https://gitlab.gnome.org/GNOME/mutter/issues/789
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/810
2019-11-06 22:45:22 +00:00
Carlos Garnacho
a58bdbfbd4 st: Add StClipboard method to set arbitrary clipboard content
This complements the current text-based API.

https://gitlab.gnome.org/GNOME/mutter/issues/789
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/810
2019-11-06 22:45:22 +00:00
Florian Müllner
f51952f5d6 shell: Remove format_date() utility function
It is now unused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/807
2019-11-06 20:19:57 +00:00
Carlos Garnacho
6a42d77261 st: Track stylesheet changes on the StThemeContext
Instead of every individual StThemeNode. There are essentially two kinds
of theme nodes: Those we create for lookups, and those interned by the
theme context and used by StWidgets. Listening to the signal on the former
is pointless as they are short lived and not meant to be really used for
drawing. So it is only essential to track stylesheet changes in those we
intern for later use.

This change does precisely that, it lets the StThemeContext track the
stylesheet changes and let all known theme nodes reset their state for
it.

The internal array holding all connected handlers for this signal in glib
was about the biggest single allocation made in gnome-shell, as interned
theme nodes nodes are around the 4 to 5 digit numbers. This essentially
makes it disappear.

This however means that widgets that are explicitly set a theme through
st_widget_set_theme() don't get their theme node implicitly updated.
There's little reasons to use that API, so perhaps this is an acceptable
tradeoff.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/779
2019-11-05 12:36:28 +00:00
Carlos Garnacho
55867c40c4 st: Drop StWidget theme overriding API
A StWidget could get its style from a) a theme set in the StThemeContext,
and b) directly through it's ::theme property. Generally, overriding CSS
through the latter cannot be recommended as it loses any connection with
the global theme (eg. the ones you get through selector specificity).

It sounds a bit too powerful and pervasive, there's no use for it in
gnome-shell and doesn't look like something that could be recommended on
extensions. So, just drop this piece of API.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/779
2019-11-05 12:36:28 +00:00
Milan Crha
28c535e341 calendar-server: Uses wrong timezone for event times
The conversion to UTC/time_t time was not using correct timezone.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1714
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/806
2019-11-05 12:27:06 +01:00
Florian Müllner
2c62e45168 st: Remove StBin's align properties
They are now completely unused, so remove them and stop the confusing
shadowing of ClutterActor's own x/y-align properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:27:56 +01:00
Florian Müllner
72af64d964 st: Remove st_get_align_factor() utility method
It is now unused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:23:32 +01:00
Florian Müllner
2f39bd8ba4 st/bin: Use child's align properties
By now, all containers and layout managers except StBin (and its
subclasses) use the generic ClutterActor expand/align properties
to control how their children are laid out.

This is particularly confusing as two or the properties StBin uses
for layout - x-align and y-align - shadow the generic ClutterActor
ones, but work very differently: They use a different enum and
determine how the bin lays out its child, instead of how the bin
is laid out by its parent.

Address this by deprecating the StBin properties and using the same
generic ClutterActor properties as everyone else.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:23:32 +01:00
Florian Müllner
f0a5170473 st: Deprecate StBoxLayout child properties
We are no longer using them, and so shouldn't anyone else :-)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/780
2019-11-01 19:42:02 +00:00
Marco Trevisan (Treviño)
aa9031d8e7 st/scroll-view: Remove scrollbars references on dispose
As we're destroying the scrollbars on destruction, we should remove any
reference of it, not to cause multiple-calls to disposal to unreference them
again.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/190
2019-10-30 01:08:27 +01:00
Georges Basile Stavracas Neto
6965781d59 st: Use clutter_actor_pick() in pick
Use the new function to perform picking and avoid
going through any painting-related code paths.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/773
2019-10-21 13:53:56 +00:00
Marco Trevisan (Treviño)
320df13b65 st/button: Add the clicked button to virtual function signature
clicked signal includes a clicked mouse button parameter, but the vfunc
signature doesn't include it, so it won't be passed to the functions when
the signal is emitted.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Daniel van Vugt
d7c569c692 st: Remove color from ClutterActor pick virtual function
It's unused since commit mutter@14c706e51

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/759
2019-10-16 12:01:41 +00:00
Georges Basile Stavracas Neto
7a92a9ba21 st: Replace ClutterSize by graphene_size_t
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/421
2019-10-16 10:49:04 +00:00
Georges Basile Stavracas Neto
0199857c5b Replace ClutterVertex by graphene_point3d_t
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/421
2019-10-16 10:49:04 +00:00
Robert Mader
20f4fc7c87 shell-screenshots: Do not pass a clip for window screenshots
Design team wants us not to clip away the shadows, lets do that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/762
2019-10-14 17:56:01 +02:00
Marco Trevisan (Treviño)
b4128967a1 st/scroll-view: Remove container foreach vfunc
foreach_with_internals vfunc is deprecated for long time and not used
anymore, so remove it

Related to: https://gitlab.gnome.org/GNOME/mutter/merge_requests/816

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/747
2019-10-14 14:57:49 +00:00
Marco Trevisan (Treviño)
31fe517007 shell-global: Ignore modal operations if we have no compositor
Modal dialog actions might be triggered during display closing, and in such
cases we should just ignore the requests.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/746
2019-10-08 17:51:52 +02:00
Marco Trevisan (Treviño)
31d915a38a shell-global: Disconnect from stage events on X11 display close
As per GNOME/mutter!385 [1], the compositor is finalized an its pointer
cleared on display close.

However, since the shell reacts to such events instead of controlling them,
when the shell is stopping or restarting and its display closing, the shell
stage destroys its children after the display closing is finished and during
this process the focus is unset, causing focus_actor_changed() to be called
and thus calls to meta_stage_is_focused() which deferences the now NULL
compositor, leading to a crash on shutdown.

Since after this point we should just ignore any stage event, disconnect
from them all.

[1] https://gitlab.gnome.org/GNOME/mutter/merge_requests/385

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/746
2019-10-08 17:49:30 +02:00
Iain Lane
085531b43d main, util: Notify systemd once we are fully initialised
If graphical applications want to start from systemd units, they need to
start after we're properly ready to display them. This is particularly
important under X where `_GTK_FRAME_EXTENTS` and other xprops are needed
to have the right theming.

We're doing this in an idle callback so that the dynamic starting of
`gnome-session-x11-service.target` (which launches `gsd-xsettings`) as
the result of a signal emission happens before us signalling we're ready
for later things to start.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/750
2019-10-04 15:40:05 +00:00
Florian Müllner
60cab56f86 shell-util: Handle NULL from meta_window_get_image()
Until commit 506b75fc7f we got away with not handling a NULL return
value, as cairo_surface_destroy() deals with a NULL surface; the same
isn't true for get_width/get_height, so guard to code in question to
prevent a crash.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1678
2019-09-25 14:34:27 +00:00
Benjamin Berg
0fdbde9101 main: Remove NOTIFY_SOCKET from environment
It is only used exactly once to notify systemd about the service
startup. So unset it as soon as possible as it can leak into
subprocesses we spawn otherwise.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/741
2019-09-23 11:09:39 +02:00
Robert Mader
506b75fc7f shell-util: Do not scale the clip in get_content_for_window_actor()
This is now handled in Mutter. Also, respect the result size instead
of assuming it to be equal to the clip size, as the clip takes actor
coordinates while the result takes buffer coordinates.

This can be fixed in a future API iteration.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/728
2019-09-20 17:27:34 +00:00
Jonas Dreßler
00e95de114 shell-app: Never allow opening new windows while an app is starting
We allow opening new windows as a fallback in case the app doesn't give
us explicit information about it, but we don't want to allow opening new
windows if we're unable to ask for this information (we can only use the
APIs to get this information while the app is RUNNING).

So always return FALSE in case the app is STARTING, always return TRUE
in case the app is STOPPED (starting an app always opens a new window)
and go through the usual checks in case the app is RUNNING (and
eventually fall back to FALSE).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121
2019-09-18 17:14:16 +00:00
Daniel García Moreno
cf00231aa8 st: Fix box-shadow drawing with prerendered_texture
The use of box-shadow on a StWidget that has a background-gradient was
not been rendered correctly, the shadow borders was calculated inside
the st_theme_node_prerender_shadow function and in the case that we've a
prerendered_texture the max_borders was not calculated and are 0.

This patch creates a new static function to compute shadow maximum
borders copying the code from st_theme_node_prerender_shadow, and call
this new method in the case that we've a prerendered_texture.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1186
2019-09-18 16:09:36 +00:00
Florian Müllner
25a7a8006a gnome-extensions: Translate help command
The quotes and COMMAND string aren't part of the syntax, so they
should be translated.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1538
2019-09-11 17:09:30 +00:00
Florian Müllner
a030c54661 shell: Replace another GTimeVal
This slipped through in commit 9b7f228f8e.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/709
2019-09-10 17:51:02 +00:00
Florian Müllner
dcf7bae6c7 calendar-server: Temporarily ignore all deprecations in eds includes
Evolution draws in libsoup, which exposes deprecated types in its
API. While its headers have been fixed to guard the affected symbols,
those fixes aren't in our CI images yet.

Until we get a fixed version, just disable all deprecation warnings
during the include in order to not trip over "foreign" bugs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/709
2019-09-10 17:51:02 +00:00
Florian Müllner
d0ace108e5 calendar-server: Disable deprecated e-d-s API
We aren't using any deprecated evolution-data-server API, so we can
turn it off; this avoids compiler warnings for glib deprecations
used by those functions, which makes it harder to spot warnings for
our own code base.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/709
2019-09-10 17:51:02 +00:00
Florian Müllner
32d5744014 build: Exclude private headers from GIR
They contain API that is explicitly not meant to be used externally
and - as it uses the "wrong" namespace due to the _ prefix - doesn't
end up in the introspection data anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/709
2019-09-10 17:51:02 +00:00
Florian Müllner
d16094774b build: Remove st-private.h from "public" headers
It is currently listed both as public and private header, which is
clearly bonkers. As the name implies, the latter is correct ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/709
2019-09-10 17:51:02 +00:00
Carlos Garnacho
8d9cae45f9 st-clipboard: Add trailing 0 to pasted text
We translate the raw stream content far too directly into a char*,
it notably forgets that the stream does not have nul-ended data,
this means we are potentially adding garbage after the pasted content.

Tentatively fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1570
2019-09-09 19:04:31 +00:00
Carlos Garnacho
9194de8460 shell: Add helpers to start/stop systemd units
These just send the respective DBus message to the systemd user service.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/680
2019-09-05 07:42:46 +00:00
Will Thompson
a207f67f73 global: Don't trust persistent/runtime state data
An Endless OS system was found in the wild with a malformed
.local/share/gnome-shell/notifications. When deserialized in Python,
after passing trusted=True to g_variant_new_from_bytes(), the first
element of the first struct in the array looks like this:

    In [41]: _38.get_child_value(0).get_child_value(0)
    Out[41]: GLib.Variant('s', '\Uffffffff\Uffffffff\Uffffffff\Uffffffff\Uffffffff')

When deserialised in GJS, we get:

    gjs> v.get_child_value(0).get_child_value(0)
    [object variant of type "s"]
    gjs> v.get_child_value(0).get_child_value(0).get_string()
    typein:43:1 malformed UTF-8 character sequence at offset 0
      @typein:43:1
      @<stdin>:1:34

While g_variant_new_from_bytes() doesn't have much to say about its
'trusted' parameter, g_variant_new_from_data() does:

> If data is trusted to be serialised data in normal form then trusted
> should be TRUE. This applies to serialised data created within this
> process or read from a trusted location on the disk (such as a file
> installed in /usr/lib alongside your application). You should set
> trusted to FALSE if data is read from the network, a file in the
> user's home directory, etc.

Persistent state is read from the user's home directory, so it should
not be trusted. With trusted=False, the string value above comes out as
"".

I don't have an explanation for how this file ended up being malformed.
I also don't have an explanation for when this started crashing: my
guess is that recent GJS became stricter about validating UTF-8 but I
could be wrong!

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1552
2019-09-03 01:00:50 +00:00
Jonas Ådahl
b73aace476 shell: Get cairo surface via window actor
Instead of going via the MetaShapedTexture to get the cairo surface, get
it from the window actor. The window actor can then handle this in a way
that makes it include potential subsurfaces.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/692
2019-09-02 16:53:55 +00:00
Benjamin Berg
cf156b469c Notify service startup to systemd
Using the bus name to notify service startup to systemd has some
disadvantages. The main one being that systemd will consider a
gnome-shell restart (Alt+F2 r) a service failure and restart the shell,
cleaning up all its children (i.e. user launched applications). In the
future the shell should launch applications in their own transient unit
so that a service restart does not affect applications.

Another potential issue is that we must never load
gnome-shell-wayland.service and gnome-shell-x11.service at the same
time, as systemd does not like two services providing the same bus
name.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/690
2019-08-27 17:42:32 +00:00
Florian Müllner
957fa910b3 st: Adjust theme test
Mutter's Clutter fork can no longer be initialized separatedly, as
its backend now draws from MetaBackend. Adjust the code to use the
newly added test initialization function instead to get the test
back up.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/691
2019-08-27 15:30:51 +03:00
Florian Müllner
8ac5be95d3 tests: Don't initialize Clutter
Clutter's backend code depends on MetaBackend now, which makes it
impossible to initialize without resorting to private mutter API.

Luckily we only need Clutter for interactive tests which are broken
anyway, as Clutter.main() and friends were removed a while ago.

So for now, get at least unit tests working again by simply the
unnecessary Clutter initialization.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/691
2019-08-27 15:30:51 +03:00
Florian Müllner
c6580421b3 shell-extension-tool: Fix typo
Spotted by Amr Ibrahim.
2019-08-27 12:16:27 +03:00
Carlos Garnacho
db9a7ea7a9 shell: Ignore non-toplevels for ShellWindowTracker::tracked-windows-changed
Popups and other override-redirect windows are meaningless to everything
that depends on the ShellWindowTracker. Ignoring those windows will result
in less ShellApp::windows-changed signal emissions, and less activity in
the AppMenuButton and everything else that depends on them.

Reduces gnome-shell CPU activity while typing on the Epiphany addressbar,
as the pop up animation there results in a number of xdg_popup being
created and destroyed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/642
https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-08-21 16:53:36 +00:00
Florian Müllner
490a62e781 shell-extension-tool: Turn into a small wrapper
Now that we have a replacement, deprecate the existing tool and make
it call out to the new one instead of implementing any functionality
on its own.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
d4b8912c0e extensions-tool: Add 'reset' command
Now that we allow to disable session mode extensions, it can be useful
to reset an extension to its original state, that is disabled in the
regular session, but possibly enabled via the session mode.

Add a corresponding command.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
532acf4c4a extensions-tool: Adjust enable/disable commands to shell changes
Change both 'enabled-extensions' and 'disabled-extensions' keys as in
commit ce1bee727. While those actions are now also exposed by the
shell's D-Bus API, there is some value in allowing the tool to be used
outside a running GNOME session (for example in setup scripts), so
keep changing the GSettings keys directly.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
7141c5be6d extensions-tool: Split out settings_list_add/remove helpers
With the addition of the 'disabled-extensions' key in commit ce1bee727,
the way extensions are enabled/disabled changed: Now a UUID is always
added to one list and removed from another.

Prepare for that by generalizing the relevant bits of the existing
enable/disable commands as helper functions.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
2df7757905 extensions-tool: Add 'uninstall' command
Uninstall is another action that can be useful from the command line,
so expose that as well.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
9d5c743a98 extensions-tool: Handle existing extension folder
g_file_make_directory_with_parents() returns an error if the directory
already exists (unlike g_mkdir_with_parents()), so it is currently
impossible to install more than a single extension, whoops.

Handle the error properly by just carrying on.

https://gitlab.gnome.org/fmuellner/gnome-extensions-tool/merge_requests/3
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
653e6c85bb extensions-tool: Add 'prefs' command
Easily launching an extension's preference dialog from the command
line can be quicker than using a UI like Tweaks or the extension
website, so add that functionality.

https://gitlab.gnome.org/fmuellner/gnome-extensions-tool/merge_requests/2
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
d9fa389079 extensions-tool: Add '--prefs' list option
We are about to add a 'prefs' command for launching an extension's
preference dialog. As that command only makes sense for extensions
that actually have preferences, shell completion should filter the
list of extensions accordingly. To allow that, add an appropriate
list option.

https://gitlab.gnome.org/fmuellner/gnome-extensions-tool/merge_requests/2
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
a429fdbd08 extensions-tool: Add 'install' command
The ability to install unaudited extensions directly from a zip file
can be useful for testing and code review, so implement a corresponding
command that complements the previously added 'pack' command.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
f9357457bf extensions-tool: Add new 'pack' command
Extensions are uploaded to extensions.gnome.org as zip files that
not only contain the extension sources, but also compiled GSettings
schemas and message catalogues. To make this more convenient, add
a corresponding command for creating an archive suitable for up-
loading.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
369e400e32 extensions-tool: Show Philip some info
Add a 'show' alias for the previously added 'info' command
because it makes sense:

https://twitter.com/pwithnall/status/1036895943004762112

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
07ad4d8911 extensions-tool: Add info command
We already support displaying extension details for the list command,
so it's a logical extension to also support showing extension info
for a particular extension (not least because the shell has a
corresponding D-Bus method).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
1b40abe37a extensions-tool: Add a man page
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
0de5209cf1 extensions-tool: Add bash completion
Completions are clearly helpful, in particular for extension UUIDs
that are often lengthy strings containing random usernames.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
07fad38a50 extensions-tool: Add list options
In addition to a plain list of all extensions, add options to display
additional details of each extensions and to filter the list by
enabled state or install location.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
ac4b88f25d extensions-tool: Implement list command
Seeing at a glance which extensions are installed is surely useful,
so add a corresponding command.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
23a7aa5740 extensions-tool: Add create options
As we are using git-style command syntax, we can allow for data to be
provided on the command line rather than asking for it interactively.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
0b1e29e5e3 extensions-tool: Implement create command
This implements more functionality of the existing tool and, as
'reload' is an unreliable feature that doesn't work more often
than not, the last bit that we will replicate.

The command follows the original for the most part, with the most
important difference being the installed template, which doesn't
provide any sample functionality and uses modern JS syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
c8c93b2a70 extensions-tool: Implement enable/disable commands
This replicates the most basic functionality of the existing
gnome-shell-extension-tool, albeit using a git/gio/gsettings
style command interface rather than plain options; this will
allow us to implement more complex commands that have options
on their own in the future.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Florian Müllner
d8c7cac536 extensions-tool: Start import
The gnome-extensions tool[0] was started as an external project, and
provides a replacement for the existing gnome-shell-extension-tool.
It was decided to ship the tool as part of the gnome-shell repository,
so start importing it with its history into a subdir.

[0] https://gitlab.gnome.org/fmuellner/gnome-extensions-tool

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1234
2019-08-21 18:28:02 +02:00
Jonas Ådahl
16cb918e0d shell-global: Set stage input region via MetaX11Display
The API in mutter changed to set it via MetaX11Display; lets jump on the
train.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/682
2019-08-19 09:20:44 +00:00
Jonas Ådahl
638b315e40 shell-global: Only sync input region if X11 session
We'd do an early out in the called functions eventually anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/682
2019-08-19 09:20:44 +00:00
Florian Müllner
9b7f228f8e src: Stop using g_get_current_time()
It isn't 2k38 safe and has therefore been deprecated. Replace it
with GDateTime or g_get_real_time() as appropriate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/657
2019-08-09 19:22:18 +00:00
Florian Müllner
5d8ea4f9a3 main: Remove left-over variable
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/657
2019-08-09 19:22:18 +00:00
Georges Basile Stavracas Neto
c0047cd11d shell/app-system: Monitor for icon theme changes
Whenever an app is installed, the usual routine is
to run 'gtk-update-icon-cache' after installing all
of the app's files.

The side effect of that is that the .desktop file of
the application is installed before the icon theme
is updated. By the time GAppInfoMonitor emits the
'changed' signal, the icon theme is not yet updated,
leading to StIcon use the fallback icon.

Under some circumstances (e.g. on very slow spinning
disks) the app icon is never actually loaded, and we
see the fallback icon forever.

Monitor the icon theme for changes when an app is
installed. Try as many as 6 times before giving up
on detecting an icon theme update.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/661
2019-08-08 15:22:44 +00:00
Georges Basile Stavracas Neto
dd9a452594 st/texture-cache: Monitor GtkIconTheme changes
The texture cache, right now, only monitors for
complete theme changes. If the contents of the
icon theme change, however, the texture cache
isn't properly invalidated.

This manifests itself as a randomly reproducible
bug when installing an app; the app icon may be
the fallback forever, or as long as something else
updates the icon theme.

Watch for the GtkIconTheme:changed signal, and
evict the texture cache when the theme changes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/661
2019-08-08 15:22:44 +00:00
Florian Müllner
72defaa97e st: Use StAdjustment's new transition API
Now that the adjustment itself can be used to track its transitions,
do that for animating the scroll bar handle.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/669
2019-08-07 18:40:47 +02:00
Florian Müllner
9097c5e9c0 st: Add transition API to StAdjustment
StAdjustment implements the ClutterAnimatable interface, so we can
already animate its properties with ClutterPropertyTransitions.

But as it is currently not possible to associate a transition with
an adjustment, it must be owned (and kept alive in case of GC) by
the calling code.

Change that by implementing the same (add|remove|get)_transition() API
as ClutterActor, so we can use a familiar API and even duck typing in
case of javascript.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/669
2019-08-07 18:40:44 +02:00
Florian Müllner
0846238f69 js: Use implicit animations for animatable properties
We now have everything in place to replace Tweener for all animatable
properties with implicit animations, which has the following benefits:

 - they run entirely in C, while Tweener requires context switches
   to JS each frame

 - they are more reliable, as Tweener only detects when an animation
   is overwritten with another Tween, while Clutter considers any
   property change

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
2019-08-06 23:54:29 +02:00
Florian Müllner
1e6cb43815 shell-app: Consider desktop actions in can_open_new_window()
We currently only consider a remote "app.new-window" action when running,
but not a fixed "new-window" action in the .desktop file. The latter is
clearly useful as well, in particular as open_new_window() already does,
so add it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/665
2019-08-06 15:04:24 +02:00
Benjamin Berg
31968ea53c meson: Avoid using relative paths to po directory
Replace the relative path to the po directory with a toplevel definition
of po_dir and use that instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/507
2019-08-05 21:38:51 +00:00
Florian Müllner
12b8fb15b1 st: Move slow-down-factor into settings
Now that we have a Settings singleton, we have a better place for the
slow-down-factor than an awkward extern variable.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/656
2019-08-01 21:13:28 +00:00
Florian Müllner
5295866eff st: Fix property type
Commit 8f3554ff accidentally changed the type of the StWidget:track-hover
property from boolean to object.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1482
2019-08-01 12:44:33 +02:00
Niels De Graef
8f3554ff3e st: Use g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, always try to use
`g_object_notify_by_pspec()` instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/652
2019-07-31 17:35:03 +00:00
Niels De Graef
28ab1f4af4 Ensure G_PARAM_STATIC_STRINGS for all properties
In `st`, we can do this by using `ST_PARAM_*`. In the other code files,
just use `G_PARAM_STATIC_STRINGS` directly.

This is just a minor convenience to prevent a few unnecessary string
copies.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/646
2019-07-30 13:58:44 +00:00
Niels De Graef
d360114226 st: Cleanup ST_PARAM_* and add WRITABLE version
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/646
2019-07-30 13:58:44 +00:00
Florian Müllner
007d305736 shell: Actually make GLSLEffect an effect
A generic, introspectable Shader effect is not only more flexible
than a shader actor, it will also make it much easier to turn
Lightbox into an actor subclass and replace Tweener with Clutter's
own animation support.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/651
2019-07-29 17:51:14 +02:00
Florian Müllner
ae7ec648b2 shell: Properly rename type
This is just a find-and-replace name change to make the actual code
changes in the follow-up commit more apparent.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/651
2019-07-29 17:51:14 +02:00
Florian Müllner
99a2fad311 shell: Rename GLSLQuad to GLSLEffect
You can guess where this is going ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/651
2019-07-29 17:51:14 +02:00
Ting-Wei Lan
d9d9778a98 main: Avoid missing braces warnings when compiling with clang
Since -Werror=missing-braces is used, having missing braces warnings
aren't allowed. However, the first member of struct sigaction is a union
whose first member is a pointer, causing clang to produce warnings when
it is initialized to { 0 }.

Instead of initializing to a zero value, we can specify values of
members directly in the initializer to avoid warnings.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/633
2019-07-20 16:45:49 +08:00
Florian Müllner
208c5e9562 shell: Don't use g_memmove()
Glib stopped providing any fallback implementations on systems without
memmove() all the way back in 2013. Since then, the symbol is a simple
macro around memmove(); use that function directly now that glib added
a deprecation warning.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/632
2019-07-19 17:43:56 +00:00
Illya Klymov
55b036170b shell-recorder: Restore cursor recording
Due to changes introduced in 5357e0a1 cursor recording interaction with
magnifier was reversed. This fix restores original correct behavior
Related issue: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1208
2019-07-08 21:08:51 +00:00
Florian Müllner
be40de5a9b st: Consider non-background properties for ::style-changed
st_theme_node_paint_equal() was originally added to preserve paint state
when a style change didn't affect any of StWidget's cached background
resources.
That's why using it for filtering out unneeded style changes as in commit
f662864a misses any non-background related properties that are relevant
for subclasses. Add additional tests to make sure we keep emitting the
signal in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212
2019-07-07 21:01:33 +00:00
Florian Müllner
7359e431d3 st: Add st_icon_colors_equal()
This is a small convenience wrapper around clutter_color_equal()
for the different color components, which also handles the case
where one (or both) of the icon colors are %NULL.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212
2019-07-07 21:01:33 +00:00
Jonas Dreßler
0bdd1b6fc4 st/button: Ungrab device before calling st_button_release
Since priv->device gets set to NULL inside st_button_release, ungrab the
input device before calling st_button_release and avoid
clutter_input_device_ungrab failing with a critical error.

This fixes a regression introduced with
d5a1a888d9

While at it, also remove the superfluous line resetting priv->device to
NULL and move the check for priv->grabbed into an elseif block since
there should be no case where StButton has both grabs at the same time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/614
2019-07-04 18:25:15 +02:00
Carlos Garnacho
8a22092632 shell: Drop XDND initialization code
Let mutter take over this, and drop this piece of backend-specific
code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/611
2019-07-03 16:37:15 +02:00
Jonas Dreßler
d5a1a888d9 st: Replace global grabs with input device grabs
Global grabs are being removed from Clutter in favour of input device
grabs, so only grab the input device instead and replace priv->grabbed
with checks for priv->grab_device.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
2019-07-02 01:18:15 +00:00
Christian Hergert
751cd2f1c1 main: setup GJS profiler when GJS_TRACE_FD is set
This is the same environment variable that will be used in GJS to auto-
connect Sysprof to the GJS profiler when the gjs binary is used.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/573
2019-06-24 15:05:46 +00:00
Niels De Graef
ccf646f54a Drop CoglError for GError
From https://gitlab.gnome.org/GNOME/mutter/merge_requests/631

```
CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.
```

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/586
2019-06-20 16:30:40 +02:00
Florian Müllner
523ba5a719 shell: Remove shell_global_structured_log()
It is now unused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/579
2019-06-15 15:26:17 +02:00
Laurent Bigonville
58c4212cfa shell-app: Fix spelling error
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1205
2019-06-15 12:08:40 +02:00
Florian Müllner
d8825e0d12 shell: Stop using anchor point
Since the removal of the old (pre-3.16) message tray, legacy tray icons
are very unlikely to be placed in a container that is animated using the
deprecated anchor point.

Just assume that the regular stage position is good enough.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/572
2019-06-05 17:59:51 +00:00
Florian Müllner
3c5fea59df st: Stop using (deprecated) ClutterAnimation
Instead, make StAdjustment a ClutterAnimatable and use a property
transition.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/572
2019-06-05 17:59:51 +00:00
Olivier Fourdan
443c8347ea locatePointer: Add implementation in gnome-shell
The "locate pointer" functionality was implemented in gnome settings
daemon using X11 protocols and would fail when run under Wayland.

With Wayland, there is no global coordinate space exposed to the clients
so this functionality cannot be implemented as a separate program.

Instead, add the "locate pointer" functionality in gnome-shell so that
it works in both X11 and Wayland.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/981
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/413
https://gitlab.gnome.org/GNOME/mutter/merge_requests/453
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/merge_requests/19
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/86
2019-06-05 08:15:10 +00:00
Cosimo Cecchi
12bace2721 shell-global: don't warn when unsetting non-existent state
If the state we're trying to delete does not exist, do not log an
error.
Prevents this journal warning at startup:

gnome-shell[1082]: Could not delete runtime/persistent state file: Error removing file /run/user/1000/gnome-shell/runtime-state-LE.:0/screenShield.locked: No such file or directory

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/555
2019-05-27 08:36:17 -07:00
Cosimo Cecchi
2c45b5416e keyring-prompt: relax NULL check in remove_mnemonics()
Instead of considering a GValue containing a NULL string to be a
programmer error, simply return NULL.
remove_mnemonics() is in fact called on the value of the
"choice-label" property as well, which has NULL as its default
value.

This prevents triggering the following gnome-shell warning:

gnome-shell[1082]: remove_mnemonics: assertion 'label != NULL' failed

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/555
2019-05-27 08:36:11 -07:00
Carlos Garnacho
dd5d7d3b70 shell: Only initialize global->xdisplay on X11 compositors
This is just used to set up things that are relevant to X11 compositors
(XDND, XFixes input region). We can live with it unset on the wayland
compositor cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/378
2019-05-24 12:24:06 +02:00
Carlos Garnacho
771b1a0788 shell: Do not set XFixes input region on wayland compositors
This is just needed on the X11 compositor, wayland compositors are known
for handling their own input.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/378
2019-05-24 12:24:06 +02:00
Carlos Garnacho
5a9d094f3e shell: Use MetaDisplay input focus API
Replaces use of (now removed) MetaX11Display focus API (which happened to
work for wayland too).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/378
2019-05-24 12:24:06 +02:00
Milan Crha
bd4aac8f49 calendar-server: Port to libecal-2.0
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/501
2019-05-17 20:24:08 +00:00
Florian Müllner
785dd5c5f7 Revert "calendar-server: Port to libecal-2.0"
This reverts commit 71e469a59c.
2019-05-17 22:23:43 +02:00
Milan Crha
71e469a59c calendar-server: Port to libecal-2.0
Port the calendar-server code to work with the latest evolution-data-server
API changes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/501
2019-05-17 22:17:07 +02:00
Marco Trevisan (Treviño)
54039c3552 st: Introspect ScrollViewFade to read fade properties
Util.ensureActorVisibleInScrollView takes care of the potential scroll view fade
effect in order to compute the scroll offset, reading the ScrollViewFade's
`vfade-offset` property. This was correctly working until gnome 3.30 cycle.
However such property isn't defined now because since gjs 1.54, it can only
fetch introspected properties and St.ScrollViewFade was considered a private API
not exposed by gir.

Fix this by also introspecting st-scroll-view-fade sources.
Not being considered private anymore, install the header.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1061
2019-05-15 15:15:31 -05:00
Veerasamy Sevagen
b197a1affb cleanup: Fix spelling errors
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/515
2019-05-15 19:32:29 +00:00
Florian Müllner
0afd600ea4 st: Delay handling of :first/:last-child changes
Updating the :first/:last-child pseudo classes can result in a lot
of unnecessary style changes when bulk-adding children to a container,
as every child ends up as the new last child.

Address this by deferring the style change to an idle, so we only do
the work once for the actual first and last child.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/529
2019-05-07 20:28:03 +00:00
Florian Müllner
598407b14a Revert "st: Reload icon on style changes only if necessary"
The size isn't the only relevant style change, we also need to pick
up icon-colors, icon-style and icon-shadow.

This reverts commit 94995e9c1e.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/529
2019-05-07 20:28:03 +00:00
Florian Müllner
5520bb3890 texture-cache: Keep aspect ratio for content images
Images are loaded either with a supplied fixed size, or using the "native"
dimensions of the file. When creating a content image from the loaded data,
we currently simply apply this directly to the preferred size.

This works usually fine: GdkPixbuf will always keep the aspect ratio, so
if only one dimension is provided, the other will be adjusted accordingly:

Loading a 200x200 image with a requested size of (100, -1) will result in
a 100x100 content image.

There is a catch though: GdkPixbuf will only scale *down* to the requested
size, no up. That is, loading a 100x100 image with a requested size of
(200, -1) will result in a 100x100 pixbuf. But as we assume that the pixbuf
size matches the requested size, the image content ends up with 200x100.

Fix this by explicitly handling the case where only one size was supplied,
and make the other dimension take the aspect ratio into account

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/525
2019-05-04 00:50:31 +00:00
Carlos Garnacho
1ebbd7c768 st: Reimplement StClipboard on top of MetaSelection
And stop using X11/gdk for this.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/331
2019-05-02 15:58:51 +00:00
Carlos Garnacho
94995e9c1e st: Reload icon on style changes only if necessary
The parameters that may affect the icon on ::style-changed are more size
related than visual (we listen to icon theme changes for the latter). It
makes sense to just update the icon if the size came out different.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/524
2019-04-30 15:02:37 +02:00
Carlos Garnacho
fb04dafb0b st: Use g_signal_handler_disconnect() to disconnect from StTheme
With a high enough amount of actors, there may be enough theme nodes and
signal connections on StTheme::custom-stylesheets-changed that
g_signal_handlers_disconnect_by*() on dispose becomes expensive, this may
become a surprisingly hot spot in StWidget::style-changed.

Keep the handler ID around and use g_signal_handler_disconnect() to avoid
linear lookups for the matching func/data.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/524
2019-04-30 15:02:29 +02:00
Simon McVittie
0f531d8c44 ShellApp: Use g_signal_connect_object for window signals
A window being unmanaged can cause the ShellApp to be removed from
the ShellAppSystem, which if we are unlucky is the app's last
reference, causing it to be disposed and freed. It would be bad if this
happened before we finished handling the signal.

Use g_signal_connect_object to ensure that a reference is held to
the ShellApp for the duration of the signal handler, delaying its
last-unref.

In particular, when a signal handler calls _shell_app_remove_window(),
there is a brief period for which ShellApp breaks the intended
invariant (see !497) that app->running_state is non-NULL if and only if
app->running_state->windows is also non-NULL (non-empty). Freeing the
ShellApp at this point would cause a crash. This seems likely to be the
root cause of <https://gitlab.gnome.org/GNOME/gnome-shell/issues/750>,
<https://gitlab.gnome.org/GNOME/gnome-shell/issues/822> and
<https://bugs.debian.org/926212>.

Signed-off-by: Simon McVittie <smcv@debian.org>
2019-04-23 12:51:56 +00:00
Carlos Garnacho
f74c07b9ac st: Only emit ::style-changed on actual changes
Compare painting/geometry of old and new paint nodes, so it's ensured to
be only emitted on actual style changes. Emission still must be propagated
through to children, though.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1153
2019-04-22 18:48:57 +02:00
Georges Basile Stavracas Neto
4d4d5a0b16
shell, st: Adjust to CoglPipeline API changes
cogl_pipeline_set_layer_null_texture() now doesn't receive
the texture type, since it only supports 2D textures now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-18 16:33:06 -03:00
Georges Basile Stavracas Neto
03c4930883
util: Fix compiler warning
A harmless warning due to meta_surface_actor_get_texture()
now returning a pointer to MetaShapedTexture instead of
ClutterActor.

No functional changes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/502
2019-04-18 15:40:55 -03:00
Robert Mader
2b1d6e607f calendar-server: Add gnu_printf format attribute
Suggested by compiler with `-Wsuggest-attribute=format`

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/441
2019-04-17 21:39:03 +00:00
Robert Mader
1dff32e48a hotplug-sniffer: Add gnu_printf format attribute
Suggested by compiler with `-Wsuggest-attribute=format`

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/441
2019-04-17 21:39:03 +00:00
Robert Mader
1e3a174de9 na-tray-manager: Add missing void to functions with no arguments
to avoid "old-style function definition" and "function declaration
isn’t a prototype" warnings.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/441
2019-04-17 21:39:03 +00:00
Carlos Garnacho
a540fe4130 st: Round CSS units to the nearest multiple of the scale factor
Actors themed through CSS should ideally get sizes and positions that
conform to the "pixel grid". A notorious example is the panel that has a
height of 1.86em. On unchanged font settings and hidpi that translates to
55px, which leaves the workarea with "half pixels" that hidpi wayland
applications don't know how to fully cover.

If the requested height is a multiple of the scale factor, the workarea
and maximized applications can then work on full pixels.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/91
2019-04-17 18:46:37 +00:00
Florian Müllner
de6512be1a st: Add missing include
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/485
2019-04-08 18:17:46 +02:00
Florian Müllner
0b72ff1896 st: Add missing END_DECLS marker
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/485
2019-04-08 18:17:33 +02:00
Marco Trevisan (Treviño)
5357e0a18c st/settings: Add magnifier activation property and bind to settings
The same code for reading the current magnifier state is repeated in both
shell-recorder, shell-screenshot and magnifier itself.
So to move this inside a property of st-settings so that we can refer to it
all over the places removing duplications.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/473
2019-04-02 20:28:54 +00:00
Carlos Garnacho
1b5e91e4b3 shell: Fallback on ISO 8601 datetime string for screenshot date info
If the locale doesn't honor strftime()'s %c argument, we would end up
feeding NULLs into GdkPixbuf tagging. Fallback to a sensible (although
not nicely localized) datetime string.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1017
2019-04-02 00:25:39 +00:00
Florian Müllner
1767cd0f6c app: Consider "quit" action for quit
Just like we take a remote "new-window" action into account for
opening new windows, we should call an explicit "quit" action
before falling back to closing all the app's windows on quit.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-03-28 00:02:20 +00:00
Robert Mader
187c2193e8 st-theme-node-transition: Exclude get_new_paint_state() from introspection
to silence a build warning.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/449
2019-03-12 01:14:52 +00:00
Florian Müllner
706bdd8059 st-widget: Add missing g_return_val_if_fail()
It's a public function, so it's good practice to sanity-check its
input (unless disabled at compile time of course).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1018
2019-03-12 01:00:32 +00:00
Florian Müllner
9729a2e772 texture-cache: Apply resource scale to the right dimension
Size matters!

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/444
2019-03-12 00:48:11 +00:00
Florian Müllner
4f65283f31 app: Set styleclass on fallback app icons
For window backed apps, create_icon_texture() doesn't return an StIcon
but a generic widget. Set an appropriate style class to make it easier
to apply a specific style only to fallback icons.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1027
2019-03-08 16:20:21 +01:00
Florian Müllner
d86d3bbe54 texture-cache: Fall back to actor size for bound textures
With StImageContent, the meaning of passing -1 as size parameter changed
from "load the image at its preferred size" to "abort the session". It
is therefore no longer possible to just load the image and then have it
scaled by applying a CSS size to the texture's parent.

Setting the size from CSS is useful though, so to still allow that, fall
back to the actor's size (which can be determined by the style).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1027
2019-03-08 16:20:21 +01:00
Florian Müllner
6f794738e8 texture-cache: Load bound surfaces into StWidgets
Using widgets instead of plain actors will allow us to set the size
from CSS.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1027
2019-03-08 16:20:21 +01:00
Iain Lane
c73428247c
build: Add mutter's private directory to libst's build-time RPATH
We need this to run `test-theme`, otherwise when run as part of the
build tests it fails like:

  error while loading shared libraries: libmutter-cogl-4.so.0: cannot
  open shared object file: No such file or directory

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/442
2019-03-06 12:45:48 +00:00
Robert Mader
4785093a5c st-shadow: Remove unnecessary ';'
to silence a build warning.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/434
2019-03-04 22:29:33 +00:00
Florian Müllner
06174be777 build: Include test-theme in tests
It's an existing test that doesn't require interaction, so there's
no reason why it shouldn't be run by `ninja test`.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/419
2019-03-04 20:10:07 +00:00
Florian Müllner
fde8401124 test-theme: Change presumed CWD
The executable is assumed to be run from $top_srcdir/src, which is
essentially an autotools left-over (it's where the program ended
up with srcdir == builddir).

Now with meson, its actual srcdir makes more senses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/419
2019-03-04 20:10:07 +00:00
Florian Müllner
70ac33d58c test-theme: Force default resolution
Clutter no longer hard-codes a resolution of 96 DPI (although that's
still the default), so any assertions of sizes for physical units
may be off.

Fix this by setting up the test environment according to the
assumptions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/419
2019-03-04 20:10:07 +00:00
Robert Mader
5a897407d9 shell-tray-manager: Silence gdk_window_set_background_pattern warning
Apparently we can't get rid of it without breaking backward compatibility.
So let's stick to how GTK handles it and just silence the warning.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/423
2019-03-04 19:57:47 +00:00
Robert Mader
1b3c26364b na-tray-child: Silence gdk_window_set_background_pattern warnings
Apparently we can't get rid of them without breaking backward compatibility.
So let's stick to how GTK handles it and just silence the warnings.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/423
2019-03-04 19:57:47 +00:00
Florian Müllner
ae07aa7864 gtk-embed: Hide window actors from pick
Since we started to support tray icons on wayland, the icon we show
is not the actual XEmbed window. Instead, we let mutter create a
MetaWindow for it, then use its window actor as source for a clone
we (or nowadays: extensions) can add, remove and destroy freely.

To not let the real icon get in the way, we set an empty input shape
and make its window actor fully transparent. This works OK on X11,
but on wayland all events still go through Clutter, so any reactive
surface actor inside the window actor will block events for any actors
underneath (and status icons go into the top-windows group, so almost
all actors are affected).

Luckily we can pile another hack onto the pile of status icon hacks ...

https://gitlab.gnome.org/GNOME/gnome-shell/issues/191
2019-03-04 19:52:24 +00:00
Florian Müllner
4d0a742d64 st: Only consider visible children for :first/:last-child
While mapping the :first/:last-child pseudo classes directly to the
ClutterActor:first-child/:last-child properties allows for an easy
implementation, it is unexpected that rules can appear to not have
an effect because the selected child is hidden. GTK's behavior of
applying the classes to visible children makes much more sense, so
change our implementation to do the same.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/312
2019-03-02 12:19:40 +00:00
Niels De Graef
5f4e0e5ff8 plugin: Style consistency fix
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/315
2019-03-02 11:57:21 +00:00
Niels De Graef
a4c159ecad plugin: Use G_DECLARE_FINAL_TYPE
libmutter-4 added support for this, so we can also drop the boilerplate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/315
2019-03-02 11:57:21 +00:00
Niels De Graef
b1f893e998 plugin: Move class_init and init below methods
This allows us to get rid of all the forward declarations, tidying up
the file a bit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/315
2019-03-02 11:57:21 +00:00
Niels De Graef
789dc165af plugin: Add some comments on its purpose
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/315
2019-03-02 11:57:21 +00:00
Marco Trevisan (Treviño)
115eda9650 shell-screenshot: Apply monitor scale to cursor surface
When we grab a screenshot of a framebuffer scaled shell, we shoudl apply the
device scale to the image surface, while the monitor scaling should be applied
to the cursor surface, so that it's painted at proper coordinates and in proper
size in the generated image.

This is not needed for XWayland clients as they are not scaled anyways, while
for wayland clients that are painted in multiple monitors, this might cause
a lower quality cursor in the lower dpi monitor, because the cursor sprite is
generated for the monitor scale, and not for the surface scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
d027e35cef shell-screenshot: Always use "actors-painted" signal
Since we don't care about all the stage to be painted here, we can just proceed
when all the actors have been put in place.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
b3e178af9d shell-screenshot: Use mutter paint signals to optionally draw cursor
Under wayland, if the cursor should be included when doing a fullscreen
screenshot, we can rely on mutter "paint" signal to have it composited for free.
Otherwise if it's not requested, we can use the "actors-painted" signal to get a
stage texture before the mouse overlay has been added.

Instead, under X11 or when only a window screenshot is requested, we still
need to draw it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
559ec8750a shell-screenshot: Add utility function to check when draw the cursor
Don't repeat the same logic in multiple places, just set include_cursor to the
proper value once depending on the settings we have.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
02c3980b83 shell-screenshot: Initialize cursor tracker in draw cursor function
Avoid code duplication, since we're using this only if the cursor has to be
painted differently.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
6f027ee7dc shell-util: Apply resource_scale on clipping when getting the meta texture image
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
6d6c2e5b99 shell-recorder: Use clutter-computed sizes and scaling for the capture
Get from clutter the capture sizes and scale and don't mind
about doing any rounding here, as it might be different
from the one done at clutter level (causing mismatch and
not-working videos). Delegate this to clutter, and forget
about the internal details.

These values are then used to composte the image and set the video caps.

https://bugzilla.gnome.org/show_bug.cgi?id=7650111
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
2bda79cb3a st-texture-cache: Use GSlice to manage memory of leaders data
This allows some memory optimizations when possible, so let's use it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
19c60ff5c5 st-texture-cache: use StImageContent for cairo bound surface
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
e3c5c9a2e7 st-texture-cache: Cancel sliced image loading on target actor destroy
It might happen that the target clutter actor that we return on call
of st_texture_cache_load_sliced_image might be destroyed while the
loading task is still running. To protect from this, let's connect
to "destroy" signal and when this happens we use a cancellable to
stop the task.

This allows to safely reuse the return value of this function to
cancel the execution and avoiding that load_callback is called
even for a request that is not anymore under our control.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
2c17c186b8 st-texture-cache: Load sliced contents with REQUEST_CONTENTENT_SIZE
When loading an actor for a sliced image actor, we can now use the
REQUEST_CONTENT_SIZE request-mode for the actor since we the content image
has now a predictable size and thus we can be sure that the size will be applied
taking care of the resource scale.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Marco Trevisan (Treviño)
ef1697d00d st-texture-cache: Set sliced actor size in logical size
The actor size should be set in logical size more than in the actual size
of the texture when using resource scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:53 +00:00
Jonas Ådahl
40e7638a4b st-icon: Add resource-scale support
This commit adds support for scaling the StIcon resource (the icon
texture) according to the resource scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
aaf69b2898 st-texture-cache: Use StContentImage to create actor contents
This will allow to use resource-scale aware content that will use a preferred
size that takes in account the icon scaling and the resource scaling.

If no size is passed we should just divide the actual resource size by the
resource scale, as we assume that it's loaded with such scaling applied.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
0464361ca5 st-image-content: Wrap ClutterImage with explicit preferred size
Create StImageContent as a simple ClutterImage with preferred width/height
properties in order to be able to use explicit sizing when creating clutter
contents that will be applied to actors whose size depends on the content itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
420697693b st-texture-cache: Separate 'scale' to 'paint_scale' and 'resource_scale'
Instead of just passing a scale when getting a cached icon, pass both a
'paint_scale', the scale of which the icon will be painted on the
stage, and a 'resource_scale', the scale of the resource used for
painting.

In effect, the texture size will use the scale 'paint_scale * resource_scale'
in a ceiled value while the size of the actor will use 'paint_scale' when
determining the size.
this would load a bigger texture, but the downscaling would keep the visual
quality.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
37f53a42da st: Create shadow pipeline taking resource scale in account
The shadow pipeline is created doing software blurring of the texture so the
shadow spec blur parameter should be scaled accordingly with the texture scaling
otherwise we won't take enough pixels in account creating stronger shadows.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
5617ffc79c st: Use scaled surfaces for creating cairo background shadows
Create the surfaces for background shadows at scaled sizes and then draw on them
using logical coordinates, by setting the surface device scale accordingly.

Use the said surface scale when generating the actual shadow cairo pattern
but in such case, to reduce the number of code changes, is better to work in
absolute coordinates, and to do so:
  1) Create a temporary shadow-spec copy with scaled values to absolute sizes
  2) Invert the scaling on the shadow matrix
  3) Do the actual painting in absolute coordinates
  4) Set the shadow matrix scaling back to the logical coordinates.

Finally scale down the created shadow pattern surface size when painting it,
applying again a reverse scale to the matrix.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
ca4d86e9e5 st-shadow: Define autoptr cleanup function for StShadow
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
0141fef561 st-theme-node: Paint elements in resource-scale scaled surfaces
Pass resource-scale to drawing phase, and use it to create texture
surfaces scaled with the widget current scaling.
Also redraw by default widgets when the resource scale changes.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Jonas Ådahl
5d4a804c90 st-shadow: Ceil size before comparing with texture
A fractional resource scale would mean we never use the fast path for
creating the shadow, because we'd cast the int to a float before
comparing, which would never match.

Instead compare the expected texture size with the source texture, to
actually potentially trigger the fast path.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Jonas Ådahl
6bc3300e5a st-scroll-view-fade: Include outer bound of pixel on border
The fade shader will draw the fade effect up until the border pixel. If
we set the bottom right coordinate to the outer edge of the pixel we
might end up not drawing the fade effect on all of the pixels. This
could for example happen if one logical pixel (clutter stage pixel)
consists of more than one physical pixel.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
15f69bdc3b st-label: Paint shadow using resource-scaled texture
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
0bcf76970a st-private: Scale shadows accordingly to actor resource scaling
Use scaled offscreen framebuffer to paint shadows so that it will match the
scaling applied to the actual actor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Marco Trevisan (Treviño)
03c4628cad st-drawing-area: Draw content taking care of the resource_scale
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Jonas Ådahl
9f4ae9618a st-widget: Introduce widget resource scale
This commit makes StWidget manage the scale of which its associated
resources should be multiplied with. The resource scale is calculated
by clutter, and is retrieved by clutter_actor_get_resource_scale(). Due
to the resource scale not always being available, the getter may fail,
and the actual widget that draws the content will have to deal with
this situation.

As the resource scale depends on where on the stage the widget is drawn,
the resource scale will in general be available once the widget is
mapped.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:52 +00:00
Robert Mader
94a674c008 na-tray-manager: Use gdk_screen_get_default() and gdk_x11_get_default_screen()
instead of explicit screen arguments and `gdk_screen_get_number()`, as nowadays there
is always only one screen. This silences some deprecation warnings and removes
deprecated API.

Bonus: some code style cleanups

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/422
2019-02-27 00:35:04 +01:00
Florian Müllner
ffb9aa1ace test-theme: Stop using ClutterCairoTexture
It's deprecated, so use one of our own types for testing type
inheritance.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/420
2019-02-26 03:04:00 +01:00
Robert Mader
823fd855cf na-tray-child: Silence some deprecation warnings
Use `gdk_x11_display_error_trap_...` instead of `gdk_error_trap_...`

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/417
2019-02-26 01:37:54 +01:00
Robert Mader
f5ee225362 shell-tray-icon: Silence some deprecation warnings
Use `gdk_x11_display_error_trap_...` instead of `gdk_error_trap_...`

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/417
2019-02-26 01:37:46 +01:00
Andrea Azzarone
ff1ea4b1c9 st-clipboard: Remove get/set_property functions.
Remove st_clipboard_get_property and st_clipboard_set_property because they are
identical to the default implementation.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/414
2019-02-26 00:23:36 +00:00
Florian Müllner
81f0e7de9e texture-cache: Use content size for returned images
Since commit deec0bf255, the texture cache is based on ClutterImage
rather than ClutterTexture. As ClutterImage (like all ClutterContent)
is only concerned with painting, it doesn't influence the size of the
actor it is added to at all, and the returned actor will now stay at
size 0x0 after the image has been loaded.

Set up the actor to follow the content's size instead, to get closer
to the previous behavior.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/402
2019-02-10 19:29:13 +00:00
Florian Müllner
8003f8b803 build: Don't introspect ShellMenu
It is now only used internally by ShellApp to track remote actions,
so there's no need to expose it to javascript code.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Florian Müllner
7df93458d7 build: Remove remote menu support
It is now unused.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Florian Müllner
753618a19f app: Remove :menu property
It is now unused.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Florian Müllner
e355756758 app: Don't rely on app menu to check for GtkApplications
As the app menu is being phased out, it is no longer a good indicator
for GtkApplications. Instead, base the check directly on the appropriate
D-Bus properties.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Carlos Garnacho
b092c5f37d st: Honor button mask on touch events
Even though it's not a "button", we use button1 to map to actions. Seems
fair to refuse to press the StButton if it would not react to button1.
2019-02-05 16:25:54 +01:00
Florian Müllner
446183adee app: Remove unused code
This was overlooked back in the day when application search moved into GIO.
2019-02-05 01:54:17 +01:00
Carlos Garnacho
d8593c5b4a st: Init icon theme in StSettings
This was not initialized, leaving a default icon theme unless
changed later.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/953
2019-02-04 17:13:36 +00:00
Carlos Garnacho
8647922df9 st: Use StSettings for primary-paste setting
If middle-click happens, check whether the setting is enabled
and paste primary selection if so.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 23:18:53 +01:00
Carlos Garnacho
df3068d9ca st: Use StSettings for enable-animations check
Keep a statically allocated one so all widgets will use a single
object.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 23:18:53 +01:00
Carlos Garnacho
036e67049b st-texture-cache: Use GtkIconTheme separate from GTK+
Using the default icon theme just has automatic theme updates as an added
value. We can do that ourselves, and stop relying on XSettings internally.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 23:18:53 +01:00
Carlos Garnacho
fef2bac8ab st: Add StSettings object
This is a GtkSettings lookalike, so the shell can fetch the relevant
settings.
2019-01-30 23:18:53 +01:00
Carlos Garnacho
c59c5eb893 st: Add StDirectionType enum
In order to replace GTK+'s GtkDirectionType. It's bit-compatible with it,
too. All callers have been updated to use it.

This is a purely accessory change in terms of X11 Display usage cleanup,
but helps see better what is left.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 22:50:01 +01:00
Carlos Garnacho
a977c1388a st: Add StPolicyType enum
In order to replace GTK+'s GtkPolicyType. It's bit-compatible with it, too.
All callers have been updated to use it.

This is a purely accessory change in terms of X11 Display usage cleanup,
but helps see better what is left.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 22:50:01 +01:00
Carlos Garnacho
0fdfebdb67 shell: Drop some unused headers and Gdk variables
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 22:50:01 +01:00
Florian Müllner
f4a64f77f2 util: Use (thread-safe) uselocale()
Our helper method to translate a string according to the LC_TIME
setting uses the no-thread-safe setlocale(). While that's not an
issue in practice given that all JS code shares a single thread,
I was pointed to a better alternative when adopting the same
handling in gnome-desktop's wallclock[0].

[0] https://gitlab.gnome.org/GNOME/gnome-desktop/merge_requests/17

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/292
2019-01-30 20:35:04 +01:00
Carlos Garnacho
b597d5faf0 shell-global: Use MetaLaunchContext instead of GdkLaunchContext
Is functionally the same, without requiring the MetaX11Display.
2019-01-30 13:11:29 +01:00
Georges Basile Stavracas Neto
69b1fb699f
app: Replace ClutterTexture by ClutterActor
It apparently uses no ClutterTexture specifics, and instead
only tries to match what StTextureCache used to return.

Since StTextureCache now returns ClutterActor, also use a
ClutterActor on ShellApp.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/373
2019-01-29 17:11:13 -02:00
Georges Basile Stavracas Neto
259f90bbf6
texture-cache: Fix documentation error
It now returns a ClutterActor, not a ClutterTexture.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/371
2019-01-29 16:38:04 -02:00
Georges Basile Stavracas Neto
8665045326
st: Check for ClutterImage when creating shadow pipelines
_st_create_shadow_pipeline_from_actor creates shadow pipelines
from actors. This function special-cases ClutterTexture as a
small performance improvement, since we can have access to the
CoglTexture easily with it. However, recent commits removed all
usage of ClutterTexture from GNOME Shell, rendering this optimization
useless. Instead, actors now may have a ClutterImage set as
their content, that can be used instead.

Replace the check for ClutterTexture with a check for ClutterImage,
and use the texture of the image when it is available.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/371
2019-01-29 16:38:04 -02:00
Georges Basile Stavracas Neto
a7bb8ee639
magnifier: Use a ClutterContent to render mouse sprite
The Magnifier class uses a small subtree of actors to track the
current cursor's position and sprite. Specifically, it uses the
deprecated ClutterTexture to paint the cursor sprites.

Add a new, very simple ClutterContent implementation to track the
cursor sprite, and replace the ClutterTexture by a ClutterActor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/371
2019-01-29 16:31:57 -02:00
Carlos Garnacho
95a31b0c31 st: Use ClutterKeymap to detect caps lock state changes
This drops usage of Gtk/X11, replacing it with code that is dependent
of the Clutter backend in use. Another positive side effect is that
the keymap state will now be correct on wayland, since there were no
guarantees that X11 key state would reflect the current reality.

https://bugzilla.gnome.org/show_bug.cgi?id=762881
2019-01-29 16:03:22 +00:00
Carlos Garnacho
86a00b6872 shell-global: Make saving of persistent state asynchronous
This is an expensive operation that is best avoided in the main loop. Given
the call doesn't care much about returning error or status, it can just
be made async within.

Every operation on a given file will be destructive wrt previous
operations on the same file, so we just cancel any pending operation on
it before batching the current one.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/815
2019-01-28 14:56:08 +00:00
Georges Basile Stavracas Neto
23d6d13d80
st-shadow: Add a CoglFramebuffer argument
The last patch in the series, this one adapts StShadowHelper
to received a CoglFramebuffer. This is where we first touch
JavaScript with Cogl types, and as such, it depends on the
latest Mutter. Earlier versions of Mutter didn't have its
Mutter-Clutter GIR to generate types for various Cogl types.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/283
2019-01-28 12:35:54 -02:00
Georges Basile Stavracas Neto
09addfc87c
st-private: Receive a CoglFramebuffer
Same case of the previous patch; _st_paint_shadow_with_opacity()
uses cogl_get_draw_framebuffer(), and this patch makes it receive
a CoglFramebuffer as a parameter instead.

The cautious reader might notice that this commit apparently goes
against the long-term goal, for it introduces more instances of
cogl_get_draw_framebuffer(). This is not wrong, but these introduced
ones will be removed later on, when ClutterActor.paint() receives
a CoglFramebuffer as a parameter instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/283
2019-01-28 12:35:51 -02:00
Georges Basile Stavracas Neto
a2f27a9409
theme-node-transition: Receive a CoglFramebuffer
This is in preparation for a future where only explicit frambuffer
APIs are available, i.e., cogl_get_draw_framebuffer() does not
exist.

There is absolutely no functional changes in this patch (nor the
following ones in this series), only rearrangements so that various
functions receive a CoglFramebuffer instead of using the draw
framebuffer.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/283
2019-01-28 12:35:41 -02:00
Carlos Garnacho
69ad75cf48 shell-app-system: Cache GAppInfos around
This was called here just to end up emitting ::installed-changed,
which would trigger other g_app_info_get_all() calls. Cache it here
so it may be reused later on.
2019-01-26 22:55:31 +01:00
verdre
99ce3deeb0 st-button: Handle touch-cancel events
Handling those events is neccessary if a touch event that pressed down a
button turns out to be a gesture. In this case the button should be
released without emitting the clicked signal.
2019-01-25 10:31:41 +00:00
Georges Basile Stavracas Neto
3dcb593a71
texture-cache: Simplify function with g_autoptr
st_texture_cache_reset_texture() is slightly easier to
read and follow by using g_autoptr, so use that.
2019-01-24 16:23:58 -02:00
Georges Basile Stavracas Neto
1847a4f4cc
texture-cache: Avoid creating unnecessary ClutterImages
After loading the GdkPixbuf, StTextureCache unconditionally
creates a ClutterImage and, if it's not in the cache, add
it to the cache. That's a waste of resources when the image
is already committed to the texture cache.

Fix that by reusing the ClutterImage of the cache if it is
already there; otherwise, create a new ClutterImage as we
were previously doing.
2019-01-24 16:23:58 -02:00
Georges Basile Stavracas Neto
deec0bf255
texture-cache: Replace ClutterTexture by ClutterImage
ClutterTexture is a deprecated class that is simultaneously
an actor, and the content of the actor. Clutter's new model
is to separate painting (via ClutterContent) from actors.

Currently, StTextureCache relies on ClutterTexture to store
the loaded textures. This not only does not match the latest
practices of Clutter, but also generates various compile-time
warnings.

Port StTextureCache to store ClutterImages instead of storing
ClutterTextures. ClutterImage exposes the internal CoglTexture,
so no helpers are needed to match the current StTextureCache
API. Aspect ratio was dropped, but from my testing, it doesn't
change anything.
2019-01-24 16:23:58 -02:00
Niels De Graef
7c4e43c84f Remove deprecated CoglHandle
Prefer something a bit more type-safe instead and in the meantime use
the newly available `cogl_clear_object` to simplify some code a bit.
2019-01-16 17:54:29 +00:00
Carlos Garnacho
3989cad3db build: Remove Canberra dependency
It is no longer direct, but rather through mutter API.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327
2019-01-09 23:09:18 +00:00
Carlos Garnacho
2a1f915f9d global: Drop API to play sounds
All callers have been updated to use MetaSoundPlayer. This drops direct
usage of libcanberra-gtk, and the X11 connection indirectly. One thing
worth noting is that we pass less metadata (eg. event x/y that might be
used for surrounding effects). This was all largely unused, so the
MetaSoundPlayer was made simpler.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327
2019-01-09 23:09:18 +00:00
Florian Müllner
925a25da17 st: Avoid integer overflow on unpremultiply
When computing the effective border color, we operate on colors with
premultiplied alpha to simplify the calculations, then unpremultiply
the result. However we miss a bounds check in the last check, so any
color component can overflow the allowed maximum of 0xff and shift the
result in unexpected ways.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/305
2018-12-04 15:55:39 +00:00
Cosimo Cecchi
6743c18fdf StWidget: don't forget to invalidate the paint state if not on stage
If the actor is not on the stage yet (i.e. does not have a theme
node), but has a paint state cached, we currently fail to invalidate
it, which will lead to the actor painting with old contents once it
gets onto the stage.

This commit fixes the issue by changing our invalidation strategy;
previously we were looking at the widget's own theme node to determine
if it should be invalidated or not.
Now we look at the theme nodes of our cached paint states. When the
widget is mapped on stage, those are the same as the widget's own
theme node, but when the widget is not on the stage, we'll still be
able to invalidate them.

As part of this, we move the invalidation API to StThemeNodePaintState,
which is a more natural place for our use case.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/314
2018-12-04 15:52:36 +00:00
Marco Trevisan (Treviño)
4c11d15a07 st-button: Ignore pointer emulated touch events
In X11, pointer emulated touch events are replicated with normal PRESS, RELEASE
pair events which are generated by the server. Thus for a single tap we get:
 - TOUCH_BEGIN -> TOUCH_END, PRESS -> RELEASE

This will cause st-button to send two "clicked" signals, instead of just one,
breaking extensions (like dash-to-dock) that show buttons in the main stage
which will be checked two times or that will receive the same signal two times.
2018-11-26 21:18:25 +00:00
Carlos Garnacho
cdb8ac3a2f shell: Hide/drop unused public API
These static methods won't work as-is as MetaStartupSequence API in
JS bindings. Luckily those are used nowhere there.
2018-11-23 13:58:35 +01:00
Carlos Garnacho
10b3671a99 shell: Use MetaStartupNotification
This is "API compatible" with ShellStartupNotification, so only
C changes are necessary.
2018-11-23 13:58:35 +01:00
Jasper St. Pierre
43041f0464 app-usage: Remove more unused things
https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
Jasper St. Pierre
c3ec813f6f app-usage: Remove unused open-window-count attribute
Since this has already been unused and was inaccessible, this shouldn't
matter too much.

https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
Jasper St. Pierre
04d7069d83 app-usage: Remove crufty old "context"s idea
Back in the day, there was a proposed system of tracking apps in a
specific context.

The inspiration was that you may have used apps in multiple modes:
Firefox may have been used in both "Programmer Reference" and
"Kitten Videos" contexts. Early user response to the feedback wasn't
too positive - context switching is something that humans have trouble
doing implicitly, let alone explicitly. The old codebase still has a
few remnants of this around; let's finally put them to rest.

Note that we still write out a dummy context tag to the XML file - old
versions of the shell will flat out crash if you don't have one of those
in there, so just leave it in for compatibility sake.

https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
Georges Basile Stavracas Neto
361cc6cf92
st: Remove deprecated cogl_texture_new()
cogl_texture_new() is used in a few places in GNOME Shell, but
it's a deprecated Cogl function. The replacement is the less
verbose cogl_texture_2d_new_with_size(), that is very much a
straightforward replacement.

Remove the few places where this function is used, replacing
it by the CoglTexture2d counterpart.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/287
2018-11-12 21:59:36 -02:00
Cosimo Cecchi
ca3f4cfb41 StTextureCache: use right event to detect file changes
StTextureCache installs file monitors that invalidate caches when
contents of the underlying file change.
At the moment, the cache uses the Gio.FileMonitorEvent.CHANGED event
type to make that determination.

However, that is suboptimal for at least two reasons:
- while a file is being written to disk, many CHANGED events will be
  emitted in sequence. That will cause needless cache invalidations,
  and we will risk loading the file before it's fully loaded.
- if an existing file is replaced, e.g. with g_file_replace(), we may
  not get a CHANGED event but a CREATED one instead, so the cache ends
  up never getting invalidated.

The good news is that in both of those cases GFileMonitor will send a
CHANGES_DONE_HINT event after changes have settled, or after the file
is replaced.

This commit fixes both cases by switching from the CHANGED event to
CHANGES_DONE_HINT to determine that a file has in fact changed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/286
2018-11-10 00:42:49 +01:00
Georges Basile Stavracas Neto
127ba318fd
polkit: Only unregister registered handles
If the initialization fails for some reason, for example by
running 'gnome-shell --replace', we should not crash because
of an attempt of unregistering an unregistered agent handle.

Fix that by checking if the handle is not NULL before calling
the unregistering routines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
2018-11-06 13:05:29 -02:00
Georges Basile Stavracas Neto
72fa44d0fd
polkit: Port to G_DECLARE_FINAL_CLASS
So we can remove this old boilerplate code. In order to be able
to use that, the autoptr function for PolkitAgentListener was
added as well.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
2018-11-06 13:05:15 -02:00
Georges Basile Stavracas Neto
655234e6c3
shell: Remove ShellGenericContainer
Now that it is no longer used in GNOME Shell, let's
remove this old workaround. This commit also removes
the docs reference from the sgml file.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:44:14 -03:00
Georges Basile Stavracas Neto
b719744e75
st-bin: Destroy child in ClutterActor:destroy vfunc
According to Clutter documentation, "[…] actors implementing the
ClutterContainer interface should override the default implementation
of the class handler of this signal and call clutter_actor_destroy()
on their  children."

StBin was doing that in GObject:dispose() instead. Move the child
destruction to a new ClutterActor:destroy() vfunc override.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
2717ca9d08
st-box-layout: Pass correct allocation box to layout manager
StBoxLayout implements StScrollable, which, semantically, means that
the StBoxLayout size may not match the minimum size reported by the
layout manager. In this specific case, the layout manager by is a
ClutterBoxLayout by default. For example:

        +--------------+
        |   Viewport   |
 +------+--------------+-----------------+
 |      |              |                 |
 |      |              |     Content     |
 |      |              |                 |
 +------+--------------+-----------------+
        |              |
        +--------------+

So, assuming that:

 - ContentSize = the minimum size of the content;
 - ViewportSize = the allocated size of the viewport;

When allocating StBoxLayout, it must assume ViewportSize, but must
pass ContentSize to the layout manager. That way, the children of
StBoxLayout are correctly placed within it, even if it's bigger than
ViewportSize.

And here's the problem: right now, StBoxLayout assumes ViewportSize
AND also passes it to layout manager. Commit 77c4c6b6d specifically
exposed this bug by relying entirely on StBoxLayout to arrange the
app and window icons.

Fix that by using ViewportSize to allocate StBoxLayout itself, but
passing ContentSize to the layout manager.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Florian Müllner
44b871da92 shell: Fix list of GIR includes
gjs now relies entirely on introspection data to determine parent
types and implemented interfaces, so in order to have all methods
and properties resolve correctly, we must include the corresponding
GIRs of all types used.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/574
2018-09-25 23:57:51 +00:00
Florian Müllner
3e29ab5441 build: Remove obsolete soup dependency
It's unused since commit 96396163c ...

https://gitlab.gnome.org/GNOME/gnome-shell/issues/574
2018-09-25 23:57:51 +00:00
Florian Müllner
87a645aa2b app: Close all closable windows from quit()
There's no relation between a window being hidden from overview/taskbars
and a window not being closable - currently we effectively disable the
fallback quit action for any application with open transients, which
simply doesn't make sense.

Instead, only exclude windows for which the close action has been
explicitly disabled.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/217
2018-09-13 10:54:39 +00:00
Carlos Garnacho
dd59212d3f st: Use ClutterClickAction on StEntry primary/secondary icons
This makes them work on touchscreens as well.

Closes: #116
2018-08-17 18:27:44 +00:00
Florian Müllner
95788c9834 build: Use dedicated resources for helper programs
Using a single resource file for all JS sources saves a couple of
build system instructions, but has some serious downsides:

 - bundling the entire shell code with the tools blows
   up their size unnecessarily

 - the tools are rebuilt unnecessarily for any shell
   code change

Autotools was painful enough to let this slip, but with meson we
don't have any excuses - using the actual dependencies speeds up
the build a tiny bit and reduces the tools' sizes from over 2M
to about 50k.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/192
2018-08-14 17:28:04 +00:00
Florian Müllner
9cf571efbd build: Clean up tools' dependencies
Simply reusing the same dependencies as gnome-shell itself not only
means that we link tons of stuff unnecessarily, but also that we
have to do the whole mutter rpath dance for nothing. Just use the
dependencies those executables actually need for a nice cleanup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/192
2018-08-14 17:28:03 +00:00
Florian Müllner
dc4128c78b build: Don't modify typelib search path in tools
We need this in the main gnome-shell executable in order to locate
the private Shell and St typelibs, but those aren't useful or even
usable in the extension-prefs/portal helper tools.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/192
2018-08-14 17:28:03 +00:00
Florian Müllner
393d7246cc Replace custom override schema with per-desktop override
GSettings now recognizes per-desktop overrides that can be used
to change schemas' default values for a particular desktop. This
is not entirely unlike our existing custom override mechanism in
mutter, except that it is not limited to keys in org.gnome.mutter,
and it doesn't require a separate schema - the latter means that
we (and gnome-teak-tool) no longer have to figure out the correct
schema for the current login session and just use the original one.

https://bugzilla.gnome.org/show_bug.cgi?id=786496
2018-07-31 18:36:26 +00:00
Georges Basile Stavracas Neto
2991f9f102 util: Fix code style
The C code introduced in 49d8ff38e did not follow
GNOME Shell's C code style. This commit adjusts it
to comply with the correct code style.
2018-07-30 21:23:28 -03:00
Daniel Drake
49d8ff38e7 Add check_cloexec_fds debug command
Add a debug command (to be executed manually via Alt+F2) to check
that all of gnome-shell's file descriptors have the CLOEXEC flag set.
This is important so that internal file descriptors do not get passed
to apps when they are launched.

It prints a warning message for every fd that does not have the flag set.

fdwalk() is used from the standard library if available (it is not
available in glibc), otherwise we use the same implementation as glib
has internally.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/132
2018-07-30 23:11:41 +00:00
Daniel Drake
4b522a02c3 shell-app: remove child_setup from app launching
When the amount of free memory on the system is somewhat low, gnome-shell
will sometimes fail to launch apps, reporting the error:
  fork(): Cannot allocate memory

fork() is failing here because while cloning the process virtual address
space, Linux worries that the thread being forked may end up COWing the
entire address space of the parent process (gnome-shell, which is
memory-hungry), and there is not enough free memory to permit that to
happen. This check is somewhat irrelevant because we are only forking
to immediately exec(), which will discard the whole virtual address
space anyway.

This issue can be avoided by using a new optimized gspawn codepath in
the latest glib development version, which uses posix_spawn() internally.

For the optimized codepath to be used, we must not pass a child_setup
function, so the the file descriptor management is reimplemented here
using new glib API to pass fds to the child process. The old API will
continue to be used on older glib versions.

We must also change the spawn flags for this code path to be hit.
I checked that gnome-shell's open file descriptors are all CLOEXEC
so using G_SPAWN_LEAVE_DESCRIPTORS_OPEN should be safe.

This will result in more resilient app launching when memory is low,
since the optimized spawn path avoids cloning the virtual address
space of the parent process (gnome-shell) and avoids the irrelevant
memory overcommit check.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/132
2018-07-30 23:11:41 +00:00
Florian Müllner
3efd296fc3 app: Consider "new-window" action for opening new windows
While can_open_new_window() uses some elaborate heuristics to predict
whether an application can open multiple windows, open_new_window()
will always simply relaunch the application. This is often the best
we can do, but when an application provides a "new-window" action in
its .desktop file or on the bus, it is much more likely to work as
expected than blindly activating the app and hoping for a particular
behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=756844
2018-07-30 19:21:40 +00:00
Florian Müllner
be84a00022 screenshot: Add pick_color() method
Graphical applications like GIMP or GIMP allow picking colors from
any location on-screen. In order to keep supporting this feature
on wayland and in sandboxed apps, we will expose an appropriate
method in the Screenshot interface, so first add a corresponding
method to ShellScreenshot.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/286
2018-07-30 16:55:10 +00:00
Florian Müllner
da537cda43 screenshot: Adopt GIO's async pattern
A custom callback type is more convenient, but only as long as no
other callback type is required. We are about to add functionality
that does not return the filename to a screenshot saved on disk, so
prepare for that by moving to GIO's generic async callback pattern.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/286
2018-07-30 16:55:09 +00:00
Iain Lane
a5937d1d6d Add systemd units
So that we can be started by systemd --user, instead of gnome-session.

There are three units:

  - gnome-shell.service: Start gnome-shell itself.
  - gnome-shell-x11.target, gnome-shell-wayland.target: Sync points for
    units that need to care if x11 or wayland is in use.
    gnome-settings-daemon will use these, for example.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/138
2018-07-17 18:10:06 +00:00
Jasper St. Pierre
50e849a186 st-texture-cache: Obey cache policy in st_texture_cache_load
https://bugzilla.gnome.org/show_bug.cgi?id=663461
2018-07-13 20:50:08 +00:00
Carlos Garnacho
b1b455ff1a st-adjustment: Mark all properties as EXPLICIT_NOTIFY
All adjustment setter functions take good care of avoiding emission of
notify:: when it's not needed. The set_property() implementation already
calls into the setter functions, so mark the properties as EXPLICITY_NOTIFY
in order to optimize notify:: emission away through g_object_set (rather
common from JS code).
2018-07-13 11:53:46 +00:00
Carlos Garnacho
ab4c72d758 st-box-layout: Queue relayout on adjustment changes
The actor allocation doesn't change per-se, but apply_transform()
will practically transform it. In order to have the paint volume
update accordingly, queue a relayout.
2018-07-13 11:53:46 +00:00
Carlos Garnacho
86a520b880 st: Clip StEntry to allocation
The default get_paint_volume() implementation will do the union
of children, and the child ClutterText paint volume may expand
beyond StEntry size when text overflows.

We actually want all content to be clipped to the StEntry, so
implement get_paint_volume() and tell it so.
2018-07-13 11:53:45 +00:00
Carlos Garnacho
4bf033a885 st: Make StScrollables' paint volume reflect the unconstrained view
And constrain it in StScrollView instead (instead of falling back to an
infinite paint volume, as the actor as paint/pick impls, but no
corresponding get_paint_volume one).

Fixes artifacts with the AppView (and possibly other places) when paint
volumes are aggressively cached.
2018-07-13 11:53:45 +00:00
Jonas Ådahl
47ea10b7c9 Remove usage of MetaScreen
Remove any usage of MetaScreen, as it has been removed from libmutter
in the API version 3. The corresponding functionality has been moved
into three different places: MetaDisplay, MetaX11Display (for X11
specific functionality) and MetaWorkspaceManager.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:56:19 +02:00
Marco Trevisan (Treviño)
e39d7152f2 st-private: Warn if creating shadow for unallocated actors 2018-06-29 11:00:25 +02:00
Marco Trevisan (Treviño)
e522e2e804 st-icon: Create shadow pipeline only at paint
Don't try to allocate the shadow after allocation, just do it at paint
as it's done by other shadowed widgets
2018-06-29 10:43:12 +02:00
Marco Trevisan (Treviño)
2ba26407f1 st-icon: Remove unused size values 2018-06-29 10:43:12 +02:00
Marco Trevisan (Treviño)
1f03599d1c st-texture-cache: Save cairo surfaces to a different map
The default keyed_surface is meant to handle CoglTextures thus we can't
add cairo surfaces to it, as the DestroyNotify function won't handle them.

Then the quicker way is to just add another Hash table for handling
such types of textures, with proper destroy function.
2018-06-21 00:56:36 +02:00
Marco Trevisan (Treviño)
a24999b7a3 st-texture-cache: Don't add NULL textures to cache
This might cause a crash when cleaning up the cache as the hash table has
cogl_object_unref as DestroyNotify function but that assumes that
the passed object is a valid CoglObject.

Fixes: #210
2018-06-21 00:48:54 +02:00
Ryan Hendrickson
f56ba0877a st: Add support for font-feature-settings
Cantarell now supports tabular figures, which are useful in places
where digits should either align or not use different widths. In
order to allow elements to request the feature, add support for
the corresponding CSS property[0].

[0] https://www.w3.org/TR/css-fonts-3/#font-rend-desc

https://gitlab.gnome.org/GNOME/gnome-shell/issues/34
2018-06-08 18:45:07 +02:00
Florian Müllner
5ac6201d91 test-theme: Fix a comment 2018-06-08 17:39:13 +02:00
Florian Müllner
7a3927c168 screenshot: Store creation time in metadata
It's useful information, even when we are not using JPEG/Exif - at
least nautilus will show it in its image properties.

https://bugzilla.gnome.org/show_bug.cgi?id=790481
2018-05-31 11:36:27 +00:00
Marco Trevisan (Treviño)
44894262f4 st-label: Unset clutter text instance on disposal
The instance is owned by the actor (being its child), and thus when the
disposal happens for the parent the text is disposed too, thus it's just
safer to nullify its reference so that we won't try to access to invalid
objects later, and this might be the case since the JS objects could be kept
around until they aren't finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=788931
2018-05-29 02:28:26 +03:00