/[rdesktop]/sourceforge.net/trunk/rdesktop/uiports/svgawin.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/uiports/svgawin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 810 by jsorg71, Fri Jul 9 17:27:56 2004 UTC revision 811 by jsorg71, Mon Feb 7 00:54:10 2005 UTC
# Line 30  Line 30 
30  #include <stdarg.h> // va_list va_start va_end  #include <stdarg.h> // va_list va_start va_end
31    
32    
33    #include <sys/ioctl.h>
34    #include <linux/keyboard.h>
35    #include <linux/kd.h>
36    #include <fcntl.h>
37    
38  extern int g_tcp_port_rdp;  extern int g_tcp_port_rdp;
39  int g_use_rdp5 = 0;  int g_use_rdp5 = 0;
40  char g_hostname[16] = "";  char g_hostname[16] = "";
# Line 59  static uint32* colmap = 0; Line 64  static uint32* colmap = 0;
64  static uint8* desk_save = 0;  static uint8* desk_save = 0;
65  static int g_server_Bpp = 1;  static int g_server_Bpp = 1;
66    
67    /* Keyboard LEDS */
68    static int numlock;
69    static int capslock;
70    static int scrolllock;
71    
72  // this is non null if vgalib has non accel functions available  // this is non null if vgalib has non accel functions available
73  // reading from video memory is sooo slow  // reading from video memory is sooo slow
74  static uint8* sdata = 0;  static uint8* sdata = 0;
# Line 119  typedef struct Line 129  typedef struct
129    
130  myrect* head_rect = 0;  myrect* head_rect = 0;
131    
132    // Keyboard stuff - PeterS
133    
134    static void setled(int mask, int state)
135    {
136      int fd;
137      long int leds;
138      
139      if (( fd=open("/dev/console", O_NOCTTY)) != -1 )
140      {
141        if (ioctl (fd, KDGETLED, &leds) != -1)
142        {
143          leds &= 7;
144          if (state)
145            leds |= mask;
146          else
147            leds &= ~mask;  
148          ioctl (fd, KDSETLED, leds);      
149        }
150        close(fd);
151      }
152    }
153    
154    
155  //*****************************************************************************  //*****************************************************************************
156  // do a raster op  // do a raster op
157  int rop(int rop, int src, int dst)  int rop(int rop, int src, int dst)
# Line 734  void key_event(int scancode, int pressed Line 767  void key_event(int scancode, int pressed
767      return;      return;
768    rdpkey = scancode;    rdpkey = scancode;
769    ext = 0;    ext = 0;
770      
771      // Keyboard LEDS
772      if ((scancode == SCANCODE_CAPSLOCK) && pressed)
773      {
774         capslock = !capslock;
775         setled(LED_CAP, capslock);
776      }
777      if ((scancode == SCANCODE_SCROLLLOCK) && pressed)
778      {
779         scrolllock = !scrolllock;
780         setled(LED_SCR, scrolllock);
781      }
782    
783      if ((scancode == SCANCODE_NUMLOCK) && pressed)
784      {
785         numlock = !numlock;
786         setled(LED_NUM, numlock);
787      }
788        
789    switch (scancode)    switch (scancode)
790    {    {
791      case SCANCODE_CURSORBLOCKUP:    rdpkey = 0xc8; ext = KBD_FLAG_EXT; break; // up arrow      case SCANCODE_CURSORBLOCKUP:    rdpkey = 0xc8; ext = KBD_FLAG_EXT; break; // up arrow
# Line 750  void key_event(int scancode, int pressed Line 802  void key_event(int scancode, int pressed
802      case SCANCODE_KEYPADENTER:      rdpkey = 0x1c; break; // enter      case SCANCODE_KEYPADENTER:      rdpkey = 0x1c; break; // enter
803      case SCANCODE_RIGHTCONTROL:     rdpkey = 0x1d; break; // right ctrl      case SCANCODE_RIGHTCONTROL:     rdpkey = 0x1d; break; // right ctrl
804      case SCANCODE_RIGHTALT:         rdpkey = 0x38; break; // right alt      case SCANCODE_RIGHTALT:         rdpkey = 0x38; break; // right alt
805      case SCANCODE_LEFTWIN:          rdpkey = 0; break; // left win      case SCANCODE_LEFTWIN:          rdpkey = 0x5b; ext = KBD_FLAG_EXT; break; // left win
806      case SCANCODE_RIGHTWIN:         rdpkey = 0; break; // right win      case SCANCODE_RIGHTWIN:         rdpkey = 0x5c; ext = KBD_FLAG_EXT; break; // right win
807      case 127:                       rdpkey = 0; break; // menu key      case 127:                       rdpkey = 0x5d; ext = KBD_FLAG_EXT; break; // menu key
808      case SCANCODE_PRINTSCREEN:      rdpkey = 0; break; // print screen      case SCANCODE_PRINTSCREEN:      rdpkey = 0x37; ext = KBD_FLAG_EXT; break; // print screen
809      case SCANCODE_BREAK:            rdpkey = 0; break; // break      case SCANCODE_BREAK:            //rdpkey = 0; break; // break
810      case SCANCODE_SCROLLLOCK:       rdpkey = 0; break; // scroll lock      {
811          if (pressed)
812          {
813            ext = KBD_FLAG_EXT;
814            rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, 0x46, 0);
815            rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, 0xc6, 0);
816          }    
817          rdpkey = 0;
818        }
819        case SCANCODE_SCROLLLOCK:       rdpkey = 0x46; break; // scroll lock
820      case 112: // mouse down      case 112: // mouse down
821      {      {
822        rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON4,        rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON4,
# Line 774  void key_event(int scancode, int pressed Line 835  void key_event(int scancode, int pressed
835      rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, rdpkey, 0);      rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, rdpkey, 0);
836    else    else
837      rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE | ext, rdpkey, 0);      rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE | ext, rdpkey, 0);
838      
839    
840  }  }
841    

Legend:
Removed from v.810  
changed lines
  Added in v.811

  ViewVC Help
Powered by ViewVC 1.1.26