Slightly expand and expose verbose debugging.
This commit is contained in:
parent
1742a041f4
commit
5e4538db44
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
* $OpenBSD: calmwm.c,v 1.107 2018/01/02 14:04:58 okan Exp $
|
* $OpenBSD: calmwm.c,v 1.108 2018/02/04 22:56:26 okan Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -67,7 +67,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
fallback = u_argv(argv);
|
fallback = u_argv(argv);
|
||||||
Conf.wm_argv = u_argv(argv);
|
Conf.wm_argv = u_argv(argv);
|
||||||
while ((ch = getopt(argc, argv, "c:d:")) != -1) {
|
while ((ch = getopt(argc, argv, "c:d:v")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'c':
|
case 'c':
|
||||||
conf_file = optarg;
|
conf_file = optarg;
|
||||||
@ -75,6 +75,9 @@ main(int argc, char **argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
display_name = optarg;
|
display_name = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
Conf.debug++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
@ -241,7 +244,7 @@ usage(void)
|
|||||||
{
|
{
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
(void)fprintf(stderr, "usage: %s [-c file] [-d display]\n",
|
(void)fprintf(stderr, "usage: %s [-v] [-c file] [-d display]\n",
|
||||||
__progname);
|
__progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
* $OpenBSD: calmwm.h,v 1.355 2018/02/02 13:40:55 okan Exp $
|
* $OpenBSD: calmwm.h,v 1.356 2018/02/04 22:56:26 okan Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CALMWM_H_
|
#ifndef _CALMWM_H_
|
||||||
@ -31,12 +31,10 @@
|
|||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
/* #define DEBUG */
|
#define LOG_DEBUG0(...) log_debug(0, __func__, __VA_ARGS__)
|
||||||
#ifdef DEBUG
|
#define LOG_DEBUG1(...) log_debug(1, __func__, __VA_ARGS__)
|
||||||
#define DPRINTF(...) log_debug(__func__, __VA_ARGS__)
|
#define LOG_DEBUG2(...) log_debug(2, __func__, __VA_ARGS__)
|
||||||
#else
|
#define LOG_DEBUG3(...) log_debug(3, __func__, __VA_ARGS__)
|
||||||
#define DPRINTF(...) do {} while (0)
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#undef MAX
|
#undef MAX
|
||||||
@ -313,6 +311,7 @@ struct conf {
|
|||||||
char *homedir;
|
char *homedir;
|
||||||
char *known_hosts;
|
char *known_hosts;
|
||||||
char *wm_argv;
|
char *wm_argv;
|
||||||
|
u_int32_t debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* MWM hints */
|
/* MWM hints */
|
||||||
@ -591,9 +590,9 @@ void xu_ewmh_restore_net_wm_state(struct client_ctx *);
|
|||||||
char *u_argv(char * const *);
|
char *u_argv(char * const *);
|
||||||
void u_exec(char *);
|
void u_exec(char *);
|
||||||
void u_spawn(char *);
|
void u_spawn(char *);
|
||||||
void log_debug(const char *, const char *, ...)
|
void log_debug(int, const char *, const char *, ...)
|
||||||
__attribute__((__format__ (printf, 2, 3)))
|
__attribute__((__format__ (printf, 3, 4)))
|
||||||
__attribute__((__nonnull__ (2)));
|
__attribute__((__nonnull__ (3)));
|
||||||
|
|
||||||
void *xcalloc(size_t, size_t);
|
void *xcalloc(size_t, size_t);
|
||||||
void *xmalloc(size_t);
|
void *xmalloc(size_t);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: cwm.1,v 1.61 2017/12/30 22:25:09 okan Exp $
|
.\" $OpenBSD: cwm.1,v 1.62 2018/02/04 22:56:26 okan Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
|
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
|
||||||
.\"
|
.\"
|
||||||
@ -14,7 +14,7 @@
|
|||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: December 30 2017 $
|
.Dd $Mdocdate: February 4 2018 $
|
||||||
.Dt CWM 1
|
.Dt CWM 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -23,6 +23,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.\" For a program: program [-abc] file ...
|
.\" For a program: program [-abc] file ...
|
||||||
.Nm cwm
|
.Nm cwm
|
||||||
|
.Op Fl v
|
||||||
.Op Fl c Ar file
|
.Op Fl c Ar file
|
||||||
.Op Fl d Ar display
|
.Op Fl d Ar display
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -47,6 +48,11 @@ however,
|
|||||||
will continue to process the rest of the configuration file.
|
will continue to process the rest of the configuration file.
|
||||||
.It Fl d Ar display
|
.It Fl d Ar display
|
||||||
Specify the display to use.
|
Specify the display to use.
|
||||||
|
.It Fl v
|
||||||
|
Verbose mode.
|
||||||
|
Multiple
|
||||||
|
.Fl v
|
||||||
|
options increase the verbosity.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
* $OpenBSD: util.c,v 1.21 2018/02/02 13:40:55 okan Exp $
|
* $OpenBSD: util.c,v 1.22 2018/02/04 22:56:26 okan Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -123,14 +123,16 @@ log_msg(const char *msg, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
log_debug(const char *func, const char *msg, ...)
|
log_debug(int level, const char *func, const char *msg, ...)
|
||||||
{
|
{
|
||||||
char *fmt;
|
char *fmt;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (Conf.debug < level)
|
||||||
|
return;
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
if (asprintf(&fmt, "%s: %s", func, msg) == -1)
|
xasprintf(&fmt, "debug%d: %s: %s", level, func, msg);
|
||||||
exit(1);
|
|
||||||
log_msg(fmt, ap);
|
log_msg(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
* $OpenBSD: xevents.c,v 1.133 2018/02/02 13:50:22 okan Exp $
|
* $OpenBSD: xevents.c,v 1.134 2018/02/04 22:56:26 okan Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -77,7 +77,7 @@ xev_handle_maprequest(XEvent *ee)
|
|||||||
XMapRequestEvent *e = &ee->xmaprequest;
|
XMapRequestEvent *e = &ee->xmaprequest;
|
||||||
struct client_ctx *cc = NULL, *old_cc;
|
struct client_ctx *cc = NULL, *old_cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((old_cc = client_current()) != NULL)
|
if ((old_cc = client_current()) != NULL)
|
||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
@ -95,7 +95,7 @@ xev_handle_unmapnotify(XEvent *ee)
|
|||||||
XUnmapEvent *e = &ee->xunmap;
|
XUnmapEvent *e = &ee->xunmap;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
if (e->send_event) {
|
if (e->send_event) {
|
||||||
@ -113,7 +113,7 @@ xev_handle_destroynotify(XEvent *ee)
|
|||||||
XDestroyWindowEvent *e = &ee->xdestroywindow;
|
XDestroyWindowEvent *e = &ee->xdestroywindow;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL)
|
if ((cc = client_find(e->window)) != NULL)
|
||||||
client_delete(cc);
|
client_delete(cc);
|
||||||
@ -127,7 +127,7 @@ xev_handle_configurerequest(XEvent *ee)
|
|||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
sc = cc->sc;
|
sc = cc->sc;
|
||||||
@ -182,7 +182,7 @@ xev_handle_propertynotify(XEvent *ee)
|
|||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
switch (e->atom) {
|
switch (e->atom) {
|
||||||
@ -219,7 +219,7 @@ xev_handle_enternotify(XEvent *ee)
|
|||||||
XCrossingEvent *e = &ee->xcrossing;
|
XCrossingEvent *e = &ee->xcrossing;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
Last_Event_Time = e->time;
|
Last_Event_Time = e->time;
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ xev_handle_buttonpress(XEvent *ee)
|
|||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
struct bind_ctx *mb;
|
struct bind_ctx *mb;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
e->state &= ~IGNOREMODMASK;
|
e->state &= ~IGNOREMODMASK;
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ xev_handle_buttonrelease(XEvent *ee)
|
|||||||
XButtonEvent *e = &ee->xbutton;
|
XButtonEvent *e = &ee->xbutton;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", ee->xbutton.window);
|
LOG_DEBUG3("window: 0x%lx", ee->xbutton.window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
if (cc->flags & (CLIENT_ACTIVE | CLIENT_HIGHLIGHT)) {
|
if (cc->flags & (CLIENT_ACTIVE | CLIENT_HIGHLIGHT)) {
|
||||||
@ -293,7 +293,7 @@ xev_handle_keypress(XEvent *ee)
|
|||||||
KeySym keysym, skeysym;
|
KeySym keysym, skeysym;
|
||||||
unsigned int modshift;
|
unsigned int modshift;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0);
|
keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0);
|
||||||
skeysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 1);
|
skeysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 1);
|
||||||
@ -346,7 +346,7 @@ xev_handle_keyrelease(XEvent *ee)
|
|||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((sc = screen_find(e->root)) == NULL)
|
if ((sc = screen_find(e->root)) == NULL)
|
||||||
return;
|
return;
|
||||||
@ -377,7 +377,7 @@ xev_handle_clientmessage(XEvent *ee)
|
|||||||
struct client_ctx *cc, *old_cc;
|
struct client_ctx *cc, *old_cc;
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if (e->message_type == cwmh[WM_CHANGE_STATE]) {
|
if (e->message_type == cwmh[WM_CHANGE_STATE]) {
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
@ -426,7 +426,7 @@ xev_handle_randr(XEvent *ee)
|
|||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DPRINTF("new size: %d/%d", rev->width, rev->height);
|
LOG_DEBUG3("new size: %d/%d", rev->width, rev->height);
|
||||||
|
|
||||||
i = XRRRootToScreen(X_Dpy, rev->root);
|
i = XRRRootToScreen(X_Dpy, rev->root);
|
||||||
TAILQ_FOREACH(sc, &Screenq, entry) {
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
@ -448,7 +448,7 @@ xev_handle_mappingnotify(XEvent *ee)
|
|||||||
XMappingEvent *e = &ee->xmapping;
|
XMappingEvent *e = &ee->xmapping;
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
XRefreshKeyboardMapping(e);
|
XRefreshKeyboardMapping(e);
|
||||||
if (e->request == MappingKeyboard) {
|
if (e->request == MappingKeyboard) {
|
||||||
@ -463,7 +463,7 @@ xev_handle_expose(XEvent *ee)
|
|||||||
XExposeEvent *e = &ee->xexpose;
|
XExposeEvent *e = &ee->xexpose;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
DPRINTF("window: 0x%lx", e->window);
|
LOG_DEBUG3("window: 0x%lx", e->window);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL && e->count == 0)
|
if ((cc = client_find(e->window)) != NULL && e->count == 0)
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
|
Loading…
Reference in New Issue
Block a user