Esempio n. 1
0
bool DisplayManager::IsFullscreen(HWND hWnd) {
    HWND fg = GetForegroundWindow();
    if (hWnd == NULL || fg == NULL) {
        return false;
    }

    HWND shell = GetShellWindow();
    if (fg == shell) {
        return false;
    }

    HWND dt = GetDesktopWindow();
    if (fg == dt) {
        return false;
    }

    RECT wndRect = { 0 };
    GetWindowRect(fg, &wndRect);
    Monitor wm = MonitorAtWindow(hWnd);
    if ((wndRect.bottom - wndRect.top) == wm.Height() &&
            (wndRect.right - wndRect.left) == wm.Width()) {
        return true;
    }
    return false;
}
Esempio n. 2
0
File: OSD.cpp Progetto: tg44/3RVX
void OSD::PositionWindow(Monitor monitor, LayeredWnd &lWnd) {
    Settings::OSDPos pos = _settings->OSDPosition();

    if (pos == Settings::OSDPos::Custom) {
        int customX = _settings->OSDX();
        int customY = _settings->OSDY();
        lWnd.X(customX);
        lWnd.Y(customY);
        return;
    }

    int offset = _settings->OSDEdgeOffset();

    /* Edge cases ;-) */
    switch (pos) {
    case Settings::TopLeft:
        lWnd.X(monitor.X() + offset);
        lWnd.Y(monitor.Y() + offset);
        return;

    case Settings::TopRight:
        lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
        lWnd.Y(monitor.Y() + offset);
        return;

    case Settings::BottomLeft:
        lWnd.X(monitor.X() + offset);
        lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
        return;

    case Settings::BottomRight:
        lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
        lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
        return;
    }

    /* Center */
    CenterWindowX(monitor, lWnd);
    CenterWindowY(monitor, lWnd);
    if (pos == Settings::OSDPos::Center) {
        return;
    }

    /* We're centered. Now adjust based on top, bottom, left, or right: */

    switch (pos) {
    case Settings::Top:
        lWnd.Y(monitor.Y() + offset);
        return;

    case Settings::Bottom:
        lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
        return;

    case Settings::Left:
        lWnd.X(monitor.X() + offset);
        return;

    case Settings::Right:
        lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
        return;
    }
}
Esempio n. 3
0
File: OSD.cpp Progetto: tg44/3RVX
void OSD::CenterWindowX(Monitor monitor, LayeredWnd &lWnd) {
    lWnd.X(monitor.X() + monitor.Width() / 2 - lWnd.Width() / 2);
}