/[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 524 by matthewc, Wed Oct 29 06:29:05 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 51  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;
55    static BOOL g_mouse_in_wnd;
56    
57  /* endianness */  /* endianness */
58  static BOOL g_host_be;  static BOOL g_host_be;
59  static BOOL g_xserver_be;  static BOOL g_xserver_be;
60    static BOOL g_xserver_bgr;
61    
62  /* software backing store */  /* software backing store */
63  static BOOL g_ownbackstore;  static BOOL g_ownbackstore;
# Line 66  static BOOL g_moving_wnd; Line 68  static BOOL g_moving_wnd;
68  static int g_move_x_offset = 0;  static int g_move_x_offset = 0;
69  static int g_move_y_offset = 0;  static int g_move_y_offset = 0;
70    
71    #ifdef WITH_RDPSND
72    extern int g_dsp_fd;
73    extern BOOL g_dsp_busy;
74    extern BOOL g_rdpsnd;
75    #endif
76    
77  /* MWM decorations */  /* MWM decorations */
78  #define MWM_HINTS_DECORATIONS   (1L << 1)  #define MWM_HINTS_DECORATIONS   (1L << 1)
79  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5
# Line 195  make_colour16(PixelColour pc) Line 203  make_colour16(PixelColour pc)
203          pc.red = (pc.red * 0x1f) / 0xff;          pc.red = (pc.red * 0x1f) / 0xff;
204          pc.green = (pc.green * 0x3f) / 0xff;          pc.green = (pc.green * 0x3f) / 0xff;
205          pc.blue = (pc.blue * 0x1f) / 0xff;          pc.blue = (pc.blue * 0x1f) / 0xff;
206          return (pc.red << 11) | (pc.green << 5) | pc.blue;          if (g_xserver_bgr)
207                    return (pc.blue << 11) | (pc.green << 5) | pc.red;
208            else
209                    return (pc.red << 11) | (pc.green << 5) | pc.blue;
210                    
211  }  }
212    
213  static uint32  static uint32
214  make_colour24(PixelColour pc)  make_colour24(PixelColour pc)
215  {  {
216          return (pc.red << 16) | (pc.green << 8) | pc.blue;          if (g_xserver_bgr)
217                    return (pc.blue << 16) | (pc.green << 8) | pc.red;
218            else
219                    return (pc.red << 16) | (pc.green << 8) | pc.blue;
220  }  }
221    
222  static uint32  static uint32
223  make_colour32(PixelColour pc)  make_colour32(PixelColour pc)
224  {  {
225          return (pc.red << 16) | (pc.green << 8) | pc.blue;          if (g_xserver_bgr)
226                    return (pc.blue << 16) | (pc.green << 8) | pc.red;
227            else
228                    return (pc.red << 16) | (pc.green << 8) | pc.blue;
229  }  }
230    
231  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }
# Line 254  translate_colour(uint32 colour) Line 272  translate_colour(uint32 colour)
272                                          colour = make_colour16(split_colour24(colour));                                          colour = make_colour16(split_colour24(colour));
273                                          break;                                          break;
274                                  case 24:                                  case 24:
275                                            colour = make_colour24(split_colour24(colour));
276                                          break;                                          break;
277                                  case 32:                                  case 32:
278                                          colour = make_colour32(split_colour24(colour));                                          colour = make_colour32(split_colour24(colour));
# Line 261  translate_colour(uint32 colour) Line 280  translate_colour(uint32 colour)
280                          }                          }
281                          break;                          break;
282          }          }
         switch (g_bpp)  
         {  
                 case 16:  
                         if (g_host_be != g_xserver_be)  
                                 BSWAP16(colour);  
                         break;  
   
                 case 24:  
                         if (g_xserver_be)  
                                 BSWAP24(colour);  
                         break;  
   
                 case 32:  
                         if (g_host_be != g_xserver_be)  
                                 BSWAP32(colour);  
                         break;  
         }  
   
