Commit Graph

5861 Commits

Author SHA1 Message Date
Daniel van Vugt
0e0574a0b4 iconGrid: Eliminate JavaScript for painting/picking
The only reason for `vfunc_paint` and `vfunc_pick` existing was to
implement a culling optimization. Although that optimization actually
made performance worse than none at all because it forced the painting
and picking cycles to spend more time calling into JavaScript.

Turns out we don't have to choose between native code and culling though.
Just reimplement the culling using native ClutterActor functions and we
get the benefits of both.

Performance on an i7-7700:

Moving the cursor over the icon grid:
Before: 70% CPU, 5.5ms per frame
After : 60% CPU, 4.5ms per frame

Scrolling the icon grid:
Before: 60% CPU, 4.4ms per frame
After : 50% CPU, 3.3ms per frame

Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/174
2018-11-27 13:25:37 +00:00
daniruiz
3217c10ff2 theme: Replace calendar arrow images with symbolic icons and CSS
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/301
2018-11-26 15:34:08 +00:00
Sam Hewitt
4d2dce2c52 theme: Drop custom assets for window close buttons in overview
They can be replaced by a themed icon and some CSS styling.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/782
2018-11-22 23:50:24 +01:00
Andrea Azzarone
ff2fbf5ae4 dash: destroy items's child before tooltip
Destroy the DashItemContainer's child from the same handler as the tooltip. This
will prevent invalid reads when the item is destroyed while its quicklist is
still open.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/781
2018-11-19 15:51:32 +00:00
Florian Müllner
e77463b875 altSwitcher: Fix error when all alternatives are disabled
While we do consider the case that we don't have a child to show for the
visibility, we are still trying to move the click action unconditionally.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/783
2018-11-17 12:18:23 +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
João Paulo Rechi Vita
52c59ac0dd power: Label the PENDING_CHARGE state as "Not Charging"
The pending-charge state means AC power is on but the battery is not
being charged. This can happen because its charge is above a certain
threshold, to avoid short charging cycles and prolong the battery's
life, or because the PSU is not powerful enough to charge the batteries.

Instead of lying to the user about something being estimated, we should
simply tell the truth and set the label to "Not Charging".

Closes: #701.
2018-11-14 13:51:26 -08:00
Florian Müllner
240f3faf6e windowAttentionHandler: Fix syntax errors
Gah, why didn't we catch those?!
2018-11-14 19:38:33 +01:00
Florian Müllner
284978757e windowAttentionHandler: Handle XUrgencyHint as well
While it's not commonly used, it is easy enough to handle it the
same as the demands-attention hint, so do just that.

https://bugzilla.gnome.org/show_bug.cgi?id=643595
2018-11-14 13:42:33 +00:00
Florian Müllner
6099e92df5 workspace: Confine caption width to workspace area
When we started to only show a single caption at a time, we allowed
title captions to be wider than their corresponding window preview.
But while overlapping neighboring previews is fine, we shouldn't
allow the captions to leak outside the workspace area itself and
overlap unrelated elements like workspace switcher or dash.

This partly reverts commit b3b30f239d.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Florian Müllner
a4d09b4264 workspace: Remove dead code
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Erik Duxstad
118cab1766 windowManager: make TouchpadWorkspaceSwitchAction respect natural-scroll
Instead of defaulting to a natural scroll behavior,
have the workspace switch action use the natural-scroll setting
in org.gnome.peripherals.touchpad to determine the correct
direction of travel when swiping. 4 finger swipes will then
match the behavior of the rest of the UI.

Reference: https://gitlab.gnome.org/GNOME/gnome-shell/issues/516
2018-11-13 14:56:11 +00:00
Marco Trevisan (Treviño)
367b1c0627 notificationDaemon: Don't pass unused extra hints value
Probably this is a leftover of old implementations of _iconForNotificationData,
but right now this only takes a value, so just pass one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:56 +01:00
Marco Trevisan (Treviño)
33b8537bf5 notificationDaemon: support file:// or icon theme names for image-path
While this sounds counter-intuitive, the image-path hint value might also
be used with URIs or icon names.

As per freedesktop standard:
  The "app_icon" parameter and "image-path" hint should be either an URI
  (file:// is the only URI schema supported right now) or a name in a
  freedesktop.org-compliant icon theme (not a GTK+ stock ID).

Thus the image-path hint should also be parsed as it happens for the
app_icon.

Reuse same logic, by falling back on _iconForNotificationData with the
hint value.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:46 +01:00
Cosimo Cecchi
5fb8d4f730 calendar: do not call destroy() recursively
We have a callback that will call close() when the notification is
destroyed, and a callback that will call destroy() on the notification
when the message is closed.

Currently, if the notification is destroyed we'll execute our callback
that will call again destroy() on the notification. That's bad
practice in general, and it also has the side effect of resetting the
destroy reason.

This commit avoids re-destroying the notification by dropping the
notification reference on destroy.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
a98ed08a54 notificationDaemon: use different reason when replacing notification
Differently from the fd.o notifications, Gtk notifications do not
have a mechanism to update themselves. Instead, when a new
notification is received for an ID already known to the notification
daemon, the old notification is dismissed and a replaced with a new
one.

Currently though, there is no way to distinguish a notification that
was dismissed because of an user interaction, or because it was
replaced. That is an useful piece of information, so add a new value
to the NotificationDestroyedReason enum to account for it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
80a7547129 notificationDaemon: separate out GtkNotification creation
This way, source subclasses can easily use a notification subclass
if different functionality is required.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Takao Fujiwara
551e827841 keyboard: Do not call KeyboardManager.holdKeyboard() with set-content-type
When gnome-shell receives the signal of 'set-content-type' from ibus,
gnome-shell calls KeyboardManager.holdKeyboard() and
KeyboardManager.releaseKeyboard() and the functions change the current
input focus in GNOME Xorg and it could result in closing a popup window
which has a password entry by focusing on the entry.
The solution is to stop to call the APIs on 'set-content-type' signal.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
2018-11-09 10:55:30 +00:00
Florian Müllner
4dc2039859 messageTray: Disable unredirection while showing banners
We don't usually show notification banners while the monitor is in
fullscreen, but when we do - the notification is urgent - we should
actually show the banner, even if the top-most window is unredirected.
To achieve that, disable unredirection while the banner is showing.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/430
2018-11-08 12:51:27 +00:00
Florian Müllner
f1195ecb01 workspaces: Use correct schema for workspace settings
The custom overrides system is gone, we need to use the original
mutter schema.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/768
2018-11-08 10:50:32 +01:00
Daniel van Vugt
1acdff822a iconGrid: Keep icons reactive during pulse animation
The `reactive` property of icon actors was being restored multiple times
over the course of the pulse animation, all at slightly different times
as each icon finished animating at different times.

The problem is that toggling `reactive` on an `StWidget` incurs a style
change of the `insensitive` pseudo class, and style changes would quickly
queue relayouts incurring full stage reallocation. This occurred many times
during a pulse animation, limiting its smoothness and performance.

The solution is to not toggle the `reactive` property in the pulse
animation at all, which avoids incurring multiple full stage relayouts.

As a bonus, this means the icon under the cursor pulses with the correct
selection highlight, appearing more seamless and responsive.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/261
2018-10-30 19:58:52 +01:00
Daniel van Vugt
a5e6dd52d2 iconGrid: Defer and group animation cleanup
The `reactive` property of icon actors was being restored 24 times over
the course of the spring animation, all at slightly different times as
each icon finished animating at different times.

The problem is that toggling `reactive` on an `StWidget` incurs a style
change of the `insensitive` pseudo class, and style changes would quickly
queue relayouts incurring full stage reallocation. This occurred many times
during a spring animation hogging the CPU and limiting the frame rate.

The solution is defer and batch the cleanup for all icons until after the
last icon has finished animating. This way the CPU impact of the style
change and stage relayout isn't felt during the animation so the frame
rate remains higher and smoother. The overall CPU usage of the animation
is also reduced as the remaining relayouts are much more likely to be
grouped into a single frame.

Icon spring animation performance on an i7-7700:
Before: 83% CPU and 47 FPS
After : 78% CPU and 54 FPS
which is about a 22% increase in performance per clock (FPS/CPU).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/253
2018-10-30 18:01:05 +00:00
Georges Basile Stavracas Neto
c0b561dd4a
switcherPopup: Bind to the stage, not the monitor
The switcher popup is a large, mostly transparent actor that
should cover all the clickable area of GNOME Shell. In Clutter
terms, it should cover the whole stage.

By binding it to the primary monitor, the Alt+Tab behavior
becomes a bit inconsistent. For example, by not hiding when
clicking at empty spaces at other monitors.

Fix that by binding the SwitcherPopup to the whole stage,
and not only the primary monitor.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/647
2018-10-25 12:33:10 -03:00
Carmen Bianca Bakker
0f542c2e16 Remove padding from date strings
The padding is removed by using %-d instead of %e or %d.

Examples:

"%B %d %Y"  -> "October 04 2018"

"%B %e %Y"  -> "October  4 2018"

"%B %-d %Y" -> "October 4 2018"

https://gitlab.gnome.org/GNOME/gnome-shell/issues/666
2018-10-25 13:05:47 +02:00
Carmen Bianca Bakker
cff9eaf5aa Change a translator comment to be less ambiguous
https://gitlab.gnome.org/GNOME/gnome-shell/issues/666
2018-10-25 13:05:08 +02:00
Sebastian Pinnau
7026a6fd32 automountManager: Add handling of udisks errors for no/wrong passwords
If no password or a wrong password is entered after automounting an
encrypted device, then the password should be reasked. However, this
does not happen because the relevant udisks error messages for this
cases are missing in the exception handler that calls _reaskPassword.

Fix this issue by adding the relevant udisks error strings to the
exception handling in the _onVolumeMounted method.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/640
2018-10-24 00:13:10 +02:00
Florian Müllner
a0dc8dc7ef panel: Also ignore hidden windows for proximity
We currently only ignore minimized windows, not windows that are
hidden for other reasons - namely on wayland windows are initially
hidden until they are placed.

This fixes a flicker in the transparent top bar on wayland when the
"position" of an unplaced window wrongly suggests the window is
overlapping the top bar.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/693
2018-10-23 16:24:22 +02:00
Florian Müllner
8566ec2ee5 osdWindow: Disconnect signals on destroy
Since we started to show OSD windows on all monitors, OSD windows are
destroyed when the corresponding monitor is disconnected. We shouldn't
leave any signal handlers around in that case - they prevent the object
from being garbage collected, and trigger warnings for accessing proper-
ties of invalidated GObjects.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/602
2018-10-22 14:58:50 +00:00
Didier Roche
ae7dd5e2db osdWindow: Ensure we setMaxLevel before setting Level itself
When maxLevel is > 100%, first OSD appearance was capping the current
level to 100%. Consecutives key press were then OK.
Ensure we setMaxLevel before setting Level itself, so that correct cap
value is applied.
2018-10-19 16:18:41 +02:00
Florian Müllner
76117fd306 appFolder: Don't block all shortcuts
App folder popups take a grab when opened, and as we don't pass any
particular pushModal() parameters, all keybindings are blocked. While
this makes sense for most keybindings that would interfere with the
popup interaction, others like volume/brightness keys or screenshots
can be allowed safely.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/648
2018-10-11 20:12:54 +02:00
Andrea Azzarone
8855622666 popupMenu: Handle keypress if numlock is enabled
Add exception to handle a keypress if numlock is enabled as we already do for
capslock. This uses Clutter.ModifierType.MOD2_MASK because at the moment there
is not a more explicit way to refer to the numlock mask.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/550
2018-10-11 07:45:44 +00:00
Georges Basile Stavracas Neto
38c1ebba62
dash: expand and center align DashItemContainer
This is necessary to keep the small actor that shows up
during drag motion center aligned.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
557b232c89
panel: Delegate container destruction to PanelMenu.ButtonBox
Instead of taking care of the PanelMenu.ButtonBox.container
destruction by itself, delegate that to the very object that
created it in the first place: PanelMenu.ButtonBox itself.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
038f8b6ea5
keyboard: Stop using Shell.GenericContainer
This is the last remaining usage of Shell.GenericContainer
in the codebase, and posed small challenges compared to the
other removals.

A new St.Widget subclass called InputSourceIndicatorContainer
was added as a replacement to the Shell.GenericContainer. It
was needed because GNOME Shell needs to override the regular
size allocation functions, but InputSourceIndicator already
is a St.Widget with its own size allocation overrides.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
b4c674900f
inspector: Stop using Shell.GenericContainer
No alarms and no surprises here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
3fa19e58ac
boxPointer: Stop using Shell.GenericContainer
An easy removal too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
f460f2748d
boxPointer: Add compatibility API
Because we're late in the cycle, and don't know how many
extensions actually rely on this API, this commit adds
back the BoxPointer.show() and .hide() functions, with
warning messages to notify consumers that this is going
to be removed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
8b215b2446
boxPointer: Rename show/hide to open/close
Pretty much like dd4709bb2, BoxPointer's show() and hide()
functions will clash with Clutter.Actor's ones.

In addition to that, on a conceptual level, the current API
is not great, because calling boxPointer.hide() won't result
in boxPointer.actor.visible == false.

For these reasons, rename show() and hide() to open() and
close(). A compatibility layer will be added in a following
commit, warning about the usage of show() and hide().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:53 -03:00
Georges Basile Stavracas Neto
dd225713a1
layoutManager: Subclass GObject.Object
LayoutManager is currently a pure JavaScript class that
relies on the rudimentary Signals.addSignalMethods() to
handle signals. This is an inefficient implementation of
one of the most central classes in GNOME Shell.

In addition to removing Shell.GenericContainer, then,
turn LayoutManager into a proper GObject.Object subclass.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
f4682748fa
layoutManager: Stop using Shell.GenericContainer
This one was remarkably easy to port. In order to make it,
replace the Shell.GenericContainer handlers by a constraint
and simply replace it by a St.Widget.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
b058e89166
workspaceSwitcherPopup: Stop using Shell.GenericContainer
Removing Shell.GenericContainer here was slightly trickier
because it required factoring out a new JavaScript class.

It's nevertheless a straightforward removal.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
ac314cfb05
messageTray: Drop Shell.GenericContainer usage
Nothing particularly outstanding with this class - it was
a straightforward removal and subclassing.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
fc342fe8c5
buttonBox: Drop Shell.GenericContainer usage
Another easy port.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
dd4709bb27
appMenuButton: Rename show/hide to fadeIn/fadeOut
In the next commit, we will turn PanelMenu.ButtonBox into a
St.Widget subclass. As a domino effect, PanelMenu.Button will
become one too, and so will Panel.AppMenuButton.

When that happens, the current show() and hide() functions in
Panel.AppMenuButton will clash with Clutter.Actor's ones.

To avoid that, rename these functions to fadeIn() and fadeOut()
and avoid a name clash.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
e9f4f2e8ae
thumbnailBox: Stop using Shell.GenericContainer
This is another straight port from Shell.GenericContainer.
The important thing to notice is that the calculation is
broken if the StThemeNode helpers (adjust_preferred_* and
adjust_for_*) aren't used.

The downside of this patch is that it removed the skip_paint
from the thumbnails. Keeping it would add an unecessarily
large amount of code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
197c0eee29
iconGrid: Stop using Shell.GenericContainer
Removing Shell.GenericContainer from the IconGrid class was
challenging because it needs the "skip paint" API from it.
This API was added, too, as a workaround to the inability
to override vfuncs from GJS.

The overrides are largely copy-pasted and translated versions
of the Shell.GenericContainer code.

The IconGrid:key-focus-in signal was renamed to :child-focused
to avoid clashing with ClutterActor:key-focus-in.

In GridSearchResults, the internal IconGrid had it's y_expand
set to false, so it doesn't push other search elements (the
list results mainly) to the bottom of the screen.

Because skip paint wasn't and still isn't a GObject property,
rename it to _skipPaint to reflect that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
034a723677
iconGrid: Rename ::key-focus-in signal
As part of our quest to obsolete Shell.GenericContainer, IconGrid will
become a Clutter.Actor subclass. As the ::key-focus-in signal would
clash with Clutter.Actor::key-focus-in, rename it to ::child-focused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
efb3025d8c
dash: Set scale and opacity on parent actor
DashItemContainer currently animates the scale and opacity
of its child when zooming in. This is visible when adding
a new favorite item to the dash; the items will zoom in from
the center.

After the previous commit, however, the zoom animation got
slightly broken, and looked like the icon was coming from
the bottom instead of the center.

Fix that by setting the scale and opacity of DashItemContainer
itself, instead of its child. Remove the unused code after that
too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
81ec8215a0
baseIcon: Stop using Shell.GenericContainer
Pretty much like the previous patches, this extends St.Bin. The
most interesting aspect of this patch is that most of the sizing
routines of the icons is now delegated to the actors and layout
managers, removing quite a bunch of code.

The 'spacing' theme property is now redirected to StBoxLayout's
spacing property. Also adjust the Dash code to stop forcing a
potentially invalid width in the first icon too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
4be66ecf01
windowIcon: Subclass St.BoxLayout
Following the previous work, turn WindowIcon into a
St.BoxLayout subclass, and remove the this.actor
field from it.
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
c6cea277eb
switcherList: Stop using Shell.GenericContainer
This commit removes all the uses of Shell.GenericContainer from
SwitcherPopup.SwitcherList. Compared to the other patches, this
one was specially trickier to get right, and a few invasive
changes needed to be done.

