[Bug 49369] Store Window Settings doesn't work with KMail

Lubos Lunak l.lunak at suse.cz
Mon Oct 21 17:48:11 BST 2002

On Friday 18 October 2002 23:47, Ingo Klöcker wrote:
> Hash: SHA1
> Hi *whoever implemented this "Store Window Settings" feature*,
> please tell us, the KMail developers, how we can fix this bug. And
> please keep in mind that KMail currently has two different main
> windows. The composer window and the "main window" (with folder, header
> and preview pane and optionally mimetree viewer).
> How does KWin differentiate between the composer window and the main
> window when it stores and restores window settings?

 Actually, I started looking at this issue at the end of the last week. The 
only suitable window properties for identifying windows AFAIK are WM_NAME, 
http://mail.gnome.org/archives/usability/2002-March/msg00012.html). Using the 
window caption (WM_NAME) might probably cause more harm than good, so that 
leaves only WM_CLASS and WM_WINDOW_ROLE. In Konsole, use "  xprop | grep 
'\(CLASS\)\|\(ROLE\)'  " and click on various windows (Qt now incorrectly 
uses WINDOW_ROLE without the WM_ prefix, see qapplication_x11.cpp.patch). If 
the output is the same, the windows will be considered the same. I said 'will 
be', after applying the attached kdebase/kwin patch, feel free to review (oh, 
in case somebody notices the removal of SessionInfoPrivate, that's a private 
class anyway).

 For KMail (and all other apps): The WM_CLASS value is basically argv[0], so 
you cannot do much about it. The WM_WINDOW_ROLE is set by Qt to the value of 
QWidget::name() (i.e. the const char* argument to QWidget constructor, or 
QWidget::setName()). I suggest setting it explicitly for all toplevel widgets 
(different values for different types of widgets of course). As a slight 
short-term disadvantage, this may break some DCOP scripts *shrug* hardcoding 
kmail-mainwindow#1 somewhere may sometimes break even now.

 Hmm, and while I'm at it, I also suggest the kmainwindow.cpp patch which 
makes sure the name() will be really always unique. Probably not really 
needed if I get in Qt a similar patch for QWidget::setName() for toplevel 

 PS: I reassigned the bug to kwin, as it's a kwin bug (fixed by the attached 
patch). Just set name() for toplevel widgets in KMail as I said (unless 
somebody will complain about the possible DCOP breakage or whatever).

Lubos Lunak
KDE developer
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qapplication_x11.cpp.patch
Type: text/x-diff
Size: 633 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021021/8f974d16/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kwin.patch
Type: text/x-diff
Size: 9121 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021021/8f974d16/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmainwindow.cpp.patch
Type: text/x-diff
Size: 1895 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021021/8f974d16/attachment-0002.patch>

More information about the kde-core-devel mailing list