Commit Graph

540 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
be6ce3c5b4
appIcon: Scale and fade itself when starting drag
As per design direction, scale and fade the app icon
when starting dragging it, and show it again if the
drop is accepted. Clutter takes care of animating the
rest of icon positions through implicit animations.

Scale and fade the dragged icon while it's being dragged.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671
2019-08-09 10:58:38 -03:00
Jonas Dreßler
87f5aa7a13 appDisplay: Animate activate-discrete-gpu action in the AppIconMenu
Just as we animate the apps launch using the zoom out animation if the
'new-window' action provided by the app is launched, we should also show
this animation if the 'activate-discrete-gpu' action provided by the app
via its AppInfo is launched.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/673
2019-08-08 16:48:48 +00:00
Jonas Dreßler
1dadbd0cbb appDisplay: Always animate our own new window and discrete gpu actions
For the "New Window" entry we add to the AppIcons popup menu we should
always animate the app icon if the menu entry is activated as it was
intended by commit 62786c09a8.

For the "Launch using Dedicated Graphics Card" entry we can also always
show the animation if the entry is activated since the entry should only
be visible if the app is stopped.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/673
2019-08-08 16:48:48 +00:00
Jonas Dreßler
73850fee02 appDisplay: Animate launch of new-window action in the AppIconMenu
We add our own "New Window" menu entry if the app doesn't already
provide a 'new-window' action. For this menu entry, we show the zoom out
animation on the app icon when the user clicks the entry.

To be consistent in case the app already provides its own 'new-window'
action via its AppInfo, also show the zoom out animation when this
action is activated.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/662
2019-08-08 15:28:48 +00:00
Georges Basile Stavracas Neto
fd19906c64
allView: Scale in when moving icons from folders
App icons inside folders are already animated when the folder is
opened, but moving an app icon from a folder doesn't, making the
transition abrupt.

Fortunately, it's easy to detect icons that were previously hidden
but are not anymore.

Add an animation to these icons when showing.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:12:00 -03:00
Georges Basile Stavracas Neto
54a2773046
folderIcon: Add visual drag-over feedback
WIP: This is not exactly what was discussed on IRC, but
it's looking alright as a first iteration. Design feedback
welcomed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:11:59 -03:00
Georges Basile Stavracas Neto
ec8b7bc7b2
allView: Remove icon from folder when dropping outside
When dropping an app icon to outside the folder, remove the
app from that folder. GNOME Shell is already smart enough
to figure out the setting changes and update the icons.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:11:59 -03:00
Georges Basile Stavracas Neto
ea71172d44
allView: Switch pages when dragging above or below the grid
This is necessary for being able to drag application icons
to folders in different pages.

Add a drag motion handler to AllView and handle overshoots
when dragging. Only handle it when dragging from AllView.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:11:59 -03:00
Georges Basile Stavracas Neto
5dfa620f86
folderIcon: Update folder icon after dropping
After dropping an application into the folder icon, the
list of applications is updated but the folder icon itself
is not.

Introduce BaseIcon.update() and call it from FolderIcon
when redisplaying.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:11:59 -03:00
Georges Basile Stavracas Neto
09d5f0779d
folderIcon: Allow dropping application icons
Connect to the overview signals related to Drag n' Drop, and
allow dropping application icons in it. Dropping an icon
appends the application id to the folder's GSettings key.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:11:56 -03:00
Georges Basile Stavracas Neto
d1880dc987
appDisplay: Add event blocker inhibition API
The event blocker is an actor that is added in between the
icon grid and the app folder popup in order to guarantee
that clicking outside the app folder will collapse it.

However, the next patch will require allowing dragging events
to be passed to folder icons, and the event blocker gets in
our way here, preventing drag n' drop to work properly.

Add an API to inhibit the event blocker. This API will be
used by the app folders while an item is dragged.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664
2019-08-08 09:09:46 -03:00
Florian Müllner
b67c300484 js: Use Clutter transitions for adjustment changes
This concludes our quest of moving from Tweener to Clutter's
animation framework.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/669
2019-08-07 18:40:49 +02:00
Georges Basile Stavracas Neto
8b97a06961
allView: Always update currentPage
Commit 0f178c3b3d added a shortcirtuit to avoid running
an animation on an invisible actor. However, it introduced
a bug where the current page is not properly updated. That
leads to the wrong set of icons being animated under some
circumstances.

Update the current page even if we bail out early.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/667
2019-08-06 21:09:13 -03:00
Florian Müllner
0846238f69 js: Use implicit animations for animatable properties
We now have everything in place to replace Tweener for all animatable
properties with implicit animations, which has the following benefits:

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

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
2019-08-06 23:54:29 +02:00
Florian Müllner
0f178c3b3d appDisplay: Skip animation when hidden
The time computation isn't just unnecessary in that case, it's likely
wrong as well: If we don't have a valid allocation, we may well end
up with a negative value, NaN or Infinity.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/654
2019-08-06 14:52:41 +02:00
Georges Basile Stavracas Neto
00ec8ca989
allView: Redisplay on folder changes
Now that redisplaying is a lightweight operation that only
adds and removes what changed, we can not be concerned about
redisplaying on folder changes.

Redisplaying will be necessary when custom order in the app
grid is implemented, in order to update not only which icons
are hidden, but also their position.

Call _redisplay() in AllView when folders change.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:20:31 -03:00
Georges Basile Stavracas Neto
9c6f558c9e
baseAppView: Remove unused BaseAppView.addItem
Now that BaseAppView does not allow for subclasses to add
and remove items directly, the addItem() method can be
removed.

Remove BaseAppView.addItem().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:20:31 -03:00
Georges Basile Stavracas Neto
1c172955ee
allView, folderView: Only add icons once
FolderView and AllView currently check if the item is
present in the BaseAppView._items map, in order to avoid
adding the same icon multiple times.

Now that BaseAppView._loadApps() has a different role --
it returns a list with all app icons, and BaseAppView
diffs with the current list of app icons -- checking the
BaseAppView._items map is wrong.

Make sure there are no duplicated items in the temporary
array returned by all _loadApps() implementations. Remove
the now unused BaseAppView.hasItem() method.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:20:31 -03:00
Georges Basile Stavracas Neto
1d44bf7ce6
baseAppView: Only add and remove when necessary
BaseAppView currently removes all icons, and readds them, every
time the list of app icons needs to be redisplayed. In order to
allow animating app icon positions in the future, however, we
cannot destroy the actors of the app icons.

Previous commits paved the way for us to do differential loading,
i.e. add only the icons that were added, and remove only what was
removed.

Make the BaseAppView effectively implement differential loading.
The BaseAppView.removeAll() method is removed, since we do not
remove all icons anymore. BaseAppView._loadApps() now returns an
array with the new apps, instead of putting them directly at the
BaseAppView lists.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:20:29 -03:00
Georges Basile Stavracas Neto
036e41621d
baseAppView: Move _loadGrid() into _redisplay()
Next commit will introduce differential loading of
app icons, and will reorganize this part of the
codebase.

When doing that, the ideal symmetry of the new code
would be:

 * Update BaseAppView._allItems array
 * Update BaseAppView._items map
 * Update BaseAppView._grid actor

Move the code in _loadGrid() into _redisplay() so that
we can check in-place which new icons need to be added.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:19:26 -03:00
Georges Basile Stavracas Neto
3003e9091d
baseAppView: Call loadGrid() directly
Now that the three views follow the exact same loading routine
(remove all + load apps + load grid), we don't need each view
call loadGrid() directly anymore.

This is an important step in order to animate adding and removing
icons, since now we can diff old and new app icons properly.

Move all calls to BaseAppView.loadGrid() to a single one after
BaseAppView._loadApps(). Also add the underscore prefix, since
this is now considered a protected function.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:19:25 -03:00
Georges Basile Stavracas Neto
8d9da10710
frequentView: Use BaseAppView.addItem() and loadGrid()
FrequentView is another view that is slightly not unified with how
BaseAppView expects subclasses to load app icons. Instead of using
BaseAppView.addItem() and then calling BaseAppview.loadGrid(), it
adds the app icons directly to the icon grid.

Make FrequentView add icons using BaseAppview.addItem(), and load
the icons using BaseAppView.loadGrid().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:19:25 -03:00
Georges Basile Stavracas Neto
4d23c12028
folderIcon: Move app icon loading to FolderView
Future patches will diff the old and new icons of views, in order to
animate them when necessary (e.g. adding an app icon to a folder, or
from a folder back to the app grid). In order to do that, all views
must be streamlined in how they load app icons.

Currently, FrequentView and AllView are already following the behavior
expected by BaseAppView, but FolderView isn't. Its icons are loaded by
FolderIcon, and FolderView doesn't implement BaseView._loadApps(),
which makes it impossible to diff old and new apps.

Move the app icon loading routine from FolderIcon to FolderView, by
implementing the _loadApps() method.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
2019-08-05 21:19:24 -03: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
Georges Basile Stavracas Neto
8e1b13ca96 appDisplay: Trivial code style improvement
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/643
2019-07-24 18:55:50 -03:00
Georges Basile Stavracas Neto
3db1058c2c appIcon: End running drag operations on destroy
AppIcon makes itself draggable, and handles the various DnD
routines such as 'drag-begin' and 'drag-end' by making the
Overview emit the appropriate signals.

However, when destroyed, the AppIcon does not try to finish
any drag operations that started. That causes the event
blocker in AllView not to be updated correctly when dragging
icons to outside folders.

Make AppIcon emit 'item-drag-end' when a drag operation
started and it's destroyed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/643
2019-07-24 18:11:25 -03: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
71759a0769 cleanup: Mark unused (but useful) variables as ignored
While we aren't using those destructured variables, they are still useful
to document the meaning of those elements. We don't want eslint to keep
warning about them though, so mark them accordingly.

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
a455860978 appDisplay: Indent with spaces rather than tabs
Another style nit that sneaked in with commit eaa32090b9.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/640
2019-07-23 20:05:19 +02:00
Florian Müllner
0ecf135a4b appDisplay: Add missing semicolon
This slipped through in commit eaa320 ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/640
2019-07-23 20:05:19 +02:00
Ray Strode
cebb6d40df appDisplay: Keep popup open on refresh
If the list of applications is refreshed we currently close
the open app folder.

This commit adds logic to reopen the app folder on reload.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
0ee13672ee appDisplay: Add open method to FolderIcon
At the moment the only way to open a folder icon is to click on it;
there's no API to open the icon programmatically.

This commits adds an open method and makes the click handler use
it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
49260a85ad appDisplay: Stop watching FolderIcon parent view when destroyed
When a FolderIcon is opened, it asks the parent view to allocate
space for it, which takes time.  Eventually, the space-ready
signal is emitted on the view and the icon can make use of the new
space with its popup.  If the icon gets destroyed in the
interim, though, space-ready signal handler still fires.

This commit disconnects the signal handler so it doesn't get called
on a destroyed icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
da9f37e629 appDisplay: Add destroy handler for FolderIcon
It is important that the FolderView of a FolderIcon always
gets destroyed before the AppFolderPopup, since the view
may or may not be in the popup, and the view should
get cleaned up exactly once in either case.

This commit adds a destroy handler on FolderIcon to ensure
things get taken down in the right order, and to make sure
the view isn't leaked if it's not yet part of the popup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
164f3fa3fd appDisplay: Clear AllView reference to current popup when destroyed
AllView contains a reference to the current popup that lingers after
the popup is destroyed.

This commit fixes that, by explicitly nullifying when appropriate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
8e75d81a44 appDisplay: Add AppFolderPopup destroy handler
At the moment AppFolderPopup calls popdown on destruction,
which leads to open-state-changed getting emitted after
the actor associated with the popup is destroyed.

This commit handles ungrabbing and closing from an
actor destroy handler to side-step the open-state-changed
signal.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Ray Strode
eaa32090b9 appDisplay: Don't leak duplicate items in AppView
If an icon already exists in an app view with the same id, the
duplicate is not added on a call to addItem.  Unfortunately,
since it's not added, the icon actor gets orphaned and leaked.

This commit address the problem by introducing a new hasItem
method and disallowing callers to call addItem with a duplicate
in the first place.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628
2019-07-23 14:53:24 +00:00
Florian Müllner
2653402c5c js: Add missing return values to later_add() handlers
meta_later_add() is modelled after g_idle_add() and friends, and
the handler's boolean return value determines whether it should
be scheduled again or removed. There are some places where we omit
the return value, add them (although the implicit return value of
"undefined" already gives us the intended result).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/637
2019-07-22 20:48:16 +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
55c717c2dc appDisplay: Fix logic error
Commit f6b4b96737 accidentally swapped the conditions here from
!includes() to includes().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/621
2019-07-10 21:50:17 +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
1398aa6562 style: Fix indentation errors
While we have some style inconsistencies - mostly regarding split lines,
i.e. aligning to the first arguments vs. a four-space indent - there are
a couple of places where the spacing is simply wrong. Fix those.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
6ed5bc2f6c cleanup: Use consistent switch indentation
We are currently inconsistent on whether case labels share the same
indentation level as the corresponding switch statement or not. gjs
goes with the default of no additional indentation, so go along with
that.

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
f250643385 style: Use space after catch
We are currently inconsistent with whether or not to put a space
after catch clauses. While the predominant style is to omit it,
that's inconsistent with the style we use for any other statement.
There's not really a good reason to stick with it, so switch to
the style gjs/eslint default to.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
e56d7f5021 cleanup: Remove unused variables
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:10 +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
Marco Trevisan (Treviño)
c1c45f95af appDisplay: Set Adjustment value after allocation
AllView's adaptToSize is called as part of viewStack allocation vfunc, and this
makes the adjustment value to be reset while relayouting.

So, fix this by delaying this using the Meta later that we already had for
pageIndicators operations.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1392
2019-06-18 23:22:32 +02: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
Marco Trevisan (Treviño)
bbd3275dad js: Check for this.constructor type instead of new.target
Use more ES6-inspired check for classes initializations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-26 20:48:52 -05:00
Marco Trevisan (Treviño)
7bb84dae80 popupMenu: Make MenuManager to take an actor as parameter
Since we assume now that most of the classes are actors per se we can just pass
the actor itself as parameter

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487
2019-04-17 21:32:18 +00:00
Marco Trevisan (Treviño)
1be933bc49 boxpointer: Don't use boxpointer actor, as it's now an actor itself
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
56a361650c appIconMenu: Sync windows section with app menu
Keep the app icon context menu consistent with the app menu, so stop
grouping windows by workspace and add a section heading.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/968
2019-04-17 19:23:23 +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
Carlos Garnacho
fab390826e appDisplay: Separate PageIndicators to a separate file
In order to cater for emoji panel usage, we want something like PageIndicators
except:
- It should have horizontal disposition
- It should not be animatable (?)
- It should not be reactive

Separated PageIndicators into a base, non-animated widget, and an
AnimatedPageIndicators that can be used on appDisplay.js. Reactiveness is
set through an extra method, and layout is set as a construct argument.
2019-02-05 16:25:54 +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
794a056819 appDisplay: Use GAppInfo list from ShellAppSystem
It is now cached there, so the number of g_app_info_get_all() calls
is reduced to one per change.
2019-01-26 22:55:31 +01:00
Carlos Garnacho
3db52155dd appDisplay: Reduce g_app_info_get_all() calls
Whenever the AllView needs (re)populating, we used to do one general
g_app_info_get_all() to get all GAppInfo, plus one per app folder in order
to check the ones that fall within that category. This calls results in a
fair amount of I/O blocking the main loop.

In order to ease this, keep the GAppInfo list around in AllView, and make
the AppFolders use it when figuring out the contained apps. Since reloading
the AllView results in AppFolders regenerated from scratch, the app info
list is ensured to be up-to-date for any later change within the AppFolder
(eg. through the GSettings key changing).

