Compare commits

..

19 commits

Author SHA1 Message Date
020f51a0cb Merge branch 'master' into wayland 2025-12-09 00:51:54 -07:00
49a0f08f61 merge src/core.c 2025-12-09 00:50:16 -07:00
6f331d613d
make cursor related functions public 2025-12-08 14:42:16 +09:00
b239dd3819
some useful function 2025-12-08 14:38:01 +09:00
b9796e99d5
tiny fix 2025-12-08 00:32:56 +09:00
218f8fa9cf
remove MwLLSetBackground 2025-12-07 10:40:40 +09:00
71cb96b06e
make gdi rendering a little bit faster 2025-12-07 07:10:20 +09:00
c2e960fe59
make destroyed 1 on child widgets too 2025-12-07 06:34:16 +09:00
a0b3ecb697
add MwNborderWidth 2025-12-07 05:33:22 +09:00
14cf131528
finally fix 2025-12-07 05:26:16 +09:00
ce80f70332
idk 2025-12-07 05:25:08 +09:00
498a76facd
idk 2025-12-07 05:24:23 +09:00
0e183f64f2
oops 2025-12-07 05:23:16 +09:00
d4887f4940
allow null value 2025-12-07 05:22:52 +09:00
d5336dd38c
allow null value 2025-12-07 05:21:22 +09:00
5fea127518
update color db 2025-12-07 05:19:10 +09:00
baa2f81d9a
update milsko.xml 2025-12-07 04:20:30 +09:00
2782277d06
add MwGetName 2025-12-07 04:14:02 +09:00
e397f40485
format 2025-12-07 03:43:14 +09:00
17 changed files with 517 additions and 331 deletions

View file

@ -210,7 +210,7 @@ if (param_get("static")) {
}
foreach my $l (@library_targets) {
my $warn = "-Wall -Wextra -Wno-sign-compare";
my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value";
my $s = $l;
my $o = $object_suffix;
$o =~ s/\./\\\./g;

View file

@ -315,6 +315,13 @@ MWDECL void MwReparent(MwWidget handle, MwWidget new_parent);
*/
MWDECL MwClass MwGetClass(MwWidget handle);
/*!
* @brief Gets name of widget
* @param handle Widget
* @return Name
*/
MWDECL const char* MwGetName(MwWidget handle);
/*!
* @brief Gets children of widget
* @param handle Widget

View file

@ -20,6 +20,7 @@ struct _MwLLGDI {
HICON icon;
int grabbed;
int force_render;
};
struct _MwLLGDIColor {
@ -38,5 +39,6 @@ struct _MwLLGDIPixmap {
};
MWDECL int MwLLGDICallInit(void);
MWDECL HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask);
#endif

View file

@ -69,5 +69,6 @@ struct _MwLLX11Pixmap {
};
MWDECL int MwLLX11CallInit(void);
MWDECL Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask);
#endif

View file

@ -30,6 +30,7 @@
#define MwNflat "Iflat"
#define MwNshowArrows "IshowArrows"
#define MwNpadding "Ipadding"
#define MwNborderWidth "IborderWidth"
#define MwNtitle "Stitle"
#define MwNtext "Stext"

View file

@ -21,6 +21,12 @@
<integer name="x" />
<integer name="y" />
</struct>
<struct name="MwRect">
<integer name="x" />
<integer name="y" />
<integer name="width" />
<integer name="height" />
</struct>
<struct name="MwSizeHints">
<integer name="min_width" />
<integer name="min_height" />
@ -41,6 +47,7 @@
- MwNy
- MwNwidth
- MwNheight
- MwNborderWidth
Integer properties must be prefixed with I.
String properties must be prefixed with S.
@ -73,6 +80,7 @@
<integer name="flat" />
<integer name="showArrows" />
<integer name="padding" />
<integer name="borderWidth" />
<string name="title" />
<string name="text" />
@ -353,6 +361,34 @@
<integer name="toggle" />
</arguments>
</function>
<function name="MwGetName">
<return>
<string />
</return>
<arguments>
<widget name="handle" />
</arguments>
</function>
<function name="MwGetChildren">
<return>
<widget pointer="yes" />
</return>
<arguments>
<widget name="handle" />
</arguments>
</function>
<function name="MwGetCursorCoord">
<arguments>
<widget name="handle" />
<struct defname="MwPoint" pointer="yes" name="point" />
</arguments>
</function>
<function name="MwGetScreenSize">
<arguments>
<widget name="handle" />
<struct defname="MwRect" pointer="yes" name="rect" />
</arguments>
</function>
</functions>
</header>
<header name="Error">

View file

@ -603,18 +603,18 @@ BBX 7 14 0 -2
BITMAP
00
00
00
08
2A
1C
08
08
1C
2A
08
00
00
00
00
00
ENDCHAR
STARTCHAR 002b
ENCODING 43

View file

@ -603,18 +603,18 @@ BBX 7 14 0 -2
BITMAP
00
00
00
5a
5a
3c
18
18
3c
5a
5a
00
00
00
00
00
ENDCHAR
STARTCHAR 002b
ENCODING 43

View file

@ -57,6 +57,14 @@
119 136 153 LightSlateGrey
190 190 190 gray
190 190 190 grey
190 190 190 x11 gray
190 190 190 X11Gray
190 190 190 x11 grey
190 190 190 X11Grey
128 128 128 web gray
128 128 128 WebGray
128 128 128 web grey
128 128 128 WebGrey
211 211 211 light grey
211 211 211 LightGrey
211 211 211 light gray
@ -105,6 +113,7 @@
72 209 204 MediumTurquoise
64 224 208 turquoise
0 255 255 cyan
0 255 255 aqua
224 255 255 light cyan
224 255 255 LightCyan
95 158 160 cadet blue
@ -131,6 +140,11 @@
124 252 0 lawn green
124 252 0 LawnGreen
0 255 0 green
0 255 0 lime
0 255 0 x11 green
0 255 0 X11Green
0 128 0 web green
0 128 0 WebGreen
127 255 0 chartreuse
0 250 154 medium spring green
0 250 154 MediumSpringGreen
@ -202,11 +216,16 @@
219 112 147 pale violet red
219 112 147 PaleVioletRed
176 48 96 maroon
176 48 96 x11 maroon
176 48 96 X11Maroon
128 0 0 web maroon
128 0 0 WebMaroon
199 21 133 medium violet red
199 21 133 MediumVioletRed
208 32 144 violet red
208 32 144 VioletRed
255 0 255 magenta
255 0 255 fuchsia
238 130 238 violet
221 160 221 plum
218 112 214 orchid
@ -219,6 +238,10 @@
138 43 226 blue violet
138 43 226 BlueViolet
160 32 240 purple
160 32 240 x11 purple
160 32 240 X11Purple
128 0 128 web purple
128 0 128 WebPurple
147 112 219 medium purple
147 112 219 MediumPurple
216 191 216 thistle
@ -736,3 +759,24 @@
252 252 252 grey99
255 255 255 gray100
255 255 255 grey100
169 169 169 dark grey
169 169 169 DarkGrey
169 169 169 dark gray
169 169 169 DarkGray
0 0 139 dark blue
0 0 139 DarkBlue
0 139 139 dark cyan
0 139 139 DarkCyan
139 0 139 dark magenta
139 0 139 DarkMagenta
139 0 0 dark red
139 0 0 DarkRed
144 238 144 light green
144 238 144 LightGreen
220 20 60 crimson
75 0 130 indigo
128 128 0 olive
102 51 153 rebecca purple
102 51 153 RebeccaPurple
192 192 192 silver
0 128 128 teal

View file

@ -19,6 +19,8 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
HBITMAP hbmp;
HDC dc, hbdc;
u->ll->gdi.force_render = 0;
if(u->ll->common.copy_buffer) {
GetClientRect(hWnd, &rc);
@ -235,6 +237,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->common.copy_buffer = 1;
r->common.type = MwLLBackendGDI;
r->gdi.force_render = 0;
r->gdi.grabbed = 0;
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;
@ -518,10 +521,14 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
}
static void MwLLForceRenderImpl(MwLL handle) {
if(!handle->gdi.force_render) {
PostMessage(handle->gdi.hWnd, WM_USER, 0, 0);
handle->gdi.force_render = 1;
}
}
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask) {
HCURSOR cursor;
BYTE* dmask = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
BYTE* dimage = malloc((MwCursorDataHeight / 8) * MwCursorDataHeight);
@ -562,12 +569,18 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
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.icon != NULL) DestroyIcon(handle->gdi.icon);
handle->gdi.cursor = cursor;
free(dimage);
free(dmask);
}
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {

View file

@ -394,8 +394,11 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) {
destroy_pixmap(handle);
create_pixmap(handle);
/* we want events */
#if 0
handle->x11.width = w;
handle->x11.height = h;
#endif
XSync(handle->x11.display, False);
@ -777,10 +780,10 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
}
static void MwLLForceRenderImpl(MwLL handle) {
if(!handle->x11.force_render) {
XEvent ev;
memset(&ev, 0, sizeof(ev));
if(!handle->x11.force_render) {
ev.type = Expose;
ev.xexpose.window = handle->x11.window;
XSendEvent(handle->x11.display, handle->x11.window, False, ExposureMask, &ev);
@ -789,17 +792,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;
int y, x, ys, xs;
char* di = 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* cmask = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, dm, MwCursorDataHeight, MwCursorDataHeight, 32, MwCursorDataHeight * 4);
Pixmap pimage = XCreatePixmap(handle->x11.display, handle->x11.window, MwCursorDataHeight, MwCursorDataHeight, 1);
Pixmap pmask = XCreatePixmap(handle->x11.display, handle->x11.window, MwCursorDataHeight, MwCursorDataHeight, 1);
GC imagegc = XCreateGC(handle->x11.display, pimage, 0, NULL);
GC maskgc = XCreateGC(handle->x11.display, pmask, 0, NULL);
XImage* cimage = XCreateImage(display, DefaultVisual(display, DefaultScreen(display)), 1, ZPixmap, 0, di, 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(display, DefaultRootWindow(display), MwCursorDataHeight, MwCursorDataHeight, 1);
Pixmap pmask = XCreatePixmap(display, DefaultRootWindow(display), MwCursorDataHeight, MwCursorDataHeight, 1);
GC imagegc = XCreateGC(display, pimage, 0, NULL);
GC maskgc = XCreateGC(display, pmask, 0, NULL);
XColor cfg, cbg;
xs = -mask->x + image->x;
@ -831,25 +834,32 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
cfg.red = 65535;
cfg.green = 65535;
cfg.blue = 65535;
XAllocColor(handle->x11.display, handle->x11.colormap, &cfg);
XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &cfg);
cbg.red = 0;
cbg.green = 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(handle->x11.display, pmask, maskgc, cmask, 0, 0, 0, 0, MwCursorDataHeight, MwCursorDataHeight);
XPutImage(display, pimage, imagegc, cimage, 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);
XDefineCursor(handle->x11.display, handle->x11.window, cur);
XFreeCursor(handle->x11.display, cur);
cur = XCreatePixmapCursor(display, pimage, pmask, &cfg, &cbg, xs, ys);
XFreePixmap(handle->x11.display, pimage);
XFreePixmap(handle->x11.display, pmask);
XFreePixmap(display, pimage);
XFreePixmap(display, pmask);
XDestroyImage(cimage);
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) {

View file

@ -60,6 +60,14 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "LightSlateGrey") == 0) return MwLLAllocColor(handle->lowlevel, 119, 136, 153);
if(strcmp(color, "gray") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "grey") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "x11 gray") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "X11Gray") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "x11 grey") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "X11Grey") == 0) return MwLLAllocColor(handle->lowlevel, 190, 190, 190);
if(strcmp(color, "web gray") == 0) return MwLLAllocColor(handle->lowlevel, 128, 128, 128);
if(strcmp(color, "WebGray") == 0) return MwLLAllocColor(handle->lowlevel, 128, 128, 128);
if(strcmp(color, "web grey") == 0) return MwLLAllocColor(handle->lowlevel, 128, 128, 128);
if(strcmp(color, "WebGrey") == 0) return MwLLAllocColor(handle->lowlevel, 128, 128, 128);
if(strcmp(color, "light grey") == 0) return MwLLAllocColor(handle->lowlevel, 211, 211, 211);
if(strcmp(color, "LightGrey") == 0) return MwLLAllocColor(handle->lowlevel, 211, 211, 211);
if(strcmp(color, "light gray") == 0) return MwLLAllocColor(handle->lowlevel, 211, 211, 211);
@ -108,6 +116,7 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "MediumTurquoise") == 0) return MwLLAllocColor(handle->lowlevel, 72, 209, 204);
if(strcmp(color, "turquoise") == 0) return MwLLAllocColor(handle->lowlevel, 64, 224, 208);
if(strcmp(color, "cyan") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 255);
if(strcmp(color, "aqua") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 255);
if(strcmp(color, "light cyan") == 0) return MwLLAllocColor(handle->lowlevel, 224, 255, 255);
if(strcmp(color, "LightCyan") == 0) return MwLLAllocColor(handle->lowlevel, 224, 255, 255);
if(strcmp(color, "cadet blue") == 0) return MwLLAllocColor(handle->lowlevel, 95, 158, 160);
@ -134,6 +143,11 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "lawn green") == 0) return MwLLAllocColor(handle->lowlevel, 124, 252, 0);
if(strcmp(color, "LawnGreen") == 0) return MwLLAllocColor(handle->lowlevel, 124, 252, 0);
if(strcmp(color, "green") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 0);
if(strcmp(color, "lime") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 0);
if(strcmp(color, "x11 green") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 0);
if(strcmp(color, "X11Green") == 0) return MwLLAllocColor(handle->lowlevel, 0, 255, 0);
if(strcmp(color, "web green") == 0) return MwLLAllocColor(handle->lowlevel, 0, 128, 0);
if(strcmp(color, "WebGreen") == 0) return MwLLAllocColor(handle->lowlevel, 0, 128, 0);
if(strcmp(color, "chartreuse") == 0) return MwLLAllocColor(handle->lowlevel, 127, 255, 0);
if(strcmp(color, "medium spring green") == 0) return MwLLAllocColor(handle->lowlevel, 0, 250, 154);
if(strcmp(color, "MediumSpringGreen") == 0) return MwLLAllocColor(handle->lowlevel, 0, 250, 154);
@ -205,11 +219,16 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "pale violet red") == 0) return MwLLAllocColor(handle->lowlevel, 219, 112, 147);
if(strcmp(color, "PaleVioletRed") == 0) return MwLLAllocColor(handle->lowlevel, 219, 112, 147);
if(strcmp(color, "maroon") == 0) return MwLLAllocColor(handle->lowlevel, 176, 48, 96);
if(strcmp(color, "x11 maroon") == 0) return MwLLAllocColor(handle->lowlevel, 176, 48, 96);
if(strcmp(color, "X11Maroon") == 0) return MwLLAllocColor(handle->lowlevel, 176, 48, 96);
if(strcmp(color, "web maroon") == 0) return MwLLAllocColor(handle->lowlevel, 128, 0, 0);
if(strcmp(color, "WebMaroon") == 0) return MwLLAllocColor(handle->lowlevel, 128, 0, 0);
if(strcmp(color, "medium violet red") == 0) return MwLLAllocColor(handle->lowlevel, 199, 21, 133);
if(strcmp(color, "MediumVioletRed") == 0) return MwLLAllocColor(handle->lowlevel, 199, 21, 133);
if(strcmp(color, "violet red") == 0) return MwLLAllocColor(handle->lowlevel, 208, 32, 144);
if(strcmp(color, "VioletRed") == 0) return MwLLAllocColor(handle->lowlevel, 208, 32, 144);
if(strcmp(color, "magenta") == 0) return MwLLAllocColor(handle->lowlevel, 255, 0, 255);
if(strcmp(color, "fuchsia") == 0) return MwLLAllocColor(handle->lowlevel, 255, 0, 255);
if(strcmp(color, "violet") == 0) return MwLLAllocColor(handle->lowlevel, 238, 130, 238);
if(strcmp(color, "plum") == 0) return MwLLAllocColor(handle->lowlevel, 221, 160, 221);
if(strcmp(color, "orchid") == 0) return MwLLAllocColor(handle->lowlevel, 218, 112, 214);
@ -222,6 +241,10 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "blue violet") == 0) return MwLLAllocColor(handle->lowlevel, 138, 43, 226);
if(strcmp(color, "BlueViolet") == 0) return MwLLAllocColor(handle->lowlevel, 138, 43, 226);
if(strcmp(color, "purple") == 0) return MwLLAllocColor(handle->lowlevel, 160, 32, 240);
if(strcmp(color, "x11 purple") == 0) return MwLLAllocColor(handle->lowlevel, 160, 32, 240);
if(strcmp(color, "X11Purple") == 0) return MwLLAllocColor(handle->lowlevel, 160, 32, 240);
if(strcmp(color, "web purple") == 0) return MwLLAllocColor(handle->lowlevel, 128, 0, 128);
if(strcmp(color, "WebPurple") == 0) return MwLLAllocColor(handle->lowlevel, 128, 0, 128);
if(strcmp(color, "medium purple") == 0) return MwLLAllocColor(handle->lowlevel, 147, 112, 219);
if(strcmp(color, "MediumPurple") == 0) return MwLLAllocColor(handle->lowlevel, 147, 112, 219);
if(strcmp(color, "thistle") == 0) return MwLLAllocColor(handle->lowlevel, 216, 191, 216);
@ -739,5 +762,26 @@ MwLLColor MwParseColorName(MwWidget handle, const char* color) {
if(strcmp(color, "grey99") == 0) return MwLLAllocColor(handle->lowlevel, 252, 252, 252);
if(strcmp(color, "gray100") == 0) return MwLLAllocColor(handle->lowlevel, 255, 255, 255);
if(strcmp(color, "grey100") == 0) return MwLLAllocColor(handle->lowlevel, 255, 255, 255);
if(strcmp(color, "dark grey") == 0) return MwLLAllocColor(handle->lowlevel, 169, 169, 169);
if(strcmp(color, "DarkGrey") == 0) return MwLLAllocColor(handle->lowlevel, 169, 169, 169);
if(strcmp(color, "dark gray") == 0) return MwLLAllocColor(handle->lowlevel, 169, 169, 169);
if(strcmp(color, "DarkGray") == 0) return MwLLAllocColor(handle->lowlevel, 169, 169, 169);
if(strcmp(color, "dark blue") == 0) return MwLLAllocColor(handle->lowlevel, 0, 0, 139);
if(strcmp(color, "DarkBlue") == 0) return MwLLAllocColor(handle->lowlevel, 0, 0, 139);
if(strcmp(color, "dark cyan") == 0) return MwLLAllocColor(handle->lowlevel, 0, 139, 139);
if(strcmp(color, "DarkCyan") == 0) return MwLLAllocColor(handle->lowlevel, 0, 139, 139);
if(strcmp(color, "dark magenta") == 0) return MwLLAllocColor(handle->lowlevel, 139, 0, 139);
if(strcmp(color, "DarkMagenta") == 0) return MwLLAllocColor(handle->lowlevel, 139, 0, 139);
if(strcmp(color, "dark red") == 0) return MwLLAllocColor(handle->lowlevel, 139, 0, 0);
if(strcmp(color, "DarkRed") == 0) return MwLLAllocColor(handle->lowlevel, 139, 0, 0);
if(strcmp(color, "light green") == 0) return MwLLAllocColor(handle->lowlevel, 144, 238, 144);
if(strcmp(color, "LightGreen") == 0) return MwLLAllocColor(handle->lowlevel, 144, 238, 144);
if(strcmp(color, "crimson") == 0) return MwLLAllocColor(handle->lowlevel, 220, 20, 60);
if(strcmp(color, "indigo") == 0) return MwLLAllocColor(handle->lowlevel, 75, 0, 130);
if(strcmp(color, "olive") == 0) return MwLLAllocColor(handle->lowlevel, 128, 128, 0);
if(strcmp(color, "rebecca purple") == 0) return MwLLAllocColor(handle->lowlevel, 102, 51, 153);
if(strcmp(color, "RebeccaPurple") == 0) return MwLLAllocColor(handle->lowlevel, 102, 51, 153);
if(strcmp(color, "silver") == 0) return MwLLAllocColor(handle->lowlevel, 192, 192, 192);
if(strcmp(color, "teal") == 0) return MwLLAllocColor(handle->lowlevel, 0, 128, 128);
return MwLLAllocColor(handle->lowlevel, 0, 0, 0);
}

