backend refactor

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@683 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-13 02:27:31 +00:00
parent 7e7e9f776d
commit 295e685f54
14 changed files with 495 additions and 458 deletions

View File

@@ -28,15 +28,15 @@ static void draw(MwWidget handle) {
int ow = r.width;
int oh = r.height;
double sw = (double)ow / px->width;
double sh = (double)oh / px->height;
double sw = (double)ow / px->common.width;
double sh = (double)oh / px->common.height;
if(sw < sh) {
r.width = px->width * sw;
r.height = px->height * sw;
r.width = px->common.width * sw;
r.height = px->common.height * sw;
} else {
r.width = px->width * sh;
r.height = px->height * sh;
r.width = px->common.width * sh;
r.height = px->common.height * sh;
}
r.width -= MwDefaultBorderWidth(handle) * 2;
r.height -= MwDefaultBorderWidth(handle) * 2;

View File

@@ -223,10 +223,10 @@ static void frame_draw(MwWidget handle) {
}
if(lb->list[i].pixmap != NULL) {
MwRect r2;
int h = (lb->list[i].pixmap->height > MwTextHeight(handle, "M")) ? MwTextHeight(handle, "M") : lb->list[i].pixmap->height;
int h = (lb->list[i].pixmap->common.height > MwTextHeight(handle, "M")) ? MwTextHeight(handle, "M") : lb->list[i].pixmap->common.height;
r2.x = MwDefaultBorderWidth(handle);
r2.y = p.y + (MwTextHeight(handle, "M") - h) / 2;
r2.width = h * lb->list[i].pixmap->width / lb->list[i].pixmap->height;
r2.width = h * lb->list[i].pixmap->common.width / lb->list[i].pixmap->common.height;
r2.height = h;
MwLLDrawPixmap(handle->lowlevel, &r2, lb->list[i].pixmap);
}

View File

@@ -55,7 +55,7 @@ static int create(MwWidget handle) {
pfd.cDepthBits = 32;
pfd.cColorBits = 32;
o->dc = GetDC(handle->lowlevel->hWnd);
o->dc = GetDC(handle->lowlevel->gdi.hWnd);
pf = ChoosePixelFormat(o->dc, &pfd);
SetPixelFormat(o->dc, pf, &pfd);
@@ -93,11 +93,11 @@ static int create(MwWidget handle) {
o->glXGetProcAddress = (MWglXGetProcAddress)dlsym(o->lib, "glXGetProcAddress");
/* XXX: fix this */
o->visual = o->glXChooseVisual(handle->lowlevel->display, DefaultScreen(handle->lowlevel->display), attribs);
o->gl = o->glXCreateContext(handle->lowlevel->display, o->visual, NULL, GL_TRUE);
o->visual = o->glXChooseVisual(handle->lowlevel->x11.display, DefaultScreen(handle->lowlevel->x11.display), attribs);
o->gl = o->glXCreateContext(handle->lowlevel->x11.display, o->visual, NULL, GL_TRUE);
#endif
handle->internal = o;
handle->lowlevel->copy_buffer = 0;
handle->internal = o;
handle->lowlevel->common.copy_buffer = 0;
MwSetDefault(handle);
@@ -113,8 +113,8 @@ static void destroy(MwWidget handle) {
FreeLibrary(o->lib);
#else
o->glXMakeCurrent(handle->lowlevel->display, None, NULL);
o->glXDestroyContext(handle->lowlevel->display, o->gl);
o->glXMakeCurrent(handle->lowlevel->x11.display, None, NULL);
o->glXDestroyContext(handle->lowlevel->x11.display, o->gl);
dlclose(o->lib);
#endif
@@ -126,7 +126,7 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
#ifdef _WIN32
o->wglMakeCurrent(o->dc, o->gl);
#else
o->glXMakeCurrent(handle->lowlevel->display, handle->lowlevel->window, o->gl);
o->glXMakeCurrent(handle->lowlevel->x11.display, handle->lowlevel->x11.window, o->gl);
#endif
}
@@ -137,7 +137,7 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
#else
(void)o;
o->glXSwapBuffers(handle->lowlevel->display, handle->lowlevel->window);
o->glXSwapBuffers(handle->lowlevel->x11.display, handle->lowlevel->x11.window);
#endif
}

View File

@@ -136,7 +136,7 @@ static int create(MwWidget handle) {
return 1;
}
handle->lowlevel->copy_buffer = 0;
handle->lowlevel->common.copy_buffer = 0;
handle->internal = o;
MwSetDefault(handle);
@@ -313,8 +313,8 @@ static MwErrorEnum vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
.pNext = NULL,
.flags = 0,
.dpy = handle->lowlevel->display,
.window = handle->lowlevel->window,
.dpy = handle->lowlevel->x11.display,
.window = handle->lowlevel->x11.window,
};
VK_CMD(_vkCreateXlibSurfaceKHR(o->vkInstance, &createInfo, NULL, &o->vkSurface));
#endif