Commit Graph

153 Commits

Author SHA1 Message Date
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
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
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
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
4c5206954a style: Use camelCase for variable names
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02: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
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)
4e84b46c9b keyboard: Add extended keys and language popups to top window group
As per commit 2bd80579ed important actors are added to the top window group
using the layout's addTopChrome method.

This group includes the on-screen keyboard, however its popups were not added
and so they are now shown under the OSK and don't receive any input.

Fix this by adding Language popup and extended keys popup to top chrome.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1396
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/583
2019-06-19 00:30:17 +02:00
Marco Trevisan (Treviño)
271e43a1ed keyboard: Remove unused _hideSubkeys function
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540
2019-05-09 16:11:26 -05:00
Marco Trevisan (Treviño)
2702a82896 keyboard: Unset Idle ID before removing it
When toggling keyboard various times, we might get an error because trying to
disconnect an idle that isn't set anymore.

This is because when we remove the idle, we don't unset the ID.
Also clear the idle when destroying the keyboard.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540
2019-05-09 15:08:20 -05:00
Marco Trevisan (Treviño)
8ad33d8752 keyboard: Use JS style for current page variable
We should use camelCase for _currentPage.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540
2019-05-09 15:08:18 -05:00
Marco Trevisan (Treviño)
d84bbb8770 keyboard: Don't try to set the same current page twice
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540
2019-05-09 15:07:56 -05:00
Marco Trevisan (Treviño)
c0c2edf2e1 keyboard: Unset current page when it gets destroyed
The current page is going to be destroyed as part of _onKeyboardGroupsChanged
cleanup, however we don't unset its pointer, and thus we'd might try to call a
function using an invalidated pointer.

So, unset the this._current_page reference when its get destroyed, connecting
to destroy signal when setting it and disconnecting when changing page.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540
2019-05-09 15:07:54 -05:00
Carlos Garnacho
ed999ce926 keyboard: Destroy old layout actors when regenerating keyboard groups
We were cleaning up self._groups, but the actors for all previous
groups/layers/modes would remain attached to the aspect container,
simply hidden.

Under some circumstances this can really make the amount of actors
in the shell stage to quickly ramp up, it's not just a "leak" but
also has potential side effects on performance.

We should destroy all child actors of this._aspectContainer, except
the static ones (emoji and keypad).

While at it, fix this._groups re-initialization, as it's actually an
object, not an array.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/523
Closes?: https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-04-30 21:33:02 +02:00
Florian Müllner
a63ba61194 keyboard: Disable emoji support on X11
Unlike regular keys that generate key events from a virtual device,
emoji keys rely on the input method to insert the character. However
as the compositor cannot inject IM events into ibus, this only works
in the shell's own entries on X11.

We shouldn't expose mostly broken functionality to the user, so limit
the feature to the wayland session.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1172
2019-04-26 22:33:28 +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
Carlos Garnacho
b117826ada keyboard: Add bottom emoji panel row to separate aspect container
So we ensure the row has the right aspect ratio, and buttons neatly aligned
with the bottom row in the alphanumeric view.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/439
2019-03-05 21:11:47 +00:00
Carlos Garnacho
26b44b48ab keyboard: align AspectContainer to bottom if restricting vertically
It is convenient for the OSK so it eg. doesn't appear centered in the
available space (eg. on very narrow portrait layouts), plus it will also
be convenient to align other AspectContainers to the same baseline.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/439
2019-03-05 21:11:47 +00:00
Florian Müllner
7dd326f090 keyboard: Make items in language menu unfocusable
The menu grabs the key focus when opened, which takes focus away from
whichever actor triggered the keyboard. And as the menu doesn't have
any text entries, the keyboard is popped down as a result.

Prevent this by making the menu items unfocusable, so the keyboard
focus just stays where it is. Considering that the menu is part
of the on-screen keyboard itself, not being keyboard-navigatable
isn't a big deal here.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/171
2019-02-09 14:48:27 +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
f78efc46e7 keyboard: Implement keypad OSK panel
This is pretty ad-hoc, the panel is hooked so it shows right away on the
right Clutter.InputContentPurpose.
2019-02-05 16:25:57 +01:00
Carlos Garnacho
42ae052da7 keyboard: Add Emoji keyboard
This keyboard works similar to GTK+'s emoji chooser (actually, both pull
from the same JSON file). Emojis are categorized in sections and variants
and kept in a "model".

