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

Legend:
Removed from v.456  
changed lines
  Added in v.521

  ViewVC Help
Powered by ViewVC 1.1.26