mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Update window update interface
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@13470 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0fd6c646bc
commit
eda5a7a078
9 changed files with 111 additions and 91 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,9 +1,25 @@
|
|||
2002-04-14 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/x11/XGServerWindow.h: Add graphics driver protocol
|
||||
information.
|
||||
* Source/x11/XGServerWindow.m (_createBuffer:): Use it.
|
||||
(-termwindow:): Idem.
|
||||
([XGServer -windowbacking::win]): Idem.
|
||||
([XGServer -windowdevice:]): Idem.
|
||||
([XGServer -_addExposedRectangle::]): Idem.
|
||||
([XGServer -flushwindowrect::]): Idem.
|
||||
|
||||
* Source/xlib/XGBitmapImageRep.m: Use new GSCurrentDevice.
|
||||
* Source/xlib/XGContext.m: Idem.
|
||||
* Headers/xlib/XGGState.h: Use window device, not window number.
|
||||
* Source/xlib/XGGState.m: Idem.
|
||||
|
||||
Thu Apr 11 22:24:01 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/x11/XGServerEvent.m: Added missing includes.
|
||||
* Source/x11/XGServerWindow.m: Idem.
|
||||
* Source/x11/XGDragView.m: Idem.
|
||||
|
||||
2
|
||||
2002-04-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/gpbs.m: Fixed bug in argument parsing ... was objecting to
|
||||
|
|
|
@ -60,25 +60,32 @@ typedef struct {
|
|||
#define WMFHideOtherApplications 10
|
||||
#define WMFHideApplication 12
|
||||
|
||||
/* Graphics Driver protocol. Setup in [NSGraphicsContext-contextDevice:] */
|
||||
enum {
|
||||
GDriverHandlesBacking = 1,
|
||||
GDriverHandlesExpose = 2
|
||||
};
|
||||
|
||||
typedef struct _gswindow_device_t {
|
||||
Display *display;
|
||||
Window ident;
|
||||
Window root;
|
||||
Window parent;
|
||||
int screen;
|
||||
GC gc;
|
||||
long number;
|
||||
int depth;
|
||||
int border;
|
||||
int map_state;
|
||||
int visibility;
|
||||
NSBackingStoreType type;
|
||||
NSRect xframe;
|
||||
Drawable buffer;
|
||||
Drawable alpha_buffer;
|
||||
Display *display; /* Display this window is on */
|
||||
Window ident; /* Window handle */
|
||||
Window root; /* Handle of root window */
|
||||
Window parent; /* Handle of parent window */
|
||||
int screen; /* Screeen this window is on */
|
||||
GC gc; /* GC for drawing */
|
||||
long number; /* Globally unique identifier */
|
||||
int depth; /* Window depth */
|
||||
int border; /* Border size */
|
||||
int map_state; /* X map state */
|
||||
int visibility; /* X visibility */
|
||||
NSBackingStoreType type; /* Backing type */
|
||||
NSRect xframe; /* Window frame */
|
||||
Drawable buffer; /* Backing store pixmap */
|
||||
Drawable alpha_buffer; /* Alpha buffer. Managed by gdriver
|
||||
will be freed if HandlesBacking=0 */
|
||||
BOOL is_exposed;
|
||||
NSMutableArray *exposedRects;
|
||||
Region region; // Used between several expose events
|
||||
NSMutableArray *exposedRects; /* List of exposure event rects */
|
||||
Region region; /* Used between several expose events */
|
||||
XWMHints gen_hints;
|
||||
XSizeHints siz_hints;
|
||||
GNUstepWMAttributes win_attrs;
|
||||
|
@ -89,9 +96,11 @@ typedef struct _gswindow_device_t {
|
|||
Atom protocols[4];
|
||||
int numProtocols;
|
||||
XIC ic;
|
||||
void *gdriver; /* gdriver ident. Managed by gdriver */
|
||||
int gdriverProtocol; /* Managed by gdriver */
|
||||
} gswindow_device_t;
|
||||
|
||||
#define GET_XDRAWABLE(win) ((win)->buffer ? (win)->buffer: (win)->ident)
|
||||
#define GET_XDRAWABLE(win) ((win)->buffer ? (win)->buffer: (win)->ident)
|
||||
|
||||
@interface XGServer (DPSWindow)
|
||||
+ (gswindow_device_t *) _windowForXWindow: (Window)xWindow;
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
{
|
||||
@public
|
||||
void *context;
|
||||
void *windevice;
|
||||
GC xgcntxt;
|
||||
int window;
|
||||
XGCValues gcv;
|
||||
Drawable draw;
|
||||
Drawable alpha_buffer;
|
||||
|
@ -51,8 +51,7 @@
|
|||
BOOL sharedGC; /* Do we own the GC or share it? */
|
||||
}
|
||||
|
||||
- (void) setWindow: (int)win;
|
||||
- (void) setDrawable: (Drawable)theDrawable;
|
||||
- (void) setWindowDevice: (void *)device;
|
||||
- (void) setGraphicContext: (GC)xGraphicContext;
|
||||
- (void) setGCValues: (XGCValues)values withMask: (int)mask;
|
||||
- (void) setClipMask;
|
||||
|
@ -61,9 +60,9 @@
|
|||
|
||||
- (BOOL) hasDrawable;
|
||||
- (BOOL) hasGraphicContext;
|
||||
- (void *) windevice;
|
||||
- (Drawable) drawable;
|
||||
- (GC) graphicContext;
|
||||
- (NSPoint) offset;
|
||||
- (NSRect) clipRect;
|
||||
|
||||
- (void) setFont: (NSFont*)font;
|
||||
|
|
|
@ -42,18 +42,18 @@ endif
|
|||
# The list of subproject directories
|
||||
#
|
||||
SUBPROJECTS = gsc
|
||||
ifneq ($(BUILD_XLIB),)
|
||||
SUBPROJECTS += xlib
|
||||
endif
|
||||
ifneq ($(BUILD_XDPS),)
|
||||
SUBPROJECTS += xdps
|
||||
endif
|
||||
ifneq ($(BUILD_X11),)
|
||||
SUBPROJECTS += x11
|
||||
endif
|
||||
ifneq ($(BUILD_WIN32),)
|
||||
SUBPROJECTS += win32
|
||||
endif
|
||||
ifneq ($(BUILD_XLIB),)
|
||||
SUBPROJECTS += xlib
|
||||
endif
|
||||
ifneq ($(BUILD_XDPS),)
|
||||
SUBPROJECTS += xdps
|
||||
endif
|
||||
ifneq ($(BUILD_WINLIB),)
|
||||
SUBPROJECTS += winlib
|
||||
endif
|
||||
|
|
|
@ -521,6 +521,7 @@ static XGDragView *sharedDragView = nil;
|
|||
break;
|
||||
default:
|
||||
// FIXME: Should not happen, add warning?
|
||||
break;
|
||||
}
|
||||
|
||||
if (name != nil)
|
||||
|
|
|
@ -844,7 +844,8 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
only done if the Window is buffered or retained. */
|
||||
- (void) _createBuffer: (gswindow_device_t *)window
|
||||
{
|
||||
if (window->type == NSBackingStoreNonretained)
|
||||
if (window->type == NSBackingStoreNonretained
|
||||
|| (window->gdriverProtocol & GDriverHandlesBacking))
|
||||
return;
|
||||
|
||||
if (window->depth == 0)
|
||||
|
@ -1059,9 +1060,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
NSMapRemove(windowmaps, (void*)window->ident);
|
||||
}
|
||||
|
||||
if (window->buffer)
|
||||
if (window->buffer && (window->gdriverProtocol & GDriverHandlesBacking) == 0)
|
||||
XFreePixmap (XDPY, window->buffer);
|
||||
if (window->alpha_buffer)
|
||||
if (window->alpha_buffer
|
||||
&& (window->gdriverProtocol & GDriverHandlesBacking) == 0)
|
||||
XFreePixmap (XDPY, window->alpha_buffer);
|
||||
if (window->region)
|
||||
XDestroyRegion (window->region);
|
||||
|
@ -1208,6 +1210,12 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
|
||||
NSDebugLLog(@"XGTrace", @"DPSwindowbacking: %@ : %d", type, win);
|
||||
|
||||
if ((window->gdriverProtocol & GDriverHandlesBacking))
|
||||
{
|
||||
window->type = type;
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->buffer && type == NSBackingStoreNonretained)
|
||||
{
|
||||
XFreePixmap (XDPY, window->buffer);
|
||||
|
@ -1360,13 +1368,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
window->xframe.origin.x, window->xframe.origin.y,
|
||||
window->xframe.size.width, window->xframe.size.height);
|
||||
|
||||
if (window->buffer && (old_width != width || old_height != height))
|
||||
if (window->buffer && (old_width != width || old_height != height)
|
||||
&& (window->gdriverProtocol & GDriverHandlesBacking) == 0)
|
||||
{
|
||||
[isa waitAllContexts];
|
||||
XFreePixmap(XDPY, window->buffer);
|
||||
window->buffer = 0;
|
||||
if (window->alpha_buffer)
|
||||
XFreePixmap(XDPY, window->alpha_buffer);
|
||||
XFreePixmap (XDPY, window->alpha_buffer);
|
||||
window->alpha_buffer = 0;
|
||||
}
|
||||
|
||||
|
@ -1376,11 +1385,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
}
|
||||
|
||||
ctxt = GSCurrentContext();
|
||||
[ctxt contextDevice: window->number];
|
||||
DPSsetgcdrawable(ctxt, window->gc,
|
||||
(window->buffer)
|
||||
? (void *)window->buffer : (void *)window->ident,
|
||||
0, NSHeight(window->xframe));
|
||||
GSSetDevice(ctxt, window, 0, NSHeight(window->xframe));
|
||||
DPSinitmatrix(ctxt);
|
||||
DPSinitclip(ctxt);
|
||||
}
|
||||
|
@ -1973,9 +1978,18 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
valuemask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground);
|
||||
XChangeGC(XDPY, window->gc, valuemask, &values);
|
||||
[isa waitAllContexts];
|
||||
XCopyArea (XDPY, window->buffer, window->ident, window->gc,
|
||||
rectangle.x, rectangle.y, rectangle.width, rectangle.height,
|
||||
rectangle.x, rectangle.y);
|
||||
if ((window->gdriverProtocol & GDriverHandlesExpose))
|
||||
{
|
||||
/* Temporary protocol until we standardize the backing buffer */
|
||||
NSRect rect = NSMakeRect(rectangle.x, rectangle.y,
|
||||
rectangle.width, rectangle.height);
|
||||
[NSGraphicsContext handleExposeRect: rect
|
||||
forDriver: window->gdriver];
|
||||
}
|
||||
else
|
||||
XCopyArea (XDPY, window->buffer, window->ident, window->gc,
|
||||
rectangle.x, rectangle.y, rectangle.width, rectangle.height,
|
||||
rectangle.x, rectangle.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2039,8 +2053,15 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
|||
if (width > 0 || height > 0)
|
||||
{
|
||||
[isa waitAllContexts];
|
||||
XCopyArea (XDPY, window->buffer, window->ident, window->gc,
|
||||
xi, yi, width, height, xi, yi);
|
||||
if ((window->gdriverProtocol & GDriverHandlesBacking))
|
||||
{
|
||||
/* Temporary protocol until we standardize the backing buffer */
|
||||
[NSGraphicsContext handleExposeRect: rect
|
||||
forDriver: window->gdriver];
|
||||
}
|
||||
else
|
||||
XCopyArea (XDPY, window->buffer, window->ident, window->gc,
|
||||
xi, yi, width, height, xi, yi);
|
||||
}
|
||||
|
||||
XFlush(XDPY);
|
||||
|
|
|
@ -125,10 +125,7 @@
|
|||
{
|
||||
unsigned char *bData;
|
||||
XGContext *ctxt = (XGContext*)GSCurrentContext();
|
||||
Display *xDisplay = [ctxt xDisplay];
|
||||
Drawable xDrawable;
|
||||
GC gc;
|
||||
int x, y;
|
||||
gswindow_device_t *gs_win;
|
||||
|
||||
// Only produce pixmaps for meshed images with alpha
|
||||
if ((_numColors != 4) || _isPlanar)
|
||||
|
@ -136,11 +133,12 @@
|
|||
|
||||
bData = [self bitmapData];
|
||||
|
||||
[ctxt DPScurrentgcdrawable: (void**)&gc : (void**)&xDrawable : &x : &y];
|
||||
[ctxt GSCurrentDevice: (void**)&gs_win : NULL : NULL];
|
||||
|
||||
// FIXME: This optimistic computing works only, if there are no
|
||||
// additional bytes at the end of a line.
|
||||
return xgps_cursor_mask (xDisplay, xDrawable, bData, _pixelsWide, _pixelsHigh, _numColors);
|
||||
return xgps_cursor_mask (gs_win->display, GET_XDRAWABLE(gs_win),
|
||||
bData, _pixelsWide, _pixelsHigh, _numColors);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -156,13 +156,6 @@
|
|||
XBell([(XGServer *)server xDisplay], 50);
|
||||
}
|
||||
|
||||
/* Private backend methods */
|
||||
- (void) contextDevice: (int)num
|
||||
{
|
||||
[(XGGState *)gstate setWindow: num];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation XGContext (Ops)
|
||||
|
@ -170,13 +163,11 @@
|
|||
/* ----------------------------------------------------------------------- */
|
||||
/* Window system ops */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentgcdrawable: (void **)gc : (void **)draw
|
||||
: (int *)x : (int *)y
|
||||
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
|
||||
{
|
||||
if (gc)
|
||||
*gc = (void *)[(XGGState *)gstate graphicContext];
|
||||
if (draw)
|
||||
*draw = (void *)[(XGGState *)gstate drawable];
|
||||
void *windevice = [(XGGState *)gstate windevice];
|
||||
if (device)
|
||||
*device = windevice;
|
||||
if (x && y)
|
||||
{
|
||||
NSPoint offset = [gstate offset];
|
||||
|
@ -185,10 +176,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) DPSsetgcdrawable: (void *)gc : (void *)draw : (int)x : (int)y
|
||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
||||
{
|
||||
[(XGGState *)gstate setGraphicContext: (GC)gc];
|
||||
[(XGGState *)gstate setDrawable: (Drawable)draw];
|
||||
[(XGGState *)gstate setWindowDevice: device];
|
||||
[gstate setOffset: NSMakePoint(x, y)];
|
||||
}
|
||||
|
||||
|
|
|
@ -143,19 +143,15 @@ static Region emptyRegion;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) setWindow: (int)number;
|
||||
- (void) setWindowDevice: (void *)device
|
||||
{
|
||||
gswindow_device_t *gs_win;
|
||||
|
||||
window = number;
|
||||
gs_win = (gswindow_device_t *)windevice = device;
|
||||
draw = GET_XDRAWABLE(gs_win);
|
||||
[self setGraphicContext: gs_win->gc];
|
||||
alpha_buffer = 0;
|
||||
drawingAlpha = NO;
|
||||
gs_win = [XGServer _windowWithTag: window];
|
||||
if (gs_win == NULL)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidid, @"Setting invalid window on gstate");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gs_win != NULL && gs_win->alpha_buffer != 0)
|
||||
{
|
||||
|
@ -266,16 +262,6 @@ static Region emptyRegion;
|
|||
return font;
|
||||
}
|
||||
|
||||
- (void) setOffset: (NSPoint)theOffset
|
||||
{
|
||||
offset = theOffset;
|
||||
}
|
||||
|
||||
- (NSPoint) offset
|
||||
{
|
||||
return offset;
|
||||
}
|
||||
|
||||
- (void) copyGraphicContext
|
||||
{
|
||||
GC source;
|
||||
|
@ -339,9 +325,9 @@ static Region emptyRegion;
|
|||
return (draw ? YES : NO);
|
||||
}
|
||||
|
||||
- (int) window
|
||||
- (void *) windevice
|
||||
{
|
||||
return window;
|
||||
return windevice;
|
||||
}
|
||||
|
||||
- (Drawable) drawable
|
||||
|
@ -439,7 +425,7 @@ static Region emptyRegion;
|
|||
if (!source)
|
||||
source = self;
|
||||
|
||||
source_win = [XGServer _windowWithTag: source->window];
|
||||
source_win = (gswindow_device_t *)source->windevice;
|
||||
if (!source_win)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidid, @"Invalid composite source gstate");
|
||||
|
@ -456,7 +442,7 @@ static Region emptyRegion;
|
|||
|
||||
// --- get destination information ----------------------------------------------
|
||||
|
||||
dest_win = [XGServer _windowWithTag: window];
|
||||
dest_win = (gswindow_device_t *)windevice;
|
||||
if (!dest_win)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidid, @"Invalid composite gstate");
|
||||
|
@ -596,7 +582,7 @@ static Region emptyRegion;
|
|||
#define CHECK_ALPHA \
|
||||
do { \
|
||||
gswindow_device_t *source_win; \
|
||||
source_win = [XGServer _windowWithTag: [(XGGState *)source window]]; \
|
||||
source_win = (gswindow_device_t *)[(XGGState *)source windevice]; \
|
||||
source_alpha = (source_win && source_win->alpha_buffer); \
|
||||
} while (0)
|
||||
|
||||
|
@ -1231,7 +1217,7 @@ static Region emptyRegion;
|
|||
{
|
||||
gswindow_device_t *gs_win;
|
||||
color.field[AINDEX] = a;
|
||||
gs_win = [XGServer _windowWithTag: window];
|
||||
gs_win = (gswindow_device_t *)windevice;
|
||||
if (!gs_win)
|
||||
return;
|
||||
if (a < 1.0)
|
||||
|
@ -1757,7 +1743,7 @@ typedef enum {
|
|||
}
|
||||
|
||||
// --- Get our drawable info -----------------------------------------
|
||||
dest_win = [XGServer _windowWithTag: window];
|
||||
dest_win = (gswindow_device_t *)windevice;
|
||||
if (!dest_win)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidid, @"Invalid image gstate");
|
||||
|
|
Loading…
Reference in a new issue