Jump to content




Restrict hardcoded hotkeys to Left Control


  • You cannot reply to this topic
13 replies to this topic

#1 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 11 June 2013 - 09:19 AM

Hardcoded hotkeys (not sure if that's the right term - they are hardcoded for me because I can't do anything to them)... By those, I mean Ctrl+S as Fast-Shutdown (or Panic-Shutdown, whatever), Ctrl+T as Terminate, and (which brought me here) Ctrl+V as Clipboard-Paste. Those are not coded into the Lua part of CC, right?

I've been writing my OS for a while, and I began to work on the GUI three days ago. I've just finished the textbox, and thought that implementing the cut-copy-paste trio wouldn't be so bad nor so hard. I use Right Control as the "System key", so the copy method will fire only if one presses RControl+C (I didn't want to use LControl because of the old programs like "edit"). RControl+C works fine, okay. But when I tried to handle RControl+V, a lot of char events popped up from nowhere. I realized then, that's the hardcoded Clipboard-Paste function - it was pasting the contents of my clipboard.

So that. I'd like to suggest restricting these hardcoded hotkeys to LControl only, because:
  • This would allow people better handling of hotkeys.
  • As far as I know, there is no key on the right side of the keyboard that fires one of these hardcoded functions anyways.
  • Not to mention that I would be able to continue developing my OS :D
That's it.

LBPHacker

#2 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 11 June 2013 - 09:46 AM

I think this would be great. I never use right control for that stuff anyway.

#3 JJRcop

  • Members
  • 131 posts

Posted 11 June 2013 - 05:42 PM

This would be great.

#4 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 11 June 2013 - 06:36 PM

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

  • Not to mention that I would be able to continue developing my OS :D
When suggesting something you should think about what it does for the mod, not what it does for you.

#5 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 11 June 2013 - 07:33 PM

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

Hardcoded hotkeys (not sure if that's the right term - they are hardcoded for me because I can't do anything to them)... By those, I mean Ctrl+S as Fast-Shutdown (or Panic-Shutdown, whatever), Ctrl+T as Terminate, and (which brought me here) Ctrl+V as Clipboard-Paste. Those are not coded into the Lua part of CC, right?

I've been writing my OS for a while, and I began to work on the GUI three days ago. I've just finished the textbox, and thought that implementing the cut-copy-paste trio wouldn't be so bad nor so hard. I use Right Control as the "System key", so the copy method will fire only if one presses RControl+C (I didn't want to use LControl because of the old programs like "edit"). RControl+C works fine, okay. But when I tried to handle RControl+V, a lot of char events popped up from nowhere. I realized then, that's the hardcoded Clipboard-Paste function - it was pasting the contents of my clipboard.

So that. I'd like to suggest restricting these hardcoded hotkeys to LControl only, because:
  • This would allow people better handling of hotkeys.
  • As far as I know, there is no key on the right side of the keyboard that fires one of these hardcoded functions anyways.
  • Not to mention that I would be able to continue developing my OS :D
That's it.

LBPHacker


View PostSammich Lord, on 11 June 2013 - 06:36 PM, said:

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

  • Not to mention that I would be able to continue developing my OS :D
When suggesting something you should think about what it does for the mod, not what it does for you.

He didn't JUST suggest that, you know. And I can see a bunch of uses for this making THE MOD better too.

#6 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 11 June 2013 - 07:45 PM

View PostMudkipTheEpic, on 11 June 2013 - 07:33 PM, said:

View PostSammich Lord, on 11 June 2013 - 06:36 PM, said:

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

  • Not to mention that I would be able to continue developing my OS :D
When suggesting something you should think about what it does for the mod, not what it does for you.

He didn't JUST suggest that, you know. And I can see a bunch of uses for this making THE MOD better too.
I know he suggested more than just that. But the point of a suggestion is to convince the authors why a suggestion will help the mod out. If they accepted every suggestion to help one person out the mod will be total crap.

#7 JJRcop

  • Members
  • 131 posts

Posted 11 June 2013 - 08:32 PM

View PostSammich Lord, on 11 June 2013 - 07:45 PM, said:

View PostMudkipTheEpic, on 11 June 2013 - 07:33 PM, said:

View PostSammich Lord, on 11 June 2013 - 06:36 PM, said:

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

-snip-
When suggesting something you should think about what it does for the mod, not what it does for you.

He didn't JUST suggest that, you know. And I can see a bunch of uses for this making THE MOD better too.
I know he suggested more than just that. But the point of a suggestion is to convince the authors why a suggestion will help the mod out. If they accepted every suggestion to help one person out the mod will be total crap.
It helps a lot of people out, and allows them to use those hotkeys for the right-control without worry of triggering the system hotkeys.

#8 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 11 June 2013 - 09:26 PM

View PostJJRcop, on 11 June 2013 - 08:32 PM, said:

View PostSammich Lord, on 11 June 2013 - 07:45 PM, said:

View PostMudkipTheEpic, on 11 June 2013 - 07:33 PM, said:

View PostSammich Lord, on 11 June 2013 - 06:36 PM, said:

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

-snip-
When suggesting something you should think about what it does for the mod, not what it does for you.

He didn't JUST suggest that, you know. And I can see a bunch of uses for this making THE MOD better too.
I know he suggested more than just that. But the point of a suggestion is to convince the authors why a suggestion will help the mod out. If they accepted every suggestion to help one person out the mod will be total crap.
It helps a lot of people out, and allows them to use those hotkeys for the right-control without worry of triggering the system hotkeys.
He makes good points with this suggestion, I never said he didn't. I was just stating in general you shouldn't make a suggestion for yourself, but instead make it for the mod itself.

