mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-05 00:50:53 +00:00
fix
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@416 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -40,6 +40,26 @@ static void destroy_pixmap(MwLL handle) {
|
|||||||
XFreePixmap(handle->display, handle->pixmap);
|
XFreePixmap(handle->display, handle->pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wait_map(MwLL handle){
|
||||||
|
XEvent* queue = NULL;
|
||||||
|
XEvent ev;
|
||||||
|
while(1){
|
||||||
|
XNextEvent(handle->display, &ev);
|
||||||
|
if(ev.type == MapNotify && ev.xmap.window == handle->window){
|
||||||
|
printf("mapped!\n");
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
arrput(queue, ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while(arrlen(queue) > 0){
|
||||||
|
XPutBackEvent(handle->display, &queue[0]);
|
||||||
|
arrdel(queue, 0);
|
||||||
|
}
|
||||||
|
arrfree(queue);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long generate_color(XVisualInfo* xvi, unsigned long r, unsigned long g, unsigned long b) {
|
static unsigned long generate_color(XVisualInfo* xvi, unsigned long r, unsigned long g, unsigned long b) {
|
||||||
int i;
|
int i;
|
||||||
unsigned long n = 1;
|
unsigned long n = 1;
|
||||||
@@ -93,7 +113,6 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
|||||||
r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, DefaultScreen(r->display)));
|
r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, DefaultScreen(r->display)));
|
||||||
|
|
||||||
r->visual = get_visual_info(r->display);
|
r->visual = get_visual_info(r->display);
|
||||||
r->wait_map = 1;
|
|
||||||
|
|
||||||
XSetLocaleModifiers("");
|
XSetLocaleModifiers("");
|
||||||
if((r->xim = XOpenIM(r->display, 0, 0, 0)) == NULL) {
|
if((r->xim = XOpenIM(r->display, 0, 0, 0)) == NULL) {
|
||||||
@@ -130,6 +149,7 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
|||||||
|
|
||||||
XFlush(r->display);
|
XFlush(r->display);
|
||||||
XSync(r->display, False);
|
XSync(r->display, False);
|
||||||
|
wait_map(r);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -235,20 +255,9 @@ int MwLLPending(MwLL handle) {
|
|||||||
|
|
||||||
void MwLLNextEvent(MwLL handle) {
|
void MwLLNextEvent(MwLL handle) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XEvent* queue = NULL;
|
|
||||||
while(XCheckTypedWindowEvent(handle->display, handle->window, ClientMessage, &ev) || XCheckWindowEvent(handle->display, handle->window, mask, &ev)) {
|
while(XCheckTypedWindowEvent(handle->display, handle->window, ClientMessage, &ev) || XCheckWindowEvent(handle->display, handle->window, mask, &ev)) {
|
||||||
int render = 0;
|
int render = 0;
|
||||||
if(ev.type == MapNotify){
|
if(ev.type == Expose) {
|
||||||
handle->wait_map = 0;
|
|
||||||
|
|
||||||
while(arrlen(queue) > 0){
|
|
||||||
XPutBackEvent(handle->display, &queue[0]);
|
|
||||||
arrdel(queue, 0);
|
|
||||||
}
|
|
||||||
arrfree(queue);
|
|
||||||
}else if(handle->wait_map){
|
|
||||||
arrput(queue, ev);
|
|
||||||
}else if(ev.type == Expose) {
|
|
||||||
render = 1;
|
render = 1;
|
||||||
} else if(ev.type == ButtonPress) {
|
} else if(ev.type == ButtonPress) {
|
||||||
MwLLMouse p;
|
MwLLMouse p;
|
||||||
@@ -385,8 +394,6 @@ void MwLLNextEvent(MwLL handle) {
|
|||||||
if(handle->copy_buffer) XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0);
|
if(handle->copy_buffer) XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrfree(queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwLLSleep(int ms) {
|
void MwLLSleep(int ms) {
|
||||||
@@ -684,7 +691,7 @@ void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
|||||||
XFlush(handle->display);
|
XFlush(handle->display);
|
||||||
XSync(handle->display, False);
|
XSync(handle->display, False);
|
||||||
|
|
||||||
handle->wait_map = 1;
|
wait_map(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwLLMakeBorderless(MwLL handle, int toggle) {
|
void MwLLMakeBorderless(MwLL handle, int toggle) {
|
||||||
@@ -701,7 +708,7 @@ void MwLLMakeBorderless(MwLL handle, int toggle) {
|
|||||||
XFlush(handle->display);
|
XFlush(handle->display);
|
||||||
XSync(handle->display, False);
|
XSync(handle->display, False);
|
||||||
|
|
||||||
handle->wait_map = 1;
|
wait_map(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
long MwLLGetTick(void) {
|
long MwLLGetTick(void) {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ struct _MwLL {
|
|||||||
MwLLHandler handler;
|
MwLLHandler handler;
|
||||||
|
|
||||||
int grabbed;
|
int grabbed;
|
||||||
int wait_map;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLColor {
|
struct _MwLLColor {
|
||||||
|
|||||||
Reference in New Issue
Block a user