summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
Commit message (Collapse)AuthorAgeFilesLines
* Cocoa: Port QCocoaTheme::fileIconPixmap() to CocoaGabriel de Dietrich2013-04-301-19/+10
| | | | | | Task-number: QTBUG-30907 Change-Id: Ie460db63413ab9c8e0fb5fb85af907e1c7f12759 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Don't crash on null QCoocaMenuItem.Morten Johan Sørvig2013-04-261-2/+4
| | | | | Change-Id: Ia70f616983141134afe874b69a5957e31f6f5ed9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Fix ignoring close events on OSXJosh Faust2013-04-264-5/+10
| | | | | | | | | | | | | QNSWindowDelegate was not handling windowShouldClose, which is how you can tell Cocoa that your window should not close if the close button is pressed. This change moves the close handling from windowWillClose to windowShouldClose, and adds an optional "accepted" pointer to QWindowSystemInterface::handleCloseEvent so that QNSWindowDelegate can return a true/false value for whether the window should actually close Task-number: QTBUG-28965 Change-Id: I67c6296ad42cbeeb71413e05411467d4e558adb4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Don't use the SubWindow flag for windows embedded in foreign windowsShawn Rutledge2013-04-265-7/+30
| | | | | | | | | Instead, add QCocoaWindow::setEmbeddedInForeignView which can be called via QPlatformNativeInterface::NativeResourceForIntegrationFunction Task-number: QTBUG-30805 Change-Id: I05861e80ca664ddb430216388cf0fec573a4d32b Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Increase the loopLevel when activating menu items.Morten Johan Sørvig2013-04-262-0/+6
| | | | | | | | | | | | | | | | | Apply 0293aff5c44202e5c62e229b74d8bd0bf9206185 from Qt 4. Without this, calls to deleteLater() may create delete later events with a loopLevel of 1. Those events will not be processed until QApplication::exec() returns. Add a QScopedLoopLevelCounter that increases the loopLevel for the duration of the activated() call. Task-number: QTBUG-30660 Change-Id: I7ab3bb3a53243691b8f7f64e025150e5cc7da2c8 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Fix shortcut override for menusFrederik Gladhorn2013-04-263-9/+104
| | | | | | | | | | | | | | | | | | Since we use native Cocoa menus, we cannot rely on the normal shortcut handling. Shortcuts can be overridden by the currently focused object in Qt. In order to make that possible we need to send a QShortcutOverride event before accepting any key event. For menus the key event goes from the NSApp directly to the menu, so the shortcutOverride would not work. This is mostly an adaptation of the Qt 4 code. Task-number: QTBUG-30695 Change-Id: Icb4979309d2d6f9606eb9c8abc4130dc79926593 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Respect the hotspot when creating the cursor in CocoaAndy Shaw2013-04-251-7/+7
| | | | | | | | | | The hotspot was not taken from the QCursor so if one was set then it was reset to 0x0. Change-Id: Ie81f1c2ac15a16f10436738367e612c44dc42d38 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Improve text heuristic menu item syncing logicGabriel de Dietrich2013-04-256-13/+51
| | | | | | | | | | | | | | | Don't try anything after the original syncing, particularly after changing the menu item's text. Also, don't try anything if the menu item cannot be linked up to a menubar (see QTBUG-30756). This latter point requires extra syncing after adding a menu in the menubar. Finally, to be able to find the menubar, we need to clean the code for moc's eyes. Task-number: QTBUG-30756 Task-number: QTBUG-30812 Change-Id: I88fad663f1c35d03a0cb167d1723d16f590918c0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Reflect menu hierarchy in QCocoaMenu* objectsGabriel de Dietrich2013-04-253-0/+11
| | | | | | | | | | | | | | QCocoaMenu is child of either a QCocoaMenuBar, a QCocoaMenuItem as a submenu, or nothing as a standalone menu. QCocoaMenuItem is child of its containing QCocoaMenu. The parent is set during insertion and cleared during removal. QMenu needs to be updated to avoid double deletion and leaking its own platform menu. Change-Id: Iadf60d8062d7466fa616f84f3761fe322fc9aa2e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Remove dead code in QCocoaMenu*Gabriel de Dietrich2013-04-253-22/+2
| | | | | Change-Id: I56136594f073295ced645d06f657187a54e84384 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Fix disabled minimize button on main windowsGabriel de Dietrich2013-04-231-1/+1
| | | | | | | | Task-number: QTBUG-30775 Change-Id: Idec64f2cc6181e6889498171ead676d33c66e537 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Don't crash on a null window pointer.Morten Johan Sørvig2013-04-231-0/+3
| | | | | | | Task-number: QTBUG-30731 Change-Id: Id256b915012b43d1eb85bba62cbc1d42cfb58b34 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Add setAlertState(), isAlertState(), beep() functionsGabriel de Dietrich2013-04-234-0/+30
| | | | | | | | Also, fix operator precedence error in QApplication::alert(). Change-Id: I140ccfba29638d24bc1c97f5f9a9611f66eb6b8f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Move Mac translations to .cpp file for lupdate to pick them up.Friedemann Kleint2013-04-235-39/+170
| | | | | | | | Task-number: QTBUG-30125 Change-Id: I4e56fd3021b4ef5f344d4d36ae594dd88e2aa1bd Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Return GroupRole for unknown accessibility roles.Morten Johan Sørvig2013-04-231-2/+5
| | | | | | | | | UnknownRole draws attention from the screen reader and makes it focus on the unknown item. GroupRole is ignored and passes focus to child items. Change-Id: If7b4cd9ec02b1890929a709b84d897f452c39587 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Accessibility Mac: Implement accessibilityFocusedUIElementFrederik Gladhorn2013-04-221-0/+18
| | | | | | Change-Id: I17b5b1f741a8b340d8f4b16f4ec39cc9a8159bfa Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Revert "Don't warn on 0x0 sized windows."Morten Johan Sørvig2013-04-221-1/+1
| | | | | | | | This reverts commit 88272d6c04f0f67fa9612dc7bdb2a5f8ba8d0314, which accidentally re-introduced a crash. Change-Id: Ie60bcf55f940b24f982eed4f20c6af3320b040a7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Convert the CGImage into a QPixmap after reading from clipboardAndy Shaw2013-04-221-4/+2
| | | | | | | | Now that the relevant function is available we can do the conversion inside QMacPasteboardMimeTiff when obtaining an image from the clipboard Change-Id: Ie41b0fffedf4dd3f8ef49431482bd075a69722b1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Disable QTBUG-30266 hack in full screenGabriel de Dietrich2013-04-191-1/+10
| | | | | | | | | That would set the full screen window in a weird state, where is was full screen (but unable to exit that mode) and showing the title bar at the same time. Change-Id: I3ac913876f3b326504dd5af18c34181d002509d0 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Let platform plugin decide if accessibility is activeFrederik Gladhorn2013-04-193-12/+13
| | | | | Change-Id: I881a8ff3fedf3db73ee37046a4363c70960a92a6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Make password mask characters themeable.Mitch Curtis2013-04-191-0/+2
| | | | | | | | Task-number: QTBUG-29871 Change-Id: I3cf739a321d7917f8f8431992e29bba0871b1934 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Remove nativeResourceForWindow warning.Morten Johan Sørvig2013-04-181-3/+1
| | | | | | | | | | The warning is useful for pointing out the the return value will be null. However, code that correctly checks the return value (such as qt_macWindowIsTextured), still causes the warning to be printed. Change-Id: I3828992b3d5e7b08451cf0e051b937fa9d9536d3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Mac: Fix various memory leaksGabriel de Dietrich2013-04-183-5/+7
| | | | | Change-Id: Id554be11ffcf9a506c217b0dc5b96cb37c4dd57c Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa Menu: Remove unnecessary retain, release/retain in the right orderGabriel de Dietrich2013-04-181-5/+2
| | | | | | | Also, make sure platform menu item is deleted on ActionRemoved event. Change-Id: Ic07a81cb77833bdffd1464abf1c81ebdee4d16e9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Correct dir entries caching in QFileDialogCyril Oblikov2013-04-171-10/+32
| | | | | | | | | | Using QFileSystemWatcher to update cache when directory is changed. It is needed to correctly filter files created after the dialog opening. Task-number: QTBUG-30604 Change-Id: I5479f9a54095de59ca2ba36b2bd4906de0907ac8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Fix menu popup, againGabriel de Dietrich2013-04-161-28/+38
| | | | | | | | This time, popUpContextMenu:withEvent:forView: wouldn't respect the menu's minimum width setting. Change-Id: I7731851f2cf45d596d45a24dab5abe7b9239f07f Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Make sure no invisible proxy icon button is createdGabriel de Dietrich2013-04-161-0/+2
| | | | | | | | If the icon is null, don't force creation. Task-number: QTBUG-30064 Change-Id: If639714f667fedfcc67a3393a7d75111a7dbff3f Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Accessibility Mac: Enable ignoring of childrenFrederik Gladhorn2013-04-162-4/+7
| | | | | | | | | | | | | The ignored children do not show up in the hierarchy, this should improve performance significantly. Previously the code would ignore the grouping property which seems to break QGroupBox. Change-Id: I4535af9c95bce76ded65f6d40fe07f17f3acffad Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Add autorelease pool for cocoa plugin creation.Morten Johan Sorvig2013-04-151-0/+3
| | | | | | | Prevents mem leaks at startup on 10.6. Change-Id: I5f8b72c54ab396ee0ec2e47320163a6a342b78f1 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Add autorelease pools needed by Qt Creator.Morten Johan Sørvig2013-04-152-0/+4
| | | | | | | | With these Qt Creator startup is now warning-free on 10.6. Change-Id: Ie29d360611c0e516258920163e4e94d174217299 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Fix unresponsive main window after running more than one modal sessionGabriel de Dietrich2013-04-151-1/+4
| | | | | | | | | | | | | | | | For some reason, we postpone clearing the stack of modal sessions until we call processPostedEvents() again. However, it also means that when we clear the second modal session, that session keeps running although we just closed its window. The reason why it isn't stopped is because it wasn't the topmost modal session in the stack. This patch fixes the issue by stopping a modal session if any session above in the stack has been stopped. This makes it less problematic if we don't call processPostedEvents() in between ending modal sessions. Task-number: QTBUG-30504 Change-Id: I9f898250ae629947d066647f9d5a0b9f75cf0070 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Don't warn on 0x0 sized windows.Morten Johan Sørvig2013-04-151-1/+1
| | | | | | | | I don't think this is an user error. If it is then the warning should be in a cross-platform code path. Change-Id: I4c615d9b2372660bb03b17ccb25204b2a8d17b1a Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Fix popup menus on modal windowsGabriel de Dietrich2013-04-151-3/+33
| | | | | | | | | Previously, we used -popUpMenuPositioningItem:atLocation:inView: but this turns out not to work with modal windows. This can actually be reproduced in Cocoa. Change-Id: I9b750d1f97637f0cc30329d3da3acf5200f62206 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Create QCocoaWindow when enabling touch.Morten Johan Sørvig2013-04-151-0/+5
| | | | | | | | The ref-counting and (native) touch enabling is implemented in QCocoaWindow. Change-Id: I4f3f5e16db59afec7dd7dd2f8360dd60b90bfe6d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Enable touch on 0->1 counter transition.Morten Johan Sørvig2013-04-151-1/+1
| | | | | Change-Id: I9d8fb84851a866c3020cbbca13d5b2dc297cfe65 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Add devicePixelRatio metric to QPaintDevice.Morten Johan Sørvig2013-04-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously QPainter computed the devicePixelRatio based on the physical and logical dpi, and expected that the ratio between them would be either 1x or 2x. This was problematic for paint devices like printers where the physical dpi can be much higher than the logical dpi, and also for QScreen where the physical dpi would have to be defined as a multiple of the logical dpi. Add QPaintDevice::PdmDevicePixelRatio and QPaintDevice:: devicePixelRatio() getter and implement it for the QPaintDevice subclasses. Use it when calculating the highdpi scale transform in qpainter.cpp and when scaling the clip rect in qwidget.cpp. Remove physical dpi scaling for QImage, QPixmap and QOpenGLPaintDevice, reverting to the old behavior. Change-Id: I6c97510613196d4536ff39d08e9750b8782283d4 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Call QString::normalized when it is constructed via the native APIAndy Shaw2013-04-111-4/+4
| | | | | | | | | When a string comes from the native APIs then it may need to be normalized. Task-number: QTBUG-14787 Change-Id: I5164e80efcd1d99a50263c72bcf97d7fb31b38f7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Mac: Ensure the native filedialog sets file name when savingLiang Qi2013-04-091-2/+2
| | | | | | | | | | | | The name field string was not set in native dialog when one was present. The previous fix is not correct. In the doc of setNameFieldStringValue, it said "The value must not be nil". Task-number: QTBUG-28342 Change-Id: I847fb7472b8fecc0303433d8bf72b6a5bd7da72b Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* OSX window: set QWindow geometry after native window is createdShawn Rutledge2013-04-091-2/+1
| | | | | | | | | | | | | | | Initial window position is at 0,0 by default, then it's corrected in createNSWindow (by calling initialGeometry). After window creation, QNSWindowDelegate will receive the windowDidMove notification and call QCocoaWindow::windowDidMove() which then calls QNSView::updateGeometry(). It will not call QWindowSystemInterface::handleGeometryChange() because the window is still being constructed. So we can fix this by directly setting QWindow::geometry in the QCocoaWindow constructor. Task-number: QTBUG-30382 Change-Id: I3db7a6e83693e5787ae82dcab1767de938d2e5d1 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Mac: Return Qt::Key_F9 for F9, not Qt::Key_F8hjk2013-04-091-1/+1
| | | | | | Task-number: QTBUG-30520 Change-Id: I7006e43ea638796045925e753a2ef8f9d0a066e9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Properly clean window mask dataGabriel de Dietrich2013-04-082-4/+6
| | | | | | | Also, get rid of qt_mac_toCGImage and QPainter warnings. Change-Id: I9e2a0e93d74c318d99651de9222994615e082ac9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Mac: a dialog should have a titlebar by defaultShawn Rutledge2013-04-081-2/+5
| | | | | | | | Change 595deca5 for QTBUG-22316 resulted in having titlebars only on modal dialogs. Change-Id: Ic23c957e0e95cf567d90831e105cc402465df982 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Fix warning: qt_setDockMenu not foundFrederik Gladhorn2013-04-041-0/+1
| | | | | | | | | | | | qcocoanativeinterface.mm:196:5: warning: instance method '-qt_setDockMenu:' not found (return type defaults to 'id') [-Wobjc-method-access] [NSApp QT_MANGLE_NAMESPACE(qt_setDockMenu): menu]; Change-Id: I80838d0098e7f172d9b8124f04e91dba64764318 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* QPA/Mac: Fix resources leakingKonstantin Ritt2013-04-031-0/+2
| | | | | | | | | | | Having static QFont instance leads to a resources leaking, since QFontCache is unable to clean-up font engines when the application exits. Relates to QTBUG-25434 Change-Id: I71d91094de27c07ab2434c415e4c28b6acab3646 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* If the menu item is merged then we should not release itAndy Shaw2013-04-031-2/+2
| | | | | | | | | | When a menu item is merged then we do not want to release it as it will cause a problem with the Application menu. Therefore we just hide it instead. Change-Id: Ia9f7acfe063001111769841c9a360cac369f7ed7 Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cache QAccessibleInterfaces.Frederik Gladhorn2013-04-028-85/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since there already is a one-to-one relationship between QObject and QAccessibleInterface it makes little sense to create and destroy the interfaces on each call to queryAccessibleInterface. Add a cache and keep created interfaces around for the lifetime of the corresponding QObject. This changes the memory management rules: accessible interfaces must no longer be deleted. If you get an QAccessibleIntrface pointer that pointer will stay valid as long as the corresponding QObject is not deleted. This also re-enables accessibility for Mac. We limit the range of the IDs so that they are useable for Windows directly. That means we can get rid of the event cache there. This is based on: Iebf2f374916fc70a9dd29e95f45a6444b85f6cee Change-Id: I9fe6531812c0dbc5b41101ac05830a6dd75e13a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Mac style: Fix disabled menu item palette entryGabriel de Dietrich2013-03-291-1/+2
| | | | | | | Also, removed an "magic color" form the style implementation. Change-Id: Iefd3ddc0d9d651d2b87f20eb1f9990a214b651df Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Make qt_setDockMenu work and call it.Morten Johan Sørvig2013-03-292-6/+3
| | | | | | | | | The application delegate code from Qt 4 implements a non-working qt_setDockMenu. Correct the signature of the applicationDockMenu method. Change-Id: I6f531a78f91e0550b0e66cc4f2fa072006a030f4 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Remove QMacQuartzPaintDevice.Morten Johan Sørvig2013-03-291-39/+0
| | | | | | | Not used in Qt 5. Change-Id: Ia0e14414afa524c5cc04151d20c168d93d8dcadb Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* QCocoaScreen: Properly align secondary screens w.r.t. primary screenGabriel de Dietrich2013-03-271-5/+22
| | | | | | | | | | | | When using different resolution screens, one can arrange them around the primary screen. However, the vertical offset has to take into account the fact that NSScreen origin is bottom-left, whereas QScreen origin is top-left. This usualy impacts the geometry's y coordinate, and can result in popups showing in the wrong screen. Task-number: QTBUG-30348 Change-Id: I159e6be2b590bd2d9a31f3f36c3785afcc62123e Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>