1212#include " utils/paths.h"
1313#include " config.h"
1414
15- #ifdef Q_OS_WIN
16- #include < dwmapi.h>
17- #ifndef DWMWA_SYSTEMBACKDROP_TYPE
18- #define DWMWA_SYSTEMBACKDROP_TYPE 38
19- #endif
20- #ifndef DWMSBT_MAINWINDOW
21- #define DWMSBT_MAINWINDOW 2
22- #define DWMSBT_TRANSIENTWINDOW 3
23- #endif
24- #endif
25-
2615#include < QVBoxLayout>
2716#include < QHBoxLayout>
2817#include < QPainter>
@@ -116,16 +105,6 @@ MainWindow::MainWindow(QWidget* parent)
116105 setWindowIcon (QIcon (iconPath));
117106 }
118107
119- #ifdef Q_OS_WIN
120- HWND hwnd = (HWND)this ->winId ();
121- int backdrop = DWMSBT_TRANSIENTWINDOW; // Acrylic frosted glass
122- DwmSetWindowAttribute (hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdrop, sizeof (backdrop));
123- #endif
124-
125- // Frameless glass window
126- setWindowFlags (Qt::FramelessWindowHint | Qt::Window);
127- setAttribute (Qt::WA_TranslucentBackground);
128-
129108 initUI ();
130109
131110 m_debounceTimer = new QTimer (this );
@@ -150,40 +129,9 @@ MainWindow::~MainWindow() {
150129void MainWindow::paintEvent (QPaintEvent* event) {
151130 Q_UNUSED (event);
152131 QPainter painter (this );
153- // Use the semi-transparent surface color to let Mica/Acrylic bleed through
154132 painter.fillRect (rect (), Colors::toQColor (Colors::SURFACE));
155133}
156134
157- // ── Window Dragging Implementation ──
158- void MainWindow::mousePressEvent (QMouseEvent *event) {
159- if (event->button () == Qt::LeftButton) {
160- // Only allow drag from the top header area (approx 60px)
161- if (event->pos ().y () <= 60 ) {
162- m_dragging = true ;
163- m_dragPosition = event->globalPosition ().toPoint () - frameGeometry ().topLeft ();
164- event->accept ();
165- return ;
166- }
167- }
168- QMainWindow::mousePressEvent (event);
169- }
170-
171- void MainWindow::mouseMoveEvent (QMouseEvent *event) {
172- if (event->buttons () & Qt::LeftButton && m_dragging) {
173- move (event->globalPosition ().toPoint () - m_dragPosition);
174- event->accept ();
175- return ;
176- }
177- QMainWindow::mouseMoveEvent (event);
178- }
179-
180- void MainWindow::mouseReleaseEvent (QMouseEvent *event) {
181- if (event->button () == Qt::LeftButton) {
182- m_dragging = false ;
183- }
184- QMainWindow::mouseReleaseEvent (event);
185- }
186-
187135void MainWindow::dragEnterEvent (QDragEnterEvent* event) {
188136 if (event->mimeData ()->hasUrls ()) {
189137 QList<QUrl> urls = event->mimeData ()->urls ();
@@ -279,16 +227,6 @@ void MainWindow::initUI() {
279227 ).arg (Colors::ON_SURFACE));
280228 headerLayout->addWidget (title);
281229 headerLayout->addStretch ();
282-
283- // Custom window controls since we are frameless
284- MaterialIconButton* closeBtn = new MaterialIconButton (
285- MaterialIcons::Delete, Colors::toQColor (Colors::ON_SURFACE), 28 );
286- // Hack: re-use an icon visually close to an X or window close if we don't have a close icon.
287- // For now, let's use a simple distinct color and click handler.
288- closeBtn->setToolTip (" Close" );
289- connect (closeBtn, &QPushButton::clicked, this , &QMainWindow::close);
290- headerLayout->addWidget (closeBtn);
291-
292230 sidebarLayout->addLayout (headerLayout);
293231 sidebarLayout->addSpacing (20 );
294232
0 commit comments