Direct access to the keyboard?

Hi all -
I'm having some trouble because I'm making an application that I want to run on all platforms. I'm creating it on OS X, but I want to have it run on Linux as well.
The problem, which I'm sure at least some of you are aware, is that in Linux (at least in KDE) the 'key repeat' function triggers 'key released' events as well as 'key pressed' events even when the user is holding down the key. This makes it very hard to do (seemingly) simple things like determine how long the user has been holding down a key.
I'm aware of some of the work arounds, so lets just get that out of the way:
1. Turn off 'key repeat'. That just isn't realistic if you want to make a commercial application you can't expect users to be changing their system settings to just run your application when they don't have to for any other application. C++ people would make fun of me ;)
2. Use a timer to figure out if the last 'key released' event was a real one. This doesn't work because it is hard to know what value the user has their key repeat set to, you don't know if the user is holding down the key or pressing it rapidly, and it adds extra overhead for OS's that don't have this problem.
3. Post the event to your internal actions and then consume it. Again, no way to tell if the user is holding down the key or not and you are somewhat dependant on the key repeat being very rapid.
So I figure that if I can at least just get an array or something of the current state of the keyboard, then I can figure all this out for myself. I'm asking this in the 'games' section because I know this is a common way to do games programming (in DirectX for example). I've looked at some of the Xith3D and similar boards, but everyone there seems to be happy with one of the previously mentioned solutions.
Is there a real solution to this? ...or if not, can I at least look at the key state myself and just deal with it on my own?
Thanks!

