Commit ac2d5a06 authored by Michael Abrahams's avatar Michael Abrahams

Restore fullscreen on Windows

Summary:
Menus on top of fullscreen OpenGL windows were not visible.

There's a bunch of finger pointing with Qt saying Windows' OpenGL
implementation is broken. A workaround is added in Qt 5.6.
http://doc.qt.io/qt-5/windows-issues.html

Fullscreen on Windows will then add a 1px border around the window by
default. This can be worked around by patching Qt.
https://bugreports.qt.io/browse/QTBUG-41309

Reviewers: #krita:_next

Differential Revision: https://phabricator.kde.org/D1977
parent 76255392
From 84a774e00e9d2535fdb8c798d7789130a9a008f6 Mon Sep 17 00:00:00 2001
From: Michael Abrahams <miabraha@gmail.com>
Date: Wed, 22 Jun 2016 13:37:06 -0400
Subject: [PATCH 3/4] Hack for fullscreen workaround
https://bugreports.qt.io/browse/QTBUG-41309
---
src/plugins/platforms/windows/qwindowswindow.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 9c6cb53..d0829e3 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1769,7 +1769,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE;
const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
setFlag(SynchronousGeometryChangeEvent);
- SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf);
+ SetWindowPos(m_data.hwnd, HWND_TOP, r.left()-1, r.top()-1, r.width()+2, r.height()+2, swpf);
if (!wasSync)
clearFlag(SynchronousGeometryChangeEvent);
QWindowSystemInterface::handleGeometryChange(window(), r);
--
2.7.4.windows.1
......@@ -9,6 +9,7 @@ ExternalProject_Add(
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qtgui-private-headers.diff
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Hack-always-return-we-support-DIBV5.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0003-Hack-for-fullscreen-workaround.patch
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure.bat -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix ${EXTPREFIX_qt}
......
......@@ -4,7 +4,12 @@ message(STATUS "Using CMake version: ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
set(MIN_QT_VERSION 5.4.0)
if (WIN32)
set(MIN_QT_VERSION 5.6.0)
else()
set(MIN_QT_VERSION 5.4.0)
endif()
set(MIN_FRAMEWORKS_VERSION 5.7.0)
if (POLICY CMP0002)
......
......@@ -137,6 +137,9 @@
#include <mutex>
#ifdef Q_OS_WIN
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
class ToolDockerFactory : public KoDockFactoryBase
{
......@@ -495,6 +498,11 @@ KisMainWindow::KisMainWindow()
d->viewManager->updateGUI();
d->viewManager->updateIcons();
#ifdef Q_OS_WIN
auto w = qApp->activeWindow();
if (w) QWindowsWindowFunctions::setHasBorderInFullScreen(w->windowHandle(), true);
#endif
QTimer::singleShot(1000, this, SLOT(checkSanity()));
{
......@@ -505,6 +513,9 @@ KisMainWindow::KisMainWindow()
d->tabSwitchCompressor.reset(
new KisSignalCompressorWithParam<int>(500, callback, KisSignalCompressor::FIRST_INACTIVE));
}
}
void KisMainWindow::setNoCleanup(bool noCleanup)
......@@ -1779,9 +1790,6 @@ void KisMainWindow::slotToolbarToggled(bool toggle)
void KisMainWindow::viewFullscreen(bool fullScreen)
{
KisConfig cfg;
#ifdef Q_OS_WIN
cfg.setFullscreenMode(false);
#else
cfg.setFullscreenMode(fullScreen);
if (fullScreen) {
......@@ -1789,7 +1797,6 @@ void KisMainWindow::viewFullscreen(bool fullScreen)
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen); // reset
}
#endif
}
void KisMainWindow::slotProgress(int value)
......@@ -2317,9 +2324,8 @@ void KisMainWindow::createActions()
actionManager->createStandardAction(KStandardAction::Open, this, SLOT(slotFileOpen()));
actionManager->createStandardAction(KStandardAction::Quit, this, SLOT(slotFileQuit()));
actionManager->createStandardAction(KStandardAction::ConfigureToolbars, this, SLOT(slotConfigureToolbars()));
#ifndef Q_OS_WIN
actionManager->createStandardAction(KStandardAction::FullScreen, this, SLOT(viewFullscreen(bool)));
#endif
d->recentFiles = KStandardAction::openRecent(this, SLOT(slotFileOpenRecent(QUrl)), actionCollection());
connect(d->recentFiles, SIGNAL(recentListCleared()), this, SLOT(saveRecentFiles()));
KSharedConfigPtr configPtr = KSharedConfig::openConfig();
......
......@@ -1040,7 +1040,7 @@ void KisViewManager::switchCanvasOnly(bool toggled)
action->setChecked(!toggled);
}
}
#ifndef Q_OS_WIN
if (cfg.hideTitlebarFullscreen() && !cfg.fullscreenMode()) {
if(toggled) {
main->setWindowState( main->windowState() | Qt::WindowFullScreen);
......@@ -1048,7 +1048,7 @@ void KisViewManager::switchCanvasOnly(bool toggled)
main->setWindowState( main->windowState() & ~Qt::WindowFullScreen);
}
}
#endif
if (cfg.hideMenuFullscreen()) {
if (!toggled) {
if (main->menuBar()->dynamicPropertyNames().contains("wasvisible")) {
......
......@@ -782,9 +782,6 @@ FullscreenSettingsTab::FullscreenSettingsTab(QWidget* parent) : WdgFullscreenSet
chkMenu->setChecked(cfg.hideMenuFullscreen());
chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen());
chkStatusbar->setChecked(cfg.hideStatusbarFullscreen());
#ifdef Q_OS_WINDOWS
chkTitlebar->setVisible(false);
#endif
chkTitlebar->setChecked(cfg.hideTitlebarFullscreen());
chkToolbar->setChecked(cfg.hideToolbarFullscreen());
......
......@@ -1114,11 +1114,7 @@ void KisConfig::setHideStatusbarFullscreen(const bool value) const
bool KisConfig::hideTitlebarFullscreen(bool defaultValue) const
{
#ifdef Q_OS_WIN
return false;
#else
return (defaultValue ? true : m_cfg.readEntry("hideTitleBarFullscreen", true));
#endif
}
void KisConfig::setHideTitlebarFullscreen(const bool value) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment