Re: Stop dragging my <NSWindow> around
Re: Stop dragging my <NSWindow> around
- Subject: Re: Stop dragging my <NSWindow> around
- From: Daniel Stødle <email@hidden>
- Date: Fri, 4 Feb 2005 18:35:00 +0100
Hi,
You can prevent the window server from handling your drag as follows.
Note that this uses an undocumented, private Apple API, so all the
usual warnings about doing that kind of thing apply.
SnappingWindow.m:
extern OSStatus CGSClearDragRegionInWindow(int cid, int wid);
extern int _CGSDefaultConnection(void);
@implementation SnappingWindow
- (void)makeMeBeInControlOfMyDrags:(id)sender {
int cid, wid;
cid = _CGSDefaultConnection();
wid = [self windowNumber];
if (cid != -1 && wid != -1)
CGSClearDragRegionInWindow(cid, wid);
}
@end
SnappingWindow is a subclass of NSWindow. In addition to your
sendEvent-logic, you should now be able to drag the window on your own,
without messing with a fake titlebar or any of those things. Note that
Cocoa (or the window server?) seems to reset the drag region fairly
often - it'll be reset after the window has been minimized to the Dock,
for instance. The same thing probably applies to other operations as
well (resizing, closing the window, etc).
Hope this helps!
Daniel Stødle, Yellow Lemon Software
Web: http://home.online.no/~stoedle/YLS/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden