basic stuff

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@11 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-28 08:37:12 +00:00
parent b12c08d2d3
commit 31e9818e42
9 changed files with 66 additions and 25 deletions

View File

@@ -8,10 +8,10 @@ HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsi
h->parent = parent;
h->children = NULL;
h->lowlevel = MilskoLLCreate(parent->lowlevel, x, y, width, height);
h->lowlevel = MilskoLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
h->class = class;
arrput(parent->children, h);
if(parent != NULL) arrput(parent->children, h);
return h;
}
@@ -40,3 +40,22 @@ void MilskoDestroyWidget(HMILSKO handle) {
MilskoLLDestroy(handle->lowlevel);
free(handle);
}
MILSKODECL void MilskoStep(HMILSKO handle){
MilskoLLNextEvent(handle->lowlevel);
}
MILSKODECL int MilskoPending(HMILSKO handle){
int i;
for(i = 0; i < arrlen(handle->children); i++){
if(MilskoPending(handle->children[i])) return 1;
}
return MilskoLLPending(handle->lowlevel);
}
MILSKODECL void MilskoLoop(HMILSKO handle){
while(1){
MilskoStep(handle);
MilskoLLSleep(10);
}
}

6
src/window.c Normal file
View File

@@ -0,0 +1,6 @@
/* $Id$ */
#include <Milsko/Milsko.h>
MilskoClassRec MilskoWindowClassRec = {
};
MilskoClass MilskoWindowClass = &MilskoWindowClassRec;

View File

@@ -88,3 +88,7 @@ void MilskoLLNextEvent(HMILSKOLL handle) {
if(XCheckWindowEvent(handle->display, handle->window, mask, &ev)) {
}
}
void MilskoLLSleep(int ms){
usleep(ms * 1000);
}