This commit is contained in:
Nishi 2026-09-27 11:49:25 +09:00
commit 1647490b5a
4 changed files with 52 additions and 52 deletions

View file

@ -96,7 +96,7 @@ static int conversation(int num_msg, const struct pam_message** msg, struct pam_
for(i = 0; i < num_msg; i++) { for(i = 0; i < num_msg; i++) {
if(msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) { if(msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) {
const char* txt = MwGetText(passentry, MwNtext); const char* txt = MwGetString(passentry, MwNtext);
if(txt == NULL) txt = ""; if(txt == NULL) txt = "";
resp[i]->resp_retcode = PAM_SUCCESS; resp[i]->resp_retcode = PAM_SUCCESS;
@ -154,11 +154,11 @@ cleanup:
err2 = pam_end(pam, 0); err2 = pam_end(pam, 0);
if(err && ret != PAM_SUCCESS) { if(err && ret != PAM_SUCCESS) {
MwSetText(passentry, MwNtext, ""); MwSetString(passentry, MwNtext, "");
snprintf(err_str, 255, "%s: %s", place, pam_strerror(pam, err)); snprintf(err_str, 255, "%s: %s", place, pam_strerror(pam, err));
print_error = 1; print_error = 1;
} else if(err2) { } else if(err2) {
MwSetText(passentry, MwNtext, ""); MwSetString(passentry, MwNtext, "");
snprintf(err_str, 255, "Error calling pam_end: %s", pam_strerror(pam, err2)); snprintf(err_str, 255, "Error calling pam_end: %s", pam_strerror(pam, err2));
print_error = 1; print_error = 1;
} }
@ -171,7 +171,7 @@ cleanup:
} }
} }
MwSetText(reason, MwNtext, "Login failed"); MwSetString(reason, MwNtext, "Login failed");
} else { } else {
printf("Logging in as %s\n", username); printf("Logging in as %s\n", username);
struct passwd* pwd = getpwnam(username); struct passwd* pwd = getpwnam(username);

View file

@ -16,14 +16,14 @@ typedef struct wmframe {
MwWidget menu_button; MwWidget menu_button;
MwLLPixmap maximize; MwPixmap maximize;
MwLLPixmap restore; MwPixmap restore;
MwLLPixmap iconify; MwPixmap iconify;
int dragging; int dragging;
MwPoint drag_point; MwPoint drag_point;
MwLLPixmap background; MwPixmap background;
int maximized; int maximized;
MwRect old_size; MwRect old_size;
@ -255,13 +255,13 @@ static void menu_menu(MwWidget handle, void* user, void* client) {
if(strcmp(m->name, "Maximize") == 0 || strcmp(m->name, "Restore") == 0) { if(strcmp(m->name, "Maximize") == 0 || strcmp(m->name, "Restore") == 0) {
for(i = 0; i < arrlen(f->left); i++) { for(i = 0; i < arrlen(f->left); i++) {
MwLLPixmap px = MwGetVoid(f->left[i], MwNpixmap); MwPixmap px = MwGetPointer(f->left[i], MwNpixmap);
if(px == f->maximize || px == f->restore) maximize(f->left[i], w, NULL); if(px == f->maximize || px == f->restore) maximize(f->left[i], w, NULL);
} }
for(i = 0; i < arrlen(f->right); i++) { for(i = 0; i < arrlen(f->right); i++) {
MwLLPixmap px = MwGetVoid(f->right[i], MwNpixmap); MwPixmap px = MwGetPointer(f->right[i], MwNpixmap);
if(px == f->maximize || px == f->restore) maximize(f->right[i], w, NULL); if(px == f->maximize || px == f->restore) maximize(f->right[i], w, NULL);
} }
@ -278,7 +278,7 @@ static void menu_menu(MwWidget handle, void* user, void* client) {
static void apply_button(MwWidget widget, const char* str) { static void apply_button(MwWidget widget, const char* str) {
MwWidget w = widget; MwWidget w = widget;
wmframe_t* f; wmframe_t* f;
MwLLPixmap px = NULL; MwPixmap px = NULL;
while(w != NULL && strcmp(MwGetName(w), "frame") != 0) w = MwGetParent(w); while(w != NULL && strcmp(MwGetName(w), "frame") != 0) w = MwGetParent(w);
@ -558,10 +558,10 @@ void wm_destroy(MwWidget widget) {
arrfree(f->left); arrfree(f->left);
arrfree(f->right); arrfree(f->right);
if(f->background != NULL) MwLLDestroyPixmap(f->background); if(f->background != NULL) MwDestroyPixmap(f->background);
MwLLDestroyPixmap(f->maximize); MwDestroyPixmap(f->maximize);
MwLLDestroyPixmap(f->restore); MwDestroyPixmap(f->restore);
MwLLDestroyPixmap(f->iconify); MwDestroyPixmap(f->iconify);
free(widget->opaque); free(widget->opaque);
MwDestroyWidget(widget); MwDestroyWidget(widget);
pthread_mutex_unlock(&xmutex); pthread_mutex_unlock(&xmutex);
@ -579,15 +579,15 @@ void wm_set_name(MwWidget widget, const char* name) {
int wm_set_icon_by_name(MwWidget widget, const char* cat, const char* name) { int wm_set_icon_by_name(MwWidget widget, const char* cat, const char* name) {
wmframe_t* f = widget->opaque; wmframe_t* f = widget->opaque;
MwLLPixmap px = NULL; MwPixmap px = NULL;
int st = 0; int st = 0;
pthread_mutex_lock(&xmutex); pthread_mutex_lock(&xmutex);
if(f->menu_button != NULL) { if(f->menu_button != NULL) {
char* p; char* p;
if((px = MwGetVoid(f->menu_button, MwNpixmap)) != NULL) { if((px = MwGetPointer(f->menu_button, MwNpixmap)) != NULL) {
MwLLDestroyPixmap(px); MwDestroyPixmap(px);
px = NULL; px = NULL;
} }
@ -597,7 +597,7 @@ int wm_set_icon_by_name(MwWidget widget, const char* cat, const char* name) {
free(p); free(p);
} }
MwSetVoid(f->menu_button, MwNpixmap, px); MwSetPointer(f->menu_button, MwNpixmap, px);
} }
pthread_mutex_unlock(&xmutex); pthread_mutex_unlock(&xmutex);
@ -609,27 +609,27 @@ int wm_set_icon_by_name(MwWidget widget, const char* cat, const char* name) {
void wm_set_icon(MwWidget widget, unsigned char* data, int width, int height) { void wm_set_icon(MwWidget widget, unsigned char* data, int width, int height) {
wmframe_t* f = widget->opaque; wmframe_t* f = widget->opaque;
MwLLPixmap px = NULL; MwPixmap px = NULL;
pthread_mutex_lock(&xmutex); pthread_mutex_lock(&xmutex);
if(f->menu_button != NULL) { if(f->menu_button != NULL) {
if((px = MwGetVoid(f->menu_button, MwNpixmap)) != NULL) { if((px = MwGetPointer(f->menu_button, MwNpixmap)) != NULL) {
MwLLDestroyPixmap(px); MwDestroyPixmap(px);
px = NULL; px = NULL;
} }
px = MwLoadRaw(f->menu_button, data, width, height); px = MwLoadRaw(f->menu_button, data, width, height);
MwSetVoid(f->menu_button, MwNpixmap, px); MwSetPointer(f->menu_button, MwNpixmap, px);
} }
pthread_mutex_unlock(&xmutex); pthread_mutex_unlock(&xmutex);
} }
static char tmp_bg[64]; static char tmp_bg[64];
MwLLPixmap lookup_col(MwWidget widget, const char* bgfg, const char* type, const char** bg) { MwPixmap lookup_col(MwWidget widget, const char* bgfg, const char* type, const char** bg) {
wmframe_t* f = widget->opaque; wmframe_t* f = widget->opaque;
MwLLPixmap px = NULL; MwPixmap px = NULL;
xl_node_t* node = get_window(); xl_node_t* node = get_window();
xl_node_t* n; xl_node_t* n;
@ -651,8 +651,8 @@ MwLLPixmap lookup_col(MwWidget widget, const char* bgfg, const char* type, const
const char* to; const char* to;
int i; int i;
unsigned char* d = malloc(1 * TitleBarHeight * 4); unsigned char* d = malloc(1 * TitleBarHeight * 4);
MwLLColor cfrom; MwColor cfrom;
MwLLColor cto; MwColor cto;
int fr, fg, fb; int fr, fg, fb;
int tr, tg, tb; int tr, tg, tb;
xl_node_t* n3 = n2->first_child; xl_node_t* n3 = n2->first_child;
@ -680,12 +680,12 @@ MwLLPixmap lookup_col(MwWidget widget, const char* bgfg, const char* type, const
continue; continue;
} }
cfrom = MwParseColor(widget, from == NULL ? MwGetText(widget, MwNbackground) : from); cfrom = MwParseColor(widget, from == NULL ? MwGetString(widget, MwNbackground) : from);
cto = MwParseColor(widget, to == NULL ? MwGetText(widget, MwNbackground) : to); cto = MwParseColor(widget, to == NULL ? MwGetString(widget, MwNbackground) : to);
MwColorGet(cfrom, &fr, &fg, &fb); MwColorGet(cfrom, &fr, &fg, &fb);
MwColorGet(cto, &tr, &tg, &tb); MwColorGet(cto, &tr, &tg, &tb);
MwLLFreeColor(cfrom); MwFreeColor(cfrom);
MwLLFreeColor(cto); MwFreeColor(cto);
memset(d, 255, 1 * TitleBarHeight * 4); memset(d, 255, 1 * TitleBarHeight * 4);
@ -716,8 +716,8 @@ void wm_focus(MwWidget widget, int focus) {
wmframe_t* f = widget->opaque; wmframe_t* f = widget->opaque;
const char* bg = NULL; const char* bg = NULL;
const char* fg = NULL; const char* fg = NULL;
MwLLPixmap bgpx = NULL; MwPixmap bgpx = NULL;
MwLLPixmap fgpx = NULL; MwPixmap fgpx = NULL;
pthread_mutex_lock(&xmutex); pthread_mutex_lock(&xmutex);
if(focus) { if(focus) {
@ -728,9 +728,9 @@ void wm_focus(MwWidget widget, int focus) {
fgpx = lookup_col(widget, "Foreground", "Inactive", &fg); fgpx = lookup_col(widget, "Foreground", "Inactive", &fg);
} }
if(fgpx != NULL) MwLLDestroyPixmap(fgpx); if(fgpx != NULL) MwDestroyPixmap(fgpx);
if(f->background != NULL) MwLLDestroyPixmap(f->background); if(f->background != NULL) MwDestroyPixmap(f->background);
f->background = bgpx; f->background = bgpx;
MwVaApply(f->title, MwVaApply(f->title,

View file

@ -30,7 +30,7 @@ static int calc_size(MwWidget box, xl_node_t* node) {
} }
static void exec_button(MwWidget handle, void* user, void* client) { static void exec_button(MwWidget handle, void* user, void* client) {
char** args = MDEStringToExec(MwGetText(handle, "Sexec"), NULL); char** args = MDEStringToExec(MwGetString(handle, "Sexec"), NULL);
int i; int i;
if(fork() == 0) { if(fork() == 0) {
@ -55,7 +55,7 @@ void module_reload(MwWidget box, MwWidget user, xl_node_t* node) {
if(children != NULL) { if(children != NULL) {
int i; int i;
for(i = 0; children[i] != NULL; i++) { for(i = 0; children[i] != NULL; i++) {
MwLLPixmap px = MwGetVoid(children[i], MwNpixmap); MwLLPixmap px = MwGetPointer(children[i], MwNpixmap);
if(px != NULL) MwLLDestroyPixmap(px); if(px != NULL) MwLLDestroyPixmap(px);
@ -137,7 +137,7 @@ void module_destroy(MwWidget box, MwWidget user) {
if(children != NULL) { if(children != NULL) {
int i; int i;
for(i = 0; children[i] != NULL; i++) { for(i = 0; children[i] != NULL; i++) {
MwLLPixmap px = MwGetVoid(children[i], MwNpixmap); MwLLPixmap px = MwGetPointer(children[i], MwNpixmap);
if(px != NULL) MwLLDestroyPixmap(px); if(px != NULL) MwLLDestroyPixmap(px);

View file

@ -16,15 +16,15 @@
#define TriW 5 #define TriW 5
typedef struct opaque { typedef struct opaque {
MwLLPixmap closed; MwPixmap closed;
MwLLPixmap opened; MwPixmap opened;
MwWidget submenu; MwWidget submenu;
int is_opened; int is_opened;
MwMenu menu; MwMenu menu;
MwMenu current; MwMenu current;
MwLLPixmap stripe; MwPixmap stripe;
char* stripe_color; char* stripe_color;
char* name; char* name;
char* category; char* category;
@ -367,7 +367,7 @@ void module_reload(MwWidget box, MwWidget user, xl_node_t* node) {
} else if(n->type == XL_NODE_NODE && strcmp(n->name, "Stripe") == 0) { } else if(n->type == XL_NODE_NODE && strcmp(n->name, "Stripe") == 0) {
xl_attribute_t* a; xl_attribute_t* a;
if(opaque->stripe != NULL) MwLLDestroyPixmap(opaque->stripe); if(opaque->stripe != NULL) MwDestroyPixmap(opaque->stripe);
opaque->stripe = MwLoadImage(box, n->text == NULL ? "" : n->text); opaque->stripe = MwLoadImage(box, n->text == NULL ? "" : n->text);
a = n->first_attribute; a = n->first_attribute;
@ -394,8 +394,8 @@ void module_reload(MwWidget box, MwWidget user, xl_node_t* node) {
} }
MwWidget module(MwWidget box, xl_node_t* node) { MwWidget module(MwWidget box, xl_node_t* node) {
MwLLPixmap closed = NULL; MwPixmap closed = NULL;
MwLLPixmap opened = NULL; MwPixmap opened = NULL;
MwWidget btn; MwWidget btn;
int w, h; int w, h;
unsigned int ch; unsigned int ch;
@ -477,10 +477,10 @@ MwWidget module(MwWidget box, xl_node_t* node) {
void module_destroy(MwWidget box, MwWidget user) { void module_destroy(MwWidget box, MwWidget user) {
opaque_t* opaque = user->opaque; opaque_t* opaque = user->opaque;
MwLLDestroyPixmap(opaque->closed); MwDestroyPixmap(opaque->closed);
MwLLDestroyPixmap(opaque->opened); MwDestroyPixmap(opaque->opened);
if(opaque->stripe != NULL) MwLLDestroyPixmap(opaque->stripe); if(opaque->stripe != NULL) MwDestroyPixmap(opaque->stripe);
if(opaque->stripe_color != NULL) free(opaque->stripe_color); if(opaque->stripe_color != NULL) free(opaque->stripe_color);
recursive_free(opaque->menu); recursive_free(opaque->menu);