summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoawindowdelegate_mac.mm
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:11:55 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:11:55 (GMT)
commitf5ac9ac1387fb9aac7c74d686f0b247ac50746e1 (patch)
tree8efb9b6c1029f8b9c26b96fa5389b1b0623c5163 /src/gui/kernel/qcocoawindowdelegate_mac.mm
parentcb369071fa9b15e68f91d2883ee29f12c58fc803 (diff)
parentbc184432c49eb56254bc5db07c6af03718c6b0e7 (diff)
downloadQt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.zip
Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.gz
Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Diffstat (limited to 'src/gui/kernel/qcocoawindowdelegate_mac.mm')
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 03b2fce..fa325f4 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -194,7 +194,6 @@ static void cleanupCocoaWindowDelegate()
{
NSWindow *window = [notification object];
QWidget *qwidget = m_windowHash->value(window);
- // Just here to handle the is zoomed method.
QWidgetData *widgetData = qt_qwidget_data(qwidget);
if (!(qwidget->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) && [window isZoomed]) {
widgetData->window_state = widgetData->window_state | Qt::WindowMaximized;
@@ -202,7 +201,6 @@ static void cleanupCocoaWindowDelegate()
& ~Qt::WindowMaximized));
qt_sendSpontaneousEvent(qwidget, &e);
}
- [self checkForMove:[window frame] forWidget:qwidget];
NSRect rect = [[window contentView] frame];
const QSize newSize(rect.size.width, rect.size.height);
const QSize &oldSize = widgetData->crect.size();
@@ -212,12 +210,18 @@ static void cleanupCocoaWindowDelegate()
}
}
-- (void)checkForMove:(const NSRect &)newRect forWidget:(QWidget *)qwidget
+- (void)windowDidMove:(NSNotification *)notification
{
- // newRect's origin is bottom left.
+ // The code underneath needs to translate the window location
+ // from bottom left (which is the origin used by Cocoa) to
+ // upper left (which is the origin used by Qt):
+ NSWindow *window = [notification object];
+ NSRect newRect = [window frame];
+ QWidget *qwidget = m_windowHash->value(window);
QPoint qtPoint = flipPoint(NSMakePoint(newRect.origin.x,
newRect.origin.y + newRect.size.height)).toPoint();
const QRect &oldRect = qwidget->frameGeometry();
+
if (qtPoint.x() != oldRect.x() || qtPoint.y() != oldRect.y()) {
QWidgetData *widgetData = qt_qwidget_data(qwidget);
QRect oldCRect = widgetData->crect;
@@ -233,11 +237,6 @@ static void cleanupCocoaWindowDelegate()
}
}
-- (void)windowDidMove:(NSNotification *)notification
-{
- [self windowDidResize:notification];
-}
-
-(BOOL)windowShouldClose:(id)windowThatWantsToClose
{
QWidget *qwidget = m_windowHash->value(windowThatWantsToClose);