Commit Graph

23 Commits

Author SHA1 Message Date
Didier Roche
3f756dc608 barLevel: Support maxValue higher than 1
Ensure that both barLevel and slider can support a higher maxValue than 1
and computes various positions based on it.
It defaults to 1 if not set.

https://bugzilla.gnome.org/show_bug.cgi?id=790280.
2018-07-31 18:14:10 +00:00
Didier Roche
c90a4e4849 levelBar: Factor out bar drawing
Split drawing logic from Slider to BarLevel subclass.
This changes part of the theme css from -slider- to -barlevel-.

https://bugzilla.gnome.org/show_bug.cgi?id=790280.
2018-07-31 18:14:09 +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
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
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
Carlos Garnacho
516d19eb39 slider: Cache slider width for dragging handlers
The actor allocation will be invalid on CLUTTER_TOUCH_BEGIN, because
it comes together with a CLUTTER_ENTER event that will recalculate
styles, and queue a relayout in result.

The net result is that on CLUTTER_TOUCH_BEGIN, the relayout has been
already queued, so the slider width comes up as 0, and the value ends
up as 1. Later touch events already happen on a validated actor, so
it is corrected. Still, not fun when modifying the volume slider on a
touchscreen.
2017-07-15 02:36:19 +02:00
Mario Sanchez Prada
779b1ae8e5 slider: Emit a 'drag-begin' signal when starting to drag
We are already emitting a 'drag-end' signal when no more dragging
is happening, so it makes sense to emit a 'drag-begin' too when
starting, so that apps interested in implementing different logic
between those two events can easily do it without needing to deal
with the underlying 'button-press-event' signal for the actor.

https://bugzilla.gnome.org/show_bug.cgi?id=761208
2016-01-27 22:35:11 +00:00
Adel Gadllah
554de3fb24 Lower slider scrolling step to 2%
https://bugzilla.gnome.org/show_bug.cgi?id=742648
2015-01-16 18:24:36 +01:00
Adel Gadllah
e3a8a284a4 slider: Don't hardcode scroll interval for smooth scrolling
Use the SLIDER_SCROLL_STEP constant instead for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=742648
2015-01-10 14:56:34 +01:00
Carlos Garnacho
dbbf4097a5 slider: React to touch events
The slider locks to the first interacting sequence, and ignores events from
any other.

https://bugzilla.gnome.org/show_bug.cgi?id=733633
2014-07-24 18:15:02 +02:00
Magdalen Berns
f21c49f8da Slider: put imports in order
Bug https://bugzilla.gnome.org/show_bug.cgi?id=712649
2014-02-05 19:36:50 +00:00
Florian Müllner
deb2f30b37 js: Use EVENT_PROPAGATE/EVENT_STOP constants in event handlers
Just as SOURCE_CONTINUE/SOURCE_REMOVE in source functions, these
constants increase code clarity over plain true/false.

https://bugzilla.gnome.org/show_bug.cgi?id=719567
2013-12-16 18:27:19 +01:00
Alejandro Piñeiro
84d8d4f622 a11y: using generic accessible at slider
Needed in order to fill the AtkValue implementation using
signal callbacks (ala ShellGenericContainer).

https://bugzilla.gnome.org/show_bug.cgi?id=648623
2013-08-28 16:05:54 +02:00
Alejandro Piñeiro
dd1651f2d1 Setting proper name and role for system menu sliders
https://bugzilla.gnome.org/show_bug.cgi?id=706391
2013-08-22 17:18:33 +02:00
Alejandro Piñeiro
aa569304bc Fix key navigation on system menu sliders
Rely key press events management if the menu item contains
a slider.

https://bugzilla.gnome.org/show_bug.cgi?id=706386
2013-08-22 16:02:35 +02:00
Alejandro Piñeiro
3d57fd3227 slider: fix wrong variable name for own actor
https://bugzilla.gnome.org/show_bug.cgi?id=706386
2013-08-22 16:02:35 +02:00
Jasper St. Pierre
44f8fecf84 slider: Explicitly grab the device that was clicked
It seems the Clutter bug mentioned has been fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=704368
2013-07-19 05:36:02 -04:00
Jasper St. Pierre
0cee0e08e9 slider: Make clicking anywhere on the slider menu item pass to the slider
This is a regression from splitting the slider out that never got fixed.
Restore the previous (useful) behavior by adding a public API to the
slider that lets us pass an event through.

https://bugzilla.gnome.org/show_bug.cgi?id=704368
2013-07-19 05:36:02 -04:00
Jasper St. Pierre
109b29aeb5 slider: Add rounded ends to sliders
https://bugzilla.gnome.org/show_bug.cgi?id=702825
2013-06-25 09:49:44 -04:00
Jasper St. Pierre
8d47afb195 slider: Use clutter_cairo_set_source_color
This cuts down on the denseness of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=702825
2013-06-24 15:14:03 -04:00
Jasper St. Pierre
a01469fb08 slider: Extend the trough to the allocation extents
This aligns the edge of the slider with the allocation of items
under it, which is what we want to happen in the new aggregate
menu.

https://bugzilla.gnome.org/show_bug.cgi?id=702825
2013-06-24 15:14:03 -04:00
Jasper St. Pierre
847cb5b972 slider: Separate PopupSliderMenuItem into its own widget
https://bugzilla.gnome.org/show_bug.cgi?id=701755
2013-06-06 14:00:38 -04:00