• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Stop dragging my <NSWindow> around
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Resizing text views and flowing controls
  • Next by Date: Re: NSCalendarDate picker widget?
  • Previous by thread: Re: Stop dragging my <NSWindow> around
  • Next by thread: Re: Method not seeing array as array[solved]
  • Index(es):
    • Date
    • Thread