283          return colour;          return colour;
284  }  }
285    
# Line 290  translate8to8(uint8 * data, uint8 * out, Line 291  translate8to8(uint8 * data, uint8 * out,
291  }  }
292    
293  static void  static void
294  translate8to16(uint8 * data, uint16 * out, uint16 * end)  translate8to16(uint8 * data, uint8 * out, uint8 * end)
295  {  {
296            uint16 value;
297    
298          while (out < end)          while (out < end)
299                  *(out++) = (uint16) g_colmap[*(data++)];          {
300                    value = (uint16) g_colmap[*(data++)];
301                    
302                    if (g_xserver_be)
303                    {
304                            *(out++) = value >> 8;
305                            *(out++) = value;
306                    }
307                    else
308                    {
309                            *(out++) = value;
310                            *(out++) = value >> 8;
311                    }
312            }
313  }  }
314    
315  /* little endian - conversion happens when colourmap is built */  /* little endian - conversion happens when colourmap is built */
# Line 305  translate8to24(uint8 * data, uint8 * out Line 321  translate8to24(uint8 * data, uint8 * out
321          while (out < end)          while (out < end)
322          {          {
323                  value = g_colmap[*(data++)];                  value = g_colmap[*(data++)];
324                  *(out++) = value;                  
325                  *(out++) = value >> 8;                  if (g_xserver_be)
326                  *(out++) = value >> 16;                  {
327                            *(out++) = value >> 16;
328                            *(out++) = value >> 8;
329                            *(out++) = value;
330                    }
331                    else
332                    {
333                            *(out++) = value;
334                            *(out++) = value >> 8;
335                            *(out++) = value >> 16;
336                    }
337          }          }
338  }  }
339    
340  static void  static void
341  translate8to32(uint8 * data, uint32 * out, uint32 * end)  translate8to32(uint8 * data, uint8 * out, uint8 * end)
342  {  {
343            uint32 value;
344    
345          while (out < end)          while (out < end)
346                  *(out++) = g_colmap[*(data++)];          {
347                    value = g_colmap[*(data++)];
348    
349                    if (g_xserver_be)
350                    {
351                            *(out++) = value >> 24;
352                            *(out++) = value >> 16;
353                            *(out++) = value >> 8;
354                            *(out++) = value;
355                    }
356                    else
357                    {
358                            *(out++) = value;
359                            *(out++) = value >> 8;
360                            *(out++) = value >> 16;
361                            *(out++) = value >> 24;
362                    }
363            }
364  }  }
365    
366  /* todo the remaining translate function might need some big endian check ?? */  /* todo the remaining translate function might need some big endian check ?? */
367    
368  static void  static void
369  translate15to16(uint16 * data, uint16 * out, uint16 * end)  translate15to16(uint16 * data, uint8 * out, uint8 * end)
370  {  {
371            uint16 pixel;
372            uint16 value;
373    
374          while (out < end)          while (out < end)
375                  *(out++) = (uint16) make_colour16(split_colour15(*(data++)));          {
376                    pixel = *(data++);
377    
378                    if (g_host_be)
379                    {
380                            BSWAP16(pixel);
381                    }
382    
383                    value = make_colour16(split_colour15(pixel));
384    
385                    if (g_xserver_be)
386                    {
387                            *(out++) = value >> 8;
388                            *(out++) = value;
389                    }
390                    else
391                    {
392                            *(out++) = value;
393                            *(out++) = value >> 8;
394                    }
395            }
396  }  }
397    
398  static void  static void
399  translate15to24(uint16 * data, uint8 * out, uint8 * end)  translate15to24(uint16 * data, uint8 * out, uint8 * end)
400  {  {
401          uint32 value;          uint32 value;
402            uint16 pixel;
403    
404          while (out < end)          while (out < end)
405          {          {
406                  value = make_colour24(split_colour15(*(data++)));                  pixel = *(data++);
407                  *(out++) = value;  
408                  *(out++) = value >> 8;                  if (g_host_be)
409                  *(out++) = value >> 16;                  {
410                            BSWAP16(pixel);
411                    }
412    
413                    value = make_colour24(split_colour15(pixel));
414                    if (g_xserver_be)
415                    {
416                            *(out++) = value >> 16;
417                            *(out++) = value >> 8;
418                            *(out++) = value;
419                    }
420                    else
421                    {
422                            *(out++) = value;
423                            *(out++) = value >> 8;
424                            *(out++) = value >> 16;
425                    }
426          }          }
427  }  }
428    
429  static void  static void
430  translate15to32(uint16 * data, uint32 * out, uint32 * end)  translate15to32(uint16 * data, uint8 * out, uint8 * end)
431  {  {
432            uint16 pixel;
433            uint32 value;
434    
435          while (out < end)          while (out < end)
436                  *(out++) = make_colour32(split_colour15(*(data++)));          {
437                    pixel = *(data++);
438    
439                    if (g_host_be)
440                    {
441                            BSWAP16(pixel);
442                    }
443    
444                    value = make_colour32(split_colour15(pixel));
445    
446                    if (g_xserver_be)
447                    {
448                            *(out++) = value >> 24;
449                            *(out++) = value >> 16;
450                            *(out++) = value >> 8;
451                            *(out++) = value;
452                    }
453                    else
454                    {
455                            *(out++) = value;
456                            *(out++) = value >> 8;
457                            *(out++) = value >> 16;
458                            *(out++) = value >> 24;
459                    }
460            }
461  }  }
462    
463  static void  static void
464  translate16to16(uint16 * data, uint16 * out, uint16 * end)  translate16to16(uint16 * data, uint16 * out, uint16 * end)
465  {  {
466          while (out < end)          uint16 value;
467                  *(out++) = (uint16) (*(data++));  
468            if (g_xserver_be)
469            {
470                    while (out < end)
471                    {
472                            value = *data;
473                            BSWAP16(value);
474                            *out = value;
475                            data++;
476                            out++;
477                    }
478    
479            }
480            else
481            {
482                    while (out < end)
483                    {
484                            *out = *data;
485                            out++;
486                            data++;
487                    }
488            }
489  }  }
490    
491    
# Line 360  static void Line 493  static void
493  translate16to24(uint16 * data, uint8 * out, uint8 * end)  translate16to24(uint16 * data, uint8 * out, uint8 * end)
494  {  {
495          uint32 value;          uint32 value;
496            uint16 pixel;
497    
498          while (out < end)          while (out < end)
499          {          {
500                  value = make_colour24(split_colour16(*(data++)));                  pixel = *(data++);
501                  *(out++) = value;  
502                  *(out++) = value >> 8;                  if (g_host_be)
503                  *(out++) = value >> 16;                  {
504                            BSWAP16(pixel);
505                    }
506    
507                    value = make_colour24(split_colour16(pixel));
508    
509                    if (g_xserver_be)
510                    {
511                            *(out++) = value >> 16;
512                            *(out++) = value >> 8;
513                            *(out++) = value;
514                    }
515                    else
516                    {
517                            *(out++) = value;
518                            *(out++) = value >> 8;
519                            *(out++) = value >> 16;
520                    }
521          }          }
522  }  }
523    
524  static void  static void
525  translate16to32(uint16 * data, uint32 * out, uint32 * end)  translate16to32(uint16 * data, uint8 * out, uint8 * end)
526  {  {
527            uint16 pixel;
528            uint32 value;
529    
530          while (out < end)          while (out < end)
531                  *(out++) = make_colour32(split_colour16(*(data++)));          {
532                    pixel = *(data++);
533    
534                    if (g_host_be)
535                    {
536                    BSWAP16(pixel)}
537    
538                    value = make_colour32(split_colour16(pixel));
539    
540                    if (g_xserver_be)
541                    {
542                            *(out++) = value >> 24;
543                            *(out++) = value >> 16;
544                            *(out++) = value >> 8;
545                            *(out++) = value;
546                    }
547                    else
548                    {
549                            *(out++) = value;
550                            *(out++) = value >> 8;
551                            *(out++) = value >> 16;
552                            *(out++) = value >> 24;
553                    }
554            }
555  }  }
556    
557  static void  static void
558  translate24to16(uint8 * data, uint16 * out, uint16 * end)  translate24to16(uint8 * data, uint8 * out, uint8 * end)
559  {  {
560          uint32 pixel = 0;          uint32 pixel = 0;
561            uint16 value;
562          while (out < end)          while (out < end)
563          {          {
564                  pixel = *(data++) << 16;                  pixel = *(data++) << 16;
565                  pixel |= *(data++) << 8;                  pixel |= *(data++) << 8;
566                  pixel |= *(data++);                  pixel |= *(data++);
567                  *(out++) = (uint16) make_colour16(split_colour24(pixel));  
568                    value = (uint16) make_colour16(split_colour24(pixel));
569    
570                    if (g_xserver_be)
571                    {
572                            *(out++) = value >> 8;
573                            *(out++) = value;
574                    }
575                    else
576                    {
577                            *(out++) = value;
578                            *(out++) = value >> 8;
579                    }
580          }          }
581  }  }
582    
# Line 400  translate24to24(uint8 * data, uint8 * ou Line 590  translate24to24(uint8 * data, uint8 * ou
590  }  }
591    
592  static void  static void
593  translate24to32(uint8 * data, uint32 * out, uint32 * end)  translate24to32(uint8 * data, uint8 * out, uint8 * end)
594  {  {
         uint32 pixel = 0;  
595          while (out < end)          while (out < end)
596          {          {
597                  pixel = *(data++);                  if (g_xserver_be)
598                  pixel |= *(data++) << 8;                  {
599                  pixel |= *(data++) << 16;                          *(out++) = 0x00;
600                  *(out++) = pixel;                          *(out++) = *(data++);
601                            *(out++) = *(data++);
602                            *(out++) = *(data++);
603                    }
604                    else
605                    {
606                            *(out++) = *(data++);
607                            *(out++) = *(data++);
608                            *(out++) = *(data++);
609                            *(out++) = 0x00;
610                    }
611          }          }
612  }  }
613    
# Line 425  translate_image(int width, int height, u Line 624  translate_image(int width, int height, u
624                          switch (g_bpp)                          switch (g_bpp)
625                          {                          {
626                                  case 32:                                  case 32:
627                                          translate24to32(data, (uint32 *) out, (uint32 *) end);                                          translate24to32(data, out, end);
628                                          break;                                          break;
629                                  case 24:                                  case 24:
630                                          translate24to24(data, out, end);                                          translate24to24(data, out, end);
631                                          break;                                          break;
632                                  case 16:                                  case 16:
633                                          translate24to16(data, (uint16 *) out, (uint16 *) end);                                          translate24to16(data, out, end);
634                                          break;                                          break;
635                          }                          }
636                          break;                          break;
# Line 439  translate_image(int width, int height, u Line 638  translate_image(int width, int height, u
638                          switch (g_bpp)                          switch (g_bpp)
639                          {                          {
640                                  case 32:                                  case 32:
641                                          translate16to32((uint16 *) data, (uint32 *) out,                                          translate16to32((uint16 *) data, out, end);
                                                         (uint32 *) end);  
642                                          break;                                          break;
643                                  case 24:                                  case 24:
644                                          translate16to24((uint16 *) data, out, end);                                          translate16to24((uint16 *) data, out, end);
# Line 455  translate_image(int width, int height, u Line 653  translate_image(int width, int height, u
653                          switch (g_bpp)                          switch (g_bpp)
654                          {                          {
655                                  case 32:                                  case 32:
656                                          translate15to32((uint16 *) data, (uint32 *) out,                                          translate15to32((uint16 *) data, out, end);
                                                         (uint32 *) end);  
657                                          break;                                          break;
658                                  case 24:                                  case 24:
659                                          translate15to24((uint16 *) data, out, end);                                          translate15to24((uint16 *) data, out, end);
660                                          break;                                          break;
661                                  case 16:                                  case 16:
662                                          translate15to16((uint16 *) data, (uint16 *) out,                                          translate15to16((uint16 *) data, out, end);
                                                         (uint16 *) end);  
663                                          break;                                          break;
664                          }                          }
665                          break;                          break;
# Line 474  translate_image(int width, int height, u Line 670  translate_image(int width, int height, u
670                                          translate8to8(data, out, end);                                          translate8to8(data, out, end);
671                                          break;                                          break;
672                                  case 16:                                  case 16:
673                                          translate8to16(data, (uint16 *) out, (uint16 *) end);                                          translate8to16(data, out, end);
674                                          break;                                          break;
675                                  case 24:                                  case 24:
676                                          translate8to24(data, out, end);                                          translate8to24(data, out, end);
677                                          break;                                          break;
678                                  case 32:                                  case 32:
679                                          translate8to32(data, (uint32 *) out, (uint32 *) end);                                          translate8to32(data, out, end);
680                                          break;                                          break;
681                          }                          }
682                          break;                          break;
# Line 554  ui_init(void) Line 750  ui_init(void)
750                  return False;                  return False;
751          }          }
752    
753          if (g_owncolmap != True)          /* private colour map code only works for 8 bpp */
754            if (g_owncolmap && (g_bpp > 8))
755                    g_owncolmap = False;
756    
757            if (!g_owncolmap)
758          {          {
759                  g_xcolmap = DefaultColormapOfScreen(g_screen);                  g_xcolmap = DefaultColormapOfScreen(g_screen);
760                  if (g_depth <= 8)                  if (g_depth <= 8)
# Line 569  ui_init(void) Line 769  ui_init(void)
769          test = 1;          test = 1;
770          g_host_be = !(BOOL) (*(uint8 *) (&test));          g_host_be = !(BOOL) (*(uint8 *) (&test));
771          g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);          g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
772            g_xserver_bgr = (g_visual->blue_mask > g_visual->red_mask);
773    
774          if ((g_width == 0) || (g_height == 0))          /*
775             * Determine desktop size
776             */
777            if (g_width < 0)
778            {
779                    /* Percent of screen */
780                    g_height = HeightOfScreen(g_screen) * (-g_width) / 100;
781                    g_width = WidthOfScreen(g_screen) * (-g_width) / 100;
782            }
783            else if (g_width == 0)
784          {          {
785                  /* Fetch geometry from _NET_WORKAREA */                  /* Fetch geometry from _NET_WORKAREA */
786                  uint32 x, y, cx, cy;                  uint32 x, y, cx, cy;
# Line 587  ui_init(void) Line 797  ui_init(void)
797                          g_height = 600;                          g_height = 600;
798                  }                  }
799          }          }
800            else if (g_fullscreen)
         if (g_fullscreen)  
