Update of /cvsroot/perl-win32-gui/Win32-GUI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8883

Modified Files:
        CHANGELOG GUI.xs Listbox.xs 
Log Message:
bug fix and addition of GetKeyState

Index: GUI.xs
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.xs,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** GUI.xs      16 Mar 2006 21:11:11 -0000      1.50
--- GUI.xs      16 Mar 2006 21:31:42 -0000      1.51
***************
*** 42,46 ****
  
      ##########################################################################
!     # (@)METHOD:GetAsyncKeyState(key)
      # Retrieve the status of the specified virtual key at the time the 
function
      # is called. The status specifies whether the key is up or down.
--- 42,46 ----
  
      ##########################################################################
!     # (@)METHOD:GetAsyncKeyState(keyCode)
      # Retrieve the status of the specified virtual key at the time the 
function
      # is called. The status specifies whether the key is up or down.
***************
*** 54,62 ****
      int key
  CODE:
!     RETVAL = (GetAsyncKeyState(key) & 0x8000) >>16;
  OUTPUT:
      RETVAL
     
      ##########################################################################
      # (@)METHOD:GetKeyboardState()
      # Return array ref with the status of the 256 virtual keys. 
--- 54,94 ----
      int key
  CODE:
!     RETVAL = (GetAsyncKeyState(key) & 0x8000) >>15;
  OUTPUT:
      RETVAL
     
      ##########################################################################
+     # (@)METHOD:GetKeyState(keyCode)
+     # Retrieve the status of the specified virtual key at the time the last
+     # keyboard message was retrieved from the message queue.
+     #
+     # In scalar context returns a value specifying whether the key is up(0)
+     # or down(1). In list context, returns a 2 element list with the first
+     # element as in scalar context and the second member specifying whether
+     # the key is toggled(1) or not(0) - this is only meaningful for keys that
+     # have a toggled state: Caps Lock, Num Lock etc.
+     #
+     # keyCode -- If A..Z0..9, use the ASCII code. Otherwise, use 
+     # a virtual key code. Example: VK_SHIFT
+ void
+ GetKeyState(key)
+     int key
+ PREINIT:
+     USHORT result;
+ PPCODE:
+     result = (USHORT)GetKeyState(key);
+     if(GIMME_V == G_ARRAY) {
+           /* list context */
+           mXPUSHu((result & 0x8000) >> 15);
+           mXPUSHu(result & 0x0001);
+           XSRETURN(2);
+     }
+     else {
+           /* scalar(and void) context */
+           mXPUSHu((result & 0x8000) >> 15);
+           XSRETURN(1);
+     }
+ 
+     ##########################################################################
      # (@)METHOD:GetKeyboardState()
      # Return array ref with the status of the 256 virtual keys. 

Index: Listbox.xs
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Listbox.xs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Listbox.xs  3 Dec 2005 01:56:31 -0000       1.5
--- Listbox.xs  16 Mar 2006 21:31:42 -0000      1.6
***************
*** 663,669 ****
      UINT tab
  CODE:
!     DWORD * pBuf = (DWORD *) safemalloc(items * sizeof(DWORD));
      for (int i = 1; i < items; i++)
!         pBuf[i] = SvIV(ST(i));
      RETVAL = SendMessage(handle, LB_SETTABSTOPS, items-1, (LPARAM) pBuf);
      safefree(pBuf);
--- 663,669 ----
      UINT tab
  CODE:
!     DWORD * pBuf = (DWORD *) safemalloc((items-1) * sizeof(DWORD));
      for (int i = 1; i < items; i++)
!         pBuf[i-1] = SvIV(ST(i));
      RETVAL = SendMessage(handle, LB_SETTABSTOPS, items-1, (LPARAM) pBuf);
      safefree(pBuf);

Index: CHANGELOG
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** CHANGELOG   16 Mar 2006 21:11:11 -0000      1.72
--- CHANGELOG   16 Mar 2006 21:31:42 -0000      1.73
***************
*** 6,9 ****
--- 6,13 ----
  Win32-GUI ChangeLog
  ===================
+ + [Robert May] : 16 Mar 2006 - bug fix and addition of GetKeyState
+     - Added Win32::GUI::GetKeyState
+     - Listbox.xs fix to indexing error in SetTabStops().
+ 
  + [Robert May] : 11 Jan 2006 - bug fixes and add balloon tips for Notify Icon
      - Label.xs correct -truncate option processing, as SS_.*ELLIPSIS.*


Reply via email to