Skip to content
Snippets Groups Projects
Commit 8327e7f9 authored by gambas's avatar gambas
Browse files

Set application desktop file name and fix window properties on Wayland.

[GB.QT4]
* NEW: Set application desktop file name to the application name.

[GB.QT5]
* NEW: Set application desktop file name to the application name.
* BUG: Window properties are correctly set on Wayland now.
parent 45861063
Branches
Tags
No related merge requests found
Pipeline #243849206 failed
......@@ -1616,16 +1616,14 @@ void MyMainWindow::showEvent(QShowEvent *e)
void MyMainWindow::initProperties(int which)
{
#ifndef NO_X_WINDOW
CWIDGET *_object = CWidget::get(this);
if (!THIS->toplevel || effectiveWinId() == 0)
if (!THIS->toplevel) // || effectiveWinId() == 0)
return;
if (!THIS->title && _border)
setWindowTitle(TO_QSTRING(GB.Application.Title()));
//qDebug("initProperties: %d", which);
#ifdef QT5
QT_WINDOW_PROP prop;
......@@ -1665,7 +1663,6 @@ void MyMainWindow::initProperties(int which)
X11_flush();
#endif
#endif
}
void MyMainWindow::setEventLoop()
......@@ -1761,8 +1758,6 @@ void MyMainWindow::present(QWidget *parent)
{
#ifdef QT5
PLATFORM.Window.SetTransientFor(this, parent);
if (windowHandle())
windowHandle()->setTransientParent(parent->windowHandle());
#else
X11_set_transient_for(effectiveWinId(), parent->effectiveWinId());
#endif
......@@ -1852,21 +1847,14 @@ void MyMainWindow::doShowModal(bool popup, const QPoint *pos)
info.save_popup = popup ? CWIDGET_enter_popup() : NULL;
info.flags = windowFlags() & ~Qt::WindowType_Mask;
if (popup)
setWindowFlags(Qt::Popup | info.flags);
setWindowModality(Qt::ApplicationModal);
if (!popup && _resizable && _border)
{
setMinimumSize(THIS->minw, THIS->minh);
setSizeGrip(true);
}
_enterLoop = false; // Do not call exitLoop() if we do not entered the loop yet!
if (popup)
{
setWindowFlags(Qt::Popup | info.flags);
move(0, 0);
move(*pos);
setFocus();
......@@ -1875,6 +1863,12 @@ void MyMainWindow::doShowModal(bool popup, const QPoint *pos)
}
else
{
if (_resizable && _border)
{
setMinimumSize(THIS->minw, THIS->minh);
setSizeGrip(true);
}
parent = CWINDOW_Current;
if (!parent)
{
......@@ -1883,6 +1877,9 @@ void MyMainWindow::doShowModal(bool popup, const QPoint *pos)
parent = CWINDOW_Active;
}
if (parent)
setParent(CWidget::getTopLevel((CWIDGET *)parent)->widget.widget, Qt::Dialog | info.flags);
present(parent ? CWidget::getTopLevel((CWIDGET *)parent)->widget.widget : 0);
}
......@@ -2133,19 +2130,19 @@ void MyMainWindow::setBorder(bool b)
return;
_border = b;
if (!isWindow())
return;
if (effectiveWinId())
{
//qDebug("effectiveWinId");
initProperties(PROP_BORDER);
#ifdef QT5
PLATFORM.Window.Remap(WINDOW);
#else
if (effectiveWinId())
X11_window_remap(effectiveWinId());
#endif
}
#ifndef QT5
doReparent(parentWidget(), pos());
#endif
......
......@@ -916,6 +916,8 @@ static void QT_Init(void)
/*fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, FD_CLOEXEC);*/
qApp->setDesktopFileName(TO_QSTRING(GB.Application.Name()));
if (::strcmp(qApp->style()->metaObject()->className(), "Breeze::Style") == 0)
{
env = getenv("GB_QT_NO_BREEZE_FIX");
......
......@@ -27,6 +27,7 @@
#include <QAbstractNativeEventFilter>
#include <QPointer>
#include <QWindow>
#include <QApplication>
static QPointer<QWidget> _mouseGrabber = 0;
......@@ -180,7 +181,6 @@ static void window_set_user_time(QWidget *window, int timestamp)
static void window_set_transient_for(QWidget *window, QWidget *parent)
{
//X11_set_transient_for(window->effectiveWinId(), parent->effectiveWinId());
}
//-------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment