[PATCH] adjust window rectangle
Michal Mecinski <[email protected]>
| Newsgroups | gmane.comp.kde.devel.cygwin |
|---|---|
| Message-ID | <[email protected]> |
The minimum size of dialog windows is too small. The reason is that the window's border and title bar is not taken into account when determining the minimum (and maximum) size of windows. This patch fixes this bug by making the following changes: * Change the WM_GETMINMAXINFO message handler in qapplication_win.cpp to call AdjustWindowRect() * Change QWidget::create() in qwidget_win.cpp to pass all style flags to AdjustWindowRect() -- Regards, Michal _______________________________________________ kde-cygwin mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-cygwin
adjustwindowrect.patch
(text/plain, 3 KB)
Index: src/kernel/qapplication_win.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qapplication_win.cpp,v
retrieving revision 1.1.2.30.2.62
diff -u -p -r1.1.2.30.2.62 qapplication_win.cpp
--- src/kernel/qapplication_win.cpp 29 Apr 2005 13:29:11 -0000 1.1.2.30.2.62
+++ src/kernel/qapplication_win.cpp 5 May 2005 18:19:13 -0000
@@ -3592,10 +3592,27 @@ static LRESULT CALLBACK qt_window_proced
if ( widget ) {
QSize minSize = widget->minimumSize ();
QSize maxSize = widget->maximumSize ();
- minMaxInfo->ptMaxTrackSize.x = maxSize.width();
- minMaxInfo->ptMaxTrackSize.y = maxSize.height();
- minMaxInfo->ptMinTrackSize.x = minSize.width();
- minMaxInfo->ptMinTrackSize.y = minSize.height();
+ DWORD dwStyle = QT_WA_INLINE(
+ GetWindowLongW( widget->winId(), GWL_STYLE ),
+ GetWindowLongA( widget->winId(), GWL_STYLE ) );
+ DWORD dwExtStyle = QT_WA_INLINE(
+ GetWindowLongW( widget->winId(), GWL_EXSTYLE ),
+ GetWindowLongA( widget->winId(), GWL_EXSTYLE ) );
+ RECT rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = minSize.width();
+ rect.bottom = minSize.height();
+ AdjustWindowRectEx( &rect, dwStyle, FALSE, dwExtStyle );
+ minMaxInfo->ptMinTrackSize.x = rect.right - rect.left;
+ minMaxInfo->ptMinTrackSize.y = rect.bottom - rect.top;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = maxSize.width();
+ rect.bottom = maxSize.height();
+ AdjustWindowRectEx( &rect, dwStyle, FALSE, dwExtStyle );
+ minMaxInfo->ptMaxTrackSize.x = rect.right - rect.left;
+ minMaxInfo->ptMaxTrackSize.y = rect.bottom - rect.top;
}
return 0;
}
Index: src/kernel/qwidget_win.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qwidget_win.cpp,v
retrieving revision 1.1.2.15.2.36
diff -u -p -r1.1.2.15.2.36 qwidget_win.cpp
--- src/kernel/qwidget_win.cpp 23 Apr 2005 15:28:00 -0000 1.1.2.15.2.36
+++ src/kernel/qwidget_win.cpp 5 May 2005 18:19:29 -0000
@@ -259,8 +259,7 @@ void QWidget::create( WId window, bool i
qDebug ( "QWidget::create window Rect before AdjustRect: %ld, %ld - %ld,%ld", rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom );
#endif
- if ( isTopLevel() && !isPopup() && !testWFlags( WStyle_NoBorder ) )
- AdjustWindowRect( &rcWnd, WS_CAPTION, FALSE );
+ AdjustWindowRectEx( &rcWnd, dwStyle, FALSE, dwExtStyle );
#ifdef DEBUG_QWIDGET
qDebug ( "QWidget::create window Rect after AdjustRect: %ld, %ld - %ld,%ld", rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom );