can load image now
This commit is contained in:
parent
10df6ece35
commit
2f6a6b764f
7 changed files with 46 additions and 19 deletions
16
mdm/config.c
16
mdm/config.c
|
|
@ -1 +1,17 @@
|
|||
#include "mdm.h"
|
||||
|
||||
#include <ini.h>
|
||||
|
||||
char* config_picture = NULL;
|
||||
|
||||
static int dumper(void* user, const char* section, const char* name, const char* value){
|
||||
if(strcmp(section, "MDM Config") != 0) return 1;
|
||||
|
||||
if(strcmp(name, "Picture") == 0) config_picture = MDEStringDuplicate(value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void parse_config(void){
|
||||
ini_parse(CONFDIR "/mdm/mdmrc", dumper, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
void login_window(void){
|
||||
MwWidget window, pic, userlabel, usercombo, passlabel, passentry, mainsep, sesslabel, sesscombo, fieldsep, shutdown, reboot, ok;
|
||||
MwLLPixmap p;
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
|
|
@ -11,6 +12,7 @@ void login_window(void){
|
|||
MwNhasBorder, 1,
|
||||
MwNinverted, 0,
|
||||
NULL);
|
||||
p = config_picture == NULL ? NULL : MwLoadImage(window, config_picture);
|
||||
pic = MwVaCreateWidget(MwImageClass, "image", window, 10, 10, 80, 137,
|
||||
MwNhasBorder, 1,
|
||||
NULL);
|
||||
|
|
@ -44,5 +46,7 @@ void login_window(void){
|
|||
MwNtext, "OK",
|
||||
NULL);
|
||||
|
||||
if(p != NULL) MwVaApply(pic, MwNpixmap, p, NULL);
|
||||
|
||||
MwLoop(window);
|
||||
}
|
||||
|
|
|
|||
11
mdm/main.c
11
mdm/main.c
|
|
@ -1,14 +1,5 @@
|
|||
#include "mdm.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <MDE/File.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int is_launch_x = 1;
|
||||
|
||||
int main(int argc, char** argv){
|
||||
|
|
@ -28,6 +19,8 @@ int main(int argc, char** argv){
|
|||
if(access(CONFDIR "/mdm", F_OK) != 0) mkdir(CONFDIR "/mdm", 0755);
|
||||
if(access(CONFDIR "/mdm/mdmrc", F_OK) != 0) MDEFileCopy(DATADIR "/examples/mdm/mdmrc", CONFDIR "/mdm/mdmrc");
|
||||
|
||||
parse_config();
|
||||
|
||||
if(is_launch_x){
|
||||
if((st = launch_x()) != 0) return st;
|
||||
}
|
||||
|
|
|
|||
18
mdm/mdm.h
18
mdm/mdm.h
|
|
@ -1,6 +1,19 @@
|
|||
#ifndef __MDM_H__
|
||||
#define __MDM_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <MDE/Foundation.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* xserver.c */
|
||||
int launch_x(void);
|
||||
int x_width(void);
|
||||
|
|
@ -10,4 +23,9 @@ void init_x(void);
|
|||
/* login.c */
|
||||
void login_window(void);
|
||||
|
||||
/* config.c */
|
||||
extern char* config_picture;
|
||||
|
||||
void parse_config(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
[MDM Entry]
|
||||
[MDM Config]
|
||||
Picture=@CMAKE_INSTALL_FULL_DATAROOTDIR@/mdm/mdm.png
|
||||
|
|
|
|||
5
mdm/pam
Normal file
5
mdm/pam
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
auth required pam_unix.so
|
||||
auth required pam_nologin.so
|
||||
account required pam_unix.so
|
||||
password required pam_unix.so
|
||||
session required pam_unix.so
|
||||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static pid_t x_server;
|
||||
static int got_usr1;
|
||||
static Display* display;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue