Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability fixes #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Expand Up @@ -31,7 +31,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"
)
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DNEEDS_BASENAME")
else()
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DHAVE_SHADOW")
endif()
Expand Down Expand Up @@ -219,7 +218,6 @@ endif(BUILD_SLIMLOCK)
####### install
# slim
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin )
install(TARGETS slimlock RUNTIME DESTINATION bin)

if (BUILD_SHARED_LIBS)
set_target_properties(libslim PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion app.cpp
Expand Up @@ -339,7 +339,7 @@ void App::Run() {
HideCursor();

// Create panel
LoginPanel = new Panel(Dpy, Scr, Root, cfg, themedir, Panel::Mode_DM);
LoginPanel = new Panel(Dpy, Scr, Root, cfg, themebase, themeName, Panel::Mode_DM);
bool firstloop = true; // 1st time panel is shown (for automatic username)
bool focuspass = cfg->getOption("focus_password")=="yes";
bool autologin = cfg->getOption("auto_login")=="yes";
Expand Down
9 changes: 4 additions & 5 deletions panel.cpp
Expand Up @@ -16,7 +16,7 @@

using namespace std;

Panel::Panel(Display* dpy, int scr, Window root, Cfg* config, const string& themedir, PanelType panel_mode)
Panel::Panel(Display* dpy, int scr, Window root, Cfg* config, const string& themebase, const string& themeName, PanelType panel_mode)
: Dpy(dpy), Scr(scr), Root(root), cfg(config), mode(panel_mode), session_name(""), session_exec(""),
// Load properties from config / theme
input_name(cfg->getIntOption("input_name_x"), cfg->getIntOption("input_name_y")),
Expand Down Expand Up @@ -76,6 +76,7 @@ Panel::Panel(Display* dpy, int scr, Window root, Cfg* config, const string& them
}

// Load panel and background image
string themedir = themebase + themeName;
string panelpng = "";
panelpng = panelpng + themedir +"/panel.png";
image = new Image;
Expand All @@ -86,8 +87,7 @@ Panel::Panel(Display* dpy, int scr, Window root, Cfg* config, const string& them
if (!loaded) {
logStream << APPNAME
<< ": could not load panel image for theme '"
<< basename((char*)themedir.c_str()) << "'"
<< endl;
<< themeName << "'" << endl;
exit(ERR_EXIT);
}
}
Expand All @@ -103,8 +103,7 @@ Panel::Panel(Display* dpy, int scr, Window root, Cfg* config, const string& them
if (!loaded){
logStream << APPNAME
<< ": could not load background image for theme '"
<< basename((char*)themedir.c_str()) << "'"
<< endl;
<< themeName << "'" << endl;
exit(ERR_EXIT);
}
}
Expand Down
11 changes: 2 additions & 9 deletions panel.h
Expand Up @@ -24,10 +24,6 @@
#include <iostream>
#include <string>

#ifdef NEEDS_BASENAME
#include <libgen.h>
#endif

#include "switchuser.h"
#include "log.h"
#include "image.h"
Expand Down Expand Up @@ -67,7 +63,8 @@ class Panel {
};

Panel(Display* dpy, int scr, Window root, Cfg* config,
const std::string& themed, PanelType panel_mode);
const std::string& themed, const std::string& themeName,
PanelType panel_mode);
~Panel();
void OpenPanel();
void ClosePanel();
Expand Down Expand Up @@ -161,10 +158,6 @@ class Panel {

Image* image;

// For thesting themes
bool testing;
std::string themedir;

// Session handling
std::string session_name;
std::string session_exec;
Expand Down
2 changes: 1 addition & 1 deletion slimlock.cpp
Expand Up @@ -180,7 +180,7 @@ int main(int argc, char **argv) {
// configuration
HideCursor();

loginPanel = new Panel(dpy, scr, win, cfg, themedir, Panel::Mode_Lock);
loginPanel = new Panel(dpy, scr, win, cfg, themebase, themeName, Panel::Mode_Lock);

int ret = pam_start(APPNAME, loginPanel->GetName().c_str(), &conv, &pam_handle);
// If we can't start PAM, just exit because slimlock won't work right
Expand Down