diff --git a/include/Mw/BaseTypes.h b/include/Mw/BaseTypes.h index d547dfd..4e473fb 100644 --- a/include/Mw/BaseTypes.h +++ b/include/Mw/BaseTypes.h @@ -59,8 +59,8 @@ typedef unsigned long MwU64; #ifdef OTHER_TYPES_DEFINED #undef OTHER_TYPES_DEFINED #else -typedef int MwI32; -typedef unsigned int MwU32; +typedef int MwI32; +typedef unsigned int MwU32; typedef short MwI16; typedef unsigned short MwU16; diff --git a/src/backend/call.c b/src/backend/call.c index 3f1f71c..75475c6 100644 --- a/src/backend/call.c +++ b/src/backend/call.c @@ -40,7 +40,7 @@ MwLLSetSizeHints = MwLLSetSizeHintsImpl; \ MwLLMakeBorderless = MwLLMakeBorderlessImpl; \ MwLLMakeToolWindow = MwLLMakeToolWindowImpl; \ - MwLLMakePopup = MwLLMakePopupImpl; \ + MwLLMakePopup = MwLLMakePopupImpl; \ \ MwLLSetBackground = MwLLSetBackgroundImpl; \ \ diff --git a/src/backend/x11.c b/src/backend/x11.c index 313ca4b..cf6f13f 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -73,22 +73,17 @@ static void sync_move(MwLL handle, int x, int y) { MwLLSetXY(handle, x, y); } -static void wait_map(MwLL handle, int move_back, int nomap) { +static void wait_map(MwLL handle) { XEvent* queue = NULL; XEvent ev; - int x, y; - unsigned int w, h; XWindowAttributes xwa; - MwLLGetXYWH(handle, &x, &y, &w, &h); - XGetWindowAttributes(handle->x11.display, handle->x11.window, &xwa); if(xwa.map_state != IsViewable) { - if(move_back) MwLLSetXY(handle, x, y); XSync(handle->x11.display, False); - if(!nomap) XMapWindow(handle->x11.display, handle->x11.window); + XMapWindow(handle->x11.display, handle->x11.window); XSync(handle->x11.display, False); @@ -107,31 +102,6 @@ static void wait_map(MwLL handle, int move_back, int nomap) { } arrfree(queue); } - - if(move_back) MwLLSetXY(handle, x, y); -} - -static void wait_unmap(MwLL handle) { - XEvent* queue = NULL; - XEvent ev; - - XUnmapWindow(handle->x11.display, handle->x11.window); - XSync(handle->x11.display, False); - - while(1) { - XNextEvent(handle->x11.display, &ev); - if(ev.type == UnmapNotify && ev.xunmap.window == handle->x11.window) { - break; - } else { - arrput(queue, ev); - } - } - - while(arrlen(queue) > 0) { - XPutBackEvent(handle->x11.display, &queue[0]); - arrdel(queue, 0); - } - arrfree(queue); } static unsigned long generate_color(MwLL handle, unsigned long r, unsigned long g, unsigned long b) { @@ -245,7 +215,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { XSelectInput(r->x11.display, r->x11.window, mask); - wait_map(r, 0, 0); + wait_map(r); if(x != MwDEFAULT || y != MwDEFAULT) { unsigned int dummy; @@ -882,11 +852,11 @@ static void MwLLDetachImpl(MwLL handle, MwPoint* point) { static void MwLLShowImpl(MwLL handle, int show) { if(show) { - wait_map(handle, 0, 0); + wait_map(handle); XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime); } else { - wait_unmap(handle); + XUnmapWindow(handle->x11.display, handle->x11.window); } } @@ -902,11 +872,8 @@ static void MwLLMakePopupImpl(MwLL handle, MwLL parent) { } static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int maxy) { - XSizeHints* hints = XAllocSizeHints(); - long ret; - XWindowAttributes xwa; - - XGetWindowAttributes(handle->x11.display, handle->x11.window, &xwa); + XSizeHints* hints = XAllocSizeHints(); + long ret; XGetWMSizeHints(handle->x11.display, handle->x11.window, hints, &ret, XA_WM_NORMAL_HINTS); @@ -917,11 +884,6 @@ static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int hints->max_height = maxy; XSetWMSizeHints(handle->x11.display, handle->x11.window, hints, XA_WM_NORMAL_HINTS); XFree(hints); - - if(xwa.map_state == IsViewable) { - wait_unmap(handle); - wait_map(handle, 1, 0); - } } static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) { diff --git a/src/widget/opengl.c b/src/widget/opengl.c index 16fe3da..0912e8b 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -90,8 +90,7 @@ static int create(MwWidget handle) { attribs[3] = 24; attribs[4] = None; - while(glpath[glincr] != NULL && (o->lib = MwDynamicOpen(glpath[glincr++])) == NULL) - ; + while(glpath[glincr] != NULL && (o->lib = MwDynamicOpen(glpath[glincr++])) == NULL); o->glXChooseVisual = (MWglXChooseVisual)MwDynamicSymbol(o->lib, "glXChooseVisual"); o->glXCreateContext = (MWglXCreateContext)MwDynamicSymbol(o->lib, "glXCreateContext"); diff --git a/src/widget/scrollbar.c b/src/widget/scrollbar.c index c332453..9586af0 100644 --- a/src/widget/scrollbar.c +++ b/src/widget/scrollbar.c @@ -130,7 +130,7 @@ static void draw(MwWidget handle) { } static void mouse_move(MwWidget handle) { - int or = MwGetInteger(handle, MwNorientation); + int or = MwGetInteger(handle, MwNorientation); scrollbar_t* scr = handle->internal; if(!handle->pressed) return; @@ -158,9 +158,9 @@ static void mouse_move(MwWidget handle) { } static void mouse_down(MwWidget handle, void* ptr) { - int ww = MwGetInteger(handle, MwNwidth); - int wh = MwGetInteger(handle, MwNheight); - int or = MwGetInteger(handle, MwNorientation); + int ww = MwGetInteger(handle, MwNwidth); + int wh = MwGetInteger(handle, MwNheight); + int or = MwGetInteger(handle, MwNorientation); scrollbar_t* scr = handle->internal; MwLLMouse* m = ptr;