Exemplo n.º 1
0
/**
 * @brief Switch window fullscreen state.
 *
 *        Switch normal window to fullscreen and fullscreen window to normal.
 *
 * @param win pointer to a ws window structure
 */
void wsWindowFullscreen(wsWindow *win)
{
    if (win->isFullScreen) {
        if (vo_fs_type & vo_wm_FULLSCREEN)
            /* window manager supports EWMH */
            vo_x11_ewmh_fullscreen(win->WindowID, _NET_WM_STATE_REMOVE);
        else {
            win->X      = win->OldX;
            win->Y      = win->OldY;
            win->Width  = win->OldWidth;
            win->Height = win->OldHeight;
        }

        win->isFullScreen = False;
    } else {
        if (vo_fs_type & vo_wm_FULLSCREEN)
            /* window manager supports EWMH */
            vo_x11_ewmh_fullscreen(win->WindowID, _NET_WM_STATE_ADD);
        else {
            win->OldX      = win->X;
            win->OldY      = win->Y;
            win->OldWidth  = win->Width;
            win->OldHeight = win->Height;
        }

        win->isFullScreen = True;

        wsWindowUpdateXinerama(win);
    }

    /* unknown window manager and obsolete option -fsmode used */
    if (vo_wm_type == 0 && !(vo_fsmode & 16)) {
        XUnmapWindow(wsDisplay, win->WindowID); // required for MWM
        XWithdrawWindow(wsDisplay, win->WindowID, wsScreen);
    }

    /* restore window if window manager doesn't support EWMH */
    if (!(vo_fs_type & vo_wm_FULLSCREEN)) {
        if (!win->isFullScreen)
            wsWindowDecoration(win);

        wsWindowSizeHint(win);
        wsWindowLayer(wsDisplay, win->WindowID, win->isFullScreen);
        XMoveResizeWindow(wsDisplay, win->WindowID, win->X, win->Y, win->Width, win->Height);
    }

    /* some window managers lose ontop after fullscreen */
    if (!win->isFullScreen & vo_ontop)
        wsWindowLayer(wsDisplay, win->WindowID, vo_ontop);

    wsWindowRaiseTop(wsDisplay, win->WindowID);
    XFlush(wsDisplay);
}
Exemplo n.º 2
0
// ----------------------------------------------------------------------------------------------
//    Switch to fullscreen.
// ----------------------------------------------------------------------------------------------
void wsFullScreen(wsTWindow *win)
{
    int decoration = 0;

    if (win->isFullScreen) {
        vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH

        if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
            win->X      = win->OldX;
            win->Y      = win->OldY;
            win->Width  = win->OldWidth;
            win->Height = win->OldHeight;
            decoration  = win->Decorations;
        }

#ifdef ENABLE_DPMS
        wsScreenSaverOn(wsDisplay);
#endif

        win->isFullScreen = False;
    } else {
        if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
            win->OldX      = win->X;
            win->OldY      = win->Y;
            win->OldWidth  = win->Width;
            win->OldHeight = win->Height;
            vo_dx           = win->X;
            vo_dy           = win->Y;
            vo_dwidth       = win->Width;
            vo_dheight      = win->Height;
            vo_screenwidth  = wsMaxX;
            vo_screenheight = wsMaxY;
            xinerama_x      = wsOrgX;
            xinerama_y      = wsOrgY;
            update_xinerama_info();
            wsMaxX      = vo_screenwidth;
            wsMaxY      = vo_screenheight;
            wsOrgX      = xinerama_x;
            wsOrgY      = xinerama_y;
            win->X      = wsOrgX;
            win->Y      = wsOrgY;
            win->Width  = wsMaxX;
            win->Height = wsMaxY;
        }

        win->isFullScreen = True;
#ifdef ENABLE_DPMS
        wsScreenSaverOff(wsDisplay);
#endif

        vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD); // adds fullscreen state if wm supports EWMH
    }

    if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
        vo_x11_decoration(wsDisplay, win->WindowID, decoration);
        vo_x11_sizehint(win->X, win->Y, win->Width, win->Height, 0);
        vo_x11_setlayer(wsDisplay, win->WindowID, win->isFullScreen);

        if ((!(win->isFullScreen)) & vo_ontop)
            vo_x11_setlayer(wsDisplay, win->WindowID, 1);

        XMoveResizeWindow(wsDisplay, win->WindowID, win->X, win->Y, win->Width, win->Height);
    }

    if (vo_wm_type == 0 && !(vo_fsmode & 16)) {
        XWithdrawWindow(wsDisplay, win->WindowID, wsScreen);
    }

    XMapRaised(wsDisplay, win->WindowID);
    XRaiseWindow(wsDisplay, win->WindowID);
    XFlush(wsDisplay);
}