summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-07 14:15:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-07 14:15:04 (GMT)
commit979a44d072c838f5e5a33e5520691b2de1d9f260 (patch)
tree642e999aa3f8c172ac8b66ad3d0d43b485bda9bb /win
parentea566f2ac0714ef7f7a6e3207a62b30cb3099ca4 (diff)
downloadtk-979a44d072c838f5e5a33e5520691b2de1d9f260.zip
tk-979a44d072c838f5e5a33e5520691b2de1d9f260.tar.gz
tk-979a44d072c838f5e5a33e5520691b2de1d9f260.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.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDraw.c89
-rw-r--r--win/tkWinWindow.c41
-rw-r--r--win/tkWinX.c5
3 files changed, 126 insertions, 9 deletions
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 b2424ce..098fc6d 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,