View file

@ -242,6 +242,14 @@ static void MwFreeWidget(MwWidget handle) {
free(handle);
}
static void destroy_children(MwWidget handle) {
int i;
for(i = 0; i < arrlen(handle->children); i++) {
destroy_children(handle->children[i]);
}
handle->destroyed = 1;
}
void MwDestroyWidget(MwWidget handle) {
if(handle->parent != NULL) {
int i;
@ -252,6 +260,7 @@ void MwDestroyWidget(MwWidget handle) {
arrput(handle->parent->destroy_queue, handle);
}
}
destroy_children(handle);
handle->destroyed = 1;
}
@ -377,14 +386,17 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
if(strcmp(key, MwNtitle) == 0) {
MwLLSetTitle(handle->lowlevel, value);
} else {
char* v = MwStringDuplicate(value);
char* v = value == NULL ? NULL : MwStringDuplicate(value);
if(shgeti(handle->text, key) != -1) free(shget(handle->text, key));
if(value != NULL) {
shput(handle->text, key, v);
} else {
shdel(handle->text, key);
}
}
if(handle->prop_event) MwDispatch3(handle, prop_change, key);
if(strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0 || strcmp(key, MwNsubBackground) == 0 || strcmp(key, MwNsubForeground) == 0) {
MwForceRender(handle);
}
@ -731,6 +743,10 @@ MwClass MwGetClass(MwWidget handle) {
return handle->widget_class;
}
const char* MwGetName(MwWidget handle) {
return handle->name;
}
MwWidget* MwGetChildren(MwWidget handle) {
MwWidget* c = malloc(sizeof(*c) * (arrlen(handle->children) + 1));
int i;

View file

@ -11,6 +11,10 @@ const char* MwDefaultDarkSubBackground = "#333";
const char* MwDefaultDarkSubForeground = "#ddd";
int MwDefaultBorderWidth(MwWidget handle) {
int bw = MwGetInteger(handle, MwNborderWidth);
if(bw != MwDEFAULT) return bw;
if(MwGetInteger(handle, MwNmodernLook)) {
return 1;
} else {

View file

@ -131,8 +131,16 @@ void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
} else {
int diff = get_color_diff(handle) / 3 * 2;
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, -diff, (handle->parent == NULL || handle->parent->lowlevel == NULL) ? 1 : 0);
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, diff, 0);
if(MwDefaultBorderWidth(handle) >= 2) {
int i;
int st = invert ? 1 : 0;
for(i = st; i < st + 2; i++) {
if((i % 2) == 0) MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) - 1, -diff, (handle->parent == NULL || handle->parent->lowlevel == NULL) ? 1 : 0);
if((i % 2) == 1) MwDrawFrameEx(handle, rect, color, invert, 1, diff, 0);
}
} else {
MwDrawFrameEx(handle, rect, color, invert, 1, 0, 0);
}
}
}

2
src/font/boldfont.c generated
View file

@ -47,7 +47,7 @@ MwFont MwBoldFontData[] = {
{0, 12, {28, 12, 12, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 39 */
{0, 12, {0, 3, 6, 12, 12, 24, 24, 24, 24, 24, 12, 12, 6, 3}}, /* 40 */
{0, 12, {0, 48, 24, 12, 12, 6, 6, 6, 6, 6, 12, 12, 24, 48}}, /* 41 */
{0, 12, {0, 0, 45, 45, 30, 12, 30, 45, 45, 0, 0, 0, 0, 0}}, /* 42 */
{0, 12, {0, 0, 0, 45, 45, 30, 12, 12, 30, 45, 45, 0, 0, 0}}, /* 42 */
{0, 12, {0, 0, 0, 0, 12, 12, 12, 63, 12, 12, 12, 0, 0, 0}}, /* 43 */
{0, 12, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 12, 12, 24}}, /* 44 */
{0, 12, {0, 0, 0, 0, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0}}, /* 45 */

2
src/font/font.c generated
View file

@ -47,7 +47,7 @@ MwFont MwFontData[] = {
{0, 12, {24, 8, 8, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 39 */
{0, 12, {0, 1, 2, 4, 4, 8, 8, 8, 8, 8, 4, 4, 2, 1}}, /* 40 */
{0, 12, {0, 32, 16, 8, 8, 4, 4, 4, 4, 4, 8, 8, 16, 32}}, /* 41 */
{0, 12, {0, 0, 4, 21, 14, 4, 14, 21, 4, 0, 0, 0, 0, 0}}, /* 42 */
{0, 12, {0, 0, 0, 4, 21, 14, 4, 4, 14, 21, 4, 0, 0, 0}}, /* 42 */
{0, 12, {0, 0, 0, 0, 8, 8, 8, 62, 8, 8, 8, 0, 0, 0}}, /* 43 */
{0, 12, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 8, 8, 16}}, /* 44 */
{0, 12, {0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0}}, /* 45 */