1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-03-14 23:33:36 +01:00

Added slim dm with home made patch for keyboard shortcuts

This commit is contained in:
root
2010-08-18 21:58:38 +02:00
parent 2061de50a2
commit ab932074c8
8 changed files with 546 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
--- app.cpp.orig 2009-01-13 11:30:36.000000000 +0900
+++ app.cpp 2009-01-13 11:32:27.000000000 +0900
@@ -270,21 +270,22 @@
signal(SIGALRM, AlarmSignal);
#ifndef XNEST_DEBUG
- OpenLog();
-
if (!force_nodaemon && cfg->getOption("daemon") == "yes") {
daemonmode = true;
}
// Daemonize
if (daemonmode) {
- if (daemon(0, 1) == -1) {
+ if (daemon(0, 0) == -1) {
cerr << APPNAME << ": " << strerror(errno) << endl;
exit(ERR_EXIT);
}
- UpdatePid();
}
+ OpenLog();
+
+ if (daemonmode) UpdatePid();
+
CreateServerAuth();
StartServer();
alarm(2);

View File

@@ -0,0 +1,89 @@
diff -rc slim-1.3.1-orig/app.cpp slim-1.3.1/app.cpp
*** slim-1.3.1-orig/app.cpp 2008-09-26 02:54:15.000000000 +0200
--- slim-1.3.1/app.cpp 2009-02-17 19:50:06.000000000 +0100
***************
*** 41,48 ****
Panel* panel = *static_cast<Panel**>(appdata_ptr);
int result = PAM_SUCCESS;
for (int i=0; i<num_msg; i++){
! resp[i]->resp=0;
! resp[i]->resp_retcode=0;
switch(msg[i]->msg_style){
case PAM_PROMPT_ECHO_ON:
// We assume PAM is asking for the username
--- 41,48 ----
Panel* panel = *static_cast<Panel**>(appdata_ptr);
int result = PAM_SUCCESS;
for (int i=0; i<num_msg; i++){
! (*resp)[i].resp=0;
! (*resp)[i].resp_retcode=0;
switch(msg[i]->msg_style){
case PAM_PROMPT_ECHO_ON:
// We assume PAM is asking for the username
***************
*** 51,63 ****
case Panel::Suspend:
case Panel::Halt:
case Panel::Reboot:
! resp[i]->resp=strdup("root");
break;
case Panel::Console:
case Panel::Exit:
case Panel::Login:
! resp[i]->resp=strdup(panel->GetName().c_str());
break;
}
break;
--- 51,63 ----
case Panel::Suspend:
case Panel::Halt:
case Panel::Reboot:
! (*resp)[i].resp=strdup("root");
break;
case Panel::Console:
case Panel::Exit:
case Panel::Login:
! (*resp)[i].resp=strdup(panel->GetName().c_str());
break;
}
break;
***************
*** 73,79 ****
default:
panel->EventHandler(Panel::Get_Passwd);
! resp[i]->resp=strdup(panel->GetPasswd().c_str());
break;
}
break;
--- 73,79 ----
default:
panel->EventHandler(Panel::Get_Passwd);
! (*resp)[i].resp=strdup(panel->GetPasswd().c_str());
break;
}
break;
***************
*** 89,97 ****
}
if (result!=PAM_SUCCESS){
for (int i=0; i<num_msg; i++){
! if (resp[i]->resp==0) continue;
! free(resp[i]->resp);
! resp[i]->resp=0;
};
free(*resp);
*resp=0;
--- 89,97 ----
}
if (result!=PAM_SUCCESS){
for (int i=0; i<num_msg; i++){
! if ((*resp)[i].resp==0) continue;
! free((*resp)[i].resp);
! (*resp)[i].resp=0;
};
free(*resp);
*resp=0;

View File

@@ -0,0 +1,143 @@
Index: trunk/app.h
===================================================================
--- trunk/app.h (revision 151)
+++ trunk/app.h (working copy)
@@ -34,6 +34,7 @@
~App();
void Run();
int GetServerPID();
+ void RestartServer();
void StopServer();
// Lock functions
@@ -48,7 +49,6 @@
void Console();
void Exit();
void KillAllClients(Bool top);
- void RestartServer();
void ReadConfig();
void OpenLog();
void CloseLog();
Index: trunk/app.cpp
===================================================================
--- trunk/app.cpp (revision 151)
+++ trunk/app.cpp (working copy)
@@ -100,6 +100,11 @@
extern App* LoginApp;
+int xioerror(Display *disp) {
+ LoginApp->RestartServer();
+ return 0;
+}
+
void CatchSignal(int sig) {
cerr << APPNAME << ": unexpected signal " << sig << endl;
LoginApp->StopServer();
@@ -107,19 +112,6 @@
exit(ERR_EXIT);
}
-
-void AlarmSignal(int sig) {
- int pid = LoginApp->GetServerPID();
- if(waitpid(pid, NULL, WNOHANG) == pid) {
- LoginApp->StopServer();
- LoginApp->RemoveLock();
- exit(OK_EXIT);
- }
- signal(sig, AlarmSignal);
- alarm(2);
-}
-
-
void User1Signal(int sig) {
signal(sig, User1Signal);
}
@@ -257,7 +249,6 @@
signal(SIGHUP, CatchSignal);
signal(SIGPIPE, CatchSignal);
signal(SIGUSR1, User1Signal);
- signal(SIGALRM, AlarmSignal);
#ifndef XNEST_DEBUG
OpenLog();
@@ -277,7 +268,6 @@
CreateServerAuth();
StartServer();
- alarm(2);
#endif
}
@@ -575,6 +565,8 @@
int status;
while (wpid != pid) {
wpid = wait(&status);
+ if (wpid == ServerPID)
+ xioerror(Dpy); // Server died, simulate IO error
}
if (WIFEXITED(status) && WEXITSTATUS(status)) {
LoginPanel->Message("Failed to execute login command");
@@ -620,9 +612,6 @@
void App::Reboot() {
- // Stop alarm clock
- alarm(0);
-
#ifdef USE_PAM
try{
pam.end();
@@ -645,9 +634,6 @@
void App::Halt() {
- // Stop alarm clock
- alarm(0);
-
#ifdef USE_PAM
try{
pam.end();
@@ -733,6 +719,7 @@
StopServer();
RemoveLock();
+ while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens
Run();
}
@@ -803,6 +790,7 @@
for(cycles = 0; cycles < ncycles; cycles++) {
if((Dpy = XOpenDisplay(DisplayName))) {
+ XSetIOErrorHandler(xioerror);
return 1;
} else {
if(!ServerTimeout(1, "X server to begin accepting connections"))
@@ -885,9 +873,6 @@
ServerPID = -1;
break;
}
- alarm(15);
- pause();
- alarm(0);
// Wait for server to start up
if(WaitForServer() == 0) {
@@ -920,15 +905,12 @@
void App::StopServer() {
- // Stop alars clock and ignore signals
- alarm(0);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGTERM, SIG_DFL);
signal(SIGKILL, SIG_DFL);
- signal(SIGALRM, SIG_DFL);
// Catch X error
XSetIOErrorHandler(IgnoreXIO);

View File

@@ -0,0 +1,57 @@
--- slim.conf.orig 2010-07-08 00:04:10.000000000 -0500
+++ slim.conf 2010-07-30 21:46:14.713367279 -0500
@@ -2,7 +2,7 @@
# Note: -xauth $authfile is automatically appended
default_path /bin:/usr/bin:/usr/local/bin
default_xserver /usr/bin/X
-#xserver_arguments -dpi 75
+xserver_arguments -nolisten tcp -br -deferglyphs 16
# Commands for halt, login, etc.
halt_cmd /sbin/shutdown -h now
@@ -18,7 +18,7 @@
# Activate numlock when slim starts. Valid values: on|off
-# numlock on
+numlock on
# Hide the mouse cursor (note: does not work with some WMs).
# Valid values: true|false
@@ -33,7 +33,8 @@
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
# login_cmd exec /bin/sh - ~/.xinitrc %session
-login_cmd exec /bin/bash -login ~/.xinitrc %session
+# login_cmd exec /bin/bash -login ~/.xinitrc %session
+login_cmd exec /bin/bash -login /etc/X11/xinit/xinitrc
# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
@@ -41,11 +42,13 @@
#
# sessionstart_cmd some command
# sessionstop_cmd some command
+sessionstart_cmd /usr/bin/sessreg -a -l :0.0 %user
+sessionstop_cmd /usr/bin/sessreg -d -l :0.0 %user
# Start in daemon mode. Valid values: yes | no
# Note that this can be overriden by the command line
# options "-d" and "-nodaemon"
-# daemon yes
+daemon yes
# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
@@ -53,8 +56,10 @@
# see the xinitrc.sample file shipped with slim sources
sessions xfce4,icewm,wmaker,blackbox
-# Executed when pressing F11 (requires imagemagick)
+# Executed when pressing F11 (requires media-gfx/imagemagick for import)
+# Alternative is media-gfx/scrot. See Gentoo bug 252241 for more info.
screenshot_cmd import -window root /slim.png
+#screenshot_cmd scrot /root/slim.png
# welcome message. Available variables: %host, %domain
welcome_msg Welcome to %host

View File

@@ -0,0 +1,107 @@
diff -ur slim-1.3.2_orig/app.cpp slim-1.3.2/app.cpp
--- slim-1.3.2_orig/app.cpp 2010-07-08 07:04:10.000000000 +0200
+++ slim-1.3.2/app.cpp 2010-08-18 21:47:42.000000000 +0200
@@ -50,6 +50,15 @@
// We assume PAM is asking for the username
panel->EventHandler(Panel::Get_Name);
switch(panel->getAction()){
+ case Panel::KSuspend:
+ Suspend();
+ break;
+ case Panel::KHalt:
+ Halt();
+ break;
+ case Panel::KReboot:
+ Reboot();
+ break;
case Panel::Suspend:
case Panel::Halt:
case Panel::Reboot:
@@ -394,12 +403,15 @@
case Panel::Console:
Console();
break;
+ case Panel::KReboot:
case Panel::Reboot:
Reboot();
break;
+ case Panel::KHalt:
case Panel::Halt:
Halt();
break;
+ case Panel::KSuspend:
case Panel::Suspend:
Suspend();
break;
@@ -420,6 +432,9 @@
}
catch(PAM::Auth_Exception& e){
switch(LoginPanel->getAction()){
+ case Panel::KSuspend:
+ case Panel::KReboot:
+ case Panel::KHalt:
case Panel::Exit:
case Panel::Console:
return true; // <--- This is simply fake!
@@ -440,6 +455,9 @@
if (!focuspass){
LoginPanel->EventHandler(Panel::Get_Name);
switch(LoginPanel->getAction()){
+ case Panel::KSuspend:
+ case Panel::KReboot:
+ case Panel::KHalt:
case Panel::Exit:
case Panel::Console:
cerr << APPNAME << ": Got a special command (" << LoginPanel->GetName() << ")" << endl;
@@ -454,6 +472,10 @@
struct passwd *pw;
switch(LoginPanel->getAction()){
+ case Panel::KSuspend:
+ case Panel::KHalt:
+ case Panel::KReboot:
+ return true;
case Panel::Suspend:
case Panel::Halt:
case Panel::Reboot:
diff -ur slim-1.3.2_orig/panel.cpp slim-1.3.2/panel.cpp
--- slim-1.3.2_orig/panel.cpp 2010-07-08 07:04:10.000000000 +0200
+++ slim-1.3.2/panel.cpp 2010-08-17 21:28:19.000000000 +0200
@@ -351,6 +351,22 @@
string formerString = "";
XLookupString(&event.xkey, &ascii, 1, &keysym, &compstatus);
+ if (reinterpret_cast<XKeyEvent&>(event).state & ControlMask) {
+ switch(keysym){
+ case XK_s:
+ action = KSuspend;
+ return false;
+ case XK_h:
+ action = KHalt;
+ return false;
+ case XK_r:
+ action = KReboot;
+ return false;
+ default:
+ break;
+ }
+ }
+
switch(keysym){
case XK_F1:
SwitchSession();
diff -ur slim-1.3.2_orig/panel.h slim-1.3.2/panel.h
--- slim-1.3.2_orig/panel.h 2010-07-08 07:04:10.000000000 +0200
+++ slim-1.3.2/panel.h 2010-08-17 21:28:37.000000000 +0200
@@ -40,7 +40,10 @@
Reboot,
Halt,
Exit,
- Suspend
+ Suspend,
+ KHalt,
+ KReboot,
+ KSuspend
};
enum FieldType {
Get_Name,

View File

@@ -0,0 +1,9 @@
/var/log/slim.log {
compress
rotate 4
weekly
delaycompress
copytruncate
missingok
notifempty
}