1 diff --git a/INSTALL b/INSTALL
2 index 3a9562c..3db35c8 100644
5 @@ -2,6 +2,7 @@ INSTALL file for SLiM
13 diff --git a/Makefile b/Makefile
14 index f7d3d2d..919b954 100644
17 @@ -7,7 +7,7 @@ CXX=/usr/bin/g++
19 CFLAGS=-Wall -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/libpng12 -I/usr/include
21 -LDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg
22 +LDFLAGS=-lXft -lX11 -lXinerama -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg
26 diff --git a/Makefile.freebsd b/Makefile.freebsd
27 index 3ff326e..10436cf 100644
28 --- a/Makefile.freebsd
29 +++ b/Makefile.freebsd
33 CFLAGS=-I. -I/usr/local/include/freetype2 -I/usr/local/include/freetype2/config -I/usr/local/include/libpng -I/usr/local/include -I/usr/include
34 -LDFLAGS= -L/usr/local/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lcrypt -lXmu -lpng -ljpeg
35 +LDFLAGS= -L/usr/local/lib -lXft -lX11 -lXinerama -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lcrypt -lXmu -lpng -ljpeg
36 CUSTOM=-DNEEDS_BASENAME
39 diff --git a/Makefile.openbsd b/Makefile.openbsd
40 index b1829f8..08d1c04 100644
41 --- a/Makefile.openbsd
42 +++ b/Makefile.openbsd
46 CFLAGS=-I. -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/X11R6/include/freetype2/config -I/usr/local/include/libpng -I/usr/local/include -I/usr/include
47 -LDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lXmu -lpng -ljpeg
48 +LDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lXft -lX11 -lXinerama -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lXmu -lpng -ljpeg
49 CUSTOM=-DNEEDS_BASENAME
52 diff --git a/README b/README
53 index e30fbf1..fad5cf2 100644
56 @@ -15,6 +15,7 @@ INTRODUCTION
57 - XFT / freetype support
58 - Double or single (GDM-style) inputbox support
59 - Automake-based build procedure
64 @@ -40,8 +41,9 @@ USAGE
65 is to take a screenshot if the 'import' program is available.
68 - /usr/etc/slim.conf is the main configuration file.
69 - Options are explained in the file itself
70 + /etc/slim.conf is the main configuration file, or use the -f
72 + Options are explained in the file itself.
76 diff --git a/app.cpp b/app.cpp
77 index fd5dece..5776de9 100644
80 @@ -321,8 +321,30 @@ void App::Run() {
85 + XineramaScreenInfo *screens = XineramaQueryScreens(Dpy, &screenCount);
86 + if (screens != NULL) {
88 + int screen = Cfg::string2int(cfg->getOption("xinerama_screen").c_str(), &ok);
89 + if (!ok || screen >= screenCount)
91 + screenInfo = (XineramaScreenInfo *)malloc(sizeof(XineramaScreenInfo));
92 + if (screenInfo == NULL) {
93 + fprintf(stderr, "Can't allocate memory for Xinerama screeninfo.\n");
96 + memcpy(screenInfo, &screens[screen], sizeof(XineramaScreenInfo));
102 + if (!testing && XineramaIsActive(Dpy)) {
103 + Root = XCreateSimpleWindow(Dpy, Root, ScreenLeft(), ScreenTop(), ScreenWidth(), ScreenHeight(), 0, 0, 0);
104 + XMapWindow(Dpy, Root);
109 LoginPanel = new Panel(Dpy, Scr, Root, cfg, themedir);
110 bool firstloop = true; // 1st time panel is shown (for automatic username)
111 @@ -714,8 +736,8 @@ void App::Console() {
115 - int width = (XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)) - (posx * 2)) / fontx;
116 - int height = (XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)) - (posy * 2)) / fonty;
117 + int width = (ScreenWidth() - (posx * 2)) / fontx;
118 + int height = (ScreenHeight() - (posy * 2)) / fonty;
121 const char* cmd = cfg->getOption("console_cmd").c_str();
122 @@ -748,6 +770,8 @@ void App::Exit() {
126 + if (screenInfo != NULL)
131 @@ -1017,13 +1041,45 @@ void App::blankScreen()
132 GC gc = XCreateGC(Dpy, Root, 0, 0);
133 XSetForeground(Dpy, gc, BlackPixel(Dpy, Scr));
134 XFillRectangle(Dpy, Root, gc, 0, 0,
135 - XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)),
136 - XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)));
137 + XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), // intentional
138 + XHeightOfScreen(ScreenOfDisplay(Dpy, Scr))); // intentional
144 +int App::ScreenLeft()
146 + if (screenInfo == NULL)
149 + return screenInfo->x_org;
152 +int App::ScreenTop()
154 + if (screenInfo == NULL)
157 + return screenInfo->y_org;
160 +int App::ScreenWidth()
162 + if (screenInfo == NULL)
163 + return XWidthOfScreen(ScreenOfDisplay(Dpy, Scr));
165 + return screenInfo->width;
168 +int App::ScreenHeight()
170 + if (screenInfo == NULL)
171 + return XHeightOfScreen(ScreenOfDisplay(Dpy, Scr));
173 + return screenInfo->height;
176 void App::setBackground(const string& themedir) {
178 filename = themedir + "/background.png";
179 @@ -1037,18 +1093,18 @@ void App::setBackground(const string& themedir) {
181 string bgstyle = cfg->getOption("background_style");
182 if (bgstyle == "stretch") {
183 - image->Resize(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)));
184 + image->Resize(ScreenWidth(), ScreenHeight());
185 } else if (bgstyle == "tile") {
186 - image->Tile(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)));
187 + image->Tile(ScreenWidth(), ScreenHeight());
188 } else if (bgstyle == "center") {
189 string hexvalue = cfg->getOption("background_color");
190 hexvalue = hexvalue.substr(1,6);
191 - image->Center(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)),
192 + image->Center(ScreenWidth(), ScreenHeight(),
194 } else { // plain color or error
195 string hexvalue = cfg->getOption("background_color");
196 hexvalue = hexvalue.substr(1,6);
197 - image->Center(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)),
198 + image->Center(ScreenWidth(), ScreenHeight(),
201 Pixmap p = image->createPixmap(Dpy, Scr, Root);
202 diff --git a/app.h b/app.h
203 index 8127f13..faa1bf7 100644
209 #include <X11/Xlib.h>
210 +#include <X11/extensions/Xinerama.h>
213 #include <sys/wait.h>
214 @@ -40,6 +41,8 @@ public:
218 + friend class Panel;
223 @@ -69,10 +72,16 @@ private:
224 int ServerTimeout(int timeout, char *string);
230 + int ScreenHeight();
236 + XineramaScreenInfo* screenInfo;
239 const char* DisplayName;
240 diff --git a/cfg.cpp b/cfg.cpp
241 index f53ddae..cf2127c 100644
244 @@ -56,6 +56,7 @@ Cfg::Cfg()
245 options.insert(option("sessions","wmaker,blackbox,icewm"));
246 options.insert(option("sessiondir",""));
247 options.insert(option("hidecursor","false"));
248 + options.insert(option("xinerama_screen", "0"));
251 options.insert(option("input_panel_x","50%"));
252 diff --git a/panel.cpp b/panel.cpp
253 index 032574d..c0ac774 100644
264 +extern App* LoginApp;
266 Panel::Panel(Display* dpy, int scr, Window root, Cfg* config,
267 const string& themedir) {
269 @@ -105,28 +108,27 @@ Panel::Panel(Display* dpy, int scr, Window root, Cfg* config,
274 if (bgstyle == "stretch") {
275 - bg->Resize(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)));
276 + bg->Resize(LoginApp->ScreenWidth(), LoginApp->ScreenHeight());
277 } else if (bgstyle == "tile") {
278 - bg->Tile(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)));
279 + bg->Tile(LoginApp->ScreenWidth(), LoginApp->ScreenHeight());
280 } else if (bgstyle == "center") {
281 string hexvalue = cfg->getOption("background_color");
282 hexvalue = hexvalue.substr(1,6);
283 - bg->Center(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)),
284 - XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)),
285 + bg->Center(LoginApp->ScreenWidth(), LoginApp->ScreenHeight(),
287 } else { // plain color or error
288 string hexvalue = cfg->getOption("background_color");
289 hexvalue = hexvalue.substr(1,6);
290 - bg->Center(XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)),
291 - XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)),
292 + bg->Center(LoginApp->ScreenWidth(), LoginApp->ScreenHeight(),
296 string cfgX = cfg->getOption("input_panel_x");
297 string cfgY = cfg->getOption("input_panel_y");
298 - X = Cfg::absolutepos(cfgX, XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), image->Width());
299 - Y = Cfg::absolutepos(cfgY, XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)), image->Height());
300 + X = Cfg::absolutepos(cfgX, LoginApp->ScreenWidth(), image->Width());
301 + Y = Cfg::absolutepos(cfgY, LoginApp->ScreenHeight(), image->Height());
303 // Merge image into background
304 image->Merge(bg, X, Y);
305 @@ -210,8 +212,8 @@ void Panel::Message(const string& text) {
307 Cfg::string2int(cfg->getOption("msg_shadow_yoffset").c_str());
309 - int msg_x = Cfg::absolutepos(cfgX, XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), extents.width);
310 - int msg_y = Cfg::absolutepos(cfgY, XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)), extents.height);
311 + int msg_x = Cfg::absolutepos(cfgX, LoginApp->ScreenWidth(), extents.width);
312 + int msg_y = Cfg::absolutepos(cfgY, LoginApp->ScreenHeight(), extents.height);
314 SlimDrawString8 (draw, &msgcolor, msgfont, msg_x, msg_y,
316 @@ -585,8 +587,8 @@ void Panel::ShowSession() {
317 currsession.length(), &extents);
318 msg_x = cfg->getOption("session_x");
319 msg_y = cfg->getOption("session_y");
320 - int x = Cfg::absolutepos(msg_x, XWidthOfScreen(ScreenOfDisplay(Dpy, Scr)), extents.width);
321 - int y = Cfg::absolutepos(msg_y, XHeightOfScreen(ScreenOfDisplay(Dpy, Scr)), extents.height);
322 + int x = Cfg::absolutepos(msg_x, LoginApp->ScreenWidth(), extents.width);
323 + int y = Cfg::absolutepos(msg_y, LoginApp->ScreenHeight(), extents.height);
325 Cfg::string2int(cfg->getOption("session_shadow_xoffset").c_str());
327 diff --git a/slim.conf b/slim.conf
328 index 3542751..e72eca2 100644
331 @@ -16,6 +16,8 @@ xauth_path /usr/bin/xauth
332 # Xauth file for server
333 authfile /var/run/slim.auth
335 +# Xinerama screen to show login panel on (zero-based)
338 # Activate numlock when slim starts. Valid values: on|off