mirror of git://git.suckless.org/dwm
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
This commit is contained in:
parent
a55f0e12fe
commit
95e8d12b71
30
client.c
30
client.c
|
@ -3,7 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -219,7 +218,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
c->h = wa->height;
|
c->h = wa->height;
|
||||||
c->th = bh;
|
c->th = bh;
|
||||||
|
|
||||||
c->border = 1;
|
c->border = 0;
|
||||||
setsize(c);
|
setsize(c);
|
||||||
|
|
||||||
if(c->h != sh && c->y < bh)
|
if(c->h != sh && c->y < bh)
|
||||||
|
@ -254,8 +253,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
if(!c->isfloat)
|
if(!c->isfloat)
|
||||||
c->isfloat = trans
|
c->isfloat = trans
|
||||||
|| (c->maxw && c->minw &&
|
|| (c->maxw && c->minw &&
|
||||||
c->maxw == c->minw && c->maxh == c->minh)
|
c->maxw == c->minw && c->maxh == c->minh);
|
||||||
|| (c->w == sw && c->h == sh);
|
|
||||||
settitle(c);
|
settitle(c);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
|
|
||||||
|
@ -271,7 +269,7 @@ resize(Client *c, Bool sizehints, Corner sticky)
|
||||||
{
|
{
|
||||||
int bottom = c->y + c->h;
|
int bottom = c->y + c->h;
|
||||||
int right = c->x + c->w;
|
int right = c->x + c->w;
|
||||||
XConfigureEvent e;
|
/*XConfigureEvent e;*/
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if(sizehints) {
|
if(sizehints) {
|
||||||
|
@ -302,21 +300,11 @@ resize(Client *c, Bool sizehints, Corner sticky)
|
||||||
wc.y = c->y;
|
wc.y = c->y;
|
||||||
wc.width = c->w;
|
wc.width = c->w;
|
||||||
wc.height = c->h;
|
wc.height = c->h;
|
||||||
|
if(c->w == sw && c->h == sh)
|
||||||
|
wc.border_width = 0;
|
||||||
|
else
|
||||||
wc.border_width = 1;
|
wc.border_width = 1;
|
||||||
XConfigureWindow(dpy, c->win,
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
|
||||||
|
|
||||||
e.type = ConfigureNotify;
|
|
||||||
e.event = c->win;
|
|
||||||
e.window = c->win;
|
|
||||||
e.x = c->x;
|
|
||||||
e.y = c->y;
|
|
||||||
e.width = c->w;
|
|
||||||
e.height = c->h;
|
|
||||||
e.border_width = c->border;
|
|
||||||
e.above = None;
|
|
||||||
e.override_redirect = False;
|
|
||||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,8 +391,8 @@ togglemax(Arg *arg)
|
||||||
oh = sel->h;
|
oh = sel->h;
|
||||||
sel->x = sx;
|
sel->x = sx;
|
||||||
sel->y = sy + bh;
|
sel->y = sy + bh;
|
||||||
sel->w = sw - 2 * sel->border;
|
sel->w = sw - 2;
|
||||||
sel->h = sh - 2 * sel->border - bh;
|
sel->h = sh - 2 - bh;
|
||||||
|
|
||||||
higher(sel);
|
higher(sel);
|
||||||
resize(sel, False, TopLeft);
|
resize(sel, False, TopLeft);
|
||||||
|
|
18
config.arg.h
18
config.arg.h
|
@ -3,15 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
|
||||||
#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
|
||||||
#define BGCOLOR "#0a2c2d"
|
|
||||||
#define FGCOLOR "#ddeeee"
|
|
||||||
#define BORDERCOLOR "#176164"
|
|
||||||
#define MODKEY Mod1Mask
|
|
||||||
#define NUMLOCKMASK Mod2Mask
|
|
||||||
#define MASTERW 52 /* percent */
|
|
||||||
|
|
||||||
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
|
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
|
||||||
#define TAGS \
|
#define TAGS \
|
||||||
char *tags[TLast] = { \
|
char *tags[TLast] = { \
|
||||||
|
@ -21,7 +12,16 @@ char *tags[TLast] = { \
|
||||||
[Twork] = "work", \
|
[Twork] = "work", \
|
||||||
[Tmisc] = "misc", \
|
[Tmisc] = "misc", \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define DEFTAG Tdev
|
#define DEFTAG Tdev
|
||||||
|
#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
||||||
|
#define BGCOLOR "#0a2c2d"
|
||||||
|
#define FGCOLOR "#ddeeee"
|
||||||
|
#define BORDERCOLOR "#176164"
|
||||||
|
#define MODKEY Mod1Mask
|
||||||
|
#define NUMLOCKMASK Mod2Mask
|
||||||
|
#define MASTERW 52 /* percent */
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
const char *browse[] = { "firefox", NULL }; \
|
const char *browse[] = { "firefox", NULL }; \
|
||||||
|
|
18
config.h
18
config.h
|
@ -3,15 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
|
||||||
#define FONT "fixed"
|
|
||||||
#define BGCOLOR "#666699"
|
|
||||||
#define FGCOLOR "#eeeeee"
|
|
||||||
#define BORDERCOLOR "#9999CC"
|
|
||||||
#define MODKEY Mod1Mask
|
|
||||||
#define NUMLOCKMASK Mod2Mask
|
|
||||||
#define MASTERW 52 /* percent */
|
|
||||||
|
|
||||||
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
|
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
|
||||||
#define TAGS \
|
#define TAGS \
|
||||||
char *tags[TLast] = { \
|
char *tags[TLast] = { \
|
||||||
|
@ -21,7 +12,16 @@ char *tags[TLast] = { \
|
||||||
[Twork] = "work", \
|
[Twork] = "work", \
|
||||||
[Tmisc] = "misc", \
|
[Tmisc] = "misc", \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define DEFTAG Tdev
|
#define DEFTAG Tdev
|
||||||
|
#define FONT "fixed"
|
||||||
|
#define BGCOLOR "#666699"
|
||||||
|
#define FGCOLOR "#eeeeee"
|
||||||
|
#define BORDERCOLOR "#9999CC"
|
||||||
|
#define MODKEY Mod1Mask
|
||||||
|
#define NUMLOCKMASK Mod2Mask
|
||||||
|
#define MASTERW 52 /* percent */
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
const char *term[] = { "xterm", NULL }; \
|
const char *term[] = { "xterm", NULL }; \
|
||||||
|
|
1
draw.c
1
draw.c
|
@ -3,7 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
|
|
4
dwm.h
4
dwm.h
|
@ -3,8 +3,8 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include CONFIG
|
#include CONFIG
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
/* mask shorthands, used in event.c and client.c */
|
/* mask shorthands, used in event.c and client.c */
|
||||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||||
|
@ -57,8 +57,8 @@ struct Client {
|
||||||
int tx, ty, tw, th; /* title */
|
int tx, ty, tw, th; /* title */
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int grav;
|
int grav;
|
||||||
unsigned int border;
|
|
||||||
long flags;
|
long flags;
|
||||||
|
unsigned int border;
|
||||||
Bool isfloat;
|
Bool isfloat;
|
||||||
Bool ismax;
|
Bool ismax;
|
||||||
Client *next;
|
Client *next;
|
||||||
|
|
45
event.c
45
event.c
|
@ -3,7 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -151,11 +150,13 @@ configurerequest(XEvent *e)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||||
|
XEvent synev;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
unsigned long newmask;
|
||||||
|
|
||||||
ev->value_mask &= ~CWSibling;
|
|
||||||
if((c = getclient(ev->window))) {
|
if((c = getclient(ev->window))) {
|
||||||
gravitate(c, True);
|
gravitate(c, True);
|
||||||
|
if(c->isfloat) {
|
||||||
if(ev->value_mask & CWX)
|
if(ev->value_mask & CWX)
|
||||||
c->x = ev->x;
|
c->x = ev->x;
|
||||||
if(ev->value_mask & CWY)
|
if(ev->value_mask & CWY)
|
||||||
|
@ -164,19 +165,45 @@ configurerequest(XEvent *e)
|
||||||
c->w = ev->width;
|
c->w = ev->width;
|
||||||
if(ev->value_mask & CWHeight)
|
if(ev->value_mask & CWHeight)
|
||||||
c->h = ev->height;
|
c->h = ev->height;
|
||||||
if(ev->value_mask & CWBorderWidth)
|
|
||||||
c->border = 1;
|
|
||||||
gravitate(c, False);
|
|
||||||
resize(c, True, TopLeft);
|
|
||||||
}
|
}
|
||||||
|
if(ev->value_mask & CWBorderWidth)
|
||||||
|
c->border = ev->border_width;
|
||||||
|
gravitate(c, False);
|
||||||
|
|
||||||
|
resize(c, True, TopLeft);
|
||||||
|
|
||||||
|
wc.x = c->x;
|
||||||
|
wc.y = c->y;
|
||||||
|
wc.width = c->w;
|
||||||
|
wc.height = c->h;
|
||||||
|
newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
|
||||||
|
if(newmask)
|
||||||
|
XConfigureWindow(dpy, c->win, newmask, &wc);
|
||||||
|
else {
|
||||||
|
synev.type = ConfigureNotify;
|
||||||
|
synev.xconfigure.display = dpy;
|
||||||
|
synev.xconfigure.event = c->win;
|
||||||
|
synev.xconfigure.window = c->win;
|
||||||
|
synev.xconfigure.x = c->x;
|
||||||
|
synev.xconfigure.y = c->y;
|
||||||
|
synev.xconfigure.width = c->w;
|
||||||
|
synev.xconfigure.height = c->h;
|
||||||
|
synev.xconfigure.border_width = c->border;
|
||||||
|
synev.xconfigure.above = None;
|
||||||
|
/* Send synthetic ConfigureNotify */
|
||||||
|
XSendEvent(dpy, c->win, True, NoEventMask, &synev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
wc.x = ev->x;
|
wc.x = ev->x;
|
||||||
wc.y = ev->y;
|
wc.y = ev->y;
|
||||||
wc.width = ev->width;
|
wc.width = ev->width;
|
||||||
wc.height = ev->height;
|
wc.height = ev->height;
|
||||||
wc.border_width = 1;
|
wc.border_width = ev->border_width;
|
||||||
XConfigureWindow(dpy, ev->window,
|
wc.sibling = ev->above;
|
||||||
CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
wc.stack_mode = ev->detail;
|
||||||
|
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
|
||||||
|
}
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
main.c
13
main.c
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -15,7 +14,6 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
|
@ -165,6 +163,7 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
fd_set rd;
|
fd_set rd;
|
||||||
|
Bool readin = True;
|
||||||
Window w;
|
Window w;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
@ -251,6 +250,7 @@ main(int argc, char *argv[])
|
||||||
/* main event loop, reads status text from stdin as well */
|
/* main event loop, reads status text from stdin as well */
|
||||||
while(running) {
|
while(running) {
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
|
if(readin)
|
||||||
FD_SET(STDIN_FILENO, &rd);
|
FD_SET(STDIN_FILENO, &rd);
|
||||||
FD_SET(ConnectionNumber(dpy), &rd);
|
FD_SET(ConnectionNumber(dpy), &rd);
|
||||||
|
|
||||||
|
@ -267,11 +267,12 @@ main(int argc, char *argv[])
|
||||||
(handler[ev.type])(&ev); /* call handler */
|
(handler[ev.type])(&ev); /* call handler */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(FD_ISSET(STDIN_FILENO, &rd)) {
|
if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
|
||||||
if(!fgets(stext, sizeof(stext), stdin))
|
readin = NULL != fgets(stext, sizeof(stext), stdin);
|
||||||
break;
|
if(readin)
|
||||||
else
|
|
||||||
stext[strlen(stext) - 1] = 0;
|
stext[strlen(stext) - 1] = 0;
|
||||||
|
else
|
||||||
|
strcpy(stext, "broken pipe");
|
||||||
drawstatus();
|
drawstatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
tag.c
17
tag.c
|
@ -3,7 +3,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -86,26 +85,26 @@ dotile(Arg *arg)
|
||||||
if(n == 1) {
|
if(n == 1) {
|
||||||
c->x = sx;
|
c->x = sx;
|
||||||
c->y = sy + bh;
|
c->y = sy + bh;
|
||||||
c->w = sw - 2 * c->border;
|
c->w = sw - 2;
|
||||||
c->h = sh - 2 * c->border - bh;
|
c->h = sh - 2 - bh;
|
||||||
}
|
}
|
||||||
else if(i == 0) {
|
else if(i == 0) {
|
||||||
c->x = sx;
|
c->x = sx;
|
||||||
c->y = sy + bh;
|
c->y = sy + bh;
|
||||||
c->w = mw - 2 * c->border;
|
c->w = mw - 2;
|
||||||
c->h = sh - 2 * c->border - bh;
|
c->h = sh - 2 - bh;
|
||||||
}
|
}
|
||||||
else if(h > bh) {
|
else if(h > bh) {
|
||||||
c->x = sx + mw;
|
c->x = sx + mw;
|
||||||
c->y = sy + (i - 1) * h + bh;
|
c->y = sy + (i - 1) * h + bh;
|
||||||
c->w = w - 2 * c->border;
|
c->w = w - 2;
|
||||||
c->h = h - 2 * c->border;
|
c->h = h - 2;
|
||||||
}
|
}
|
||||||
else { /* fallback if h < bh */
|
else { /* fallback if h < bh */
|
||||||
c->x = sx + mw;
|
c->x = sx + mw;
|
||||||
c->y = sy + bh;
|
c->y = sy + bh;
|
||||||
c->w = w - 2 * c->border;
|
c->w = w - 2;
|
||||||
c->h = sh - 2 * c->border - bh;
|
c->h = sh - 2 - bh;
|
||||||
}
|
}
|
||||||
resize(c, False, TopLeft);
|
resize(c, False, TopLeft);
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in New Issue