Add --sync option

This commit is contained in:
Julien Danjou 2008-03-16 11:31:38 +01:00
parent dbe2052320
commit 2c0b68cd4e
2 changed files with 25 additions and 10 deletions

View File

@ -9,7 +9,10 @@ awesome - awesome window manager
SYNOPSIS SYNOPSIS
-------- --------
awesome [-v | --version] [-c configuration file] awesome [ -v | --version ]
awesome [ -h | --help ]
awesome [ -k | --check ] [ -c configuration file ]
awesome [ -s | --sync ] [ -c configuration file ]
DESCRIPTION DESCRIPTION
----------- -----------
@ -42,13 +45,16 @@ awesome can draw a small border around windows to indicate the focus state.
OPTIONS OPTIONS
------- -------
-v | --version:: -v | --version::
prints version information to standard output, then exits. Prints version information to standard output, then exits.
-h | --help:: -h | --help::
prints help information, then exits. Prints help information, then exits.
-c:: --config || -c::
use an alternate configuration file instead of $HOME/.awesomerc. Use an alternate configuration file instead of $HOME/.awesomerc.
-k:: --check | -k::
check configuration file syntax. Check configuration file syntax.
--sync | -s::
Enable X11 synchronization mode. All X11 calls will be synchronized,
so you can break on exit to retrieve a backtrace of X errors.
DEFAULTS MOUSE BINDINGS DEFAULTS MOUSE BINDINGS
----------------------- -----------------------

View File

@ -169,7 +169,8 @@ exit_help(int exit_code)
-h, --help show help\n\ -h, --help show help\n\
-v, --version show version\n\ -v, --version show version\n\
-c, --config FILE configuration file to use\n\ -c, --config FILE configuration file to use\n\
-k, --check check configuration file syntax\n"); -k, --check check configuration file syntax\n\
-s --sync enable synchronization (X debug)\n");
exit(exit_code); exit(exit_code);
} }
@ -194,12 +195,14 @@ main(int argc, char *argv[])
struct sockaddr_un *addr; struct sockaddr_un *addr;
Client *c; Client *c;
XSetWindowAttributes wa; XSetWindowAttributes wa;
Bool xsync = False;
static struct option long_options[] = static struct option long_options[] =
{ {
{"help", 0, NULL, 'h'}, {"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'}, {"version", 0, NULL, 'v'},
{"check", 0, NULL, 'k'}, {"check", 0, NULL, 'k'},
{"config", 0, NULL, 'c'}, {"config", 1, NULL, 'c'},
{"sync", 0, NULL, 's'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
@ -217,7 +220,7 @@ main(int argc, char *argv[])
} }
/* check args */ /* check args */
while((opt = getopt_long(argc, argv, "vhkc:", while((opt = getopt_long(argc, argv, "vhkcs:",
long_options, NULL)) != -1) long_options, NULL)) != -1)
switch(opt) switch(opt)
{ {
@ -236,6 +239,9 @@ main(int argc, char *argv[])
case 'k': case 'k':
return config_check(confpath); return config_check(confpath);
break; break;
case 's':
xsync = True;
break;
} }
/* Text won't be printed correctly otherwise */ /* Text won't be printed correctly otherwise */
@ -258,6 +264,9 @@ main(int argc, char *argv[])
xerrorxlib = XSetErrorHandler(xerror); xerrorxlib = XSetErrorHandler(xerror);
XSync(dpy, False); XSync(dpy, False);
if(xsync)
XSynchronize(dpy, True);
/* store display */ /* store display */
globalconf.display = dpy; globalconf.display = dpy;