Add an environment variable that toggles key event debugging messages for bug #1161.

[GB.QT4]
* NEW: Add an environment variable that toggles key event debugging messages for bug #1161.

[GB.QT5]
* NEW: Add an environment variable that toggles key event debugging messages for bug #1161.
This commit is contained in:
gambas 2017-09-07 22:00:17 +02:00
parent bac61774be
commit b4899b113b
3 changed files with 23 additions and 2 deletions

View file

@ -2898,6 +2898,20 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event)
{
QKeyEvent *kevent = (QKeyEvent *)event;
if (MAIN_key_debug)
{
#ifdef QT5
qDebug("gb.qt5"
#else
qDebug("gb.qt4"
#endif
": %s: real = %d original = %d no_keyboard = %d",
(type == QEvent::KeyRelease ? "KeyRelease" :
type == QEvent::KeyPress ? "KeyPress" :
type == QEvent::InputMethod ? "InputMethod" : "?"),
real, original, control->flag.no_keyboard);
}
#if QT_VERSION <= 0x030005
if (!real || !original)
goto _DESIGN;

View file

@ -131,6 +131,7 @@ int MAIN_x11_last_key_code = 0;
#endif
bool MAIN_debug_busy = false;
bool MAIN_init = false;
bool MAIN_key_debug = false;
GB_CLASS CLASS_Control;
GB_CLASS CLASS_Container;
@ -875,6 +876,7 @@ static void QT_Init(void)
{
static bool init = false;
QFont f;
char *env;
if (init)
return;
@ -890,7 +892,7 @@ static void QT_Init(void)
if (::strcmp(qApp->style()->metaObject()->className(), "Breeze::Style") == 0)
{
char *env = getenv("GB_QT_NO_BREEZE_FIX");
env = getenv("GB_QT_NO_BREEZE_FIX");
if (!env || atoi(env) == 0)
{
CSTYLE_fix_breeze = TRUE;
@ -899,7 +901,7 @@ static void QT_Init(void)
}
else if (::strcmp(qApp->style()->metaObject()->className(), "Oxygen::Style") == 0)
{
char *env = getenv("GB_QT_NO_OXYGEN_FIX");
env = getenv("GB_QT_NO_OXYGEN_FIX");
if (!env || atoi(env) == 0)
{
CSTYLE_fix_oxygen = TRUE;
@ -928,6 +930,10 @@ static void QT_Init(void)
MyApplication::initClipboard();
env = getenv("GB_QT_KEY_DEBUG");
if (env && atoi(env) != 0)
MAIN_key_debug = TRUE;
init = true;
}

View file

@ -51,6 +51,7 @@ extern int MAIN_loop_level;
extern int MAIN_scale;
extern bool MAIN_debug_busy;
extern bool MAIN_init;
extern bool MAIN_key_debug;
#ifndef NO_X_WINDOW
extern int MAIN_x11_last_key_code;
#endif