formatting
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-07-24 20:51:17 -07:00
commit 7c2ab989fa
3 changed files with 39 additions and 38 deletions

View file

@ -274,7 +274,7 @@ struct _MwClass {
MwHandlerChildrenProp children_prop_change; MwHandlerChildrenProp children_prop_change;
MwHandlerClipboardReceived clipboard; MwHandlerClipboardReceived clipboard;
MwHandlerProps props_change; MwHandlerProps props_change;
MwHandler drag_and_drop; MwHandler drag_and_drop;
void* reserved2; void* reserved2;
void* reserved3; void* reserved3;
}; };

View file

@ -77,7 +77,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
switch(msg) { switch(msg) {
case WM_INITDIALOG: case WM_INITDIALOG:
return TRUE; return TRUE;
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
@ -168,25 +168,26 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
MwLLDispatch(u->ll, up, &p); MwLLDispatch(u->ll, up, &p);
break; break;
} }
case WM_DROPFILES: { case WM_DROPFILES:
HDROP hDrop = (HDROP)wp; {
UINT count; HDROP hDrop = (HDROP)wp;
UINT i, n; UINT count;
HRESULT hr; UINT i, n;
HRESULT hr;
count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0); count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
wchar_t wpath[MAX_PATH]; wchar_t wpath[MAX_PATH];
char path[MAX_PATH]; char path[MAX_PATH];
wsymtbl.DragQueryFileW(hDrop, i, wpath, MAX_PATH); wsymtbl.DragQueryFileW(hDrop, i, wpath, MAX_PATH);
memset(path, 0, sizeof(path)); memset(path, 0, sizeof(path));
WideCharToMultiByte(CP_UTF8, 0, wpath, -1, path, sizeof(path) - 1, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, wpath, -1, path, sizeof(path) - 1, NULL, NULL);
MwLLDispatch(u->ll, drag_and_drop, path); MwLLDispatch(u->ll, drag_and_drop, path);
} }
wsymtbl.DragFinish(hDrop); wsymtbl.DragFinish(hDrop);
break; break;
} }
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
@ -612,9 +613,9 @@ static void MwLLNextEventImpl(MwLL handle) {
handle->gdi.get_darktheme = 0; handle->gdi.get_darktheme = 0;
} }
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
if(GetMessage(&msg, NULL, 0, 0)) { if(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
} }
} }

View file

@ -145,8 +145,9 @@ static void llclosehandler(MwLL handle, void* data) {
} }
static void llmovehandler(MwLL handle, void* data) { static void llmovehandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user; MwWidget h = (MwWidget)handle->common.user;
MwPoint* p = data; MwPoint* p = data;
h->mouse_point.x = p->x; h->mouse_point.x = p->x;
h->mouse_point.y = p->y; h->mouse_point.y = p->y;
@ -193,15 +194,13 @@ static void llclipboardhandler(MwLL handle, void* data) {
} }
static void lldraganddrophandler(MwLL handle, void* data) { static void lldraganddrophandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user; MwWidget h = (MwWidget)handle->common.user;
const char * p = data; const char* p = data;
if(MwGetInteger(h, MwNdisabled) == 1) return; if(MwGetInteger(h, MwNdisabled) == 1) return;
printf("%s\n",p);
MwDispatchUserHandler(h, MwNdragAndDropHandler, data); MwDispatchUserHandler(h, MwNdragAndDropHandler, data);
} }
/* if both of them are true /* if both of them are true
* 1. widget class is not NULL * 1. widget class is not NULL
* 2. parent is NULL * 2. parent is NULL
@ -282,20 +281,20 @@ static MwWidget MwCreateWidget_Internal(MwClass widget_class, const char* name,
if(parent == NULL) h->top_step = 1; if(parent == NULL) h->top_step = 1;
if(h->lowlevel != NULL) { if(h->lowlevel != NULL) {
h->lowlevel->common.user = h; h->lowlevel->common.user = h;
h->lowlevel->common.handler->draw = lldrawhandler; h->lowlevel->common.handler->draw = lldrawhandler;
h->lowlevel->common.handler->up = lluphandler; h->lowlevel->common.handler->up = lluphandler;
h->lowlevel->common.handler->down = lldownhandler; h->lowlevel->common.handler->down = lldownhandler;
h->lowlevel->common.handler->resize = llresizehandler; h->lowlevel->common.handler->resize = llresizehandler;
h->lowlevel->common.handler->close = llclosehandler; h->lowlevel->common.handler->close = llclosehandler;
h->lowlevel->common.handler->move = llmovehandler; h->lowlevel->common.handler->move = llmovehandler;
h->lowlevel->common.handler->key = llkeyhandler; h->lowlevel->common.handler->key = llkeyhandler;
h->lowlevel->common.handler->key_released = llkeyrelhandler; h->lowlevel->common.handler->key_released = llkeyrelhandler;
h->lowlevel->common.handler->focus_in = llfocusinhandler; h->lowlevel->common.handler->focus_in = llfocusinhandler;
h->lowlevel->common.handler->focus_out = llfocusouthandler; h->lowlevel->common.handler->focus_out = llfocusouthandler;
h->lowlevel->common.handler->clipboard = llclipboardhandler; h->lowlevel->common.handler->clipboard = llclipboardhandler;
h->lowlevel->common.handler->dark_theme = lldarkthemehandler; h->lowlevel->common.handler->dark_theme = lldarkthemehandler;
h->lowlevel->common.handler->drag_and_drop = lldraganddrophandler; h->lowlevel->common.handler->drag_and_drop = lldraganddrophandler;
} }
if(parent != NULL) arrput(parent->children, h); if(parent != NULL) arrput(parent->children, h);
@ -573,6 +572,7 @@ int MwStep(MwWidget handle) {
MwFreeWidget(handle); MwFreeWidget(handle);
return 1; return 1;
} }
return 0; return 0;
} }