-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SSInput + Allow Keybindings #33983
base: dev
Are you sure you want to change the base?
Conversation
ff3c36f
to
1588766
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lack of support for parser clearing on a system with rather severe sticky-key problems makes this unsafe to test.
SSinput doesn't present a very big value-add over native functionality, in exchange for lumbering input with soft-code overhead, amongst other issues.
"Any" = "\"KeyDown \[\[*\]\]\"", | ||
"Any+UP" = "\"KeyUp \[\[*\]\]\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method of input interception is near-completely incompatible with "default"/ non-hotkey mode. Alternative ways of handling this exist, but aren't very pleasant and require significant additional code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be compatible? It exists separately. They don't intersect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize, the fact that this code has been substantially edited from what is usually considered SSInput wasn't noticed.
if(!prefs.hotkeys && length(_key) == 1 && _key != "Alt" && _key != "Ctrl" && _key != "Shift") | ||
var/current_text = winget(src, "input", "text") | ||
winset(src, "outputwindow.input", "focus=true;text=[current_text + url_encode(_key)]") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about as good as you can get while staying performant, but is also still not fast enough to not drop input above like, 70WPM.
The original code did not include reading back from the existing text, which is even slower, and will likely result in clobbering at even higher WPM due to the queued nature of instant
, and simultaneous access, with latency.
Input handling with respect to modifier keys gets incredibly weird if the textbox has both focus and content as well.
I didn't do it that way originally for that explicit reason. I simply accepted having one character as better than having nothing, which was the original state of this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Macro changes from hotkeys to default when hotkeys toggled so this piece of code is unnecessary. It exists just as fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code confused me, and caused me to fundamentally misunderstand the way they've altered this system. In the state it is, it seems like it'd function fine enough.
@@ -132,5 +135,7 @@ Thanks to spacemaniac and mcdonald for help with the JS side of this. | |||
winset(src, "asset_cache_browser", "background-color = none;background-color = [COLOR_DARKMODE_BACKGROUND]") | |||
winset(src, "asset_cache_browser", "text-color = #000000;text-color = [COLOR_DARKMODE_TEXT]") | |||
|
|||
//winset(src, "input", "background-color = none;background-color = [COLOR_DARKMODE_BACKGROUND]") | |||
//winset(src, "input", "text-color = #000000;text-color = [COLOR_DARKMODE_TEXT]") | |||
update_hotkey_mode() // Updates input color and focus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i see an issue why color doesn't update
winset(src, "hotkeytoggle", "background-color = #ffffff;background-color = #494949") | ||
winset(src, "hotkeytoggle", "text-color = #000000;text-color = [COLOR_DARKMODE_TEXT]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines 53-54 need to be removed in this case
Hotkey mode doesn't seem to toggle completely when pressing tab or the button, that should be fixed to act like it normally would before this is test merged. |
/proc/sanitize_islist(value, default) | ||
if(islist(value) && length(value)) | ||
return value | ||
if(default) | ||
return default | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to implement this proc instead of using the already existing LAZY_INIT_LIST()
define?
// This is for when macro sets are eventualy datumized | ||
/datum/controller/subsystem/input/proc/setup_default_macro_sets() | ||
macro_set = list( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dmdocs for procs and vars need three slashes to be parsed.
// This is for when macro sets are eventualy datumized | |
/datum/controller/subsystem/input/proc/setup_default_macro_sets() | |
macro_set = list( | |
/// This is for when macro sets are eventualy datumized | |
/datum/controller/subsystem/input/proc/setup_default_macro_sets() | |
macro_set = list( |
) | ||
|
||
|
||
// Badmins just wanna have fun ♪ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment isn't necessary.
// Badmins just wanna have fun ♪ |
|
||
// Badmins just wanna have fun ♪ | ||
/datum/controller/subsystem/input/proc/refresh_client_macro_sets() | ||
for(var/client/C in GLOB.clients) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for(var/client/C in GLOB.clients) | |
for(var/client/C as anything in GLOB.clients) |
|
||
|
||
/datum/controller/subsystem/input/fire() | ||
for(var/client/C in GLOB.clients) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for(var/client/C in GLOB.clients) | |
for(var/client/C as anything in GLOB.clients) |
// Only way to do that is to tie the behavior into the focus's keyLoop(). | ||
|
||
/atom/movable/keyLoop(client/user) | ||
var/movement_dir = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantics for bitfields.
var/movement_dir = 0 | |
var/movement_dir = EMPTY_BITFIELD |
/datum/proc/key_down(key, client/user) // Called when a key is pressed down initially | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/datum/proc/key_down(key, client/user) // Called when a key is pressed down initially | |
return | |
/// Called when a key is pressed down initially | |
/datum/proc/key_down(key, client/user) | |
return |
return | ||
|
||
|
||
/datum/proc/key_up(key, client/user) // Called when a key is released |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/datum/proc/key_up(key, client/user) // Called when a key is released | |
/// Called when a key is released | |
/datum/proc/key_up(key, client/user) |
return | ||
|
||
|
||
/datum/proc/keyLoop(client/user) // Called once every frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/datum/proc/keyLoop(client/user) // Called once every frame | |
/// Called once every frame | |
/datum/proc/keyLoop(client/user) |
// removes all the existing macros | ||
/client/proc/erase_all_macros() | ||
var/erase_output = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// removes all the existing macros | |
/client/proc/erase_all_macros() | |
var/erase_output = "" | |
/// removes all the existing macros | |
/client/proc/erase_all_macros() | |
var/erase_output = "" |
stale for now, i'll come back and work on this soon:tm: |
🆑
tweak: Keybinding can now be done.
tweak: Examining has a funny magnifying icon.
/:cl:
Picked up from #33851
Currently has the issues of: