Commit Graph

9028 Commits

Author SHA1 Message Date
Sebastian Keller
d57953ad94 Revert "signalTracker: Use WeakMap in SignalManager to avoid leaking objects"
This reverts commit 085102be74.

We need the SignalManager map top be iterable at shutdown for some of
the following changes. A WeakMap is not iterable. This revert changes it
back to a regular Map, which re-introduces the leaks caused by this.
Those will be fixed differently by the two followup commits.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2466>
2022-09-03 15:11:46 +00:00
Florian Müllner
6a23e8ee0f status/bluetooth: Indicate progress on toggle
Turning bluetooth on or off can be very slow ­– 10-15 seconds on
my system – and we currently don't provide any feedback that
something is indeed happening until the state changes at last.

Address this by using the `acquiring` icon when the adapter is
in a transitioning state.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2444>
2022-09-03 15:05:57 +00:00
Florian Müllner
d54dc08a32 status/bluetooth: Expose adapter-state
GnomeBluetooth now exposes a more precise state than the binary
"adapter fully powerered on/off" property. Expose that on the
BtClient object to make it available to the toggle and indicator.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2444>
2022-09-03 15:05:57 +00:00
Florian Müllner
9bda370636 config: Check for new required GnomeBluetooth API
Client.default_adapter_state is a recent API addition, so update
the HAVE_BLUETOOTH check accordingly before depending on it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2444>
2022-09-03 15:05:57 +00:00
Carlos Garnacho
a89d2aed84 padOsd: Figure out label/edition UI positions from unchanged fonts
We can figure out the position to render the text without resorting to
font sizes that make the whole text element sub-pixel size. As the
original labels in the SVG are themed invisible anyway, calculate the
button/ring/strip label and configuration UI position from their unchanged
size/location.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5415
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2288>
2022-09-02 19:24:47 +00:00
Florian Müllner
646cb41e83 quickSettings: Override StButton:label property
StButton already has a :label property, so we should override it
instead of shadowing it with a new property of the same name, like
we already do for :icon-name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2462>
2022-08-31 16:40:30 +00:00
Milan Crha
a6244e34de calendar: Correct handling of recurring events
When a recurring event has deleted a single instance, it's received
as an event modification, thus make sure all of the old instances
are removed before adding the event to the list of events.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4592

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2328>
2022-08-31 16:35:14 +00:00
Florian Müllner
2ed0a61b6d status/system: Set accessible name for screenshot item
Otherwise it shows up as plain "push button".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2455>
2022-08-31 02:20:56 +00:00
Yao Wei (魏銘廷)
137c50b6dc switchMonitor: Fix initial selection on desktop
Due to !2056 the monitor config is 2 instead of 4 on the desktop.
However, the constant `Meta.MonitorSwitchConfigType.UNKNOWN` is fixed to
4, and may cause the initial selection to be out of index thus fail to
display the switcher.  This replaces the above constant to the actual
length of the switcher items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2451>
2022-08-31 00:38:49 +00:00
Florian Müllner
6c56de82ea status/network: Stop using radio-mode for VPN items
If a device has multiple connections set up, then at most one of
those can be active at a time, which is why they are presented
as radio items.

In contrast, VPN connections are not mutually exclusive, each can
be turned on or off independently. Setting :radio-mode on them
currently means that VPN connections can be activated, but never
disabled.

So instead of abusing the :radio-mode property to give VPN items
the UI we want, use regular items that reflect the desired behavior
and explicitly set up the UI the way we want.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2426>
2022-08-30 15:43:11 +00:00
Sebastian Keller
085102be74 signalTracker: Use WeakMap in SignalManager to avoid leaking objects
The object the SignalTracker belongs to is stored in a map managed by
the SignalManager which keeps a reference to that object. This map is
never destroyed nor is any entry ever removed. This leads to all objects
that ever had SignalTrackers used on them being kept alive even after
all references outside of the SignalTracker are long gone. This then
also extends to other objects which are leaked indirectly through
reference chains from these objects.

