From eb4aab5639579264c5de62f662e0562d3d4aad80 Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Tue, 21 Apr 2015 21:44:35 -0700 Subject: [PATCH] Avoid "Gtk-Message: GtkDialog mapped without a transient
Hello community, here is the log from the commit of package wxWidgets-3_0 for openSUSE:Factory checked in at 2016-03-07 13:23:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wxWidgets-3_0 (Old) and /work/SRC/openSUSE:Factory/.wxWidgets-3_0.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "wxWidgets-3_0" Changes: -------- --- /work/SRC/openSUSE:Factory/wxWidgets-3_0/wxGTK3-3_0.changes 2015-04-07 09:27:24.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.wxWidgets-3_0.new/wxGTK3-3_0.changes 2016-03-07 13:24:06.000000000 +0100 @@ -1,0 +2,20 @@ +Sat Feb 20 12:33:39 UTC 2016 - jengelh@inai.de + +- Add patches from upstream to resolve crashes in normal conditions, + and when running under non-X11 wxGTK3. + 0001-avoid-passing-invalid-rect-to-Refresh-closes-16819.patch + 0001-Ensure-the-PangoFontFace-type-is-loaded.patch + 0001-Fix-wxPrintDialog-when-used-directly-see-16821.patch + 0001-set-transient-parent-for-about-dialog-closes-16823.patch + 0001-Avoid-refreshing-not-currently-visible-items-in-gene.patch + 0001-Avoid-Gtk-Message-GtkDialog-mapped-without-a-transie.patch + 0001-Fix-wxSpinButton-best-size-for-GTK-3.12-and-later-se.patch + 0001-Fix-drawing-checkbox-and-radiobutton-in-checked-stat.patch + 0001-fix-crashes-in-wxGTK3-when-running-with-non-X11-back.patch + 0002-Don-t-defer-wxTLW-initialization-in-wxGTK-when-not-u.patch + 0003-Don-t-use-frame-extents-when-not-using-X11-in-wxGTK.patch + 0004-Don-t-crash-when-switching-to-full-screen-in-non-X11.patch + 0005-Don-t-use-X11-only-functions-when-not-using-X11-in-w.patch + 0001-Provide-trivial-GDK_IS_X11_DISPLAY-definition-for-GT.patch + +------------------------------------------------------------------- wxWidgets-3_0.changes: same change New: ---- 0001-Avoid-Gtk-Message-GtkDialog-mapped-without-a-transie.patch 0001-Avoid-refreshing-not-currently-visible-items-in-gene.patch 0001-Ensure-the-PangoFontFace-type-is-loaded.patch 0001-Fix-drawing-checkbox-and-radiobutton-in-checked-stat.patch 0001-Fix-wxPrintDialog-when-used-directly-see-16821.patch 0001-Fix-wxSpinButton-best-size-for-GTK-3.12-and-later-se.patch 0001-Provide-trivial-GDK_IS_X11_DISPLAY-definition-for-GT.patch 0001-avoid-passing-invalid-rect-to-Refresh-closes-16819.patch 0001-set-transient-parent-for-about-dialog-closes-16823.patch 0002-Don-t-defer-wxTLW-initialization-in-wxGTK-when-not-u.patch 0003-Don-t-use-frame-extents-when-not-using-X11-in-wxGTK.patch 0004-Don-t-crash-when-switching-to-full-screen-in-non-X11.patch 0005-Don-t-use-X11-only-functions-when-not-using-X11-in-w.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wxGTK3-3_0.spec ++++++ --- /var/tmp/diff_new_pack.Z87xWm/_old 2016-03-07 13:24:08.000000000 +0100 +++ /var/tmp/diff_new_pack.Z87xWm/_new 2016-03-07 13:24:08.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package wxGTK3-3_0 # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -41,6 +41,19 @@ Source6: wxpython-mkdiff.sh Source50: baselibs.conf Patch1: soversion.diff +Patch2: 0001-avoid-passing-invalid-rect-to-Refresh-closes-16819.patch +Patch3: 0001-Ensure-the-PangoFontFace-type-is-loaded.patch +Patch4: 0001-Fix-wxPrintDialog-when-used-directly-see-16821.patch +Patch5: 0001-set-transient-parent-for-about-dialog-closes-16823.patch +Patch6: 0001-Avoid-refreshing-not-currently-visible-items-in-gene.patch +Patch7: 0001-Avoid-Gtk-Message-GtkDialog-mapped-without-a-transie.patch +Patch8: 0001-Fix-wxSpinButton-best-size-for-GTK-3.12-and-later-se.patch +Patch9: 0001-Fix-drawing-checkbox-and-radiobutton-in-checked-stat.patch +Patch10: 0001-Provide-trivial-GDK_IS_X11_DISPLAY-definition-for-GT.patch +Patch11: 0002-Don-t-defer-wxTLW-initialization-in-wxGTK-when-not-u.patch +Patch12: 0003-Don-t-use-frame-extents-when-not-using-X11-in-wxGTK.patch +Patch13: 0004-Don-t-crash-when-switching-to-full-screen-in-non-X11.patch +Patch14: 0005-Don-t-use-X11-only-functions-when-not-using-X11-in-w.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: SDL-devel BuildRequires: autoconf @@ -211,7 +224,8 @@ %prep echo "=== RPM build flags: WX_DEBUG=0%{?WX_DEBUG}" %setup -q -n %tarball_name-%version -%patch -P 1 -p1 +%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 6 -P 7 -P 8 -P 9 -p1 +%patch -P 10 -P 11 -P 12 -P 13 -P 14 -p1 cp %{S:2} . %build wxWidgets-3_0.spec: same change ++++++ 0001-Avoid-Gtk-Message-GtkDialog-mapped-without-a-transie.patch ++++++ parent", closes #16863 --- src/gtk/filedlg.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 44087dd..609436a 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -192,7 +192,8 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, const wxSize& sz, const wxString& name) { - parent = GetParentForModalDialog(parent, style); + // wxFD_MULTIPLE has the same value as wxDIALOG_NO_PARENT + parent = GetParentForModalDialog(parent, style & ~wxFD_MULTIPLE); if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)) -- 2.7.0 ++++++ 0001-Avoid-refreshing-not-currently-visible-items-in-gene.patch ++++++
From c4f569ed60f08ecb318c7268c92471cc5d9071a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Mon, 2 Mar 2015 14:39:45 +0100 Subject: [PATCH] Avoid refreshing not currently visible items in generic wxListCtrl.
This is useless at best and resulted in GTK+ warnings because we ended up (somehow -- is there another bug lurking here?) with negative items height in this case. Closes #16862. --- src/generic/listctrl.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 771c400..d21a8c6 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1935,6 +1935,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo ) size_t visibleFrom, visibleTo; GetVisibleLinesRange(&visibleFrom, &visibleTo); + if ( lineFrom > visibleTo || lineTo < visibleFrom ) + { + // None of these lines are currently visible at all, don't bother + // doing anything. + return; + } + if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; if ( lineTo > visibleTo ) -- 2.7.0 ++++++ 0001-Ensure-the-PangoFontFace-type-is-loaded.patch ++++++
From 5d3376802258191166a86cd9175cb4adb0a16c2e Mon Sep 17 00:00:00 2001 From: Scott Talbert
Date: Tue, 3 Mar 2015 23:33:00 -0500 Subject: [PATCH] Ensure the PangoFontFace type is loaded.
This works around problems with using wxFontDialog from wxPython. Closes #16820. --- src/gtk/fontdlg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index bdf2dd4..09122f7 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -78,6 +78,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) gtk_parent = GTK_WINDOW(parent->m_widget); #if GTK_CHECK_VERSION(3,2,0) + g_type_ensure(PANGO_TYPE_FONT_FACE); if (gtk_check_version(3,2,0) == NULL) m_widget = gtk_font_chooser_dialog_new(wxGTK_CONV(message), gtk_parent); else -- 2.7.0 ++++++ 0001-Fix-drawing-checkbox-and-radiobutton-in-checked-stat.patch ++++++
From c1d150ed1228c155054cf1fa90932ced7371e6a4 Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Sun, 1 Nov 2015 19:46:01 -0800 Subject: [PATCH] Fix drawing checkbox and radiobutton in checked state with GTK+ >= 3.14, see #17240
(cherry picked from commit ed817dd3667306fc5079068734a6b89203129607) --- src/gtk/renderer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 98969dd..c7e95a9 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -41,6 +41,10 @@ #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" +#if defined(__WXGTK3__) && !GTK_CHECK_VERSION(3,14,0) + #define GTK_STATE_FLAG_CHECKED (1 << 11) +#endif + // ---------------------------------------------------------------------------- // wxRendererGTK: our wxRendererNative implementation // ---------------------------------------------------------------------------- @@ -551,7 +555,11 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, { int stateFlags = GTK_STATE_FLAG_NORMAL; if (flags & wxCONTROL_CHECKED) + { stateFlags = GTK_STATE_FLAG_ACTIVE; + if (gtk_check_version(3,14,0) == NULL) + stateFlags = GTK_STATE_FLAG_CHECKED; + } if (flags & wxCONTROL_DISABLED) stateFlags |= GTK_STATE_FLAG_INSENSITIVE; if (flags & wxCONTROL_UNDETERMINED) @@ -866,7 +874,11 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, #ifdef __WXGTK3__ int state = GTK_STATE_FLAG_NORMAL; if (flags & wxCONTROL_CHECKED) + { state = GTK_STATE_FLAG_ACTIVE; + if (gtk_check_version(3,14,0) == NULL) + state = GTK_STATE_FLAG_CHECKED; + } else if (flags & wxCONTROL_UNDETERMINED) state = GTK_STATE_FLAG_INCONSISTENT; if (flags & wxCONTROL_DISABLED) -- 2.7.0 ++++++ 0001-Fix-wxPrintDialog-when-used-directly-see-16821.patch ++++++
From a2f1bc1fdec222f3be7b7c5745ebc52c3c85a51c Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Mon, 11 May 2015 10:14:34 -0700 Subject: [PATCH] Fix wxPrintDialog when used directly, see #16821
---
src/gtk/print.cpp | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp
index 2d70a1b..675a3ea 100644
--- a/src/gtk/print.cpp
+++ b/src/gtk/print.cpp
@@ -32,7 +32,6 @@
#include "wx/fontutil.h"
#include "wx/dynlib.h"
#include "wx/paper.h"
-#include "wx/scopeguard.h"
#include "wx/modalhook.h"
#include
From 312ae4c92cec95954557347c2b7a9e24d4398a59 Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Thu, 16 Jul 2015 07:13:27 -0700 Subject: [PATCH] Fix wxSpinButton best size for GTK+ 3.12 and later, see #17051
--- src/gtk/spinbutt.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index cdb3bca..a2285fb 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -92,6 +92,10 @@ bool wxSpinButton::Create(wxWindow *parent, g_object_ref(m_widget); gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0); +#if GTK_CHECK_VERSION(3,12,0) + if (gtk_check_version(3,12,0) == NULL) + gtk_entry_set_max_width_chars(GTK_ENTRY(m_widget), 0); +#endif gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); -- 2.7.0 ++++++ 0001-Provide-trivial-GDK_IS_X11_DISPLAY-definition-for-GT.patch ++++++
From 45e972943fba447e87db9dd41eaabc0e55df1017 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Wed, 19 Nov 2014 13:29:07 +0000 Subject: [PATCH 1/5] Provide trivial GDK_IS_X11_DISPLAY() definition for GTK+2.
This will be useful for upcoming patches using it to fix problems with GTK+ 3 without breaking GTK+ 2 compilation. See #16688. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/private/gtk2-compat.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/wx/gtk/private/gtk2-compat.h b/include/wx/gtk/private/gtk2-compat.h index 76a6075..1cdcc04 100644 --- a/include/wx/gtk/private/gtk2-compat.h +++ b/include/wx/gtk/private/gtk2-compat.h @@ -517,5 +517,9 @@ static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequis } #define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size +// There is no equivalent in GTK+ 2, but it's not needed there anyhow as X11 +// backend can only work with X11 displays in that version. +#define GDK_IS_X11_DISPLAY(dpy) (TRUE) + #endif // !__WXGTK3__ #endif // _WX_GTK_PRIVATE_COMPAT_H_ -- 2.7.0 ++++++ 0001-avoid-passing-invalid-rect-to-Refresh-closes-16819.patch ++++++
From d988a94acba127d7cf189eb391d81b0ff8ed992a Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Sun, 1 Feb 2015 18:06:06 +0000 Subject: [PATCH] avoid passing invalid rect to Refresh(), closes #16819
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 6d7815a..720db75 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2114,7 +2114,8 @@ void wxGridWindow::OnFocus(wxFocusEvent& event) m_owner->GetGridCursorCol()); const wxRect cursor = m_owner->BlockToDeviceRect(cursorCoords, cursorCoords); - Refresh(true, &cursor); + if (cursor != wxGridNoCellRect) + Refresh(true, &cursor); } if ( !m_owner->GetEventHandler()->ProcessEvent( event ) ) -- 2.7.0 ++++++ 0001-set-transient-parent-for-about-dialog-closes-16823.patch ++++++
From bb3dcf85fb05324a4fb71769635a820661c82797 Mon Sep 17 00:00:00 2001 From: Paul Cornett
Date: Mon, 2 Feb 2015 18:31:24 +0000 Subject: [PATCH] set transient parent for 'about' dialog, closes #16823
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
src/gtk/aboutdlg.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gtk/aboutdlg.cpp b/src/gtk/aboutdlg.cpp
index fc978bf..e65eb41 100644
--- a/src/gtk/aboutdlg.cpp
+++ b/src/gtk/aboutdlg.cpp
@@ -23,7 +23,7 @@
#include "wx/aboutdlg.h"
#ifndef WX_PRECOMP
- #include "wx/utils.h" // for wxLaunchDefaultBrowser()
+ #include "wx/window.h"
#endif //WX_PRECOMP
#include
From d4aaa5f40a372ca9651b07f4a68f66703e94caf5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Wed, 19 Nov 2014 13:29:13 +0000 Subject: [PATCH 2/5] Don't defer wxTLW initialization in wxGTK when not using X11.
See #16688. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 71ee5e8..386b739 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -954,6 +954,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) deferShow = m_deferShowAllowed && gs_requestFrameExtentsStatus != RFE_STATUS_BROKEN && !gtk_widget_get_realized(m_widget) && + GDK_IS_X11_DISPLAY(gtk_widget_get_display(m_widget)) && g_signal_handler_find(m_widget, GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET), -- 2.7.0 ++++++ 0003-Don-t-use-frame-extents-when-not-using-X11-in-wxGTK.patch ++++++
From 015206314b707e6dc1737f116fe951be967d3d3f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Wed, 19 Nov 2014 13:29:18 +0000 Subject: [PATCH 3/5] Don't use frame extents when not using X11 in wxGTK.
See #16688. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 386b739..511324a 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -452,8 +452,12 @@ gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget), bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom) { #ifdef GDK_WINDOWING_X11 - static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false); GdkDisplay* display = gdk_window_get_display(window); + + if (!GDK_IS_X11_DISPLAY(display)) + return false; + + static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false); Atom xproperty = gdk_x11_atom_to_xatom_for_display(display, property); Atom type; int format; -- 2.7.0 ++++++ 0004-Don-t-crash-when-switching-to-full-screen-in-non-X11.patch ++++++
From a6b14c2ed1b653a3b7d30911ca5bbab0f7b78b14 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Wed, 19 Nov 2014 13:29:23 +0000 Subject: [PATCH 4/5] Don't crash when switching to full screen in non X11-based wxGTK.
Only use internal X11 display if we're running in a such environment. See #16688. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 511324a..62cfe1a 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -852,10 +852,19 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) m_fsIsShowing = show; + wxX11FullScreenMethod method = wxX11_FS_WMSPEC; + Display* xdpy = NULL; + Window xroot = None; + #ifdef GDK_WINDOWING_X11 - Display* xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget)); - Window xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget)); - wxX11FullScreenMethod method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot); + GdkDisplay *display = gtk_widget_get_display(m_widget); + + if (GDK_IS_X11_DISPLAY(display)) + { + xdpy = GDK_DISPLAY_XDISPLAY(display); + xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget)); + method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot); + } // NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions // to switch to fullscreen, which is not always available. We must @@ -870,7 +879,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); } #ifdef GDK_WINDOWING_X11 - else + else if (xdpy != NULL) { GdkWindow* window = gtk_widget_get_window(m_widget); Window xid = GDK_WINDOW_XID(window); -- 2.7.0 ++++++ 0005-Don-t-use-X11-only-functions-when-not-using-X11-in-w.patch ++++++
From 17135e0a7704b55db39110c2d55b9beda00ef7ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Wed, 19 Nov 2014 13:29:28 +0000 Subject: [PATCH 5/5] Don't use X11-only functions when not using X11 in wxGTK.
See #16688. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 321d681..49d0626 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -849,28 +849,31 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } #ifdef GDK_WINDOWING_X11 - // we want to always get the same key code when the same key is - // pressed regardless of the state of the modifiers, i.e. on a - // standard US keyboard pressing '5' or '%' ('5' key with - // Shift) should result in the same key code in OnKeyDown(): - // '5' (although OnChar() will get either '5' or '%'). - // - // to do it we first translate keysym to keycode (== scan code) - // and then back but always using the lower register - Display *dpy = (Display *)wxGetDisplay(); - KeyCode keycode = XKeysymToKeycode(dpy, keysym); - - wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode); + if (GDK_IS_X11_DISPLAY(gdk_window_get_display(gdk_event->window))) + { + // we want to always get the same key code when the same key is + // pressed regardless of the state of the modifiers, i.e. on a + // standard US keyboard pressing '5' or '%' ('5' key with + // Shift) should result in the same key code in OnKeyDown(): + // '5' (although OnChar() will get either '5' or '%'). + // + // to do it we first translate keysym to keycode (== scan code) + // and then back but always using the lower register + Display *dpy = (Display *)wxGetDisplay(); + KeyCode keycode = XKeysymToKeycode(dpy, keysym); + + wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode); #ifdef HAVE_X11_XKBLIB_H - KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0); + KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0); #else - KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0); + KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0); #endif - // use the normalized, i.e. lower register, keysym if we've - // got one - key_code = keysymNormalized ? keysymNormalized : keysym; + // use the normalized, i.e. lower register, keysym if we've + // got one + key_code = keysymNormalized ? keysymNormalized : keysym; + } #else key_code = keysym; #endif -- 2.7.0