Results 1 to 4 of 4

Thread: Kana Lock Detection

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Kana Lock Detection

    Hi, I'm very new to Qt, but I have been recently been assigned to a project involving Qt & X11 in Linux (a flavor of Ubuntu). One of my tasks is to write a function to detect the state of caps lock, number lock, scroll lock, and Kana lock. So far, I have been able to detect caps, number, and scroll lock, but can't seem to figure out Kana lock. Does anyone know how to use XkbGetIndicatorState() to detect Kana lock? If not, does anyone know a better, or different, method that is capable of detecting the state of all four?


    My code for the other three is:

    //---------------------------------------------------
    Qt Code:
    1. #include <iostream>
    2. #include <X11/KBlib.h>
    3. #include <X11/Xlib.h>
    4.  
    5. using namespace std;
    6.  
    7. int main( int argc, char *argv[] ){
    8.  
    9. unsigned kbd_state, led_state=0;
    10. XkbGetIndicatorState( NULL, XkbUseCoreKbd, &kbd_state );
    11.  
    12. // here is the logic for lock detection
    13. if( (kbd_state & 0x01) == 1 ) led_state += 1; // if caps lock is on
    14. if( (kbd_state & 0x02) == 2 ) led_state += 2; // if number lock is on
    15. if( (kbd_state & 0x04) == 4 ) led_state += 4; // if scroll lock is on
    16. // if( (kbd_state & ????) == ? ) led_state += ?; // is kana lock on??????
    17.  
    18. return 0;
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 

    //---------------------------------------------------


    Any help would be really appreciated! Thanks!
    Last edited by high_flyer; 13th September 2011 at 09:47. Reason: code tags

Similar Threads

  1. lock a file
    By Malek in forum Newbie
    Replies: 2
    Last Post: 27th December 2010, 23:44
  2. Lock a file
    By euthymos in forum Qt Programming
    Replies: 22
    Last Post: 27th December 2010, 23:29
  3. Lock Screen
    By ahmdsd_ostora in forum Qt Programming
    Replies: 16
    Last Post: 11th July 2010, 09:55
  4. Lock strategy
    By pippo42 in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2010, 10:31
  5. QMutex seems not to lock()
    By sylvaticus in forum Qt Programming
    Replies: 18
    Last Post: 4th December 2009, 10:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.