The most noticeable one is that the allocation of the items is
done entirely by St.BoxLayout -- we don't manually allocate them
anymore. To make it work, get_preferred_width() had to calculate
the correct value. It now assumes that:

 * Minimum width: the minimum width of the widest child.
 * Natural width: the minimum width of the StBoxLayout (use it
   instead of the natural width to force the labels to ellipsize
   when too long.)

The AppIcon class became a St.Widget subclass as well, to override
get_preferred_width() and be able to keep the squared shape.

Besides that, add a new SwitcherButton class to reimplement squared
icons without having to resort to hacks in the size allocation
machinery. This class has a single vfunc override to ensure that it
is squared when the SwitcherList is.

The arrows indicating multiple windows are now in this._list
actor to the SwitcherPopup itself, since this._list automatically
manages its own children now.

At last, adapt (but preserve) the hack in CyclerPopup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
9a47b4b343
switcherList: Remove unused variable
The title is self-explanatory, 'primary' was not being used
anywhere.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
0ec36fc5cf
switcherPopup: Use MonitorConstraint instead of vfunc overrides
Instead of overriding vfunc_get_preferred_width|height(), use the
already available Layout.MonitorConstraint to bind SwitcherPopup
to the primary monitor.
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
a315e75e95
switcherPopup: Subclass St.Widget
This commit turns SwitcherPopup.SwitcherPopup into a St.Widget
subclass, and gets rid of Shell.GenericContainer usage. Subclasses
were adapted to that too.

This class introduced a new challenge: it overrides show(). As per
discussions, we now call this.visible = true inside show().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
e82c68accd
switcherPopup: Rename destroy() to fadeAndDestroy()
In the process of purging all usages of Shell.GenericContainer
of GNOME Shell, one specific problematic situation that might
occur is when classes have functions that would clash with any
ClutterActor or StWidget function name.

One of such example is SwitcherPopup.destroy(). Right now, this
class is a pure JavaScript class that wraps a real actor, but
soon this will change, and it'll become a St.Widget subclass.

Another problem with functions that mimic the toolkit ones is
the predictability of them; after calling destroy(), that widget
is expected to not be available anymore. In SwitcherPopup case,
it is still available for a short while. In this case, that's not
a big problem, but the show() and hide() functions in other clases
are more problematic because the actor's visibility does not
follow that.

This commit is a first step in cleaning that up, and changes the
SwitcherPopup.destroy() to fadeAndDestroy().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
286ffbe2b6
panel: Stop using Shell.GenericContainer
Shell.GenericContainer exposes the size negotiation machinery
through the use of signals. Signals are not specially performant.
One of the reasons is that they acquire a global lock for signal
handlers lookup. GNOME Shell has more than 2,000 actors at any
given point in time, up to 20 levels deep in hierarchy, making
size negotiation and painting non-trivial tasks. Such a critical
section of Clutter's machinery shouldn't rely on signals
whatsoever.

