suggestion & PATCH: center shutdown-dialog on screen containing mouse-pointer

Thomas Gahr ml at dadommas.de
Sat Sep 10 02:08:44 BST 2011


Yay! What a great feeling to contribute, even if it's just a tiny bit :)

Anyway, I found an issue which seems to be either a bug in Qt (mind I'm using 
4.8 beta) or KWin (seems not unlikely, see below) as far as I can tell.

Before I start babbling: at the moment of writing this, I do not have a second 
screen to investigate this further and will not until two days from now... 
I'll just describe the problem and my source-reading-only findings - so I think 
most people can just skip this mail. I'll follow up with results from a 
testcase and debugging to narrow this down. Unless someone says "stop it", of 
course :)

Problem (in KDialog::centerOnScreen): If a second screen was connected and has 
been disconnected (upon disconnection the laptop display's absolute 
coordinates are reset to (0,0) in kcontrol) the dialog is not centered on the 
screen but is only half-visible. Put another way: when two displays are 
connected, the dialog is centered either on (0,0  1920x1080) or (1920,0  
1920x1080) - in the situation just described the dialog seems to be centered 
on (0,0  3840x1080), i.e. only half visible.
Note: after disconnecting the second display, my mouse pointer can not leave 
the screen - so X is well aware that the display dimensions are back from 
3840x1080 to 1920x1080.

KDIalog::centerOnScreen calls KDailog::screenRect, which has two code paths to 
follow: return QDesktopWidget::availableGeometry or QDesktopWidget::geometry.

QDesktopWidget::availableGeometry queries (according to current Qt sources 
from git) _NET_WORKAREA from the root window. According to the freedesktop 
spec [0] "This property MUST be set by the Window Manager" - so it seems (to 
me, just jumping to conclusions here) like KWin didn't react properly to the 
fact that the display config changed.

If instead QDesktopWidget::geometry is returned, I'm at my whit's end, 
QDesktopWidget only reimplements resizeEvent and I have no idea how or where 
QDesktopWidget is instantiated/handled in QApplication.

Anyway, as I said before, I will build a testcase to investigate 
QDesktopWidget's behaviour further (my suspicion is that availableGeometry is 
wrong while screenGeometry is correct) and I'll debug KDialog to narrow this 
down.

While I'm at it:
Reading this mail you might've noticed that
a) I'm talking (writing) a lot ;)
b) I'm unsure how/when to approach kde-core-devel...
I noticed a usability issue, investigated it, wrote a patch and sent a mail 
here - would it've been better to file a bugreport and attach the patch there? 
I'd really hate to unnecessarily "spam" the list if another measure would be 
more appropriate.

Cheers and thanks,

Thomas



[0] http://standards.freedesktop.org/wm-spec/1.3/ar01s03.html

On Wednesday 07 September 2011 20:31:07 Aaron J. Seigo wrote:
> On Tuesday, September 6, 2011 20:17:54 Thomas Gahr wrote:
> > So I cooked up this little patch which adds 6 characters of code and a
> > lot of joy for me ;)
> 
> thanks Thomas; i've applied the patch and it seems to work nicely! you can
> expect to see it in Plasma Workspaces 4.8... :)




More information about the kde-core-devel mailing list