From 11069552dfb91c1cff48c4c0d39d4900b9c1f2e0 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Mon, 4 May 2026 19:24:09 +0900 Subject: [PATCH] raise --- include/Mw/LowLevel.h | 2 ++ include/Mw/LowLevel/Haiku.h | 8 ++++---- src/backend/call.c | 2 ++ src/backend/classicmacos.c | 4 ++++ src/backend/cocoa.m | 4 ++++ src/backend/gdi.c | 4 ++++ src/backend/haiku.cc | 12 ++++++++---- src/backend/wayland.c | 4 ++++ src/backend/x11.c | 17 ++++++++++++----- src/core.c | 4 ++-- src/lowlevel.c | 2 ++ src/widget/subwindow.c | 2 ++ 12 files changed, 50 insertions(+), 15 deletions(-) diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index dee33a2..494e4cd 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -328,6 +328,8 @@ MWDECL void (*MwLLSetDarkTheme)(MwLL handle, int toggle); */ MWDECL MwBool (*MwLLDoModern)(MwLL handle); +MWDECL void (*MwLLRaise)(MwLL handle); + /* font renderer */ MWDECL void MwFLSetup(void); diff --git a/include/Mw/LowLevel/Haiku.h b/include/Mw/LowLevel/Haiku.h index 3a33b38..504295e 100644 --- a/include/Mw/LowLevel/Haiku.h +++ b/include/Mw/LowLevel/Haiku.h @@ -39,12 +39,12 @@ class MwView : public BView { MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags); ~MwView(); - void MessageReceived(BMessage* message); - void PostMessage(BMessage* message); - void PostMessage(uint32 command); + void MessageReceived(BMessage* message); + void PostMessage(BMessage* message); + void PostMessage(uint32 command); status_t SendMessage(BMessage* message); status_t SendMessage(uint32 command); - void Invalidate(); + void Invalidate(); void AttachedToWindow(); void Draw(BRect updateRect); diff --git a/src/backend/call.c b/src/backend/call.c index 6e6c98f..122e260 100644 --- a/src/backend/call.c +++ b/src/backend/call.c @@ -57,5 +57,7 @@ \ MwLLSetDarkTheme = MwLLSetDarkThemeImpl; \ MwLLDoModern = MwLLDoModernImpl; \ +\ + MwLLRaise = MwLLRaiseImpl; \ return 0; \ } diff --git a/src/backend/classicmacos.c b/src/backend/classicmacos.c index 6023220..4b09cd1 100644 --- a/src/backend/classicmacos.c +++ b/src/backend/classicmacos.c @@ -351,6 +351,10 @@ static MwBool MwLLDoModernImpl(MwLL handle) { return MwFALSE; } +static void MwLLRaiseImpl(MwLL handle) { + (void)handle; +} + static int MwLLClassicMacOSCallInitImpl(void) { InitGraf(&qd.thePort); InitFonts(); diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index 5b2d6da..e1951c9 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -1164,6 +1164,10 @@ static MwBool MwLLDoModernImpl(MwLL handle) { return MwTRUE; } +static void MwLLRaiseImpl(MwLL handle) { + (void)handle; +} + static int MwLLCocoaCallInitImpl(void) { #ifndef __APPLE__ printf("Using GNUStep Backend\n"); diff --git a/src/backend/gdi.c b/src/backend/gdi.c index a0454be..dad0b5a 100644 --- a/src/backend/gdi.c +++ b/src/backend/gdi.c @@ -878,6 +878,10 @@ static MwBool MwLLDoModernImpl(MwLL handle) { return MwTRUE; } +static void MwLLRaiseImpl(MwLL handle) { + (void)handle; +} + static int MwLLGDICallInitImpl(void) { void* ntdll; diff --git a/src/backend/haiku.cc b/src/backend/haiku.cc index e58e160..03c755b 100644 --- a/src/backend/haiku.cc +++ b/src/backend/haiku.cc @@ -181,7 +181,7 @@ void MwView::MessageReceived(BMessage* message) { case BVIEW_MW_GET_MOUSE: { BPoint* p; - uint32 btn; + uint32 btn; if(message->FindPointer("view-ppoint", (void**)&p) != B_OK) break; @@ -217,7 +217,7 @@ void MwView::PostMessage(uint32 command) { status_t MwView::SendMessage(BMessage* message) { BMessage copy = *message; BMessage reply; - MwLL top = this->handle; + MwLL top = this->handle; while(top->haiku.parent != NULL) top = top->haiku.parent; @@ -730,9 +730,9 @@ void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_type) {} void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {} void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) { - MwLL top = handle; + MwLL top = handle; BMessage msg(BVIEW_MW_GET_MOUSE); - BPoint p; + BPoint p; while(top->haiku.parent != NULL) { top = top->haiku.parent; } @@ -765,6 +765,10 @@ MwBool MwLLDoModernImpl(MwLL handle) { return MwTRUE; } +static void MwLLRaiseImpl(MwLL handle) { + (void)handle; +} + int MwLLHaikuCallInitImpl() { return 0; } diff --git a/src/backend/wayland.c b/src/backend/wayland.c index f554623..950e820 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -2830,6 +2830,10 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)toggle; } +static void MwLLRaiseImpl(MwLL handle) { + (void)handle; +} + static int MwLLWaylandCallInitImpl(void) { #ifdef __linux__ MwBool loadWayland = MwFALSE; diff --git a/src/backend/x11.c b/src/backend/x11.c index e9e24bd..29af5d6 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -80,6 +80,7 @@ static struct symtbl { void (*XDestroyIC)(XIC); void (*XSetICFocus)(XIC); XImage* (*XGetImage)(Display*, Drawable, int, int, unsigned int, unsigned int, unsigned long, int); + int (*XRaiseWindow)(Display*, Window); XSizeHints* (*XAllocSizeHints)(void); XVisualInfo* (*XGetVisualInfo)(Display*, long, XVisualInfo*, int*); @@ -182,6 +183,7 @@ static struct symtbl { #define XPending xsymtbl.XPending #define XChangeWindowAttributes xsymtbl.XChangeWindowAttributes #define XGetImage xsymtbl.XGetImage +#define XRaiseWindow xsymtbl.XRaiseWindow #if USE_XRENDER #define XRenderFindStandardFormat xsymtbl.XRenderFindStandardFormat @@ -1370,6 +1372,15 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)toggle; } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwTRUE; +} + +static void MwLLRaiseImpl(MwLL handle) { + XRaiseWindow(handle->x11.display, handle->x11.window); +} + static int MwLLX11CallInitImpl(void) { MwBool loadX11 = MwFALSE; if(getenv("MILSKO_BACKEND")) { @@ -1464,6 +1475,7 @@ static int MwLLX11CallInitImpl(void) { X11_FUNC_LOAD(XDestroyIC); X11_FUNC_LOAD(XSetICFocus); X11_FUNC_LOAD(XGetImage); + X11_FUNC_LOAD(XRaiseWindow); X11_FUNC_LOAD(XAllocSizeHints); X11_FUNC_LOAD(XGetVisualInfo); @@ -1491,10 +1503,5 @@ static int MwLLX11CallInitImpl(void) { return 0; } -static MwBool MwLLDoModernImpl(MwLL handle) { - (void)handle; - return MwTRUE; -} - #include "call.c" CALL(X11); diff --git a/src/core.c b/src/core.c index 5a542b3..d0341e0 100644 --- a/src/core.c +++ b/src/core.c @@ -1049,9 +1049,9 @@ void MwReparent(MwWidget handle, MwWidget new_parent) { MwDispatch(handle->parent, children_update); } - if(new_parent == NULL){ + if(new_parent == NULL) { handle->top_step = 1; - }else{ + } else { handle->top_step = 0; } diff --git a/src/lowlevel.c b/src/lowlevel.c index a0bc459..ea07510 100644 --- a/src/lowlevel.c +++ b/src/lowlevel.c @@ -55,6 +55,8 @@ void (*MwLLSetDarkTheme)(MwLL handle, int toggle) = NULL; MwBool (*MwLLDoModern)(MwLL handle) = NULL; +void (*MwLLRaise)(MwLL handle) = NULL; + void MwLLCreateCommon(MwLL handle) { handle->common.handler = malloc(sizeof(*handle->common.handler)); memset(handle->common.handler, 0, sizeof(*handle->common.handler)); diff --git a/src/widget/subwindow.c b/src/widget/subwindow.c index b3ce527..5cdf55b 100644 --- a/src/widget/subwindow.c +++ b/src/widget/subwindow.c @@ -355,6 +355,8 @@ static void mouse_down(MwWidget handle, void* ptr) { sw->base.x = MwGetInteger(handle, MwNx); sw->base.y = MwGetInteger(handle, MwNy); } + + MwLLRaise(handle->lowlevel); } static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {