int fb_hXTermHasFocus(void) { #ifndef DISABLE_X11 Window focus_window; int dummy; X.GetInputFocus(display, &focus_window, &dummy); return (focus_window == xterm_window); #else return 0; #endif }
int fb_hXTermInitFocus(void) { #ifndef DISABLE_X11 const char *funcs[] = { "XOpenDisplay", "XCloseDisplay", "XGetInputFocus", NULL }; int dummy; ref_count++; if (ref_count > 1) return 0; xlib = fb_hDynLoad("libX11.so", funcs, (void **)&X); if (!xlib) return -1; display = X.OpenDisplay(NULL); if (!display) return -1; X.GetInputFocus(display, &xterm_window, &dummy); #endif return 0; }