/[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 823 by stargo, Mon Feb 28 23:30:00 2005 UTC revision 844 by jdmeijer, Thu Mar 10 22:48:15 2005 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     User interface services - X Window System     User interface services - X Window System
4     Copyright (C) Matthew Chapman 1999-2002     Copyright (C) Matthew Chapman 1999-2005
5    
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 119  PixelColour; Line 119  PixelColour;
119          XFillRectangle(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, cx, cy); \          XFillRectangle(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, cx, cy); \
120  }  }
121    
122    #define FILL_POLYGON(p,np)\
123    { \
124            XFillPolygon(g_display, g_wnd, g_gc, p, np, Complex, CoordModePrevious); \
125            if (g_ownbackstore) \
126                    XFillPolygon(g_display, g_backstore, g_gc, p, np, Complex, CoordModePrevious); \
127    }
128    
129    #define DRAW_ELLIPSE(x,y,cx,cy,m)\
130    { \
131            switch (m) \
132            { \
133                    case 0: /* Outline */ \
134                            XDrawArc(g_display, g_wnd, g_gc, x, y, cx, cy, 0, 360*64); \
135                            if (g_ownbackstore) \
136                                    XDrawArc(g_display, g_backstore, g_gc, x, y, cx, cy, 0, 360*64); \
137                            break; \
138                    case 1: /* Filled */ \
139                            XFillArc(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, \
140                                     cx, cy, 0, 360*64); \
141                            if (g_ownbackstore) \
142                                    XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y); \
143                            break; \
144            } \
145    }
146    
147  /* colour maps */  /* colour maps */
148  extern BOOL g_owncolmap;  extern BOOL g_owncolmap;
149  static Colormap g_xcolmap;  static Colormap g_xcolmap;
# Line 2166  ui_rect( Line 2191  ui_rect(
2191          FILL_RECTANGLE(x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
2192  }  }
2193    
2194    void
2195    ui_polygon(uint8 opcode,
2196               /* mode */ uint8 fillmode,
2197               /* dest */ POINT * point, int npoints,
2198               /* brush */ BRUSH * brush, int bgcolour, int fgcolour)
2199    {
2200            uint8 style, i, ipattern[8];
2201            Pixmap fill;
2202    
2203            SET_FUNCTION(opcode);
2204    
2205            switch (fillmode)
2206            {
2207                    case ALTERNATE:
2208                            XSetFillRule(g_display, g_gc, EvenOddRule);
2209                            break;
2210                    case WINDING:
2211                            XSetFillRule(g_display, g_gc, WindingRule);
2212                            break;
2213                    default:
2214                            unimpl("fill mode %d\n", fillmode);
2215            }
2216    
2217            if (brush)
2218                    style = brush->style;
2219            else
2220                    style = 0;
2221    
2222            switch (style)
2223            {
2224                    case 0: /* Solid */
2225                            SET_FOREGROUND(fgcolour);
2226                            FILL_POLYGON((XPoint *) point, npoints);
2227                            break;
2228    
2229                    case 2: /* Hatch */
2230                            fill = (Pixmap) ui_create_glyph(8, 8,
2231                                                            hatch_patterns + brush->pattern[0] * 8);
2232                            SET_FOREGROUND(fgcolour);
2233                            SET_BACKGROUND(bgcolour);
2234                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2235                            XSetStipple(g_display, g_gc, fill);
2236                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2237                            FILL_POLYGON((XPoint *) point, npoints);
2238                            XSetFillStyle(g_display, g_gc, FillSolid);
2239                            XSetTSOrigin(g_display, g_gc, 0, 0);
2240                            ui_destroy_glyph((HGLYPH) fill);
2241                            break;
2242    
2243                    case 3: /* Pattern */
2244                            for (i = 0; i != 8; i++)
2245                                    ipattern[7 - i] = brush->pattern[i];
2246                            fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
2247                            SET_FOREGROUND(bgcolour);
2248                            SET_BACKGROUND(fgcolour);
2249                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2250                            XSetStipple(g_display, g_gc, fill);
2251                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2252                            FILL_POLYGON((XPoint *) point, npoints);
2253                            XSetFillStyle(g_display, g_gc, FillSolid);
2254                            XSetTSOrigin(g_display, g_gc, 0, 0);
2255                            ui_destroy_glyph((HGLYPH) fill);
2256                            break;
2257    
2258                    default:
2259                            unimpl("brush %d\n", brush->style);
2260            }
2261    
2262            RESET_FUNCTION(opcode);
2263    }
2264    
2265    void
2266    ui_polyline(uint8 opcode,
2267                /* dest */ POINT * points, int npoints,
2268                /* pen */ PEN * pen)
2269    {
2270            /* TODO: set join style */
2271            SET_FUNCTION(opcode);
2272            SET_FOREGROUND(pen->colour);
2273            XDrawLines(g_display, g_wnd, g_gc, (XPoint *) points, npoints, CoordModePrevious);
2274            if (g_ownbackstore)
2275                    XDrawLines(g_display, g_backstore, g_gc, (XPoint *) points, npoints,
2276                               CoordModePrevious);
2277            RESET_FUNCTION(opcode);
2278    }
2279    
2280    void
2281    ui_ellipse(uint8 opcode,
2282               /* mode */ uint8 fillmode,
2283               /* dest */ int x, int y, int cx, int cy,
2284               /* brush */ BRUSH * brush, int bgcolour, int fgcolour)
2285    {
2286            uint8 style, i, ipattern[8];
2287            Pixmap fill;
2288    
2289            SET_FUNCTION(opcode);
2290    
2291            if (brush)
2292                    style = brush->style;
2293            else
2294                    style = 0;
2295    
2296            switch (style)
2297            {
2298                    case 0: /* Solid */
2299                            SET_FOREGROUND(fgcolour);
2300                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2301                            break;
2302    
2303                    case 2: /* Hatch */
2304                            fill = (Pixmap) ui_create_glyph(8, 8,
2305                                                            hatch_patterns + brush->pattern[0] * 8);
2306                            SET_FOREGROUND(fgcolour);
2307                            SET_BACKGROUND(bgcolour);
2308                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2309                            XSetStipple(g_display, g_gc, fill);
2310                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2311                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2312                            XSetFillStyle(g_display, g_gc, FillSolid);
2313                            XSetTSOrigin(g_display, g_gc, 0, 0);
2314                            ui_destroy_glyph((HGLYPH) fill);
2315                            break;
2316    
2317                    case 3: /* Pattern */
2318                            for (i = 0; i != 8; i++)
2319                                    ipattern[7 - i] = brush->pattern[i];
2320                            fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
2321                            SET_FOREGROUND(bgcolour);
2322                            SET_BACKGROUND(fgcolour);
2323                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2324                            XSetStipple(g_display, g_gc, fill);
2325                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2326                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2327                            XSetFillStyle(g_display, g_gc, FillSolid);
2328                            XSetTSOrigin(g_display, g_gc, 0, 0);
2329                            ui_destroy_glyph((HGLYPH) fill);
2330                            break;
2331    
2332                    default:
2333                            unimpl("brush %d\n", brush->style);
2334            }
2335    
2336            RESET_FUNCTION(opcode);
2337    }
2338    
2339  /* warning, this function only draws on wnd or backstore, not both */  /* warning, this function only draws on wnd or backstore, not both */
2340  void  void
2341  ui_draw_glyph(int mixmode,  ui_draw_glyph(int mixmode,
# Line 2221  ui_draw_glyph(int mixmode, Line 2391  ui_draw_glyph(int mixmode,
2391  }  }
2392    
2393  void  void
2394  ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,  ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y,
2395               int clipx, int clipy, int clipcx, int clipcy,               int clipx, int clipy, int clipcx, int clipcy,
2396               int boxx, int boxy, int boxcx, int boxcy, int bgcolour,               int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush,
2397               int fgcolour, uint8 * text, uint8 length)               int bgcolour, int fgcolour, uint8 * text, uint8 length)
2398  {  {
2399            /* TODO: use brush appropriately */
2400    
2401          FONTGLYPH *glyph;          FONTGLYPH *glyph;
2402          int i, j, xyoffset, x1, y1;          int i, j, xyoffset, x1, y1;
2403          DATABLOB *entry;          DATABLOB *entry;

Legend:
Removed from v.823  
changed lines
  Added in v.844

  ViewVC Help
Powered by ViewVC 1.1.26