Define the parent window of a modal dialog the same way in all GUI components.

[GB.QT4]
* BUG: Define the parent window of a modal dialog the same way in all GUI components.

[GB.QT5]
* BUG: Define the parent window of a modal dialog the same way in all GUI components.

[GB.GTK]
* BUG: Define the parent window of a modal dialog the same way in all GUI components.

[GB.GTK3]
* BUG: Define the parent window of a modal dialog the same way in all GUI components.
This commit is contained in:
gambas 2017-10-23 23:10:49 +02:00
parent d720a2789b
commit a048b76368
2 changed files with 19 additions and 5 deletions

View file

@ -787,6 +787,7 @@ bool gMainWindow::isModal() const
void gMainWindow::showModal()
{
gMainWindow *save;
gMainWindow *parent;
if (!isTopLevel()) return;
if (isModal()) return;
@ -798,8 +799,16 @@ void gMainWindow::showModal()
//show();
gtk_grab_add(border);
if (_active)
gtk_window_set_transient_for(GTK_WINDOW(border), GTK_WINDOW(_active->topLevel()->border));
parent = _current;
if (!parent)
{
parent = gApplication::mainWindow();
if (!parent)
parent = _active;
}
if (parent)
gtk_window_set_transient_for(GTK_WINDOW(border), GTK_WINDOW(parent->topLevel()->border));
save = _current;
_current = this;

View file

@ -1672,9 +1672,10 @@ void MyMainWindow::activateLater()
void MyMainWindow::present(QWidget *parent)
{
//CWIDGET *_object = CWidget::get(this);
//CWIDGET *_parent = parent ? CWidget::get(parent) : 0;
//qDebug("present: %p %s: parent = %p %s", THIS, _object->name, _parent, _parent ? _parent->name : "");
/*CWIDGET *_object = CWidget::get(this);
CWIDGET *_parent = parent ? CWidget::get(parent) : 0;
qDebug("present: %p %s: parent = %p %s", THIS, _object->name, _parent, _parent ? _parent->name : "");*/
if (parent)
_screen = QApplication::desktop()->screenNumber(parent);
@ -1837,7 +1838,11 @@ void MyMainWindow::showModal(void)
parent = CWINDOW_Current;
if (!parent)
{
parent = CWINDOW_Main;
if (!parent)
parent = CWINDOW_Active;
}
present(parent ? CWidget::getTopLevel((CWIDGET *)parent)->widget.widget : 0);
setEventLoop();