diff options
author | Stephen Hurd <deuce@synchro.net> | 2021-09-05 03:04:46 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2021-09-06 18:58:10 +0300 |
commit | b1eef1f2dc943abe132dc29d3b841f572245a05a (patch) | |
tree | 90bc75b6096ecdf3fef124b7dd7226a09bb440fa | |
parent | 1a94ea2f57e3f49f69c772c35278c7a18bffdf06 (diff) |
Fix for supermerill/SuperSlicer#8882.3.56.9
The CallAfter() on Linux causes weird window focus issues.
For me, using ALT-Tab to switch away from PrusaSlicer/SuperSlicer would cause
PrusaSlicer/SuperSlicer to take back focus after about one second. Stranger
things reportedly occur with focus-follows-mouse.
The #ifdef is there because it is assumed the CallAfter() was added
in 20f5b7a for a good reason.
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 26f930990..7e511639d 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6115,9 +6115,14 @@ void Plater::force_print_bed_update() void Plater::on_activate() { -#if defined(__linux__) || defined(_WIN32) // Activating the main frame, and no window has keyboard focus. // Set the keyboard focus to the visible Canvas3D. +#if defined(__linux__) + if (this->p->view3D->IsShown() && wxWindow::FindFocus() != this->p->view3D->get_wxglcanvas()) + this->p->view3D->get_wxglcanvas()->SetFocus(); + else if (this->p->preview->IsShown() && wxWindow::FindFocus() != this->p->view3D->get_wxglcanvas()) + this->p->preview->get_wxglcanvas()->SetFocus(); +#elif defined(_WIN32) if (this->p->view3D->IsShown() && wxWindow::FindFocus() != this->p->view3D->get_wxglcanvas()) CallAfter([this]() { this->p->view3D->get_wxglcanvas()->SetFocus(); }); else if (this->p->preview->IsShown() && wxWindow::FindFocus() != this->p->view3D->get_wxglcanvas()) |