The EmojiPager actor then uses this model to generate pages on-the-fly as
the user swipes around. This is an important optimization since the amount
of actors would rival with the rest of the shell otherwise.

The EmojiSelection object puts the EmojiPager, the page indicators and
a KeyContainer with the bottom row of emoji section shortcuts together to
implement the emoji panel as a whole.

The Keyboard object hooked this to an "emoji" key, which is just visible
on the Clutter.InputContentPurpose where showing an emoji would be
meaningful. Otherwise the surrounding buttons are made a bit wider to
cover up for it (i.e. as it was before).
2019-02-05 16:25:57 +01:00
Carlos Garnacho
2a9923628b keyboard: Separate aspect ratio control to a container actor
This will be useful as we want other panels (eg. emoji) to preserve aspect
ratio with the rest of the OSK. Separate the aspect ratio management logic
into this container that will be the parent of them all.
2019-02-05 16:25:54 +01:00
Carlos Garnacho
291aa0b053 keyboard: Remove unused code
This signal does not exist, the Suggestions.add() method allows to attach
per-element callbacks instead.
2019-02-05 16:25:54 +01:00
Carlos Garnacho
83eb75ad7a keyboard: Fix JS warning
Iterate correctly through the array, instead of stepping on the possibly
non existent first element.
2019-02-05 16:25:54 +01:00
Carlos Garnacho
bb215966e5 keyboard: Fix JS warning
The label field may be empty here (eg. buttons fully styled through css),
just resort to an empty string then.
2019-02-05 16:25:54 +01:00
Carlos Garnacho
545d49c70d keyboard: Fix JS warning
The solution is pointed out by the warning itself.
2019-02-05 16:25:54 +01:00
Carlos Garnacho
4aecf4c973 keyboard: Avoid sequence grabs on touch
We can do without these. Since grabs prevent gestures in parent containers
from happening, we actively don't want these for emoji scrolling/paging.
2019-02-05 16:25:54 +01:00
Florian Müllner
cdd2803498 Don't mistake GObject.registerClass() for a constructor
Those slipped through when porting from Lang.Class to ES6 classes.

Very indirectly spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/388
2019-02-05 02:21:40 +00:00
Carlos Garnacho
b10606e884 keyboard: Drop GDK API usage
Use the misnamed but equivalent Clutter function.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 22:50:01 +01:00
Florian Müllner
3134222d27 keyboard: Add back constructor parameter
This was accidentally dropped in commit bacfdbbb03.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375
2019-01-30 16:13:17 +00: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
f8ce47c24d keyboard: Use addSettingsItem() in language menu
If the session mode doesn't allow access to Settings, the language
menu should respect that and not expose the "Region & Languages"
panel. Using the dedicated method instead of manually constructing
the menu item takes care of that and makes for less code.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/780
2019-01-16 00:29:23 +00: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
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
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
Andrea Azzarone
179cd0a3c8 keyboard: Remove leftover call to get_current_time 2018-09-14 12:18:38 +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
Florian Müllner
7ca418a79a Explicitly convert raw data to strings
As strings are guaranteed to use UTF-8 in the GNOME platform, generic
file APIs like g_file_load_contents() return raw data instead. Since
gjs' recent update to mozjs60, this data is now returns as Uint8Array
which cannot simply be treated as string - its toString() method boils
down to arr.join(',') - so use gjs' new ByteArray module to explicitly
convert the data.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/179
2018-07-31 16:28:53 +00:00
Florian Müllner
0dee82fb9f keyboard: Handle no-window case in FocusTracker
For windows, the cursor location needs to be adjusted by the frame
offsets. However we cannot assume that there is a window, as the
shell itself can have the key focus.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/414
2018-07-17 01:44:18 +02:00
Carlos Garnacho
e3ebc8d0c6 keyboard: Remove stale references to global.screen
(Re)introduced by the previous patch.
2018-07-11 18:46:49 +02:00