Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
commit
37835cb53a
8 changed files with 83 additions and 35 deletions
36
src/core.c
36
src/core.c
|
|
@ -133,7 +133,9 @@ static void lldarkthemehandler(MwLL handle, void* data) {
|
|||
int* ptr = data;
|
||||
|
||||
if(IsFirstVisible(h)) {
|
||||
MwSetDarkTheme(h, *ptr);
|
||||
MwVaApply(h,
|
||||
MwNdarkTheme, *ptr,
|
||||
NULL);
|
||||
|
||||
MwDispatchUserHandler(h, MwNdarkThemeHandler, data);
|
||||
}
|
||||
|
|
@ -164,7 +166,6 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
|
|||
h->draw_inject = NULL;
|
||||
h->tick_list = NULL;
|
||||
h->destroyed = 0;
|
||||
h->dark_theme = 0;
|
||||
h->bgcolor = NULL;
|
||||
h->berserk = 0;
|
||||
|
||||
|
|
@ -416,6 +417,14 @@ void MwLoop(MwWidget handle) {
|
|||
}
|
||||
}
|
||||
|
||||
static void force_render_all(MwWidget handle) {
|
||||
int i;
|
||||
for(i = 0; i < arrlen(handle->children); i++) {
|
||||
force_render_all(handle->children[i]);
|
||||
}
|
||||
if(handle->lowlevel != NULL) MwForceRender(handle);
|
||||
}
|
||||
|
||||
void MwSetInteger(MwWidget handle, const char* key, int n) {
|
||||
int xy;
|
||||
int wh = 0;
|
||||
|
|
@ -440,6 +449,9 @@ void MwSetInteger(MwWidget handle, const char* key, int n) {
|
|||
if(strcmp(key, MwNforceInverted) == 0) {
|
||||
MwForceRender(handle);
|
||||
}
|
||||
if(strcmp(key, MwNmodernLook) == 0 || strcmp(key, MwNdarkTheme) == 0 || strcmp(key, MwNbitmapFont) == 0){
|
||||
force_render_all(handle);
|
||||
}
|
||||
}
|
||||
|
||||
void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||
|
|
@ -517,6 +529,7 @@ int MwGetInteger(MwWidget handle, const char* key) {
|
|||
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 1);
|
||||
#endif
|
||||
if(strcmp(key, MwNisRounded) == 0) return inherit_integer(handle, key, 1);
|
||||
if(strcmp(key, MwNdarkTheme) == 0) return inherit_integer(handle, key, 0);
|
||||
}
|
||||
return shget(handle->integer, key);
|
||||
}
|
||||
|
|
@ -531,7 +544,7 @@ const char* MwGetText(MwWidget handle, const char* key) {
|
|||
h = h->parent;
|
||||
}
|
||||
if(v == NULL) {
|
||||
if(handle->dark_theme) {
|
||||
if(MwGetInteger(handle, MwNdarkTheme)) {
|
||||
if(strcmp(key, MwNbackground) == 0) return MwDefaultDarkBackground;
|
||||
if(strcmp(key, MwNforeground) == 0) return MwDefaultDarkForeground;
|
||||
if(strcmp(key, MwNsubBackground) == 0) return MwDefaultDarkSubBackground;
|
||||
|
|
@ -747,21 +760,10 @@ void MwGrabPointer(MwWidget handle, int toggle) {
|
|||
MwLLGrabPointer(handle->lowlevel, toggle);
|
||||
}
|
||||
|
||||
static void force_render_all(MwWidget handle) {
|
||||
int i;
|
||||
for(i = 0; i < arrlen(handle->children); i++) {
|
||||
force_render_all(handle->children[i]);
|
||||
}
|
||||
if(handle->lowlevel != NULL) MwForceRender(handle);
|
||||
}
|
||||
|
||||
void MwSetDarkTheme(MwWidget handle, int toggle) {
|
||||
int old = handle->dark_theme;
|
||||
if(old != toggle) {
|
||||
handle->dark_theme = toggle;
|
||||
|
||||
force_render_all(handle);
|
||||
}
|
||||
MwVaApply(handle,
|
||||
MwNdarkTheme, toggle,
|
||||
NULL);
|
||||
}
|
||||
|
||||
MwWidget MwGetParent(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
|
|||
MwLLColor col;
|
||||
MwBool rounded = MwGetInteger(handle, MwNroundness) != MwDEFAULT && MwGetInteger(handle, MwNisRounded) != 0;
|
||||
|
||||
if(border) {
|
||||
if(border){
|
||||
if(!handle->lowlevel->common.supports_transparency) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect) = NULL;
|
|||
void MwLLCreateCommon(MwLL handle) {
|
||||
handle->common.handler = malloc(sizeof(*handle->common.handler));
|
||||
memset(handle->common.handler, 0, sizeof(*handle->common.handler));
|
||||
|
||||
handle->common.supports_transparency = 0;
|
||||
}
|
||||
|
||||
void MwLLDestroyCommon(MwLL handle) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue