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

List:       kde-core-devel
Subject:    [PATCH] Fix for bug 51571 - please review
From:       Ravi <ravi () kde ! org>
Date:       2003-09-13 18:19:58
[Download RAW message or body]

Hello,
  This is a "fix" for http://bugs.kde.org/show_bug.cgi?id=51571 which uses a 
different (nicer?) hack to handle maximized windows. Ok to commit?

Regards,
Ravi

["51571.diff" (text/x-diff)]

Index: kdeui/kmainwindow.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kmainwindow.cpp,v
retrieving revision 1.120
diff -u -p -w -r1.120 kmainwindow.cpp
--- kdeui/kmainwindow.cpp	3 Sep 2003 15:33:17 -0000	1.120
+++ kdeui/kmainwindow.cpp	13 Sep 2003 18:18:43 -0000
@@ -826,10 +826,10 @@ void KMainWindow::saveWindowSize( KConfi
 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
   int scnum = QApplication::desktop()->screenNumber(parentWidget());
   QRect desk = QApplication::desktop()->screenGeometry(scnum);
-  // save maximalization as desktop size + 1 in that direction
+  // save maximalization as desktop -1 in that direction
   KWin::WindowInfo info = KWin::windowInfo( winId(), NET::WMState );
-  int w = info.state() & NET::MaxHoriz ? desk.width() + 1 : width();
-  int h = info.state() & NET::MaxVert ? desk.height() + 1 : height();
+  int w = info.state() & NET::MaxHoriz ? ( -1 ) : width();
+  int h = info.state() & NET::MaxVert ? ( -1 ) : height();
   QRect size( desk.width(), w, desk.height(), h );
 #else
   int w = 500;
@@ -859,8 +859,12 @@ void KMainWindow::restoreWindowSize( KCo
         // restore the size
         int scnum = QApplication::desktop()->screenNumber(parentWidget());
         QRect desk = QApplication::desktop()->screenGeometry(scnum);
-        QSize size( config->readNumEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 ),
-                    config->readNumEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 ) );
+        // Make sure we maximize in appropriate direction.
+        int sizeX = config->readNumEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 );
+        int sizeY = config->readNumEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 );
+        sizeX = ( sizeX==( -1 ) )?desk.width()+1:sizeX;
+        sizeY = ( sizeY==( -1 ) )?desk.height()+1:sizeY;
+        QSize size( sizeX, sizeY );
         if (size.isEmpty()) {
             // try the KDE 2.0 way
             size = QSize( config->readNumEntry( QString::fromLatin1("Width"), 0 ),


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

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