Hi,
I am working as part of a research group attempting to design and build a cross platform system for dynamically altering the UI of applications. As part of this we are attempting to build some small proof of concept applications to judge what can and can't be done on various systems. One of these is an application to deal with the problem of messages popping up outside of the users view.
As an example, a visually impaired user interacting with the computer using the Universal Access Zoom feature. They start a file copy operation using the Finder, then move their focus to another application in a different part of the screen. While they work in this application Finder encounters an error and pops up an error dialog, but on an area of the screen outside of the users current zoomed in view. The user may not find out about this error until some time later when they move the zoomed view again.
What we would like to do is to offer the user the ability to either: 1) Have the zoomed view automatically move to the area where the pop-up window was created. or 2) Have the pop-up window be moved to the area that the user can currently see.
I have managed to use the Accessibility API to detect when new windows are created and will hopefully be able to filter these to work out which windows we are actually interested in. I can also use the Accessibility API to move these windows to a location of my choosing. However, I have come across some issues.
I cannot work out how to move the zoom view. I found the function UAZoomChangeFocus, which sounds like it will do exactly what I want. Unfortunately though when I call it with the rect I wish to move to, nothing happens. The function returns 'noErr' but the screen focus never changes. I resorted to attempting to move the mouse pointer to get the zoom view to follow it, but this option has it's own issues. I used CGEventCreateMouseEvent to create a MouseMoved event but it interprets the point as actual screen pixels as opposed to points in the global context. So giving it a point of (100,100) the mouse pointer appears 100 pixels from the top and left of the screen containing the zoomed view, instead of moving the zoomed view to be looking at the area near the Apple menu as I would expect. Additionally, unless the zoom movement options are set to keep the mouse at the center of the view then the moment the user moves the mouse again, it jumps back to where it was.
I also can't work out how to find the screen area that is currently being zoomed in on. And therefore cannot know where to move a window to so that the user can see it. I have tried CGDisplayBounds, [NSScreen frame], [NSScreen visibleFrame], all of them return the global visible area as opposed to the area in the zoom focus. I have also tried getting the location of the mouse pointer using CGEventGetLocation, which gives me an exact floating point co-ordinate of the mouse pointer e.g. (1311.447388,821.671082), but I'm not sure this is any good to me unless I can find a way to translate that into a pixel position as well.
Summary: I need to find a way to move the focus of the Universal Access Zoom feature. I need to find a way to find the current focus area of the Universal Access Zoom feature.
Thanks in advance for any help you can provide.
Kind Regards,
Adam. |