void ZLWin32ApplicationWindow::refresh() {
	ZLDesktopApplicationWindow::refresh();

	if (!isFullscreen()) {
		myToolbarInfo.cxIdeal = 0;
	}
}
void ZLWin32ApplicationWindow::runPopup(const NMTOOLBAR &nmToolbar) {
	Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR);
	if (tb.hwnd == 0) {
		return;
	}
	ZLToolbar::ItemPtr item = tb.TBItemByActionCode[nmToolbar.iItem];
	if (!item.isNull()) {
		const ZLToolbar::MenuButtonItem &button =
			(const ZLToolbar::MenuButtonItem&)*item;
		shared_ptr<ZLPopupData> popupData = button.popupData();
		if (!popupData.isNull()) {
			const int count = popupData->count();
			if (count != 0) {
				myPopupMenu = new ZLWin32PopupMenu(myMainWindow);
				for (int i = 0; i < count; ++i) {
					myPopupMenu->addItem(popupData->text(i), 0, true);
				}
				POINT p;
				p.x = nmToolbar.rcButton.left;
				p.y = nmToolbar.rcButton.bottom + 6;
				ClientToScreen(myMainWindow, &p);
				int code = myPopupMenu->run(p);
				if (code > 0) {
					popupData->run(code - 1);
				}
				myPopupMenu.reset();
			}
		}
	}
}
Ejemplo n.º 3
0
bool BasisManager::keyPressed( const OIS::KeyEvent &arg )
{
	// меняем оконный режим по Alt+Enter
	if (arg.key == OIS::KC_RETURN) {
		if (mInput->isKeyDown(OIS::KC_RMENU)) {
			setFullscreen(!isFullscreen());
			return true;
		}
	}
	if ( arg.key == OIS::KC_SYSRQ ) {
		std::ifstream stream;
		std::string file;
		do {
			stream.close();
			static size_t num = 0;
			const size_t max_shot = 100;
			if (num == max_shot) {
				MYGUI_LOG(Info, "The limit of screenshots is exceeded : " << max_shot);
				return true;
			}
			file = MyGUI::utility::toString("screenshot_", ++num, ".png");
			stream.open(file.c_str());
		} while (stream.is_open());
		mWindow->writeContentsToFile(file);
		return true;
	}

	return mStates.back()->keyPressed(arg);
}
Ejemplo n.º 4
0
/**
 * Updates the checkbox when the view settings were changed.
 */
void View::updateFullscreen()
{
	auto settings = ::FourInALine::getInstance()->getSettings();
	auto viewSettings = settings->getViewSettings();

	bool isFullscreen = viewSettings->isFullscreen();
	this->fullscreenCheckboxAction->setChecked(isFullscreen);
}
void ZLEwlApplicationWindow::setFullscreen(bool fullscreen) {
	if (fullscreen == isFullscreen()) {
		return;
	}

	if (fullscreen) {
	} else {
	}
}
Ejemplo n.º 6
0
void Chimera_X11::setFullscreen( bool fs )
{
    if( m_quickViewPtr && m_pluginWindow ) {
        if( fs && !isFullscreen() ) {
            m_quickViewPtr->hide();
            m_quickViewPtr->setParent( 0 );
            m_quickViewPtr->showFullScreen();
            Q_EMIT fullscreenChanged( true );
        } else if( !fs && isFullscreen() ) {
            m_quickViewPtr->showNormal();
            m_quickViewPtr->hide();
            m_quickViewPtr->setParent( m_pluginWindow.data() );
            onWindowResized( 0, static_cast<FB::PluginWindowX11*>( GetWindow() ) );
            m_quickViewPtr->requestActivate();
            Q_EMIT fullscreenChanged( false );
        }
    }
}
Ejemplo n.º 7
0
void FullscreenController::updateSize()
{
    if (!isFullscreen())
        return;

    RenderFullScreen* renderer = Fullscreen::from(*m_fullScreenFrame->document()).fullScreenRenderer();
    if (renderer)
        renderer->updateStyle();
}
	void WindowGL33::setFullscreen(bool fullscreen)
	{
		if (isFullscreen() && !fullscreen)
		{
			this->setPos(m_windowedX, m_windowedY);
			this->setSize(m_windowedWidth, m_windowedHeight);
		}
		else if (!isFullscreen() && fullscreen)
		{
			m_windowedWidth = getFrameWidth();
			m_windowedHeight = getFrameHeight();
			m_windowedX = getX();
			m_windowedY = getY();
			this->setPos(0, 0);
			this->setSize(m_fullscreenWidth, m_fullscreenHeight);
		}
		m_isFullscreen = fullscreen;
	}
void Window::forceFullscreenMode()
{
    if (!isFullscreen())
    {
        makeFullscreen();

        SDL_SetWindowSize(window, dimensions.w, dimensions.h);
        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
    }
}
void FullscreenController::updateSize()
{
    if (!isFullscreen())
        return;

    updatePageScaleConstraints(false);

    LayoutFullScreen* layoutObject = Fullscreen::from(*m_fullScreenFrame->document()).fullScreenLayoutObject();
    if (layoutObject)
        layoutObject->updateStyle();
}
Ejemplo n.º 11
0
void Window::create()
{
    if (isFullscreen() && !mVideoMode.isValid())
    {
        mVideoMode = sf::VideoMode::getFullscreenModes()[0];
    }
    sf::RenderWindow::create(mVideoMode,mTitle,mStyle);
    setMouseCursor(mCursor);
    updateBackground();
    mVisible = true;
}
void Window::forceFullscreenMode(int w, int h)
{
    if (!isFullscreen())
    {
        fullscreen = true;
        setSize(w, h);

        SDL_SetWindowPosition(window, 0, 0);
        SDL_SetWindowSize(window, w, h);
        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
    }
}
void Window::forceWindowedMode()
{
    if (isFullscreen())
    {
        fullscreen = false;
        setSize(1280, 720);

        SDL_SetWindowSize(window, 1280, 720);
        SDL_SetWindowFullscreen(window, NULL);
        SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
    }
}
Ejemplo n.º 14
0
void Window::save(std::string const& filename)
{
    pugi::xml_document doc;
    doc.load_file(filename.c_str());
    if (doc.child("Window"))
    {
        doc.remove_child("Window");
    }
    pugi::xml_node window = doc.append_child("Window");
    window.append_child("VerticalSync").append_attribute("value") = mVerticalSync;
    window.append_child("Fullscreen").append_attribute("value") = isFullscreen();
    window.append_child("Resolution").append_attribute("value") = std::string(std::to_string(mVideoMode.width) + "," + std::to_string(mVideoMode.height)).c_str();
    doc.save_file(filename.c_str());
}
Ejemplo n.º 15
0
/**
 * Create all actions and connect them.
 */
