Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qcocoawindowdelegate_mac.mm

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    203203                                                   & ~Qt::WindowMaximized));
    204204        qt_sendSpontaneousEvent(qwidget, &e);
     205    } else {
     206        widgetData->window_state = widgetData->window_state & ~Qt::WindowMaximized;
     207        QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
     208                                                   | Qt::WindowMaximized));
     209        qt_sendSpontaneousEvent(qwidget, &e);
    205210    }
    206211    NSRect rect = [[window contentView] frame];
     
    270275    QWidget *qwidget = m_windowHash->value([notification object]);
    271276    Q_ASSERT(qwidget);
    272     if (qwidget->isActiveWindow())
    273         return;  // Widget is already active, no need to go through re-activation.
    274 
    275277    onApplicationWindowChangedActivation(qwidget, true);
    276278}
     
    289291    QWidget *qwidget = m_windowHash->value([notification object]);
    290292    Q_ASSERT(qwidget);
    291     if (qwidget->isActiveWindow())
    292         return;  // Widget is already active, no need to go through re-activation
    293 
    294 
    295293    onApplicationWindowChangedActivation(qwidget, true);
    296294}
     
    313311    // saving the current window geometry before the window is maximized
    314312    QWidget *qwidget = m_windowHash->value(window);
    315     if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) {
    316         QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
    317         widgetPrivate->topData()->normalGeometry = qwidget->geometry();
     313    QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
     314    if (qwidget->isWindow()) {
     315        if(qwidget->windowState() & Qt::WindowMaximized) {
     316            // Restoring
     317            widgetPrivate->topData()->wasMaximized = false;
     318        } else {
     319            // Maximizing
     320            widgetPrivate->topData()->normalGeometry = qwidget->geometry();
     321            // If the window was maximized we need to update the coordinates since now it will start at 0,0.
     322            // We do this in a special field that is only used when not restoring but manually resizing the window.
     323            // Since the coordinates are fixed we just set a boolean flag.
     324            widgetPrivate->topData()->wasMaximized = true;
     325        }
    318326    }
    319327    return YES;
     
    387395    return NO;
    388396}
     397
     398- (void)syncContentViewFrame: (NSNotification *)notification
     399{
     400    NSView *cView = [notification object];
     401    if (cView) {
     402        NSWindow *window = [cView window];
     403        QWidget *qwidget = m_windowHash->value(window);
     404        if (qwidget) {
     405            QWidgetData *widgetData = qt_qwidget_data(qwidget);
     406            NSRect rect = [cView frame];
     407            const QSize newSize(rect.size.width, rect.size.height);
     408            const QSize &oldSize = widgetData->crect.size();
     409            if (newSize != oldSize) {
     410                [self syncSizeForWidget:qwidget toSize:newSize fromSize:oldSize];
     411            }
     412        }
     413
     414    }
     415}
     416
    389417@end
    390418#endif// QT_MAC_USE_COCOA
Note: See TracChangeset for help on using the changeset viewer.