* [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions
@ 2011-05-29 22:36 Alexandre Raymond
2011-05-31 20:07 ` Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexandre Raymond, andreas.faerber
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'.
----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<---
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions
2011-05-29 22:36 [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions Alexandre Raymond
@ 2011-05-31 20:07 ` Andreas Färber
2011-06-06 23:39 ` Alexandre Raymond
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2011-05-31 20:07 UTC (permalink / raw)
To: Alexandre Raymond; +Cc: qemu-devel
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 <cerbere@gmail.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions
2011-05-31 20:07 ` Andreas Färber
@ 2011-06-06 23:39 ` Alexandre Raymond
2011-06-09 19:03 ` [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions Andreas Färber
2011-06-09 19:06 ` [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions Andreas Färber
0 siblings, 2 replies; 7+ messages in thread
From: Alexandre Raymond @ 2011-06-06 23:39 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
Hi Andreas,
On Tue, May 31, 2011 at 4:07 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> 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.
I am working on a cleanup of the cocoa code. As a temporary fix, would
you accept a simple patch renaming handleEvent to handleGUIEvent in
order to avoid the compilation warning ?
Alexandre
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions
2011-06-06 23:39 ` Alexandre Raymond
@ 2011-06-09 19:03 ` Andreas Färber
2011-06-10 2:47 ` Alexandre Raymond
2011-06-09 19:06 ` [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions Andreas Färber
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2011-06-09 19:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber
Avoid compiler confusion as to which method signature to use for the
handleEvent: selector on OSX >= 10.6 by making the variable type-safe
as opposed to generic 'id' type.
Requires moving the variable definition to after the class definition.
----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<---
Reported-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
ui/cocoa.m | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1c54759..515e684 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -63,7 +63,6 @@ typedef struct {
} QEMUScreen;
NSWindow *normalWindow;
-id cocoaView;
static DisplayChangeListener *dcl;
int gArgc;
@@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode)
- (QEMUScreen) gscreen;
@end
+QemuCocoaView *cocoaView;
+
@implementation QemuCocoaView
- (id)initWithFrame:(NSRect)frameRect
{
--
1.7.5.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions
2011-06-06 23:39 ` Alexandre Raymond
2011-06-09 19:03 ` [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions Andreas Färber
@ 2011-06-09 19:06 ` Andreas Färber
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2011-06-09 19:06 UTC (permalink / raw)
To: Alexandre Raymond; +Cc: qemu-devel
Hi Alexandre,
Am 07.06.2011 um 01:39 schrieb Alexandre Raymond:
> On Tue, May 31, 2011 at 4:07 PM, Andreas Färber <andreas.faerber@web.de
> > wrote:
>> 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.
> I am working on a cleanup of the cocoa code. As a temporary fix, would
> you accept a simple patch renaming handleEvent to handleGUIEvent in
> order to avoid the compilation warning ?
Could you please test the new patch for the above solution that I just
submitted?
Thanks,
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions
2011-06-09 19:03 ` [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions Andreas Färber
@ 2011-06-10 2:47 ` Alexandre Raymond
2011-06-12 13:43 ` Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Raymond @ 2011-06-10 2:47 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
Tested-by: Alexandre Raymond <cerbere@gmail.com>
That's definitely a better patch ;-)
Thanks,
Alexandre
On Thu, Jun 9, 2011 at 3:03 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> Avoid compiler confusion as to which method signature to use for the
> handleEvent: selector on OSX >= 10.6 by making the variable type-safe
> as opposed to generic 'id' type.
> Requires moving the variable definition to after the class definition.
>
> ----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<---
>
> Reported-by: Alexandre Raymond <cerbere@gmail.com>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
> ui/cocoa.m | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 1c54759..515e684 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -63,7 +63,6 @@ typedef struct {
> } QEMUScreen;
>
> NSWindow *normalWindow;
> -id cocoaView;
> static DisplayChangeListener *dcl;
>
> int gArgc;
> @@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode)
> - (QEMUScreen) gscreen;
> @end
>
> +QemuCocoaView *cocoaView;
> +
> @implementation QemuCocoaView
> - (id)initWithFrame:(NSRect)frameRect
> {
> --
> 1.7.5.3
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions
2011-06-10 2:47 ` Alexandre Raymond
@ 2011-06-12 13:43 ` Andreas Färber
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2011-06-12 13:43 UTC (permalink / raw)
To: Alexandre Raymond; +Cc: qemu-devel
Am 10.06.2011 um 04:47 schrieb Alexandre Raymond:
> Tested-by: Alexandre Raymond <cerbere@gmail.com>
>
> That's definitely a better patch ;-)
Thanks, applied to the cocoa branch.
Andreas
> Thanks,
> Alexandre
>
>
>
> On Thu, Jun 9, 2011 at 3:03 PM, Andreas Färber
> <andreas.faerber@web.de> wrote:
>> Avoid compiler confusion as to which method signature to use for the
>> handleEvent: selector on OSX >= 10.6 by making the variable type-safe
>> as opposed to generic 'id' type.
>> Requires moving the variable definition to after the class
>> definition.
>>
>> ----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<---
>>
>> Reported-by: Alexandre Raymond <cerbere@gmail.com>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> ---
>> ui/cocoa.m | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 1c54759..515e684 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -63,7 +63,6 @@ typedef struct {
>> } QEMUScreen;
>>
>> NSWindow *normalWindow;
>> -id cocoaView;
>> static DisplayChangeListener *dcl;
>>
>> int gArgc;
>> @@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode)
>> - (QEMUScreen) gscreen;
>> @end
>>
>> +QemuCocoaView *cocoaView;
>> +
>> @implementation QemuCocoaView
>> - (id)initWithFrame:(NSRect)frameRect
>> {
>> --
>> 1.7.5.3
>>
>>
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-06-12 13:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-29 22:36 [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions Alexandre Raymond
2011-05-31 20:07 ` Andreas Färber
2011-06-06 23:39 ` Alexandre Raymond
2011-06-09 19:03 ` [Qemu-devel] [PATCH] cocoa: Avoid warning related to multiple handleEvent: definitions Andreas Färber
2011-06-10 2:47 ` Alexandre Raymond
2011-06-12 13:43 ` Andreas Färber
2011-06-09 19:06 ` [Qemu-devel] [PATCH] Cocoa: avoid warning related to multiple method definitions Andreas Färber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).