git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@31 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-28 22:00:17 +00:00
parent 61b442d259
commit 0bc58045ae
5 changed files with 26 additions and 22 deletions

11
src/lowlevel.c Normal file
View File

@@ -0,0 +1,11 @@
/* $Id$ */
#include <Milsko/Milsko.h>
void MilskoLLCreateCommon(MilskoLL handle) {
handle->callback = malloc(sizeof(*handle->callback));
memset(handle->callback, 0, sizeof(*handle->callback));
}
void MilskoLLDestroyCommon(MilskoLL handle) {
free(handle->callback);
}

View File

@@ -9,14 +9,9 @@ MilskoLL MilskoLLCreate(MilskoLL parent, int x, int y, int width, int height) {
Window root;
unsigned int border, depth;
r = malloc(sizeof(*r));
r->x = x;
r->y = y;
r->width = width;
r->height = height;
r->callback = malloc(sizeof(*r->callback));
r = malloc(sizeof(*r));
memset(r->callback, 0, sizeof(*r->callback));
MilskoLLCreateCommon(r);
if(parent == NULL) {
r->display = XOpenDisplay(NULL);
@@ -37,6 +32,8 @@ MilskoLL MilskoLLCreate(MilskoLL parent, int x, int y, int width, int height) {
}
void MilskoLLDestroy(MilskoLL handle) {
MilskoLLDestroyCommon(handle);
XFreeGC(handle->display, handle->gc);
XDestroyWindow(handle->display, handle->window);
free(handle);
@@ -85,11 +82,6 @@ void MilskoLLGetXYWH(MilskoLL handle, int* x, int* y, unsigned int* w, unsigned
unsigned int border, depth;
XGetGeometry(handle->display, handle->window, &root, x, y, w, h, &border, &depth);
handle->x = *x;
handle->y = *y;
handle->width = *w;
handle->height = *h;
}
void MilskoLLSetXY(MilskoLL handle, int x, int y) {