summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 6a473db..045bcb3 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1513,12 +1513,16 @@ void QWidgetPrivate::toggleDrawers(bool visible)
*****************************************************************************/
bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up)
{
+ // I'm not sure what "up" is
if(!w || !w->isWindow())
return false;
QTLWExtra *topData = w->d_func()->topData();
QWExtra *extraData = w->d_func()->extraData();
- topData->resizer += up;
+ // topData->resizer is only 4 bits, so subtracting -1 from zero causes bad stuff
+ // to happen, prevent that here (you really want the thing hidden).
+ if (up >= 0 || topData->resizer != 0)
+ topData->resizer += up;
OSWindowRef windowRef = qt_mac_window_for(OSViewRef(w->winId()));
{
#ifndef QT_MAC_USE_COCOA
@@ -1531,7 +1535,6 @@ bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up)
bool remove_grip = (topData->resizer || (w->windowFlags() & Qt::FramelessWindowHint)
|| (extraData->maxw && extraData->maxh &&
extraData->maxw == extraData->minw && extraData->maxh == extraData->minh));
-
#ifndef QT_MAC_USE_COCOA
WindowAttributes attr;
GetWindowAttributes(windowRef, &attr);
@@ -2132,11 +2135,10 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin
if ((popup || type == Qt::Tool || type == Qt::ToolTip) && !q->isModal()) {
[windowRef setHidesOnDeactivate:YES];
- [windowRef setHasShadow:YES];
} else {
[windowRef setHidesOnDeactivate:NO];
}
-
+ [windowRef setHasShadow:YES];
Q_UNUSED(parentWidget);
Q_UNUSED(dialog);
@@ -2691,10 +2693,15 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
createWinId();
if (q->isWindow()) {
#ifndef QT_MAC_USE_COCOA
- if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
- mwl->updateHIToolBarStatus();
+ // We do this down below for wasCreated, so avoid doing this twice
+ // (only for performance, it gets called a lot anyway).
+ if (!wasCreated) {
+ if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ mwl->updateHIToolBarStatus();
+ }
}
#else
+ // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon.
if (oldToolbar && !(f & Qt::FramelessWindowHint)) {
OSWindowRef newWindow = qt_mac_window_for(q);
[newWindow setToolbar:oldToolbar];
@@ -2709,6 +2716,16 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (wasCreated) {
transferChildren();
+#ifndef QT_MAC_USE_COCOA
+ // If we were a unified window, We just transfered our toolbars out of the unified toolbar.
+ // So redo the status one more time. It apparently is not an issue with Cocoa.
+ if (q->isWindow()) {
+ if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ mwl->updateHIToolBarStatus();
+ }
+ }
+#endif
+
if (topData &&
(!topData->caption.isEmpty() || !topData->filePath.isEmpty()))
setWindowTitle_helper(q->windowTitle());
@@ -4012,6 +4029,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
setGeometry_sys_helper(x, y, w, h, isMove);
}
#else
+ QSize olds = q->size();
+ const bool isResize = (olds != QSize(w, h));
NSWindow *window = qt_mac_window_for(q);
const QRect &fStrut = frameStrut();
const QRect frameRect(QPoint(x - fStrut.left(), y - fStrut.top()),
@@ -4019,7 +4038,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
fStrut.top() + fStrut.bottom() + h));
NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1),
frameRect.width(), frameRect.height());
-
+ // The setFrame call will trigger a 'windowDidResize' notification for the corresponding
+ // NSWindow. The pending flag is set, so that the resize event can be send as non-spontaneous.
+ if (isResize)
+ q->setAttribute(Qt::WA_PendingResizeEvent);
QPoint currTopLeft = data.crect.topLeft();
if (currTopLeft.x() == x && currTopLeft.y() == y
&& cocoaFrameRect.size.width != 0