[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-mac
Subject:    Re: [KDE/Mac] Review Request 126324: [MSWin/OS X] save and restore window geometry instead of only s
From:       "Boudhayan Gupta" <bgupta () kde ! org>
Date:       2015-12-14 14:08:14
Message-ID: 20151214140814.7434.55532 () mimi ! kde ! org
[Download RAW message or body]

--===============6105801550876487972==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit



> On Dec. 14, 2015, 5:17 p.m., Marco Martin wrote:
> > src/gui/CMakeLists.txt, line 22
> > <https://git.reviewboard.kde.org/r/126324/diff/3/?file=421934#file421934line22>
> > 
> > we really can't add a dependency to QWidgets here.
> > depending on qwidgets will make many potential interested project not able to use \
> > it
> 
> Alex Richardson wrote:
> Also shouldn't all that information be available using QScreen/QWindow? It doesn't \
> seem to save much: \
> http://code.woboq.org/qt5/qtbase/src/widgets/kernel/qwidget.cpp.html#_ZNK7QWidget12saveGeometryEv
>  
> René J.V. Bertin wrote:
> Are you more or less inviting me to "clone" QWidget::saveGeometry? It *does* do \
> more than simply saving frame position and window size (I have a working prototype \
> that saves and restores just that, but I guess you'd want me to include maximised \
> state and what else?) 
> Boudhayan Gupta wrote:
> Don't just lift code. See what it does and then implement it your own way. \
> Licensing between Qt and KDE are incompatible (quote: code may not be copied from \
> Qt into KDE Platform as Qt is LGPL 2.1 only which would prevent it being used under \
> LGPL 3 - from https://techbase.kde.org/Policies/Licensing_Policy)

Actually, René, I think it would be prudent to at least try and push a patch \
upstream to Qt implementing the window geometry APIs on QWindow.


- Boudhayan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126324/#review89465
-----------------------------------------------------------


On Dec. 13, 2015, 7:24 p.m., René J.V. Bertin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126324/
> -----------------------------------------------------------
> 
> (Updated Dec. 13, 2015, 7:24 p.m.)
> 
> 
> Review request for KDE Software on Mac OS X and KDE Frameworks.
> 
> 
> Repository: kconfig
> 
> 
> Description
> -------
> 
> In KDElibs4, the KMainWindow::saveWindowSize() and KMainWindow::restoreWindowSize() \
> function saved and restored not only the size but also the position (i.e. the \
> geometry) of windows, using QWidget::saveGeometry and QWidget::restoreGeometry. 
> 2 main reasons for this (according to the comments):
> - Under X11 restoring the position is tricky
> - X11 has a window manager which might be considered responsible for that \
> functionality (and I suppose most modern WMs have the feature enabled by default?) 
> Both arguments are moot on MS Windows and OS X, and on both platforms users expect \
> to see window positions restored as well as window size. On OS X there is also \
> little choice in the matter: most applications offer the geometry restore without \
> asking (IIRC it is the same on MS Windows). 
> I would thus like to propose to port the platform-specific code that existed for MS \
> Windows (and for OS X as a MacPorts patch that apparently was never submitted \
> upstreams). I realise that this violates the message conveyed by the function names \
> but I would like to think that this is a case where function is more important. 
> You may also notice that the Mac version does not store resolution-specific \
> settings. This happens to work best on OS X, where multi-screen support has been \
> present since the early nineties, and where window geometry is restored regardless \
> of the screen resolution (i.e. connect a different external screen with a different \
> resolution, and windows will reopen as they were on that screen, not with some \
> default geometry). I required I can update the comments in the header to reflect \
> this subtlety. 
> Note that for optimal functionality a companion patch to `KMainWindow::event` is \
> required: ```
> --- a/src/kmainwindow.cpp
> +++ b/src/kmainwindow.cpp
> @@ -772,7 +772,7 @@ bool KMainWindow::event(QEvent *ev)
> {
> K_D(KMainWindow);
> switch (ev->type()) {
> -#ifdef Q_OS_WIN
> +#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
> case QEvent::Move:
> #endif
> case QEvent::Resize:
> ```
> 
> This ensures that the window geometry save is performed also after a move (to \
> update the position) without requiring a dummy resizing operation. Do I need to \
> create a separate RR for this change or is it small enough that I can push it if \
> and when this RR is accepted? 
> 
> Diffs
> -----
> 
> src/gui/CMakeLists.txt 9663e09 
> src/gui/kwindowconfig.h 48a8f3c 
> src/gui/kwindowconfig.cpp d2f355c 
> 
> Diff: https://git.reviewboard.kde.org/r/126324/diff/
> 
> 
> Testing
> -------
> 
> On OS X 10.6 through 10.9 with various KDElibs4 versions and now with Qt 5.5.1 and \
> frameworks 5.16.0 (and Kate as a test application). I presume that the MS Windows \
> code has been tested sufficiently in KDELibs4; I have only adapted it to Qt5 and \
> tested if it builds. 
> 
> Thanks,
> 
> René J.V. Bertin
> 
> 


--===============6105801550876487972==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/126324/">https://git.reviewboard.kde.org/r/126324/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On December 14th, 2015, 5:17 p.m. IST, <b>Marco \
Martin</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/126324/diff/3/?file=421934#file421934line22" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/gui/CMakeLists.txt</a>  <span style="font-weight: normal;">

     (Diff revision 3)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">21</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="nb">target_link_libraries</span><span class="p">(</span><span \
class="s">KF5ConfigGui</span> <span class="s">PUBLIC</span> <span \
class="s">Qt5::Gui</span> <span class="s">Qt5::Xml</span> <span \
class="s">KF5::ConfigCore</span><span class="p">)</span></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">22</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="nb">target_link_libraries</span><span class="p">(</span><span \
class="s">KF5ConfigGui</span> <span class="s">PUBLIC</span> <span \
class="s">Qt5::<span class="hl">Widgets</span></span><span class="hl"> </span><span \
class="s"><span class="hl">Qt5::</span>Gui</span> <span class="s">Qt5::Xml</span> \
<span class="s">KF5::ConfigCore</span><span class="p">)</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">we \
really can't add a dependency to QWidgets here. depending on qwidgets will make many \
potential interested project not able to use it</p></pre>  </blockquote>



 <p>On December 14th, 2015, 5:51 p.m. IST, <b>Alex Richardson</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Also \
shouldn't all that information be available using QScreen/QWindow? It doesn't seem to \
save much: http://code.woboq.org/qt5/qtbase/src/widgets/kernel/qwidget.cpp.html#_ZNK7QWidget12saveGeometryEv</p></pre>
  </blockquote>





 <p>On December 14th, 2015, 6:59 p.m. IST, <b>René J.V. Bertin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Are \
you more or less inviting me to "clone" QWidget::saveGeometry? It <em style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">does</em> do more than simply saving frame position and window size (I have \
a working prototype that saves and restores just that, but I guess you'd want me to \
include maximised state and what else?)</p></pre>  </blockquote>





 <p>On December 14th, 2015, 7:10 p.m. IST, <b>Boudhayan Gupta</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Don't \
just lift code. See what it does and then implement it your own way. Licensing \
between Qt and KDE are incompatible (quote: code may not be copied from Qt into KDE \
Platform as Qt is LGPL 2.1 only which would prevent it being used under LGPL 3 - from \
https://techbase.kde.org/Policies/Licensing_Policy)</p></pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Actually, René, I think it would be prudent to at least try and push a \
patch upstream to Qt implementing the window geometry APIs on QWindow.</p></pre> <br \
/>




<p>- Boudhayan</p>


<br />
<p>On December 13th, 2015, 7:24 p.m. IST, René J.V. Bertin wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Software on Mac OS X and KDE Frameworks.</div>
<div>By René J.V. Bertin.</div>


<p style="color: grey;"><i>Updated Dec. 13, 2015, 7:24 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kconfig
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">In KDElibs4, the KMainWindow::saveWindowSize() and \
KMainWindow::restoreWindowSize() function saved and restored not only the size but \
also the position (i.e. the geometry) of windows, using QWidget::saveGeometry and \
QWidget::restoreGeometry.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">2 main reasons for this (according to \
                the comments):
- Under X11 restoring the position is tricky
- X11 has a window manager which might be considered responsible for that \
functionality (and I suppose most modern WMs have the feature enabled by \
default?)</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Both arguments are moot on MS Windows and OS X, and on \
both platforms users expect to see window positions restored as well as window size. \
On OS X there is also little choice in the matter: most applications offer the \
geometry restore without asking (IIRC it is the same on MS Windows).</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">I would thus like to propose to port the platform-specific code that \
existed for MS Windows (and for OS X as a MacPorts patch that apparently was never \
submitted upstreams). I realise that this violates the message conveyed by the \
function names but I would like to think that this is a case where function is more \
important.</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">You may also notice that the Mac version does not \
store resolution-specific settings. This happens to work best on OS X, where \
multi-screen support has been present since the early nineties, and where window \
geometry is restored regardless of the screen resolution (i.e. connect a different \
external screen with a different resolution, and windows will reopen as they were on \
that screen, not with some default geometry). I required I can update the comments in \
the header to reflect this subtlety.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Note that for optimal \
functionality a companion patch to <code style="text-rendering: inherit;color: \
#4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">KMainWindow::event</code> is required:</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div \
class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"><span \
style="color: #A00000">--- a/src/kmainwindow.cpp</span> <span style="color: \
#00A000">+++ b/src/kmainwindow.cpp</span> <span style="color: #800080; font-weight: \
bold">@@ -772,7 +772,7 @@ bool KMainWindow::event(QEvent *ev)</span>  {
     K_D(KMainWindow);
     switch (ev-&gt;type()) {
<span style="color: #A00000">-#ifdef Q_OS_WIN</span>
<span style="color: #00A000">+#if defined(Q_OS_WIN) || defined(Q_OS_OSX)</span>
     case QEvent::Move:
 #endif
     case QEvent::Resize:
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This ensures that the window geometry save is \
performed also after a move (to update the position) without requiring a dummy \
resizing operation. Do I need to create a separate RR for this change or is it small \
enough that I can push it if and when this RR is accepted?</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">On OS X 10.6 through 10.9 with various KDElibs4 \
versions and now with Qt 5.5.1 and frameworks 5.16.0 (and Kate as a test \
application). I presume that the MS Windows code has been tested sufficiently in \
KDELibs4; I have only adapted it to Qt5 and tested if it builds.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/gui/CMakeLists.txt <span style="color: grey">(9663e09)</span></li>

 <li>src/gui/kwindowconfig.h <span style="color: grey">(48a8f3c)</span></li>

 <li>src/gui/kwindowconfig.cpp <span style="color: grey">(d2f355c)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/126324/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============6105801550876487972==--


[Attachment #3 (text/plain)]

_______________________________________________
kde-mac@kde.org
List Information: https://mail.kde.org/mailman/listinfo/kde-mac
KDE/Mac Information: http://community.kde.org/Mac

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic