Don't set focus to unfocusable windows in wxGTK

Restore IsFocusable() check that was commented out, without any real
explanation, by c7bfb76a2c (A number of focus handling improvements:
Left clicking on a window only focuses the window if not processed.
wxControlContainer::SetFocus moved to wxControlContainerBase so that a
container now focuses the first child even on wxGTK. wxAuiBook is now a
container, need for correct navigation on wxGTK., 2007-08-18).

This is needed to avoid giving focus on click to the windows that
explicitly override AcceptsFocus() to return false, as e.g.
wxGridColLabelWindow and other wxGrid subwindow classes do. From the
user point of view, previously clicking on a grid row/column label just
disabled the user of arrow keys, which was very inconvenient (and didn't
happen under MSW).
This commit is contained in:
Vadim Zeitlin 2020-04-15 16:02:43 +02:00 committed by Leland Lucius
parent 3c2a61d036
commit 85dbf5f732

View File

@ -1691,7 +1691,7 @@ gtk_window_button_press_callback( GtkWidget* WXUNUSED_IN_GTK3(widget),
return TRUE;
if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() &&
(gs_currentFocus != win) /* && win->IsFocusable() */)
(gs_currentFocus != win) && win->IsFocusable())
{
win->SetFocus();
}