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

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

revision 576 by stargo, Thu Jan 22 20:31:59 2004 UTC revision 606 by stargo, Sat Feb 14 23:20:24 2004 UTC
# Line 23  Line 23 
23  #include <unistd.h>  #include <unistd.h>
24  #include <time.h>  #include <time.h>
25  #include <errno.h>  #include <errno.h>
26    #include <strings.h>
27  #include "rdesktop.h"  #include "rdesktop.h"
28  #include "xproto.h"  #include "xproto.h"
29    
# Line 63  static int g_red_shift_l, g_blue_shift_l Line 64  static int g_red_shift_l, g_blue_shift_l
64    
65  /* software backing store */  /* software backing store */
66  static BOOL g_ownbackstore;  static BOOL g_ownbackstore;
67  static Pixmap g_backstore = NULL;  static Pixmap g_backstore = 0;
68    
69  /* Moving in single app mode */  /* Moving in single app mode */
70  static BOOL g_moving_wnd;  static BOOL g_moving_wnd;
# Line 731  ui_init(void) Line 732  ui_init(void)
732                  TrueColorVisual = True;                  TrueColorVisual = True;
733          }          }
734    
735          if ((g_server_bpp == 8) && ((! TrueColorVisual) || (g_depth <= 8)))          if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8)))
736          {          {
737                  /* we use a colourmap, so the default visual should do */                  /* we use a colourmap, so the default visual should do */
738                  g_visual = DefaultVisualOfScreen(g_screen);                  g_visual = DefaultVisualOfScreen(g_screen);
# Line 783  ui_init(void) Line 784  ui_init(void)
784    
785          if (!g_owncolmap)          if (!g_owncolmap)
786          {          {
787                  g_xcolmap = XCreateColormap(g_display,RootWindowOfScreen(g_screen),g_visual,AllocNone);                  g_xcolmap =
788                            XCreateColormap(g_display, RootWindowOfScreen(g_screen), g_visual,
789                                            AllocNone);
790                  if (g_depth <= 8)                  if (g_depth <= 8)
791                          warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");                          warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
792          }          }
# Line 849  ui_deinit(void) Line 852  ui_deinit(void)
852  {  {
853          if (g_IM != NULL)          if (g_IM != NULL)
854                  XCloseIM(g_IM);                  XCloseIM(g_IM);
855            
856          if (g_null_cursor != NULL)          if (g_null_cursor != NULL)
857                  ui_destroy_cursor(g_null_cursor);                  ui_destroy_cursor(g_null_cursor);
858    
# Line 892  ui_create_window(void) Line 895  ui_create_window(void)
895          if (g_gc == NULL)          if (g_gc == NULL)
896                  g_gc = XCreateGC(g_display, g_wnd, 0, NULL);                  g_gc = XCreateGC(g_display, g_wnd, 0, NULL);
897    
898          if ((g_ownbackstore) && (g_backstore == NULL))          if ((g_ownbackstore) && (g_backstore == 0))
899          {          {
900                  g_backstore =                  g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth);
                         XCreatePixmap(g_display, g_wnd, g_width, g_height,  
                                       g_depth);  
901    
902                  /* clear to prevent rubbish being exposed at startup */                  /* clear to prevent rubbish being exposed at startup */
903                  XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));                  XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
# Line 1271  xwin_process_events(void) Line 1272  xwin_process_events(void)
1272  int  int
1273  ui_select(int rdp_socket)  ui_select(int rdp_socket)
1274  {  {
1275          int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1;          int n;
1276          fd_set rfds, wfds;          fd_set rfds, wfds;
1277            struct timeval tv;
1278            BOOL s_timeout = False;
1279    
1280          while (True)          while (True)
1281          {          {
1282                    n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket;
1283                  /* Process any events already waiting */                  /* Process any events already waiting */
1284                  if (!xwin_process_events())                  if (!xwin_process_events())
1285                          /* User quit */                          /* User quit */
# Line 1291  ui_select(int rdp_socket) Line 1295  ui_select(int rdp_socket)
1295                  if (g_dsp_busy)                  if (g_dsp_busy)
1296                  {                  {
1297                          FD_SET(g_dsp_fd, &wfds);                          FD_SET(g_dsp_fd, &wfds);
1298                          n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n;                          n = (g_dsp_fd > n) ? g_dsp_fd : n;
1299                  }                  }
1300  #endif  #endif
1301                    /* default timeout */
1302                    tv.tv_sec = 60;
1303                    tv.tv_usec = 0;
1304    
1305                    /* add redirection handles */
1306                    rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout);
1307    
1308                  switch (select(n, &rfds, &wfds, NULL, NULL))                  n++;
1309    
1310                    switch (select(n, &rfds, &wfds, NULL, &tv))
1311                  {                  {
1312                          case -1:                          case -1:
1313                                  error("select: %s\n", strerror(errno));                                  error("select: %s\n", strerror(errno));
1314    
1315                          case 0:                          case 0:
1316                                    /* TODO: if tv.tv_sec just times out
1317                                     * we will segfault.
1318                                     * FIXME:
1319                                     */
1320                                    //s_timeout = True;
1321                                    //rdpdr_check_fds(&rfds, &wfds, (BOOL) True);
1322                                  continue;                                  continue;
1323                  }                  }
1324    
1325                    rdpdr_check_fds(&rfds, &wfds, (BOOL) False);
1326    
1327                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
1328                          return 1;                          return 1;
1329    

Legend:
Removed from v.576  
changed lines
  Added in v.606

  ViewVC Help
Powered by ViewVC 1.1.26