Regardless of that, Shell.GenericContainer is a workaround to
a non-existing issue anymore. It shouldn't be used anyway, and
any performance improvements that removing it can potentially
yield are bonuses to it.

This commit starts this work by removing Shell.GenericContainer
usage from Panel.Panel class. The class now extends St.Widget,
and as such, it has no "this.actor" field set anymore. A couple
of places where this actor field was used are adjuste as well.

It is important to notice that we now allocate the Panel itself
inside vfunc_allocate(). This was previously done before emitting
the signal by Shell.GenericContainer.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Florian Müllner
501a1aff68 appFavorites: Don't add app explicitly
When adding a favorite, we add the ID to the list of favorites, save the
setting and add the new app to the favorites map. However as writing the
settings value already results in reload() to update the favorites map,
the new app is usually already in the map when we add it.

The only exception is when the ID was found in the RENAMED_DESKTOP_IDS map,
in which case we end up adding both the renamed app and the original one.
Fix this by simply relying on reload() to properly update the map, just like
we already do in _removeFavorite().

https://gitlab.gnome.org/GNOME/gnome-shell/issues/471
2018-10-08 16:22:04 +00:00
Florian Müllner
586a9ff9cd layout: Don't update input region on wayland
We already see all events on wayland, so we can save us the work
of computing the XFixes region there.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/273
2018-10-08 16:03:53 +00:00
Florian Müllner
7190666075 closeDialog: Untrack chrome when window loses focus
On X11, reactive chrome must be added to the input region in order
to work as expected. However that region works independently from
any window stacking, with the result that the unresponsive-app dialog
currently blocks all input in the "covered" area, even in windows
stacked above the unresponsive window.

The correct fix would be to track the unobscured parts of the dialog
and set the input region from that, but that's quite cumbersome. So
instead, only track chrome when the corresponding window is focused
(or the dialog itself of course).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/273
2018-10-08 16:03:53 +00:00
Florian Müllner
e2f6a1980d automountManager: Explicitly track active operations
As a mount operation's UI may be reused (for example after mistyping
the password), we only close the operation once the mount has finished
(successfully or with error).

We therefore need to track ongoing operations, which we currently do
by monkey-patching the corresponding volume object. However while the
underlying GVolume object indeed remains the same through-out the
operation, the JS wrapper object isn't referenced anywhere and may
thus be garbage collected, resulting in a stuck dialog.

