Re: InputManagers
Re: InputManagers
- Subject: Re: InputManagers
- From: Steve Checkoway <email@hidden>
- Date: Sat, 12 Jun 2004 02:59:42 -0700
Well, I figured out my problem. It seems that all I needed to do to get
it to work was define a new class that was the subclass of the NSWindow
and in the load method of the main class call:
[ClickDragWindow poseAsClass:[NSWindow class]];
I just thought that someone might care to know.
- Steve
On Jun 11, 2004, at 6:15 AM, Steve Checkoway wrote:
I'm not sure that this is the best way to go about doing what I want so
if anyone has a better suggestion, I'm all ears.
Basically, I would like to add functionality to (Cocoa) windows in all
applications where command (or some other modifier, perhaps option)
dragging causes the entire window to be dragged around similar to many
X11 window managers. After looking at CocoaGestures with otool for a
bit and noticing that it is installed in ~/Library/InputManagers, I
decided that I would make my first attempt at this using the input
managers.
I can get my bundle to load (verified with a few NSLog()s) and I can
subclass NSWindow and then have my subclass pose as that class. I have
two problems, one minor, one major.
First of all, if I try to add instance variables to the subclass, the
application won't launch. It seems that I cannot do that. That would be
the minor problem.
The major problem is that whenever I quit an application that has
loaded the bundle, it crashes. My + (void) load method is pretty
simple:
+ (void) load
{
[ClickDrag poseAsClass:[NSWindow class]];
}
The only method that I override is sendEvent:. If I don't override the
method it and don't pose as the NSWindow class, it doesn't crash. If I
do either of those (or both), it crashes. So basically it only works if
I only have the load method and it's definition does not include the
poseAsClass: method call.
Here is the crash report:
Date/Time: 2004-06-11 06:11:23 -0700
OS Version: 10.3.4 (Build 7H63)
Report Version: 2
Command: TextEdit
Path: /Applications/TextEdit.app/Contents/MacOS/TextEdit
Version: 1.3 (202)
PID: 8436
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xa092f277
Thread 0 Crashed:
0 libobjc.A.dylib 0x908311f4 objc_msgSend + 0x14
1 com.apple.CoreFoundation 0x90194494 __CFArrayReleaseValues + 0x214
2 com.apple.CoreFoundation 0x9019541c __CFArrayDeallocate + 0x3c
3 com.apple.CoreFoundation 0x90190d80 CFRelease + 0x1e8
4 com.apple.Foundation 0x909f15d4 NSPopAutoreleasePool + 0x164
5 com.apple.Foundation 0x90a359f0 +[NSAutoreleasePool
releaseAllPools] + 0x30
6 com.apple.AppKit 0x92ec187c -[NSApplication
_deallocHardCore:] + 0xe4
7 com.apple.AppKit 0x92eae264 -[NSApplication terminate:] +
0x1c4
8 com.apple.AppKit 0x92e77ac0 -[NSApplication
sendAction:to:from:] + 0x6c
9 com.apple.AppKit 0x92ead30c -[NSMenu
performActionForItemAtIndex:] + 0x188
10 com.apple.AppKit 0x92ef1c2c -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] + 0x68
11 com.apple.AppKit 0x92ef855c -[NSMenu
performKeyEquivalent:] + 0x104
12 com.apple.AppKit 0x92ed7594 -[NSApplication
_handleKeyEquivalent:] + 0x124
13 com.apple.AppKit 0x92df4ec4 -[NSApplication sendEvent:] +
0xa5c
14 com.apple.AppKit 0x92dfd73c -[NSApplication run] + 0x240
15 com.apple.AppKit 0x92eb9b80 NSApplicationMain + 0x1d0
16 com.apple.TextEdit 0x00007d98 0x1000 + 0x6d98
17 com.apple.TextEdit 0x00007c0c 0x1000 + 0x6c0c
I've been using TextEdit as my test application although the same has
happened with Console.
I've read the posts in this list's archive so with any luck, this isn't
something that's come up before and I just missed it.
Thank you for any help,
Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >InputManagers (From: Steve Checkoway <email@hidden>) |