several fixes

This commit is contained in:
Nishi 2026-04-12 08:03:59 +09:00
commit 2d330bdb80
Signed by: nishi
GPG key ID: 27EF69B208EB9343
6 changed files with 35 additions and 7 deletions

View file

@ -17,6 +17,8 @@ char* name_line = NULL;
char* try_exec_line = NULL;
char* exec_line = NULL;
char* desktop_names_line = NULL;
int session_count = 0;
int mde_count = -1;
static void add_user(const char* name, void* user) {
MwComboBoxAdd(user, -1, name);
@ -60,6 +62,11 @@ static void add_session(session_type_t session_type, const char* path, int dir,
if(i == shlen(sessions)) {
MwComboBoxAdd(user, -1, name_line);
if(strcmp(name_line, "MDE") == 0) {
mde_count = session_count;
}
session_count++;
value->run = exec_line;
value->try_run = try_exec_line;
value->session_type = session_type;
@ -199,11 +206,11 @@ void login_window(void) {
pic = MwVaCreateWidget(MwImageClass, "image", window, 10, 10, 80, 137,
MwNhasBorder, 1,
NULL);
userlabel = MwVaCreateWidget(MwLabelClass, "userlabel", window, 95, 10, MwTextWidth(window, "User:"), 16,
userlabel = MwVaCreateWidget(MwLabelClass, "userlabel", window, 95, 10, MwTextWidth(window, NULL, "User:"), 16,
MwNtext, "User:",
NULL);
usercombo = MwCreateWidget(MwComboBoxClass, "usercombo", window, 95, 10 + 16 + 5, 265, 18);
passlabel = MwVaCreateWidget(MwLabelClass, "passlabel", window, 95, 10 + 16 + 5 + 18 + 5, MwTextWidth(window, "Password:"), 16,
passlabel = MwVaCreateWidget(MwLabelClass, "passlabel", window, 95, 10 + 16 + 5 + 18 + 5, MwTextWidth(window, NULL, "Password:"), 16,
MwNtext, "Password:",
NULL);
passentry = MwVaCreateWidget(MwEntryClass, "passentry", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5, 265, 18,
@ -212,7 +219,7 @@ void login_window(void) {
mainsep = MwVaCreateWidget(MwSeparatorClass, "mainsep", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18, 265, 10,
MwNorientation, MwHORIZONTAL,
NULL);
sesslabel = MwVaCreateWidget(MwLabelClass, "sesslabel", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10, MwTextWidth(window, "Session Type:"), 16,
sesslabel = MwVaCreateWidget(MwLabelClass, "sesslabel", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10, MwTextWidth(window, NULL, "Session Type:"), 16,
MwNtext, "Session Type:",
NULL);
sesscombo = MwCreateWidget(MwComboBoxClass, "sesscombo", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10 + 16 + 5, 265, 18);
@ -243,11 +250,21 @@ void login_window(void) {
shfree(sessions);
sh_new_strdup(sessions);
shdefault(sessions, NULL);
mde_count = -1;
session_count = 0;
MDEDirectoryScan(DATAROOTDIR "/xsessions", add_session_x, sesscombo);
MDEDirectoryScan("/usr/share/xsessions", add_session_x, sesscombo);
MDEDirectoryScan(DATAROOTDIR "/wayland-sessions", add_session_wayland, sesscombo);
MDEDirectoryScan("/usr/share/wayland-sessions", add_session_wayland, sesscombo);
if(mde_count != -1) {
MwVaApply(sesscombo,
MwNvalue, mde_count,
NULL);
}
pthread_mutex_unlock(&xmutex);
while(1) {

View file

@ -9,6 +9,8 @@ void rehash(int sig) {
int main() {
int st;
MwLibraryInit();
wm_config_init();
wm_config_read();

View file

@ -41,8 +41,6 @@ void loop_wm(void) {
pthread_mutex_lock(&xmutex);
MwLibraryInit();
root = MwVaCreateWidget(NULL, "root", NULL, 0, 0, 0, 0,
COMMON_LOOK,
NULL);

View file

@ -661,8 +661,8 @@ void loop_x(void) {
if(ret) continue;
if(i != arrlen(windows)) {
XWindowAttributes xwa;
int rev;
Window cfocus;
int rev;
Window cfocus;
if(!XGetWindowAttributes(xdisplay, windows[i].client, &xwa)) {
wm_destroy(windows[i].frame);

View file

@ -7,3 +7,8 @@ install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startmde
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mde.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xsessions
)

6
startmde/mde.desktop Normal file
View file

@ -0,0 +1,6 @@
[Desktop Entry]
Name=MDE
Comment=Milk Desktop Experience
Exec=startmde
Type=Application
Keywords=desktop