summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-07 14:43:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-07 14:43:39 (GMT)
commitf0a49fb50d3f9081a6d15ab8a54ea7cfb81b50d8 (patch)
treec9fe9bd01413b9122cdecf28f7ef3b93af9e89be
parentf58782e964943a3a977716bf65ee3b6cedafde06 (diff)
parentf9626b8791b204e2abc39cfc211befbaa74d7202 (diff)
downloadtk-f0a49fb50d3f9081a6d15ab8a54ea7cfb81b50d8.zip
tk-f0a49fb50d3f9081a6d15ab8a54ea7cfb81b50d8.tar.gz
tk-f0a49fb50d3f9081a6d15ab8a54ea7cfb81b50d8.tar.bz2
Add another few Xlib stubs for Win32. Cherry-picked from [http://www.androwish.org/index.html/info/862eb620a096fddc|AndroWish]. Thanks to Christian Werner.
-rw-r--r--.fossil-settings/crlf-glob6
-rw-r--r--generic/tkInt.decls70
-rw-r--r--generic/tkIntXlibDecls.h121
-rw-r--r--generic/tkStubInit.c26
-rw-r--r--macosx/tkMacOSXDraw.c5
-rw-r--r--tests/event.test2
-rw-r--r--win/tkWinDraw.c89
-rw-r--r--win/tkWinWindow.c41
-rw-r--r--win/tkWinX.c5
-rw-r--r--xlib/xgc.c15
10 files changed, 345 insertions, 35 deletions
diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob
new file mode 100644
index 0000000..7175730
--- /dev/null
+++ b/.fossil-settings/crlf-glob
@@ -0,0 +1,6 @@
+win/buildall.vc.bat
+win/makefile.bc
+win/makefile.vc
+win/mkd.bat
+win/rmd.bat
+win/rules.vc
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 586b407..a13d8d7 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1422,28 +1422,76 @@ declare 106 win {
# New in Tk 8.6
declare 107 win {
- int XFlush(Display *display)
+ int XFlush(Display *display)
}
declare 108 win {
- int XGrabServer(Display *display)
+ int XGrabServer(Display *display)
}
declare 109 win {
- int XUngrabServer(Display *display)
+ int XUngrabServer(Display *display)
}
declare 110 win {
- int XFree(void *data)
+ int XFree(void *data)
}
declare 111 win {
- int XNoOp(Display *display)
+ int XNoOp(Display *display)
}
declare 112 win {
- XAfterFunction XSynchronize(Display *display, Bool onoff)
+ XAfterFunction XSynchronize(Display *display, Bool onoff)
}
declare 113 win {
- int XSync(Display *display, Bool discard)
+ int XSync(Display *display, Bool discard)
}
declare 114 win {
- VisualID XVisualIDFromVisual(Visual *visual)
+ VisualID XVisualIDFromVisual(Visual *visual)
+}
+
+# For tktreectrl
+declare 120 win {
+ int XOffsetRegion(Region rgn, int dx, int dy)
+}
+declare 121 win {
+ int XUnionRegion(Region srca, Region srcb, Region dr_return)
+}
+
+# For 3dcanvas
+declare 122 win {
+ Window XCreateWindow(Display *display, Window parent, int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned int border_width, int depth, unsigned int clazz,
+ Visual *visual, unsigned long value_mask,
+ XSetWindowAttributes *attributes)
+}
+
+# Various, e.g. for stub-enabled BLT
+declare 129 win {
+ int XLowerWindow(Display *d, Window w)
+}
+declare 130 win {
+ int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 131 win {
+ int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 132 win {
+ int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n)
+}
+declare 133 win {
+ int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n)
+}
+declare 134 win {
+ int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y)
+}
+declare 135 win {
+ int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m)
+}
+declare 136 win {
+ int XReparentWindow(Display *d, Window w, Window p, int x, int y)
+}
+declare 137 win {
+ int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
+ int sx, int sy, int dx, int dy,
+ unsigned int w, unsigned int h)
}
################################
@@ -1725,7 +1773,7 @@ declare 79 aqua {
XTextProperty *text_prop_return)
}
declare 80 aqua {
- void XDrawSegments(Display *display, Drawable d, GC gc,
+ int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments)
}
declare 81 aqua {
@@ -1743,10 +1791,10 @@ declare 84 aqua {
void XClearWindow(Display *d, Window w)
}
declare 85 aqua {
- void XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
+ int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
}
declare 86 aqua {
- void XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
+ int XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
int npoints, int mode)
}
declare 87 aqua {
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 6ac7ccb..8e7d650 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -356,6 +356,57 @@ EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff);
EXTERN int XSync(Display *display, Bool discard);
/* 114 */
EXTERN VisualID XVisualIDFromVisual(Visual *visual);
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+/* 120 */
+EXTERN int XOffsetRegion(Region rgn, int dx, int dy);
+/* 121 */
+EXTERN int XUnionRegion(Region srca, Region srcb,
+ Region dr_return);
+/* 122 */
+EXTERN Window XCreateWindow(Display *display, Window parent, int x,
+ int y, unsigned int width,
+ unsigned int height,
+ unsigned int border_width, int depth,
+ unsigned int clazz, Visual *visual,
+ unsigned long value_mask,
+ XSetWindowAttributes *attributes);
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+/* 129 */
+EXTERN int XLowerWindow(Display *d, Window w);
+/* 130 */
+EXTERN int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 131 */
+EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 132 */
+EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc,
+ XRectangle *r, int n);
+/* 133 */
+EXTERN int XDrawSegments(Display *d, Drawable dr, GC gc,
+ XSegment *s, int n);
+/* 134 */
+EXTERN int XDrawPoint(Display *d, Drawable dr, GC gc, int x,
+ int y);
+/* 135 */
+EXTERN int XDrawPoints(Display *d, Drawable dr, GC gc,
+ XPoint *p, int n, int m);
+/* 136 */
+EXTERN int XReparentWindow(Display *d, Window w, Window p,
+ int x, int y);
+/* 137 */
+EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
+ int sx, int sy, int dx, int dy,
+ unsigned int w, unsigned int h);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
@@ -584,7 +635,7 @@ EXTERN void XSetWMClientMachine(Display *display, Window w,
EXTERN Status XStringListToTextProperty(char **list, int count,
XTextProperty *text_prop_return);
/* 80 */
-EXTERN void XDrawSegments(Display *display, Drawable d, GC gc,
+EXTERN int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments);
/* 81 */
EXTERN void XForceScreenSaver(Display *display, int mode);
@@ -598,10 +649,10 @@ EXTERN int XFillRectangle(Display *display, Drawable d, GC gc,
/* 84 */
EXTERN void XClearWindow(Display *d, Window w);
/* 85 */
-EXTERN void XDrawPoint(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoint(Display *display, Drawable d, GC gc,
int x, int y);
/* 86 */
-EXTERN void XDrawPoints(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoints(Display *display, Drawable d, GC gc,
XPoint *points, int npoints, int mode);
/* 87 */
EXTERN int XWarpPointer(Display *display, Window src_w,
@@ -742,6 +793,29 @@ typedef struct TkIntXlibStubs {
XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */
int (*xSync) (Display *display, Bool discard); /* 113 */
VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */
+ void (*reserved115)(void);
+ void (*reserved116)(void);
+ void (*reserved117)(void);
+ void (*reserved118)(void);
+ void (*reserved119)(void);
+ int (*xOffsetRegion) (Region rgn, int dx, int dy); /* 120 */
+ int (*xUnionRegion) (Region srca, Region srcb, Region dr_return); /* 121 */
+ Window (*xCreateWindow) (Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clazz, Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes); /* 122 */
+ void (*reserved123)(void);
+ void (*reserved124)(void);
+ void (*reserved125)(void);
+ void (*reserved126)(void);
+ void (*reserved127)(void);
+ void (*reserved128)(void);
+ int (*xLowerWindow) (Display *d, Window w); /* 129 */
+ int (*xFillArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 130 */
+ int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */
+ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */
+ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */
+ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */
+ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */
+ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */
+ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -824,13 +898,13 @@ typedef struct TkIntXlibStubs {
XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */
void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */
Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */
- void (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
+ int (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
void (*xForceScreenSaver) (Display *display, int mode); /* 81 */
int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */
int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */
void (*xClearWindow) (Display *d, Window w); /* 84 */
- void (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
- void (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
+ int (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
+ int (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
int (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */
void (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */
void (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */
@@ -1081,6 +1155,41 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xSync) /* 113 */
#define XVisualIDFromVisual \
(tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+#define XOffsetRegion \
+ (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */
+#define XUnionRegion \
+ (tkIntXlibStubsPtr->xUnionRegion) /* 121 */
+#define XCreateWindow \
+ (tkIntXlibStubsPtr->xCreateWindow) /* 122 */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+#define XLowerWindow \
+ (tkIntXlibStubsPtr->xLowerWindow) /* 129 */
+#define XFillArcs \
+ (tkIntXlibStubsPtr->xFillArcs) /* 130 */
+#define XDrawArcs \
+ (tkIntXlibStubsPtr->xDrawArcs) /* 131 */
+#define XDrawRectangles \
+ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */
+#define XDrawSegments \
+ (tkIntXlibStubsPtr->xDrawSegments) /* 133 */
+#define XDrawPoint \
+ (tkIntXlibStubsPtr->xDrawPoint) /* 134 */
+#define XDrawPoints \
+ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */
+#define XReparentWindow \
+ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */
+#define XPutImage \
+ (tkIntXlibStubsPtr->xPutImage) /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#define XSetDashes \
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 21e6a68..ffe7b75 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -71,6 +71,9 @@ TkCreateXEventSource(void)
# define TkUnixContainerId 0
# define TkUnixDoOneXEvent 0
# define TkUnixSetMenubar 0
+# define XCreateWindow 0
+# define XOffsetRegion 0
+# define XUnionRegion 0
# define TkWmCleanup (void (*)(TkDisplay *)) TkpSync
# define TkSendCleanup (void (*)(TkDisplay *)) TkpSync
# define TkpTestsendCmd 0
@@ -707,6 +710,29 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XSynchronize, /* 112 */
XSync, /* 113 */
XVisualIDFromVisual, /* 114 */
+ 0, /* 115 */
+ 0, /* 116 */
+ 0, /* 117 */
+ 0, /* 118 */
+ 0, /* 119 */
+ XOffsetRegion, /* 120 */
+ XUnionRegion, /* 121 */
+ XCreateWindow, /* 122 */
+ 0, /* 123 */
+ 0, /* 124 */
+ 0, /* 125 */
+ 0, /* 126 */
+ 0, /* 127 */
+ 0, /* 128 */
+ XLowerWindow, /* 129 */
+ XFillArcs, /* 130 */
+ XDrawArcs, /* 131 */
+ XDrawRectangles, /* 132 */
+ XDrawSegments, /* 133 */
+ XDrawPoint, /* 134 */
+ XDrawPoints, /* 135 */
+ XReparentWindow, /* 136 */
+ XPutImage, /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index f48538d..f85d6ac 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -880,7 +880,7 @@ XDrawLines(
*----------------------------------------------------------------------
*/
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -894,7 +894,7 @@ XDrawSegments(
display->request++;
if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
- return;
+ return BadDrawable;
}
if (dc.context) {
double o = (lw % 2) ? .5 : 0;
@@ -911,6 +911,7 @@ XDrawSegments(
}
}
TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
}
/*
diff --git a/tests/event.test b/tests/event.test
index 3e40862..0ac640d 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -823,7 +823,7 @@ test event-7.2(double-click) {A double click on a lone character
} -result {4 A 4 A}
test event-8 {event generate with keysyms corresponding to
- multi-byte virtual keycodes - bug
+ multi-byte virtual keycodes - bug
e36963bfe8df9f5e528134707a91b9c0051de723} -setup {
deleteWindows
set res [list ]
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index ba4176c..bb903db 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -486,7 +486,7 @@ XCopyPlane(
/*
*----------------------------------------------------------------------
*
- * TkPutImage --
+ * TkPutImage, XPutImage --
*
* Copies a subimage from an in-memory image to a rectangle of of the
* specified drawable.
@@ -599,6 +599,21 @@ TkPutImage(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XPutImage(
+ Display *display,
+ Drawable d, /* Destination drawable. */
+ GC gc,
+ XImage *image, /* Source image. */
+ int src_x, int src_y, /* Offset of subimage. */
+ int dest_x, int dest_y, /* Position of subimage origin in drawable. */
+ unsigned int width, unsigned int height)
+ /* Dimensions of subimage. */
+{
+ return TkPutImage(NULL, 0, display, d, gc, image,
+ src_x, src_y, dest_x, dest_y, width, height);
+}
/*
*----------------------------------------------------------------------
@@ -940,7 +955,7 @@ XFillPolygon(
/*
*----------------------------------------------------------------------
*
- * XDrawRectangle --
+ * XDrawRectangle, XDrawRectangles --
*
* Draws a rectangle.
*
@@ -985,11 +1000,31 @@ XDrawRectangle(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XDrawRectangles(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XRectangle rects[],
+ int nrects)
+{
+ int n, ret;
+
+ for (n = 0; n < nrects; n++) {
+ ret = XDrawRectangle(display, d, gc, rects[n].x, rects[n].y,
+ rects[n].width, rects[n].height);
+ if (ret != Success) {
+ break;
+ }
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XDrawArc --
+ * XDrawArc, XDrawArcs --
*
* Draw an arc.
*
@@ -1015,11 +1050,34 @@ XDrawArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 0);
}
+
+int
+XDrawArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int n, ret;
+
+ display->request++;
+
+ for (n = 0; n < narcs; n++) {
+ ret = DrawOrFillArc(display, d, gc, arcs[n].x, arcs[n].y,
+ arcs[n].width, arcs[n].height,
+ arcs[n].angle1, arcs[n].angle2, 0);
+ if (ret != Success) {
+ break;
+ }
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XFillArc --
+ * XFillArc, XFillArcs --
*
* Draw a filled arc.
*
@@ -1045,6 +1103,29 @@ XFillArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 1);
}
+
+int
+XFillArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int n, ret;
+
+ display->request++;
+
+ for (n = 0; n < narcs; n++) {
+ ret = DrawOrFillArc(display, d, gc, arcs[n].x, arcs[n].y,
+ arcs[n].width, arcs[n].height,
+ arcs[n].angle1, arcs[n].angle2, 1);
+ if (ret != Success) {
+ break;
+ }
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index ade15bc..385e72b 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -590,7 +590,7 @@ XResizeWindow(
/*
*----------------------------------------------------------------------
*
- * XRaiseWindow --
+ * XRaiseWindow, XLowerWindow --
*
* Change the stacking order of a window.
*
@@ -614,6 +614,18 @@ XRaiseWindow(
SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return Success;
}
+
+int
+XLowerWindow(
+ Display *display,
+ Window w)
+{
+ HWND window = Tk_GetHWND(w);
+
+ display->request++;
+ SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ return Success;
+}
/*
*----------------------------------------------------------------------
@@ -753,6 +765,33 @@ XChangeWindowAttributes(
/*
*----------------------------------------------------------------------
*
+ * XReparentWindow --
+ *
+ * TODO: currently placeholder to satisfy Xlib stubs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * TODO.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+XReparentWindow(
+ Display *display,
+ Window w,
+ Window parent,
+ int x,
+ int y)
+{
+ return BadWindow;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkWinSetWindowPos --
*
* Adjust the stacking order of a window relative to a second window (or
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 2dc3b63..cfd64af 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -125,16 +125,13 @@ TkGetServerInfo(
OSVERSIONINFOW os;
if (!buffer[0]) {
- HANDLE handle = LoadLibraryW(L"NTDLL");
+ HANDLE handle = GetModuleHandle(TEXT("NTDLL"));
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!getversion || getversion(&os)) {
GetVersionExW(&os);
}
- if (handle) {
- FreeLibrary(handle);
- }
/* Write the first character last, preventing multi-thread issues. */
sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion,
(int)os.dwMinorVersion, (int)os.dwBuildNumber,
diff --git a/xlib/xgc.c b/xlib/xgc.c
index e097d2e..1e720fb 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -520,7 +520,7 @@ XDrawImageString(
}
#endif
-void
+int
XDrawPoint(
Display *display,
Drawable d,
@@ -528,10 +528,10 @@ XDrawPoint(
int x,
int y)
{
- XDrawLine(display, d, gc, x, y, x, y);
+ return XDrawLine(display, d, gc, x, y, x, y);
}
-void
+int
XDrawPoints(
Display *display,
Drawable d,
@@ -541,15 +541,17 @@ XDrawPoints(
int mode)
{
int i;
+ int result = Success;
- for (i=0; i<npoints; i++) {
- XDrawLine(display, d, gc,
+ for (i=0; (i<npoints) && (result == Success); i++) {
+ result = XDrawLine(display, d, gc,
points[i].x, points[i].y, points[i].x, points[i].y);
}
+ return result;
}
#if !defined(MAC_OSX_TK)
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -557,6 +559,7 @@ XDrawSegments(
XSegment *segments,
int nsegments)
{
+ return Success;
}
#endif