Skip to content

Commit

Permalink
Merge pull request #2 from palaeoware/fullscreen_test
Browse files Browse the repository at this point in the history
Fullscreen mode - partial fix for linux
  • Loading branch information
alanspencer committed Oct 22, 2018
2 parents bc451d6 + ef13a87 commit 912200c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
16 changes: 7 additions & 9 deletions src/fullscreenwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <QHBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
#include <QDebug>
#include <QShortcut>
#include <QScreen>

#include "fullscreenwindow.h"
#include "globals.h"
Expand All @@ -11,17 +13,13 @@ FullScreenWindow::FullScreenWindow(QWidget *parent, GlWidget *gl3widget)
{
glwidget = gl3widget;

// Included gere for testing in a windowed mode
/*
int nWidth = 1200;
int nHeight = 800;
#ifdef __linux__
currentScreen = availableScreens.at(QApplication::desktop()->screenNumber(this));
if (parent != nullptr)
setGeometry(parent->x() + parent->width() / 2 - nWidth / 2,
parent->y() + parent->height() / 2 - nHeight / 2,
nWidth, nHeight);
setGeometry(currentScreen->geometry());
else
resize(nWidth, nHeight);
*/
resize(currentScreen->geometry().width(), currentScreen->geometry().height());
#endif

QHBoxLayout *fullScreenLayout = new QHBoxLayout(this);
fullScreenLayout->setContentsMargins(0, 0, 0, 0);
Expand Down
19 changes: 6 additions & 13 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3876,23 +3876,17 @@ void MainWindow::updateScreenRatio()
*/
void MainWindow::on_actionFull_Screen_triggered()
{

#ifdef __linux__
QMessageBox::warning(this, "Apologies", "Full screen doesn't currently work on Linux due to limitations of the QWidget::showFullScreen() call. Sorry about that.");
return;
//fullScreenDialog->setWindowFlags( Qt::X11BypassWindowManagerHint);
// fullScreenDialog->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
//fullScreenDialog->showMaximized();
//fullScreenDialog->setWindowState(Qt::WindowFullScreen);
//fullScreenDialog->show();
#else
if (isGLFullScreen == false)
{
fullScreenDialog = new FullScreenWindow(this, gl3widget);

fullScreenDialog->showFullScreen();
isGLFullScreen = true;

#ifdef __linux__
fullScreenDialog->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
fullScreenDialog->show();
#else
fullScreenDialog->showFullScreen();
#endif
//qDebug() << "[Full Screen Mode] Opening full screen mode";
}
else
Expand All @@ -3905,5 +3899,4 @@ void MainWindow::on_actionFull_Screen_triggered()

//qDebug() << "[Full Screen Mode] Closing full screen mode";
}
#endif
}

0 comments on commit 912200c

Please sign in to comment.