X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=da457258877fc1abf38bfaa3f7da3f8cac75b1ef;hb=762accdc0274dbd63c05d1163b5856b2d7226654;hp=2b62f617ae34d2b6d38abf77f99f473112804fa9;hpb=09cb8b2d136a40da776714bdce9fa80d69768837;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 2b62f61..da45725 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -50,7 +50,7 @@ static const char *cvstag = "$scrotwm$"; -#define SWM_VERSION "0.8" +#define SWM_VERSION "0.9" #include #include @@ -160,7 +160,7 @@ int font_adjusted = 0; /* dialog windows */ double dialog_ratio = .6; /* status bar */ -#define SWM_BAR_MAX (128) +#define SWM_BAR_MAX (256) char *bar_argv[] = { NULL, NULL }; int bar_pipe[2]; char bar_ext[SWM_BAR_MAX]; @@ -249,6 +249,7 @@ void horizontal_stack(struct workspace *, struct swm_geometry *); void max_stack(struct workspace *, struct swm_geometry *); void grabbuttons(struct ws_win *, int); +void new_region(struct swm_screen *, int, int, int, int); struct layout { void (*l_stack)(struct workspace *, struct swm_geometry *); @@ -347,13 +348,20 @@ struct quirk { #define SWM_Q_TRANSSZ (1<<1) /* transiend window size too small */ #define SWM_Q_ANYWHERE (1<<2) /* don't position this window */ #define SWM_Q_XTERM_FONTADJ (1<<3) /* adjust xterm fonts when resizing */ +#define SWM_Q_FULLSCREEN (1<<4) /* remove border */ } quirks[] = { - { "MPlayer", "xv", SWM_Q_FLOAT }, + { "MPlayer", "xv", SWM_Q_FLOAT | SWM_Q_FULLSCREEN }, { "OpenOffice.org 2.4", "VCLSalFrame", SWM_Q_FLOAT }, { "OpenOffice.org 3.0", "VCLSalFrame", SWM_Q_FLOAT }, - { "Firefox-bin", "firefox-bin", SWM_Q_TRANSSZ}, - { "Gimp", "gimp", SWM_Q_FLOAT | SWM_Q_ANYWHERE}, - { "XTerm", "xterm", SWM_Q_XTERM_FONTADJ}, + { "Firefox-bin", "firefox-bin", SWM_Q_TRANSSZ }, + { "Gimp", "gimp", SWM_Q_FLOAT | SWM_Q_ANYWHERE }, + { "XTerm", "xterm", SWM_Q_XTERM_FONTADJ }, + { "xine", "Xine Window", SWM_Q_FLOAT | SWM_Q_ANYWHERE }, + { "Xitk", "Xitk Combo", SWM_Q_FLOAT | SWM_Q_ANYWHERE }, + { "xine", "xine Panel", SWM_Q_FLOAT | SWM_Q_ANYWHERE }, + { "Xitk", "Xine Window", SWM_Q_FLOAT | SWM_Q_ANYWHERE }, + { "xine", "xine Video Fullscreen Window", SWM_Q_FULLSCREEN | SWM_Q_FLOAT }, + { "pcb", "pcb", SWM_Q_FLOAT }, { NULL, NULL, 0}, }; @@ -430,8 +438,6 @@ setscreencolor(char *val, int i, int c) i, ScreenCount(display)); } -void new_region(struct swm_screen *, int, int, int, int); - void custom_region(char *val) { @@ -699,15 +705,15 @@ bar_toggle(struct swm_region *r, union arg *args) DNPRINTF(SWM_D_MISC, "bar_toggle\n"); - if (bar_enabled) { + if (bar_enabled) for (i = 0; i < sc; i++) TAILQ_FOREACH(tmpr, &screens[i].rl, entry) XUnmapWindow(display, tmpr->bar_window); - } else { + else for (i = 0; i < sc; i++) TAILQ_FOREACH(tmpr, &screens[i].rl, entry) XMapRaised(display, tmpr->bar_window); - } + bar_enabled = !bar_enabled; for (i = 0; i < sc; i++) for (j = 0; j < SWM_WS_MAX; j++) @@ -1365,7 +1371,11 @@ stack_floater(struct ws_win *win, struct swm_region *r) bzero(&wc, sizeof wc); mask = CWX | CWY | CWBorderWidth | CWWidth | CWHeight; - wc.border_width = 1; + if ((win->quirks & SWM_Q_FULLSCREEN) && (win->g.w == WIDTH(r)) && + (win->g.h == HEIGHT(r))) + wc.border_width = 0; + else + wc.border_width = 1; if (win->transient && (win->quirks & SWM_Q_TRANSSZ)) { win->g.w = (double)WIDTH(r) * dialog_ratio; win->g.h = (double)HEIGHT(r) * dialog_ratio; @@ -2307,6 +2317,14 @@ manage_window(Window id) XConfigureWindow(display, win->id, mask, &wc); } + /* Reset font sizes (the bruteforce way; no default keybinding). */ + if (win->quirks & SWM_Q_XTERM_FONTADJ) { + for (i = 0; i < SWM_MAX_FONT_STEPS; i++) + fake_keypress(win, XK_KP_Subtract, ShiftMask); + for (i = 0; i < SWM_MAX_FONT_STEPS; i++) + fake_keypress(win, XK_KP_Add, ShiftMask); + } + XSelectInput(display, id, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask); @@ -2397,13 +2415,13 @@ configurerequest(XEvent *e) if (win->ws->r != NULL) { /* this seems to be full screen */ if (win->g.w >= WIDTH(win->ws->r)) { - win->g.x = -1; + win->g.x = 0; win->g.w = WIDTH(win->ws->r); ev->value_mask |= CWX | CWWidth; } if (win->g.h >= HEIGHT(win->ws->r)) { /* kill border */ - win->g.y = -1; + win->g.y = 0; win->g.h = HEIGHT(win->ws->r); ev->value_mask |= CWY | CWHeight; } @@ -2608,13 +2626,12 @@ getstate(Window w) unsigned long n, extra; Atom real; - astate = XInternAtom(display, "WM_STATE", False); status = XGetWindowProperty(display, w, astate, 0L, 2L, False, astate, &real, &format, &n, &extra, (unsigned char **)&p); if (status != Success) return (-1); if (n != 0) - result = *p; + result = *((long *)p); XFree(p); return (result); } @@ -2772,6 +2789,11 @@ screenchange(XEvent *e) { TAILQ_FOREACH(r, &screens[i].rl, entry) TAILQ_FOREACH(win, &r->ws->winlist, entry) XUnmapWindow(display, win->id); + + /* add bars to all regions */ + for (i = 0; i < ScreenCount(display); i++) + TAILQ_FOREACH(r, &screens[i].rl, entry) + bar_setup(r); stack(); }