Changeset 561 for trunk/src/gui/kernel/qcocoaview_mac.mm
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/kernel/qcocoaview_mac.mm
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 50 50 #include <private/qdnd_p.h> 51 51 #include <private/qmacinputcontext_p.h> 52 #include <private/qmultitouch_mac_p.h> 53 #include <private/qevent_p.h> 54 #include <private/qbackingstore_p.h> 52 55 53 56 #include <qscrollarea.h> … … 62 65 #include <qdebug.h> 63 66 67 @interface NSEvent (Qt_Compile_Leopard_DeviceDelta) 68 - (CGFloat)deviceDeltaX; 69 - (CGFloat)deviceDeltaY; 70 - (CGFloat)deviceDeltaZ; 71 @end 72 73 @interface NSEvent (Qt_Compile_Leopard_Gestures) 74 - (CGFloat)magnification; 75 @end 64 76 65 77 QT_BEGIN_NAMESPACE … … 72 84 extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp 73 85 extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm 86 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp 74 87 75 88 Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) … … 101 114 { NSDragOperationGeneric, Qt::CopyAction, false }, 102 115 { NSDragOperationEvery, Qt::ActionMask, false }, 103 { NSDragOperationNone, Qt::IgnoreAction, false } 116 { NSDragOperationNone, Qt::IgnoreAction, false } 104 117 }; 105 118 … … 182 195 QT_FORWARD_DECLARE_CLASS(QPainter) 183 196 QT_FORWARD_DECLARE_CLASS(QHoverEvent) 197 QT_FORWARD_DECLARE_CLASS(QCursor) 184 198 QT_USE_NAMESPACE 185 199 extern "C" { … … 196 210 [self finishInitWithQWidget:widget widgetPrivate:widgetprivate]; 197 211 } 212 composingText = new QString(); 198 213 composing = false; 199 214 sendKeyEvents = true; 215 currentCustomTypes = 0; 200 216 [self setHidden:YES]; 201 217 return self; … … 212 228 } 213 229 214 -(void)registerDragTypes :(bool)accept230 -(void)registerDragTypes 215 231 { 216 232 QMacCocoaAutoReleasePool pool; 217 if (accept) { 233 // Calling registerForDraggedTypes is slow, so only do it once for each widget 234 // or when the custom types change. 235 const QStringList& customTypes = qEnabledDraggedTypes(); 236 if (currentCustomTypes == 0 || *currentCustomTypes != customTypes) { 237 if (currentCustomTypes == 0) 238 currentCustomTypes = new QStringList(); 239 *currentCustomTypes = customTypes; 218 240 const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; 219 NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, 220 NSFilenamesPboardType, NSStringPboardType, 221 NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, 222 NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, 223 NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, 224 NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, 241 NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, 242 NSFilenamesPboardType, NSStringPboardType, 243 NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, 244 NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, 245 NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, 246 NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, 225 247 NSURLPboardType, NSPDFPboardType, NSVCardPboardType, 226 NSFilesPromisePboardType, NSInkTextPboardType, 248 NSFilesPromisePboardType, NSInkTextPboardType, 227 249 NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; 228 250 // Add custom types supported by the application. 229 const QStringList& customTypes = qEnabledDraggedTypes();230 251 for (int i = 0; i < customTypes.size(); i++) { 231 252 [supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))]; 232 253 } 233 254 [self registerForDraggedTypes:supportedTypes]; 255 } 256 } 257 258 - (void)resetCursorRects 259 { 260 QWidget *cursorWidget = qwidget; 261 262 if (cursorWidget->testAttribute(Qt::WA_TransparentForMouseEvents)) 263 cursorWidget = QApplication::widgetAt(qwidget->mapToGlobal(qwidget->rect().center())); 264 265 if (cursorWidget == 0) 266 return; 267 268 if (!cursorWidget->testAttribute(Qt::WA_SetCursor)) { 269 [super resetCursorRects]; 270 return; 271 } 272 273 QRegion mask = qt_widget_private(cursorWidget)->extra->mask; 274 NSCursor *nscursor = static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursorWidget->cursor())); 275 if (mask.isEmpty()) { 276 [self addCursorRect:[qt_mac_nativeview_for(cursorWidget) visibleRect] cursor:nscursor]; 234 277 } else { 235 [self unregisterDraggedTypes]; 278 const QVector<QRect> &rects = mask.rects(); 279 for (int i = 0; i < rects.size(); ++i) { 280 const QRect &rect = rects.at(i); 281 [self addCursorRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()) cursor:nscursor]; 282 } 236 283 } 237 284 } … … 244 291 } 245 292 } 246 247 - (void)addDropData:(id <NSDraggingInfo>)sender 293 294 - (void)addDropData:(id <NSDraggingInfo>)sender 248 295 { 249 296 [self removeDropData]; 250 CFStringRef dropPasteboard = (CFStringRef) [[sender draggingPasteboard] name]; 297 CFStringRef dropPasteboard = (CFStringRef) [[sender draggingPasteboard] name]; 251 298 dropData = new QCocoaDropData(dropPasteboard); 252 } 253 254 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender 255 { 299 } 300 301 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender 302 { 303 if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) 304 return NSDragOperationNone; 305 NSPoint windowPoint = [sender draggingLocation]; 306 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { 307 // pass the drag enter event to the view underneath. 308 NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; 309 if (candidateView && candidateView != self) 310 return [candidateView draggingEntered:sender]; 311 } 312 dragEnterSequence = [sender draggingSequenceNumber]; 256 313 [self addDropData:sender]; 257 314 QMimeData *mimeData = dropData; 258 315 if (QDragManager::self()->source()) 259 316 mimeData = QDragManager::self()->dragPrivate()->data; 260 NSPoint windowPoint = [sender draggingLocation];261 317 NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; 262 318 NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; 263 319 QPoint posDrag(localPoint.x, localPoint.y); 264 NSDragOperation nsActions = [sender draggingSourceOperationMask]; 320 NSDragOperation nsActions = [sender draggingSourceOperationMask]; 265 321 Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions); 322 QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; 323 Qt::KeyboardModifiers modifiers = Qt::NoModifier; 324 if ([sender draggingSource] != nil) { 325 // modifier flags might have changed, update it here since we don't send any input events. 326 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]); 327 modifiers = QApplication::keyboardModifiers(); 328 } else { 329 // when the source is from another application the above technique will not work. 330 modifiers = qt_cocoaDragOperation2QtModifiers(nsActions); 331 } 266 332 // send the drag enter event to the widget. 267 QDragEnterEvent qDEEvent(posDrag, qtAllowed, mimeData, 268 QApplication::mouseButtons(), QApplication::keyboardModifiers()); 333 QDragEnterEvent qDEEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); 269 334 QApplication::sendEvent(qwidget, &qDEEvent); 270 335 if (!qDEEvent.isAccepted()) { … … 273 338 return NSDragOperationNone; 274 339 } else { 340 // save the mouse position, used by draggingExited handler. 341 DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; 342 dndParams->activeDragEnterPos = windowPoint; 275 343 // send a drag move event immediately after a drag enter event (as per documentation). 276 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, 277 QApplication::mouseButtons(), QApplication::keyboardModifiers()); 344 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); 278 345 qDMEvent.setDropAction(qDEEvent.dropAction()); 279 346 qDMEvent.accept(); // accept by default, since enter event was accepted. 280 347 QApplication::sendEvent(qwidget, &qDMEvent); 281 348 if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { 282 // since we accepted the drag enter event, the widget expects 283 // future drage move events. 284 // ### check if we need to treat this like the drag enter event. 285 nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction()); 349 // since we accepted the drag enter event, the widget expects 350 // future drage move events. 351 // ### check if we need to treat this like the drag enter event. 352 nsActions = NSDragOperationNone; 353 // Save as ignored in the answer rect. 354 qDMEvent.setDropAction(Qt::IgnoreAction); 286 355 } else { 287 356 nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction()); 288 357 } 289 358 QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent); 290 291 } 359 return nsActions; 360 } 292 361 } 293 294 362 - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender 295 363 { 296 // drag enter event was rejected, so ignore the move event. 364 NSPoint windowPoint = [sender draggingLocation]; 365 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { 366 // pass the drag move event to the view underneath. 367 NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; 368 if (candidateView && candidateView != self) 369 return [candidateView draggingUpdated:sender]; 370 } 371 // in cases like QFocusFrame, the view under the mouse might 372 // not have received the drag enter. Generate a synthetic 373 // drag enter event for that view. 374 if (dragEnterSequence != [sender draggingSequenceNumber]) 375 [self draggingEntered:sender]; 376 // drag enter event was rejected, so ignore the move event. 297 377 if (dropData == 0) 298 378 return NSDragOperationNone; 299 379 // return last value, if we are still in the answerRect. 300 NSPoint windowPoint = [sender draggingLocation];301 380 NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; 302 381 NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; … … 306 385 && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) 307 386 return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction)); 308 // send drag move event to the widget 387 // send drag move event to the widget 309 388 QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; 310 389 Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions); 390 Qt::KeyboardModifiers modifiers = Qt::NoModifier; 391 if ([sender draggingSource] != nil) { 392 // modifier flags might have changed, update it here since we don't send any input events. 393 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]); 394 modifiers = QApplication::keyboardModifiers(); 395 } else { 396 // when the source is from another application the above technique will not work. 397 modifiers = qt_cocoaDragOperation2QtModifiers(nsActions); 398 } 311 399 QMimeData *mimeData = dropData; 312 400 if (QDragManager::self()->source()) 313 401 mimeData = QDragManager::self()->dragPrivate()->data; 314 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, 315 QApplication::mouseButtons(), QApplication::keyboardModifiers()); 402 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); 316 403 qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction); 317 404 qDMEvent.accept(); 318 405 QApplication::sendEvent(qwidget, &qDMEvent); 319 qt_mac_copy_answer_rect(qDMEvent);320 406 321 407 NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction()); … … 323 409 // ignore this event (we will still receive further notifications) 324 410 operation = NSDragOperationNone; 325 } 411 // Save as ignored in the answer rect. 412 qDMEvent.setDropAction(Qt::IgnoreAction); 413 } 414 qt_mac_copy_answer_rect(qDMEvent); 326 415 return operation; 327 416 } … … 329 418 - (void)draggingExited:(id < NSDraggingInfo >)sender 330 419 { 331 Q_UNUSED(sender) 332 // drag enter event was rejected, so ignore the move event. 420 dragEnterSequence = -1; 421 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { 422 // try sending the leave event to the last view which accepted drag enter. 423 DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; 424 NSView *candidateView = [[[self window] contentView] hitTest:dndParams->activeDragEnterPos]; 425 if (candidateView && candidateView != self) 426 return [candidateView draggingExited:sender]; 427 } 428 // drag enter event was rejected, so ignore the move event. 333 429 if (dropData) { 334 430 QDragLeaveEvent de; … … 336 432 [self removeDropData]; 337 433 } 338 339 434 } 340 435 341 436 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 342 437 { 438 NSPoint windowPoint = [sender draggingLocation]; 439 dragEnterSequence = -1; 440 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { 441 // pass the drop event to the view underneath. 442 NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; 443 if (candidateView && candidateView != self) 444 return [candidateView performDragOperation:sender]; 445 } 343 446 [self addDropData:sender]; 344 345 NSPoint windowPoint = [sender draggingLocation]; 447 346 448 NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; 347 449 NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; 348 450 QPoint posDrop(localPoint.x, localPoint.y); 349 350 NSDragOperation nsActions = [sender draggingSourceOperationMask]; 451 452 NSDragOperation nsActions = [sender draggingSourceOperationMask]; 351 453 Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions); 352 454 QMimeData *mimeData = dropData; … … 359 461 QDragManager::self()->dragPrivate()->target = qwidget; 360 462 QApplication::sendEvent(qwidget, &de); 463 if (QDragManager::self()->object) 464 QDragManager::self()->dragPrivate()->executed_action = de.dropAction(); 361 465 if (!de.isAccepted()) 362 466 return NO; … … 367 471 - (void)dealloc 368 472 { 473 delete composingText; 369 474 [[NSNotificationCenter defaultCenter] removeObserver:self]; 475 delete currentCustomTypes; 476 [self unregisterDraggedTypes]; 370 477 [super dealloc]; 371 478 } … … 389 496 { 390 497 [super setFrameSize:newSize]; 391 498 392 499 // A change in size has required the view to be invalidated. 393 if ([self inLiveResize]) 394 { 500 if ([self inLiveResize]) { 395 501 NSRect rects[4]; 396 502 NSInteger count; … … 400 506 [self setNeedsDisplayInRect:rects[count]]; 401 507 } 402 } 403 else 404 { 508 } else { 405 509 [self setNeedsDisplay:YES]; 406 510 } … … 409 513 - (void)drawRect:(NSRect)aRect 410 514 { 515 if (QApplicationPrivate::graphicsSystem() != 0) { 516 if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) 517 bs->markDirty(qwidget->rect(), qwidget); 518 qwidgetprivate->syncBackingStore(qwidget->rect()); 519 return; 520 } 411 521 CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 412 522 qwidgetprivate->hd = cg; … … 462 572 #endif 463 573 QPainter p(qwidget); 464 QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(qwidget->parent()); 465 QPoint scrollAreaOffset; 466 if (scrollArea && scrollArea->viewport() == qwidget) { 467 QAbstractScrollAreaPrivate *priv 468 = static_cast<QAbstractScrollAreaPrivate *>(qt_widget_private(scrollArea)); 469 scrollAreaOffset = priv->contentsOffset(); 470 p.translate(-scrollAreaOffset); 471 } 472 qwidgetprivate->paintBackground(&p, qrgn, scrollAreaOffset, 574 qwidgetprivate->paintBackground(&p, qrgn, 473 575 qwidget->isWindow() ? QWidgetPrivate::DrawAsRoot : 0); 474 576 p.end(); … … 481 583 if (!redirectionOffset.isNull()) 482 584 QPainter::restoreRedirected(qwidget); 483 #ifdef QT_RASTER_PAINTENGINE484 if(engine && engine->type() == QPaintEngine::Raster)485 static_cast<QRasterPaintEngine*>(engine)->flush(qwidget,486 qrgn.boundingRect().topLeft());487 #endif488 585 if (engine) 489 586 engine->setSystemClip(QRegion()); … … 503 600 } 504 601 602 - (NSView *)hitTest:(NSPoint)aPoint 603 { 604 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) 605 return nil; // You cannot hit a transparent for mouse event widget. 606 return [super hitTest:aPoint]; 607 } 608 505 609 - (void)updateTrackingAreas 506 610 { … … 513 617 } 514 618 } 619 620 // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should 621 // only be turned on if mouseTracking, hover is on or a tool tip is set. 622 // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to 623 // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of 624 // mouse moves delivered to it (Apple recommends keeping it OFF because there 625 // is a performance hit). So it goes. 515 626 NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp 516 | NSTrackingInVisibleRect; 517 if (qwidget->hasMouseTracking() || !qwidgetprivate->toolTip.isEmpty() 518 || qwidget->testAttribute(Qt::WA_Hover)) 519 trackingOptions |= NSTrackingMouseMoved; 627 | NSTrackingInVisibleRect | NSTrackingMouseMoved; 520 628 NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0, 521 629 qwidget->width(), … … 537 645 QApplication::sendEvent(qwidget, &enterEvent); 538 646 qt_mouseover = qwidget; 539 647 540 648 // Update cursor and dispatch hover events. 541 649 qt_mac_update_cursor_at_global_pos(flipPoint(globalPoint).toPoint()); … … 545 653 QApplicationPrivate::instance()->notify_helper(qwidget, &he); 546 654 } 547 } 655 } 548 656 } 549 657 … … 554 662 if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) { 555 663 QApplication::sendEvent(qwidget, &leaveEvent); 556 664 557 665 // ### Think about if it is necessary to update the cursor, should only be for a few cases. 558 666 qt_mac_update_cursor_at_global_pos(flipPoint(globalPoint).toPoint()); … … 579 687 - (void)mouseMoved:(NSEvent *)theEvent 580 688 { 581 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); 582 } 583 584 - (NSView *)viewUnderTransparentForMouseView:(NSView *)mouseView widget:(QWidget *)widgetToGetMouse 585 withWindowPoint:(NSPoint)windowPoint 586 { 587 NSMutableArray *viewsToLookAt = [NSMutableArray arrayWithCapacity:5]; 588 [viewsToLookAt addObject:mouseView]; 589 QWidget *parentWidget = widgetToGetMouse->parentWidget(); 590 while (parentWidget) { 591 [viewsToLookAt addObject:qt_mac_nativeview_for(parentWidget)]; 592 parentWidget = parentWidget->parentWidget(); 593 } 594 595 // Now walk through the subviews of each view and determine which subview should 596 // get the event. We look through all the subviews at a given level with 597 // the assumption that the last item to be found the candidate has a higher z-order. 598 // Unfortunately, fast enumeration doesn't go backwards in 10.5, so assume go fast 599 // forward is quicker than the slow normal way backwards. 600 NSView *candidateView = nil; 601 for (NSView *lookView in viewsToLookAt) { 602 NSPoint tmpPoint = [lookView convertPoint:windowPoint fromView:nil]; 603 for (NSView *view in [lookView subviews]) { 604 if (view == mouseView) 605 continue; 606 NSRect frameRect = [view frame]; 607 if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) 608 candidateView = view; 609 } 610 if (candidateView) 611 break; 612 } 613 614 615 if (candidateView != nil) { 616 // Now that we've got a candidate, we have to dig into it's tree and see where it is. 617 NSView *lowerView = nil; 618 NSView *viewForDescent = candidateView; 619 while (viewForDescent) { 620 NSPoint tmpPoint = [viewForDescent convertPoint:windowPoint fromView:nil]; 621 // Apply same rule as above wrt z-order. 622 for (NSView *view in [viewForDescent subviews]) { 623 if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) 624 lowerView = view; 625 } 626 if (!lowerView) // Low as we can be at this point. 627 candidateView = viewForDescent; 628 629 // Try to go deeper, will also exit out of the loop, if we found the point. 630 viewForDescent = lowerView; 631 lowerView = nil; 632 } 633 } 634 // I am transparent, so I can't be a candidate. 635 if (candidateView == mouseView) 636 candidateView = nil; 637 return candidateView; 689 // We always enable mouse tracking for all QCocoaView-s. In cases where we have 690 // child views, we will receive mouseMoved for both parent & the child (if 691 // mouse is over the child). We need to ignore the parent mouseMoved in such 692 // cases. 693 NSPoint windowPoint = [theEvent locationInWindow]; 694 NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; 695 if (candidateView && candidateView == self) { 696 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); 697 } 638 698 } 639 699 640 700 - (void)mouseDown:(NSEvent *)theEvent 641 701 { 702 if (!qt_button_down) 703 qt_button_down = qwidget; 704 642 705 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton); 643 706 // Don't call super here. This prevents us from getting the mouseUp event, 644 // which we need to send even if the mouseDown event was not accepted. 707 // which we need to send even if the mouseDown event was not accepted. 645 708 // (this is standard Qt behavior.) 646 709 } … … 649 712 - (void)mouseUp:(NSEvent *)theEvent 650 713 { 651 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); 652 653 if (!mouseOK) 654 [super mouseUp:theEvent]; 714 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); 715 716 qt_button_down = 0; 655 717 } 656 718 657 719 - (void)rightMouseDown:(NSEvent *)theEvent 658 { 659 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);660 661 if (!mouseOK) 662 [super rightMouseDown:theEvent];720 { 721 if (!qt_button_down) 722 qt_button_down = qwidget; 723 724 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton); 663 725 } 664 726 665 727 - (void)rightMouseUp:(NSEvent *)theEvent 666 728 { 667 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); 668 669 if (!mouseOK) 670 [super rightMouseUp:theEvent]; 729 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); 730 731 qt_button_down = 0; 671 732 } 672 733 673 734 - (void)otherMouseDown:(NSEvent *)theEvent 674 735 { 736 if (!qt_button_down) 737 qt_button_down = qwidget; 738 675 739 Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); 676 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); 677 678 if (!mouseOK) 679 [super otherMouseDown:theEvent]; 740 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); 680 741 } 681 742 … … 683 744 { 684 745 Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); 685 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); 686 687 if (!mouseOK) 688 [super otherMouseUp:theEvent]; 689 746 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); 747 748 qt_button_down = 0; 690 749 } 691 750 … … 694 753 qMacDnDParams()->view = self; 695 754 qMacDnDParams()->theEvent = theEvent; 696 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::LeftButton); 697 698 if (!mouseOK) 699 [super mouseDragged:theEvent]; 755 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); 700 756 } 701 757 … … 704 760 qMacDnDParams()->view = self; 705 761 qMacDnDParams()->theEvent = theEvent; 706 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::RightButton); 707 708 if (!mouseOK) 709 [super rightMouseDragged:theEvent]; 762 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); 710 763 } 711 764 … … 714 767 qMacDnDParams()->view = self; 715 768 qMacDnDParams()->theEvent = theEvent; 716 Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); 717 bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, mouseButton); 718 719 if (!mouseOK) 720 [super otherMouseDragged:theEvent]; 769 qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); 721 770 } 722 771 … … 728 777 [currentIManager handleMouseEvent:theEvent]; 729 778 } 730 779 731 780 NSPoint windowPoint = [theEvent locationInWindow]; 732 781 NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint]; 733 782 NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; 734 783 QPoint qlocal = QPoint(localPoint.x, localPoint.y); 735 QPoint qglobal = QPoint(globalPoint.x, globalPoint.y);736 Qt::MouseButton buttons = cocoaButton2QtButton([theEvent buttonNumber]);784 QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y)); 785 Qt::MouseButtons buttons = QApplication::mouseButtons(); 737 786 bool wheelOK = false; 738 787 Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]); 739 740 // Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets 741 // expect the delta to be a multiple of 120. 742 const int ScrollFactor = 10 * 120; 743 // The qMax(...) factor reduces the 744 // acceleration for large wheel deltas. 745 int deltaX = [theEvent deltaX] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaX])); 746 int deltaY = [theEvent deltaY] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaY])); 747 int deltaZ = [theEvent deltaZ] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaZ])); 788 QWidget *widgetToGetMouse = qwidget; 789 // if popup is open it should get wheel events if the cursor is over the popup, 790 // otherwise the event should be ignored. 791 if (QWidget *popup = qAppInstance()->activePopupWidget()) { 792 if (!popup->geometry().contains(qglobal)) 793 return; 794 } 795 796 int deltaX = 0; 797 int deltaY = 0; 798 int deltaZ = 0; 799 800 const EventRef carbonEvent = (EventRef)[theEvent eventRef]; 801 const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0; 802 const bool scrollEvent = carbonEventKind == kEventMouseScroll; 803 804 if (scrollEvent) { 805 // The mouse device containts pixel scroll wheel support (Mighty Mouse, Trackpad). 806 // Since deviceDelta is delivered as pixels rather than degrees, we need to 807 // convert from pixels to degrees in a sensible manner. 808 // It looks like four degrees per pixel behaves most native. 809 // Qt expects the unit for delta to be 1/8 of a degree: 810 deltaX = [theEvent deviceDeltaX]; 811 deltaY = [theEvent deviceDeltaY]; 812 deltaZ = [theEvent deviceDeltaZ]; 813 } else { 814 // carbonEventKind == kEventMouseWheelMoved 815 // Remove acceleration, and use either -120 or 120 as delta: 816 deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120); 817 deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120); 818 deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120); 819 } 748 820 749 821 if (deltaX != 0) { 750 822 QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal); 751 qt_sendSpontaneousEvent( qwidget, &qwe);823 qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); 752 824 wheelOK = qwe.isAccepted(); 753 825 if (!wheelOK && QApplicationPrivate::focus_widget 754 && QApplicationPrivate::focus_widget != qwidget) {826 && QApplicationPrivate::focus_widget != widgetToGetMouse) { 755 827 QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, 756 828 deltaX, buttons, keyMods, Qt::Horizontal); … … 759 831 } 760 832 } 761 833 762 834 if (deltaY) { 763 835 QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical); 764 qt_sendSpontaneousEvent( qwidget, &qwe);836 qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); 765 837 wheelOK = qwe.isAccepted(); 766 if ( wheelOK && QApplicationPrivate::focus_widget767 && QApplicationPrivate::focus_widget != qwidget) {838 if (!wheelOK && QApplicationPrivate::focus_widget 839 && QApplicationPrivate::focus_widget != widgetToGetMouse) { 768 840 QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, 769 delta Z, buttons, keyMods, Qt::Vertical);841 deltaY, buttons, keyMods, Qt::Vertical); 770 842 qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2); 771 843 wheelOK = qwe2.isAccepted(); 772 844 } 773 845 } 774 846 775 847 if (deltaZ) { 776 848 // Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to 777 849 // try to be ahead of the pack, I'm adding this extra value. 778 850 QWheelEvent qwe(qlocal, qglobal, deltaZ, buttons, keyMods, (Qt::Orientation)3); 779 qt_sendSpontaneousEvent( qwidget, &qwe);851 qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); 780 852 wheelOK = qwe.isAccepted(); 781 853 if (!wheelOK && QApplicationPrivate::focus_widget 782 && QApplicationPrivate::focus_widget != qwidget) {854 && QApplicationPrivate::focus_widget != widgetToGetMouse) { 783 855 QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, 784 856 deltaZ, buttons, keyMods, (Qt::Orientation)3); … … 801 873 if (!qt_mac_handleTabletEvent(self, tabletEvent)) 802 874 [super tabletPoint:tabletEvent]; 875 } 876 877 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 878 - (void)touchesBeganWithEvent:(NSEvent *)event; 879 { 880 bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); 881 qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); 882 } 883 884 - (void)touchesMovedWithEvent:(NSEvent *)event; 885 { 886 bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); 887 qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); 888 } 889 890 - (void)touchesEndedWithEvent:(NSEvent *)event; 891 { 892 bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); 893 qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); 894 } 895 896 - (void)touchesCancelledWithEvent:(NSEvent *)event; 897 { 898 bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); 899 qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); 900 } 901 #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 902 903 - (void)magnifyWithEvent:(NSEvent *)event; 904 { 905 if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) 906 return; 907 908 QNativeGestureEvent qNGEvent; 909 qNGEvent.gestureType = QNativeGestureEvent::Zoom; 910 NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; 911 qNGEvent.position = flipPoint(p).toPoint(); 912 qNGEvent.percentage = [event magnification]; 913 qt_sendSpontaneousEvent(qwidget, &qNGEvent); 914 } 915 916 - (void)rotateWithEvent:(NSEvent *)event; 917 { 918 if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) 919 return; 920 921 QNativeGestureEvent qNGEvent; 922 qNGEvent.gestureType = QNativeGestureEvent::Rotate; 923 NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; 924 qNGEvent.position = flipPoint(p).toPoint(); 925 qNGEvent.percentage = -[event rotation]; 926 qt_sendSpontaneousEvent(qwidget, &qNGEvent); 927 } 928 929 - (void)swipeWithEvent:(NSEvent *)event; 930 { 931 if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) 932 return; 933 934 QNativeGestureEvent qNGEvent; 935 qNGEvent.gestureType = QNativeGestureEvent::Swipe; 936 NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; 937 qNGEvent.position = flipPoint(p).toPoint(); 938 if ([event deltaX] == 1) 939 qNGEvent.angle = 180.0f; 940 else if ([event deltaX] == -1) 941 qNGEvent.angle = 0.0f; 942 else if ([event deltaY] == 1) 943 qNGEvent.angle = 90.0f; 944 else if ([event deltaY] == -1) 945 qNGEvent.angle = 270.0f; 946 qt_sendSpontaneousEvent(qwidget, &qNGEvent); 947 } 948 949 - (void)beginGestureWithEvent:(NSEvent *)event; 950 { 951 if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) 952 return; 953 954 QNativeGestureEvent qNGEvent; 955 qNGEvent.gestureType = QNativeGestureEvent::GestureBegin; 956 NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; 957 qNGEvent.position = flipPoint(p).toPoint(); 958 qt_sendSpontaneousEvent(qwidget, &qNGEvent); 959 } 960 961 - (void)endGestureWithEvent:(NSEvent *)event; 962 { 963 if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) 964 return; 965 966 QNativeGestureEvent qNGEvent; 967 qNGEvent.gestureType = QNativeGestureEvent::GestureEnd; 968 NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; 969 qNGEvent.position = flipPoint(p).toPoint(); 970 qt_sendSpontaneousEvent(qwidget, &qNGEvent); 803 971 } 804 972 … … 845 1013 } 846 1014 1015 - (BOOL)resignFirstResponder 1016 { 1017 // Seems like the following test only triggers if this 1018 // view is inside a QMacNativeWidget: 1019 if (qwidget == QApplication::focusWidget()) 1020 QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); 1021 return YES; 1022 } 1023 847 1024 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal 848 1025 { … … 861 1038 Q_UNUSED(aPoint); 862 1039 qMacDnDParams()->performedAction = operation; 1040 if (QDragManager::self()->object 1041 && QDragManager::self()->dragPrivate()->executed_action != Qt::ActionMask) { 1042 qMacDnDParams()->performedAction = 1043 qt_mac_mapDropAction(QDragManager::self()->dragPrivate()->executed_action); 1044 } 863 1045 } 864 1046 … … 896 1078 } 897 1079 898 if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) { 1080 if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled) 1081 && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly 1082 || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly 1083 || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) { 899 1084 [qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]]; 900 1085 } … … 941 1126 - (void) insertText:(id)aString 942 1127 { 943 if (composing) { 944 // Send the commit string to the widget. 945 QString commitText; 1128 QString commitText; 1129 if ([aString length]) { 946 1130 if ([aString isKindOfClass:[NSAttributedString class]]) { 947 commitText = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));1131 commitText = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string])); 948 1132 } else { 949 1133 commitText = QCFString::toQString(reinterpret_cast<CFStringRef>(aString)); 950 1134 }; 1135 } 1136 1137 if ([aString length] && composing) { 1138 // Send the commit string to the widget. 951 1139 composing = false; 952 1140 sendKeyEvents = false; … … 954 1142 e.setCommitString(commitText); 955 1143 qt_sendSpontaneousEvent(qwidget, &e); 956 } 1144 } else { 1145 // The key sequence "`q" on a French Keyboard will generate two calls to insertText before 1146 // it returns from interpretKeyEvents. The first call will turn off 'composing' and accept 1147 // the "`" key. The last keyDown event needs to be processed by the widget to get the 1148 // character "q". The string parameter is ignored for the second call. 1149 sendKeyEvents = true; 1150 } 1151 1152 composingText->clear(); 957 1153 } 958 1154 … … 976 1172 NSRange effectiveRange; 977 1173 NSRange range = NSMakeRange(index, composingLength-index); 978 NSDictionary *attributes = [aString attributesAtIndex:index 1174 NSDictionary *attributes = [aString attributesAtIndex:index 979 1175 longestEffectiveRange:&effectiveRange 980 1176 inRange:range]; … … 985 1181 if (color) { 986 1182 clr = colorFrom(color); 987 } 1183 } 988 1184 QTextCharFormat format; 989 1185 format.setFontUnderline(true); … … 1008 1204 0, composingLength, format); 1009 1205 } 1206 *composingText = qtText; 1010 1207 QInputMethodEvent e(qtText, attrs); 1011 1208 qt_sendSpontaneousEvent(qwidget, &e); 1209 if (!composingLength) 1210 composing = false; 1012 1211 } 1013 1212 1014 1213 - (void) unmarkText 1015 1214 { 1215 if (composing) { 1216 QInputMethodEvent e; 1217 e.setCommitString(*composingText); 1218 qt_sendSpontaneousEvent(qwidget, &e); 1219 } 1220 composingText->clear(); 1016 1221 composing = false; 1017 1222 } … … 1052 1257 - (NSRange) markedRange 1053 1258 { 1054 NSRange range; 1259 NSRange range; 1055 1260 if (composing) { 1056 1261 range.location = 0; … … 1077 1282 } 1078 1283 return selRange; 1079 1284 1080 1285 } 1081 1286 … … 1083 1288 { 1084 1289 Q_UNUSED(theRange); 1085 // The returned rect is always based on the internal cursor. 1290 // The returned rect is always based on the internal cursor. 1086 1291 QRect mr(qwidget->inputMethodQuery(Qt::ImMicroFocus).toRect()); 1087 1292 QPoint mp(qwidget->mapToGlobal(QPoint(mr.bottomLeft()))); … … 1174 1379 if(!(GetCurrentEventButtonState() & kEventMouseButtonPrimary)) 1175 1380 return Qt::IgnoreAction; 1176 1381 1177 1382 if(object) { 1178 1383 dragPrivate()->source->removeEventFilter(this); … … 1180 1385 beingCancelled = false; 1181 1386 } 1182 1387 1183 1388 object = o; 1184 1389 dragPrivate()->target = 0; … … 1192 1397 dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray()); 1193 1398 dragBoard.setMimeData(dragPrivate()->data); 1194 1399 1195 1400 // create the image 1196 1401 QPoint hotspot; … … 1230 1435 NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); 1231 1436 [image retain]; 1232 DnDParams *dndParams =[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];1233 // save supported actions 1234 [dndParams ->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];1235 NSPoint imageLoc = {dndParams ->localPoint.x - hotspot.x(),1236 dndParams ->localPoint.y + pix.height() - hotspot.y()};1437 DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; 1438 // save supported actions 1439 [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; 1440 NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(), 1441 dndParams.localPoint.y + pix.height() - hotspot.y()}; 1237 1442 NSSize mouseOffset = {0.0, 0.0}; 1238 1443 NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; 1239 NSPoint windowPoint = [dndParams->theEvent locationInWindow]; 1444 NSPoint windowPoint = [dndParams.theEvent locationInWindow]; 1445 dragPrivate()->executed_action = Qt::ActionMask; 1240 1446 // do the drag 1241 [dndParams ->view retain];1242 [dndParams ->view dragImage:image1447 [dndParams.view retain]; 1448 [dndParams.view dragImage:image 1243 1449 at:imageLoc 1244 1450 offset:mouseOffset 1245 event:dndParams ->theEvent1451 event:dndParams.theEvent 1246 1452 pasteboard:pboard 1247 source:dndParams ->view1453 source:dndParams.view 1248 1454 slideBack:YES]; 1249 [dndParams->view release]; 1455 // reset the implicit grab widget when drag ends because we will not 1456 // receive the mouse release event when DND is active. 1457 qt_button_down = 0; 1458 [dndParams.view release]; 1250 1459 [image release]; 1460 dragPrivate()->executed_action = Qt::IgnoreAction; 1251 1461 object = 0; 1252 Qt::DropAction performedAction(qt_mac_mapNSDragOperation( dndParams->performedAction));1462 Qt::DropAction performedAction(qt_mac_mapNSDragOperation(qMacDnDParams()->performedAction)); 1253 1463 // do post drag processing, if required. 1254 1464 if(performedAction != Qt::IgnoreAction) { 1255 // check if the receiver points us to a file location. 1465 // check if the receiver points us to a file location. 1256 1466 // if so, we need to do the file copy/move ourselves. 1257 1467 QCFType<CFURLRef> pasteLocation = 0;
Note:
See TracChangeset
for help on using the changeset viewer.