git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@813 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-25 20:21:15 +00:00
parent 8a02b3d31b
commit f2bbadf62b
8 changed files with 41 additions and 3 deletions

View File

@@ -323,6 +323,13 @@ MWDECL MwClass MwGetClass(MwWidget handle);
*/
MWDECL MwWidget* MwGetChildren(MwWidget handle);
/*!
* @brief Gets the cursor coordinate
* @param handle Widget
* @param point Point
*/
MWDECL void MwGetCursorCoord(MwWidget handle, MwPoint* point);
#ifdef __cplusplus
}
#endif

View File

@@ -192,6 +192,8 @@ MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text);
MWDECL char* (*MwLLGetClipboard)(MwLL handle);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
#ifdef __cplusplus
}
#endif

View File

@@ -18,7 +18,7 @@ struct _MwLLGDI {
HWND hWnd;
HDC hDC;
HCURSOR cursor;
HICON icon;
HICON icon;
int grabbed;
};

View File

@@ -52,6 +52,8 @@
\
MwLLSetClipboard = MwLLSetClipboardImpl; \
MwLLGetClipboard = MwLLGetClipboardImpl; \
\
MwLLGetCursorCoord = MwLLGetCursorCoordImpl; \
\
return 0; \
}

View File

@@ -240,7 +240,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->gdi.hWnd = CreateWindow("milsko", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x == MwDEFAULT ? CW_USEDEFAULT : x, y == MwDEFAULT ? CW_USEDEFAULT : y, width, height, parent == NULL ? NULL : parent->gdi.hWnd, 0, wc.hInstance, NULL);
r->gdi.hInstance = wc.hInstance;
r->gdi.cursor = NULL;
r->gdi.icon = NULL;
r->gdi.icon = NULL;
u->ll = r;
u->min_set = 0;
@@ -716,13 +716,23 @@ static void MwLLMakeToolWindowImpl(MwLL handle) {
SetWindowPos(handle->gdi.hWnd, NULL, 0, 0, w, h, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
POINT p;
(void)handle;
GetCursorPos(&p);
point->x = p.x;
point->y = p.y;
}
static void MwLLBeginStateChangeImpl(MwLL handle) {
(void)handle;
}
static void MwLLEndStateChangeImpl(MwLL handle) {
(void)handle;
;
}
static int MwLLGDICallInitImpl(void) {

View File

@@ -990,6 +990,17 @@ static void MwLLMakeToolWindowImpl(MwLL handle) {
XChangeProperty(handle->x11.display, handle->x11.window, wndtype, XA_ATOM, 32, PropModeReplace, (unsigned char*)&wndmenu, 1);
}
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
Window root, child;
int rx, ry, wx, wy;
unsigned int m;
XQueryPointer(handle->x11.display, DefaultRootWindow(handle->x11.display), &root, &child, &rx, &ry, &wx, &wy, &m);
point->x = rx;
point->y = ry;
}
static void MwLLBeginStateChangeImpl(MwLL handle) {
MwLLShow(handle, 0);
}

View File

@@ -705,3 +705,7 @@ MwWidget* MwGetChildren(MwWidget handle) {
return c;
}
void MwGetCursorCoord(MwWidget handle, MwPoint* point) {
MwLLGetCursorCoord(handle->lowlevel, point);
}

View File

@@ -48,6 +48,8 @@ void (*MwLLGrabPointer)(MwLL handle, int toggle);
void (*MwLLSetClipboard)(MwLL handle, const char* text);
char* (*MwLLGetClipboard)(MwLL handle);
void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
void MwLLCreateCommon(MwLL handle) {
handle->common.handler = malloc(sizeof(*handle->common.handler));
memset(handle->common.handler, 0, sizeof(*handle->common.handler));