Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/macwindowhelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// macwindowhelper.h
#pragma once

#include <QWidget>

#if defined(Q_OS_MAC)
void makeWindowCoverMenuBar(QWidget *widget);
#else
inline void makeWindowCoverMenuBar(QWidget *) {}
#endif
19 changes: 19 additions & 0 deletions src/macwindowhelper.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// macwindowhelper.mm
#import "macwindowhelper.h"

#if defined(Q_OS_MAC)
#import <AppKit/AppKit.h>

void makeWindowCoverMenuBar(QWidget *widget) {
if (!widget) return;

NSView *nativeView = (__bridge NSView *)widget->winId();
if (!nativeView) return;

NSWindow *nsWindow = [nativeView window];
if (!nsWindow) return;

[nsWindow setLevel:NSMainMenuWindowLevel + 1];
[nsWindow setStyleMask:NSWindowStyleMaskBorderless];
}
#endif
9 changes: 7 additions & 2 deletions src/projectionwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with Subtivals. If not, see <http://www.gnu.org/licenses/>
**/

#include <QtCore/QSettings>
#include <QtCore/qmath.h>
#include <QtGui/QCursor>
Expand All @@ -22,19 +23,23 @@

#include "subtitlestyle.h"
#include "projectionwindow.h"
#include "macwindowhelper.h"

ProjectionWindow::ProjectionWindow(QWidget *parent)
: SubtitlesForm(parent), m_hideDesktop(false), m_monitor(-1),
m_resizable(false) {
Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint |
Qt::X11BypassWindowManagerHint;
Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
#ifdef WIN32
flags |= Qt::SubWindow;
#endif
#ifdef Q_OS_LINUX
flags |= Qt::X11BypassWindowManagerHint;
#endif
setStyleSheet("background:transparent;");
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(flags);
setCursor(QCursor(Qt::BlankCursor));
makeWindowCoverMenuBar(this);
}

ProjectionWindow::~ProjectionWindow() {}
Expand Down
9 changes: 8 additions & 1 deletion src/subtivals.pro
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ HEADERS += mainwindow.h \
styleadvanced.h \
shortcuteditor.h \
wizard.h \
weblive.h
weblive.h \
macwindowhelper.h

OBJECTIVE_SOURCES += macwindowhelper.mm

macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
}

FORMS += mainwindow.ui \
subtitlesform.ui \
Expand Down