/[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 461 by astrand, Tue Sep 2 09:40:07 2003 UTC revision 481 by matthewc, Thu Oct 9 03:28:04 2003 UTC
# Line 34  extern BOOL g_hide_decorations; Line 34  extern BOOL g_hide_decorations;
34  extern char g_title[];  extern char g_title[];
35  extern int g_server_bpp;  extern int g_server_bpp;
36  extern int g_win_button_size;  extern int g_win_button_size;
 BOOL g_enable_compose = False;  
 BOOL g_focused;  
 BOOL g_mouse_in_wnd;  
37    
38  Display *g_display;  Display *g_display;
39  Time g_last_gesturetime;  Time g_last_gesturetime;
40  static int g_x_socket;  static int g_x_socket;
41  static Screen *g_screen;  static Screen *g_screen;
42  Window g_wnd;  Window g_wnd;
43    BOOL g_enable_compose = False;
44  static GC g_gc;  static GC g_gc;
45  static Visual *g_visual;  static Visual *g_visual;
46  static int g_depth;  static int g_depth;
# Line 52  static XIC g_IC; Line 50  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 Atom g_protocol_atom, g_kill_atom;  static Atom g_protocol_atom, g_kill_atom;
53    static BOOL g_focused;
54    static BOOL g_mouse_in_wnd;
55    
56  /* endianness */  /* endianness */
57  static BOOL g_host_be;  static BOOL g_host_be;
# Line 66  static BOOL g_moving_wnd; Line 66  static BOOL g_moving_wnd;
66  static int g_move_x_offset = 0;  static int g_move_x_offset = 0;
67  static int g_move_y_offset = 0;  static int g_move_y_offset = 0;
68    
69    #ifdef WITH_RDPSND
70    extern int g_dsp_fd;
71    extern BOOL g_dsp_busy;
72    #endif
73    
74  /* MWM decorations */  /* MWM decorations */
75  #define MWM_HINTS_DECORATIONS   (1L << 1)  #define MWM_HINTS_DECORATIONS   (1L << 1)
76  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5
# Line 201  make_colour16(PixelColour pc) Line 206  make_colour16(PixelColour pc)
206  static uint32  static uint32
207  make_colour24(PixelColour pc)  make_colour24(PixelColour pc)
208  {  {
209          return (pc.red << 16) | (pc.green << 8) | pc.blue;          if (g_xserver_be)
210            {
211                    return pc.red | (pc.green << 8) | (pc.blue << 16);
212            }
213            else
214            {
215                    return (pc.red << 16) | (pc.green << 8) | pc.blue;
216            }
217  }  }
218    
219  static uint32  static uint32
220  make_colour32(PixelColour pc)  make_colour32(PixelColour pc)
221  {  {
222          return (pc.red << 16) | (pc.green << 8) | pc.blue;          if (g_xserver_be)
223            {
224                    return pc.red | (pc.green << 8) | (pc.blue << 16);
225            }
226            else
227            {
228                    return (pc.red << 16) | (pc.green << 8) | pc.blue;
229            }
230  }  }
231    
232  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }
# Line 344  translate15to24(uint16 * data, uint8 * o Line 363  translate15to24(uint16 * data, uint8 * o
363  static void  static void
364  translate15to32(uint16 * data, uint32 * out, uint32 * end)  translate15to32(uint16 * data, uint32 * out, uint32 * end)
365  {  {
366            uint16 pixel;
367    
368          while (out < end)          while (out < end)
369                  *(out++) = make_colour32(split_colour15(*(data++)));          {
370                    if (g_host_be)
371                    {
372                            pixel = *(data++);
373                            pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8;
374                            *(out++) = make_colour32(split_colour15(pixel));
375                    }
376                    else
377                    {
378                            *(out++) = make_colour32(split_colour15(*(data++)));
379                    }
380            }
381  }  }
382    
383  static void  static void
# Line 373  translate16to24(uint16 * data, uint8 * o Line 405  translate16to24(uint16 * data, uint8 * o
405  static void  static void
406  translate16to32(uint16 * data, uint32 * out, uint32 * end)  translate16to32(uint16 * data, uint32 * out, uint32 * end)
407  {  {
408            uint16 pixel;
409    
410          while (out < end)          while (out < end)
411                  *(out++) = make_colour32(split_colour16(*(data++)));          {
412                    if (g_host_be)
413                    {
414                            pixel = *(data++);
415                            pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8;
416                            *(out++) = make_colour32(split_colour16(pixel));
417                    }
418                    else
419                    {
420                            *(out++) = make_colour32(split_colour16(*(data++)));
421                    }
422            }
423  }  }
424    
425  static void  static void
# Line 405  translate24to32(uint8 * data, uint32 * o Line 450  translate24to32(uint8 * data, uint32 * o
450          uint32 pixel = 0;          uint32 pixel = 0;
451          while (out < end)          while (out < end)
452          {          {
453                  pixel = *(data++);                  if (g_host_be)
454                  pixel |= *(data++) << 8;                  {
455                  pixel |= *(data++) << 16;                          pixel = *(data++) << 16;
456                            pixel |= *(data++) << 8;
457                            pixel |= *(data++);
458                    }
459                    else
460                    {
461                            pixel = *(data++);
462                            pixel |= *(data++) << 8;
463                            pixel |= *(data++) << 16;
464                    }
465                  *(out++) = pixel;                  *(out++) = pixel;
466          }          }
467  }  }
# Line 833  xwin_process_events(void) Line 887  xwin_process_events(void)
887                                  if (tr.scancode == 0)                                  if (tr.scancode == 0)
888                                          break;                                          break;
889    
890                                  save_remote_modifiers();                                  save_remote_modifiers(tr.scancode);
891                                  ensure_remote_modifiers(ev_time, tr);                                  ensure_remote_modifiers(ev_time, tr);
892                                  rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);                                  rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);
893                                  restore_remote_modifiers(ev_time);                                  restore_remote_modifiers(ev_time, tr.scancode);
894    
895                                  break;                                  break;
896    
# Line 1029  int Line 1083  int
1083  ui_select(int rdp_socket)  ui_select(int rdp_socket)
1084  {  {
1085          int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1;          int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1;
1086          fd_set rfds;          fd_set rfds, wfds;
   
         FD_ZERO(&rfds);  
1087    
1088          while (True)          while (True)
1089          {          {
# Line 1041  ui_select(int rdp_socket) Line 1093  ui_select(int rdp_socket)
1093                          return 0;                          return 0;
1094    
1095                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
1096                    FD_ZERO(&wfds);
1097                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
1098                  FD_SET(g_x_socket, &rfds);                  FD_SET(g_x_socket, &rfds);
1099    
1100                  switch (select(n, &rfds, NULL, NULL, NULL))  #ifdef WITH_RDPSND
1101                    /* FIXME: there should be an API for registering fds */
1102                    if (g_dsp_busy)
1103                    {
1104                            FD_SET(g_dsp_fd, &wfds);
1105                            n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n;
1106                    }
1107    #endif
1108    
1109                    switch (select(n, &rfds, &wfds, NULL, NULL))
1110                  {                  {
1111                          case -1:                          case -1:
1112                                  error("select: %s\n", strerror(errno));                                  error("select: %s\n", strerror(errno));
# Line 1055  ui_select(int rdp_socket) Line 1117  ui_select(int rdp_socket)
1117    
1118                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
1119                          return 1;                          return 1;
1120    
1121    #ifdef WITH_RDPSND
1122                    if (g_dsp_busy && FD_ISSET(g_dsp_fd, &wfds))
1123                            wave_out_play();
1124    #endif
1125          }          }
1126  }  }
1127    

Legend:
Removed from v.461  
changed lines
  Added in v.481

  ViewVC Help
Powered by ViewVC 1.1.26