From 8583f45cbff4b0682a214672ce6e15b137f13557 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Tue, 11 Nov 2025 11:35:08 +0000 Subject: [PATCH] fix git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@662 b9cfdab3-6d41-4d17-bbe4-086880011989 --- src/backend/x11.c | 15 ++++++++++----- src/dialog/messagebox.c | 2 +- src/widget/menu.c | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/backend/x11.c b/src/backend/x11.c index 8315b96..eb8bab9 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -798,10 +798,11 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) { } void MwLLDetach(MwLL handle, MwPoint* point) { - int x = 0, y = 0; - Window child, root, parent; - Window* children; - unsigned int nchild; + int x = 0, y = 0; + Window child, root, parent; + Window* children; + unsigned int nchild; + XWindowAttributes xwa; handle->top = 1; @@ -810,9 +811,13 @@ void MwLLDetach(MwLL handle, MwPoint* point) { XTranslateCoordinates(handle->display, parent, RootWindow(handle->display, DefaultScreen(handle->display)), 0, 0, &x, &y, &child); - wait_unmap(handle); + XGetWindowAttributes(handle->display, handle->window, &xwa); + + if(xwa.map_state == IsViewable) wait_unmap(handle); XReparentWindow(handle->display, handle->window, RootWindow(handle->display, DefaultScreen(handle->display)), x + point->x, y + point->y); + + if(xwa.map_state == IsViewable) wait_map(handle, 0, 0); } void MwLLShow(MwLL handle, int show) { diff --git a/src/dialog/messagebox.c b/src/dialog/messagebox.c index af78a6c..ee9a197 100644 --- a/src/dialog/messagebox.c +++ b/src/dialog/messagebox.c @@ -40,7 +40,7 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi p.x = (ww - w) / 2; p.y = (wh - h) / 2; - window = MwVaCreateWidget(MwWindowClass, "messagebox", handle, p.x, p.y, w, h, + window = MwVaCreateWidget(MwWindowClass, "messagebox", handle, 0, 0, w, h, MwNtitle, title, NULL); diff --git a/src/widget/menu.c b/src/widget/menu.c index c2a7bb7..2751bdd 100644 --- a/src/widget/menu.c +++ b/src/widget/menu.c @@ -93,7 +93,7 @@ static void destroy(MwWidget handle) { in_area = (r.x <= handle->mouse_point.x && r.y <= handle->mouse_point.y && handle->mouse_point.x <= (int)(r.x + r.width) && handle->mouse_point.y <= (int)(r.y + r.height)) ? 1 : 0; #define END_MENU_LOOP \ - p.x += tw / 2 + 20; \ + p.x += tw / 2 + 30; \ if(incr) p.x = oldx; \ }