Fix this issue by tracking active operations explicitly, so that all
involved objects are referenced until the end of the operation.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/565
2018-10-08 13:18:53 +00:00
Andrea Azzarone
fffe58f829 viewSelector: Don't unfocus other modals on reset
Don't drop the key focus on Clutter's side if anything but the overview has
pushed a modal (e.g. system modals when activated using the overview).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/618
2018-10-04 16:40:46 +00:00
Bastien Nocera
361955dbf9 appFavorites: Add evince to rename list
Evince 3.30 changed the desktop filename. Without this patch,
evince will disappear from the dock.
2018-10-04 17:54:01 +02:00
Andrew Zaborowski
4609cf1912 networkAgent: Ask for wifi secrets in the hints paremeter
The `hints` and `settingName` parameters to the agent call may define
the specific list of secrets NM actually needs from the user.  This
seems to have been the intended use of these two parameters but only
recently did NM with the IWD backend start to use this to request 802.1x
secrets.  So if `hints` is provided, ask user for the specific secrets
listed there and don't even look at what type of EAP method is in use.
Only the three types of secrets actually in use by NM's IWD backend are
supported for now -- they happen to be the same three that
_get8021xSecrets() had already supported.
2018-09-26 00:34:22 +00:00
Carlos Garnacho
11fb91f60f keyboard: Listen to IbusPanelService::focus-in/out to track focus changes
In X11 there's no input panel state requests, so restore the previous behavior
that focused entries would always toggle the OSK on there.
2018-09-25 23:49:42 +00:00
Carlos Garnacho
7ea034c719 keyboard: Filter redundant FocusTracker::position-changed signals
Just emit the signal if it did actually change.
2018-09-25 23:49:42 +00:00
Will Thompson
b2fabd9356
workspacesView: initialize self._restackedNotifyId
This attribute was previously only assigned in show(). hide() compares
this attribute to 0. If hide() is called before show() is first called,
the comparison would give the correct result (undefined > 0 is false)
but log a warning:

    JS WARNING: [resource:///org/gnome/shell/ui/workspacesView.js 529]:
    reference to undefined property "_restackedNotifyId"

Initialize this attribute in _init(), alongside _scrollEventId and
_keyPressEventId which are also used in hide().
2018-09-25 23:00:53 +01:00
Will Thompson
0892b5dcdb
endSessionDialog: squash "reference to undefined property" warning
dialogContent is set to one of the elements of the list DialogContent,
but not all of those have a checkBoxText property. When logging out (as
opposed to shutting down), this causes a warning:

    JS WARNING: [resource:///org/gnome/shell/ui/endSessionDialog.js
    763]: reference to undefined property "checkBoxText"

(The line number corresponds to this line in 3.28.3.)

The warning is apparently not triggered if the undefined property is
used as part of a boolean expression:

    gjs> var x = {};
    gjs> x.a;
    typein:2:1 strict warning: reference to undefined property "a"
    gjs> if (x.b) { log('oh no'); }
    gjs> x.c || ''
    ""
_setCheckBoxLabel() just checks the truthiness of its 'text' argument,
and the empty string is false-y, so passing '' rather than undefined has
no functional effect.
2018-09-25 21:28:35 +01:00
Adam Williamson
33ffdd6061 Fix connection to wifi APs from user menu (RH #1628263)
In recent Fedora 29, connecting to wifi access points from the
user menu (top-right menu) does not work. Clicking the 'Connect'
button just animates it but does nothing else. The logs show an
error "JS ERROR: Error: Expected type utf8 for Argument
'specific_object' but got type 'undefined'".

Looking into this, it seems the problem is these uses of the
`path` property of an NMAccessPoint. NMAccessPoint inherits
from NMObject, and NMObject *does* have a path property:

https://developer.gnome.org/libnm/stable/NMObject.html#NMObject--path

so at first glance this seems fine. But I poked around a bit
using libnm via Python (which goes via introspection, just like
this JS code does), and found that indeed AccessPoint objects
don't seem to have a `path` property there either.

Looking at the libnm code, this actually makes sense, because
the property is marked "(skip)":

https://github.com/NetworkManager/NetworkManager/blob/master/libnm/nm-object.c#L1291

and the introspection docs suggest that means it should be left
out of introspected output:

https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Symbol_visibility

I'm a bit concerned that this was only found recently - whereas
the change to use `.path` in gnome-shell dates from October 2017
(d71af5e5) and the property has been marked (skip) in NM since
at least 2016 - but this all seems to add up. The obvious fix is
to replace use of `.path` with `.get_path()`, which returns the
path and is *not* marked (skip) and so *is* available via
introspection. I tested that this works in Python and also did
a test build of gnome-shell with this change and installed it on
an affected system, it does seem to fix the bug.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-09-18 16:15:32 -07:00
Florian Müllner
94423151b2 dbus: Move all interface descriptions into the resource
https://gitlab.gnome.org/GNOME/gnome-shell/issues/537
2018-09-17 07:34:49 +00:00
Andrea Azzarone
179cd0a3c8 keyboard: Remove leftover call to get_current_time 2018-09-14 12:18:38 +02:00
Daniel Drake
fcdac69eea switchMonitor: switch to next config upon initial keypress
In GNOME-3.24, pressing Super+P or a similar function key would cause
a switch to the next available monitor configuration.

However, in GNOME-3.26, this was reimplemented in mutter and gnome-shell
and the behaviour is now different: pressing Super+P and releasing will
cause no change in montor configuration[1]. In this new design you have
to press Super+P and keep holding Super in order to keep the switcher
open, then press P again (or use the arrow keys or mouse) to
select the next one in the list.

This is incompatible with many Asus products such as Asus X530UN, where
pressing the presentation mode media key (Fn+F8) actually generates
the following keypress events from the keyboard controller:

Fn pressed: nothing
F8 pressed: nothing
F8 released: Super press, p press, p release, Super release (quick burst)
Fn released: nothing

With this firmware behaviour it's not possible to hold the keys and have
the dialog come up so that you can select another new mode.

To solve this, when the switcher is opened, select the next available
display config by default, which is more similar to the pre-GNOME-3.26
behaviour. Now pressing Fn+F8 on this laptop will result in the display
mode switch taking place.

[1]: The mentioned desired behaviour will at least happen after
https://gitlab.gnome.org/GNOME/mutter/issues/281 has been fixed

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/208
2018-09-13 16:11:16 +00:00
Florian Müllner
9d6e1a89fc workspaceTracker: Don't keep multiple trailing workspaces
Since we always keep the active workspace until the user switches
to a different one, we may end up with two empty workspaces at
the end. It's not obvious to users why this happens, and there's
indeed no good reason for the behavior - just remove the trailing
workspace in that case.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/536
2018-09-13 13:44:52 +02:00
Carlos Garnacho
b087752b55 windowManager: listen actively to windows being destroyed during WS switch
Prevents gjs from dealing with already dispose()d objects.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/539
2018-09-11 14:32:33 +00:00
Jürg Billeter
2d791a51c0 windowMenu: Port from Meta.ScreenDirection to Meta.DisplayDirection
Meta.ScreenDirection no longer exists. This fixes window menus on
multi-monitor systems.

	JS ERROR: TypeError: Meta.ScreenDirection is undefined
	_buildMenu@resource:///org/gnome/shell/ui/windowMenu.js:135:17
2018-09-11 12:59:07 +02:00
Iain Lane
5d61e2563d network: Don't assume the active connection has been processed first
`NMConnectionDevice._sync()` is responsible for setting up the active
connection that we'll end up displaying. It expects the active
connection to already be in a map `_connectionItems`. If it isn't in
there, we get a null dereference and the indicator can get into a weird
state where it doesn't display devices / connections properly.

Let's change this expectation. If there is an active connection,
`_deviceAdded()` will eventually get to it and call `_sync()` to set up
the active connection state. We make `_sync()` tolerate there being no
active connection when it's called.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/140
2018-09-03 23:31:17 +00:00
Marco Trevisan (Treviño)
72f5802be9 extensionSystem: Unset stylesheet file reference when unloaded
We must remove the GFile reference from the representing object when an
extension has been unloaded as this won't be used anymore later (e.g. as cached
ref).
2018-09-03 23:29:01 +00:00
Marco Trevisan (Treviño)
30cb2127a1 js/main: Throw error if no valid default stylesheet is found
Throw an error using an informative message in case a mode uses a stylesheet
that can't be loaded, instead of crashing later because the theming can't be
properly computed, and thus the minimum size of the actors.
2018-09-03 23:29:01 +00:00
Marco Trevisan (Treviño)
3aea290adc extensionSystem: Unload stylesheet if extension is not loaded
We should not keep any reference to an extension custom stylesheet in case we
got an error while enabling that
2018-09-03 23:29:01 +00:00
Marco Trevisan (Treviño)
5b3ff7184e extensionSystem: Don't load an extension with invalid stylesheet
We currently assign the stylesheet to an extension whenever the file exists,
regardless of whether it actually loaded successfully or not.
And thus we load an extension that ships a stylesheet even if that file can't
be used.

There is no point in trying to load an extension if its stylesheet wasn't
loaded in the first place, so make sure this happens only on success.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/188
2018-09-03 23:29:01 +00:00
Marco Trevisan (Treviño)
760406002f search: Ignore search provider results metas if search is cancelled
When a search has been cancelled, it is expected that providers don't
return the requested number of results, so don't log a warning in that
case.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/205
2018-09-04 01:00:52 +02:00
Marco Trevisan (Treviño)
c47a740c83 search: Cancel search provider operations on clear
Ensure that the search provider operations (just getResultMetas requests
in the current implementation) in progress are properly cancelled when we
clear the UI, otherwise returned results might still be added when not
needed.

This is triggered for each provider by the SearchResults reset.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/205
2018-09-04 01:00:52 +02:00
Marco Trevisan (Treviño)
0fe5a3c0c4 viewSelector: Cancel search on overview hidden
Currently when the overview is hidden, any pending search is kept alive,
not only at remote search provider level (as per issue #183), but even
the shell providers proxies continue to get and process data. This happens
even if this is not needed anymore, while the UI reset is performed only
next time that the overview is shown (causing some more computation
presentation time).

In order to stop this to happen, when the overview is hidden, we have to
unset the search entry to an empty value as this would make SearchResults
to have empty terms list and that would make the proxies cancellable to
be triggered (without causing any further search to start).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/205
2018-09-04 01:00:52 +02:00
Florian Müllner
5bca4a884e calendar: chain up to parent on _onDestroy 2018-09-03 22:43:21 +00:00
Marco Trevisan (Treviño)
9c41736a81 automountManager: remove allowAutorun expire timeout on volume removal
If the volume is removed before AUTORUN_EXPIRE_TIMEOUT_SECS seconds, we can stop
the timeout earlier as there's nothing to unset, while the volume instance
won't be valid anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=791233
2018-09-03 22:43:21 +00:00
Marco Trevisan (Treviño)
87da623d86 messageList: stop syncing if closeButton has been destroyed
The _sync function for Message only updates the close button visibility,
so we can safely stop doing that if the close button get get destroyed earlier
(as it happens when clicking on it).

https://bugzilla.gnome.org/show_bug.cgi?id=791233
2018-09-03 22:43:21 +00:00
Marco Trevisan (Treviño)
3033506f2c dnd: Nullify _dragActor after we've destroyed it, and avoid invalid access
We need to avoid that we use the _dragActor instance after that it has
been destroyed or we'll get errors. We now set it to null when this
happens, protecting any access to that.

Add a DragState enum-like object to keep track of the state
instead of using booleans.

Remove duplicated handler on 'destroy' and just use a generic one.

https://bugzilla.gnome.org/show_bug.cgi?id=791233
2018-09-03 22:43:21 +00:00
Jonas Ådahl
900398406c panel: Keep prefs in sync with shell-shows-app-menu state
Previously mutter listened to Xsettings (via GTK) to get notified
whether the shell showed the app menu. After X11 support was changed in
the direction of being less central, listening to this particular
Xsettings were removed with the intention of having the Shell tell
mutter directly whether it was showing the menu or not.

This commit makes that happen. It still travels through Xsettings (still
via Gtk), as the shell still gets that state from Xsettings, but fixing
this is out of scope for this particular fix.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/276
2018-08-28 23:53:10 +00:00
Marco Trevisan (Treviño)
dbf993300a js: use ES6 template strings for dbus interfaces
Use multiline template strings for dbus interfaces as they're easier to maintain
2018-08-27 19:23:00 +02:00
Daniel van Vugt
f77b3da74f js/ui: Choose some actors to cache on the GPU
Flag some actors that are good candidates for caching in texture memory
(what Clutter calls "offscreen redirect"), thereby mostly eliminating
their repaint overhead.

This isn't exactly groundbreaking, it's how you're meant to use
OpenGL in the first place. But the difficulty is in the design of
Clutter which has some peculiarities making universal caching
inefficient at the moment:

 * Repainting an offscreen actor is measurably slower than repainting
   the same actor if it was uncached. But only by less than 100%,
   so if an actor can avoid changing every frame then caching is usually
   more efficient over that timeframe.

 * The cached painting from a container typically includes its children,
   so you can't cache containers whose children are usually animating at
   full frame rate. That results in a performance loss.
     This could be remedied in future by Clutter explicitly separating a
   container's background painting from its child painting and always
   caching the background (as StWidget tries to in some cases already).

So this commit selects just a few areas where caching has been verified
to be beneficial, and many use cases now see their CPU usage halved:

One small window active...... 10% -> 7% (-30%)
...under a panel menu........ 23% -> 9% (-61%)
One maximized window active.. 12% -> 9% (-25%)
...under a panel menu........ 23% -> 11% (-52%)
...under a shell dialog...... 22% -> 12% (-45%)
...in activities overview.... 32% -> 17% (-47%)
(on an i7-7700)

Also a couple of bugs are fixed by this:

https://bugzilla.gnome.org/show_bug.cgi?id=792634
https://bugzilla.gnome.org/show_bug.cgi?id=792633
2018-08-27 14:16:59 +00:00
Andrea Azzarone
ce4c485f34 windowManager: Ignore auto-repeat activation of toggle keybindigs
Use Meta.KeyBindingFlags.IGNORE_AUTOREPEAT for open-application-menu
and toggle-message-tray keybindings.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/373
2018-08-20 11:14:38 +00:00
Andrea Azzarone
1877a2e00a viewSelector: Ignore auto-repeat activation of toggle keybindigs
Use Meta.KeyBindingFlags.IGNORE_AUTOREPEAT for toggle-application-view
and toggle-application-view keybindings.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/373
2018-08-20 11:14:37 +00:00
Florian Müllner
9a5a4b2206 Revert "workspaceThumbnail: rebuild thumbnails if workareas size changed"
It is unclear what the change was supposed to be fixing, but it
broke animations of workspace additions and removals, as those
events trigger the ::workareas-changed signal.

This reverts commit c29bd46e7a.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/162
2018-08-19 12:41:08 +00:00
Carlos Garnacho
3ab9e9e8ad runDialog: Use ClutterText::activate for enter handling
Instead of consuming the event in front of the input method. Enter
is sometimes overriden by those, so it seems better to let the IM
handle the key event, and react later to it if it got propagated
anyway. That is what ::activate does, so use this signal.

This used to work before ClutterInputMethod/InputFocus because the
IM received the events directly from stage captured events. This
is not the case anymore.

Closes: #440
2018-08-17 18:37:32 +00:00
Florian Müllner
764fbbe052 overview: Restore previous workspace switcher policy
We used to keep the workspace switcher slid out when the user made use
of workspaces. This was changed in commit 2d84975 to give more space
to window previews, but it turned out to make the switcher quite a lot
more difficult to interact with (rather than only being a question of
discoverability). So go back to the previous behavior.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/161
2018-08-14 17:34:57 +00:00
Florian Müllner
328c63bf64 overviewControls: Sync hover after drag operations
During global grabs, actors miss enter and leave events required
for correct hover tracking. This can cause the workspace switcher
to get stuck while slid out, so ensure the actor's hover state is
synced after drag operations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/161
2018-08-14 17:34:57 +00:00
Carlos Garnacho
73d8c82640 layout: Mark chrome container as NO_LAYOUT
Showing and hiding children does not affect the allocation of the uiGroup
nor its other children. We can avoid full relayout/redraw in those
situations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/197
2018-08-14 19:13:30 +02:00
Florian Müllner
afe5703710 networkAgent: Fix another ByteArray => Uint8Array instance
This was missed in commit 7ca418a79a. As we are dealing with
non-\0-terminated data here, go through GBytes this time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/189
2018-08-06 12:16:59 +00:00
verdre
02d06bb1f3 overview: Use whole stage size for cover pane
We show a cover pane on top of the overview during transitions to
prevent issues caused by clicks and mouseover events when the overview
is not ready. Right now, this pane is only being shown on the primary
monitor, which obviosly allows interactions to happen before the
animations are finished on the secondary monitors.

To fix this, use the size of the whole stage for the cover pane.
2018-08-06 10:18:28 +02:00
Carlos Garnacho
6b610b26f8 keyboard: Refactor code resetting IM on window drags
When a window is dragged, the OSK should get hidden. Just
do this in a nicer way.
2018-08-03 17:02:20 +02:00
Carlos Garnacho
81956e9b84 keyboard: defer position-changed till we have a rect
Emitting it that soon results in JS warnings, as we don't have
everything in place yet. The position-changed signal will be
emitted from other locations as soon as we have it.

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

Closes: #464
2018-08-03 13:12:20 +02:00