Permalink
Browse files

Added multi monitor support

  • Loading branch information...
1 parent ee57539 commit 24e262c9ba22321d3d83f2c8946c941d5767f6e0 @moetunes committed Oct 10, 2012
Showing with 179 additions and 115 deletions.
  1. +4 −1 ChangeLog
  2. +1 −1 Makefile
  3. +5 −4 README.md
  4. +7 −6 bar.c
  5. +2 −2 config.h
  6. +1 −1 readkeysapps.c
  7. +5 −19 readrc.c
  8. +154 −81 snapwm.c
View
@@ -1,7 +1,10 @@
+10/10/12
+ Added multi monitor support
+
24/9/12
Fix for existing window/s not being unmapped in
fullscreen mode when new window added
- Bar is toggled on a per desktop basis
+ Bar is toggled on a per desktop basis
22/9/12
Added AltSuper for Mod key combo
View
@@ -1,5 +1,5 @@
CFLAGS+= -g -std=c99 -pedantic -Wall
-LDADD+= -lX11
+LDADD+= -lX11 -lXinerama
LDFLAGS=
EXEC=snapwm
View
@@ -10,7 +10,7 @@ Screenshots and ramblings/updates at https://bbs.archlinux.org/viewtopic.php?id=
-------
-**snapwm** is a very minimal and lightweight dynamic tiling window manager.
+**snapwm** is a xinerama aware, very minimal and lightweight dynamic tiling window manager.
All configuration is read from three files in ~/.config/snapwm/ .
@@ -78,10 +78,9 @@ It allows the "normal" method of tiling window managers(with the new window as t
###Recent Changes
--------------
-13/4/12
+10/10/12
- * Colours changed in rc.conf
- * Background colour can be changed
+ * Added multi monitor support
###Status
@@ -112,6 +111,8 @@ It allows the "normal" method of tiling window managers(with the new window as t
* Number of desktops now read from rc.conf
* Whether to left align the current windows' name in the bar moved to rc.conf
* No need to rebuild the wm to change a setting
+ * Colours changed in rc.conf
+ * Background colour can be changed
###Installation
View
13 bar.c
@@ -1,4 +1,4 @@
-// bar.c [ 0.6.4 ]
+// bar.c [ 0.7.0 ]
static void draw_numopen(unsigned int cd, unsigned int gc);
static Drawable area_sb;
@@ -32,7 +32,7 @@ void setup_status_bar() {
void status_bar() {
unsigned int i, y;
- y = (topbar == 0) ? 0 : sh+bdw;
+ y = (topbar == 0) ? 0 : desktops[0].h+bdw;
sb_width = 0;
for(i=0;i<DESKTOPS;++i) {
sb_bar[i].sb_win = XCreateSimpleWindow(dis, root, sb_width, y,
@@ -43,7 +43,7 @@ void status_bar() {
sb_width += sb_bar[i].width;
}
sb_area = XCreateSimpleWindow(dis, root, sb_desks, y,
- sw-(sb_desks+2),sb_height,2,theme[3].barcolor,theme[1].barcolor);
+ desktops[0].w-(sb_desks+2),sb_height,2,theme[3].barcolor,theme[1].barcolor);
XSelectInput(dis, sb_area, ButtonPressMask|ExposureMask|EnterWindowMask|LeaveWindowMask);
XMapWindow(dis, sb_area);
@@ -58,16 +58,17 @@ void status_bar() {
void toggle_bar() {
unsigned int i;
+ if(desktops[current_desktop].screen != 0) return;
if(STATUS_BAR == 0) {
if(has_bar == 0) {
show_bar = 1;
- sh += sb_height+4;
+ desktops[0].h += sb_height+4;
for(i=0;i<DESKTOPS;++i) XUnmapWindow(dis,sb_bar[i].sb_win);
XUnmapWindow(dis, sb_area);
has_bar = 1;
} else {
show_bar = 0;
- sh -= sb_height+4;
+ desktops[0].h -= sb_height+4;
for(i=0;i<DESKTOPS;++i) XMapWindow(dis, sb_bar[i].sb_win);
XMapWindow(dis, sb_area);
has_bar = 0;
@@ -169,7 +170,7 @@ void update_output(unsigned int messg) {
char *win_name;
if(!(XFetchName(dis, root, &win_name))) {
- strcpy(output, "&3snapwm 0.5.7 ");
+ strcpy(output, "&3 snapwm inc. ");
text_length = 15;
} else {
while(win_name[text_length] != '\0' && text_length < 256) {
View
@@ -1,6 +1,6 @@
- /* config.h for snapwm.c [ 0.6.4 ]
+ /* config.h for snapwm
*
- * RC FILE set to $HOME/.config/snapwm/rc.conf
+ * CONFIG FILES set to $HOME/.config/snapwm/
*/
#ifndef CONFIG_H
View
@@ -1,4 +1,4 @@
-/* readkeysapps.c [ 0.6.4 ] */
+/* readkeysapps.c [ 0.7.0 ] */
void read_keys_file() {
FILE *keyfile ;
View
@@ -1,4 +1,4 @@
-// readrc.c [ 0.6.4 ]
+// readrc.c [ 0.7.0 ]
/* *********************** Read Config File ************************ */
void read_rcfile() {
@@ -128,14 +128,6 @@ void read_rcfile() {
}
fclose(rcfile);
}
- if(STATUS_BAR == 0 && show_bar == 0) {
- // Screen height
- sh = (XDisplayHeight(dis,screen) - (sb_height+4+bdw));
- sw = XDisplayWidth(dis,screen)- bdw;
- } else {
- sh = (XDisplayHeight(dis,screen) - bdw);
- sw = XDisplayWidth(dis,screen)- bdw;
- }
return;
}
@@ -198,11 +190,6 @@ void set_defaults() {
get_font();
sb_height = font.height+2;
font.fh = ((sb_height - font.height)/2) + font.ascent;
- sh = (XDisplayHeight(dis,screen) - (sb_height+4+bdw));
- sw = XDisplayWidth(dis,screen)- bdw;
- } else {
- sh = (XDisplayHeight(dis,screen) - bdw);
- sw = XDisplayWidth(dis,screen)- bdw;
}
return;
}
@@ -214,7 +201,7 @@ void update_config() {
XUngrabButton(dis, AnyButton, AnyModifier, root);
if(font.fontset) XFreeFontSet(dis, font.fontset);
read_rcfile();
- y = (topbar == 0) ? 0 : sh+bdw;
+ y = (topbar == 0) ? 0 : desktops[0].h+bdw;
if(DESKTOPS < old_desktops) {
save_desktop(current_desktop);
Arg a = {.i = DESKTOPS-1};
@@ -230,8 +217,7 @@ void update_config() {
if(current_desktop > (DESKTOPS-1)) change_desktop(a);
}
if(old_desktops < DESKTOPS)
- for(i=old_desktops;i<DESKTOPS;++i)
- init_desks(i);
+ init_desks();
if(STATUS_BAR == 0) {
setup_status_bar();
if(DESKTOPS != old_desktops) {
@@ -248,7 +234,7 @@ void update_config() {
}
XSetWindowBorder(dis,sb_area,theme[3].barcolor);
XSetWindowBackground(dis, sb_area, theme[1].barcolor);
- XMoveResizeWindow(dis, sb_area, sb_desks, y, sw-(sb_desks+4)+bdw,sb_height);
+ XMoveResizeWindow(dis, sb_area, sb_desks, y, desktops[0].w-(sb_desks+4)+bdw,sb_height);
XGetWindowAttributes(dis, sb_area, &attr);
total_w = attr.width;
if(area_sb != 0) {
@@ -259,7 +245,7 @@ void update_config() {
}
}
for(i=0;i<DESKTOPS;++i) {
- desktops[i].master_size = (desktops[i].mode == 2) ? (sh*msize)/100 : (sw*msize)/100;
+ desktops[i].master_size = (desktops[i].mode == 2) ? (desktops[i].h*msize)/100 : (desktops[i].w*msize)/100;
if(desktops[i].head == NULL)
desktops[i].mode = mode;
}
Oops, something went wrong.

0 comments on commit 24e262c

Please sign in to comment.