Compare commits

..

1 Commits

Author SHA1 Message Date
Blink-A
3d622980f2
Merge be5a13d7b3 into 48706562fc 2025-06-08 16:28:35 -07:00

View File

@ -24,26 +24,15 @@ Bounds get_bounds(uintptr pid, int8_t isPid){
AXValueRef axp = NULL;
AXValueRef axs = NULL;
AXUIElementRef AxID = AXUIElementCreateApplication(pid);
AXUIElementRef AxWin = NULL;
// Get the window from the application
if (AXUIElementCopyAttributeValue(AxID, kAXFocusedWindowAttribute, (CFTypeRef *)&AxWin)
!= kAXErrorSuccess || AxWin == NULL) {
// If no focused window, try to get the main window
if (AXUIElementCopyAttributeValue(AxID, kAXMainWindowAttribute, (CFTypeRef *)&AxWin)
!= kAXErrorSuccess || AxWin == NULL) {
goto exit;
}
}
// Determine the current point of the window
if (AXUIElementCopyAttributeValue(AxWin, kAXPositionAttribute, (CFTypeRef*) &axp)
if (AXUIElementCopyAttributeValue(AxID, kAXPositionAttribute, (CFTypeRef*) &axp)
!= kAXErrorSuccess || axp == NULL){
goto exit;
}
// Determine the current size of the window
if (AXUIElementCopyAttributeValue(AxWin, kAXSizeAttribute, (CFTypeRef*) &axs)
if (AXUIElementCopyAttributeValue(AxID, kAXSizeAttribute, (CFTypeRef*) &axs)
!= kAXErrorSuccess || axs == NULL){
goto exit;
}
@ -58,11 +47,10 @@ Bounds get_bounds(uintptr pid, int8_t isPid){
bounds.H = s.height;
}
// return bounds;
exit:
if (axp != NULL) { CFRelease(axp); }
if (axs != NULL) { CFRelease(axs); }
if (AxWin != NULL) { CFRelease(AxWin); }
if (AxID != NULL) { CFRelease(AxID); }
return bounds;
#elif defined(USE_X11)