gdi backend has bugs

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@351 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
Nishi 2025-10-16 07:38:43 +00:00
commit 9b17545880
3 changed files with 19 additions and 7 deletions

View file

@ -337,8 +337,12 @@ MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int hei
BITMAPINFOHEADER bmih; BITMAPINFOHEADER bmih;
RGBQUAD* quad; RGBQUAD* quad;
int y, x; int y, x;
int w = (width + (16 - (width % 16))) / 8; int w = (width + (16 - (width % 16))) / 8;
WORD* words = malloc(w * height); WORD* words;
if(16 * (width / 16) == width) w -= 2;
words = malloc(w * height);
r->width = width; r->width = width;
r->height = height; r->height = height;
@ -478,18 +482,22 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
} }
void MwLLDetach(MwLL handle, MwPoint* point) { void MwLLDetach(MwLL handle, MwPoint* point) {
RECT rc, rc2; RECT rc, rc2;
LPARAM lp = GetWindowLongPtr(handle->hWnd, GWL_STYLE);
lp &= WS_VISIBLE;
GetWindowRect(GetParent(handle->hWnd), &rc); GetWindowRect(GetParent(handle->hWnd), &rc);
GetClientRect(handle->hWnd, &rc2); GetClientRect(handle->hWnd, &rc2);
SetWindowLongPtr(handle->hWnd, GWL_STYLE, (LPARAM)WS_OVERLAPPEDWINDOW); SetWindowLongPtr(handle->hWnd, GWL_STYLE, (LPARAM)WS_OVERLAPPEDWINDOW | lp);
SetParent(handle->hWnd, NULL); SetParent(handle->hWnd, NULL);
rc.left += point->x; rc.left += point->x;
rc.top += point->y; rc.top += point->y;
AdjustWindowRect(&rc2, WS_OVERLAPPEDWINDOW, FALSE); AdjustWindowRect(&rc2, WS_OVERLAPPEDWINDOW | lp, FALSE);
rc2.right -= rc2.left; rc2.right -= rc2.left;
rc2.bottom -= rc2.top; rc2.bottom -= rc2.top;

View file

@ -373,7 +373,7 @@ MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int hei
r->use_render = XRenderQueryExtension(handle->display, &evbase, &erbase) ? 1 : 0; r->use_render = XRenderQueryExtension(handle->display, &evbase, &erbase) ? 1 : 0;
r->image = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, di, width, height, 32, width * 4); r->image = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, di, width, height, 32, width * 4);
r->mask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, dm, width, height, 32, width * 4); r->mask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), 1, ZPixmap, 0, dm, width, height, 32, width * 4);
for(y = 0; y < height; y++) { for(y = 0; y < height; y++) {
for(x = 0; x < width; x++) { for(x = 0; x < width; x++) {

View file

@ -9,15 +9,19 @@ static int create(MwWidget handle) {
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect r; MwRect r;
MwLLPixmap px = MwGetVoid(handle, MwNpixmap); MwLLPixmap px = MwGetVoid(handle, MwNpixmap);
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
r.width = MwGetInteger(handle, MwNwidth); r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawRect(handle, &r, base);
if(px != NULL) { if(px != NULL) {
MwLLDrawPixmap(handle->lowlevel, &r, px); MwLLDrawPixmap(handle->lowlevel, &r, px);
} }
MwLLFreeColor(base);
} }
static void prop_change(MwWidget handle, const char* key) { static void prop_change(MwWidget handle, const char* key) {