mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-11 03:43:29 +00:00
fix sizehints bug
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@316 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -101,6 +101,10 @@ int main() {
|
|||||||
NULL);
|
NULL);
|
||||||
MwWidget viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5);
|
MwWidget viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5);
|
||||||
|
|
||||||
|
hints.min_width = hints.max_width = 640;
|
||||||
|
hints.min_height = hints.max_height = 480;
|
||||||
|
MwVaApply(window, MwNsizeHints, &hints, NULL);
|
||||||
|
|
||||||
MwVaCreateWidget(MwLabelClass, "label", window, 5, 470 - 16 + 5, 630, 16,
|
MwVaCreateWidget(MwLabelClass, "label", window, 5, 470 - 16 + 5, 630, 16,
|
||||||
MwNtext, "Press left click to draw triangle, right click to undo",
|
MwNtext, "Press left click to draw triangle, right click to undo",
|
||||||
NULL);
|
NULL);
|
||||||
@@ -111,10 +115,6 @@ int main() {
|
|||||||
|
|
||||||
opengl = MwCreateWidget(MwOpenGLClass, "opengl", MwViewportGetViewport(viewport), 0, 0, 1024, 768);
|
opengl = MwCreateWidget(MwOpenGLClass, "opengl", MwViewportGetViewport(viewport), 0, 0, 1024, 768);
|
||||||
|
|
||||||
hints.min_width = hints.max_width = 640;
|
|
||||||
hints.min_height = hints.max_height = 480;
|
|
||||||
MwVaApply(window, MwNsizeHints, &hints, NULL);
|
|
||||||
|
|
||||||
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
|
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
|
||||||
MwAddUserHandler(opengl, MwNmouseDownHandler, mouse, NULL);
|
MwAddUserHandler(opengl, MwNmouseDownHandler, mouse, NULL);
|
||||||
MwAddUserHandler(opengl, MwNmouseMoveHandler, mouse_move, NULL);
|
MwAddUserHandler(opengl, MwNmouseMoveHandler, mouse_move, NULL);
|
||||||
|
|||||||
@@ -573,6 +573,16 @@ void MwLLMakePopup(MwLL handle, MwLL parent) {
|
|||||||
|
|
||||||
void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
||||||
XSizeHints* hints = XAllocSizeHints();
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
int x = 0, y = 0;
|
||||||
|
Window child, root, parent;
|
||||||
|
Window* children;
|
||||||
|
unsigned int nchild;
|
||||||
|
|
||||||
|
XQueryTree(handle->display, handle->window, &root, &parent, &children, &nchild);
|
||||||
|
if(children != NULL) XFree(children);
|
||||||
|
|
||||||
|
XTranslateCoordinates(handle->display, parent, RootWindow(handle->display, DefaultScreen(handle->display)), 0, 0, &x, &y, &child);
|
||||||
|
|
||||||
hints->flags = PMinSize | PMaxSize;
|
hints->flags = PMinSize | PMaxSize;
|
||||||
hints->min_width = minx;
|
hints->min_width = minx;
|
||||||
hints->min_height = miny;
|
hints->min_height = miny;
|
||||||
@@ -580,6 +590,10 @@ void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
|||||||
hints->max_height = maxy;
|
hints->max_height = maxy;
|
||||||
XSetWMSizeHints(handle->display, handle->window, hints, XA_WM_NORMAL_HINTS);
|
XSetWMSizeHints(handle->display, handle->window, hints, XA_WM_NORMAL_HINTS);
|
||||||
XFree(hints);
|
XFree(hints);
|
||||||
|
|
||||||
|
XUnmapWindow(handle->display, handle->window);
|
||||||
|
XMapWindow(handle->display, handle->window);
|
||||||
|
XMoveWindow(handle->display, handle->window, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwLLMakeBorderless(MwLL handle, int toggle) {
|
void MwLLMakeBorderless(MwLL handle, int toggle) {
|
||||||
|
|||||||
@@ -44,12 +44,16 @@ open(OUT, ">", "README.txt");
|
|||||||
l("");
|
l("");
|
||||||
l("Greetings - Welcome to the Milsko GUI Toolkit (Version 1.0)");
|
l("Greetings - Welcome to the Milsko GUI Toolkit (Version 1.0)");
|
||||||
l("");
|
l("");
|
||||||
l(" This document contains a brief summary of the contents of this source distributions and building instructions for Milsko GUI Toolkit.");
|
l(
|
||||||
|
" This document contains a brief summary of the contents of this source distributions and building instructions for Milsko GUI Toolkit."
|
||||||
|
);
|
||||||
|
|
||||||
l("");
|
l("");
|
||||||
c("Requirements");
|
c("Requirements");
|
||||||
l("");
|
l("");
|
||||||
l(" Milsko requires the Windows environment with GDI (so anything NT or 9x) or the Unix-like environment with X11 for runtime.");
|
l(
|
||||||
|
" Milsko requires the Windows environment with GDI (so anything NT or 9x) or the Unix-like environment with X11 for runtime."
|
||||||
|
);
|
||||||
l("");
|
l("");
|
||||||
l(" To build Milsko for Windows, you must have one of following compilers:");
|
l(" To build Milsko for Windows, you must have one of following compilers:");
|
||||||
l(" * Visual C++ 6.0 or newer");
|
l(" * Visual C++ 6.0 or newer");
|
||||||
@@ -85,7 +89,8 @@ l("");
|
|||||||
l("");
|
l("");
|
||||||
c("Building Milsko");
|
c("Building Milsko");
|
||||||
l("");
|
l("");
|
||||||
l(" Building Milsko depends on the platform you use, and the compiler you use.");
|
l(" Building Milsko depends on the platform you use, and the compiler you use."
|
||||||
|
);
|
||||||
h("A. Visual C++");
|
h("A. Visual C++");
|
||||||
l("1) Run `nmake -f NTMakefile'.");
|
l("1) Run `nmake -f NTMakefile'.");
|
||||||
h("B. Borland C++");
|
h("B. Borland C++");
|
||||||
|
|||||||
Reference in New Issue
Block a user