Make window activation specific to the GUI platform, in the hope of finding a workaround to the fact that window activation request is impossible in Wayland.

[GB.QT5]
* BUG: Make window activation specific to the GUI platform, in the hope of finding a workaround to the fact that window activation request is impossible in Wayland.
This commit is contained in:
Benoît Minisini 2022-12-09 18:16:01 +01:00
parent 5d0c54bca2
commit 2eeae0aea6
4 changed files with 17 additions and 3 deletions

View file

@ -2880,9 +2880,10 @@ void MyMainWindow::setBetterMask(QPixmap &bg)
void MyMainWindow::activate(void)
{
#ifdef QT5
if (!MAIN_platform_is_wayland)
PLATFORM.Window.Activate(this);
#else
activateWindow();
#endif
activateWindow();
}
bool MyMainWindow::focusNextPrevChild(bool next)

View file

@ -72,6 +72,7 @@ typedef
void (*SetProperties)(QWidget *window, int which, QT_WINDOW_PROP *prop);
void (*SetUserTime)(QWidget *window, int timestamp);
void (*SetTransientFor)(QWidget *window, QWidget *parent);
void (*Activate)(QWidget *window);
} Window;
}
QT_PLATFORM_INTERFACE;

View file

@ -171,6 +171,11 @@ static void window_set_transient_for(QWidget *window, QWidget *parent)
#endif
}
static void window_activate(QWidget *win)
{
win->windowHandle()->alert(0);
}
//-------------------------------------------------------------------------
extern "C" {
@ -198,6 +203,7 @@ void *GB_QT5_WAYLAND_1[] EXPORT = {
(void *)window_set_properties,
(void *)window_set_user_time,
(void *)window_set_transient_for,
(void *)window_activate,
NULL
};

View file

@ -357,6 +357,11 @@ static void window_set_transient_for(QWidget *window, QWidget *parent)
X11_set_transient_for(window->effectiveWinId(), parent->effectiveWinId());
}
static void window_activate(QWidget *window)
{
window->activateWindow();
}
//-------------------------------------------------------------------------
static void x11_set_event_filter(int (*filter)(XEvent *))
@ -391,7 +396,8 @@ void *GB_QT5_X11_1[] EXPORT = {
(void *)window_set_properties,
(void *)window_set_user_time,
(void *)window_set_transient_for,
(void *)window_activate,
NULL
};