mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Update window.h
Fix: error when current window is minimized
This commit is contained in:
parent
ef191f2dfd
commit
de675b4dd2
@ -367,11 +367,11 @@ MData get_active(void) {
|
|||||||
if (focused == NULL) { return result; } // Verify
|
if (focused == NULL) { return result; } // Verify
|
||||||
|
|
||||||
AXUIElementRef element;
|
AXUIElementRef element;
|
||||||
|
CGWindowID win = 0;
|
||||||
// Retrieve the currently focused window
|
// Retrieve the currently focused window
|
||||||
if (AXUIElementCopyAttributeValue(focused, kAXFocusedWindowAttribute, (CFTypeRef*) &element)
|
if (AXUIElementCopyAttributeValue(focused, kAXFocusedWindowAttribute, (CFTypeRef*) &element)
|
||||||
== kAXErrorSuccess && element) {
|
== kAXErrorSuccess && element) {
|
||||||
|
|
||||||
CGWindowID win = 0;
|
|
||||||
// Use undocumented API to get WID
|
// Use undocumented API to get WID
|
||||||
if (_AXUIElementGetWindow(element, &win) == kAXErrorSuccess && win) {
|
if (_AXUIElementGetWindow(element, &win) == kAXErrorSuccess && win) {
|
||||||
// Manually set internals
|
// Manually set internals
|
||||||
@ -380,6 +380,9 @@ MData get_active(void) {
|
|||||||
} else {
|
} else {
|
||||||
CFRelease(element);
|
CFRelease(element);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
result.CgID = win;
|
||||||
|
result.AxID = element;
|
||||||
}
|
}
|
||||||
CFRelease(focused);
|
CFRelease(focused);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user