summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 12:42:32 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 12:44:08 (GMT)
commitf65ed7b51a573dd8429feecc19c7abe8a0a36114 (patch)
tree5ce70bc3ca67573b4a3b07c13e1a8a8be520f4bd /src/gui
parent3464a05a94c4e638d91b2151d6aad70f78ea3087 (diff)
downloadQt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.zip
Qt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.tar.gz
Qt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.tar.bz2
Remove some warnings in the Cocoa build.
After discussing with some of the Objective-C people I have finally got a fair number of the warnings to disappear in both 10.5 and 10.6. I also took the opportunity to remove a bunch of other warnings. Reviewed by: Morten Sørvig
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm12
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/gui/inputmethod/qmacinputcontext_mac.cpp37
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm3
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac_p.h13
-rw-r--r--src/gui/kernel/qcocoapanel_mac.mm6
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm4
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac_p.h31
-rw-r--r--src/gui/kernel/qsound_mac.mm11
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontdatabase_mac.cpp2
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm19
-rw-r--r--src/gui/widgets/qcocoamenu_mac_p.h17
13 files changed, 113 insertions, 48 deletions
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index c5cfcc0..06120da 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -54,11 +54,19 @@
typedef float CGFloat; // Should only not be defined on 32-bit platforms
#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+@protocol NSWindowDelegate <NSObject>
+- (void)windowDidResize:(NSNotification *)notification;
+- (BOOL)windowShouldClose:(id)window;
+@end
+#endif
+
QT_USE_NAMESPACE
@class QCocoaColorPanelDelegate;
-@interface QCocoaColorPanelDelegate : NSObject {
+@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> {
NSColorPanel *mColorPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -74,8 +82,6 @@ QT_USE_NAMESPACE
okButton:(NSButton *)okButton
cancelButton:(NSButton *)cancelButton
priv:(QColorDialogPrivate *)priv;
-- (BOOL)windowShouldClose:(id)window;
-- (void)windowDidResize:(NSNotification *)notification;
- (void)colorChanged:(NSNotification *)notification;
- (void)relayout;
- (void)onOkClicked;
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index e7d2f43..3dc3c00 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -78,7 +78,9 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
-@protocol NSWindowDelegate <NSObject> @end
+@protocol NSWindowDelegate <NSObject>
+- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
+@end
#endif
diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp
index 9ccbe7a..e92c0d3 100644
--- a/src/gui/inputmethod/qmacinputcontext_mac.cpp
+++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp
@@ -55,13 +55,6 @@ extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
# define typeByteCount typeSInt32
#endif
-static QTextFormat qt_mac_compose_format()
-{
- QTextCharFormat ret;
- ret.setFontUnderline(true);
- return ret;
-}
-
QMacInputContext::QMacInputContext(QObject *parent)
: QInputContext(parent), composing(false), recursionGuard(false), textDocument(0)
{
@@ -70,7 +63,7 @@ QMacInputContext::QMacInputContext(QObject *parent)
QMacInputContext::~QMacInputContext()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(textDocument)
DeleteTSMDocument(textDocument);
#endif
@@ -79,7 +72,7 @@ QMacInputContext::~QMacInputContext()
void
QMacInputContext::createTextDocument()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(!textDocument) {
InterfaceTypeList itl = { kUnicodeDocument };
NewTSMDocument(1, itl, &textDocument, SRefCon(this));
@@ -96,7 +89,7 @@ QString QMacInputContext::language()
void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(e->type() != QEvent::MouseButtonPress)
return;
@@ -105,11 +98,21 @@ void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
if (pos < 0 || pos > currentText.length())
reset();
// ##### handle mouse position
+#else
+ Q_UNUSED(pos);
+ Q_UNUSED(e);
#endif
}
#if !defined QT_MAC_USE_COCOA
+static QTextFormat qt_mac_compose_format()
+{
+ QTextCharFormat ret;
+ ret.setFontUnderline(true);
+ return ret;
+}
+
void QMacInputContext::reset()
{
if (recursionGuard)
@@ -132,12 +135,12 @@ bool QMacInputContext::isComposing() const
{
return composing;
}
-#endif
+#endif
void QMacInputContext::setFocusWidget(QWidget *w)
{
createTextDocument();
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(w)
ActivateTSMDocument(textDocument);
else
@@ -147,6 +150,7 @@ void QMacInputContext::setFocusWidget(QWidget *w)
}
+#ifndef QT_MAC_USE_COCOA
static EventTypeSpec input_events[] = {
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
{ kEventClassTextInput, kEventTextInputOffsetToPos },
@@ -154,11 +158,12 @@ static EventTypeSpec input_events[] = {
};
static EventHandlerUPP input_proc_handlerUPP = 0;
static EventHandlerRef input_proc_handler = 0;
+#endif
void
QMacInputContext::initialize()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(!input_proc_handler) {
input_proc_handlerUPP = NewEventHandlerUPP(QMacInputContext::globalEventProcessor);
InstallEventHandler(GetApplicationEventTarget(), input_proc_handlerUPP,
@@ -171,7 +176,7 @@ QMacInputContext::initialize()
void
QMacInputContext::cleanup()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(input_proc_handler) {
RemoveEventHandler(input_proc_handler);
input_proc_handler = 0;
@@ -186,7 +191,7 @@ QMacInputContext::cleanup()
OSStatus
QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *)
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
SRefCon refcon = 0;
@@ -342,6 +347,8 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void
}
if(!handled_event) //let the event go through
return eventNotHandledErr;
+#else
+ Q_UNUSED(event);
#endif
return noErr; //we eat the event
}
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index 353d815..ab96d58 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -259,14 +259,13 @@ static void cleanupCocoaApplicationDelegate()
onApplicationChangedActivation(false);
}
-class QDesktopWidgetImplementation;
- (void)applicationDidChangeScreenParameters:(NSNotification *)notification
{
Q_UNUSED(notification);
QDesktopWidgetImplementation::instance()->onResize();
}
-- (void)setReflectionDelegate:(NSObject *)oldDelegate
+- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate
{
[oldDelegate retain];
[reflectionDelegate release];
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
index 3931f16..5aa98df 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
@@ -97,7 +97,14 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
-@protocol NSApplicationDelegate <NSObject> @end
+@protocol NSApplicationDelegate <NSObject>
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
+- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames;
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender;
+- (void)applicationDidBecomeActive:(NSNotification *)notification;
+- (void)applicationDidResignActive:(NSNotification *)notification;
+@end
#endif
@@ -106,7 +113,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
QApplicationPrivate *qtPrivate;
NSMenu *dockMenu;
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
- id <NSApplicationDelegate> reflectionDelegate;
+ NSObject <NSApplicationDelegate> *reflectionDelegate;
bool inLaunch;
}
+ (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate;
@@ -115,6 +122,6 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
- (QApplicationPrivate *)qAppPrivate;
- (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
-- (void)setReflectionDelegate:(NSObject *)oldDelegate;
+- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
@end
#endif
diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm
index 266cf88..bdc7ecb 100644
--- a/src/gui/kernel/qcocoapanel_mac.mm
+++ b/src/gui/kernel/qcocoapanel_mac.mm
@@ -55,6 +55,12 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.
QT_END_NAMESPACE
QT_USE_NAMESPACE
+
+@interface NSWindow (QtCoverForHackWithCategory)
++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
+@end
+
+
@implementation QT_MANGLE_NAMESPACE(QCocoaPanel)
- (BOOL)canBecomeKeyWindow
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index 9c1dce5..7084416 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -58,6 +58,10 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.
QT_END_NAMESPACE
QT_USE_NAMESPACE
+@interface NSWindow (QtCoverForHackWithCategory)
++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
+@end
+
@implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration))
- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask;
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
index b171b47..1e1d668 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
@@ -63,15 +63,8 @@ QT_FORWARD_DECLARE_CLASS(QWidget)
QT_FORWARD_DECLARE_CLASS(QSize)
QT_FORWARD_DECLARE_CLASS(QWidgetData)
-@interface QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) : NSObject {
- QHash<NSWindow *, QWidget *> *m_windowHash;
- QHash<NSDrawer *, QWidget *> *m_drawerHash;
-}
-+ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate;
-- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget;
-- (void)resignDelegateForWindow:(NSWindow *)window;
-- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget;
-- (void)resignDelegateForDrawer:(NSDrawer *)drawer;
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+@protocol NSWindowDelegate <NSObject>
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
- (void)windowDidMiniaturize:(NSNotification*)notification;
- (void)windowDidResize:(NSNotification *)notification;
@@ -83,6 +76,25 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData)
- (void)windowDidResignMain:(NSNotification*)notification;
- (void)windowDidBecomeKey:(NSNotification*)notification;
- (void)windowDidResignKey:(NSNotification*)notification;
+@end
+
+@protocol NSDrawerDelegate <NSObject>
+- (NSSize)drawerWillResizeContents:(NSDrawer *)sender toSize:(NSSize)contentSize;
+@end
+
+#endif
+
+
+
+@interface QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) : NSObject<NSWindowDelegate, NSDrawerDelegate> {
+ QHash<NSWindow *, QWidget *> *m_windowHash;
+ QHash<NSDrawer *, QWidget *> *m_drawerHash;
+}
++ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate;
+- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget;
+- (void)resignDelegateForWindow:(NSWindow *)window;
+- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget;
+- (void)resignDelegateForDrawer:(NSDrawer *)drawer;
- (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window;
- (void)syncSizeForWidget:(QWidget *)qwidget
toSize:(const QSize &)newSize
@@ -90,6 +102,5 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData)
- (NSSize)closestAcceptableSizeForWidget:(QWidget *)qwidget
window:(NSWindow *)window withNewSize:(NSSize)proposedSize;
- (QWidget *)qt_qwidgetForWindow:(NSWindow *)window;
-- (void)checkForMove:(const NSRect &)newRect forWidget:(QWidget *)qwidget;
@end
#endif
diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm
index 43965d1..a8ee516 100644
--- a/src/gui/kernel/qsound_mac.mm
+++ b/src/gui/kernel/qsound_mac.mm
@@ -80,14 +80,19 @@ protected:
QT_END_NAMESPACE
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+@protocol NSSoundDelegate <NSObject>
+-(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool;
+@end
+#endif
+
QT_USE_NAMESPACE
-@interface QMacSoundDelegate : NSObject {
+@interface QMacSoundDelegate : NSObject<NSSoundDelegate> {
QSound *qSound; // may be null.
QAuServerMac* server;
-}
+}
-(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server;
--(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool;
@end
@implementation QMacSoundDelegate
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 52f4b34..06d4a36 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -442,7 +442,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
// ### copied to tools/makeqpf/qpf2.cpp
-#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA))
// see the Unicode subset bitfields in the MSDN docs
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
// Any,
diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp
index f596449..2f6788f 100644
--- a/src/gui/text/qfontdatabase_mac.cpp
+++ b/src/gui/text/qfontdatabase_mac.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
int qt_mac_pixelsize(const QFontDef &def, int dpi); //qfont_mac.cpp
int qt_mac_pointsize(const QFontDef &def, int dpi); //qfont_mac.cpp
+#ifndef QT_MAC_USE_COCOA
static void initWritingSystems(QtFontFamily *family, ATSFontRef atsFont)
{
ByteCount length = 0;
@@ -81,6 +82,7 @@ qDebug() << "first char" << hex << unicodeRange[0];
for (int i = 0; i < systems.count(); ++i)
family->writingSystems[systems.at(i)] = QtFontFamily::Supported;
}
+#endif
static void initializeDb()
{
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index 370bc0c..b733db5 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -124,12 +124,20 @@ QT_USE_NAMESPACE
-(void)mousePressed:(NSEvent *)mouseEvent;
@end
-@interface QNSMenu : NSMenu {
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+
+@protocol NSMenuDelegate <NSObject>
+-(void)menuNeedsUpdate:(NSMenu*)menu;
+@end
+#endif
+
+
+@interface QNSMenu : NSMenu <NSMenuDelegate> {
QMenu *qmenu;
}
-(QMenu*)menu;
-(id)initWithQMenu:(QMenu*)qmenu;
--(void)menuNeedsUpdate:(QNSMenu*)menu;
-(void)selectedAction:(id)item;
@end
@@ -455,10 +463,11 @@ private:
}
return self;
}
--(QMenu*)menu {
- return qmenu;
+-(QMenu*)menu {
+ return qmenu;
}
--(void)menuNeedsUpdate:(QNSMenu*)menu {
+-(void)menuNeedsUpdate:(NSMenu*)nsmenu {
+ QNSMenu *menu = static_cast<QNSMenu *>(nsmenu);
emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow();
for(int i = [menu numberOfItems]-1; i >= 0; --i)
[menu removeItemAtIndex:i];
diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h
index cd53692..8eb6fba 100644
--- a/src/gui/widgets/qcocoamenu_mac_p.h
+++ b/src/gui/widgets/qcocoamenu_mac_p.h
@@ -56,16 +56,23 @@
QT_FORWARD_DECLARE_CLASS(QMenu)
-@interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu
-{
- QMenu *qmenu;
-}
-- (id)initWithQMenu:(QMenu*)menu;
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+
+@protocol NSMenuDelegate <NSObject>
- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item;
- (void)menuWillOpen:(NSMenu*)menu;
- (void)menuWillClose:(NSMenu*)menu;
- (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier
whichItem:(NSMenuItem**)outItem;
+@end
+
+#endif
+
+@interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu <NSMenuDelegate>
+{
+ QMenu *qmenu;
+}
+- (id)initWithQMenu:(QMenu*)menu;
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action;
@end
#endif