ken, thanx for your responses. i had already discovered and tried addLocalMonitorForEventsMatchingMask:handler: and as you point out in your second reply, it does not work because live resizing is running its own event loop.
overriding sendEvent would work if i detect a mouse down in the resize “box” and run my own event loop but: a) i’m not aware of a documented size for the resize “box”; and b) this would involve my re-implementing all the notifications and method calls associated with live resize drawing, and i don’t really want to have to do this. so… anyone have any other ideas as to how to get called for a modifier key change will in the midst of a live resize? thanx, ken On Jun 23, 2011, at 2:24 AM, Ken Tozier <kentoz...@comcast.net> wrote: > Date: Wed, 22 Jun 2011 17:48:20 -0400 > From: Ken Tozier <kentoz...@comcast.net> > Subject: Re: constrained window resizing > To: Cocoa Dev List List <cocoa-dev@lists.apple.com> > Message-ID: <93f00017-e4df-4638-9b44-ca558d1ad...@comcast.net> > Content-Type: text/plain; charset=windows-1252 > > In NSEvent docs, there's a section on "Monitoring Application Events" > (http://tinyurl.com/6enhj2g) and it looks like there is a flag you can set > (explained here: http://tinyurl.com/6jky52c) to receive notifications for > this sort of thing > > > On Jun 22, 2011, at 5:21 PM, Ken Victor wrote: > >> i‚ve got a subclass of NSWindow (MagneticWindow) that provides: >> - (NSSize) windowWillResize: (NSWindow*) sender toSize: (NSSize) >> frameSize; >> i use this to provide constrained live resizing of the window, i.e., if the >> shift key is down, the window will only resize in the horizontal or vertical >> direction (based on the mouse‚s position relative to where it was at mouse >> down time), and if the shift and control keys are both down, then the window >> will maintain its aspect ratio as it is resized. >> >> this is all working fine except for one minor point: i don‚t get called if >> any of the keys change their state (e.g., when the shift is let up) until >> the user moves the mouse. since the framework is running its own runloop for >> resizing, i don‚t see how to „hook in‰. and while this class has overridden >> sendEvent to provide its own runloop for dragging windows around (to provide >> similar constraining), i don‚t really want to have to do this for resizing >> as i‚m not sure of all the methods i would have to call to get live resizing >> drawing working properly. >> >> can anyone suggest a way i can get informed when any of the modifier keys >> change their state while in the midst of live resizing (without requiring >> mouse movement)? >> >> thanx, >> ken > and > Date: Wed, 22 Jun 2011 17:15:38 -0500 > From: Ken Thomases <k...@codeweavers.com> > Subject: Re: constrained window resizing > To: Ken Tozier <kentoz...@comcast.net> > Cc: Cocoa Dev List List <cocoa-dev@lists.apple.com> > Message-ID: <de6da287-f4cd-45d6-a743-a31f8e58b...@codeweavers.com> > Content-Type: text/plain; charset=us-ascii > > On Jun 22, 2011, at 4:48 PM, Ken Tozier wrote: > >> In NSEvent docs, there's a section on "Monitoring Application Events" >> (http://tinyurl.com/6enhj2g) and it looks like there is a flag you can set >> (explained here: http://tinyurl.com/6jky52c) to receive notifications for >> this sort of thing > > I don't think that will work because (from your first link): > >> Your handler will not be called for events that are consumed by nested >> event-tracking loops such as control tracking, menu tracking, or window >> dragging; only events that are dispatched through the applications >> sendEvent: method will be passed to your handler. > > Window resizing is just such a nested event-tracking loop. (Which is also > why the OP's thought of using -sendEvent: wouldn't help either.) > > Regards, > Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com