As the list was already filtered in the first place, we can also remove
the try{}catch() in AppFolder in order to discard desktop files with
invalid encoding.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/832
2019-01-26 16:40:48 +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
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
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
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
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
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
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
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
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
Xavier Johnson
a21a22fdb5 appDisplay: Make middle-click like Ctrl+click
When middle-clicking an app icon on the Dash, it will always try to open
a new window of that app, even if the app doesn't support multiple
windows. Meanwhile, Ctrl+click on an app will only open a new window if
the app allows it.

This change prevents middle-clicks on app icons from opening new windows
for apps without multi-window support.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/316
2018-06-07 17:49:36 +00:00
Florian Müllner
f0557ea05c appDisplay: Fall back to app name in icon menu
The app icon's context menu contains a list of open windows,
identified by their title. As we currently don't handle the
case where the app didn't set a title, we end up with empty
menu items which looks clearly broken. Fall back to the app's
name in that case.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/26
2018-05-31 11:27:43 +00:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Nikita Churaev
92f1aec3dd appDisplay: Fix small app folder icons when using HIDPI
While the scale factor is taken into account for app icons, we set
an explicit size when combining the into a folder icon - unless we
take the factor into account, the result will be too small on HiDPI
displays.

https://bugzilla.gnome.org/show_bug.cgi?id=792259
2018-02-10 00:40:48 +00:00
Marco Trevisan (Treviño)
35eac697c1 appDisplay: don't try to close the popup menu that is already destroyed
This would lead to a JS error otherwise, as we might end up
in deleting actors that have been already destructed.

https://bugzilla.gnome.org/show_bug.cgi?id=791233
2018-01-17 13:04:41 -05:00
Rares Visalom
52f604757c appDisplay: Include system actions in search results
The way system actions are displayed in the search
results is by appending them at the end of the list
returned by the ApplicationProvider.

https://bugzilla.gnome.org/show_bug.cgi?id=691900
2017-08-22 13:02:58 +02:00
Mario Sanchez Prada
d903978937 Explicitly set the width and height for subicons' containers in folders
Otherwise the smaller icons will try to take too much space since the
texture rendering the icons will be scaled up on HiDPI displays according
to the scale factor, which will push the size of the StBin containing the
texture up, causing them to completely fill the folder's total space.

Explicitly setting the size of the StBin container in this case, in a
similar fashion to what we do when creating the empty placeholders (in
case where there are less than 4 apps in a folder), ensures that each
"cell" of the grid-like widget representing the folder does not take
too much space.

https://bugzilla.gnome.org/show_bug.cgi?id=786145
2017-08-11 12:47:45 +02:00
Florian Müllner
c67eabaf62 appDisplay: Use ::paint handler to set up spring animation
The animation needs the icons' final positions, so we currently defer
it to a ::notify::allocation handler; however as starting the animation
during an allocation cycle would trigger a Clutter warning, it is
further deferred to a MetaLater. While this usually works, it is possible
that the allocation is already valid when we connect the signal, in which
case the animation is triggered at a later unexpected time. Switch to
a more robust ::paint handler instead, which also allows us to get rid
of the double-delay.

https://bugzilla.gnome.org/show_bug.cgi?id=736148
2017-07-19 10:49:54 +02:00
Florian Müllner
033277b68f Define externally accessible contants with 'var' instead of 'const'
Just as we did with classes, define other constants that are (or
may be) used from other modules with 'var' to cut down on warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
6a2af25d48 appDisplay: Define constant before using it
This is now a fatal error with current gjs, however I wonder: Did this
ever work?

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
358133e82f Initialize properties in _init()
While we've always considered it good style to initialize JS properties,
some code that relies on uninitialized properties having an implicit
value of 'undefined' has slipped in over time. The updated SpiderMonkey
version used by gjs now warns when accessing those properties, so we
should make sure that they are properly initialized to avoid log spam,
even though all warnings addressed here occur in conditionals that
produce the correct result with 'undefined'.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2017-07-13 17:23:54 +02:00
Mario Sanchez Prada
d8e7fc403b appDisplay: Add a null-check for the scrollview's fade ClutterEffect
This effect will only be created when the StScrollView actor has either
a non-zero vertical or horizontal fade offset defined, so we need to
add a null-check in these two cases before assuming it's there.

