fixup flushwindowrect coordinate handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23466 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-09-12 13:00:10 +00:00
parent 45fbea927a
commit 9021fec40a
3 changed files with 19 additions and 14 deletions

View file

@ -9,7 +9,7 @@
* Source/x11/XGServerWindow.m: * Source/x11/XGServerWindow.m:
* Source/x11/XGServerEvent.m: * Source/x11/XGServerEvent.m:
Get backend to generate NSEvent objects with event location given in Get backend to generate NSEvent objects with event location given in
OpernStep coordinates. OpenStep coordinates. Fix flushwindowrect coordinate handling.
Update art backend to try to honor the x and y window offsets Update art backend to try to honor the x and y window offsets
provided in the graphics state. provided in the graphics state.

View file

@ -2659,6 +2659,7 @@ static BOOL didCreatePixmaps;
XGCValues values; XGCValues values;
unsigned long valuemask; unsigned long valuemask;
gswindow_device_t *window; gswindow_device_t *window;
float l, r, t, b;
window = WINDOW_WITH_TAG(win); window = WINDOW_WITH_TAG(win);
if (win == 0 || window == NULL) if (win == 0 || window == NULL)
@ -2667,7 +2668,7 @@ static BOOL didCreatePixmaps;
return; return;
} }
NSDebugLLog(@"XGTrace", @"DPSflushwindowrect: %@ : %d", NSDebugLLog(@"XGFlush", @"DPSflushwindowrect: %@ : %d",
NSStringFromRect(rect), win); NSStringFromRect(rect), win);
if (window->type == NSBackingStoreNonretained) if (window->type == NSBackingStoreNonretained)
{ {
@ -2675,23 +2676,20 @@ static BOOL didCreatePixmaps;
return; return;
} }
/* FIXME: Doesn't take into account any offset added to the window
(from PSsetgcdrawable) or possible scaling (unlikely in X-windows,
but what about other devices?) */
rect.origin.y = NSHeight(window->xframe) - NSMaxY(rect);
values.function = GXcopy; values.function = GXcopy;
values.plane_mask = AllPlanes; values.plane_mask = AllPlanes;
values.clip_mask = None; values.clip_mask = None;
valuemask = (GCFunction | GCPlaneMask | GCClipMask); valuemask = (GCFunction | GCPlaneMask | GCClipMask);
XChangeGC(dpy, window->gc, valuemask, &values); XChangeGC(dpy, window->gc, valuemask, &values);
xi = NSMinX(rect); // width/height seems [self styleoffsets: &l : &r : &t : &b
yi = NSMinY(rect); // to require +1 pixel : window->win_attrs.window_style : window->ident];
width = NSWidth(rect) + 1; // to copy out xi = NSMinX(rect) - l;
height = NSHeight(rect) + 1; yi = NSHeight(window->xframe) + b - NSMaxY(rect);
width = NSWidth(rect);
height = NSHeight(rect);
NSDebugLLog (@"NSWindow", NSDebugLLog (@"XGFlush",
@"copy X rect ((%d, %d), (%d, %d))", xi, yi, width, height); @"copy X rect ((%d, %d), (%d, %d))", xi, yi, width, height);
if (width > 0 || height > 0) if (width > 0 || height > 0)

View file

@ -245,6 +245,8 @@ static Region emptyRegion;
} }
XSetRegion(XDPY, xgcntxt, clipregion); XSetRegion(XDPY, xgcntxt, clipregion);
NSDebugLLog(@"XGGraphics", @"Clip %@ set to X rect %@",
self, NSStringFromRect([self clipRect]));
} }
/* Returns the clip region, which must be freed by the caller */ /* Returns the clip region, which must be freed by the caller */
@ -1485,10 +1487,12 @@ static Region emptyRegion;
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h - (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h
{ {
XRectangle xrect; XRectangle xrect;
NSRect orect;
CHECK_GC; CHECK_GC;
xrect = XGViewRectToX(self, NSMakeRect(x, y, w, h)); orect = NSMakeRect(x, y, w, h);
xrect = XGViewRectToX(self, orect);
if (clipregion == 0) if (clipregion == 0)
{ {
@ -1522,7 +1526,10 @@ static Region emptyRegion;
[self setColor: &fillColor state: COLOR_FILL]; [self setColor: &fillColor state: COLOR_FILL];
bounds = XGViewRectToX(self, NSMakeRect(x, y, w, h)); bounds = XGViewRectToX(self, NSMakeRect(x, y, w, h));
// Hack: Only draw when alpha is not zero NSDebugLLog(@"XGGraphics", @"Fill %@ X rect %d,%d,%d,%d",
self, bounds.x, bounds.y, bounds.width, bounds.height);
// Hack: Only draw when alpha is not zero
if (drawingAlpha == NO || fillColor.field[AINDEX] != 0.0) if (drawingAlpha == NO || fillColor.field[AINDEX] != 0.0)
XFillRectangle(XDPY, draw, xgcntxt, XFillRectangle(XDPY, draw, xgcntxt,
bounds.x, bounds.y, bounds.width, bounds.height); bounds.x, bounds.y, bounds.width, bounds.height);