mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Moving login manager to branches. Incomplete too
This commit is contained in:
parent
0bff00e8c3
commit
742064b04e
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Background.h"
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <edelib/Debug.h>
|
||||
|
||||
bool Background::load_images(const char* bpath, const char* ppath) {
|
||||
EASSERT(bpath != NULL);
|
||||
EASSERT(ppath != NULL);
|
||||
|
||||
fl_register_images();
|
||||
|
||||
// get background image first
|
||||
img = Fl_Shared_Image::get(bpath);
|
||||
if(!img)
|
||||
return false;
|
||||
|
||||
// scale if needed
|
||||
if(img->w() != w() && img->h() != h()) {
|
||||
Fl_Image* scaled = img->copy(w(), h());
|
||||
// Fl_Shared_Image contains correct pointers, so we can replace this
|
||||
img = scaled;
|
||||
}
|
||||
|
||||
// panel image
|
||||
panel_img = Fl_Shared_Image::get(ppath);
|
||||
if(!panel_img)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Background::draw(void) {
|
||||
if(img)
|
||||
img->draw(x(), y());
|
||||
|
||||
if(panel_img)
|
||||
panel_img->draw(x() + panel_img_x, y() + panel_img_y);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __BACKGROUND_H__
|
||||
#define __BACKGROUND_H__
|
||||
|
||||
#include <FL/Fl_Box.H>
|
||||
|
||||
class Fl_Image;
|
||||
|
||||
/*
|
||||
* Background composer; it will compose background image
|
||||
* with panel image and blend panel image on background if applicable.
|
||||
*
|
||||
* This class is intentionaly created (instead everything plop inside
|
||||
* one class) so in the future I can easily add scaled image smoothing
|
||||
* and (optinaly) better blending.
|
||||
*/
|
||||
class Background : public Fl_Box {
|
||||
private:
|
||||
Fl_Image* img;
|
||||
Fl_Image* panel_img;
|
||||
|
||||
int panel_img_x;
|
||||
int panel_img_y;
|
||||
public:
|
||||
Background(int X, int Y, int W, int H) : Fl_Box(X, Y, W, H, 0),
|
||||
img(0), panel_img(0), panel_img_x(0), panel_img_y(0) { }
|
||||
|
||||
~Background() { }
|
||||
|
||||
bool load_images(const char* bpath, const char* ppath);
|
||||
void panel_pos(int X, int Y) { panel_img_x = X; panel_img_y = Y; }
|
||||
virtual void draw(void);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "ElmaService.h"
|
||||
#include "ElmaWindow.h"
|
||||
|
||||
#include <edelib/Config.h>
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <stdlib.h>
|
||||
|
||||
ElmaService::ElmaService() : config(NULL), theme(NULL) {
|
||||
}
|
||||
|
||||
ElmaService::~ElmaService() {
|
||||
delete config;
|
||||
elma_theme_clear(theme);
|
||||
}
|
||||
|
||||
ElmaService* ElmaService::instance(void) {
|
||||
static ElmaService es;
|
||||
return &es;
|
||||
}
|
||||
|
||||
void ElmaService::execute(const char* cmd) {
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
bool ElmaService::load_config(void) {
|
||||
config = new ConfigData;
|
||||
|
||||
edelib::Config cfile;
|
||||
|
||||
if(!cfile.load("elma.conf"))
|
||||
return false;
|
||||
|
||||
char buff[256];
|
||||
unsigned int buffsz = sizeof(buff);
|
||||
|
||||
if(cfile.get("elma", "xserver", buff, buffsz))
|
||||
config->xserver_cmd = buff;
|
||||
|
||||
if(cfile.get("elma", "halt", buff, buffsz))
|
||||
config->halt_cmd = buff;
|
||||
|
||||
if(cfile.get("elma", "reboot", buff, buffsz))
|
||||
config->reboot_cmd = buff;
|
||||
|
||||
if(cfile.get("elma", "login_cmd", buff, buffsz))
|
||||
config->login_cmd = buff;
|
||||
|
||||
if(cfile.get("elma", "xauth", buff, buffsz))
|
||||
config->xauth_cmd = buff;
|
||||
|
||||
if(cfile.get("elma", "xauth_file", buff, buffsz))
|
||||
config->xauth_file = buff;
|
||||
|
||||
if(cfile.get("elma", "theme", buff, buffsz))
|
||||
config->theme = buff;
|
||||
|
||||
cfile.get("elma", "numlock", config->numlock, false);
|
||||
cfile.get("elma", "cursor", config->show_cursor, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ElmaService::load_theme(void) {
|
||||
theme = elma_theme_init("themes/default");
|
||||
|
||||
if(theme == NULL)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ElmaService::display_window(void) {
|
||||
fl_open_display();
|
||||
|
||||
int dx, dy, dw, dh;
|
||||
Fl::screen_xywh(dx, dy, dw, dh);
|
||||
|
||||
//numlock_xkb_init(fl_display);
|
||||
|
||||
ElmaWindow* win = new ElmaWindow(dw, dh);
|
||||
|
||||
if(!win->create_window(theme)) {
|
||||
delete win;
|
||||
return;
|
||||
}
|
||||
|
||||
win->clear_border();
|
||||
win->show();
|
||||
win->cursor(FL_CURSOR_NONE);
|
||||
|
||||
Fl::run();
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __ELMASERVICE_H__
|
||||
#define __ELMASERVICE_H__
|
||||
|
||||
#include "Theme.h"
|
||||
|
||||
struct ConfigData {
|
||||
edelib::String xserver_cmd;
|
||||
edelib::String halt_cmd;
|
||||
edelib::String reboot_cmd;
|
||||
edelib::String login_cmd;
|
||||
edelib::String xauth_cmd;
|
||||
|
||||
edelib::String xauth_file;
|
||||
edelib::String theme;
|
||||
|
||||
bool numlock;
|
||||
bool show_cursor;
|
||||
};
|
||||
|
||||
class ElmaService {
|
||||
private:
|
||||
ConfigData* config;
|
||||
ElmaTheme* theme;
|
||||
|
||||
void execute(const char* cmd);
|
||||
|
||||
public:
|
||||
ElmaService();
|
||||
~ElmaService();
|
||||
static ElmaService* instance(void);
|
||||
|
||||
bool load_config(void);
|
||||
bool load_theme(void);
|
||||
|
||||
void display_window(void);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,170 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <edelib/Debug.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "ElmaWindow.h"
|
||||
#include "Background.h"
|
||||
#include "TextArea.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#define USER_AND_PASS_BOX_VISIBLE 1
|
||||
#define USER_OR_PASS_BOX_VISIBLE 2
|
||||
|
||||
static void timeout_cb(void* e) {
|
||||
ElmaWindow* win = (ElmaWindow*)e;
|
||||
win->allow_input();
|
||||
}
|
||||
|
||||
ElmaWindow::ElmaWindow(int W, int H) : Fl_Double_Window(0, 0, W, H),
|
||||
bkg(0), user_in(0), pass_in(0), error_display(0), info_display(0) {
|
||||
|
||||
deny_mode = false;
|
||||
box_mode = USER_AND_PASS_BOX_VISIBLE;
|
||||
}
|
||||
|
||||
ElmaWindow::~ElmaWindow() {
|
||||
}
|
||||
|
||||
bool ElmaWindow::create_window(ElmaTheme* et) {
|
||||
EASSERT(et != NULL);
|
||||
|
||||
begin();
|
||||
bkg = new Background(0, 0, w(), h());
|
||||
if(!bkg->load_images(et->background.c_str(), et->panel.c_str()))
|
||||
return false;
|
||||
|
||||
bkg->panel_pos(et->panel_x, et->panel_y);
|
||||
|
||||
ThemeBox* tb;
|
||||
|
||||
tb = et->user;
|
||||
user_in = new TextArea(tb->x, tb->y, tb->w, tb->h);
|
||||
if(tb->label)
|
||||
user_in->label(tb->label->c_str());
|
||||
|
||||
user_in->labelcolor(FL_WHITE);
|
||||
user_in->textfont(FL_HELVETICA_BOLD);
|
||||
user_in->textsize(tb->font_size);
|
||||
|
||||
tb = et->pass;
|
||||
pass_in = new TextArea(tb->x, tb->y, tb->w, tb->h);
|
||||
if(tb->label)
|
||||
pass_in->label(tb->label->c_str());
|
||||
|
||||
pass_in->type(FL_SECRET_INPUT);
|
||||
pass_in->labelcolor(FL_WHITE);
|
||||
pass_in->textfont(FL_HELVETICA_BOLD);
|
||||
pass_in->textsize(tb->font_size);
|
||||
|
||||
/*
|
||||
* If username box and password box are at the same place, hide
|
||||
* password box. With this, password box will be shown when user
|
||||
* press enter on username box and reverse.
|
||||
*/
|
||||
if(pass_in->x() == user_in->x() && pass_in->y() == user_in->y()) {
|
||||
box_mode = USER_OR_PASS_BOX_VISIBLE;
|
||||
pass_in->hide();
|
||||
}
|
||||
|
||||
tb = et->error;
|
||||
error_display = new Fl_Box(tb->x, tb->y, tb->w, tb->h);
|
||||
error_display->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_CLIP);
|
||||
error_display->labelcolor(FL_WHITE);
|
||||
error_display->labelsize(tb->font_size);
|
||||
error_display->hide();
|
||||
|
||||
tb = et->info;
|
||||
info_display = new Fl_Box(tb->x, tb->y, tb->w, tb->h);
|
||||
info_display->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_CLIP);
|
||||
info_display->labelcolor(FL_GRAY);
|
||||
if(tb->label)
|
||||
info_display->label(tb->label->c_str());
|
||||
end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ElmaWindow::validate_user(void) {
|
||||
EDEBUG("username: %s\n", user_in->value() ? user_in->value() : "none");
|
||||
EDEBUG("password: %s\n", pass_in->value() ? pass_in->value() : "none");
|
||||
|
||||
error_display->show();
|
||||
error_display->label("Bad username or password");
|
||||
|
||||
deny_input();
|
||||
|
||||
Fl::add_timeout(3.0, timeout_cb, this);
|
||||
}
|
||||
|
||||
void ElmaWindow::allow_input(void) {
|
||||
deny_mode = false;
|
||||
|
||||
if(error_display->visible()) {
|
||||
error_display->hide();
|
||||
error_display->label(0);
|
||||
}
|
||||
|
||||
if(user_in->visible())
|
||||
user_in->activate();
|
||||
if(pass_in->visible())
|
||||
pass_in->activate();
|
||||
}
|
||||
|
||||
void ElmaWindow::deny_input(void) {
|
||||
deny_mode = true;
|
||||
|
||||
if(user_in->visible())
|
||||
user_in->deactivate();
|
||||
if(pass_in->visible())
|
||||
pass_in->deactivate();
|
||||
}
|
||||
|
||||
int ElmaWindow::handle(int event) {
|
||||
if(event == FL_KEYBOARD) {
|
||||
if(deny_mode)
|
||||
return 1;
|
||||
|
||||
if(Fl::event_key() == FL_Enter) {
|
||||
if(box_mode == USER_AND_PASS_BOX_VISIBLE) {
|
||||
if(Fl::focus() == user_in)
|
||||
Fl::focus(pass_in);
|
||||
else {
|
||||
validate_user();
|
||||
// don't remember password
|
||||
pass_in->value(0);
|
||||
Fl::focus(user_in);
|
||||
}
|
||||
} else {
|
||||
if(user_in->visible()) {
|
||||
user_in->hide();
|
||||
pass_in->show();
|
||||
// don't remember password
|
||||
pass_in->value(0);
|
||||
} else {
|
||||
user_in->show();
|
||||
pass_in->hide();
|
||||
|
||||
validate_user();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Fl_Double_Window::handle(event);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __ELMAWINDOW_H__
|
||||
#define __ELMAWINDOW_H__
|
||||
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
|
||||
class Background;
|
||||
class TextArea;
|
||||
class Fl_Box;
|
||||
struct ElmaTheme;
|
||||
|
||||
class ElmaWindow : public Fl_Double_Window {
|
||||
private:
|
||||
Background* bkg;
|
||||
TextArea* user_in;
|
||||
TextArea* pass_in;
|
||||
Fl_Box* error_display;
|
||||
Fl_Box* info_display;
|
||||
bool deny_mode;
|
||||
int box_mode;
|
||||
|
||||
void validate_user(void);
|
||||
|
||||
public:
|
||||
ElmaWindow(int W, int H);
|
||||
~ElmaWindow();
|
||||
|
||||
void allow_input(void);
|
||||
void deny_input(void);
|
||||
|
||||
bool create_window(ElmaTheme* et);
|
||||
virtual int handle(int event);
|
||||
};
|
||||
#endif
|
16
elma/Jamfile
16
elma/Jamfile
@ -1,16 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Part of Equinox Desktop Environment (EDE).
|
||||
# Copyright (c) 2008 EDE Authors.
|
||||
#
|
||||
# This program is licensed under terms of the
|
||||
# GNU General Public License version 2 or newer.
|
||||
# See COPYING for details.
|
||||
|
||||
SubDir TOP elma ;
|
||||
|
||||
SOURCE = Background.cpp NumLock.cpp Theme.cpp ElmaService.cpp ElmaWindow.cpp elma.cpp ;
|
||||
|
||||
EdeProgram elma : $(SOURCE) ;
|
||||
TranslationStrings locale : $(SOURCE) ;
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
*
|
||||
* Based on SLiM (Simple Login Manager) numlock code by:
|
||||
* Copyright (C) 2004-06 Simone Rota <sip@varlock.com>
|
||||
* Copyright (C) 2004-06 Johannes Winkelmann <jw@tks6.net>
|
||||
*
|
||||
* which in turn they ripped from KDE and nicely provide authors
|
||||
* so I'm doing that too:
|
||||
*
|
||||
* Copyright (C) 2000-2001 Lubos Lunak <l.lunak@kde.org>
|
||||
* Copyright (C) 2001 Oswald Buddenhagen <ossi@kde.org>
|
||||
*
|
||||
* And for else, blame me (Sanel).
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "NumLock.h"
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <string.h>
|
||||
|
||||
static unsigned int numlock_mask(Display* dpy) {
|
||||
XkbDescPtr xkb = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd);
|
||||
if(xkb == NULL)
|
||||
return 0;
|
||||
|
||||
char* modstr;
|
||||
unsigned int mask = 0;
|
||||
|
||||
for(int i = 0; i < XkbNumVirtualMods; i++) {
|
||||
modstr = XGetAtomName(xkb->dpy, xkb->names->vmods[i]);
|
||||
if(modstr != NULL && strcmp(modstr, "NumLock") == 0) {
|
||||
XkbVirtualModsToReal(xkb, 1 << i, &mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XkbFreeKeyboard(xkb, 0, True);
|
||||
return mask;
|
||||
}
|
||||
|
||||
bool numlock_xkb_init(Display* dpy) {
|
||||
int opcode, event, error;
|
||||
int maj, min;
|
||||
|
||||
return XkbLibraryVersion(&maj, &min) && XkbQueryExtension(dpy, &opcode, &event, &error, &maj, &min);
|
||||
}
|
||||
|
||||
void numlock_on(Display* dpy) {
|
||||
unsigned int mask = numlock_mask(dpy);
|
||||
if(!mask)
|
||||
return;
|
||||
XkbLockModifiers(dpy, XkbUseCoreKbd, mask, mask);
|
||||
}
|
||||
|
||||
void numlock_off(Display* dpy) {
|
||||
unsigned int mask = numlock_mask(dpy);
|
||||
if(!mask)
|
||||
return;
|
||||
XkbLockModifiers(dpy, XkbUseCoreKbd, mask, 0);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __NUMLOCK_H__
|
||||
#define __NUMLOCK_H__
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
bool numlock_xkb_init(Display* dpy);
|
||||
void numlock_on(Display* dpy);
|
||||
void numlock_off(Display* dpy);
|
||||
|
||||
#endif
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __TEXTAREA_H__
|
||||
#define __TEXTAREA_H__
|
||||
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <edelib/Debug.h>
|
||||
|
||||
/*
|
||||
* Creates Fl_Input-like widget, but without any box. It is not the same as
|
||||
* Fl_Input::box(FL_NO_BOX) because box is not drawn and Fl_Input will not
|
||||
* redraw itself on changes. As help, we request from parent to redraw region
|
||||
* where this widget resides.
|
||||
*/
|
||||
class TextArea : public Fl_Input {
|
||||
public:
|
||||
TextArea(int X, int Y, int W, int H, const char* l = 0) : Fl_Input(X, Y, W, H, l) {
|
||||
box(FL_NO_BOX);
|
||||
}
|
||||
|
||||
~TextArea() { }
|
||||
|
||||
virtual int handle(int event) {
|
||||
// FLTK can send FL_NO_EVENT, so be carefull
|
||||
if(!event)
|
||||
return 0;
|
||||
|
||||
// not needed, parent will redraw us
|
||||
if(event == FL_SHOW || event == FL_HIDE)
|
||||
return 1;
|
||||
|
||||
// don't allow input when we are disabled
|
||||
if(event == FL_KEYBOARD && !active())
|
||||
return 1;
|
||||
|
||||
int ret = Fl_Input::handle(event);
|
||||
if(ret);
|
||||
parent()->damage(FL_DAMAGE_ALL, x(), y(), w(), h());
|
||||
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
128
elma/Theme.cpp
128
elma/Theme.cpp
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Theme.h"
|
||||
#include <edelib/Config.h>
|
||||
#include <edelib/File.h>
|
||||
#include <edelib/Debug.h>
|
||||
|
||||
#define DEFAULT_THEME_FILE "elma.theme"
|
||||
|
||||
ElmaTheme* elma_theme_init(const char* directory) {
|
||||
edelib::String path;
|
||||
path.printf("%s/%s", directory, DEFAULT_THEME_FILE);
|
||||
|
||||
edelib::Config conf;
|
||||
|
||||
if(!conf.load(path.c_str())) {
|
||||
EWARNING(ESTRLOC ": Can' load %s\n", path.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ElmaTheme* et = new ElmaTheme;
|
||||
char buff[1024];
|
||||
|
||||
conf.get("theme", "background", buff, sizeof(buff));
|
||||
et->background.printf("%s/%s", directory, buff);
|
||||
|
||||
conf.get("theme", "panel", buff, sizeof(buff));
|
||||
et->panel.printf("%s/%s", directory, buff);
|
||||
|
||||
conf.get("theme", "panel_x", et->panel_x, 5);
|
||||
conf.get("theme", "panel_y", et->panel_y, 5);
|
||||
|
||||
ThemeBox* info = new ThemeBox;
|
||||
|
||||
conf.get("theme", "info_x", info->x, 5);
|
||||
conf.get("theme", "info_y", info->y, 5);
|
||||
conf.get("theme", "info_width", info->w, 5);
|
||||
conf.get("theme", "info_height", info->h, 5);
|
||||
conf.get("theme", "info_color", info->font_color, 255); // FL_WHITE default
|
||||
conf.get("theme", "info_font_size", info->font_size, 12);
|
||||
if(conf.get("theme", "info_text", buff, sizeof(buff)))
|
||||
info->label = new edelib::String(buff);
|
||||
else
|
||||
info->label = NULL;
|
||||
|
||||
et->info = info;
|
||||
|
||||
ThemeBox* user = new ThemeBox;
|
||||
|
||||
conf.get("theme", "username_x", user->x, 10);
|
||||
conf.get("theme", "username_y", user->y, 10);
|
||||
conf.get("theme", "username_width", user->w, 95);
|
||||
conf.get("theme", "username_height", user->h, 25);
|
||||
conf.get("theme", "username_color", user->font_color, 255); // FL_WHITE default
|
||||
conf.get("theme", "username_font_size", user->font_size, 12);
|
||||
if(conf.get("theme", "username_text", buff, sizeof(buff))) {
|
||||
user->label = new edelib::String(buff);
|
||||
// append few spaces
|
||||
*(user->label) += " ";
|
||||
} else
|
||||
user->label = NULL;
|
||||
|
||||
et->user = user;
|
||||
|
||||
ThemeBox* pass = new ThemeBox;
|
||||
|
||||
conf.get("theme", "password_x", pass->x, 50);
|
||||
conf.get("theme", "password_y", pass->y, 50);
|
||||
conf.get("theme", "password_width", pass->w, 95);
|
||||
conf.get("theme", "password_height", pass->h, 25);
|
||||
conf.get("theme", "password_color", pass->font_color, 255); // FL_WHITE default
|
||||
conf.get("theme", "password_font_size", pass->font_size, 12);
|
||||
if(conf.get("theme", "password_text", buff, sizeof(buff))) {
|
||||
pass->label = new edelib::String(buff);
|
||||
// append few spaces
|
||||
*(pass->label) += " ";
|
||||
} else
|
||||
pass->label = NULL;
|
||||
|
||||
et->pass = pass;
|
||||
|
||||
ThemeBox* error = new ThemeBox;
|
||||
|
||||
conf.get("theme", "error_x", error->x, 30);
|
||||
conf.get("theme", "error_y", error->y, 30);
|
||||
conf.get("theme", "error_width", error->w, 100);
|
||||
conf.get("theme", "error_height", error->h, 25);
|
||||
conf.get("theme", "error_color", error->font_color, 255); // FL_WHITE default
|
||||
conf.get("theme", "error_font_size", error->font_size, 12); // FL_WHITE default
|
||||
error->label = NULL;
|
||||
|
||||
et->error = error;
|
||||
|
||||
return et;
|
||||
}
|
||||
|
||||
void elma_theme_clear(ElmaTheme* et) {
|
||||
if(!et)
|
||||
return;
|
||||
|
||||
if(et->info) {
|
||||
delete et->info->label;
|
||||
delete et->info;
|
||||
}
|
||||
|
||||
if(et->user) {
|
||||
delete et->user->label;
|
||||
delete et->user;
|
||||
}
|
||||
|
||||
if(et->pass) {
|
||||
delete et->pass->label;
|
||||
delete et->pass;
|
||||
}
|
||||
|
||||
delete et->error;
|
||||
delete et;
|
||||
}
|
41
elma/Theme.h
41
elma/Theme.h
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifndef __THEME_H__
|
||||
#define __THEME_H__
|
||||
|
||||
#include <edelib/String.h>
|
||||
|
||||
struct ThemeBox {
|
||||
int x, y, w, h;
|
||||
int font_color;
|
||||
int font_size;
|
||||
edelib::String* label;
|
||||
};
|
||||
|
||||
struct ElmaTheme {
|
||||
ThemeBox* info;
|
||||
ThemeBox* user;
|
||||
ThemeBox* pass;
|
||||
ThemeBox* error;
|
||||
|
||||
int panel_x;
|
||||
int panel_y;
|
||||
edelib::String panel;
|
||||
|
||||
edelib::String background;
|
||||
};
|
||||
|
||||
ElmaTheme* elma_theme_init(const char* directory);
|
||||
void elma_theme_clear(ElmaTheme* et);
|
||||
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
[elma]
|
||||
|
||||
# path for X server
|
||||
xserver = /usr/X11R6/bin/X
|
||||
|
||||
# commands for login and halt
|
||||
halt = /sbin/shutdown -h now
|
||||
reboot = /sbin/shutdown -r now
|
||||
|
||||
# full path to xauth binary
|
||||
xauth = /usr/X11R6/bin/xauth
|
||||
|
||||
# xauth file for server
|
||||
xauth_file = /var/run/elma.auth
|
||||
|
||||
# login command, executed after succesful login
|
||||
# NOTE: if you don't have bash you have to adjust
|
||||
# the command to default or prefered shell
|
||||
# i.e. for freebsd use:
|
||||
# login_cmd = exec /bin/sh - ~/.xinitrc
|
||||
|
||||
login_cmd = exec /bin/bash -login ~/.xinitrc
|
||||
|
||||
# default theme
|
||||
theme = default
|
||||
|
||||
# enable/disable NumLock (1/0, true/false)
|
||||
numlock = true
|
||||
|
||||
# enable/disable cursor
|
||||
cursor = true
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ELMA, Ede Login MAnager
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2008 EDE Authors.
|
||||
*
|
||||
* This program is licensed under terms of the
|
||||
* GNU General Public License version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0
|
||||
#include <string.h>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <edelib/String.h>
|
||||
#include <edelib/Config.h>
|
||||
|
||||
#include "Background.h"
|
||||
#include "TextArea.h"
|
||||
#include "ElmaWindow.h"
|
||||
#include "NumLock.h"
|
||||
#endif
|
||||
|
||||
#include "ElmaService.h"
|
||||
|
||||
#define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0))
|
||||
|
||||
void help(void) {
|
||||
puts("Usage: elma [OPTIONS]");
|
||||
puts("EDE login manager responsible to log you into X seesion");
|
||||
puts("and initiate EDE startup\n");
|
||||
puts("Options:");
|
||||
puts(" -h, --help this help");
|
||||
puts(" -c, --config [FILE] use FILE as config file");
|
||||
puts(" -d, --daemon daemon mode");
|
||||
puts(" -t, --test test mode for theme preview (assume X server is running)\n");
|
||||
}
|
||||
|
||||
const char* next_param(int curr, char** argv, int argc) {
|
||||
int j = curr + 1;
|
||||
if(j >= argc)
|
||||
return NULL;
|
||||
if(argv[j][0] == '-')
|
||||
return NULL;
|
||||
return argv[j];
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
const char* config_file = NULL;
|
||||
bool test_mode = false;
|
||||
bool daemon_mode = false;
|
||||
|
||||
if(argc > 1) {
|
||||
const char* a;
|
||||
for(int i = 1; i < argc; i++) {
|
||||
a = argv[i];
|
||||
if(CHECK_ARGV(a, "-h", "--help")) {
|
||||
help();
|
||||
return 0;
|
||||
} else if(CHECK_ARGV(a, "-c", "--config")) {
|
||||
config_file = next_param(i, argv, argc);
|
||||
if(!config_file) {
|
||||
puts("Missing configuration filename");
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
} else if(CHECK_ARGV(a, "-d", "--daemon")) {
|
||||
daemon_mode = true;
|
||||
} else if(CHECK_ARGV(a, "-t", "--test")) {
|
||||
test_mode = true;
|
||||
} else {
|
||||
printf("Unknown parameter '%s'. Run 'elma -h' for options\n", a);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ElmaService* service = ElmaService::instance();
|
||||
|
||||
if(!service->load_config()) {
|
||||
puts("Unable to load config file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!service->load_theme()) {
|
||||
puts("Unable to load theme file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
service->display_window();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
The wallpaper is copyright (c) by Martina Woll
|
||||
http://www.martinawoll.de
|
Binary file not shown.
Before Width: | Height: | Size: 389 KiB |
@ -1,52 +0,0 @@
|
||||
#
|
||||
# Default theme inspired with one of the SLiM themes.
|
||||
#
|
||||
# Shows usage when username and password box are at the
|
||||
# same x/y positions.
|
||||
#
|
||||
# Blame Sanel for this...
|
||||
|
||||
[theme]
|
||||
|
||||
# background image
|
||||
background = background.jpg
|
||||
|
||||
# panel image
|
||||
panel = panel.png
|
||||
panel_x = 235
|
||||
panel_y = 489
|
||||
|
||||
# info box
|
||||
info_x = 10
|
||||
info_y = 10
|
||||
info_width = 484
|
||||
info_height = 28
|
||||
info_text = Welcome to EDE 2.0
|
||||
info_color = 12
|
||||
info_font_size = 12
|
||||
|
||||
# username box
|
||||
username_x = 240
|
||||
username_y = 489
|
||||
username_width = 184
|
||||
username_height = 30
|
||||
username_color = 12
|
||||
username_font_size = 12
|
||||
username_text = Username:
|
||||
|
||||
# password box
|
||||
password_x = 240
|
||||
password_y = 489
|
||||
password_width = 184
|
||||
password_height = 30
|
||||
password_color = 12
|
||||
password_font_size = 12
|
||||
password_text = Password:
|
||||
|
||||
# error box
|
||||
error_x = 240
|
||||
error_y = 520
|
||||
error_width = 184
|
||||
error_height = 28
|
||||
error_font_size = 12
|
||||
error_color = 12
|
Binary file not shown.
Before Width: | Height: | Size: 278 B |
@ -1,3 +0,0 @@
|
||||
http://whitestar98.deviantart.com
|
||||
|
||||
http://whitestar98.deviantart.com/art/fragile-33934982
|
Binary file not shown.
Before Width: | Height: | Size: 147 KiB |
@ -1 +0,0 @@
|
||||
http://whitestar98.deviantart.com
|
Binary file not shown.
Before Width: | Height: | Size: 142 KiB |
@ -1,3 +0,0 @@
|
||||
http://whitestar98.deviantart.com
|
||||
|
||||
http://whitestar98.deviantart.com/art/painted-sky-35289794
|
Binary file not shown.
Before Width: | Height: | Size: 64 KiB |
@ -1,50 +0,0 @@
|
||||
#
|
||||
# sky theme
|
||||
#
|
||||
# Shows usage when username and password box have
|
||||
# different x/y positions and are given without labels.
|
||||
#
|
||||
# Blame Sanel for this...
|
||||
|
||||
[theme]
|
||||
|
||||
# background image
|
||||
background = background.jpg
|
||||
|
||||
# panel image
|
||||
panel = panel.png
|
||||
panel_x = 347
|
||||
panel_y = 251
|
||||
|
||||
# info box
|
||||
info_x = 10
|
||||
info_y = 10
|
||||
info_width = 484
|
||||
info_height = 28
|
||||
info_text = Welcome to EDE 2.0
|
||||
info_color = 12
|
||||
info_font_size = 12
|
||||
|
||||
# username box
|
||||
username_x = 418
|
||||
username_y = 379
|
||||
username_width = 184
|
||||
username_height = 30
|
||||
username_color = 12
|
||||
username_font_size = 12
|
||||
|
||||
# password box
|
||||
password_x = 418
|
||||
password_y = 431
|
||||
password_width = 184
|
||||
password_height = 30
|
||||
password_color = 12
|
||||
password_font_size = 12
|
||||
|
||||
# error box
|
||||
error_x = 418
|
||||
error_y = 471
|
||||
error_width = 184
|
||||
error_height = 28
|
||||
error_font_size = 14
|
||||
error_color = 12
|
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
Loading…
Reference in New Issue
Block a user