mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
Compare commits
2 Commits
b9796e99d5
...
6f331d613d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f331d613d | ||
|
|
b239dd3819 |
@@ -38,6 +38,7 @@ struct _MwLLGDIPixmap {
|
|||||||
HBITMAP hMask2;
|
HBITMAP hMask2;
|
||||||
};
|
};
|
||||||
|
|
||||||
MWDECL int MwLLGDICallInit(void);
|
MWDECL int MwLLGDICallInit(void);
|
||||||
|
MWDECL HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct _MwLLX11Pixmap {
|
|||||||
XImage* mask;
|
XImage* mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
MWDECL int MwLLX11CallInit(void);
|
MWDECL int MwLLX11CallInit(void);
|
||||||
|
MWDECL Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ static void MwLLForceRenderImpl(MwLL handle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask) {
|
||||||
HCURSOR cursor;
|
HCURSOR cursor;
|
||||||
BYTE* dmask = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
|
BYTE* dmask = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
|
||||||
BYTE* dimage = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
|
BYTE* dimage = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
|
||||||
@@ -561,12 +561,18 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
|||||||
|
|
||||||
cursor = CreateCursor(GetModuleHandle(NULL), xs, ys, MwCursorDataHeight, MwCursorDataHeight, dmask, dimage);
|
cursor = CreateCursor(GetModuleHandle(NULL), xs, ys, MwCursorDataHeight, MwCursorDataHeight, dmask, dimage);
|
||||||
|
|
||||||
|
free(dimage);
|
||||||
|
free(dmask);
|
||||||
|
|
||||||
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
|
HCURSOR cursor = MwLLGDICreateCursor(image, mask);
|
||||||
|
|
||||||
if(handle->gdi.cursor != NULL) DestroyCursor(handle->gdi.cursor);
|
if(handle->gdi.cursor != NULL) DestroyCursor(handle->gdi.cursor);
|
||||||
if(handle->gdi.icon != NULL) DestroyIcon(handle->gdi.icon);
|
if(handle->gdi.icon != NULL) DestroyIcon(handle->gdi.icon);
|
||||||
handle->gdi.cursor = cursor;
|
handle->gdi.cursor = cursor;
|
||||||
|
|
||||||
free(dimage);
|
|
||||||
free(dmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
||||||
|
|||||||
@@ -784,17 +784,17 @@ static void MwLLForceRenderImpl(MwLL handle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask) {
|
||||||
Cursor cur;
|
Cursor cur;
|
||||||
int y, x, ys, xs;
|
int y, x, ys, xs;
|
||||||
char* di = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
char* di = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
||||||
char* dm = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
char* dm = malloc(MwCursorDataHeight * MwCursorDataHeight * 4);
|
||||||
XImage* cimage = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, di, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
XImage* cimage = XCreateImage(display, DefaultVisual(display, DefaultScreen(display)), 1, ZPixmap, 0, di, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
||||||
XImage* cmask = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, dm, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
XImage* cmask = XCreateImage(display, DefaultVisual(display, DefaultScreen(display)), 1, ZPixmap, 0, dm, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
|
||||||
Pixmap pimage = XCreatePixmap(handle->x11.display, handle->x11.window, MwCursorDataHeight, MwCursorDataHeight, 1);
|
Pixmap pimage = XCreatePixmap(display, DefaultRootWindow(display), MwCursorDataHeight, MwCursorDataHeight, 1);
|
||||||
Pixmap pmask = XCreatePixmap(handle->x11.display, handle->x11.window, MwCursorDataHeight, MwCursorDataHeight, 1);
|
Pixmap pmask = XCreatePixmap(display, DefaultRootWindow(display), MwCursorDataHeight, MwCursorDataHeight, 1);
|
||||||
GC imagegc = XCreateGC(handle->x11.display, pimage, 0, NULL);
|
GC imagegc = XCreateGC(display, pimage, 0, NULL);
|
||||||
GC maskgc = XCreateGC(handle->x11.display, pmask, 0, NULL);
|
GC maskgc = XCreateGC(display, pmask, 0, NULL);
|
||||||
XColor cfg, cbg;
|
XColor cfg, cbg;
|
||||||
|
|
||||||
xs = -mask->x + image->x;
|
xs = -mask->x + image->x;
|
||||||
@@ -826,25 +826,32 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
|||||||
cfg.red = 65535;
|
cfg.red = 65535;
|
||||||
cfg.green = 65535;
|
cfg.green = 65535;
|
||||||
cfg.blue = 65535;
|
cfg.blue = 65535;
|
||||||
XAllocColor(handle->x11.display, handle->x11.colormap, &cfg);
|
XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &cfg);
|
||||||
|
|
||||||
cbg.red = 0;
|
cbg.red = 0;
|
||||||
cbg.green = 0;
|
cbg.green = 0;
|
||||||
cbg.blue = 0;
|
cbg.blue = 0;
|
||||||
XAllocColor(handle->x11.display, handle->x11.colormap, &cbg);
|
XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &cbg);
|
||||||
|
|
||||||
XPutImage(handle->x11.display, pimage, imagegc, cimage, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
XPutImage(display, pimage, imagegc, cimage, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
||||||
XPutImage(handle->x11.display, pmask, maskgc, cmask, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
XPutImage(display, pmask, maskgc, cmask, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
|
||||||
|
|
||||||
cur = XCreatePixmapCursor(handle->x11.display, pimage, pmask, &cfg, &cbg, xs, ys);
|
cur = XCreatePixmapCursor(display, pimage, pmask, &cfg, &cbg, xs, ys);
|
||||||
XDefineCursor(handle->x11.display, handle->x11.window, cur);
|
|
||||||
XFreeCursor(handle->x11.display, cur);
|
|
||||||
|
|
||||||
XFreePixmap(handle->x11.display, pimage);
|
XFreePixmap(display, pimage);
|
||||||
XFreePixmap(handle->x11.display, pmask);
|
XFreePixmap(display, pmask);
|
||||||
|
|
||||||
XDestroyImage(cimage);
|
XDestroyImage(cimage);
|
||||||
XDestroyImage(cmask);
|
XDestroyImage(cmask);
|
||||||
|
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
|
Cursor cur = MwLLX11CreateCursor(handle->x11.display, image, mask);
|
||||||
|
|
||||||
|
XDefineCursor(handle->x11.display, handle->x11.window, cur);
|
||||||
|
XFreeCursor(handle->x11.display, cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
||||||
|
|||||||
Reference in New Issue
Block a user