https://bugzilla.gnome.org/show_bug.cgi?id=783823
2017-06-15 15:01:51 +01:00
Florian Müllner
e08f2a4a04 Don't mix GJS and GObject signal systems
GJS implements a basic signal system that allows monkey-patching
JS objects with signal methods resembling the GObject ones. However
it's clearly not a good idea to replace the actual GObject methods,
so use the proper GObject facilities when inheriting from GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=778660
2017-02-15 23:20:14 +01:00
Xiaoguang Wang
09e6bb5d56 appDisplay: Fix completion handler for empty animations
If an onComplete handler is passed to animate(), it is set to run at
the end of the animation via the icon grid's ::animation-done signal.
Currently the signal is connected after starting the animation, with
the result that the handler doesn't run when the animation completes
immediately (because there are no icons to animate). Fix this by only
starting the animation after connecting the signal.

https://bugzilla.gnome.org/show_bug.cgi?id=774381
2016-11-23 22:11:00 +01:00
Florian Müllner
e661d904de appDisplay: Use correct view for animation
We currently assume that the current view matches the 'app-picker-view'
setting. While that is usually the case, there is one notable exception:
While there isn't sufficient usage data (yet), we show all applications
instead of an empty frequent view regardless of the setting. We should
animate the actually visible icons in that case, not the (non-existent)
ones from the hidden frequent view.

https://bugzilla.gnome.org/show_bug.cgi?id=774381
2016-11-23 22:11:00 +01:00
Bastien Nocera
009d021e4f appDisplay: Add a menu item to launch on the discrete GPU
It will only show up when a discrete GPU is available (detected through
the switcheroo-control D-Bus service), and the application hasn't
alreayd been launched.

Note that this will not currently work for D-Bus activated applications,
eg. the menu item will be available, but the environment variable will
not be passed through to D-Bus to use when launching the application.

https://bugzilla.gnome.org/show_bug.cgi?id=773117
2016-10-21 19:26:49 +02:00
Michele Gaio
1545596c7e AppIconMenu: properly destroy on source destroy.
If the source actor is destroyed while the popupMenu is shown -- this
can happen if a non favorite application was closing or crashes -- the
menu actor is improperly destroyed.

This makes the popupMenu close first and does a clean ungrab instead.

https://bugzilla.gnome.org/show_bug.cgi?id=757556
2016-05-27 01:03:25 +02:00
Florian Müllner
fed79ce4e6 appDisplay: Handle non-UTF8 filename encodings more gracefully
It may be 2015, but users still stumble upon the occasional .desktop
file that uses a filename encoding other than UTF-8. We currently
fail quite spectacularly in that case by not displaying any apps at
all - handle this case more gracefully, by only filtering out the
offending apps.

https://bugzilla.gnome.org/show_bug.cgi?id=651503
2015-07-31 16:52:42 +02:00
Rui Matos
7bdd1c625c AllView: prevent accessing a NULL effect
In some cases we might be allocated a size such that
this._grid.topPadding and this._grid.bottomPadding are both 0 which
means that the ScrollView fade effect gets removed. In that case don't
try to access the effect since it will be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=750714
2015-06-26 18:09:17 +02:00
Giovanni Campagna
1f2e53dd15 AppDisplay: use global settings object
We don't need a different GSettings object for each app or
favorite item.

While it practice it does not change much (AddMatch is still
obviously sent out), it minimally reduces the overhead on
changes, and makes for cleaner code.

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:11:22 -07:00
Rui Matos
4ff489d24b appDisplay: Don't call a non-existent onComplete
Follow up to commit 6bb905895c .

https://bugzilla.gnome.org/show_bug.cgi?id=745627
2015-03-04 19:01:41 +01:00