Terminal Resize Problem
Terminal Resize Problem
- Subject: Terminal Resize Problem
- From: "Smita Godbole" <email@hidden>
- Date: Tue, 14 Oct 2008 10:47:06 +0530
Hi all,
I am making a sample application where I have to resize different applications.
Here I'm facing a strange problem with Terminal Application (version 2.0.1) on Mac OS X 10.5.3
It works fine for all the dock sizes but when I change the dock size slightly bigger than smallest size it will not resize Terminal to the screen Size.
I had checked this issue in Tiger,its working fine, I think this problem is with Leopard.
So if anyone has any idea,please suggest whether Im missing something or doing something wrong.
Im attaching my sample code here.
Here Im iterating all the processes & finding Terminal than resizing it to the screen size.
Here after resizing some space is left in the top & bottom of Terminal.
//Sample Code
void IterateProcess()
{
OSErr processErr = noErr;
ProcessSerialNumber psn = {kNoProcess, kNoProcess};
//loop for the available processes
while( (processErr = GetNextProcess(&psn)) == noErr ) {
pid_t pid;
ProcessInfoRec info;
FSSpec fsSpec;
OSErr err = noErr;
GetProcessPID( &psn, &pid);
info.processNumber.highLongOfPSN = NULL ;
info.processNumber.lowLongOfPSN = kCurrentProcess ;
info.processInfoLength = sizeof(ProcessInfoRec);
info.processName = malloc(sizeof(char)*32);
info.processAppSpec = &fsSpec;
err = GetProcessInformation (&psn, &info);
if (err != noErr)
{
printf("Getting Process Inf in IterateProcesss()\n");
continue;
}
if(strstr(info.processName, "Terminal") != NULL)
{
printf("ReSiszing Terminal\n");
ResizeFocusedWindow(pid);
}
}//while
}
void ResizeFocusedWindow(pid_t pid)
{
OSStatus err;
AXUIElementRef focusedWndElement;
CGSize size;
CGPoint position;
CFTypeRef sizeRef,posRef;
int primaryscrwidth, primaryscrheight;
AXUIElementRef appElement = AXUIElementCreateApplication (pid);
err = AXUIElementCopyAttributeValue (appElement, kAXFocusedWindowAttribute, (CFTypeRef*) &focusedWndElement);
position = CGPointMake(0,0);
posRef = AXValueCreate(kAXValueCGPointType, (void *)&position);
CGDirectDisplayID mainDisId = CGMainDisplayID();
primaryscrwidth = CGDisplayPixelsWide (mainDisId);
primaryscrheight = CGDisplayPixelsHigh (mainDisId);
size = CGSizeMake(primaryscrwidth, primaryscrheight);
sizeRef = AXValueCreate(kAXValueCGSizeType, (void *)&size);
AXUIElementSetAttributeValue(focusedWndElement, kAXPositionAttribute, posRef);
AXUIElementSetAttributeValue(focusedWndElement, kAXSizeAttribute, sizeRef);
}
Thanks in Advance
Smita Godbole
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden