D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2018-01-03 Thread Chris Holland
Zren added inline comments.

INLINE COMMENTS

> broulik wrote in SizeHandle.qml:123
> I don't know exactly how `MouseEventListener` behaves but in `MouseArea` you 
> get a ton of `onWheel` events for touchpads (which scroll pixel-precisely), 
> potentially causing you to making your panel enormous accidentally

Recently got a Windows Vista era HP laptop running KDE.
I see, the touchpad "mousewheel" sends a ton of events with `wheel.delta` from 
±9 to ±60.

In my test, I actually noticed the opposite effect (it was slow to resize) 
since we do `Math.round(wheel.delta / 120)` which can turn into `Math.round(30 
/ 120) = 0`. So events with a `wheel.delta` smaller than 60 were ignored.

Anyways, I always wondered why plasma-pa did this in their mousewheel code:

https://github.com/KDE/plasma-pa/blob/master/applet/contents/ui/main.qml#L197-L210

Should be an easy fix. Just need to add a `wheelDelta` variable and ignore 
events when it's `wheelDelta <= -120 || 120 <= wheelDelta`.

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

To: Zren, #plasma
Cc: davidedmundson, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread Chris Holland
Zren marked 3 inline comments as done.

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

To: Zren, #plasma
Cc: davidedmundson, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread Chris Holland
Zren updated this revision to Diff 15888.
Zren added a comment.


  Jump by 2px. Jump by __ clicks. Make sure thickness is even. Hide thickness 
in button after 1 second.

REPOSITORY
  R119 Plasma Desktop

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D6392?vs=15873=15888

REVISION DETAIL
  https://phabricator.kde.org/D6392

AFFECTED FILES
  desktoppackage/contents/configuration/panelconfiguration/SizeHandle.qml

To: Zren, #plasma
Cc: davidedmundson, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread Chris Holland
Zren added a comment.


  Great idea about using a timer in the binding. I can probably keep the 
onThicknessChanged binding since it does change size when moved from left/right 
to top/bottom.
  
  As far as I can tell, the `wheel.delta` is only using the hardcoded jumps of 
±120 (on click) (or 240 is scrolled fast enough). It's not triggered with a 
value of 0.
  
  Scrolling "up" to increase the top panel size (expand downwards) feels a 
little weird, but it's probably better to be consistent with the 
left/right/bottom panels than to give it a special case when scrolling in 
reversed.

INLINE COMMENTS

> broulik wrote in SizeHandle.qml:123
> I don't know exactly how `MouseEventListener` behaves but in `MouseArea` you 
> get a ton of `onWheel` events for touchpads (which scroll pixel-precisely), 
> potentially causing you to making your panel enormous accidentally

That's a really good test case I hadn't considered. I wonder if 
`Qt::MouseButtons` `KDeclarativeWheelEvent.buttons` is pressed down in those 
events. I don't have a laptop/trackpad to test with so is there a utility to 
test trackpads with the mouse?

> broulik wrote in SizeHandle.qml:129
> Missing semicolon here and below, also can it ever get 0 anyway?

I shouldn't think so, but I can't confirm it. We don't *really* need to exit if 
it's 0 anyways.

Btw, it looks like `QWheelEvent::delta()` isn't in the qt5 docs since it's 
deprecated.
https://github.com/KDE/kdeclarative/blob/master/src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp#L333
http://doc.qt.io/qt-5/qwheelevent-members.html
https://github.com/qt/qtbase/blob/dev/src/gui/kernel/qevent.h#L202
https://github.com/qt/qtbase/blob/6bceb4a8a9292ce9f062a38d6fe143460b54370e/src/gui/kernel/qevent.cpp#L1003-L1008

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

To: Zren, #plasma
Cc: davidedmundson, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread David Edmundson
davidedmundson added inline comments.

INLINE COMMENTS

> SizeHandle.qml:125
> +if (wheel.delta > 0) {
> +panel.thickness = Math.max(units.gridUnit, panel.thickness + 
> 1);
> +} else if (wheel.delta < 0) {

You need to make it by 2.

See desktoppackage/contents/configuration/panelconfiguration/SizeHandle.qml:50:

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

To: Zren, #plasma
Cc: davidedmundson, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread Kai Uwe Broulik
broulik added a comment.


  I like the idea of showing the thickness in the button. My suggestion would 
be add a `Timer` which you `restart()` when you change the panel thickness (you 
need to try whether in `onThicknessChanged` is sufficient or doing that 
explicitly in `onWheelEvent` and/or `onPositionChanged` and then bind the text 
to whether it's running, this way you don't break any bindings but just have it 
work like magic ;) for example:
  
Timer {
id: panelResizeSizeHintTimer
interval: 1000
}

...

Button {
text: panelResizeHintTimer.running ? panel.thickness : i18n("Width") // 
don't forget "Height" for horizontal panels
...
onWheel: {
// wheel stuff here
panelResizeHintTimer.restart()
...
}
  
  (QtQuick `Timer` `restart` will start it if not running and restart it if 
already running, it also runs only once by default which is what we want here)

INLINE COMMENTS

> SizeHandle.qml:123
> +
> +onWheelMoved: {
> +if (wheel.delta > 0) {

I don't know exactly how `MouseEventListener` behaves but in `MouseArea` you 
get a ton of `onWheel` events for touchpads (which scroll pixel-precisely), 
potentially causing you to making your panel enormous accidentally

> SizeHandle.qml:125
> +if (wheel.delta > 0) {
> +panel.thickness = Math.max(units.gridUnit, panel.thickness + 
> 1);
> +} else if (wheel.delta < 0) {

I think there's also a maximum size enforced (half of 
`screenToFollow.geometry`), it's somewhat hidden in the complex 
`onPositionChanged` code

> SizeHandle.qml:129
> +} else {
> +return
> +}

Missing semicolon here and below, also can it ever get 0 anyway?

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

To: Zren, #plasma
Cc: broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart, lukas


D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness

2017-06-26 Thread Chris Holland
Zren created this revision.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.

REVISION SUMMARY
  The current thickness is also shown when dragging as well.
  Closing the ruler thing and reopening will recreate the component, so the 
Width/Height text will reset.
  
  I could use `Qt.binding(funtion(){ return panel.thickness })` but I don't 
think the panel will procedurally change with the panel's config open.
  
  Bug 372364: https://bugs.kde.org/show_bug.cgi?id=372364
  Reddit: 
https://www.reddit.com/r/kde/comments/65wdow/can_we_get_some_support_for_pixel_perfect_panel/
  
  Here's a demo: https://streamable.com/m2o7c
  
  Not intended:
  Moving the panel's screen edge triggered the `panel.onThicknessChanged`
  Demo: https://streamable.com/8jof7
  
  The best way to fix that is probably setting `button.text = panel.thickness` 
in the mousewheel event and in every case in the "drag" onPositionChanged 
event. Unless someone else can think of something better.

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D6392

AFFECTED FILES
  desktoppackage/contents/configuration/panelconfiguration/SizeHandle.qml

To: Zren, #plasma
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, mart, lukas