Commit Graph

2373 Commits

Author SHA1 Message Date
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