void View::createActions()
{
	auto settings = ::FourInALine::getInstance()->getSettings();
	auto viewSettings = settings->getViewSettings();

	QIcon fullscreenCheckboxIcon;
	fullscreenCheckboxIcon.addFile(":/icons/fatcow/16x16/monitor.png", QSize(16, 16));
	fullscreenCheckboxIcon.addFile(":/icons/fatcow/32x32/monitor.png", QSize(32, 32));
	this->fullscreenCheckboxAction = new QAction(fullscreenCheckboxIcon, "", this);
	this->fullscreenCheckboxAction->setCheckable(true);
	this->fullscreenCheckboxAction->setChecked(viewSettings->isFullscreen());

	this->connect(this->fullscreenCheckboxAction, &QAction::triggered, this, &View::changeFullscreen);
}
Ejemplo n.º 16
0
bool Chimera_X11::onWindowResized( FB::ResizedEvent*, FB::PluginWindowX11* w )
{
    const int newWidth = w->getWindowWidth();
    const int newHeight = w->getWindowHeight();
    if( m_quickViewPtr && !isFullscreen() ) {
        if( newWidth > 0 && newHeight > 0 ) {
            if( !m_quickViewPtr->isVisible() )
                m_quickViewPtr->show();
            m_quickViewPtr->setX( 0 ); m_quickViewPtr->setY( 0 );
            m_quickViewPtr->resize( newWidth, newHeight );
        } else
            m_quickViewPtr->hide();
    }

    return false;
}
Ejemplo n.º 17
0
void ZLWin32ApplicationWindow::setTooltip(TOOLTIPTEXT &tooltip) {
	Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR);
	if (tb.hwnd == 0) {
		return;
	}
	ZLToolbar::ItemPtr item = tb.TBItemByActionCode[tooltip.hdr.idFrom];
	if (!item.isNull()) {
		const ZLToolbar::AbstractButtonItem &button =
			(const ZLToolbar::AbstractButtonItem&)*item;
		ZLUnicodeUtil::Ucs2String tooltipBuffer;
		::createNTWCHARString(tooltipBuffer, button.tooltip());
		size_t length = std::max(tooltipBuffer.size(), (size_t)80);
		memcpy((char*)tooltip.szText, (char*)::wchar(tooltipBuffer), 2 * length);
		tooltip.uFlags = TTF_DI_SETITEM;
	}
}
ZLQtApplicationWindow::~ZLQtApplicationWindow() {
	if (isFullscreen()) {
		myWindowStateOption.setValue(FULLSCREEN);
	} else if (isMaximized()) {
		myWindowStateOption.setValue(MAXIMIZED);
	} else {
		myWindowStateOption.setValue(NORMAL);
		if (x() != -1) {
			myXOption.setValue(x());
		}
		if (y() != -1) {
			myYOption.setValue(y());
		}
		myWidthOption.setValue(width());
		myHeightOption.setValue(height());
	}
}
Ejemplo n.º 19
0
bool NaClApplication::setFullscreen(bool enabled) {
    /* Given fullscreen mode already set or switching to it is in progress, done */
    if(isFullscreen() == enabled || ((_flags & Flag::FullscreenSwitchInProgress) && (_flags & Flag::WillBeFullscreen) == enabled))
        return true;

    /* Switch to opposite fullscreen mode is in progress, can't revert it back */
    if((_flags & Flag::FullscreenSwitchInProgress) && (_flags & Flag::WillBeFullscreen) != enabled)
        return false;

    /* Set fullscreen */
    if(!_fullscreen->SetFullscreen(enabled))
        return false;

    /* Set flags */
    _flags |= Flag::FullscreenSwitchInProgress;
    enabled ? _flags |= Flag::WillBeFullscreen : _flags &= ~Flag::WillBeFullscreen;
    return true;
}
Ejemplo n.º 20
0
void ZLWin32ApplicationWindow::onToolbarButtonRelease(int actionCode) {
	Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR);
	if (tb.hwnd == 0) {
		return;
	}
	std::map<int,ZLToolbar::ItemPtr>::const_iterator it = tb.TBItemByActionCode.find(actionCode);
	if ((it == tb.TBItemByActionCode.end()) || it->second.isNull()) {
		return;
	}
		
	switch (it->second->type()) {
		default:
			break;
		case ZLToolbar::Item::PLAIN_BUTTON:
		case ZLToolbar::Item::MENU_BUTTON:
		case ZLToolbar::Item::TOGGLE_BUTTON:
			onButtonPress((ZLToolbar::AbstractButtonItem&)*it->second);
			break;
	}
}
Ejemplo n.º 21
0
ZLQtApplicationWindow::~ZLQtApplicationWindow() {
	if (isFullscreen()) {
		myWindowStateOption.setValue(FULLSCREEN);
	} else if (isMaximized()) {
		myWindowStateOption.setValue(MAXIMIZED);
	} else {
		myWindowStateOption.setValue(NORMAL);
		QPoint position = pos();
		if (position.x() != -1) {
			myXOption.setValue(position.x());
		}
		if (position.y() != -1) {
			myYOption.setValue(position.y());
		}
		myWidthOption.setValue(width());
		myHeightOption.setValue(height());
	}
	for (std::map<const ZLToolbar::Item*,QAction*>::iterator it = myActions.begin(); it != myActions.end(); ++it) {
		if (it->second != 0) {
			delete it->second;
		}
	}
}
Ejemplo n.º 22
0
void NaClApplication::DidChangeView(const pp::View& view) {
    /* Fullscreen switch in progress */
    if(_flags & Flag::FullscreenSwitchInProgress) {
        /* Done, remove the progress flag */
        if(isFullscreen() == bool(_flags & Flag::WillBeFullscreen)) {
            _flags &= ~Flag::FullscreenSwitchInProgress;
            _flags |= Flag::Redraw;
        }

        /* Don't process anything during the switch */
        else return;
    }

    Vector2i size(view.GetRect().width(), view.GetRect().height());

    /* Canvas resized */
    if(_viewportSize != size) {
        _graphics->ResizeBuffers(size.x(), size.y());
        viewportEvent(_viewportSize = size);
    }

    drawEvent();
}
Ejemplo n.º 23
0
	bool Window::setFullscreen(bool _fullscreen){
		if (isFullscreen() == _fullscreen)
			return 1;

		DWORD style = GetWindowLong(m_hwnd, GWL_STYLE);
		if (_fullscreen){
			MONITORINFO mi = { sizeof(mi) };
			if (GetWindowPlacement(m_hwnd, &m_windowPlacement) && GetMonitorInfo(MonitorFromWindow(m_hwnd, MONITOR_DEFAULTTOPRIMARY), &mi)){
				SetWindowLong(m_hwnd, GWL_STYLE, style & ~WS_OVERLAPPEDWINDOW);
				SetWindowPos(m_hwnd, HWND_TOP,
					mi.rcMonitor.left, mi.rcMonitor.top,
					mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top,
					SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
				return 1;
			}
			return 0;
		}
		else{
			SetWindowLong(m_hwnd, GWL_STYLE, style | WS_OVERLAPPEDWINDOW);
			SetWindowPlacement(m_hwnd, &m_windowPlacement);
			SetWindowPos(m_hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
		}
		return 1;
	}
Ejemplo n.º 24
0
bool QWaylandWindow::createDecoration()
{
    // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere
    if (mState == Qt::WindowMinimized) {
        QWaylandXdgSurface *xdgSurface = dynamic_cast<QWaylandXdgSurface *>(mShellSurface);
        if ( xdgSurface ) {
            if (xdgSurface->isFullscreen()) {
                setWindowStateInternal(Qt::WindowFullScreen);
            } else if (xdgSurface->isMaximized()) {
                setWindowStateInternal(Qt::WindowMaximized);
            } else {
                setWindowStateInternal(Qt::WindowNoState);
            }
        }
    }

    if (!mDisplay->supportsWindowDecoration())
        return false;

    static bool decorationPluginFailed = false;
    bool decoration = false;
    switch (window()->type()) {
        case Qt::Window:
        case Qt::Widget:
        case Qt::Dialog:
        case Qt::Tool:
        case Qt::Drawer:
            decoration = true;
            break;
        default:
            break;
    }
    if (window()->flags() & Qt::FramelessWindowHint || isFullscreen())
        decoration = false;
    if (window()->flags() & Qt::BypassWindowManagerHint)
        decoration = false;

    if (decoration && !decorationPluginFailed) {
        if (!mWindowDecoration) {
            QStringList decorations = QWaylandDecorationFactory::keys();
            if (decorations.empty()) {
                qWarning() << "No decoration plugins available. Running with no decorations.";
                decorationPluginFailed = true;
                return false;
            }

            QString targetKey;
            QByteArray decorationPluginName = qgetenv("QT_WAYLAND_DECORATION");
            if (!decorationPluginName.isEmpty()) {
                targetKey = QString::fromLocal8Bit(decorationPluginName);
                if (!decorations.contains(targetKey)) {
                    qWarning() << "Requested decoration " << targetKey << " not found, falling back to default";
                    targetKey = QString(); // fallthrough
                }
            }

            if (targetKey.isEmpty())
                targetKey = decorations.first(); // first come, first served.


            mWindowDecoration = QWaylandDecorationFactory::create(targetKey, QStringList());
            if (!mWindowDecoration) {
                qWarning() << "Could not create decoration from factory! Running with no decorations.";
                decorationPluginFailed = true;
                return false;
            }
            mWindowDecoration->setWaylandWindow(this);
            if (subSurfaceWindow()) {
                subSurfaceWindow()->adjustPositionOfChildren();
            }
        }
    } else {
        delete mWindowDecoration;
        mWindowDecoration = 0;
    }

    return mWindowDecoration;
}
Ejemplo n.º 25
0
QApplicationWindow::~QApplicationWindow() {
	if (!isFullscreen() && !isMaximized()) {
		myWidthOption.setValue(width());
		myHeightOption.setValue(height());
	}
}
Ejemplo n.º 26
0
void
Gui::notify_key_event(gnash::key::code k, int modifier, bool pressed) 
{

    // Handle GUI shortcuts
    if (pressed) {
        if (k == gnash::key::ESCAPE) {
            if (isFullscreen()) {
                _stage->setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL);
            }
        }
	
        if (modifier & gnash::key::GNASH_MOD_CONTROL) {
            switch (k) {
              case gnash::key::o:
              case gnash::key::O:
                  takeScreenShot();
                  break;
              case gnash::key::r:
              case gnash::key::R:
                  restart();
                  break;
              case gnash::key::p:
              case gnash::key::P:
                  pause();
                  break;
              case gnash::key::l:
              case gnash::key::L:
                  refreshView();
                  break;
              case gnash::key::q:
              case gnash::key::Q:
              case gnash::key::w:
              case gnash::key::W:
                  quit();
                  break;
              case gnash::key::f:
              case gnash::key::F:
                  toggleFullscreen();
                  break;
              case gnash::key::h:
              case gnash::key::H:
                  showUpdatedRegions(!showUpdatedRegions());
                  break;
              case gnash::key::MINUS:
              {
                  // Max interval allowed: 1 second (1FPS)
                  const size_t ni = std::min<size_t>(_interval + 2, 1000u);
                  setInterval(ni);
                  break;
              }
              case gnash::key::PLUS:
              {
                  // Min interval allowed: 1/100 second (100FPS)
                  const size_t ni = std::max<size_t>(_interval - 2, 10u);
                  setInterval(ni);
                  break;
              }
              case gnash::key::EQUALS:
              {
                  if (_stage) {
                      const float fps = _stage->getRootMovie().frameRate();
                      // Min interval allowed: 1/100 second (100FPS)
                      const size_t ni = 1000.0/fps;
                      setInterval(ni);
                  }
                  break;
              }
              default:
                  break;
            }
            
#ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
            if ( _keyboardMouseMovements ) {
                int step = _keyboardMouseMovementsStep; 
                // x5 if SHIFT is pressed
                if (modifier & gnash::key::GNASH_MOD_SHIFT) step *= 5; 
                switch (k) {
                  case gnash::key::UP:
                  {
                      int newx = _xpointer;
                      int newy = _ypointer-step;
                      if ( newy < 0 ) newy=0;
                      notifyMouseMove(newx, newy);
                      break;
                  }
                  case gnash::key::DOWN:
                  {
                      int newx = _xpointer;
                      int newy = _ypointer+step;
                      if ( newy >= _height ) newy = _height-1;
                      notifyMouseMove(newx, newy);
                      break;
                  }
                  case gnash::key::LEFT:
                  {
                      int newx = _xpointer-step;
                      int newy = _ypointer;
                      if ( newx < 0 ) newx = 0;
                      notifyMouseMove(newx, newy);
                      break;
                  }
                  case gnash::key::RIGHT:
                  {
                      const int newy = _ypointer;
                      int newx = _xpointer + step;
                      if ( newx >= _width ) newx = _width-1;
                      notifyMouseMove(newx, newy);
                      break;
                  }
                  default:
                      break;
                }
            }
#endif // ENABLE_KEYBOARD_MOUSE_MOVEMENTS
        }
    }
    
    if (!_started) return;
    
    if (_stopped) return;
    
    if (_stage->keyEvent(k, pressed)) {
        // any action triggered by the
        // event required screen refresh
        display(_stage);
    }
    
}
Ejemplo n.º 27
0
void ShellSurface::move(Seat *seat)
{
    if (isFullscreen()) {
        return;
    }

    class MoveGrab : public PointerGrab
    {
    public:
        void motion(uint32_t time, Pointer::MotionEvent evt) override
        {
            pointer()->move(evt);
            QPointF pos = pointer()->motionToAbs(evt);

            Output *out = grabbedView->output();
            QRect surfaceGeometry = shsurf->geometry();

            int moveX = pos.x() + dx;
            int moveY = pos.y() + dy;

            QPointF p = QPointF(moveX, moveY);

            QPointF br = p + surfaceGeometry.bottomRight();
            if (shsurf->m_shell->snapPos(out, br)) {
                p = br - surfaceGeometry.bottomRight();
            }

            QPointF tl = p + surfaceGeometry.topLeft();
            if (shsurf->m_shell->snapPos(out, tl)) {
                p = tl - surfaceGeometry.topLeft();
            }

            shsurf->moveViews((int)p.x(), (int)p.y());
        }
        void button(uint32_t time, PointerButton button, Pointer::ButtonState state) override
        {
            if (pointer()->buttonCount() == 0 && state == Pointer::ButtonState::Released) {
                end();
            }
        }
        void ended() override
        {
            shsurf->m_currentGrab = nullptr;
            delete this;
        }

        ShellSurface *shsurf;
        View *grabbedView;
        double dx, dy;
    };

    MoveGrab *move = new MoveGrab;

    View *view = seat->pointer()->pickView()->mainView();
    move->dx = view->x() - seat->pointer()->x();
    move->dy = view->y() - seat->pointer()->y();
    move->shsurf = this;
    move->grabbedView = view;

    move->start(seat, PointerCursor::Move);
    m_currentGrab = move;
}