/[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 534 by stargo, Thu Oct 30 00:10:32 2003 UTC revision 564 by jsorg71, Fri Jan 16 23:15:33 2004 UTC
# Line 20  Line 20 
20    
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/Xutil.h>  #include <X11/Xutil.h>
23    #include <unistd.h>
24  #include <time.h>  #include <time.h>
25  #include <errno.h>  #include <errno.h>
26  #include "rdesktop.h"  #include "rdesktop.h"
# Line 310  translate8to32(uint8 * data, uint8 * out Line 311  translate8to32(uint8 * data, uint8 * out
311          }          }
312  }  }
313    
 /* todo the remaining translate function might need some big endian check ?? */  
   
314  static void  static void
315  translate15to16(uint16 * data, uint8 * out, uint8 * end)  translate15to16(uint16 * data, uint8 * out, uint8 * end)
316  {  {
# Line 542  translate24to24(uint8 * data, uint8 * ou Line 541  translate24to24(uint8 * data, uint8 * ou
541                  pixel |= *(data++);                  pixel |= *(data++);
542    
543                  value = make_colour(split_colour24(pixel));                  value = make_colour(split_colour24(pixel));
544                    
545                  if (g_xserver_be)                  if (g_xserver_be)
546                  {                  {
547                          *(out++) = value >> 16;                          *(out++) = value >> 16;
# Line 776  ui_init(void) Line 775  ui_init(void)
775          /*          /*
776           * Determine desktop size           * Determine desktop size
777           */           */
778          if (g_width < 0)          if (g_fullscreen)
779            {
780                    g_width = WidthOfScreen(g_screen);
781                    g_height = HeightOfScreen(g_screen);
782            }
783            else if (g_width < 0)
784          {          {
785                  /* Percent of screen */                  /* Percent of screen */
786                  g_height = HeightOfScreen(g_screen) * (-g_width) / 100;                  g_height = HeightOfScreen(g_screen) * (-g_width) / 100;
# Line 799  ui_init(void) Line 803  ui_init(void)
803                          g_height = 600;                          g_height = 600;
804                  }                  }
805          }          }
         else if (g_fullscreen)  
         {  
                 g_width = WidthOfScreen(g_screen);  
                 g_height = HeightOfScreen(g_screen);  
         }  
806    
807          /* make sure width is a multiple of 4 */          /* make sure width is a multiple of 4 */
808          g_width = (g_width + 3) & ~3;          g_width = (g_width + 3) & ~3;
# Line 849  ui_deinit(void) Line 848  ui_deinit(void)
848          g_display = NULL;          g_display = NULL;
849  }  }
850    
 #define NULL_POINTER_MASK       "\x80"  
 #define NULL_POINTER_DATA       "\x0\x0\x0"  
   
851  BOOL  BOOL
852  ui_create_window(void)  ui_create_window(void)
853  {  {
854            uint8 null_pointer_mask[1] = { 0x80 };
855            uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 };
856          XSetWindowAttributes attribs;          XSetWindowAttributes attribs;
857          XClassHint *classhints;          XClassHint *classhints;
858          XSizeHints *sizehints;          XSizeHints *sizehints;
# Line 937  ui_create_window(void) Line 935  ui_create_window(void)
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 */          /* 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);          g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);
939    
940          return True;          return True;
941  }  }
# Line 945  ui_create_window(void) Line 943  ui_create_window(void)
943  void  void
944  ui_destroy_window(void)  ui_destroy_window(void)
945  {  {
         ui_destroy_cursor(g_null_cursor);  
   
946          if (g_IC != NULL)          if (g_IC != NULL)
947                  XDestroyIC(g_IC);                  XDestroyIC(g_IC);
948    
# Line 990  xwin_process_events(void) Line 986  xwin_process_events(void)
986          key_translation tr;          key_translation tr;
987          char str[256];          char str[256];
988          Status status;          Status status;
         unsigned int state;  
         Window wdummy;  
         int dummy;  
989    
990          while (XPending(g_display) > 0)          while (XPending(g_display) > 0)
991          {          {
# Line 1165  xwin_process_events(void) Line 1158  xwin_process_events(void)
1158                                  if (xevent.xfocus.mode == NotifyGrab)                                  if (xevent.xfocus.mode == NotifyGrab)
1159                                          break;                                          break;
1160                                  g_focused = True;                                  g_focused = True;
1161                                  XQueryPointer(g_display, g_wnd, &wdummy, &wdummy, &dummy, &dummy,                                  reset_modifier_keys();
                                               &dummy, &dummy, &state);  
                                 reset_modifier_keys(state);  
1162                                  if (g_grab_keyboard && g_mouse_in_wnd)                                  if (g_grab_keyboard && g_mouse_in_wnd)
1163                                          XGrabKeyboard(g_display, g_wnd, True,                                          XGrabKeyboard(g_display, g_wnd, True,
1164                                                        GrabModeAsync, GrabModeAsync, CurrentTime);                                                        GrabModeAsync, GrabModeAsync, CurrentTime);
# Line 1832  ui_draw_glyph(int mixmode, Line 1823  ui_draw_glyph(int mixmode,
1823  {\  {\
1824    glyph = cache_get_font (font, ttext[idx]);\    glyph = cache_get_font (font, ttext[idx]);\
1825    if (!(flags & TEXT2_IMPLICIT_X))\    if (!(flags & TEXT2_IMPLICIT_X))\
1826      {\
1827        xyoffset = ttext[++idx];\
1828        if ((xyoffset & 0x80))\
1829      {\      {\
1830        xyoffset = ttext[++idx];\        if (flags & TEXT2_VERTICAL)\
1831        if ((xyoffset & 0x80))\          y += ttext[idx+1] | (ttext[idx+2] << 8);\
         {\  
           if (flags & TEXT2_VERTICAL) \  
             y += ttext[idx+1] | (ttext[idx+2] << 8);\  
           else\  
             x += ttext[idx+1] | (ttext[idx+2] << 8);\  
           idx += 2;\  
         }\  
1832        else\        else\
1833          {\          x += ttext[idx+1] | (ttext[idx+2] << 8);\
1834            if (flags & TEXT2_VERTICAL) \        idx += 2;\
             y += xyoffset;\  
           else\  
             x += xyoffset;\  
         }\  
1835      }\      }\
1836    if (glyph != NULL)\      else\
1837      {\      {\
1838        ui_draw_glyph (mixmode, x + glyph->offset,\        if (flags & TEXT2_VERTICAL)\
1839                       y + glyph->baseline,\          y += xyoffset;\
1840                       glyph->width, glyph->height,\        else\
1841                       glyph->pixmap, 0, 0, bgcolour, fgcolour);\          x += xyoffset;\
       if (flags & TEXT2_IMPLICIT_X)\  
         x += glyph->width;\  
1842      }\      }\
1843      }\
1844      if (glyph != NULL)\
1845      {\
1846        x1 = x + glyph->offset;\
1847        y1 = y + glyph->baseline;\
1848        XSetStipple(g_display, g_gc, (Pixmap) glyph->pixmap);\
1849        XSetTSOrigin(g_display, g_gc, x1, y1);\
1850        FILL_RECTANGLE_BACKSTORE(x1, y1, glyph->width, glyph->height);\
1851        if (flags & TEXT2_IMPLICIT_X)\
1852          x += glyph->width;\
1853      }\
1854  }  }
1855    
1856  void  void
# Line 1868  ui_draw_text(uint8 font, uint8 flags, in Line 1860  ui_draw_text(uint8 font, uint8 flags, in
1860               int fgcolour, uint8 * text, uint8 length)               int fgcolour, uint8 * text, uint8 length)
1861  {  {
1862          FONTGLYPH *glyph;          FONTGLYPH *glyph;
1863          int i, j, xyoffset;          int i, j, xyoffset, x1, y1;
1864          DATABLOB *entry;          DATABLOB *entry;
1865    
1866          SET_FOREGROUND(bgcolour);          SET_FOREGROUND(bgcolour);
# Line 1882  ui_draw_text(uint8 font, uint8 flags, in Line 1874  ui_draw_text(uint8 font, uint8 flags, in
1874                  FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy);                  FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy);
1875          }          }
1876    
1877            SET_FOREGROUND(fgcolour);
1878            SET_BACKGROUND(bgcolour);
1879            XSetFillStyle(g_display, g_gc, FillStippled);
1880    
1881          /* Paint text, character by character */          /* Paint text, character by character */
1882          for (i = 0; i < length;)          for (i = 0; i < length;)
1883          {          {
# Line 1932  ui_draw_text(uint8 font, uint8 flags, in Line 1928  ui_draw_text(uint8 font, uint8 flags, in
1928                                  break;                                  break;
1929                  }                  }
1930          }          }
1931    
1932            XSetFillStyle(g_display, g_gc, FillSolid);
1933    
1934          if (g_ownbackstore)          if (g_ownbackstore)
1935          {          {
1936                  if (boxcx > 1)                  if (boxcx > 1)

Legend:
Removed from v.534  
changed lines
  Added in v.564

  ViewVC Help
Powered by ViewVC 1.1.26