void Overlay::toggleShow() { if (g.ocIntercept) { g.ocIntercept->hideGui(); } else { foreach(OverlayClient *oc, qlClients) { if (oc->uiPid) { #if defined(Q_OS_WIN) HWND hwnd = GetForegroundWindow(); DWORD pid = 0; GetWindowThreadProcessId(hwnd, &pid); if (pid != oc->uiPid) continue; #elif defined(Q_OS_MAC) pid_t pid = 0; ProcessSerialNumber psn; GetFrontProcess(&psn); GetProcessPID(&psn, &pid); if (pid != oc->uiPid) continue; #if 0 // Fullscreen only. if (! CGDisplayIsCaptured(CGMainDisplayID())) continue; #endif #endif oc->showGui(); return; } } } }
/* * xprAddPseudoramiXScreens * Add a single virtual screen encompassing all the physical screens * with PseudoramiX. */ static void xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScreen) { CGDisplayCount i, displayCount; CGDirectDisplayID *displayList = NULL; CGRect unionRect = CGRectNull, frame; // Find all the CoreGraphics displays CGGetActiveDisplayList(0, NULL, &displayCount); DEBUG_LOG("displayCount: %d\n", (int)displayCount); if(!displayCount) { ErrorF("CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n"); *x = *y = 0; *width = 800; *height = 600; PseudoramiXAddScreen(*x, *y, *width, *height); return; } /* If the displays are captured, we are in a RandR game mode * on the primary display, so we only want to include the first * display. The others are covered by the shield window. */ if (CGDisplayIsCaptured(kCGDirectMainDisplay)) displayCount = 1; displayList = malloc(displayCount * sizeof(CGDirectDisplayID)); if(!displayList) FatalError("Unable to allocate memory for list of displays.\n"); CGGetActiveDisplayList(displayCount, displayList, &displayCount); QuartzCopyDisplayIDs(pScreen, displayCount, displayList); /* Get the union of all screens */ for (i = 0; i < displayCount; i++) { CGDirectDisplayID dpy = displayList[i]; frame = displayScreenBounds(dpy); unionRect = CGRectUnion(unionRect, frame); } /* Use unionRect as the screen size for the X server. */ *x = unionRect.origin.x; *y = unionRect.origin.y; *width = unionRect.size.width; *height = unionRect.size.height; DEBUG_LOG(" screen union origin: (%d,%d) size: (%d,%d).\n", *x, *y, *width, *height); /* Tell PseudoramiX about the real screens. */ for (i = 0; i < displayCount; i++) { CGDirectDisplayID dpy = displayList[i]; frame = displayScreenBounds(dpy); frame.origin.x -= unionRect.origin.x; frame.origin.y -= unionRect.origin.y; DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n", (int)frame.origin.x, (int)frame.origin.y); PseudoramiXAddScreen(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); } free(displayList); }