Add default static floating.
This commit is contained in:
parent
08b907930c
commit
cfe0f2d84e
34
svkbd.c
34
svkbd.c
@ -94,7 +94,7 @@ static Atom netatom[NetLast];
|
|||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
static DC dc;
|
static DC dc;
|
||||||
static Window root, win;
|
static Window root, win;
|
||||||
static Bool running = True, istoolbar = False;
|
static Bool running = True, isdock = False;
|
||||||
static KeySym pressedmod = 0;
|
static KeySym pressedmod = 0;
|
||||||
static int rows = 0, ww = 0, wh = 0, wx = 0, wy = 0;
|
static int rows = 0, ww = 0, wh = 0, wx = 0, wy = 0;
|
||||||
static char *name = "svkbd";
|
static char *name = "svkbd";
|
||||||
@ -435,8 +435,9 @@ void
|
|||||||
setup(void) {
|
setup(void) {
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
XTextProperty str;
|
XTextProperty str;
|
||||||
|
XSizeHints *sizeh = NULL;
|
||||||
XClassHint *ch;
|
XClassHint *ch;
|
||||||
Atom atype;
|
Atom atype = -1;
|
||||||
int i, sh, sw;
|
int i, sh, sw;
|
||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
|
|
||||||
@ -449,9 +450,7 @@ setup(void) {
|
|||||||
|
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||||
if(istoolbar)
|
if(isdock)
|
||||||
atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_TOOLBAR", False);
|
|
||||||
else
|
|
||||||
atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
||||||
|
|
||||||
/* init appearance */
|
/* init appearance */
|
||||||
@ -501,21 +500,32 @@ setup(void) {
|
|||||||
wmh = XAllocWMHints();
|
wmh = XAllocWMHints();
|
||||||
wmh->input = False;
|
wmh->input = False;
|
||||||
wmh->flags = InputHint;
|
wmh->flags = InputHint;
|
||||||
|
if(!isdock) {
|
||||||
|
sizeh = XAllocSizeHints();
|
||||||
|
sizeh->flags = PMaxSize | PMinSize;
|
||||||
|
sizeh->min_width = sizeh->max_width = ww;
|
||||||
|
sizeh->min_height = sizeh->max_height = wh;
|
||||||
|
}
|
||||||
XStringListToTextProperty(&name, 1, &str);
|
XStringListToTextProperty(&name, 1, &str);
|
||||||
ch = XAllocClassHint();
|
ch = XAllocClassHint();
|
||||||
ch->res_class = name;
|
ch->res_class = name;
|
||||||
ch->res_name = name;
|
ch->res_name = name;
|
||||||
|
|
||||||
XSetWMProperties(dpy, win, &str, &str, NULL, 0, NULL, wmh,
|
XSetWMProperties(dpy, win, &str, &str, NULL, 0, sizeh, wmh,
|
||||||
ch);
|
ch);
|
||||||
|
|
||||||
XFree(ch);
|
XFree(ch);
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
XFree(str.value);
|
XFree(str.value);
|
||||||
|
if(sizeh != NULL)
|
||||||
|
XFree(sizeh);
|
||||||
|
|
||||||
|
if(isdock) {
|
||||||
|
XChangeProperty(dpy, win, netatom[NetWMWindowType], XA_ATOM,
|
||||||
|
32, PropModeReplace,
|
||||||
|
(unsigned char *)&atype, 1);
|
||||||
|
}
|
||||||
|
|
||||||
XChangeProperty(dpy, win, netatom[NetWMWindowType], XA_ATOM,
|
|
||||||
32, PropModeReplace,
|
|
||||||
(unsigned char *)&atype, 1);
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
updatekeys();
|
updatekeys();
|
||||||
drawkeyboard();
|
drawkeyboard();
|
||||||
@ -556,7 +566,7 @@ updatekeys() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
usage(char *argv0) {
|
usage(char *argv0) {
|
||||||
fprintf(stderr, "usage: %s [-htv] [-g geometry]\n", argv0);
|
fprintf(stderr, "usage: %s [-hdv] [-g geometry]\n", argv0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,8 +579,8 @@ main(int argc, char *argv[]) {
|
|||||||
if(!strcmp(argv[i], "-v")) {
|
if(!strcmp(argv[i], "-v")) {
|
||||||
die("svkbd-"VERSION", © 2006-2010 svkbd engineers,"
|
die("svkbd-"VERSION", © 2006-2010 svkbd engineers,"
|
||||||
" see LICENSE for details\n");
|
" see LICENSE for details\n");
|
||||||
} else if(!strcmp(argv[i], "-t")) {
|
} else if(!strcmp(argv[i], "-d")) {
|
||||||
istoolbar = True;
|
isdock = True;
|
||||||
continue;
|
continue;
|
||||||
} else if(!strcmp(argv[i], "-g")) {
|
} else if(!strcmp(argv[i], "-g")) {
|
||||||
bitm = XParseGeometry(argv[i+1], &xr, &yr, &wr, &hr);
|
bitm = XParseGeometry(argv[i+1], &xr, &yr, &wr, &hr);
|
||||||
|
Loading…
Reference in New Issue
Block a user