Changeset 132


Ignore:
Timestamp:
Feb 16, 2009, 8:39:23 PM (17 years ago)
Author:
lpino
Message:
  • Display.java. Implemented the getCursorLocation call
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Display.java

    r121 r132  
    133133    /* Keyboard and Mouse State */
    134134//@@TODO (dmik): not yet sure what do we need from these:   
    135 //    boolean lastVirtual;
     135    boolean lastVirtual;
    136136    boolean lockActiveWindow;
    137 //    int lastKey, lastAscii, lastMouse;
    138 //    byte [] keyboard = new byte [256];
     137    int lastKey, lastAscii, lastMouse;
     138    byte [] keyboard = new byte [256];
    139139    boolean accelKeyHit, mnemonicKeyHit;
    140140
     
    289289}
    290290
    291 //@@TODO (dmik): Do we need it in OS/2?
     291//@@TODO (dmik): Do we need it in OS/2?
     292//@@TODO (lpino): Implement WinSetKeyboardStateTable API
    292293//int asciiKey (int key) {
    293294//    if (OS.IsWinCE) return 0;
     
    296297//    for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
    297298//    if (!OS.GetKeyboardState (keyboard)) return 0;
     299//    if (!OS.WinSetKeyboardStateTable (OS.HWND_DESKTOP, keyboard, OS.FALSE)) return 0;
    298300//
    299301//    /* Translate the key to ASCII or UNICODE using the virtual keyboard */
     
    693695 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    694696 * </ul>
    695  */
    696 //@@TODO (dmik):using WinQueryCursorInfo (lpino): 
    697 //public Point getCursorLocation () {
    698 //    checkDevice ();
    699 //    POINT pt = new POINT ();
    700 //    OS.GetCursorPos (pt);
    701 //    return new Point (pt.x, pt.y);
    702 //}
     697 */ 
     698public Point getCursorLocation () {
     699    checkDevice ();
     700    POINTL pt = new POINTL ();
     701    CURSORINFO cursor = new CURSORINFO();
     702    if (!OS.WinQueryCursorInfo(OS.HWND_DESKTOP, cursor)) return null;
     703    pt.x = cursor.x;
     704    pt.y = cursor.y;
     705    return new Point (pt.x, pt.y);
     706}
    703707
    704708/**
Note: See TracChangeset for help on using the changeset viewer.