if (((long)nitems > 0) && (prop != IntPtr.Zero)) {
active = (IntPtr)Marshal.ReadInt32(prop);
XFree(prop);
+ } else {
+ // The window manager does not support _NET_ACTIVE_WINDOW. Fall back to XGetInputFocus.
+ IntPtr revert_to = IntPtr.Zero;
+ XGetInputFocus(DisplayHandle, out active, out revert_to);
}
if (active != IntPtr.Zero) {
[DllImport ("libX11", EntryPoint="XIfEvent")]
internal extern static void XIfEvent (IntPtr display, ref XEvent xevent, Delegate event_predicate, IntPtr arg);
+
+ [DllImport ("libX11", EntryPoint="XGetInputFocus")]
+ internal extern static void XGetInputFocus (IntPtr display, out IntPtr focus, out IntPtr revert_to);
#endregion
#endif
}