qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions
Date: Tue, 31 May 2011 22:07:19 +0200

Hello Alexandre,

Am 30.05.2011 um 00:36 schrieb Alexandre Raymond:

This fix forces a message to be sent to the handleEvent method
of the QemuCocoaView class instead of letting the system determine
the right method.

This is caused by the fact that the cocoaView variable is a generic 'id'.

In that case I would prefer to change the variable definition, moving it further down, instead of introducing a cast.

----8<----
ui/cocoa.m: In function ‘cocoa_refresh’:
ui/cocoa.m:997: warning: multiple methods named ‘-handleEvent:’ found
/System/Library/Frameworks/AppKit.framework/Headers/ NSTextInputContext.h:84: warning: using ‘-(BOOL)handleEvent:(NSEvent *)theEvent’ ui/cocoa.m:272: warning: also found ‘-(void)handleEvent:(NSEvent *)event’
----8<---

Since I'm not seeing this issue on v10.5, it seems a new method was introduced by Apple in v10.6.

Not in NSView (QemuCocoaView's parent class):
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ ApplicationKit/Classes/NSView_Class/Reference/NSView.html

but in unrelated NSTextInputContext class:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ NSTextInputContext_Class/Reference/Reference.html

So, it seems the warning stems from the name clash of two identical selectors "handleEvent:" with differing return type (void vs. BOOL). I vaguely remember seeing a patch that renames our method, either in Juha's 48-patch series Peter pointed to or in a patch by C.W. Betts.

If you haven't already, could you please check on that? Maybe it's safest to do both? Or to change our return type even if unused?

Andreas


Signed-off-by: Alexandre Raymond <address@hidden>
---
ui/cocoa.m |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index e1312d3..1975011 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -994,7 +994,7 @@ static void cocoa_refresh(DisplayState *ds)
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:distantPast
                        inMode: NSDefaultRunLoopMode dequeue:YES];
        if (event != nil) {
-            [cocoaView handleEvent:event];
+            [(QemuCocoaView *) cocoaView handleEvent:event];
        }
    } while(event != nil);
    vga_hw_update();
--
1.7.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]