Bug 305737

Summary: Size of Desktop Switch On-Screen Display Animation is Too Big
Product: [Plasma] kwin Reporter: Jayesh Badwaik <kde.dev>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: mail
Priority: NOR Flags: mgraesslin: ReviewRequest+
Version: 4.9.0   
Target Milestone: 4.10.1   
Platform: Arch Linux   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/108945/
Latest Commit: Version Fixed In: 4.10.1
Sentry Crash Report:
Attachments: The file with the problematic code.
How the screen looks like with a 0.1 constant (not desired)
How the screen looks like with a 0.04 constant (desired)

Description Jayesh Badwaik 2012-08-24 18:24:00 UTC
The size of the Desktop Switch On-Screen Display Animation is very large. The exact setting are in the following lines (67-68) in the file /usr/share/apps/kwin/scripts/desktopchangeosd/contents/ui/main.qml (attached)
     property int itemWidth: root.screenWidth * 0.1
     property int itemHeight: root.screenHeight * 0.1

The origin setting of 0.1 is too big and is ugly (I have 16 Virtual Desktops). Before 4.9, I do not know exactly what the principle was, but the animation was simple, now it is very very ugly. I changed the lines to the following
     property int itemWidth: root.screenWidth * 0.04
     property int itemHeight: root.screenHeight * 0.04

and now I have got a reasonably good animation, just like it was before 4.9. However, I guess, the function should be dependent on the actual number of virtual desktops? The total width of the animation should not be more than 2/3 of the screen and the total height should definitely not be more than 0.04 of the screen, else it distracts the attention from the desktop itself. And hence, it might be better to replace the lines by the following

     property int itemWidth: root.screenWidth * 0.04
     property int itemHeight: root.screenHeight * (2/*3 *numberofvirtualdesktops()))





Reproducible: Always

Steps to Reproduce:
1. Turn on Deskop Switch On-Screen Display Animation in Virtual Desktops Settings
2. Switch the desktop
3.
Actual Results:  
The animations should be nice and compact, should not take focus away from the desktop.

Expected Results:  
The animations takes the focus away from the desktop and for large number of desktops, is useless.
Comment 1 Jayesh Badwaik 2012-08-24 18:27:36 UTC
Created attachment 73445 [details]
The file with the problematic code.

This is the file where the problem occurs. I have modified the file to be a solution to my needs at least and a decent workaround for almost all people with upto 10 virtual desktops (which is the maximum allowed by the pager.)

I would not say it is a patch though. If the change is found okay, I will submit it as a patch.
Comment 2 Martin Flöser 2012-08-26 20:15:09 UTC
would you mind sharing a screenshot of how this looks like?

I have to adjust the code anyway as there is a bug which causes incorrect sizes for multiple screens.
Comment 3 Jayesh Badwaik 2012-08-27 13:07:09 UTC
Created attachment 73501 [details]
How the screen looks like with a 0.1 constant (not desired)

This is how the screen looks like when the constant is 0.1 which is not desired. See how I cannot see the rest of the virtual desktops in animation as they are not accommodated in the screen.
Comment 4 Jayesh Badwaik 2012-08-27 13:24:58 UTC
Created attachment 73502 [details]
How the screen looks like with a 0.04 constant (desired)

This is how the screen should look like and used to look like before 4.9
Comment 5 Elias Probst 2013-02-13 17:42:35 UTC
(In reply to comment #4)
> Created attachment 73502 [details]
> How the screen looks like with a 0.04 constant (desired)
> 
> This is how the screen should look like and used to look like before 4.9

Wow! This is an insane amount of virtual desktops! :)
Wouldn't it make more sense to have some kind of auto-wrapping into multiple lines at a certain point?
Or otherwise scale the width of the whole OSD based on the screen width so it's never wider than the current screen's horizontal resolution?
Comment 6 Martin Flöser 2013-02-13 18:31:34 UTC
(In reply to comment #5)
> Wouldn't it make more sense to have some kind of auto-wrapping into multiple
> lines at a certain point?
given the implementation which follows the pager layout: hardly possible
> Or otherwise scale the width of the whole OSD based on the screen width so
> it's never wider than the current screen's horizontal resolution?
yeah, it just needs a max size
Comment 7 Martin Flöser 2013-02-13 19:07:59 UTC
seems I found a solution which I integrated into: https://git.reviewboard.kde.org/r/108945/

Maximum size of OSD is now 0.8 of screen width/height
Comment 8 Martin Flöser 2013-02-20 12:02:08 UTC
Git commit 1e3cf9e197cabf00e921a4769742942acc36d24c by Martin Gräßlin.
Committed on 13/02/2013 at 16:04.
Pushed by graesslin into branch 'KDE/4.10'.

Fix layout issues of Desktop Change OSD

* no more binding loops - yeah for anchoring
* properly update sizes when switching screens
* properly handle case layout indicator enabled/disabled
* connect to desktop changed and reset desktop model
* set a maximum width/height of 0.8 of screen

Most interesting change is the moving of
visible = true;
to the beginning of the block which updates the layout. Without that
all the changes are ignored resulting in the incorrect size on screen
change.

The disadvantage of that is that the OSD is shown before the layout is
adjusted. But it's considerable minor given that it should be just one
frame.
Related: bug 312728, bug 312727
FIXED-IN: 4.10.1
REVIEW: 108945

M  +17   -17   kwin/scripts/desktopchangeosd/contents/ui/main.qml

http://commits.kde.org/kde-workspace/1e3cf9e197cabf00e921a4769742942acc36d24c