Commit Graph

423 Commits

Author SHA1 Message Date
Florian Müllner
0846238f69 js: Use implicit animations for animatable properties
We now have everything in place to replace Tweener for all animatable
properties with implicit animations, which has the following benefits:

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

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
2019-08-06 23:54:29 +02:00
Florian Müllner
476816732f cleanup: Use milliseconds for animation times
The different units - seconds for Tweener and milliseconds for
timeouts - are not a big issue currently, as there is little
overlap. However this will change when we start using Clutter's
own animation framework (which uses milliseconds as well), in
particular where constants are shared between modules.

In order to prepare for the transition, define all animation times
as milliseconds and adjust them when passing them to Tweener.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/663
2019-08-05 21:55:20 +00:00
Florian Müllner
e357559582 cleanup: Mark globals used from other modules as exported
eslint cannot figure out that those symbols are used from other modules
via imports, so they trigger unused-variable errors. To fix, explicitly
mark those symbols as exported.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
11b116cb9d cleanup: Remove some unhelpful unused variables in destructuring
We aren't using them, and they don't add much in terms of clarity,
so drop them to fix a couple of eslint errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
2f97a1a55d cleanup: Mark unused arguments as unused
This will stop eslint from warning about them, while keeping their
self-documenting benefit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
79cf3a6dd0 cleanup: Remove some unhelpful unused arguments
Those unused arguments aren't bugs - unbeknownst to eslint, they all
correspond to valid signal parameters - but they don't contribute
anything to clarity, so just remove them anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
3f8d3a7ee2 panel: Remove unused constant
This was left-over in commit 2743f18af, and probably is the real reason
why the busy spinner wasn't using the shared AnimatedIcon.Spinner class:
The animation there was much slower.

Still, let's keep the code as-is for now, if we really need a different
animation time, we can add an optional constructor parameter to the
Spinner class.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/640
2019-07-23 20:05:19 +02:00
Florian Müllner
2743f18af4 panel: Use dedicated Spinner class
The startup/busy indication in the app menu was left out of commit
22e21ad7d1 because it doesn't use a hard-coded image, but as the
image in the CSS is actually the same used by the spinner class,
drop the "custom" styling and use the regular spinner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/636
2019-07-22 17:50:52 +02:00
Florian Müllner
404bc34089 cleanup: Use default parameters where appropriate
Since ES6 it is possible to set an explicit default value for optional
parameters (overriding the implicit value of 'undefined'). Use them
for a nice small cleanup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626
2019-07-12 18:54:49 +00:00
Florian Müllner
16ca7a21a7 panel: Relax check for existing signal handler
Object.prototype.hasOwnProperty() is more precise than checking for
falsiness, for instance the following is true:

  { foo: undefined }.hasOwnProperty('foo');

However when checking for a handler ID, a more relaxed check is more
appropriate, as particularly 0 is not a valid handler ID.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626
2019-07-12 18:54:49 +00:00
Florian Müllner
0d035a4e53 cleanup: Prefer template strings
Template strings are much nicer than string concatenation, so use
them where possible; this excludes translatable strings and any
strings containing '/' (until we can depend on gettext >= 0.20[0]).

[0] https://savannah.gnu.org/bugs/?50920

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/612
2019-07-05 11:32:31 +00:00
Florian Müllner
14d7897a93 style: Stop using braces for single-line arrow functions
Braces are optional for single-line arrow functions, but there's a
subtle difference:
Without braces, the expression is implicitly used as return value; with
braces, the function returns nothing unless there's an explicit return.

We currently reflect that in our style by only omitting braces when the
function is expected to have a return value, but that's not very obvious,
not an important differentiation to make, and not easy to express in an
automatic rule.