Thanks, Luther.
That solution works well on Linux, but fails on Mac OS X. (Have not tested on Windows).
I can't believe there's no way to do something as basic as actually knowing when the user has a key pressed down! This seems like a pretty big hole, and I imagine there must be some real workaround somewhere...
Here's another hack, but it only works in video games, etc., where you have a separate thread running (and SOMETIMES it may still fail due to synchronization issues):
http://forums.dreamincode.net/showtopic14233.htm
My solution, which may or may not work on any given OS, but worked when tested on Linux and Mac OS X:
          long lastUpTime=0;
          char lastUpChar='a';
               public void keyPressed(KeyEvent e) {
                    System.out.println("lastUpTime="+lastUpTime);
                    // it's zero under linux, it's <6 for Mac OS, so we just use 10ms tolerance
                    if (lastUpTime-e.getWhen()<10 && lastUpChar==e.getKeyChar()) {
                         System.out.println(" think it was FAKE released");
                         lastUpTime = 0;
                         lastUpChar='a';
                         return;
                    } else if (lastUpTime!=0) {
                         // okay, the key was released. log at that time.
                         System.out.println("Key released: \""+lastUpChar+"\" a while ago, at "+lastUpTime);
                         lastUpChar='a';
                         lastUpTime=0;
                         return;
                    System.out.println("Key pressed: "+e.getKeyChar());
                    lastUpTime=0;
                    lastUpChar='a';
               public void keyReleased(KeyEvent e) {
                    if (e.getKeyChar()==' ' || e.getKeyChar()=='b') {
                         System.out.println("Tentative key realeased: "+e.getKeyChar());
                         lastUpTime=e.getWhen();
                         lastUpChar=e.getKeyChar();
               }});

Similar Messages

  • How so i get direct Access to the Music/pics stored on NAS

    How so i get direct Access to the Music/pics stored on a Buffalo Link Station Live with my iPad without using a App? The NAS is conected with a Router. Privatfreigabe (dont know the english Word) is ok. The iTunes Server on NAS is activated. Nö Problem to get Access from iTunes on PCs.
    I just want to use the preinstalled Musik/Photo App to Listen/watch my Music/pics stored on the NAS without losging them on the iPad. Streaming is what i think of.

    Have a look at FileBrowser.
    https://itunes.apple.com/sg/app/filebrowser-access-files-on/id364738545?mt=8

  • When has firefox required direct access to the workstations camera?

    Can anyone provide an example of when Firefox requires direct access to the workstation camera? I do not know if Firefox even requires access to the camera

    Historically, access to the camera was only available through plugins like Flash. The Flash DLL runs in the plugin-container.exe process; if protected mode is in effect, it may also run outside of that process.
    I suspect that access through native APIs (e.g., [https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getUserMedia navigator.mozGetUserMedia]) is rare on the desktop. I don't recall getting any requests for it so far personally.

  • Some of the shortcut keys and directional keys on the keyboard are not working in FF 4 RC1 (i.e. Tab, Ctrl+C, arrow keys). They work fin in FF 3.6x and other applications.

    Crtl+C, Ctrl+V, Ctrl+X, Tab, and arrow keys do not work at all in FF4.0b13 and later. I am not sure about earlier versions as this is the first version I have tried.

    I found this helpful article (http://support.apple.com/kb/TS1381) and worked my way through the section "Some keys don't work as expected".
    All the following functions/settings are disabled or turned off:
    Text to speech / Speak selected text when the key is pressed
    Slow Keys
    Mouse Keys.
    The keyboard viewer just confirms my list of keys that are not working.
    Starting in safe mode makes no difference; nor does booting from the Mac OS X Install Disc and running Terminal from the Utilities menu. The same keys as before fail to work.
    This seems to confirm that it's a hardware issue. Anyone have any suggestions?

  • IOS 5 direct access to the camera is not shown

    After update to IOS5 the direct link to the camera (direct from the locked screen) is not there.
    any idea what to do?

    Double click your home button to bring up the camera button on the locked screen.

  • Left direction Key not working on the keyboard

    i have an hp envy 15 laptop.Recently my left direction key on the keyboard has stopped working.the warranty got over this month.can the key be repaired? or is there a way to find out if there is a software glitch involved in this.
    and what will be the charges if it has to be repaired
    I am a resident of India

    First, can you share the specific model of Envy 15 that you have?  If you aren't sure how to find that check out (How do I find my product name/number?)
    You mentioned that the left direction key has stopped working, can you explain that a bit more?  Is it stuck down, does it just not respond to getting pressed, does it respond incorrectly?  Do you have windows 7 or Windows 8?
    I would probably start with Notebook Keyboard Troubleshooting (Windows 7), there is a section on Stuck keys that might help, and several sections on possible software glitches that might cause keyboard problems, take a look through those solutions and see if they help.
    Another options is to run the Keyboard test as described under Component Tests in Testing for Hardware Failures (Windows 7, Vista).  This will tell you for sure if the keyboard is functional or not.
    As to figuring out how much a repair from HP would cost, for that you will need to contact your local HP support team there in India, as repair costs will be detirmined by exactly what is wrong, as well as your specific location and product model.
    R
    Although I am an HP Employee, I am speaking for myself and not for HP.

  • Server 2012 Direct Access Single NIC cant get it to work

    Hi,
    I am having some real issues with setting up Direct Access with Server 2012 and a Windows 8 client, it simply won’t work at all.
    First of all I should describe my setup:
    I have an internet connection with a static IPv4 address on the external network adapter of the router
    The internal network address (the address of the router which has the internet connection) is 192.168.1.1
    Server1 (windows 2008 R2 Standard) has a static IPv4 address 192.168.1.2 and has some ports forwarded from the router (443, 25, 80) this server is a domain controller, email server, and has the DNS, DHCP and
    certificate services
    Server 2 (Windows 2008 R2 standard) has static IPv4 address 192.168.1.3 it has no ports forwarded from the router as it has no services accessed externally, it is used as a file server and print server, backup
    domain controller and backup DNS.
    Server 3 (Windows 2012) has static IPv4 address 192.168.1.4 and has the Remote Access server role installed along with all the other default features and roles it requires in the setup process.
    These servers have all got an IPv6 address which I assume the server has configured automatically, there has been no deliberate configurations made to disable IPv6
    I have no UAG or proxy server or anything else to route packets to internal servers. Just this router which has the option for port forwarding (I assume that’s NAT isn’t it?) sorry don’t know much about that
    area.
    I go through the setup wizard in remote access to configure direct access, in the external URL I have entered da.mydomain.com and created a host A record in my external domain name providers DNS which points
    the da record to my external IP address. The wizard creates all the GPO’s, scoped correctly, and applied to a Windows 8 client. The operational status shows its all working and I got green ticks. However, when I connect the client to the internal network it
    doesn’t seem to have correctly got the DA settings. I run the following in powershell
    Get-DnsClientNrptPolicy
    Nothing displays – at all
    Get-NCSIPolicyConfiguration
    Description                   
    : NCSI Configuration
    CorporateDNSProbeHostAddress  
    : fdd8:dd4a:ea42:7777::7f00:1
    CorporateDNSProbeHostName     
    : directaccess-corpConnectivityHost.mydomain.local
    CorporateSitePrefixList       
    : {fdd8:dd4a:ea42:1::/64, fdd8:dd4a:ea42:7777::/96, fdd8:dd4a:ea42:1000::1/128,
    fdd8:dd4a:ea42:1000::2/128}
    CorporateWebsiteProbeURL      
    : http://directaccess-WebProbeHost.mydomain.local
    DomainLocationDeterminationURL : https://DirectAccess-NLS.mydomain.local:62000/insideoutside
    Get-DAConnectionStatus
    Get-DAConnectionStatus : Network Connectivity Assistant service is stopped or not responding.
    At line:1 char:1
    + Get-DAConnectionStatus
    + ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo         
    : NotSpecified: (MSFT_DAConnectionStatus:root/StandardCi...onnectionStatus) [Get-DAConnect
       ionStatus], CimException
    + FullyQualifiedErrorId : Windows System Error 1753,Get-DAConnectionStatus
    I go into services.msc and find that the network connectivity assistant is not started, it wont start either something must trigger it but I have no idea how to get it triggered to start… this might be my only
    source of problem perhaps but on a more network level question:
    If I have such ports as 80, and 443 (which I assume DA uses in some form with a public IPv4 internet address) directed at server 1, how does the DA connection get to server 3 which has the DA role installed?
    I could create another record on the server which also opens port 443 to server as well as for server 1, but then how would the router know which server to pass the DA connection to if the same port is open for two different servers?
    Either way, this first issue is that the client doesn’t seem to have the ability to connect internally correctly yet, so maybe this connectivity service is a good place to start? My understanding is that the
    networks icon in the system tray should show that there is a corporate connection, but it doesn’t. also, the client seems to have the NLS certificate in the computer certificate store, so the cert side of things is working and the GPO side is working.
    Many thanks
    Steve

    ahh i see, so just to enlighten me even further...
    If a company has two web servers that would mean they would need two different public facing IP addresses so they can route to each internal web server. If, like the big companies have, they
    may have many web servers (possibly more than 100) I’m assuming that simply buying more public IP addresses would have a limit, especially since the IPv4 address space is pretty much exhausted. So is this where proxy systems come into play like ISA and Forefront,
    is this what they do?
    I assume if such a product was implemented you could go down to just one or two public IP addresses, point all traffic to the ISA server and that in turn would do all the routing of packets
    to each server behind the NAT/router (probably based on some sort of domain name or sub domain namespace as it’s parameter for forwarding?)
    Secondly, what I have done is installed windows server 2012 and used that as a direct access client (I read on another forum that the windows 8 RP doesn’t have the enterprise bits to make this
    work). I have got much further with the 2012 server acting as a client (installed on laptop, installed desktop experience and wireless LAN), 
    but when I run the following command on my DA client I get the following status
    Get-DAConnectionStatus
    Status:                 
    connectedlocally
    Substatus:          
    none
    This appears to work fine, when im connected to the local network. But then I disconnect and run the command again and I get the following:
    Status:                 
    Error
    Substatus:          
    NameResolutionFailure
    On my router what I did is temporarily disable port 443 going to my original server and instead opened it up pointing to my other server, so 443 traffic should be going to my DA server now, but I don’t understand why its giving the name resolution failure
    status. I have a host A record called “da” with my domain hoster, and entered the full domain namespace in the DA wizard as da.mydomain.com (the Host A record has been up there for more than a week so it’s propagated through the net)
    So, a bit further but stuck again.

  • Direct Access Migration of Root CA

    We have a Domain Controller "DC01" which has the Enterprise Certificate Services role installed and the CA on this Domain Controller is named "DC01"
    The CDP location on the CA "DC01" is <servername> so effectively it's LDAP://DC01 (only LDAP is published on the certificates, no http etc.)
    The CA "DC01" issues the version1 "Computer" certificates with AutoEnrollment to all clients and all our internal clients and external clients have a "Computer" certificate from CA "DC01"
    Now we have an UAG SP3 server with Direct Access and all our clients connect successfull with Direct Access as it's setup now
    In the UAG configuration (wizard) on the IPsec Certificate Authentication screen on the option "Use a certificate from a trusted root CA" the "DC01" Root CA certificate is selected
    As Microsoft best-practises we want to move the Enterprise Certificate Services to a new member server "CS01" and effectively create a new Root CA "CS01"
    As we use the version1 "Computer" certificate template we cannot select "reenroll all certificate holders"
    so idea is to duplicate the "Computer" certificate template as a v2 template that supersedes the version1 computer template, this effectively replaces all current Computer certificates based on the old v1 computer template on clients.
    Then all clients get a new "Computer" certificate from the new Root CA but in the UAG Direct Access configuration the "IPsec Certificate Authentication" "Use a certificate from a trusted root CA" the old "DC01" Root CA
    certificate is still selected
    Question1; will this lock out clients that have a new Computer certificate from the new Root CA but the UAG Direct Access configuration still use the Root CA certificate from the old DC01 CA?
    Another idea is NOT to supersede the the version1 Computer certificate but AutoEnroll the new v2 duplicated Computer template.
    This means that clients will have a Computer certificate from the old CA "DC01" but also a Computer certificate from the new CA "CS1"
    Question2; can a client have 2 computer certificates (1 from old DC01 ca and 1 from new CS01 ca) and connect Direct Access and will this still work?

    Yes, the clients will still connect with two different certificates. I haven't had your exact situation before, but I have had to deal with a CA server that died, and we had to replace it with a new one. We stood up a new CA, issued "Computer"
    certificates again from the new CA (the old certs still existed on all the client computers) - and then switched the UAG settings over to the new root CA. This worked.
    I do recommend deleting the old certificates from the client computers if possible, so that there is no potential for conflict down the road, but the above scenario worked fine for us and I have also worked with numerous companies that have multiple machine-type
    certificates on their client computers and as long as they have one which meets the DA criteria and chains up to the CA that is active in the UAG config, it'll build tunnels.

  • JSP, Struts preventing direct access

    In a web application using Struts framework
    how can the direct access via the .do link can be avoided. I want users to use the button to move to the next page and i dont want to allow the direct access via do link.
    and
    when one page is visited and some work is done there. Then the user
    goes to some other page and visits the previous page. However, in
    that case my form is not initialized. How can this problem be solved?

    You can't avoid the .do link altogether. I am assuming that you have two page. First with 1.do and second with 2.do and you don't want the user to go directly to 2.do.
    To overcome this problem, you can write the logic on the second page to redirect it back to the first page. If they have directly gone to 2.do. The difference between button and the direct access is that first one can be post or get and the second one will be get call. Pls let me know if you need more clarifications on this.
    Try creating the form bean of session scope. In this case what will happen that the formbean will have the data captured earlier .. I mean aprtial of the data and that you can retrieve and set it th enext time.

  • Routing back to Direct Access Clients - is this possible?

    Hi,
    We have been using direct access for the past few months successfully, however the one problem we are still having is we can't use programs that require a route back to the Direct Access client (such as managing a Hyper-V machine on the local lan), using SourceOffsite
    or even using Remote Desktop to remote onto a direct access client or ping the direct access client.
    Our local LAN uses Ipv4 and we can route fine to the Direct Access clients from the Direct Access Server where the tunnel terminates but not from any other machine on the network. Do I need to change the direct access configuration to allow this or do I need
    to somehow create a route on my LAN for the direct access clients?
    Thanks in advance
    David

    I found out how to do this in this useful article and tested it and it is working fine - thanks.
    http://www.packtpub.com/article/configuring-manage-out-to-directaccess-clients

  • Cannot view history of direct access users connecting to Forefront UAG

    Hi, I'm trying to get a list of the users that have been connecting through UAG Direct Access for the past month. I've tried using the methods shown in the technet articles about monitoring of UAG Direct Access either using Powershell or the TMG event loggin
    console, using this links:
    http://technet.microsoft.com/en-us/library/gg313776.aspx
    http://technet.microsoft.com/en-us/library/gg313783.aspx
    Using the TMG event logging I see a lot of data from a few days back, even if the filter is set to 30 days, and the log is supposed to be up to 8GB in size before overwriting. The info that it shows is only about sessions to the portal trunk and not direct
    access. I know this because on the UAGModuleID column there is no there are no "connected" or "managed" sessions, all are SessionMgr, UserMgr, Filter and RDG mainly.
    Through powershell I tried running the following commands after importing the module according to the article:
    Get-Directaccessusers -showhistory $true and no results are shown.
    Get-Directaccessusers -showhistory $true -starttime "1/6/2015 8:00AM" and no results shown
    Get-Directaccessusers -showhistory $true -starttime "1/6/2015" no results
    Get-Directaccessusers -showhistory $true -starttime "1/2/2015 8:00AM" -Endtime "1/11/2015 8:00PM" no results
    Get-Directaccessusers -showhistory $true -username user = no results.
    Get-Directaccessusers -username user = no results
    the only command that shows any data is just Get-Directaccessusers but that shows the current Direct Access users, no history.
    I checked the Registry HKEY_LOCAL_MACHINE\SOFTWARE\WhaleCom\e-Gap\von\MonitorMgr\sql-builtin-log registry key and it is on 1.
    Any ideas on how can I get more history data on the direct access users connecting through UAG?
    Please let me know.
    Appreciated it.
    Thank you!
    Eduardo Rojas

    Russel,
    the problem has been solved now! The final thing missing was just a check in a  checkbox.
    Below a comprehensive explanation that may help others.
    We basically did what you proposed:
    We sent a ping from one of the DA-Clients to the TS-Farm members. Since we got replies, we knew that IPv6 communication generally is okay. The answer received was an IPv6. In this scenario we had not yet given any IPv6 to the farm-members! Thus we knew it must
    be comming from the DA DNS-Proxy. There are a number of DA-GPOs and one of them is dictating the net portion of the IPv6 to be used in DA-communication, appended by a hex-translation of the target computers IPv4. Therefore the DA DNS-Proxy is taking the GPO-set
    IPv6-value, adds the IPv4 in hex and sends it  back as an ICMP echo.
    With this in place and working correctly one can ping any domain host from any DA-Client. This is configured when initially setting up DA and is handled by the wizzard. Once DA is installed this should all be in place without extra user interaction.
    We then took those IPv6 answeres and turned them into fixed IPv6es of the farm-members (each member its own IPv6). So far so good, but this is where it still did not work. Evaluation of the Connection Broker log showed that the redirect reply still included
    only the IPv4 of the target farm-member. With that (after a short while) we realized that one has to set a
    check in the Connection Brokers Settings, so that the IPv6 LAN-Connection will be used for redirects as well and not only the IPv4 LAN-connection..... How stupid is that? :-)
    But as we all know - in dealing with server configuration - you should always "know before you go". But even though you may think you do, when finally arriving you know you didn't.... And that's what we call experinece.
    Thanks to Russel for your interest and help.
    Brgds Ralf

  • Stopping direct access to ECC

    we have earlier created few users in the ECC clients and the consultants are accessing it directly , now we want them to acess the system using SOLMAN only ...
    How can we stop the direct access to the ECC system , should we remove their login ID's from the ECC ..
    Please advice
    Regards

    Hi,
    You can't remove their user IDs in ECC otherwise they won't be able to connect remotely using the Trusted RFC. What can be done in that case is to distribute the saplogon.ini and to prevent its modification. Then you just have to remove the entry for connecting your ECC to prevent users from doing it.
    But whenever your SolMan will be down, the users won't be able to access the ECC...
    Hope it helps,
    Best regards,
    Stéphane.

  • Access 2010 Linked to Sharepoint online - avoid direct access to sharepoint stored data

    Hello,
    I have an access 2010 application (front end)  connected to SharePoint online team site (as back end).
    I wish to allow my users to work with the front end but to avoid direct access to the data on SharePoint Online.
    The user will open the access application and it will auto connect & work with SharePoint online.
    How can I implement this?
    Thank you for your help

    Hi,
    According to your description, my understanding is that you want to use Access 2010 to connect the SharePoint Online data.
    In Access 2010, you can connect the SharePoint list as a external datasource like the capture below. It will need to input url and user credentials to access SharePoint site in the wizard. If you want to connect automatically, you will need write some custom
    Micro code to achieve it.
    If you have some question about Micro code to connect SharePoint list automatically, I suggest you can create a new thread in Access Development, you will get more detailed information from there.
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • HT4907 I am able to connect to my Mac Mini on Back to My Mac through iCloud but the keyboard/trackpad on the MBAir or MBP with which I access does not register on the Mini.  So I can see the screen but cannot interact with it. Mini works accessing MBP/Air

    I am able to connect to my Mac Mini on Back to My Mac through iCloud but the keyboard/trackpad on the MBAir or MBP with which I access does not register on the Mini.  So I can see the screen but cannot interact with it. Mini works accessing MBP/Air and I can use Mini to input data or interact with screens of those computers.

    Regarding your first question about bookmarks, I think you discovered the answer in when you pressed the address bar. The second tab there has your bookmarks.
    As for the keyboard, I'm not sure why your Firefox is reacting so slowly; mine seems to show keyboards even when I don't want them. If you have accumulated a lot of history, perhaps that's an issue?
    Did you use any third party software to move your Firefox data from internal memory to the storage card?

  • After upgrading to iOS 8.3, the keyboard has frozen up  and I can no longer text or access my contacts.  I've re-booted the phone several times, to no avail.

      After upgrading to iOS 8.3, the keyboard has frozen and I can not longer text or access my contacts.  I literally just upgraded to an iPhone 6, but I'm just about ready to can this phone and go with an Android.  Can anyone help or have the same issues?

    Im having the same problem. This started with iOS 8 and Yosemite. Im in a group message with 10 people with and without iPhones. Currently have 9 threads and when ever a new person responds a new thread forms. they all have the same people but in a different order, that may be part of the reason why iMessage doesn't recognize them as the same conversation.
    As I'm writing this post 3 new threads opened and other people with and without iPhones are mentioning the same problem
    hope apple can fix this. VERY annoying

Maybe you are looking for

  • How do I get to the 'Print Mode Choice Box' in the Apple provided software for a Canon Pixma IP6210D Series printer?

    I downloaded the Apple software for my Pixma, IP6210D series printer.  There is no 'Color Matching', option or 'print options', pop up menu available.  According to the instructional book that came with the printer - the Mac how-to section those opti

  • Messages Issue Across Phone and Macs

    iPhone 5 running 8.1.1 iMessage is set to be sent to iPad, 2 iMacs and 1 Macbook air and able to send as SMS All computers up and running the latest update of Yosemite at 10.10.1 iMac  - mid 2007, everything works fine between phone and computer Macb

  • Anyone know how to cancel purchased downloads?

    So I have all these downloads - huge files - that I don't want anymore/ don't want to download... Can I get rid of them permanently without downloading 1st? I keep having to "pause" them every few minutes whenever I'm in iTunes...

  • Configuration error:1 on Mac

    Hi:  i have a Mac OS x 10.6.8, a few weeks ago i did an automatic software update for Adobe and now when i open .pdf files I get a Configuration Erro , error: 1 message and the file closes.  I've tried deleting the program and reinstalling twice, I s

  • Error code 4310

    Hi I know there has been a few discussions regarding error code 4310 when trying to burn CDs on itunes while my computer runs Windows 8. I have treid the solution of slowing down speed etc but I cant get it to work yet does anyone have another idea/s