Skip to content

Commit 0ae116f

Browse files
Updates based on review comments
1 parent c4961b1 commit 0ae116f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/Toolkit.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ public KeyCode getPlatformShortcutKey() {
875875
}
876876

877877
/**
878-
* Return the lock state for the given keyCode.
878+
* Returns the lock state for the given keyCode.
879879
* @param keyCode the keyCode to check
880880
* @return the lock state for the given keyCode.
881881
*/

modules/javafx.graphics/src/main/native-glass/gtk/glass_key.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -378,23 +378,23 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1isKeyLocked
378378
return com_sun_glass_events_KeyEvent_KEY_LOCK_UNKNOWN;
379379
}
380380

381-
Atom atom = None;
381+
Atom keyCodeAtom = None;
382382
switch (keyCode) {
383383
case com_sun_glass_events_KeyEvent_VK_CAPS_LOCK:
384-
atom = XInternAtom(display, "Caps Lock", True);
384+
keyCodeAtom = XInternAtom(display, "Caps Lock", True);
385385
break;
386386

387387
case com_sun_glass_events_KeyEvent_VK_NUM_LOCK:
388-
atom = XInternAtom(display, "Num Lock", True);
388+
keyCodeAtom = XInternAtom(display, "Num Lock", True);
389389
break;
390390
}
391391

392-
if (atom == None) {
392+
if (keyCodeAtom == None) {
393393
return com_sun_glass_events_KeyEvent_KEY_LOCK_UNKNOWN;
394394
}
395395

396396
Bool isLocked = False;
397-
if (XkbGetNamedIndicator(display, atom, NULL, &isLocked, NULL, NULL)) {
397+
if (XkbGetNamedIndicator(display, keyCodeAtom, NULL, &isLocked, NULL, NULL)) {
398398
if (isLocked) {
399399
return com_sun_glass_events_KeyEvent_KEY_LOCK_ON;
400400
} else {

modules/javafx.graphics/src/main/native-glass/mac/GlassKey.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ BOOL GetMacKey(jint javaKeyCode, unsigned short *outMacKeyCode)
404404
JNIEXPORT jint JNICALL Java_com_sun_glass_ui_mac_MacApplication__1isKeyLocked
405405
(JNIEnv * env, jobject obj, jint keyCode)
406406
{
407-
NSUInteger modifierFlags = [NSEvent modifierFlags];
408407
NSUInteger mask = 0;
409408
switch (keyCode) {
410409
case com_sun_glass_events_KeyEvent_VK_CAPS_LOCK:
@@ -415,6 +414,7 @@ BOOL GetMacKey(jint javaKeyCode, unsigned short *outMacKeyCode)
415414
default:
416415
return com_sun_glass_events_KeyEvent_KEY_LOCK_UNKNOWN;
417416
}
417+
NSUInteger modifierFlags = [NSEvent modifierFlags];
418418
return (modifierFlags & mask) ? com_sun_glass_events_KeyEvent_KEY_LOCK_ON
419419
: com_sun_glass_events_KeyEvent_KEY_LOCK_OFF;
420420
}

0 commit comments

Comments
 (0)