And if some of those objects are GObjects, this will prevent them from
being finalized, leaking further resources. A StWidget for example will
not release its shadow textures.

Fix this by using a WeakMap in SignalManager.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5807
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5796
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2450>
2022-08-29 21:53:58 +00:00
Carlos Garnacho
622590179b keyboard: Use the right property to figure out modifiers set size
During development of the OSK updates, this._modifiers turned from an
array into a Set(), but this location missed switching from length()
to size() to get the cardinality of the contained values.

As a result, the OSK misbehaved and resorted for key event forwarding
for impossible keyvals, instead of handing them directly to the IM.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5766
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2445>
2022-08-23 18:37:11 +00:00
Georges Basile Stavracas Neto
82b1a36bb3 Revert "appDisplay: Reduce drag overshoot timeout"
This reverts commit 01e43969e8.

As per design feedback [1].

[1]
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335#note_1525991

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2442>
2022-08-22 15:41:34 -03:00
Florian Müllner
1e9749a782 status/system: Add screenshot item
We got a shiny new screenshot UI last cycle, but only relatively
obscure ways of launching it: Keyboard shortcut or overview search.

The new quick settings provides us with a natural place to expose
the functionality more prominently, and at the same time reduce
the emptiness of the top row, in particular on systems without a
battery and when locked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
6db6db8a6b screenshot: Allow some shortcuts on lock screen
We will expose the screenshot UI from quick settings, including
on the lock screen. It would be odd to restrict keyboard shortcuts
more than the more accessible UI, so relax the modes for the
screenshot-ui and screen-screenshot shortcuts.

We still disable all screenshot shortcuts on the login screen, as
users don't have an obvious way to retrieve the screenshot files.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
f9135cdc86 screenshot: Only enable window screenshots when allowed by mode
We currently don't take the session mode's `hasWindows` property
into account when deciding whether window screenshots should be
allowed. Right now that doesn't matter in practice, because all
the ways to bring up the screenshot UI are blocked in those modes
anyway. This is about to change though, so take the property into
account to prevent an information leak.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
aa7bc4cfa3 screenshot: Disable screencasts when locked
It is currently not possible to bring up the screenshot UI while
locked, but that is about to change.

We still don't want screencasts in that case, because they are
much easier to abuse for filling up someone else's disk.

That restriction is enforced by inhibiting remote access in the
backend, so trying to create a screencast session will fail anyway.
Still, not offering an action that is unavailable is better than
having it fail silently, so do exactly that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
6050229aa1 status/system: "Move" spacer in desktop case
When we aren't showing the power toggle (read: on systems without
a battery), all items in the top are located on one side. Address
this by "moving" the spacer between "Settings" and "Screen Lock"
in that case to balance items a bit better.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
e2cd66169b status/system: Use icon-name property
The quick settings code was first developed in an extension, which
meant it made sense to maintain compatibility with GNOME 42 and not
use the new :icon-name convenience property.

There is no good for sticking with that for GNOME 43 as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
2022-08-22 14:15:17 +00:00
Florian Müllner
8945e25655 status/location: Use better indicator icon
We've used find-location since the indicator was added, however
the icon theme got a more appropriate location-services-active
icon a while ago.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2430>
2022-08-19 09:44:57 +00:00
Florian Müllner
b7d738dfff quickSettings: Fix slider accessibility
Since we put the actual slider into a bin to get a proper focus
indication, the slider isn't focused anymore and its accessible object
is therefore invisible to the screen reader.

Fix this by passing the slider's accessible object to the actor
that takes the focus.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2431>
2022-08-18 23:00:12 +00:00
Florian Müllner
4c495380a5 status/nightLight: Hide when unsupported
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5752

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2425>
2022-08-18 15:40:49 +00:00
Clerie Riese
2d6b21357d status/network: Use NM connectivity check URI for Portal Helper
NetworkManager can check if a network interface has "internet access" by
invoking a HTTP request.

The URI used for connectivity checking in NetworkManager can be configured
manually in NetworkManager.conf:

[connectivity]
uri=http://portal-check.exmaple.com/nm-check.txt

Portal Helper provides an argument to pass the URI that should be opened.
If this argument is empty it uses http://nmcheck.gnome.org as a fallback.

Pass the URI configured in NetworkManager to Portal Helper instead of
an empty string.

Fixes #1313

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2228>
2022-08-18 08:00:24 +00:00
Daniel van Vugt
4f3b1c51cf calendar: Use connectObject on _sectionList
This prevents _sync() being called after actor destruction (since actor
destruction became more reliable in mutter@3d94c7cc2) and so eliminates
this shutdown error:

```
(gnome-shell:35197): Gjs-CRITICAL **: 16:31:02.769: Object .Gjs_ui_calendar_Placeholder (0x559ed6e547e0), has been already disposed — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x559ed6022310 ==
 #0   559ed783c5a8 i   resource:///org/gnome/shell/ui/calendar.js:1012 (31955be5fc90 @ 148)
 #1   7ffef8f38230 b   self-hosted:1178 (32af8f6b0c40 @ 454)
 #2   559ed783c518 i   resource:///org/gnome/shell/ui/popupMenu.js:806 (31955be18ce0 @ 52)
 #3   559ed783c488 i   resource:///org/gnome/shell/ui/popupMenu.js:954 (31955be190b0 @ 168)
 #4   559ed783c3f8 i   resource:///org/gnome/shell/ui/panelMenu.js:189 (31955be88150 @ 41)
 #5   7ffef8f3de60 b   self-hosted:1178 (32af8f6b0c40 @ 423)
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2429>
2022-08-18 07:55:20 +00:00
Florian Müllner
4fd4b09919 status/bluetooth: Fix remembering set up devices
It is generally not possible to differentiate between systems
without bluetooth support, and systems where a bluetooth adapter
is powered down.

We work around that by tracking whether there are any set up devices,
and keep the bluetooth visible in that case, even when no adapter
is present.

However commit eeabdd150c moved updating the setting into the code
that handles adapter changes, which is exactly the place where we
carefully avoid changing the setting because it would be too
unreliable (devices may have already disappeared, or not yet
appeared).

Fix this by changing _setHadSetupDevices() to _syncHadSetupDevices()
and call that everywhere _sync() used to be called, *except* on
adapter changes.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2409>
2022-08-10 17:19:07 +00:00
Florian Müllner
0c7446c1fc status/bluetooth: Fix call to undefined method
The method started out as private and was then made public without
updating the internal caller, whoops.

Spotted by Sebastian Keller.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2409>
2022-08-10 17:19:07 +00:00
Carlos Garnacho
9bd91ca4d8 keyboard: Change page switching animation in emoji picker
Use a carousel animation to switch pages, and set up the emoji
picker to have the system text direction so that coordinate
flipping is mostly done for us in RTL.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5616
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
c6c6eb5310 keyboard: Shuffle text direction initialization
We do set the full OSK as LTR since keymaps are defined in that
direction. Other actors inside the OSK might want differently so
move this piece of setup to init(), so child actors can set their
own without the OSK overwriting the value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
2b81355fa1 keyboard: Use SwipeTracker for emoji panel page switching
This allows handling scroll events, in addition to 1fg and pointer
gestures. 3fg gestures are less relevant here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
d843136247 swipeTracker: Set up 1fg drag gesture in capture phase
This should be handled in the capture phase so containers setting
up the drag gesture have an opportunity to handle events from children.
This also follows what the 3fg swipe gesture does.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
aab9899cb7 keyboard: Propagate ratio changes to the emoji selection panel
Update the emoji panel so it can handle ratio changes dynamically,
and propagate the ratio from the Keyboard itself, so that the
emoji panel has a size that fits the OSK panel it was launched
from.

This is more important now with widely varying ratios, like
extended keyboards.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
90bd0c4a25 keyboard: Add Hangul OSK keymap
This keymap requires the corresponding input method for Hangul
input, and the hangul mode to be enabled. Look up for the right
state, and use a corresponding 'us' keymap for english input
otherwise, in order to follow hangul IM behavior.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
b18ab0086e keyboard: Let the OSK take 1/4th of height in portrait mode
And let the keys shrink horizontally to cover the full area.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
f1fcce66aa keyboard: Always use ratio of visible level
Since the OSK keymap actors are cached, we no longer update the aspect
container ratio as often as we should. Ensure to update the aspect ratio
with language/level changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
c0a75faf89 keyboard: Use extended US keyboard for terminal mode
If the input hint is "terminal", use the extended keyboard.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
aa341104e5 keyboard: Fill suggestion on button-press-event
Like OSK key buttons, we must avoid the default grabbing behavior
of StButton here. Hook to button-press-event to commit the selected
words, so we get a chance to prevent focus changes on the current
key focus.

Likewise, connect to ::touch-event to handle touch input.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
b210b2de72 ibusManager: Add OSK completion mode
This mode changes the current IBus engine to ibus-typing-booster
under the rug (i.e. no changes in keyboard status menu) for any
XKB engine selected.

In order to make it useful for the currently selected language,
the typing-booster dictionary is changed to the current XKB
layout language. And since the OSK has its own emoji panel,
typing-boosters own emoji completion is disabled.

These changes only apply as long as the OSK panel is shown,
reverting to the original engine and typing-booster configuration
after it is hidden. This in theory also caters for users that
do have ibus-typing-booster enabled as an input source.

The final effect is text prediction for the language that is
being typed, according to the OSK layout, given that
ibus-typing-booster and the relevant hunspell dictionaries are
used.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
fce376939f keyboard: Add 'delete' OSK key action
This action will replace CLUTTER_KEY_Backspace emission for
the OSK backspace key. Following the available mockups, implement
different modes of operation:

- Single tap deletes a single character
- Long tap starts deleting characters one by one
- Longer tap switches to word-by-word deletion

This is made possible via the input method surrounding text,
inspecting the string to look the previous char/word position
backwards, and relies on IM focus providing enough context.

Since deleting text and getting surrounding text are both
async operations, we make one happen after the other, until
the button is released.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
482e62cb75 inputMethod: Add signal/getter for surrounding text updates
We need to keep track of those at places, add a signal and getter
so that this information can be accessed from the OSK.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
2920738d23 keyboard: Add/handle "modifier" action keys
These keys are handled so that the related modifier keyval (e.g. left
control) is toggled on, and flushed on the next non-modifier key
press submission.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
3b81e0f8eb keyboard: Trigger OSK level changes on button release
Keep it consistent with the rest of the actions. For long press
handling (i.e. shift turning to caps lock), this also means the
release action should be cancelled after any long press, to prevent
both from taking effect at the same time.

Prior to this commit, we used to switch level (and hide the button
being pressed) on button press, which made its long press handler
never get a paired release and end up triggering caps lock.
Performing the action on release ensures the shift key button does
not fall into this situation, making this issue moot.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
c609ffe0b5 data: Move extra keys to JSON files
Have these defined in the JSON files themselves, instead of trying
to add them from JS while minding the differences in number of levels
and rows.

This means more redundant data in the JSON files, but simplifies
OSK layout creation significantly, and allows finer control over the
appearance without quirks.

As a result, importing data from CLDR is no longer as straightforward
as running an script. After initial import, manual editions will be
required to add missing keys, assign key widths, and so on.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
5d0c49f0e0 keyboard: Add generic handling for key actions
These actions are defined in the JSON files themselves, allowing
us to migrate away from the sets of pre/post default keys, and fold
them into the JSON files for fuller control on layout and appearance.

As a first migration step, handle the relevant actions in the buttons
created from the JSON files, so we can port these.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
5b950d7db1 keyboard: Drop needless signal from OSK Key object
The 'pressed' signal will be emitted in the same circumstances now,
there's no need for a separate 'activated' signal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
ce80e16173 keyboard: Unify OSK key commit handling in single-state signal
Instead of having callers handle pressed+released, emit string
commits on a distinct signal that is emitted all at once during
release.

This also unifies the behavior of keys that have an extended keys
popup and not wrt press/release behavior and key repeat.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
2e30fc2cbc keyboard: Separate aspect and behavior of OSK keys
Add distinct properties for label/icon, and commit string/keyval
actions. This makes keys figure less things on their own, allows
disociating aspect and behavior (e.g. label '↲' and keyval 0x13),
and makes the fallbacks clearer (keyval and label resorting to
commit string).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
a2674c1166 keyboard: Read key width from model
Handle a "width" property to key structs in the JSON files, and
use that (so far) to give the right width to space keys in layouts.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Carlos Garnacho
76933445c6 keyboard: Update OSK key model from JSON to new format
Every key is now a map able to handle more properties, so its behavior
can be extended. For now, minimally adapt to the new format so the OSK
does not break along the update.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>
2022-08-10 17:11:26 +00:00
Florian Müllner
a4134e1559 panel: Remove aggregate menu
The menu has served us well over the years, but it is finally time
to retire it.

         τετέλεσται

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
84c33157a2 status/network: Request scans while wireless menu is open
We want the list to keep updating, so periodically request scans
from NetworkManager. The code follows what Settings does in its
wifi panel, including the used interval.

There's a cute little spinner in the menu header now, to indicate
an ongoing scan.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
81eb7db5a0 status/network: Port to quick settings
… and just like that, we've reached the end of the journey.

There's little else to say, except how remarkably unremarkable
the change is (not in terms of UI of course).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
dc09f990c4 status/network: Keep sensitive when locked
Unlike the old menu that restricted almost everything on the lock
screen, we went into the completely opposite direction with quick
settings and kept everything that does not launch windows available.

Extend that line to the network items, but still respect the
`network-control` permission.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
cd9284e48f status/network: Hide sections if networking is disabled
When moving to quick settings, we will no longer have a single
parent we can hide instead.

This is only really needed for VPN - devices go away when networking
is disabled, connections (as in: configuration) do not - but it's
simpler to just handle this in the base class than adding a
_shouldBeVisible() method the VPN section can override.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
8e685246e2 status/network: Special-case wireless hotspots
If any device is in hotspot mode, use the corresponding item as
primary. Disable the (future QuickMenuToggle) menu in that case,
and turn off the hotspot when activated rather than toggling the
global wireless switch.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
3a1ebd86d2 status/network: Make wireless insensitive when hardware-disabled
We cannot do anything while switched off, so indicate that to the
user.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
791c65a5f9 status/network: Override activate() for wireless
Wireless items represent a single adapter, but wireless connectivity
is controlled globally under NetworkManager.

So instead of delegating activation to items, bind the :checked
property to the global :wireless-enabled property and toggle it
on activate.

As any wireless devices will change their state to UNAVAILABLE
when wireless is disabled, don't remove corresponding items in
that case to keep the section visible.

We don't want to hide the button to turn Wi-Fi back on when toggled
off :-)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
1cc07716fa status/network: Expose WirelessDeviceItem:is-hotspot
Whether the device is used as a hotspot is currently only
used internally for the name and icon-name properties.

But hotspots need special treatment in the toggle as well,
so turn the method into a GObject property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
88262a1042 status/network: Add activate() in NMSection
As the sections are about to turn into quick toggles, they need
to be able to perform an action on click.

Add an activate() method for that purpose, which either disconnects
all active items, or connects the primary item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
be98e5b314 status/network: Add activate() to NMDeviceItem
DeviceItems are sections, and therefore not actually activatable.

However when we port to quick settings, those toggles will need
to do *something*.

For that reason, provide an activate() implementation that

 1. deactivates the device if currently connected

 2. delegates the action to the most-recently used item,
    the first visible item or the auto-connect item (in that
    order)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
2231fce157 status/network: Use binding for updating primary indicator
The primary indicator is a bit tricker than the VPN one: The source
of the binding can change depending on the connection, and we still
want to show it when there is a network connection we don't know
about (either because we don't handle the device type, or the
device isn't managed by NetworkManager).

Bindings still make the whole thing a lot nicer though.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
ded451f334 status/network: Use bindings to update VPN indicator
Now that the VPN section is a GObject, we can set up proper bindings
for icon-name and visibility.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
11283be390 status/network: Add NMSection:label property
This is the last property that will be needed by the future
betwork quick toggles.

It maps to the same item as :icon-name, except when more than one
item is active. In that case, we overrule the binding and return
a generic name and count (like "VPN (2)").

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
f96447079a status/network: Add NMSection:icon-name property
Again no big surprise, a property that will soon correspond to the
quick toggle's icon.

It is more involved than the :checked property though, which is just
a simple boolean.

To keep it as simple as possible, we set up a binding group and use
that to bind the :icon-name property.

As state changes, we then update the group's source with the item
we deem to best represent the section as a whole at the given
moment.

That is (in that order):

 - the first active item
 - the most recently used item
 - the top-most visible item

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
b0df35babf status/network: Add NMSection:checked property
Unsurprisingly, this will become the quick toggles 'checked' state.

Equally unsurprising, it is set when at least one item is active.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
16b63af441 status/network: Make NMSection a GObject
Instead of subclassing PopupMenuSection, it is now a plain GObject
that has a `menu` JS property.

That brings it a tad bit closer to QuickMenuToggle, which is another
GObject with a `menu` property.

We are on the final stretch now. Over the next couple of commits,
we'll add some (fake) properties so we can hook everything up,
and then it's finally time for the big switch.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
2022-08-10 16:37:15 +00:00
Florian Müllner
864606ae9d screenShield: Only wake up screen when active
We treat wake up requests the same as user activity, as in general
the two behave the same: Turn on the screen and reset the idle watch
until the system becomes idle again.

The big exception is when the screen isn't locked yet. In that case
user activity should interrupt the automatic screen lock, but a
request to wake-up the screen (like showing a notification) should
not.

Address this by ignoring wake-up requests while the screen shield
isn't active, as we can expect the screen to still be turned on at
that point.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2413>
2022-08-10 16:31:42 +00:00
Florian Müllner
111e982eb7 sessionMode: Log mode changes
Now that console.debug() makes it easy to log message with DEBUG
priority, we can be a lot more generous with logging without
spamming logs (by default).

Those turned out useful in figuring out the issue in the next
commit, so let's keep them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2413>
2022-08-10 16:31:42 +00:00
Georges Basile Stavracas Neto
4dcae8ddd2 appDisplay: Bring back drag overshoot region
This is a region where, if hovered while dragging, immediately goes
to the previous or next page. This behavior was lost during the
transition to the new app grid layout manager.

Bring back the drag overshoot region.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
692de0eb95 appDisplay: Rename _lastOvershootTimeoutId
Trivial renaming to _overshootTimeoutId. No functional changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
01e43969e8 appDisplay: Reduce drag overshoot timeout
As per design feedback, reduce it to 300 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
88c3945ae1 appDisplay: Center-align arrows
As per feedback, center align the navigation arrows since they
are big enough of click targets.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
8f247971eb appDisplay: Special-case dropping over page indicators
This brings back the ability to drop an icon beyong the last page.
Because the acceptDrop() method does not have access to the target
drop actor, to avoid an extra pick or manually calculating it from
allocations, simply store it during DragMonitor.dragDrop(), and
use the target actor in acceptDrop().

This commit also removes the last usage of SidePages, so drop the
enum too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
09b975fabf appDisplay: Reimplement drag motion using page indicators
This simplified the _handleDragOvershoot() callback quite a lot.
Instead of transforming point positions and checking them against
grid coordinates, merely check if the drop target is one of the
page indicators.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
892fa6581c appDisplay: Turn navigation arrows into StButtons
Make the next and previous page arrows be StButtons, with their
'icon-name' property matching the current StIcon icon name, and
use the 'clicked' signal to switch pages.

Remove the 'button-press' callback the scroll view, since the
buttons take over this functionality.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
f22a5c5a91 appDisplay: Readd next and previous page icons previews
This was lost 2 commits ago, but now we reimplement this in a
different way. There is some jesting with allocations, since
we cannot use transformed positions while changing translation
of the icons. This new implementation works regardless of the
screen resolution.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
48bcc8f0e2 appDisplay: Make arrows always visible
Always show navigation arrows in the app grid. Make the arrows and
page indicators multually exclusive, hide one whenever the other
is visible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
3281c03aea appDisplay: Make page previews fill allocation
Instead of hardcoding the width of the page previous, allow them
to fill the allocated space.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
6c00e0fda4 appDisplay: Use custom layout manager for page indicators
This is a major departure to how page previews used to work. Add
a new layout manager that handles showing and hiding page previews
and navigation arrows. Move most of the code handling page previews
to this new layout manager.

The layout manager allocates at most 20% of the screen width for
the previews, and at least the width of the arrow.

The next and previous page peeking effect is temporarily lost with
this commit, but will be reintroduced in later commits.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
b9a373c1ab appDisplay: Introduce custom IconGrid class for AppDisplay
AppDisplay will require an extra padding applied on top of CSS
page padding. This is specific to AppDisplay and FolderView.

Add a new AppGrid class which subclasses IconGrid and adds this
extra padding - here called 'indicators-padding'.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
b115e07b4a iconGrid: Always call findBestModeForSize()
The API surface of IconGrid was originally meant to be only
setGridModes(), however findBestModeForSize() ended up being
called by AppDisplay code. Now that FolderGrid sets the modes
correctly, we don't need to skip calling findBestModeForSize()
anymore.

Always call findBestModeForSize() during IconGrid's allocation.
Add an underscore to findBestModeForSize() since it's now back
to be a private method of IconGrid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
113130552f appDisplay: Set 3x3 grid mode for folders
Folders have a fixed 3x3 grid, given that folders themselves
have a fixed size. Make the code correspond to this invariant.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
083a691a74 appDisplay: Mostly remove adaptToSize
Back in the day, adaptToSize() contained mad maths to figure out
icon sizes. Over time, its scope was reduced, to the point where
we are today where it mostly just redoes some quick maths to
predict the grid size based on the CSS box model.

Remove adaptToSize() from BaseAppView and child classes. It still
is an internal detail of the IconGrid class, but it's not exposed
as a "public" method anymore.

This removal is not perfect, as it doesn't move or compensate for
any of page indicators and arrows code. This will be done in follow
up commits introducing a new layout manager for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5ba699e095 appDisplay: Stop updating fade effect
Don't update the fade effect, since we have "infinite" borders now.
Also remove _availWidth and _availHeight, since these variables are
now unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5cb94c526c appDisplay: Give all available size to grid
Another step in dismantling AppDisplay before reintroducing some
of the elements there. Instead of adding a certain amount of
padding, capped at 200px, always give the grid all available size.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
1fb570b415 appDisplay: Remove stack from AppDisplay
The stack widget once was a ShellStack and had a prominent role
in layouting AppDisplay, but after a series of reworks it's now
effectively unused, and can be safely removed.

Remove the '_stack' widget from AppDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
29601b84d4 appDisplay: Don't update fade effect
We'll have to dismantle parts of AppDisplay and BaseAppView in
order to introduce navigation arrows in a way that won't drive
people insane.

Start this dismantling by removing the fade effect. It looks odd
for now, since we still set padding to the app grid, but that
will change soon too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Florian Müllner
b4ff426a93 status/network: Stop summarizing device sections
Now that the number of displayed items is capped, there's no need
for a summary anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
1a0dbd00e4 status/network: Limit the number of items that are shown per section
Space will be less of a concern when each sections becomes its own
menu, but it's still not infinite. To address this, enable MRU
tracking and limit the list to the eight most recently used items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
cb4d96072e status/network: Add timestamp to device items
Devices do not have an associated timestamp, but as we can now
track the MRU order of their connections, it makes sense to consider
the time of the most recent succesful connection the timestamp
of the device item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
911762ea54 status/network: Add ItemSorter option to track MRU
We always display items sorted by name, but there are cases where a
second order by recency is interesting. Add an option to ItemSorter
to keep such a list and allow accessing it with another generator
function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
a3dbb3e71f status/network: Add timestamp property to items
Connections have a timestamp property, which records the last time
it was succesfully activated. This is useful information to us, as
more recently used connections are likely more relevant than ones
that haven't been used for a long time (or not at all).

To make use of it in the future, expose that timestamp as a property.

Only connections support it, but we will soon provide a reasonable
value for devices as well, so add the property to the base class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
c84d63854f status/network: Move settings item into toplevel section
Eventually each section will turn into its own menu, which should
include a single settings item.

This also removes the odd duplication of items, now that we avoid
using submenus where possible.

In general this is straight-forward, except for modems: Some
models are now supported by a dedicated wwan panel, while others
still use the generic network one.

Address this by adding items for either panel, but only show one
at a time. The new panel is used if *any* modem is supported,
only when all modems require it, the legacy panel is used.

Hopefully that shouldn't be an issue for many users, as using many
different modems with different capabilities should be fairly rare
(except for Aleksander Morgado, but I think he can handle it)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
c2139b27da status/network: Use submenus when necessary
We currently stopped using submenus altogether, but that only works

 - if there is a single connection that represents
   the device as a whole

 - if there is just one device, so it is unambiguous
   what device items belong to

To implement that behavior, add a 'single-device-mode' property that
NMDeviceSection can set on its items, and have items update their
'use-submenu' property based on that.

For wireless devices it's a straight mapping, as its items represent
wireless networks that can appear and disappear by just walking around
(multiple wifi adapters also sounds rather fringey).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
03ded1dcf0 status/network: Introduce NMSection parent type
Now that device sections manage a list of items, and the VPN section
manages a list of items, it's time to split out a shared base.

The class will get more involved over time, and eventually become
the base of all network quick items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
78154d9d20 status/network: Simplify section setup
With the latest changes, device- and VPN sections now require
exactly the same setup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
392f72bf1c status/network: Store sections by device type
Now that the indicator no longer needs to map connections
to device wrappers, we can drop the custom 'category' type
and just use the device type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
acda87dd26 status/network: Track devices in NMDeviceSection
We got the indicator out of the business of tracking connections,
now it's time to do the same for devices.

Let sections track device additions and removals, and create device
items for them as it sees fit.

It also allows the sections to handle the ::activation-failed signal
by themselves, instead of passing it on from device items.

With this, the indicator is now solely responsible for global state:
Manage the top bar indicators, notify on connection failures, and run
the portal helper when NetworkManager detects a captive portal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9bb9a847ba status/network: Let device items handle their own connections
As mentioned when doing the same for VPN connections, it is currently
the indicator itself that keeps track of added and removed connections.

It then has to figure out the correct section, and iterate through all
its device items so each item can check whether the connection
corresponds to its device.

Stop that mess, and let each device item keep its connections updated
by itself. That is actually way easier, as NM.Device already exposes
available connections through a property, so we can get rid of all
the checkConnection() shenanigans.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
59a3963647 status/network: Create indicator sections in constructor
We currently wait until we got a connection to NetworkManager.

That's possible because the old PanelMenu indicator API takes
a menu, so it is possible to add or remove items dynamically
later.

That won't be the case with quick settings, where `quickSettingsItems`
is a plain array that is only read once when adding the indicator.

Prepare for that by moving section initialization into the constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
50671a78ec status/network: Replace wi-fi selection dialog
Now that wi-fi devices will be handled by a separate menu toggle
instead of as part of a combined system menu, there is no longer
a need of delegating network selection to a separate dialog.

To keep the menu from growing too much, the (sorted) list of
displayed networks is kept at a limit of eight. There is always
Settings for a complete list…

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00