#9 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 12 June 2013 - 01:19 AM

This indeed would be quite nice

#10 GopherAtl

  • Members
  • 888 posts

Posted 12 June 2013 - 01:47 PM

It is possible to detect and override this behavior yourself.

When text is inserted by paste, you will get only the char events for the pasted characters, without the usual proceeding key events. A pull event replacement function can identify these cases for you.

--ctrlkey pullEvent replacement

--the previous event, held for checking
local prevEvent={}

--table mapping characters to the corresponding key ids
local charToKey = {["P"]=25,["S"]=31,["R"]=19,["U"]=22,["T"]=20,["W"]=17,["V"]=47,["Y"]=21,["X"]=45,["["]=26,["Z"]=44,["]"]=27,["\\"]=43,["_"]=12,["^"]=7,["a"]=30,["c"]=46,["b"]=48,["e"]=18,["d"]=32,["g"]=34,["f"]=33,["i"]=23,["h"]=35,["k"]=37,["j"]=36,["m"]=50,["l"]=38,["o"]=24,["n"]=49,["q"]=16,["p"]=25,["s"]=31,["r"]=19,["u"]=22,["t"]=20,["w"]=17,["v"]=47,["y"]=21,["x"]=45,["{"]=26,["z"]=44,["}"]=27,["|"]=43,["~"]=41,["!"]=2,["#"]=4,["\""]=40,["%"]=6,["$"]=5,["'"]=40,["&"]=8,[")"]=11,["("]=10,["+"]=13,["*"]=9,["-"]=12,[","]=51,["/"]=53,["."]=52,["1"]=2,["0"]=11,["3"]=4,["2"]=3,["5"]=6,["4"]=5,["7"]=8,["6"]=7,["9"]=10,["8"]=9,[";"]=39,[":"]=39,["="]=13,["<"]=51,["?"]=53,[">"]=52,["A"]=30,["@"]=3,["C"]=46,["B"]=48,["E"]=18,["D"]=32,["G"]=34,["F"]=33,["I"]=23,["H"]=35,["K"]=37,["J"]=36,["M"]=50,["L"]=38,["O"]=24,["N"]=49,["Q"]=16,}

function filteredPullEvent()
  local e=nil
  while e==nil do
	e={os.pullEvent()}
	if e[1]=="char" then
	  --event is char; was previous the corresponding key?
	  if prevEvent[2]~=charToKey[e[2]] then
		--this char event had no key event; it is a pasted character.
		--discard it, and the loop will repeat
		e=nil
	  end
	end
  end

  prevEvent=e
  return unpack(e)  
end

--test code to demonstrate
while true do
  local event={filteredPullEvent()}
  print(table.concat(event," "))
end

if you're already detecting ctrl+v, with ctrl held, rather than ctrl followed by v (which can be done in a vaguely similar way, see my ctrlkeys api in my apis thread for an example), then you should be able to figure out how to incorporate this into your existing function, or you can use it as-is here in this post.

I just remembered after hitting submit, ctrl+v is an exception, in fact the ONLY ctrl+letter combination that can't be detected, because the v key event is eaten somewhere before it would be passed to lua. Ctrl+s, ctrl+r, ctrl-t, ctrl-c, and ctrl-x all pass key events for ctrl and the character, only ctrl+v does not, for some reason.
I think I've asked for this before, but if it is cc's code, and not something in java, that is eating this "v" event, I'd quite like to see that changed, so that ctrl+v behaves like all the other ctrl+letter key combinations.

#11 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 18 June 2013 - 01:00 PM

I think this really should be implemented for possibilities that are awesome! :D

#12 aaa

  • Members
  • 53 posts

Posted 04 July 2013 - 12:32 PM

View PostSammich Lord, on 11 June 2013 - 09:26 PM, said:

View PostJJRcop, on 11 June 2013 - 08:32 PM, said:

View PostSammich Lord, on 11 June 2013 - 07:45 PM, said:

View PostMudkipTheEpic, on 11 June 2013 - 07:33 PM, said:

View PostSammich Lord, on 11 June 2013 - 06:36 PM, said:

View PostLBPHacker, on 11 June 2013 - 09:19 AM, said:

-snip-
When suggesting something you should think about what it does for the mod, not what it does for you.
He didn't JUST suggest that, you know. And I can see a bunch of uses for this making THE MOD better too.
I know he suggested more than just that. But the point of a suggestion is to convince the authors why a suggestion will help the mod out. If they accepted every suggestion to help one person out the mod will be total crap.
It helps a lot of people out, and allows them to use those hotkeys for the right-control without worry of triggering the system hotkeys.
He makes good points with this suggestion, I never said he didn't. I was just stating in general you shouldn't make a suggestion for yourself, but instead make it for the mod itself.

Some people are coding their own OS, or looking for OS coded by someone else, or at least for IDE ; and that's a problem he encounters doing this. Making suggestions based on personal experience makes more sense than trying to imagine what would possibly fit to the mod. That's precisely the point and the use of suggestions.

#13 robhol

  • Members
  • 182 posts

Posted 05 July 2013 - 03:12 AM

View PostSammich Lord, on 11 June 2013 - 07:45 PM, said:

I know he suggested more than just that. But the point of a suggestion is to convince the authors why a suggestion will help the mod out. If they accepted every suggestion to help one person out the mod will be total crap.

Lol. Because there's a real danger of that happening(!)

#14 ChunLing

  • Members
  • 2,027 posts

Posted 05 July 2013 - 04:40 PM

Okay, the real danger would be that they simply started ignoring user feedback entirely. Which I sometimes think wouldn't be a terrible thing anyway.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users