Commit 4bdf4345 authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

winex11.drv: Store window and drawable rects in X11DRV_PDEVICE.

parent e7b9a5f1
......@@ -115,7 +115,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_
if (!(data = X11DRV_GetRegionData( physDev->region, 0 ))) return;
wine_tsx11_lock();
XSetClipRectangles( gdi_display, physDev->gc, physDev->org.x, physDev->org.y,
XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
......
......@@ -126,10 +126,14 @@ static void update_visible_region( struct dce *dce )
vis_rgn = ExtCreateRegion( NULL, size, data );
top = reply->top_win;
escape.org.x = reply->win_org_x - reply->top_org_x;
escape.org.y = reply->win_org_y - reply->top_org_y;
escape.drawable_org.x = reply->top_org_x;
escape.drawable_org.y = reply->top_org_y;
escape.dc_rect.left = reply->win_rect.left - reply->top_rect.left;
escape.dc_rect.top = reply->win_rect.top - reply->top_rect.top;
escape.dc_rect.right = reply->win_rect.right - reply->top_rect.left;
escape.dc_rect.bottom = reply->win_rect.bottom - reply->top_rect.top;
escape.drawable_rect.left = reply->top_rect.left;
escape.drawable_rect.top = reply->top_rect.top;
escape.drawable_rect.right = reply->top_rect.right;
escape.drawable_rect.bottom = reply->top_rect.bottom;
}
else size = reply->total_size;
}
......@@ -154,8 +158,8 @@ static void update_visible_region( struct dce *dce )
/* map region to DC coordinates */
OffsetRgn( vis_rgn,
-(escape.drawable_org.x + escape.org.x),
-(escape.drawable_org.y + escape.org.y) );
-(escape.drawable_rect.left + escape.dc_rect.left),
-(escape.drawable_rect.top + escape.dc_rect.top) );
SelectVisRgn16( HDC_16(dce->hdc), HRGN_16(vis_rgn) );
DeleteObject( vis_rgn );
}
......@@ -178,8 +182,9 @@ static void release_dce( struct dce *dce )
escape.code = X11DRV_SET_DRAWABLE;
escape.drawable = root_window;
escape.mode = IncludeInferiors;
escape.org.x = escape.org.y = 0;
escape.drawable_org.x = escape.drawable_org.y = 0;
escape.drawable_rect = virtual_screen_rect;
SetRect( &escape.dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
virtual_screen_rect.bottom - virtual_screen_rect.top );
ExtEscape( dce->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
}
......
......@@ -3462,7 +3462,7 @@ static void X11DRV_DIB_SetImageBits_GetSubImage(
descr->xDest + descr->width , descr->yDest + descr->height );
GetRgnBox( descr->physDev->region, &rc );
/* convert from dc to drawable origin */
OffsetRect( &rc, descr->physDev->org.x, descr->physDev->org.y);
OffsetRect( &rc, descr->physDev->dc_rect.left, descr->physDev->dc_rect.top);
/* clip visible rect with bitmap */
if( IntersectRect( &rc, &rc, &bmprc))
{
......@@ -3833,8 +3833,8 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
descr.gc = physDev->gc;
descr.xSrc = xSrc;
descr.ySrc = ySrc;
descr.xDest = physDev->org.x + pt.x;
descr.yDest = physDev->org.y + pt.y;
descr.xDest = physDev->dc_rect.left + pt.x;
descr.yDest = physDev->dc_rect.top + pt.y;
descr.width = cx;
descr.height = cy;
descr.useShm = FALSE;
......@@ -4229,7 +4229,7 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
/* perform the copy */
X11DRV_DIB_DoCopyDIBSection(physBitmap, FALSE, colorMap, nColorMap,
physDevDst->drawable, physDevDst->gc, xSrc, ySrc,
physDevDst->org.x + xDest, physDevDst->org.y + yDest,
physDevDst->dc_rect.left + xDest, physDevDst->dc_rect.top + yDest,
width, height);
/* free color mapping */
if (aColorMap)
......
......@@ -327,9 +327,9 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
{
const struct x11drv_escape_set_drawable *data = (const struct x11drv_escape_set_drawable *)in_data;
if(physDev->xrender) X11DRV_XRender_UpdateDrawable( physDev );
physDev->org = data->org;
physDev->dc_rect = data->dc_rect;
physDev->drawable = data->drawable;
physDev->drawable_org = data->drawable_org;
physDev->drawable_rect = data->drawable_rect;
wine_tsx11_lock();
XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
wine_tsx11_unlock();
......@@ -359,8 +359,8 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
if (event.type == NoExpose) break;
if (event.type == GraphicsExpose)
{
int x = event.xgraphicsexpose.x - physDev->org.x;
int y = event.xgraphicsexpose.y - physDev->org.y;
int x = event.xgraphicsexpose.x - physDev->dc_rect.left;
int y = event.xgraphicsexpose.y - physDev->dc_rect.top;
TRACE( "got %d,%d %dx%d count %d\n", x, y,
event.xgraphicsexpose.width,
......
......@@ -537,8 +537,8 @@ inline static void set_drawable( HDC hdc, Drawable drawable )
escape.code = X11DRV_SET_DRAWABLE;
escape.drawable = drawable;
escape.mode = IncludeInferiors;
escape.org.x = escape.org.y = 0;
escape.drawable_org.x = escape.drawable_org.y = 0;
ZeroMemory(&escape.dc_rect, sizeof(escape.dc_rect));
ZeroMemory(&escape.drawable_rect, sizeof(escape.drawable_rect));
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL );
}
......
......@@ -81,7 +81,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->org.x + lprect->left, physDev->org.y + lprect->top,
physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top,
lprect->right - lprect->left, lprect->bottom - lprect->top );
wine_tsx11_unlock();
}
......@@ -124,7 +124,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{
X11DRV_cptable[pfo->fi->cptable].pDrawString(
pfo, gdi_display, physDev->drawable, physDev->gc,
physDev->org.x + x, physDev->org.y + y, str2b, count );
physDev->dc_rect.left + x, physDev->dc_rect.top + y, str2b, count );
}
else
{
......@@ -145,7 +145,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display,
physDev->drawable, physDev->gc,
physDev->org.x + x, physDev->org.y + y, items, pitem - items );
physDev->dc_rect.left + x, physDev->dc_rect.top + y, items, pitem - items );
HeapFree( GetProcessHeap(), 0, items );
}
}
......@@ -159,9 +159,9 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{
int char_metric_offset = str2b[i].byte2 + (str2b[i].byte1 << 8)
- font->min_char_or_byte2;
int x_i = IROUND((double) (physDev->org.x + x) + offset *
int x_i = IROUND((double) (physDev->dc_rect.left + x) + offset *
pfo->lpX11Trans->a / pfo->lpX11Trans->pixelsize );
int y_i = IROUND((double) (physDev->org.y + y) - offset *
int y_i = IROUND((double) (physDev->dc_rect.top + y) - offset *
pfo->lpX11Trans->b / pfo->lpX11Trans->pixelsize );
X11DRV_cptable[pfo->fi->cptable].pDrawString(
......
......@@ -123,9 +123,9 @@ typedef struct
HDC hdc;
GC gc; /* X Window GC */
Drawable drawable;
POINT org; /* DC origin relative to drawable */
POINT drawable_org; /* Origin of drawable relative to screen */
HRGN region; /* Device region (visible region & clip region) */
RECT dc_rect; /* DC rectangle relative to drawable */
RECT drawable_rect; /* Drawable rectangle relative to screen */
HRGN region; /* Device region (visible region & clip region) */
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
......@@ -480,8 +480,8 @@ struct x11drv_escape_set_drawable
enum x11drv_escape_codes code; /* escape code (X11DRV_SET_DRAWABLE) */
Drawable drawable; /* X drawable */
int mode; /* ClipByChildren or IncludeInferiors */
POINT org; /* origin of DC relative to drawable */
POINT drawable_org; /* origin of drawable relative to screen */
RECT dc_rect; /* DC rectangle relative to drawable */
RECT drawable_rect;/* Drawable rectangle relative to screen */
};
struct x11drv_escape_set_dce
......
......@@ -1118,7 +1118,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, backgroundPixel );
XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->org.x + lprect->left, physDev->org.y + lprect->top,
physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top,
lprect->right - lprect->left, lprect->bottom - lprect->top );
wine_tsx11_unlock();
}
......@@ -1175,7 +1175,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
{
wine_tsx11_lock();
pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict,
physDev->org.x, physDev->org.y,
physDev->dc_rect.left, physDev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
......@@ -1261,7 +1261,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
assert(formatEntry);
TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count),
physDev->org.x + x, physDev->org.y + y);
physDev->dc_rect.left + x, physDev->dc_rect.top + y);
if(X11DRV_XRender_Installed) {
wine_tsx11_lock();
......@@ -1270,7 +1270,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->tile_pict,
physDev->xrender->pict,
formatEntry->font_format, formatEntry->glyphset,
0, 0, physDev->org.x + x, physDev->org.y + y,
0, 0, physDev->dc_rect.left + x, physDev->dc_rect.top + y,
wstr, count);
else {
INT offset = 0, xoff = 0, yoff = 0;
......@@ -1279,8 +1279,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->tile_pict,
physDev->xrender->pict,
formatEntry->font_format, formatEntry->glyphset,
0, 0, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
0, 0, physDev->dc_rect.left + x + xoff,
physDev->dc_rect.top + y + yoff,
wstr + idx, 1);
offset += lpDx[idx];
xoff = offset * cosEsc;
......@@ -1296,8 +1296,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(antialias == AA_None) {
for(idx = 0; idx < count; idx++) {
SharpGlyphMono(physDev, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
SharpGlyphMono(physDev, physDev->dc_rect.left + x + xoff,
physDev->dc_rect.top + y + yoff,
formatEntry->bitmaps[wstr[idx]],
&formatEntry->gis[wstr[idx]]);
if(lpDx) {
......@@ -1311,8 +1311,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
}
} else if(physDev->depth == 1) {
for(idx = 0; idx < count; idx++) {
SharpGlyphGray(physDev, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
SharpGlyphGray(physDev, physDev->dc_rect.left + x + xoff,
physDev->dc_rect.top + y + yoff,
formatEntry->bitmaps[wstr[idx]],
&formatEntry->gis[wstr[idx]]);
if(lpDx) {
......@@ -1358,28 +1358,28 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
}
}
TRACE("glyph extents %d,%d - %d,%d drawable x,y %d,%d\n", extents.left, extents.top,
extents.right, extents.bottom, physDev->org.x + x, physDev->org.y + y);
extents.right, extents.bottom, physDev->dc_rect.left + x, physDev->dc_rect.top + y);
if(physDev->org.x + x + extents.left >= 0) {
image_x = physDev->org.x + x + extents.left;
if(physDev->dc_rect.left + x + extents.left >= 0) {
image_x = physDev->dc_rect.left + x + extents.left;
image_off_x = 0;
} else {
image_x = 0;
image_off_x = physDev->org.x + x + extents.left;
image_off_x = physDev->dc_rect.left + x + extents.left;
}
if(physDev->org.y + y + extents.top >= 0) {
image_y = physDev->org.y + y + extents.top;
if(physDev->dc_rect.top + y + extents.top >= 0) {
image_y = physDev->dc_rect.top + y + extents.top;
image_off_y = 0;
} else {
image_y = 0;
image_off_y = physDev->org.y + y + extents.top;
image_off_y = physDev->dc_rect.top + y + extents.top;
}
if(physDev->org.x + x + extents.right < w)
image_w = physDev->org.x + x + extents.right - image_x;
if(physDev->dc_rect.left + x + extents.right < w)
image_w = physDev->dc_rect.left + x + extents.right - image_x;
else
image_w = w - image_x;
if(physDev->org.y + y + extents.bottom < h)
image_h = physDev->org.y + y + extents.bottom - image_y;
if(physDev->dc_rect.top + y + extents.bottom < h)
image_h = physDev->dc_rect.top + y + extents.bottom - image_y;
else
image_h = h - image_y;
......@@ -1608,7 +1608,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
if ((rgndata = X11DRV_GetRegionData( devDst->region, 0 )))
{
pXRenderSetPictureClipRectangles( gdi_display, dst_pict,
devDst->org.x, devDst->org.y,
devDst->dc_rect.left, devDst->dc_rect.top,
(XRectangle *)rgndata->Buffer,
rgndata->rdh.nCount );
HeapFree( GetProcessHeap(), 0, rgndata );
......@@ -1628,7 +1628,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
#endif
pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict,
0, 0, 0, 0,
xDst + devDst->org.x, yDst + devDst->org.y, widthDst, heightDst);
xDst + devDst->dc_rect.left, yDst + devDst->dc_rect.top, widthDst, heightDst);
pXRenderFreePicture(gdi_display, src_pict);
......
......@@ -2828,10 +2828,8 @@ struct get_visible_region_reply
{
struct reply_header __header;
user_handle_t top_win;
int top_org_x;
int top_org_y;
int win_org_x;
int win_org_y;
rectangle_t top_rect;
rectangle_t win_rect;
data_size_t total_size;
/* VARARG(region,rectangles); */
};
......@@ -4417,6 +4415,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 260
#define SERVER_PROTOCOL_VERSION 261
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -2012,10 +2012,8 @@ enum message_type
unsigned int flags; /* DCX flags */
@REPLY
user_handle_t top_win; /* top window to clip against */
int top_org_x; /* top window visible rect origin in screen coords */
int top_org_y;
int win_org_x; /* window rect origin in screen coords */
int win_org_y;
rectangle_t top_rect; /* top window visible rect with screen coords */
rectangle_t win_rect; /* window rect in screen coords */
data_size_t total_size; /* total size of the resulting region */
VARARG(region,rectangles); /* list of rectangles for the region (in screen coords) */
@END
......
......@@ -2521,10 +2521,12 @@ static void dump_get_visible_region_request( const struct get_visible_region_req
static void dump_get_visible_region_reply( const struct get_visible_region_reply *req )
{
fprintf( stderr, " top_win=%p,", req->top_win );
fprintf( stderr, " top_org_x=%d,", req->top_org_x );
fprintf( stderr, " top_org_y=%d,", req->top_org_y );
fprintf( stderr, " win_org_x=%d,", req->win_org_x );
fprintf( stderr, " win_org_y=%d,", req->win_org_y );
fprintf( stderr, " top_rect=" );
dump_rectangle( &req->top_rect );
fprintf( stderr, "," );
fprintf( stderr, " win_rect=" );
dump_rectangle( &req->win_rect );
fprintf( stderr, "," );
fprintf( stderr, " total_size=%u,", req->total_size );
fprintf( stderr, " region=" );
dump_varargs_rectangles( cur_size );
......
......@@ -756,6 +756,18 @@ static inline void client_to_screen( struct window *win, int *x, int *y )
}
}
/* convert coordinates from client to screen coords */
static inline void client_to_screen_rect( struct window *win, rectangle_t *rect )
{
for ( ; win && !is_desktop_window(win); win = win->parent)
{
rect->left += win->client_rect.left;
rect->right += win->client_rect.left;
rect->top += win->client_rect.top;
rect->bottom += win->client_rect.top;
}
}
/* map the region from window to screen coordinates */
static inline void map_win_region_to_screen( struct window *win, struct region *region )
{
......@@ -1826,18 +1838,22 @@ DECL_HANDLER(get_visible_region)
data = get_region_data_and_free( region, get_reply_max_size(), &reply->total_size );
if (data) set_reply_data_ptr( data, reply->total_size );
}
reply->top_win = top->handle;
reply->top_org_x = top->visible_rect.left;
reply->top_org_y = top->visible_rect.top;
reply->top_win = top->handle;
reply->top_rect = top->visible_rect;
if (!is_desktop_window(top))
if (!is_desktop_window(win))
{
reply->win_rect = (req->flags & DCX_WINDOW) ? win->window_rect : win->client_rect;
client_to_screen_rect( top->parent, &reply->top_rect );
client_to_screen_rect( win->parent, &reply->win_rect );
}
else
{
reply->win_org_x = (req->flags & DCX_WINDOW) ? win->window_rect.left : win->client_rect.left;
reply->win_org_y = (req->flags & DCX_WINDOW) ? win->window_rect.top : win->client_rect.top;
client_to_screen( top->parent, &reply->top_org_x, &reply->top_org_y );
client_to_screen( win->parent, &reply->win_org_x, &reply->win_org_y );
reply->win_rect.left = 0;
reply->win_rect.top = 0;
reply->win_rect.right = win->client_rect.right - win->client_rect.left;
reply->win_rect.bottom = win->client_rect.bottom - win->client_rect.top;
}
else reply->win_org_x = reply->win_org_y = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment