← Back to team overview

sikuli-driver team mailing list archive

[Bug 1947580] [NEW] Key.isLockOn() not detecting state on Linux

 

Public bug reported:

Trying to detect if the NUM_LOCK key is on at the start of the script.
Using Key.isLockOn() does not seem to work on Linux but does work on
Windows.  Using Sikuli 2.0.4.

Linux:
Settings.isLinux(): True
Key.isLockOn(Key.NUM_LOCK): False

Windows:
Settings.isLinux(): False
Key.isLockOn(Key.NUM_LOCK): True

Using the following workaround seems to work on both platforms:
import java.awt.Toolkit as TK;
import java.awt.event.KeyEvent as KE;
numIsOn = TK.getDefaultToolkit().getLockingKeyState(KE.VK_NUM_LOCK);

Linux:
Settings.isLinux(): True
numIsOn is: True

Windows:
Settings.isLinux(): False
numIsOn is: True

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to SikuliX.
https://bugs.launchpad.net/bugs/1947580

Title:
  Key.isLockOn() not detecting state on Linux

Status in SikuliX:
  New

Bug description:
  Trying to detect if the NUM_LOCK key is on at the start of the script.
  Using Key.isLockOn() does not seem to work on Linux but does work on
  Windows.  Using Sikuli 2.0.4.

  Linux:
  Settings.isLinux(): True
  Key.isLockOn(Key.NUM_LOCK): False

  Windows:
  Settings.isLinux(): False
  Key.isLockOn(Key.NUM_LOCK): True

  Using the following workaround seems to work on both platforms:
  import java.awt.Toolkit as TK;
  import java.awt.event.KeyEvent as KE;
  numIsOn = TK.getDefaultToolkit().getLockingKeyState(KE.VK_NUM_LOCK);

  Linux:
  Settings.isLinux(): True
  numIsOn is: True

  Windows:
  Settings.isLinux(): False
  numIsOn is: True

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1947580/+subscriptions



Follow ups