Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * X11 graphics driver initialisation functions |
| 3 | * |
| 4 | * Copyright 1996 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Patrik Stridvall | ab121e7 | 1999-02-04 11:11:01 +0000 | [diff] [blame] | 21 | #include "config.h" |
| 22 | |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 23 | #include <stdarg.h> |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 24 | #include <string.h> |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 25 | |
Alexandre Julliard | 435e2e6 | 2002-12-10 22:56:43 +0000 | [diff] [blame] | 26 | #include "windef.h" |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 27 | #include "winbase.h" |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 28 | #include "x11drv.h" |
Alexandre Julliard | ced71ed | 2002-03-23 21:43:56 +0000 | [diff] [blame] | 29 | #include "x11font.h" |
Alexandre Julliard | 294c8af | 2004-01-20 22:48:57 +0000 | [diff] [blame^] | 30 | #include "gdi.h" |
Ove Kaaven | 8f7ac8b | 2001-04-17 17:29:59 +0000 | [diff] [blame] | 31 | #include "ddrawi.h" |
Alexandre Julliard | 376e650 | 2002-06-02 21:40:24 +0000 | [diff] [blame] | 32 | #include "wine/debug.h" |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 33 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 34 | WINE_DEFAULT_DEBUG_CHANNEL(x11drv); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 35 | |
Alexandre Julliard | 6ec42c0 | 2004-01-15 00:35:38 +0000 | [diff] [blame] | 36 | const struct tagDC_FUNCS *X11DRV_DC_Funcs = NULL; /* hack */ |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 37 | |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 38 | Display *gdi_display; /* display to use for all GDI functions */ |
| 39 | |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 40 | /* a few dynamic device caps */ |
| 41 | static int log_pixels_x; /* pixels per logical inch in x direction */ |
| 42 | static int log_pixels_y; /* pixels per logical inch in y direction */ |
| 43 | static int horz_size; /* horz. size of screen in millimeters */ |
| 44 | static int vert_size; /* vert. size of screen in millimeters */ |
| 45 | static int palette_size; |
Huw D M Davies | e1e51f9 | 2002-04-03 21:18:50 +0000 | [diff] [blame] | 46 | unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE | |
| 47 | TC_CR_ANY | TC_SA_DOUBLE | TC_SA_INTEGER | |
| 48 | TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE); |
| 49 | /* X11R6 adds TC_SF_X_YINDEP, Xrender adds TC_VA_ABLE */ |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 50 | |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 51 | /********************************************************************** |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 52 | * X11DRV_GDI_Initialize |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 53 | */ |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 54 | BOOL X11DRV_GDI_Initialize( Display *display ) |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 55 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 56 | Screen *screen = DefaultScreenOfDisplay(display); |
| 57 | |
| 58 | gdi_display = display; |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 59 | |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 60 | palette_size = X11DRV_PALETTE_Init(); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 61 | |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 62 | if (!X11DRV_BITMAP_Init()) return FALSE; |
| 63 | |
Huw D M Davies | 6f7fc50 | 2002-01-29 03:07:21 +0000 | [diff] [blame] | 64 | /* Initialize XRender */ |
| 65 | X11DRV_XRender_Init(); |
| 66 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 67 | /* Initialize fonts and text caps */ |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 68 | |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 69 | log_pixels_x = MulDiv( WidthOfScreen(screen), 254, WidthMMOfScreen(screen) * 10 ); |
| 70 | log_pixels_y = MulDiv( HeightOfScreen(screen), 254, HeightMMOfScreen(screen) * 10 ); |
Huw D M Davies | e1e51f9 | 2002-04-03 21:18:50 +0000 | [diff] [blame] | 71 | X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y ); |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 72 | horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 ); |
| 73 | vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 ); |
| 74 | return TRUE; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 77 | /********************************************************************** |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 78 | * X11DRV_GDI_Finalize |
| 79 | */ |
| 80 | void X11DRV_GDI_Finalize(void) |
| 81 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 82 | X11DRV_PALETTE_Cleanup(); |
| 83 | XCloseDisplay( gdi_display ); |
| 84 | gdi_display = NULL; |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | /********************************************************************** |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 88 | * X11DRV_CreateDC |
| 89 | */ |
Dmitry Timoshkov | 3a910c7 | 2003-08-12 20:42:18 +0000 | [diff] [blame] | 90 | BOOL X11DRV_CreateDC( DC *dc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device, |
| 91 | LPCWSTR output, const DEVMODEW* initData ) |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 92 | { |
| 93 | X11DRV_PDEVICE *physDev; |
| 94 | |
Alexandre Julliard | 3dd63eb | 2001-07-27 19:37:31 +0000 | [diff] [blame] | 95 | if (!X11DRV_DC_Funcs) X11DRV_DC_Funcs = dc->funcs; /* hack */ |
| 96 | |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 97 | physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ); |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 98 | if(!physDev) { |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 99 | ERR("Can't allocate physDev\n"); |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 100 | return FALSE; |
| 101 | } |
Alexandre Julliard | d3cab18 | 2002-06-10 22:52:47 +0000 | [diff] [blame] | 102 | *pdev = physDev; |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 103 | physDev->hdc = dc->hSelf; |
| 104 | physDev->dc = dc; /* FIXME */ |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 105 | |
Alexandre Julliard | e1147ba | 2003-05-13 23:56:12 +0000 | [diff] [blame] | 106 | if (GetObjectType( dc->hSelf ) == OBJ_MEMDC) |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 107 | { |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 108 | physDev->drawable = BITMAP_stock_pixmap; |
Alexandre Julliard | b89525f | 2004-01-18 22:20:17 +0000 | [diff] [blame] | 109 | physDev->depth = 1; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 110 | } |
| 111 | else |
| 112 | { |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 113 | physDev->drawable = root_window; |
Alexandre Julliard | b89525f | 2004-01-18 22:20:17 +0000 | [diff] [blame] | 114 | physDev->depth = screen_depth; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 115 | } |
Alexandre Julliard | d3cab18 | 2002-06-10 22:52:47 +0000 | [diff] [blame] | 116 | physDev->org.x = physDev->org.y = 0; |
| 117 | physDev->drawable_org.x = physDev->drawable_org.y = 0; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 118 | |
Lionel Ulmer | bedf40b | 2000-05-12 20:18:14 +0000 | [diff] [blame] | 119 | physDev->current_pf = 0; |
| 120 | physDev->used_visuals = 0; |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 121 | |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 122 | wine_tsx11_lock(); |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 123 | physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 124 | XSetGraphicsExposures( gdi_display, physDev->gc, False ); |
| 125 | XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors ); |
| 126 | XFlush( gdi_display ); |
| 127 | wine_tsx11_unlock(); |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 128 | return TRUE; |
| 129 | } |
| 130 | |
| 131 | |
| 132 | /********************************************************************** |
| 133 | * X11DRV_DeleteDC |
| 134 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 135 | BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev ) |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 136 | { |
Huw D M Davies | 6f7fc50 | 2002-01-29 03:07:21 +0000 | [diff] [blame] | 137 | if(physDev->xrender) |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 138 | X11DRV_XRender_DeleteDC( physDev ); |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 139 | wine_tsx11_lock(); |
| 140 | XFreeGC( gdi_display, physDev->gc ); |
Lionel Ulmer | bedf40b | 2000-05-12 20:18:14 +0000 | [diff] [blame] | 141 | while (physDev->used_visuals-- > 0) |
Alexandre Julliard | c559735 | 2001-05-11 00:17:47 +0000 | [diff] [blame] | 142 | XFree(physDev->visuals[physDev->used_visuals]); |
| 143 | wine_tsx11_unlock(); |
Huw D M Davies | 9c68faa | 1998-11-25 12:36:03 +0000 | [diff] [blame] | 144 | HeapFree( GetProcessHeap(), 0, physDev ); |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 145 | return TRUE; |
| 146 | } |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 147 | |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 148 | |
| 149 | /*********************************************************************** |
| 150 | * GetDeviceCaps (X11DRV.@) |
| 151 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 152 | INT X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap ) |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 153 | { |
| 154 | switch(cap) |
| 155 | { |
| 156 | case DRIVERVERSION: |
| 157 | return 0x300; |
| 158 | case TECHNOLOGY: |
| 159 | return DT_RASDISPLAY; |
| 160 | case HORZSIZE: |
| 161 | return horz_size; |
| 162 | case VERTSIZE: |
| 163 | return vert_size; |
| 164 | case HORZRES: |
| 165 | return screen_width; |
| 166 | case VERTRES: |
| 167 | return screen_height; |
| 168 | case BITSPIXEL: |
| 169 | return screen_depth; |
| 170 | case PLANES: |
| 171 | return 1; |
| 172 | case NUMBRUSHES: |
| 173 | return -1; |
| 174 | case NUMPENS: |
| 175 | return -1; |
| 176 | case NUMMARKERS: |
| 177 | return 0; |
| 178 | case NUMFONTS: |
| 179 | return 0; |
| 180 | case NUMCOLORS: |
| 181 | /* MSDN: Number of entries in the device's color table, if the device has |
| 182 | * a color depth of no more than 8 bits per pixel.For devices with greater |
| 183 | * color depths, -1 is returned. */ |
| 184 | return (screen_depth > 8) ? -1 : (1 << screen_depth); |
| 185 | case PDEVICESIZE: |
| 186 | return sizeof(X11DRV_PDEVICE); |
| 187 | case CURVECAPS: |
| 188 | return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE | |
| 189 | CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT); |
| 190 | case LINECAPS: |
| 191 | return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE | |
| 192 | LC_STYLED | LC_WIDESTYLED | LC_INTERIORS); |
| 193 | case POLYGONALCAPS: |
| 194 | return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE | |
| 195 | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS); |
| 196 | case TEXTCAPS: |
| 197 | return text_caps; |
| 198 | case CLIPCAPS: |
| 199 | return CP_REGION; |
| 200 | case RASTERCAPS: |
| 201 | return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP | |
| 202 | RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS | |
| 203 | (palette_size ? RC_PALETTE : 0)); |
| 204 | case ASPECTX: |
| 205 | case ASPECTY: |
| 206 | return 36; |
| 207 | case ASPECTXY: |
| 208 | return 51; |
| 209 | case LOGPIXELSX: |
| 210 | return log_pixels_x; |
| 211 | case LOGPIXELSY: |
| 212 | return log_pixels_y; |
| 213 | case CAPS1: |
Alexandre Julliard | e0315e4 | 2002-10-31 02:38:20 +0000 | [diff] [blame] | 214 | FIXME("(%p): CAPS1 is unimplemented, will return 0\n", physDev->hdc ); |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 215 | /* please see wingdi.h for the possible bit-flag values that need |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 216 | to be returned. also, see |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 217 | http://msdn.microsoft.com/library/ddkdoc/win95ddk/graphcnt_1m0p.htm */ |
| 218 | return 0; |
| 219 | case SIZEPALETTE: |
| 220 | return palette_size; |
| 221 | case NUMRESERVED: |
| 222 | case COLORRES: |
| 223 | case PHYSICALWIDTH: |
| 224 | case PHYSICALHEIGHT: |
| 225 | case PHYSICALOFFSETX: |
| 226 | case PHYSICALOFFSETY: |
| 227 | case SCALINGFACTORX: |
| 228 | case SCALINGFACTORY: |
| 229 | case VREFRESH: |
| 230 | case DESKTOPVERTRES: |
| 231 | case DESKTOPHORZRES: |
| 232 | case BTLALIGNMENT: |
| 233 | return 0; |
| 234 | default: |
Alexandre Julliard | e0315e4 | 2002-10-31 02:38:20 +0000 | [diff] [blame] | 235 | FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap ); |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 236 | return 0; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 241 | /********************************************************************** |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 242 | * ExtEscape (X11DRV.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 243 | */ |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 244 | INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data, |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 245 | INT out_count, LPVOID out_data ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 246 | { |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 247 | switch(escape) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 248 | { |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 249 | case QUERYESCSUPPORT: |
| 250 | if (in_data) |
| 251 | { |
| 252 | switch (*(INT *)in_data) |
| 253 | { |
| 254 | case DCICOMMAND: |
| 255 | return DD_HAL_VERSION; |
Alexandre Julliard | ced71ed | 2002-03-23 21:43:56 +0000 | [diff] [blame] | 256 | case X11DRV_ESCAPE: |
| 257 | return TRUE; |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 258 | } |
| 259 | } |
| 260 | break; |
Ove Kaaven | 8f7ac8b | 2001-04-17 17:29:59 +0000 | [diff] [blame] | 261 | |
Alexandre Julliard | 9208301 | 2001-07-29 20:25:14 +0000 | [diff] [blame] | 262 | case DCICOMMAND: |
| 263 | if (in_data) |
| 264 | { |
| 265 | const DCICMD *lpCmd = in_data; |
| 266 | if (lpCmd->dwVersion != DD_VERSION) break; |
| 267 | return X11DRV_DCICommand(in_count, lpCmd, out_data); |
| 268 | } |
| 269 | break; |
Alexandre Julliard | ced71ed | 2002-03-23 21:43:56 +0000 | [diff] [blame] | 270 | |
| 271 | case X11DRV_ESCAPE: |
| 272 | if (in_data && in_count >= sizeof(enum x11drv_escape_codes)) |
| 273 | { |
| 274 | switch(*(enum x11drv_escape_codes *)in_data) |
| 275 | { |
| 276 | case X11DRV_GET_DISPLAY: |
| 277 | if (out_count >= sizeof(Display *)) |
| 278 | { |
| 279 | *(Display **)out_data = gdi_display; |
| 280 | return TRUE; |
| 281 | } |
| 282 | break; |
| 283 | case X11DRV_GET_DRAWABLE: |
| 284 | if (out_count >= sizeof(Drawable)) |
| 285 | { |
| 286 | *(Drawable *)out_data = physDev->drawable; |
| 287 | return TRUE; |
| 288 | } |
| 289 | break; |
| 290 | case X11DRV_GET_FONT: |
| 291 | if (out_count >= sizeof(Font)) |
| 292 | { |
| 293 | fontObject* pfo = XFONT_GetFontObject( physDev->font ); |
Lionel Ulmer | a3f4e7f | 2002-07-03 01:16:45 +0000 | [diff] [blame] | 294 | if (pfo == NULL) return FALSE; |
Alexandre Julliard | ced71ed | 2002-03-23 21:43:56 +0000 | [diff] [blame] | 295 | *(Font *)out_data = pfo->fs->fid; |
| 296 | return TRUE; |
| 297 | } |
Alexandre Julliard | 85dcf1e | 2004-01-14 04:53:11 +0000 | [diff] [blame] | 298 | break; |
| 299 | case X11DRV_SET_DRAWABLE: |
| 300 | if (in_count >= sizeof(struct x11drv_escape_set_drawable)) |
| 301 | { |
| 302 | struct x11drv_escape_set_drawable *data = (struct x11drv_escape_set_drawable *)in_data; |
| 303 | if(physDev->xrender) X11DRV_XRender_UpdateDrawable( physDev ); |
| 304 | physDev->org = data->org; |
| 305 | physDev->drawable = data->drawable; |
| 306 | physDev->drawable_org = data->drawable_org; |
| 307 | wine_tsx11_lock(); |
| 308 | XSetSubwindowMode( gdi_display, physDev->gc, data->mode ); |
| 309 | wine_tsx11_unlock(); |
| 310 | return TRUE; |
| 311 | } |
| 312 | break; |
| 313 | case X11DRV_START_EXPOSURES: |
| 314 | wine_tsx11_lock(); |
| 315 | XSetGraphicsExposures( gdi_display, physDev->gc, True ); |
| 316 | wine_tsx11_unlock(); |
| 317 | physDev->exposures = 0; |
| 318 | return TRUE; |
| 319 | case X11DRV_END_EXPOSURES: |
| 320 | if (out_count >= sizeof(HRGN)) |
| 321 | { |
| 322 | HRGN hrgn = 0, tmp = 0; |
| 323 | |
| 324 | wine_tsx11_lock(); |
| 325 | XSetGraphicsExposures( gdi_display, physDev->gc, False ); |
| 326 | if (physDev->exposures) |
| 327 | { |
| 328 | for (;;) |
| 329 | { |
| 330 | XEvent event; |
| 331 | |
| 332 | XWindowEvent( gdi_display, physDev->drawable, ~0, &event ); |
| 333 | if (event.type == NoExpose) break; |
| 334 | if (event.type == GraphicsExpose) |
| 335 | { |
| 336 | int x = event.xgraphicsexpose.x - physDev->org.x; |
| 337 | int y = event.xgraphicsexpose.y - physDev->org.y; |
| 338 | |
| 339 | TRACE( "got %d,%d %dx%d count %d\n", x, y, |
| 340 | event.xgraphicsexpose.width, |
| 341 | event.xgraphicsexpose.height, |
| 342 | event.xgraphicsexpose.count ); |
| 343 | |
| 344 | if (!tmp) tmp = CreateRectRgn( 0, 0, 0, 0 ); |
| 345 | SetRectRgn( tmp, x, y, |
| 346 | x + event.xgraphicsexpose.width, |
| 347 | y + event.xgraphicsexpose.height ); |
| 348 | if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR ); |
| 349 | else |
| 350 | { |
| 351 | hrgn = tmp; |
| 352 | tmp = 0; |
| 353 | } |
| 354 | if (!event.xgraphicsexpose.count) break; |
| 355 | } |
| 356 | else |
| 357 | { |
| 358 | ERR( "got unexpected event %d\n", event.type ); |
| 359 | break; |
| 360 | } |
| 361 | } |
| 362 | if (tmp) DeleteObject( tmp ); |
| 363 | } |
| 364 | wine_tsx11_unlock(); |
| 365 | *(HRGN *)out_data = hrgn; |
| 366 | return TRUE; |
| 367 | } |
| 368 | break; |
Alexandre Julliard | ced71ed | 2002-03-23 21:43:56 +0000 | [diff] [blame] | 369 | } |
| 370 | } |
| 371 | break; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 372 | } |
| 373 | return 0; |
| 374 | } |