JBR-4394, IDEA-246833: fixup of JBR-2444.

(cherry picked from commit ef262dc8bb)
(cherry picked from commit b026461771)
This commit is contained in:
Nikita Provotorov
2022-04-11 19:06:58 +07:00
committed by jbrbot
parent 6fd032363a
commit 05d799baf1

View File

@@ -661,7 +661,7 @@ static const int DEFAULT_THRESHOLD = 5;
static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
// Fix for JBR-2444
// By default filteredEventsThreshold == 5, you can turn it of with
// By default filteredEventsThreshold == 5, you can turn it off with
// recreate.x11.input.method=false
if (filteredEventsThreshold < 0) {
filteredEventsThreshold = 0;
@@ -675,19 +675,21 @@ static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
jstring name = (*env)->NewStringUTF(env, "recreate.x11.input.method");
CHECK_NULL(name);
jstring jvalue = (*env)->CallStaticObjectMethod(env, systemCls, mid, name);
if (jvalue != NULL) {
if (jvalue == NULL) {
filteredEventsThreshold = DEFAULT_THRESHOLD;
} else {
const char * utf8string = (*env)->GetStringUTFChars(env, jvalue, NULL);
if (utf8string != NULL) {
const int parsedVal = atoi(utf8string);
if (parsedVal > 0)
filteredEventsThreshold = parsedVal;
else if (strncmp(utf8string, "false", 5) == 0)
filteredEventsThreshold = 0;
else if (strncmp(utf8string, "true", 4) == 0)
filteredEventsThreshold = DEFAULT_THRESHOLD;
}
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
} else {
filteredEventsThreshold = DEFAULT_THRESHOLD;
}
(*env)->DeleteLocalRef(env, name);
}
if (filteredEventsThreshold <= 0)