801          {          {
802                  g_width = WidthOfScreen(g_screen);                  g_width = WidthOfScreen(g_screen);
803                  g_height = HeightOfScreen(g_screen);                  g_height = HeightOfScreen(g_screen);
# Line 610  ui_init(void) Line 819  ui_init(void)
819    
820          g_mod_map = XGetModifierMapping(g_display);          g_mod_map = XGetModifierMapping(g_display);
821    
822            xkeymap_init();
823    
824          if (g_enable_compose)          if (g_enable_compose)
825                  g_IM = XOpenIM(g_display, NULL, NULL, NULL);                  g_IM = XOpenIM(g_display, NULL, NULL, NULL);
826    
         xkeymap_init();  
827          xclip_init();          xclip_init();
828    
829          /* 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);  
830    
831          return True;          return True;
832  }  }
# Line 638  ui_deinit(void) Line 847  ui_deinit(void)
847          g_display = NULL;          g_display = NULL;
848  }  }
849    
850    #define NULL_POINTER_MASK       "\x80"
851    #define NULL_POINTER_DATA       "\x0\x0\x0"
852            
853  BOOL  BOOL
854  ui_create_window(void)  ui_create_window(void)
855  {  {
# Line 722  ui_create_window(void) Line 934  ui_create_window(void)
934          g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True);          g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True);
935          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);          XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);
936    
937            /* create invisible 1x1 cursor to be used as null cursor */
938            g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA);
939    
940          return True;          return True;
941  }  }
942    
943  void  void
944  ui_destroy_window(void)  ui_destroy_window(void)
945  {  {
946            ui_destroy_cursor(g_null_cursor);
947            
948          if (g_IC != NULL)          if (g_IC != NULL)
949                  XDestroyIC(g_IC);                  XDestroyIC(g_IC);
950    
# Line 833  xwin_process_events(void) Line 1050  xwin_process_events(void)
1050                                  if (tr.scancode == 0)                                  if (tr.scancode == 0)
1051                                          break;                                          break;
1052    
1053                                  save_remote_modifiers();                                  save_remote_modifiers(tr.scancode);
1054                                  ensure_remote_modifiers(ev_time, tr);                                  ensure_remote_modifiers(ev_time, tr);
1055                                  rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);                                  rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);
1056                                  restore_remote_modifiers(ev_time);                                  restore_remote_modifiers(ev_time, tr.scancode);
1057    
1058                                  break;                                  break;
1059    
# Line 1029  int Line 1246  int
1246  ui_select(int rdp_socket)  ui_select(int rdp_socket)
1247  {  {
1248          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;
1249          fd_set rfds;          fd_set rfds, wfds;
   
         FD_ZERO(&rfds);  
1250    
1251          while (True)          while (True)
1252          {          {
# Line 1041  ui_select(int rdp_socket) Line 1256  ui_select(int rdp_socket)
1256                          return 0;                          return 0;
1257    
1258                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
1259                    FD_ZERO(&wfds);
1260                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
1261                  FD_SET(g_x_socket, &rfds);                  FD_SET(g_x_socket, &rfds);
1262    
1263                  switch (select(n, &rfds, NULL, NULL, NULL))  #ifdef WITH_RDPSND
1264                    /* FIXME: there should be an API for registering fds */
1265                    if (g_dsp_busy)
1266                    {
1267                            FD_SET(g_dsp_fd, &wfds);
1268                            n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n;
1269                    }
1270    #endif
1271    
1272                    switch (select(n, &rfds, &wfds, NULL, NULL))
1273                  {                  {
1274                          case -1:                          case -1:
1275                                  error("select: %s\n", strerror(errno));                                  error("select: %s\n", strerror(errno));
# Line 1055  ui_select(int rdp_socket) Line 1280  ui_select(int rdp_socket)
1280    
1281                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
1282                          return 1;                          return 1;
1283    
1284    #ifdef WITH_RDPSND
1285                    if (g_dsp_busy && FD_ISSET(g_dsp_fd, &wfds))
1286                            wave_out_play();
1287    #endif
1288          }          }
1289  }  }
1290    
# Line 1070  ui_create_bitmap(int width, int height, Line 1300  ui_create_bitmap(int width, int height,
1300          XImage *image;          XImage *image;
1301          Pixmap bitmap;          Pixmap bitmap;
1302          uint8 *tdata;          uint8 *tdata;
1303            int bitmap_pad;
1304    
1305            if (g_server_bpp == 8)
1306            {
1307                    bitmap_pad = 8;
1308            }
1309            else
1310            {
1311                    bitmap_pad = g_bpp;
1312    
1313                    if (g_bpp == 24)
1314                            bitmap_pad = 32;
1315            }
1316    
1317          tdata = (g_owncolmap ? data : translate_image(width, height, data));          tdata = (g_owncolmap ? data : translate_image(width, height, data));
1318          bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth);          bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth);
1319          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
1320                               (char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0);                               (char *) tdata, width, height, bitmap_pad, 0);
1321    
1322          XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height);          XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height);
1323    
# Line 1089  ui_paint_bitmap(int x, int y, int cx, in Line 1332  ui_paint_bitmap(int x, int y, int cx, in
1332  {  {
1333          XImage *image;          XImage *image;
1334          uint8 *tdata;          uint8 *tdata;
1335            int bitmap_pad;
1336    
1337            if (g_server_bpp == 8)
1338            {
1339                    bitmap_pad = 8;
1340            }
1341            else
1342            {
1343                    bitmap_pad = g_bpp;
1344    
1345                    if (g_bpp == 24)
1346                            bitmap_pad = 32;
1347            }
1348    
1349          tdata = (g_owncolmap ? data : translate_image(width, height, data));          tdata = (g_owncolmap ? data : translate_image(width, height, data));
1350          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
1351                               (char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0);                               (char *) tdata, width, height, bitmap_pad, 0);
1352    
1353          if (g_ownbackstore)          if (g_ownbackstore)
1354          {          {
# Line 1230  ui_destroy_cursor(HCURSOR cursor) Line 1487  ui_destroy_cursor(HCURSOR cursor)
1487          XFreeCursor(g_display, (Cursor) cursor);          XFreeCursor(g_display, (Cursor) cursor);
1488  }  }
1489    
1490    void
1491    ui_set_null_cursor(void)
1492    {
1493            ui_set_cursor(g_null_cursor);
1494    }
1495    
1496  #define MAKE_XCOLOR(xc,c) \  #define MAKE_XCOLOR(xc,c) \
1497                  (xc)->red   = ((c)->red   << 8) | (c)->red; \                  (xc)->red   = ((c)->red   << 8) | (c)->red; \
1498                  (xc)->green = ((c)->green << 8) | (c)->green; \                  (xc)->green = ((c)->green << 8) | (c)->green; \
# Line 1430  ui_patblt(uint8 opcode, Line 1693  ui_patblt(uint8 opcode,
1693                  case 2: /* Hatch */                  case 2: /* Hatch */
1694                          fill = (Pixmap) ui_create_glyph(8, 8,                          fill = (Pixmap) ui_create_glyph(8, 8,
1695                                                          hatch_patterns + brush->pattern[0] * 8);                                                          hatch_patterns + brush->pattern[0] * 8);
1696                          SET_FOREGROUND(bgcolour);                          SET_FOREGROUND(fgcolour);
1697                          SET_BACKGROUND(fgcolour);                          SET_BACKGROUND(bgcolour);
1698                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1699                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1700                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);

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

  ViewVC Help
Powered by ViewVC 1.1.26