• 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
Accessibility API - moving and resizing windows (in one API call)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessibility API - moving and resizing windows (in one API call)


  • Subject: Accessibility API - moving and resizing windows (in one API call)
  • From: John Clayton <email@hidden>
  • Date: Sun, 11 Nov 2007 22:42:24 +0100

Hello All,

I have an app that moves and resizes windows around, via the Accessibility API.

I'd like to know if there is a way to make the window manager move *and* resize a window all in one go, rather than in two stages. The reason I ask this is that while the window server is very quick etc, when these two operations occur very frequently (i.e. on every mouse movement) there is a very noticeable jarring / flickering going on simply because these two operations are not an atomic operation as far as the window server goes.

(at least, that's my take on it).

Here's the code I currently have in my app, that uses the Accessibility API to move and resize a window:

_topLevelUIElementPosition - is the AXUIElementRef pointing to a window that I want to move/resize (or both)
mouseDelta - the distance that the mouse has moved since the button went down


// depending on quadrant, the resize is achieved in different ways
switch(_resizeQuadrant)
{
case kZWQBottomLeft:
{
CGPoint absWinPos = CGPointMake(_topLevelUIElementPosition.x + mouseDelta.x,
_topLevelUIElementPosition.y);

CFTypeRef newLocRef = AXValueCreate(kAXValueCGPointType, (void *)&absWinPos);
AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXPositionAttribute, newLocRef) );
CFRelease(newLocRef);

CGSize absSizeNow = CGSizeMake(_topLevelUIElementSize.width - mouseDelta.x,
_topLevelUIElementSize.height + mouseDelta.y);

CFTypeRef newSizeRef = AXValueCreate(kAXValueCGSizeType, (void *)&absSizeNow);
AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXSizeAttribute, newSizeRef) );
CFRelease(newSizeRef);
}
break;

case kZWQTopRight:

The two important lines in this case are the re-positioning of an application window, and the resizing of it:


AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXPositionAttribute, newLocRef) );
AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXSizeAttribute, newSizeRef) );


I'd love to somehow say something like this:
* window server: do all the following stuff in one atomic op / begin transaction *


AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXPositionAttribute, newLocRef) );

AXCALL_LOG( AXUIElementSetAttributeValue(_topLevelUIElement, kAXSizeAttribute, newSizeRef) );

* window server: end of stuff that I want done in one transaction / go do it now *

Does anyone know of a way that I could achieve this? Thanks in advance, I'm happy to expound more about this as required.

--
John Clayton
http://www.coderage-software.com/



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Accessibility API - moving and resizing windows (in one API call)
      • From: Manfred Schwind <email@hidden>
  • Prev by Date: Re: Floating window across all Spaces?
  • Next by Date: Re: NSCell copyWithZone producing EXC_BAD_ACCESS
  • Previous by thread: Spaces + AXUI API (accessibility)
  • Next by thread: Re: Accessibility API - moving and resizing windows (in one API call)
  • Index(es):
    • Date
    • Thread