Commit Graph

74 Commits

Author SHA1 Message Date
Carlos Garnacho
38da54fb02 padOsd: Use non-deprecated librsvg API to create handle
On one hand, we were using a path instead of an URI on
rsvg_handle_set_base_uri(). This broke at some point in librsvg
(presumably for the best, handling paths there sounds non-standard)
leaving a blank svg (As the base image wouldn't be accessed).

On the other hand, we use this with the deprecated rsvg_handle_write()
which we should drift away from.

Using rsvg_handle_new_from_stream_sync() neatly solves both. We use
newer API based on input streams and GFiles, and it internally does
the right thing, bringing the pad OSD back to life.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1220
2019-04-27 05:50:08 +00:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 05:05:07 +01:00
Florian Müllner
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
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
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
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
Carlos Garnacho
e09f8c87e8 padOsd: Fixup to the previous commit
Forgot to squash this change before pushing, I will leave something in the
money jar as I close the door.
2018-01-30 16:41:25 +01:00
Carlos Garnacho
9ad7f59cdb padOsd: Ensure to pick pad devices only
If the underlying X11 input driver creates multiple devices from a single
device node, we may end up picking up the wrong device. So, instead of
picking the first device based on node and bailing out if it's not a pad,
pick the first pad that has that device node, and bail out if there is
none.

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

Closes: #10
2018-01-30 16:19:42 +01:00
Carlos Garnacho
508e3e518e padOsd: Add one to the >1 rings
Ring leader/label SVG elements for the second ring are named *Ring2*.
We need to add one here for elements >1, this is consistent with strips.

https://bugzilla.gnome.org/show_bug.cgi?id=785358
2017-08-03 22:06:33 +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
Carlos Garnacho
5202181a4d padOsd: Disallow help/switch monitor actions on rings/strips
It does not make sense to map those actions to non-buttons. Set the
actions insensitive in the combobox to disallow this from the UI.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-17 19:47:08 +02:00
Carlos Garnacho
c64a38f7da padOsd: Implement edition of actions for rings/strips
Customization of keycombo actions for strips/rings was lost in the
porting to new incarnation of Wacom support.

The UI here is slightly different, instead of requiring the user to
rotate/swipe in each direction to map each keycombo, the UI will
navigate the user through edition of both options, first one, then
the other.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-17 19:47:08 +02:00
Carlos Garnacho
0d0e90ce9a padOsd: strengthen ring/strip label creation
If the padOsd is given a nonexistent ring/strip, things would fail
badly later when trying to paint a 0x0 StLabel. Just avoid creating
more ring/strip labels than those known by libwacom.

This is unlikely to happen, but seems better to protect against it.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-14 22:20:48 +02:00
Carlos Garnacho
7991a53189 padOsd: Refactor function setting label after edition into separate function
https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-14 22:20:48 +02:00
Carlos Garnacho
e039871298 padOsd: Allow to switch between pads in the same group
Whenever there's more than one pad in the same group (eg. Wacom ExpressKey
Remotes), show a popdown menu to allow configuring those extra pads.
Devices are hot-pluggable, so the popdown menu will update its state
whenever pads are added/removed.

Also, allow to quickly change between pads by switching to its OSD by
just interacting with them. Always given they are in the same group.

https://bugzilla.gnome.org/show_bug.cgi?id=779986
2017-03-13 21:23:04 +01:00
Carlos Garnacho
e057333bf3 padOsd: Add PadChooser class
This is a popdown button that allows choosing between pads in
the same group.

https://bugzilla.gnome.org/show_bug.cgi?id=779986
2017-03-13 21:23:04 +01:00
Carlos Garnacho
e0c0d9223e padOsd: shuffle title labels hierarchy
Add some boxes in between, so we can add the pad chooser button
and the overall result is still centered.

https://bugzilla.gnome.org/show_bug.cgi?id=779986
2017-03-13 21:22:43 +01:00
Carlos Garnacho
ada21c975f padOsd: peek pads attached to the same tablet
https://bugzilla.gnome.org/show_bug.cgi?id=779986
2017-03-13 16:34:27 +01:00
Carlos Garnacho
e006b9b400 ui: Add PadOsd
This is an implementation of the pad OSD that's been previously
present in gnome-settings-daemon. Since things are moving closer
to the compositor, it makes sense to have this implemented as shell
UI.

https://bugzilla.gnome.org/show_bug.cgi?id=771067
2016-11-04 16:08:10 +01:00