From b225a3260bebc6d63b910f2dd2bef25d216e89fe Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 28 Feb 2020 15:50:48 +0100 Subject: [PATCH 1/3] x11: fix support for dead keys It seems to be required to pass a window to XCreateIC for receiving dead keys. --- panda/src/x11display/x11GraphicsWindow.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 7dbd7c53dc..2d6b75740f 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -1081,10 +1081,8 @@ open_window() { XIM im = x11_pipe->get_im(); _ic = nullptr; if (im) { - _ic = XCreateIC - (im, - XNInputStyle, XIMPreeditNothing | XIMStatusNothing, - nullptr); + _ic = XCreateIC(im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, _xwindow, nullptr); if (_ic == (XIC)nullptr) { x11display_cat.warning() << "Couldn't create input context.\n"; From 4383fceba27bae6c496cf22c5ee65cd7ba4e1314 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 28 Feb 2020 15:53:21 +0100 Subject: [PATCH 2/3] x11: fall back to @im=none if XOpenIM failed This helps if the user has configured an invalid input method in their XMODIFIERS variable. --- panda/src/x11display/x11GraphicsPipe.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index 8f87b57609..64393a1541 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -278,8 +278,13 @@ x11GraphicsPipe(const std::string &display) : // Connect to an input method for supporting international text entry. _im = XOpenIM(_display, nullptr, nullptr, nullptr); if (_im == (XIM)nullptr) { - x11display_cat.warning() - << "Couldn't open input method.\n"; + // Fall back to internal input method. + XSetLocaleModifiers("@im=none"); + _im = XOpenIM(_display, nullptr, nullptr, nullptr); + if (_im == (XIM)nullptr) { + x11display_cat.warning() + << "Couldn't open input method.\n"; + } } // What styles does the current input method support? From eccfce4606aa1d6a9ea6ecf3799cb821d03344bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Derzsi=20D=C3=A1niel?= Date: Thu, 27 Feb 2020 15:09:28 +0200 Subject: [PATCH 3/3] task: Fix memory leak related to Python 3 signal API changes Python 3's signal.py API does not properly support custom signal handlers. An exception is created every frame because of this, which fills up the memory of the application. Closes #873 --- direct/src/task/Task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index e67f191d83..93e30eb3db 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -17,9 +17,13 @@ from direct.showbase.MessengerGlobal import messenger import types import random import importlib +import sys try: - import signal + if sys.version_info >= (3, 0): + import _signal as signal + else: + import signal except ImportError: signal = None