reduce cpu usage

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@590 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-04 02:43:38 +00:00
parent 1e7b838d7b
commit 3e7d53b958
35 changed files with 15449 additions and 15459 deletions

View File

@@ -87,7 +87,6 @@ MWDECL unsigned int MwIconUp[];
*/
MWDECL unsigned int MwIconWarning[];
#ifdef __cplusplus
}
#endif

View File

@@ -166,7 +166,7 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
}
h->prop_event = 1;
if(h->widget_class != NULL && h->widget_class->tick != NULL){
if(h->widget_class != NULL && h->widget_class->tick != NULL) {
MwAddTickList(h);
}
@@ -295,6 +295,7 @@ int MwPending(MwWidget handle) {
void MwLoop(MwWidget handle) {
long tick = MwLLGetTick();
int i;
int skipsleep = 0;
long wait = MwGetInteger(handle, MwNwaitMS);
if(wait == MwDEFAULT) wait = MwWaitMS;
while(!handle->close) {
@@ -311,11 +312,16 @@ void MwLoop(MwWidget handle) {
}
t = (tick + wait) - (t2 = MwLLGetTick());
if(t > 0) {
if(t > 0 && skipsleep == 0) {
MwLLSleep(t);
tick += wait;
} else {
tick = t2;
if(skipsleep) {
skipsleep--;
} else {
skipsleep = 10;
}
}
}
}

3
src/icon/back.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconBack[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/computer.c generated
View File

@@ -259,5 +259,4 @@ unsigned int MwIconComputer[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

3
src/icon/directory.c generated
View File

@@ -259,5 +259,4 @@ unsigned int MwIconDirectory[] = {
0x2B251DFF,
0xC0C0C000,
0xC0C0C000,
0
};
0};

3
src/icon/down.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconDown[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/error.c generated
View File

@@ -2307,5 +2307,4 @@ unsigned int MwIconError[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

3
src/icon/file.c generated
View File

@@ -259,5 +259,4 @@ unsigned int MwIconFile[] = {
0xC0C0C000,
0xC0C0C000,
0xC0C0C000,
0
};
0};

3
src/icon/forward.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconForward[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/info.c generated
View File

@@ -2307,5 +2307,4 @@ unsigned int MwIconInfo[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

3
src/icon/left.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconLeft[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/news.c generated
View File

@@ -2307,5 +2307,4 @@ unsigned int MwIconNews[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

3
src/icon/note.c generated
View File

@@ -2307,5 +2307,4 @@ unsigned int MwIconNote[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

3
src/icon/right.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconRight[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/search.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconSearch[] = {
0x000000FF,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/up.c generated
View File

@@ -443,5 +443,4 @@ unsigned int MwIconUp[] = {
0xCCFFFF00,
0xCCFFFF00,
0xCCFFFF00,
0
};
0};

3
src/icon/warning.c generated
View File

@@ -2307,5 +2307,4 @@ unsigned int MwIconWarning[] = {
0x00000000,
0x00000000,
0x00000000,
0
};
0};

View File

@@ -506,10 +506,10 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
}
}
static void tick(MwWidget handle){
static void tick(MwWidget handle) {
MwListBox lb = handle->internal;
if(lb->changed){
if(lb->changed) {
lb->changed = 0;
MwForceRender(lb->frame);
}

View File

@@ -141,10 +141,10 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
}
}
static void tick(MwWidget handle){
static void tick(MwWidget handle) {
MwViewport vp = handle->internal;
if(vp->vchanged){
if(vp->vchanged) {
vp->vchanged = 0;
int v = MwGetInteger(vp->vscroll, MwNvalue);
@@ -157,7 +157,7 @@ static void tick(MwWidget handle){
MwNy, -v,
NULL);
}
if(vp->hchanged){
if(vp->hchanged) {
vp->vchanged = 0;
int v = MwGetInteger(vp->hscroll, MwNvalue);