/[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 483 by jsorg71, Sat Oct 11 19:12:10 2003 UTC revision 519 by matthewc, Tue Oct 28 03:40:26 2003 UTC
# Line 49  static XIM g_IM; Line 49  static XIM g_IM;
49  static XIC g_IC;  static XIC g_IC;
50  static XModifierKeymap *g_mod_map;  static XModifierKeymap *g_mod_map;
51  static Cursor g_current_cursor;  static Cursor g_current_cursor;
52    static HCURSOR g_null_cursor;
53  static Atom g_protocol_atom, g_kill_atom;  static Atom g_protocol_atom, g_kill_atom;
54  static BOOL g_focused;  static BOOL g_focused;
55  static BOOL g_mouse_in_wnd;  static BOOL g_mouse_in_wnd;
# Line 69  static int g_move_y_offset = 0; Line 70  static int g_move_y_offset = 0;
70  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
71  extern int g_dsp_fd;  extern int g_dsp_fd;
72  extern BOOL g_dsp_busy;  extern BOOL g_dsp_busy;
73    extern BOOL g_rdpsnd;
74  #endif  #endif
75    
76  /* MWM decorations */  /* MWM decorations */
# Line 333  translate15to16(uint16 * data, uint8 * o Line 335  translate15to16(uint16 * data, uint8 * o
335    
336                  if (g_host_be)                  if (g_host_be)
337                  {                  {
338                          BSWAP16(pixel)                  BSWAP16(pixel)}
                 }  
339    
340                  value = make_colour16(split_colour15(pixel));                  value = make_colour16(split_colour15(pixel));
341    
# Line 363  translate15to24(uint16 * data, uint8 * o Line 364  translate15to24(uint16 * data, uint8 * o
364    
365                  if (g_host_be)                  if (g_host_be)
366                  {                  {
367                          BSWAP16(pixel)                  BSWAP16(pixel)}
                 }  
368    
369                  value = make_colour24(split_colour15(pixel));                  value = make_colour24(split_colour15(pixel));
370                  if (g_xserver_be)                  if (g_xserver_be)
# Line 457  translate16to24(uint16 * data, uint8 * o Line 457  translate16to24(uint16 * data, uint8 * o
457    
458                  if (g_host_be)                  if (g_host_be)
459                  {                  {
460                          BSWAP16(pixel)                  BSWAP16(pixel)}
                 }  
461    
462                  value = make_colour24(split_colour16(pixel));                  value = make_colour24(split_colour16(pixel));
463    
# Line 489  translate16to32(uint16 * data, uint8 * o Line 488  translate16to32(uint16 * data, uint8 * o
488    
489                  if (g_host_be)                  if (g_host_be)
490                  {                  {
491                          BSWAP16(pixel)                  BSWAP16(pixel)}
                 }  
492    
493                  value = make_colour32(split_colour16(pixel));                  value = make_colour32(split_colour16(pixel));
494    
# Line 500  translate16to32(uint16 * data, uint8 * o Line 498  translate16to32(uint16 * data, uint8 * o
498                          *(out++) = value >> 16;                          *(out++) = value >> 16;
499                          *(out++) = value >> 8;                          *(out++) = value >> 8;
500                          *(out++) = value;                          *(out++) = value;
501                  }                  }
502                  else                  else
503                  {                  {
504                          *(out++) = value;                          *(out++) = value;
505                          *(out++) = value >> 8;                          *(out++) = value >> 8;
506                          *(out++) = value >> 16;                          *(out++) = value >> 16;
507                          *(out++) = value >> 24;                          *(out++) = value >> 24;
508                  }                  }
509          }          }
510  }  }
511    
512  static void  static void
# Line 707  ui_init(void) Line 705  ui_init(void)
705                  return False;                  return False;
706          }          }
707    
708          if (g_owncolmap != True)          /* private colour map code only works for 8 bpp */
709            if (g_owncolmap && (g_bpp > 8))
710                    g_owncolmap = False;
711    
712            if (!g_owncolmap)
713          {          {
714                  g_xcolmap = DefaultColormapOfScreen(g_screen);                  g_xcolmap = DefaultColormapOfScreen(g_screen);
715                  if (g_depth <= 8)                  if (g_depth <= 8)
# Line 723  ui_init(void) Line 725  ui_init(void)
725          g_host_be = !(BOOL) (*(uint8 *) (&test));          g_host_be = !(BOOL) (*(uint8 *) (&test));
726          g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);          g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
727    
728          if ((g_width == 0) || (g_height == 0))          /*
729             * Determine desktop size
730             */
731            if (g_width < 0)
732            {
733                    /* Percent of screen */
734                    g_height = HeightOfScreen(g_screen) * (-g_width) / 100;
735                    g_width = WidthOfScreen(g_screen) * (-g_width) / 100;
736            }
737            else if (g_width == 0)
738          {          {
739                  /* Fetch geometry from _NET_WORKAREA */                  /* Fetch geometry from _NET_WORKAREA */
740                  uint32 x, y, cx, cy;                  uint32 x, y, cx, cy;
# Line 740  ui_init(void) Line 751  ui_init(void)
751                          g_height = 600;                          g_height = 600;
752                  }                  }
753          }          }
754            else if (g_fullscreen)
         if (g_fullscreen)  
755          {          {
756                  g_width = WidthOfScreen(g_screen);                  g_width = WidthOfScreen(g_screen);
757                  g_height = HeightOfScreen(g_screen);                  g_height = HeightOfScreen(g_screen);
# Line 763  ui_init(void) Line 773  ui_init(void)
773    
774          g_mod_map = XGetModifierMapping(g_display);          g_mod_map = XGetModifierMapping(g_display);
775    
776            xkeymap_init();
777    
778          if (g_enable_compose)          if (g_enable_compose)
779                  g_IM = XOpenIM(g_display, NULL, NULL, NULL);                  g_IM = XOpenIM(g_display, NULL, NULL, NULL);
780    
         xkeymap_init();  
781          xclip_init();          xclip_init();
782    
783          /* todo take this out when high colour is done */          DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_bpp, g_bpp, g_depth));
         printf("server bpp %d client bpp %d depth %d\n", g_server_bpp, g_bpp, g_depth);  
784    
785          return True;          return True;
786  }  }
# Line 791  ui_deinit(void) Line 801  ui_deinit(void)
801          g_display = NULL;          g_display = NULL;
802  }  }
803    
804    #define NULL_POINTER_MASK       "\x80"
805    #define NULL_POINTER_DATA       "\x0\x0\x0"
806            
807  BOOL  BOOL
808  ui_create_window(void)  ui_create_window(void)
809  {  {
# Line 875  ui_create_window(void) Line 888  ui_create_window(void)
888          g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True);          g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True);
889          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);
890    
891            /* create invisible 1x1 cursor to be used as null cursor */
892            g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA);
893    
894          return True;          return True;
895  }  }
896    
897  void  void
898  ui_destroy_window(void)  ui_destroy_window(void)
899  {  {
900            ui_destroy_cursor(g_null_cursor);
901            
902          if (g_IC != NULL)          if (g_IC != NULL)
903                  XDestroyIC(g_IC);                  XDestroyIC(g_IC);
904    
# Line 1202  ui_select(int rdp_socket) Line 1220  ui_select(int rdp_socket)
1220                  {                  {
1221                          FD_SET(g_dsp_fd, &wfds);                          FD_SET(g_dsp_fd, &wfds);
1222                          n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n;                          n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n;
1223                  }                  }
1224  #endif  #endif
1225    
1226                  switch (select(n, &rfds, &wfds, NULL, NULL))                  switch (select(n, &rfds, &wfds, NULL, NULL))
# Line 1396  ui_destroy_cursor(HCURSOR cursor) Line 1414  ui_destroy_cursor(HCURSOR cursor)
1414          XFreeCursor(g_display, (Cursor) cursor);          XFreeCursor(g_display, (Cursor) cursor);
1415  }  }
1416    
1417    void
1418    ui_set_null_cursor(void)
1419    {
1420            ui_set_cursor(g_null_cursor);
1421    }
1422    
1423  #define MAKE_XCOLOR(xc,c) \  #define MAKE_XCOLOR(xc,c) \
1424                  (xc)->red   = ((c)->red   << 8) | (c)->red; \                  (xc)->red   = ((c)->red   << 8) | (c)->red; \
1425                  (xc)->green = ((c)->green << 8) | (c)->green; \                  (xc)->green = ((c)->green << 8) | (c)->green; \
# Line 1596  ui_patblt(uint8 opcode, Line 1620  ui_patblt(uint8 opcode,
1620                  case 2: /* Hatch */                  case 2: /* Hatch */
1621                          fill = (Pixmap) ui_create_glyph(8, 8,                          fill = (Pixmap) ui_create_glyph(8, 8,
1622                                                          hatch_patterns + brush->pattern[0] * 8);                                                          hatch_patterns + brush->pattern[0] * 8);
1623                          SET_FOREGROUND(bgcolour);                          SET_FOREGROUND(fgcolour);
1624                          SET_BACKGROUND(fgcolour);                          SET_BACKGROUND(bgcolour);
1625                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1626                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1627                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);

Legend:
Removed from v.483  
changed lines
  Added in v.519

  ViewVC Help
Powered by ViewVC 1.1.26