Skip to content

Commit ed002d3

Browse files
committed
Fix wxComboCtrl popup behaviour under some Wayland compositors
We need to set the window type hint to COMBO in order to use a popup window for it under Wayland and while not doing it seems to still work with GNOME/mutter, it is required with the other compositors such as KDE Plasma or Sway and doesn't seem to do any harm under GNOME, so do it always and hope that it doesn't result in any problems with not combobox-like popups. This basically undoes 62d934a (Don't set HINT_COMBO as wxPopupWindow is used for different windows as well, 2008-10-07). See wxWidgets#23931, wxWidgets#23908. Co-authored-by: Alex Shvartzkop <[email protected]> (cherry picked from commit 5c0cc72)
1 parent 78203cd commit ed002d3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ wxGTK:
287287
- Give better error if EGL version is < 1.5 (Fabrice de Gans, #22325, #23855).
288288
- Fix hiding wxGLCanvas under Wayland (Joan Bruguera, #22580).
289289
- Fix page origin when printing in landscape (Alex Shvartzkop, #23860).
290+
- Fix wxComboCtrl popup behaviour under Wayland (Alex Shvartzkop, #23908).
290291
- Dramatically optimize adding many items to wxChoice (Ian McInerney, #23443).
291292
- Improve and document wxGLCanvas::CreateSurface() (Dan Gudmundsson, #23366).
292293
- Fix loading WebKit2 extension when using wxWebView (Scott Talbert, #23497).

src/gtk/popupwin.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,12 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
106106
g_object_ref( m_widget );
107107

108108
gtk_widget_set_name( m_widget, "wxPopupWindow" );
109-
// wxPopupWindow is used for different windows as well
110-
// gtk_window_set_type_hint( GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_COMBO );
109+
110+
// While wxPopupWindow is used for different windows as well, we don't
111+
// really know how is it going to be used but we do know that without the
112+
// hint at all, it doesn't work correctly, at least under Wayland, where
113+
// GTK only maps COMBO and {DROPDOWN,POPUP}_MENU to popups, so do set it.
114+
gtk_window_set_type_hint( GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_COMBO );
111115

112116
// Popup windows can be created without parent, so handle this correctly.
113117
if (parent)

0 commit comments

Comments
 (0)