mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
Compare commits
3 Commits
a384add9e9
...
a67a0c11f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a67a0c11f8 | ||
|
|
dc8168df12 | ||
|
|
604ff72d6e |
@@ -35,6 +35,7 @@
|
|||||||
#define MwNratio "Iratio"
|
#define MwNratio "Iratio"
|
||||||
#define MwNfixedSize "IfixedSize"
|
#define MwNfixedSize "IfixedSize"
|
||||||
#define MwNmargin "Imargin"
|
#define MwNmargin "Imargin"
|
||||||
|
#define MwNbitmapFont "IbitmapFont"
|
||||||
|
|
||||||
#define MwNtitle "Stitle"
|
#define MwNtitle "Stitle"
|
||||||
#define MwNtext "Stext"
|
#define MwNtext "Stext"
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
- MwNbackgroundPixmap
|
- MwNbackgroundPixmap
|
||||||
- MwNratio
|
- MwNratio
|
||||||
- MwNfixedSize
|
- MwNfixedSize
|
||||||
|
- MwNbitmapFont
|
||||||
|
|
||||||
Integer properties must be prefixed with I.
|
Integer properties must be prefixed with I.
|
||||||
String properties must be prefixed with S.
|
String properties must be prefixed with S.
|
||||||
@@ -87,6 +88,7 @@
|
|||||||
<integer name="ratio" />
|
<integer name="ratio" />
|
||||||
<integer name="fixedSize" />
|
<integer name="fixedSize" />
|
||||||
<integer name="margin" />
|
<integer name="margin" />
|
||||||
|
<integer name="bitmapFont" />
|
||||||
|
|
||||||
<string name="title" />
|
<string name="title" />
|
||||||
<string name="text" />
|
<string name="text" />
|
||||||
|
|||||||
10
pl/rules.pl
10
pl/rules.pl
@@ -32,11 +32,11 @@ if (grep(/^wayland$/, @backends)) {
|
|||||||
add_cflags(`pkg-config --cflags cairo wayland-client xkbcommon`);
|
add_cflags(`pkg-config --cflags cairo wayland-client xkbcommon`);
|
||||||
add_libs(`pkg-config --libs cairo wayland-client xkbcommon`);
|
add_libs(`pkg-config --libs cairo wayland-client xkbcommon`);
|
||||||
|
|
||||||
scan_wayland_protocol("stable", "xdg-shell", "");
|
scan_wayland_protocol("stable", "xdg-shell", "");
|
||||||
scan_wayland_protocol("stable", "tablet", "-v2");
|
scan_wayland_protocol("stable", "tablet", "-v2");
|
||||||
scan_wayland_protocol("staging", "xdg-toplevel-icon", "-v1");
|
scan_wayland_protocol("staging", "xdg-toplevel-icon", "-v1");
|
||||||
scan_wayland_protocol("staging", "cursor-shape", "-v1");
|
scan_wayland_protocol("staging", "cursor-shape", "-v1");
|
||||||
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
|
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
|
||||||
scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1");
|
scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1");
|
||||||
|
|
||||||
$gl_libs = "-lEGL -lwayland-egl lGL -lGLU";
|
$gl_libs = "-lEGL -lwayland-egl lGL -lGLU";
|
||||||
|
|||||||
39
src/core.c
39
src/core.c
@@ -428,6 +428,15 @@ void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int inherit_integer(MwWidget handle, const char* key, int default_v) {
|
||||||
|
int v;
|
||||||
|
|
||||||
|
if(handle->parent != NULL && (v = MwGetInteger(handle->parent, key)) != MwDEFAULT) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return default_v;
|
||||||
|
}
|
||||||
|
|
||||||
int MwGetInteger(MwWidget handle, const char* key) {
|
int MwGetInteger(MwWidget handle, const char* key) {
|
||||||
if(strcmp(key, MwNx) == 0 || strcmp(key, MwNy) == 0 || strcmp(key, MwNwidth) == 0 || strcmp(key, MwNheight) == 0) {
|
if(strcmp(key, MwNx) == 0 || strcmp(key, MwNy) == 0 || strcmp(key, MwNwidth) == 0 || strcmp(key, MwNheight) == 0) {
|
||||||
int x, y;
|
int x, y;
|
||||||
@@ -441,6 +450,18 @@ int MwGetInteger(MwWidget handle, const char* key) {
|
|||||||
if(strcmp(key, MwNheight) == 0) return h;
|
if(strcmp(key, MwNheight) == 0) return h;
|
||||||
return MwDEFAULT;
|
return MwDEFAULT;
|
||||||
} else {
|
} else {
|
||||||
|
if(shgeti(handle->integer, key) == -1) {
|
||||||
|
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
|
||||||
|
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 0);
|
||||||
|
#else
|
||||||
|
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 1);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_CLASSIC_THEME
|
||||||
|
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 0);
|
||||||
|
#else
|
||||||
|
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return shget(handle->integer, key);
|
return shget(handle->integer, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,19 +562,6 @@ void MwVaListApply(MwWidget handle, va_list va) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inherit_integer(MwWidget handle, const char* key, int default_value) {
|
|
||||||
int n;
|
|
||||||
MwWidget h = handle;
|
|
||||||
while(h != NULL) {
|
|
||||||
if((n = MwGetInteger(h, key)) != MwDEFAULT) {
|
|
||||||
MwSetInteger(handle, key, n);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
h = h->parent;
|
|
||||||
}
|
|
||||||
MwSetInteger(handle, key, default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
|
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
|
||||||
static void set_font(MwWidget handle) {
|
static void set_font(MwWidget handle) {
|
||||||
void* f;
|
void* f;
|
||||||
@@ -587,11 +595,6 @@ static void set_boldfont(MwWidget handle) {
|
|||||||
void MwSetDefault(MwWidget handle) {
|
void MwSetDefault(MwWidget handle) {
|
||||||
if(handle->lowlevel != NULL) MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
if(handle->lowlevel != NULL) MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
||||||
|
|
||||||
#ifdef USE_CLASSIC_THEME
|
|
||||||
inherit_integer(handle, MwNmodernLook, 0);
|
|
||||||
#else
|
|
||||||
inherit_integer(handle, MwNmodernLook, 1);
|
|
||||||
#endif
|
|
||||||
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
|
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
|
||||||
set_font(handle);
|
set_font(handle);
|
||||||
set_boldfont(handle);
|
set_boldfont(handle);
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ static int ttf_MwTextHeight(MwWidget handle, int count) {
|
|||||||
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
|
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
|
||||||
if(strlen(text) == 0) return;
|
if(strlen(text) == 0) return;
|
||||||
#ifdef TTF
|
#ifdef TTF
|
||||||
if(ttf_MwDrawText(handle, point, text, bold, align, color))
|
if(MwGetInteger(handle, MwNbitmapFont) || ttf_MwDrawText(handle, point, text, bold, align, color))
|
||||||
#endif
|
#endif
|
||||||
bitmap_MwDrawText(handle, point, text, bold, align, color);
|
bitmap_MwDrawText(handle, point, text, bold, align, color);
|
||||||
}
|
}
|
||||||
@@ -304,7 +304,7 @@ int MwTextWidth(MwWidget handle, const char* text) {
|
|||||||
#ifdef TTF
|
#ifdef TTF
|
||||||
int st;
|
int st;
|
||||||
|
|
||||||
if((st = ttf_MwTextWidth(handle, text)) != -1) return st;
|
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextWidth(handle, text)) != -1) return st;
|
||||||
#else
|
#else
|
||||||
(void)handle;
|
(void)handle;
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ int MwTextHeight(MwWidget handle, const char* text) {
|
|||||||
if(out == '\n') c++;
|
if(out == '\n') c++;
|
||||||
}
|
}
|
||||||
#ifdef TTF
|
#ifdef TTF
|
||||||
if((st = ttf_MwTextHeight(handle, c)) != -1) return st;
|
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextHeight(handle, c)) != -1) return st;
|
||||||
#endif
|
#endif
|
||||||
return FontHeight * c;
|
return FontHeight * c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user