Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sinister Zeta Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sinister Zeta
Sinister Zeta Project
Commits
d99073e0
Commit
d99073e0
authored
4 years ago
by
Dallin Nickel (djn011)
Browse files
Options
Downloads
Patches
Plain Diff
add comments to controller classes
parent
07002bf8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!65
Prototype
,
!52
Feature addmacros
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Controller/KeyConversion.java
+3
-0
3 additions, 0 deletions
src/Controller/KeyConversion.java
src/Controller/KeyListener.java
+5
-2
5 additions, 2 deletions
src/Controller/KeyListener.java
src/Controller/RunHotkeys.java
+20
-4
20 additions, 4 deletions
src/Controller/RunHotkeys.java
with
28 additions
and
6 deletions
src/Controller/KeyConversion.java
+
3
−
0
View file @
d99073e0
...
...
@@ -4,6 +4,9 @@ import java.util.HashMap;
import
java.util.Map
;
public
final
class
KeyConversion
{
/**
* key map to convert from the keylistener keycodes to the windows keycodes
*/
public
static
final
HashMap
<
Integer
,
Integer
>
map
=
new
HashMap
<
Integer
,
Integer
>(){
{
put
(
0x0000
,
0x07
);
// UNDEFINED
...
...
This diff is collapsed.
Click to expand it.
src/Controller/KeyListener.java
+
5
−
2
View file @
d99073e0
...
...
@@ -8,14 +8,17 @@ import static Controller.KeyConversion.map;
import
static
ui
.
MainScreen
.
dict
;
public
class
KeyListener
implements
NativeKeyListener
{
/**
* empty constructor
*/
public
KeyListener
(){}
@Override
public
void
nativeKeyPressed
(
NativeKeyEvent
nativeKeyEvent
)
{
//if key pressed is in dictionary
try
{
OSInterface
.
getInstance
().
sendKey
(
dict
.
get
(
map
.
get
(
nativeKeyEvent
.
getKeyCode
())),
true
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
map
.
get
(
nativeKeyEvent
.
getKeyCode
()));
}
catch
(
Exception
ignored
)
{
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Controller/RunHotkeys.java
+
20
−
4
View file @
d99073e0
...
...
@@ -14,26 +14,42 @@ import java.util.logging.Level;
import
java.util.logging.LogManager
;
import
java.util.logging.Logger
;
public
class
RunHotkeys
implements
Runnable
{
/**
* allows the stopping of the key listener
*/
boolean
stop
=
false
;
/**
* Creates a new keylistener
* @throws NativeHookException
*/
public
RunHotkeys
()
throws
NativeHookException
{
GlobalScreen
.
registerNativeHook
();
GlobalScreen
.
addNativeKeyListener
(
new
KeyListener
());
LogManager
.
getLogManager
().
reset
();
// Get the logger for "org.jnativehook" and set the level to off.
Logger
logger
=
Logger
.
getLogger
(
GlobalScreen
.
class
.
getPackage
().
getName
());
logger
.
setLevel
(
Level
.
OFF
);
GlobalScreen
.
registerNativeHook
();
GlobalScreen
.
addNativeKeyListener
(
new
KeyListener
());
}
/**
* run until stoppage
*/
public
void
run
()
{
while
(!
stop
)
{
}
}
public
void
stop
()
{
/**
* stop the key listener
*/
public
void
stop
()
{
stop
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment