Skip to content

Commit

Permalink
DEBUG output for fullscreen changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Dec 25, 2023
1 parent b9ff891 commit 5a4fe74
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/mixxxmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void MixxxMainWindow::initializeQOpenGL() {
#endif

void MixxxMainWindow::initialize() {
qWarning() << " $ initialize";
m_pCoreServices->getControlIndicatorTimer()->setLegacyVsyncEnabled(true);

UserSettingsPointer pConfig = m_pCoreServices->getSettings();
Expand Down Expand Up @@ -199,6 +200,7 @@ void MixxxMainWindow::initialize() {
if ((CmdlineArgs::Instance().getStartInFullscreen() || fullscreenPref) &&
// could be we're fullscreen already after setGeomtery(previousGeometry)
!isFullScreen()) {
qWarning() << " init: go fullscreen";
showFullScreen();
}

Expand Down Expand Up @@ -495,6 +497,7 @@ MixxxMainWindow::~MixxxMainWindow() {
}

void MixxxMainWindow::initializeWindow() {
qWarning() << " $ initializeWindow";
// be sure createMenuBar() is called first
DEBUG_ASSERT(m_pMenuBar);

Expand Down Expand Up @@ -701,6 +704,7 @@ void MixxxMainWindow::slotUpdateWindowTitle(TrackPointer pTrack) {
}

void MixxxMainWindow::createMenuBar() {
qWarning() << " $ createMenuBar";
ScopedTimer t(u"MixxxMainWindow::createMenuBar");
DEBUG_ASSERT(m_pCoreServices->getKeyboardConfig());
m_pMenuBar = make_parented<WMainMenuBar>(
Expand All @@ -714,6 +718,7 @@ void MixxxMainWindow::createMenuBar() {
void MixxxMainWindow::connectMenuBar() {
// This function might be invoked multiple times on startup
// so all connections must be unique!
qWarning() << " $ connectMenuBar";

ScopedTimer t(u"MixxxMainWindow::connectMenuBar");
connect(this,
Expand Down Expand Up @@ -955,15 +960,19 @@ void MixxxMainWindow::slotDeveloperToolsClosed() {
}

void MixxxMainWindow::slotViewFullScreen(bool toggle) {
qWarning() << " $ slotViewFullScreen" << toggle;
if (isFullScreen() == toggle) {
qWarning() << " (no-op)";
return;
}

// Just switch the window state here. eventFilter() will catch the
// QWindowStateChangeEvent and inform the menu bar that fullscreen changed.
if (toggle) {
qWarning() << " > showFullScreen()";
showFullScreen();
} else {
qWarning() << " > showNormal()";
showNormal();
}
}
Expand Down Expand Up @@ -1159,6 +1168,7 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
}
} else if (event->type() == QEvent::WindowStateChange) {
#ifndef __APPLE__
qWarning() << "$ WindowStateChange:" << windowState();
if (windowState() == m_prevState) {
// Ignore no-op. This happens if another window is raised above
// MixxxMianWindow, e.g. DlgPeferences. In such a case event->oldState()
Expand All @@ -1176,13 +1186,16 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
const bool isFullScreenNow = windowState() & Qt::WindowFullScreen;
if ((isFullScreenNow && !wasFullScreen) ||
(!isFullScreenNow && wasFullScreen)) {
qWarning() << "$ fullscreen changed, now"
<< (isFullScreenNow ? "fullscreen" : "window");
#ifdef __LINUX__
// Fix for "No menu bar with ubuntu unity in full screen mode"
// (issues #6072 and #6689). Before touching anything here, please
// read those bugs.
// Set this attribute instead of calling setNativeMenuBar(false),
// see https://github.com/mixxxdj/mixxx/issues/11320
if (m_supportsGlobalMenuBar) {
qWarning() << "$ global menu > rebuild";
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, isFullScreenNow);
createMenuBar();
connectMenuBar();
Expand Down

0 comments on commit 5a4fe74

Please sign in to comment.