Adding a toolbar option and changing the window type.

master
Christoph Lohmann 14 years ago
parent 5c97d98c63
commit ce9fd8d282
  1. 18
      svkbd.c

@ -20,7 +20,7 @@
/* enums */ /* enums */
enum { ColFG, ColBG, ColLast }; enum { ColFG, ColBG, ColLast };
enum { NetWMWindowType, NetWMWindowTypeDock, NetLast }; enum { NetWMWindowType, NetLast };
/* typedefs */ /* typedefs */
typedef unsigned int uint; typedef unsigned int uint;
@ -89,7 +89,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; static Bool running = True, istoolbar = 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";
@ -333,6 +333,7 @@ setup(void) {
XSetWindowAttributes wa; XSetWindowAttributes wa;
XTextProperty str; XTextProperty str;
XClassHint *ch; XClassHint *ch;
Atom atype;
int i, sh, sw; int i, sh, sw;
XWMHints *wmh; XWMHints *wmh;
@ -345,7 +346,10 @@ setup(void) {
/* init atoms */ /* init atoms */
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDock] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False); if(istoolbar)
atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_TOOLBAR", False);
else
atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
/* init appearance */ /* init appearance */
countrows(); countrows();
@ -403,7 +407,7 @@ setup(void) {
XChangeProperty(dpy, win, netatom[NetWMWindowType], XA_ATOM, XChangeProperty(dpy, win, netatom[NetWMWindowType], XA_ATOM,
32, PropModeReplace, 32, PropModeReplace,
(unsigned char *)&netatom[NetWMWindowTypeDock], 1); (unsigned char *)&atype, 1);
XMapRaised(dpy, win); XMapRaised(dpy, win);
updatekeys(); updatekeys();
drawkeyboard(); drawkeyboard();
@ -472,7 +476,7 @@ updatekeys() {
void void
usage(char *argv0) { usage(char *argv0) {
fprintf(stderr, "usage: %s [-hv] [-wh height] [-ww width] " fprintf(stderr, "usage: %s [-htv] [-wh height] [-ww width] "
"[-wx x position] [-wy y position]\n", argv0); "[-wx x position] [-wy y position]\n", argv0);
exit(1); exit(1);
} }
@ -486,6 +490,10 @@ main(int argc, char *argv[]) {
die("svkbd-"VERSION", © 2006-2010 svkbd engineers," die("svkbd-"VERSION", © 2006-2010 svkbd engineers,"
" see LICENSE for details\n"); " see LICENSE for details\n");
} }
if(!strcmp(argv[i], "-t")) {
istoolbar = True;
continue;
}
else if(argv[i][0] == '-' && argv[i][1] == 'w') { else if(argv[i][0] == '-' && argv[i][1] == 'w') {
switch(i >= argc - 1 ? 0 : argv[i][2]) { switch(i >= argc - 1 ? 0 : argv[i][2]) {
case 'h': case 'h':

Loading…
Cancel
Save