mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-08 02:13: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);
|
||||
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,
|
||||
MwNtext, "Press left click to draw triangle, right click to undo",
|
||||
NULL);
|
||||
@@ -111,10 +115,6 @@ int main() {
|
||||
|
||||
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(opengl, MwNmouseDownHandler, mouse, NULL);
|
||||
MwAddUserHandler(opengl, MwNmouseMoveHandler, mouse_move, NULL);
|
||||
|
||||
@@ -572,7 +572,17 @@ void MwLLMakePopup(MwLL handle, MwLL parent) {
|
||||
}
|
||||
|
||||
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->min_width = minx;
|
||||
hints->min_height = miny;
|
||||
@@ -580,6 +590,10 @@ void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
||||
hints->max_height = maxy;
|
||||
XSetWMSizeHints(handle->display, handle->window, hints, XA_WM_NORMAL_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) {
|
||||
|
||||
@@ -4,39 +4,39 @@
|
||||
our $WIDTH = 80;
|
||||
|
||||
sub l {
|
||||
my $len = 0;
|
||||
my $last = 0;
|
||||
my @msg = split(/ /, $_[0]);
|
||||
foreach my $m (@msg){
|
||||
$len += 1 + length($m);
|
||||
$last = 0;
|
||||
if($len > $WIDTH){
|
||||
print(OUT "\n");
|
||||
$len = 0;
|
||||
$last = 1;
|
||||
}
|
||||
print(OUT "$m ");
|
||||
}
|
||||
if(!$last){
|
||||
print(OUT "\n");
|
||||
}
|
||||
my $len = 0;
|
||||
my $last = 0;
|
||||
my @msg = split(/ /, $_[0]);
|
||||
foreach my $m (@msg) {
|
||||
$len += 1 + length($m);
|
||||
$last = 0;
|
||||
if ($len > $WIDTH) {
|
||||
print(OUT "\n");
|
||||
$len = 0;
|
||||
$last = 1;
|
||||
}
|
||||
print(OUT "$m ");
|
||||
}
|
||||
if (!$last) {
|
||||
print(OUT "\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub c {
|
||||
my ($msg) = @_;
|
||||
my $len = length($msg);
|
||||
if($_[1]){
|
||||
$len = $_[1];
|
||||
}
|
||||
print(OUT (" " x (($WIDTH - $len) / 2)) . "$msg\n");
|
||||
my ($msg) = @_;
|
||||
my $len = length($msg);
|
||||
if ($_[1]) {
|
||||
$len = $_[1];
|
||||
}
|
||||
print(OUT (" " x (($WIDTH - $len) / 2)) . "$msg\n");
|
||||
}
|
||||
|
||||
sub h {
|
||||
my ($msg) = @_;
|
||||
print(OUT "\n");
|
||||
print(OUT "$msg\n");
|
||||
print(OUT ("-" x length($msg)) . "\n");
|
||||
print(OUT "\n");
|
||||
my ($msg) = @_;
|
||||
print(OUT "\n");
|
||||
print(OUT "$msg\n");
|
||||
print(OUT ("-" x length($msg)) . "\n");
|
||||
print(OUT "\n");
|
||||
}
|
||||
|
||||
open(OUT, ">", "README.txt");
|
||||
@@ -44,12 +44,16 @@ open(OUT, ">", "README.txt");
|
||||
l("");
|
||||
l("Greetings - Welcome to the Milsko GUI Toolkit (Version 1.0)");
|
||||
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("");
|
||||
c("Requirements");
|
||||
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(" To build Milsko for Windows, you must have one of following compilers:");
|
||||
l(" * Visual C++ 6.0 or newer");
|
||||
@@ -85,7 +89,8 @@ l("");
|
||||
l("");
|
||||
c("Building Milsko");
|
||||
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++");
|
||||
l("1) Run `nmake -f NTMakefile'.");
|
||||
h("B. Borland C++");
|
||||
@@ -104,10 +109,10 @@ l("");
|
||||
c("This section exists for people who chose D.", 60);
|
||||
l("");
|
||||
c("TARGET - Target environment, chosen by Makefile in", 60);
|
||||
c(" default settings.", 60);
|
||||
c(" default settings.", 60);
|
||||
l("");
|
||||
c("GCC - Prefix for GCC toolchains. This does not", 60);
|
||||
c(" matter if you set CC/CXX manually.", 60);
|
||||
c(" matter if you set CC/CXX manually.", 60);
|
||||
l("");
|
||||
c("CC - C compiler.", 60);
|
||||
l("");
|
||||
|
||||
Reference in New Issue
Block a user