ultra optimization
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@781 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
95c8fb64cb
commit
2ea1e48258
3 changed files with 30 additions and 20 deletions
|
|
@ -325,9 +325,13 @@ static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsign
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
XSizeHints sh;
|
XSizeHints sh;
|
||||||
long r;
|
long r;
|
||||||
XWindowChanges xwc;
|
XWindowChanges xwc;
|
||||||
|
XWindowAttributes xwa;
|
||||||
|
|
||||||
|
XGetWindowAttributes(handle->x11.display, handle->x11.window, &xwa);
|
||||||
|
if(xwa.x == x && xwa.y == y) return;
|
||||||
|
|
||||||
sh.flags = 0;
|
sh.flags = 0;
|
||||||
XGetWMNormalHints(handle->x11.display, handle->x11.window, &sh, &r);
|
XGetWMNormalHints(handle->x11.display, handle->x11.window, &sh, &r);
|
||||||
|
|
@ -349,9 +353,14 @@ static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
||||||
XSizeHints sh;
|
XSizeHints sh;
|
||||||
long r;
|
long r;
|
||||||
XWindowChanges xwc;
|
XWindowChanges xwc;
|
||||||
|
XWindowAttributes xwa;
|
||||||
|
|
||||||
|
XGetWindowAttributes(handle->x11.display, handle->x11.window, &xwa);
|
||||||
|
if(xwa.width == w && xwa.height == h) return;
|
||||||
|
printf("%d %d %d %d\n", xwa.width, xwa.height, w, h);
|
||||||
|
|
||||||
sh.flags = 0;
|
sh.flags = 0;
|
||||||
XGetWMNormalHints(handle->x11.display, handle->x11.window, &sh, &r);
|
XGetWMNormalHints(handle->x11.display, handle->x11.window, &sh, &r);
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
static void set_xywh(MwWidget handle) {
|
static void set_xywh(MwWidget handle) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int diff = MwDefaultBorderWidth(handle);
|
int diff = MwDefaultBorderWidth(handle);
|
||||||
diff = 0;
|
diff = 0;
|
||||||
|
|
||||||
height = MwTextHeight(handle, "M") + 10;
|
height = MwTextHeight(handle, "M") + 10;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ static void resize(MwWidget handle) {
|
||||||
int w = MwGetInteger(handle, MwNwidth);
|
int w = MwGetInteger(handle, MwNwidth);
|
||||||
int h = MwGetInteger(handle, MwNheight);
|
int h = MwGetInteger(handle, MwNheight);
|
||||||
int ih = 0;
|
int ih = 0;
|
||||||
|
int m = 0;
|
||||||
|
|
||||||
if(tv->vscroll == NULL) {
|
if(tv->vscroll == NULL) {
|
||||||
tv->vscroll = MwCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h);
|
tv->vscroll = MwCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h);
|
||||||
|
|
@ -263,8 +264,18 @@ static void resize(MwWidget handle) {
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ih = recursive_length(tv->tree);
|
||||||
|
if(ih == 0) ih = 1;
|
||||||
|
|
||||||
|
if(ih <= (h / (LinePadding + MwTextHeight(handle, "M")))) {
|
||||||
|
MwLLShow(tv->vscroll->lowlevel, 0);
|
||||||
|
m = 16;
|
||||||
|
} else {
|
||||||
|
MwLLShow(tv->vscroll->lowlevel, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if(tv->frame == NULL) {
|
if(tv->frame == NULL) {
|
||||||
tv->frame = MwVaCreateWidget(MwFrameClass, "frame", handle, 0, 0, w - 16, h,
|
tv->frame = MwVaCreateWidget(MwFrameClass, "frame", handle, 0, 0, w - m, h,
|
||||||
MwNhasBorder, 1,
|
MwNhasBorder, 1,
|
||||||
MwNinverted, 1,
|
MwNinverted, 1,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -275,25 +286,15 @@ static void resize(MwWidget handle) {
|
||||||
MwVaApply(tv->frame,
|
MwVaApply(tv->frame,
|
||||||
MwNx, 0,
|
MwNx, 0,
|
||||||
MwNy, 0,
|
MwNy, 0,
|
||||||
MwNwidth, w - 16,
|
MwNwidth, w - m,
|
||||||
MwNheight, h,
|
MwNheight, h,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ih = recursive_length(tv->tree);
|
|
||||||
if(ih == 0) ih = 1;
|
|
||||||
|
|
||||||
MwVaApply(tv->vscroll,
|
MwVaApply(tv->vscroll,
|
||||||
MwNareaShown, h / (LinePadding + MwTextHeight(handle, "M")),
|
MwNareaShown, h / (LinePadding + MwTextHeight(handle, "M")),
|
||||||
MwNmaxValue, ih,
|
MwNmaxValue, ih,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if(ih <= (h / (LinePadding + MwTextHeight(handle, "M")))) {
|
|
||||||
MwLLShow(tv->vscroll->lowlevel, 0);
|
|
||||||
MwSetInteger(tv->frame, MwNwidth, w);
|
|
||||||
} else {
|
|
||||||
MwLLShow(tv->vscroll->lowlevel, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int create(MwWidget handle) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue