/[rdesktop]/sourceforge.net/trunk/rdesktop/xwin.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/xwin.c

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

revision 532 by astrand, Wed Oct 29 14:14:46 2003 UTC revision 543 by astrand, Mon Nov 3 13:33:35 2003 UTC
# Line 20  Line 20 
20    
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/Xutil.h>  #include <X11/Xutil.h>
23    #include <unistd.h>
24  #include <time.h>  #include <time.h>
25  #include <errno.h>  #include <errno.h>
26  #include "rdesktop.h"  #include "rdesktop.h"
# Line 207  make_colour(PixelColour pc) Line 208  make_colour(PixelColour pc)
208  }  }
209    
210  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }
211  #define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | ((x >> 8) & 0xff00)); }  #define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | (x & 0xff00)); }
212  #define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \  #define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \
213                          x = (x << 16) | (x >> 16); }                          x = (x << 16) | (x >> 16); }
214    
# Line 481  translate16to32(uint16 * data, uint8 * o Line 482  translate16to32(uint16 * data, uint8 * o
482    
483                  if (g_host_be)                  if (g_host_be)
484                  {                  {
485                  BSWAP16(pixel)}                          BSWAP16(pixel);
486                    }
487    
488                  value = make_colour(split_colour16(pixel));                  value = make_colour(split_colour16(pixel));
489    
# Line 531  translate24to16(uint8 * data, uint8 * ou Line 533  translate24to16(uint8 * data, uint8 * ou
533  static void  static void
534  translate24to24(uint8 * data, uint8 * out, uint8 * end)  translate24to24(uint8 * data, uint8 * out, uint8 * end)
535  {  {
536            uint32 pixel;
537            uint32 value;
538    
539          while (out < end)          while (out < end)
540          {          {
541                  *(out++) = (*(data++));                  pixel = *(data++) << 16;
542                    pixel |= *(data++) << 8;
543                    pixel |= *(data++);
544    
545                    value = make_colour(split_colour24(pixel));
546    
547                    if (g_xserver_be)
548                    {
549                            *(out++) = value >> 16;
550                            *(out++) = value >> 8;
551                            *(out++) = value;
552                    }
553                    else
554                    {
555                            *(out++) = value;
556                            *(out++) = value >> 8;
557                            *(out++) = value >> 16;
558                    }
559          }          }
560  }  }
561    
562  static void  static void
563  translate24to32(uint8 * data, uint8 * out, uint8 * end)  translate24to32(uint8 * data, uint8 * out, uint8 * end)
564  {  {
565            uint32 pixel;
566            uint32 value;
567    
568          while (out < end)          while (out < end)
569          {          {
570                    pixel = *(data++) << 16;
571                    pixel |= *(data++) << 8;
572                    pixel |= *(data++);
573    
574                    value = make_colour(split_colour24(pixel));
575    
576                  if (g_xserver_be)                  if (g_xserver_be)
577                  {                  {
578                          *(out++) = 0x00;                          *(out++) = value >> 24;
579                          *(out++) = *(data++);                          *(out++) = value >> 16;
580                          *(out++) = *(data++);                          *(out++) = value >> 8;
581                          *(out++) = *(data++);                          *(out++) = value;
582                  }                  }
583                  else                  else
584                  {                  {
585                          *(out++) = *(data++);                          *(out++) = value;
586                          *(out++) = *(data++);                          *(out++) = value >> 8;
587                          *(out++) = *(data++);                          *(out++) = value >> 16;
588                          *(out++) = 0x00;                          *(out++) = value >> 24;
589                  }                  }
590          }          }
591  }  }
# Line 819  ui_deinit(void) Line 850  ui_deinit(void)
850          g_display = NULL;          g_display = NULL;
851  }  }
852    
 #define NULL_POINTER_MASK       "\x80"  
 #define NULL_POINTER_DATA       "\x0\x0\x0"  
   
853  BOOL  BOOL
854  ui_create_window(void)  ui_create_window(void)
855  {  {
856            uint8 null_pointer_mask[1] = { 0x80 };
857            uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 };
858          XSetWindowAttributes attribs;          XSetWindowAttributes attribs;
859          XClassHint *classhints;          XClassHint *classhints;
860          XSizeHints *sizehints;          XSizeHints *sizehints;
# Line 907  ui_create_window(void) Line 937  ui_create_window(void)
937          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);
938    
939          /* create invisible 1x1 cursor to be used as null cursor */          /* create invisible 1x1 cursor to be used as null cursor */
940          g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA);          g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);
941    
942          return True;          return True;
943  }  }
# Line 915  ui_create_window(void) Line 945  ui_create_window(void)
945  void  void
946  ui_destroy_window(void)  ui_destroy_window(void)
947  {  {
         ui_destroy_cursor(g_null_cursor);  
   
948          if (g_IC != NULL)          if (g_IC != NULL)
949                  XDestroyIC(g_IC);                  XDestroyIC(g_IC);
950    
# Line 960  xwin_process_events(void) Line 988  xwin_process_events(void)
988          key_translation tr;          key_translation tr;
989          char str[256];          char str[256];
990          Status status;          Status status;
         unsigned int state;  
         Window wdummy;  
         int dummy;  
991    
992          while (XPending(g_display) > 0)          while (XPending(g_display) > 0)
993          {          {
# Line 1135  xwin_process_events(void) Line 1160  xwin_process_events(void)
1160                                  if (xevent.xfocus.mode == NotifyGrab)                                  if (xevent.xfocus.mode == NotifyGrab)
1161                                          break;                                          break;
1162                                  g_focused = True;                                  g_focused = True;
1163                                  XQueryPointer(g_display, g_wnd, &wdummy, &wdummy, &dummy, &dummy,                                  reset_modifier_keys();
                                               &dummy, &dummy, &state);  
                                 reset_modifier_keys(state);  
1164                                  if (g_grab_keyboard && g_mouse_in_wnd)                                  if (g_grab_keyboard && g_mouse_in_wnd)
1165                                          XGrabKeyboard(g_display, g_wnd, True,                                          XGrabKeyboard(g_display, g_wnd, True,
1166                                                        GrabModeAsync, GrabModeAsync, CurrentTime);                                                        GrabModeAsync, GrabModeAsync, CurrentTime);

Legend:
Removed from v.532  
changed lines
  Added in v.543

  ViewVC Help
Powered by ViewVC 1.1.26