So just omit braces consistently as mandated by gjs' coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
8fcd6c7153 cleanup: Use arrow functions for tweener callbacks
While it is legal to use method syntax for the function properties
here, arrow notation is less unexpected and allows us to drop the
separate scope properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
7ac35c644e style: Fix stray/missing spaces
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
29b04fcbf2 style: Fix stray/missing semi-colons
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
f6b4b96737 cleanup: Use Array.includes() to check for element existence
We can use that newer method where we don't care about the actual position
of an element inside the array.

(Array.includes() and Array.indexOf() do behave differently in edge cases,
for example in the handling of NaN, but those don't matter to us)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/152
2019-07-01 21:28:52 +00:00
Florian Müllner
2e070ab834 panel: Center-align menu arrows
Center alignment looks more balanced and makes it more likely that
the menu opens below the pointer position.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1351
2019-06-21 21:09:56 +00:00
Olivier Fourdan
5ace4682bf accessibility: Add pointer accessibility support
Adds the UI part for the pointer accessibility features.

The various timeouts running are notified using a pie-timer showing
under the pointer.

For dwell-click type selection, we use a drop-down menu. Users can
use the dwell-click to select the next type of dwell click to be
emitted.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/474
2019-06-06 09:13:29 +02:00
Marco Trevisan (Treviño)
58e0b80cac panel: Use menu items as actors
All menu items are actors now, so remove all the actor property usages.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
2019-05-15 17:27:08 +00:00
Dylan McCall
03117d65b2 panel: Drag topmost maximized window
This makes it possible to drag a window which appears connected with the
panel, even if it is not in focus. As a result, it should be easier to
manipulate side-by-side windows.

https://bugzilla.gnome.org/show_bug.cgi?id=679290
2019-05-04 13:50:04 -07:00
Florian Müllner
d57234bec9 panel: Don't chain up to parent's allocate
The top bar handles allocating all its children itself, so there's
little value in chaining up to st_widget_allocate() and get the
default layout manager allocating all children again (and possibly
differently).

If this happens, we end up with an infinite allocation cycle with
corresponding performance penalty. Fix this by just doing and what
Shell.GenericContainer did before commit 286ffbe2b6 replaced it,
and not chain up to StWidget.

Thanks to Robert Mader for debugging the issue.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1054
2019-04-29 18:29:14 +00:00
Marco Trevisan (Treviño)
be2d630348 panel: Remove this.actor definition to self
Remove this.actor = actor, since the class is now an actor itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487
2019-04-17 21:32:18 +00:00
Marco Trevisan (Treviño)
fedb8e706a panelMenu: Remove usage of this.actor from Button
Remove this.actor = actor, since the class is now an actor itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487
2019-04-17 21:32:18 +00:00
Florian Müllner
d4763b157d appMenu: Add heading to windows section
It may not be immediately obvious that the windows section is a
list of open application windows, as titles like "Downloads" can
easily be confused with an action. Add a section heading to avoid
confusion.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/968
2019-04-17 19:23:23 +00:00
Florian Müllner
d2dc072ba9 appMenu: Remove separator in window section
We currently copy the app icon menu behavior, which puts a separator
between windows from the current workspace and windows from any other
workspace. It is more useful to have the windows section appear as a
clearly marked group, so drop the separator.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/968
2019-04-17 19:23:23 +00:00
Florian Müllner
ffaca00594 appMenu: Add separator between "Details" and "Quit"
The two actions are sufficiently different to warrant their own
groups.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/968
2019-04-17 19:23:23 +00:00
Florian Müllner
9f8edd980c panel: Remove left-over Gtk.Settings
It has been unused since commit c334aa2a4c.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/481
2019-04-11 17:27:50 +00:00
Florian Müllner
0089143d06 aggregateMenu: Include action buttons in width computation again
Commit 1b169655ac removed the system indicator from the list of children
that are considered for the overall menu width, because we do want the
log-out submenu to adapt to the available width.

However as a side effect, action buttons no longer contribute to the
width either, so if extensions add additional buttons, the menu is
likely to overflow.

Avoid this by only adding the button group to the list of size children.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1094
2019-03-21 10:08:29 +00:00
Florian Müllner
572d54981e appsMenu: Fix initial visibility of "Details" item
It is only supposed to be visible when Software is installed, but
we currently only update the visibility on changes.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/989
2019-03-02 18:13:38 +00:00
Florian Müllner
70f4906ca5 aggregateLayout: Fix natural width computation
Ouch, this went unnoticed for a long time: As the minimum size of menu
items is generally small (because its label can be ellipsized), we are
requesting the unellipsized width of the last "size child" instead of
the widest one.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/996
2019-02-26 08:25:00 +00:00
Florian Müllner
1b169655ac aggregateMenu: Don't use system menu for width computation
If the user's real name is too long to fit the menu comfortably, we are
supposed to use the username instead. However since commit f8e5e3e435,
we no longer set a max-width on the menu as a whole, but instead base
the width request on only "unellipsizable" children. For some reason
the system menu ended up there, so the name is now allowed to grow
indefinitely.

Remove it from the list of size children to get the intended behavior
back.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/400
2019-02-10 02:18:40 +00:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
a1534dab02 cleanup: Clean up unused imports
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 05:05:07 +01:00
Florian Müllner
a87ab6d0fc panel: Restrict app menu width
Window titles aren't restricted in length, so the menu may end up unwieldily
width. Commit 0bec76b6ee therefore limited the app context menus, but that
got accidentally dropped in commit 0ded0dbfd5. Add back the limitation and
extend it to the new app menu as well.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Florian Müllner
1c117c469a panel: Desaturate appmenu icon
Top bar icons are supposed to by symbolic, but not all applications
provide a symbolic icon. Make the stick out less by desaturating
the appmenu icon if a symbolic style is requested.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:15 +01:00
Florian Müllner
dc79393b27 panel: Replace remote app menu
Since the plans to retire the app menu were announced, nobody objected to
the removal of the menu content, however some concerns were raised about
the menu's secondary role as indicator.

Account for that by not removing the existing app menu, but replacing it
with a built-in menu similar to the existing app icon context menu.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:29:12 +01:00
Florian Müllner
c334aa2a4c panel: Ignore shell-shows-app-menu setting
The GtkSettings was originally introduced to inform applications about
the desktop shell's capabilities, but users soon started to use it to
force GTK+ to show the app menu inside the application. We eventually
caved and also handled the setting ourselves to hide the in-shell app
menu to allow users to "move" it.

But now the remote app menu is in the process of being retired[0], and
will be replaced with a simple indicator that cannot be moved, so
stop following the GtkSetting.

[0] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:26:56 +01:00
Florian Müllner
9f61a4f5fd panel: Remove unused import
https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-02-06 18:26:56 +01:00
Florian Müllner
c1a6effea0 panel: Don't allow opening hidden menus via keybindings
We shouldn't allow toggling menus that aren't supported by the
current session mode, but as indicators are hidden rather than
destroyed on mode switches, it is not enough to check for an
indicator's existence.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/851
2019-02-05 11:08:45 -05:00
Florian Müllner
9cfb51c106 panel: Remove panel translucency
Since commit 447bf55e45 we turn the top bar translucent when
free-floating. While this looks fancy and reduces the appearance
of cutting into the available screen space, it has also had a
negative effect on legibility.

Nobody stepped up to address those issues in two years, so revert
back to the fully opaque top bar.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/408
2019-02-05 12:08:57 +00:00
Florian Müllner
15e7625c80 cleanup: Remove erroneous vfunc parameters
Unlike in C or signal handlers, vfuncs don't include the this-object
in their arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/388
2019-02-05 02:21:40 +00: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
Florian Müllner
e68dfed1f7 cleanup: Port GObject classes to JS6 classes
GJS added API for defining GObject classes with ES6 class syntax
last cycle, use it to port the remaining Lang.Class classes to
the new syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00: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
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
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
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
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