-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Caps lock no longer crashes linux games
- Loading branch information
1 parent
7be7454
commit d29dd4a
Showing
6 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
package ca.afroman.input; | ||
|
||
import java.awt.Toolkit; | ||
import java.util.List; | ||
|
||
public class LockKey extends Key | ||
{ | ||
private boolean isToggled; | ||
|
||
public LockKey(List<Key> container, int... keyEvents) | ||
{ | ||
super(container, keyEvents); | ||
|
||
isToggled = false; | ||
} | ||
|
||
/** | ||
* @return if this lock key is currently in a toggled state or not. | ||
*/ | ||
public boolean isToggled() | ||
{ | ||
for (int event : keyEvents) | ||
// for (int event : keyEvents) | ||
// { | ||
// if (Toolkit.getDefaultToolkit().getLockingKeyState(event)) return true; | ||
// } | ||
return isToggled; | ||
} | ||
|
||
@Override | ||
public void update(int keyCode, boolean isPressed) | ||
{ | ||
super.update(keyCode, isPressed); | ||
|
||
if (isPressedFiltered()) | ||
{ | ||
if (Toolkit.getDefaultToolkit().getLockingKeyState(event)) return true; | ||
isToggled = !isToggled; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters