/[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 281 by jsorg71, Mon Dec 2 22:57:47 2002 UTC revision 309 by jsorg71, Tue Feb 4 05:32:13 2003 UTC
# Line 31  extern BOOL fullscreen; Line 31  extern BOOL fullscreen;
31  extern BOOL grab_keyboard;  extern BOOL grab_keyboard;
32  extern BOOL hide_decorations;  extern BOOL hide_decorations;
33  extern char title[];  extern char title[];
34    extern int server_bpp;
35  BOOL enable_compose = False;  BOOL enable_compose = False;
36  BOOL focused;  BOOL focused;
37  BOOL mouse_in_wnd;  BOOL mouse_in_wnd;
# Line 62  static Pixmap backstore; Line 63  static Pixmap backstore;
63  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5
64  typedef struct  typedef struct
65  {  {
66          unsigned long flags;          uint32 flags;
67          unsigned long functions;          uint32 functions;
68          unsigned long decorations;          uint32 decorations;
69          long inputMode;          sint32 inputMode;
70          unsigned long status;          uint32 status;
71  }  }
72  PropMotifWmHints;  PropMotifWmHints;
73    
# Line 78  PropMotifWmHints; Line 79  PropMotifWmHints;
79                  XFillRectangle(display, backstore, gc, x, y, cx, cy); \                  XFillRectangle(display, backstore, gc, x, y, cx, cy); \
80  }  }
81    
82  #define FILL_RECTANGLE_FAST(x,y,cx,cy)\  #define FILL_RECTANGLE_BACKSTORE(x,y,cx,cy)\
83  { \  { \
84          XFillRectangle(display, ownbackstore ? backstore : wnd, gc, x, y, cx, cy); \          XFillRectangle(display, ownbackstore ? backstore : wnd, gc, x, y, cx, cy); \
85  }  }
# Line 88  BOOL owncolmap = False; Line 89  BOOL owncolmap = False;
89  static Colormap xcolmap;  static Colormap xcolmap;
90  static uint32 *colmap;  static uint32 *colmap;
91    
92  #define TRANSLATE(col)          ( owncolmap ? col : translate_colour(colmap[col]) )  #define TRANSLATE(col)          ( server_bpp != 8 ? col : owncolmap ? col : translate_colour(colmap[col]) )
93  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));
94  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));
95    
# Line 128  mwm_hide_decorations(void) Line 129  mwm_hide_decorations(void)
129          hintsatom = XInternAtom(display, "_MOTIF_WM_HINTS", False);          hintsatom = XInternAtom(display, "_MOTIF_WM_HINTS", False);
130          if (!hintsatom)          if (!hintsatom)
131          {          {
132                  error("Failed to get atom _MOTIF_WM_HINTS\n");                  warning("Failed to get atom _MOTIF_WM_HINTS: probably your window manager does not support MWM hints\n");
133                  return;                  return;
134          }          }
135    
# Line 300  ui_init(void) Line 301  ui_init(void)
301          {          {
302                  xcolmap = DefaultColormapOfScreen(screen);                  xcolmap = DefaultColormapOfScreen(screen);
303                  if (depth <= 8)                  if (depth <= 8)
304                  {                          warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
                         printf("You're using a screen depth of 8-bits or lower\n");  
                         printf("If you get scewed colours, try the -C switch\n");  
                 }  
305          }          }
306    
307          gc = XCreateGC(display, RootWindowOfScreen(screen), 0, NULL);          gc = XCreateGC(display, RootWindowOfScreen(screen), 0, NULL);
# Line 318  ui_init(void) Line 316  ui_init(void)
316          if ((width == 0) || (height == 0))          if ((width == 0) || (height == 0))
317          {          {
318                  /* Fetch geometry from _NET_WORKAREA */                  /* Fetch geometry from _NET_WORKAREA */
319                  uint32 xpos, ypos;                  uint32 x, y, cx, cy;
320    
321                  if (get_current_workarea(&xpos, &ypos, &width, &height) < 0)                  if (get_current_workarea(&x, &y, &cx, &cy) == 0)
322                  {                  {
323                          error("Failed to get workarea.\n");                          width = cx;
324                          error("Perhaps your window manager does not support EWMH?\n");                          height = cy;
325                          error("Defaulting to geometry 800x600\n");                  }
326                    else
327                    {
328                            warning("Failed to get workarea: probably your window manager does not support extended hints\n");
329                          width = 800;                          width = 800;
330                          height = 600;                          height = 600;
331                  }                  }
# Line 607  xwin_process_events(void) Line 608  xwin_process_events(void)
608                                  break;                                  break;
609    
610                          case MotionNotify:                          case MotionNotify:
611                                    if (fullscreen && !focused)
612                                            XSetInputFocus(display, wnd, RevertToPointerRoot,
613                                                           CurrentTime);
614                                  rdp_send_input(time(NULL), RDP_INPUT_MOUSE,                                  rdp_send_input(time(NULL), RDP_INPUT_MOUSE,
615                                                 MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y);                                                 MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y);
616                                  break;                                  break;
# Line 746  ui_paint_bitmap(int x, int y, int cx, in Line 750  ui_paint_bitmap(int x, int y, int cx, in
750          XImage *image;          XImage *image;
751          uint8 *tdata;          uint8 *tdata;
752    
753            if (server_bpp == 16)
754            {
755                    image = XCreateImage(display, visual, depth, ZPixmap, 0,
756                                         (char *) data, width, height, 16, 0);
757    
758                    if (ownbackstore)
759                    {
760                            XPutImage(display, backstore, gc, image, 0, 0, x, y, cx, cy);
761                            XCopyArea(display, backstore, wnd, gc, x, y, cx, cy, x, y);
762                    }
763                    else
764                    {
765                            XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
766                    }
767    
768                    XFree(image);
769                    return;
770            }
771          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
772          image = XCreateImage(display, visual, depth, ZPixmap, 0,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
773                               (char *) tdata, width, height, 8, 0);                               (char *) tdata, width, height, 8, 0);
# Line 1189  ui_draw_glyph(int mixmode, Line 1211  ui_draw_glyph(int mixmode,
1211          XSetStipple(display, gc, (Pixmap) glyph);          XSetStipple(display, gc, (Pixmap) glyph);
1212          XSetTSOrigin(display, gc, x, y);          XSetTSOrigin(display, gc, x, y);
1213    
1214          FILL_RECTANGLE_FAST(x, y, cx, cy);          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1215    
1216          XSetFillStyle(display, gc, FillSolid);          XSetFillStyle(display, gc, FillSolid);
1217  }  }
# Line 1218  ui_draw_glyph(int mixmode, Line 1240  ui_draw_glyph(int mixmode,
1240      }\      }\
1241    if (glyph != NULL)\    if (glyph != NULL)\
1242      {\      {\
1243        ui_draw_glyph (mixmode, x + (short) glyph->offset,\        ui_draw_glyph (mixmode, x + glyph->offset,\
1244                       y + (short) glyph->baseline,\                       y + glyph->baseline,\
1245                       glyph->width, glyph->height,\                       glyph->width, glyph->height,\
1246                       glyph->pixmap, 0, 0, bgcolour, fgcolour);\                       glyph->pixmap, 0, 0, bgcolour, fgcolour);\
1247        if (flags & TEXT2_IMPLICIT_X)\        if (flags & TEXT2_IMPLICIT_X)\
# Line 1241  ui_draw_text(uint8 font, uint8 flags, in Line 1263  ui_draw_text(uint8 font, uint8 flags, in
1263    
1264          if (boxcx > 1)          if (boxcx > 1)
1265          {          {
1266                  FILL_RECTANGLE_FAST(boxx, boxy, boxcx, boxcy);                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);
1267          }          }
1268          else if (mixmode == MIX_OPAQUE)          else if (mixmode == MIX_OPAQUE)
1269          {          {
1270                  FILL_RECTANGLE_FAST(clipx, clipy, clipcx, clipcy);                  FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy);
1271          }          }
1272    
1273          /* Paint text, character by character */          /* Paint text, character by character */
# Line 1279  ui_draw_text(uint8 font, uint8 flags, in Line 1301  ui_draw_text(uint8 font, uint8 flags, in
1301                                                  else                                                  else
1302                                                          x += text[i + 2];                                                          x += text[i + 2];
1303                                          }                                          }
                                         if (i + 2 < length)  
                                                 i += 3;  
                                         else  
                                                 i += 2;  
                                         length -= i;  
                                         /* this will move pointer from start to first character after FE command */  
                                         text = &(text[i]);  
                                         i = 0;  
1304                                          for (j = 0; j < entry->size; j++)                                          for (j = 0; j < entry->size; j++)
1305                                                  DO_GLYPH(((uint8 *) (entry->data)), j);                                                  DO_GLYPH(((uint8 *) (entry->data)), j);
1306                                  }                                  }
1307                                    if (i + 2 < length)
1308                                            i += 3;
1309                                    else
1310                                            i += 2;
1311                                    length -= i;
1312                                    /* this will move pointer from start to first character after FE command */
1313                                    text = &(text[i]);
1314                                    i = 0;
1315                                  break;                                  break;
1316    
1317                          default:                          default:

Legend:
Removed from v.281  
changed lines
  Added in v.309

  ViewVC Help
Powered by ViewVC 1.1.26