Debug tweaks.

SVN revision: 13468
This commit is contained in:
Kim Woelders 2005-02-22 21:04:24 +00:00
parent 5ea1619391
commit 4dca185ea6
4 changed files with 39 additions and 17 deletions

View File

@ -1016,7 +1016,6 @@ typedef struct
pid_t *children; pid_t *children;
char *machine_name; char *machine_name;
} wm; } wm;
int debug;
int mode; int mode;
char place; char place;
char flipp; char flipp;
@ -1538,10 +1537,13 @@ int EobjIsShaped(const EObj * eo);
#define EDBUG_TYPE_IPC 141 #define EDBUG_TYPE_IPC 141
#define EDBUG_TYPE_EVENTS 142 #define EDBUG_TYPE_EVENTS 142
#define EDBUG_TYPE_ICONBOX 143 #define EDBUG_TYPE_ICONBOX 143
#define EDBUG_TYPE_VERBOSE 144
int EventDebug(unsigned int type); int EventDebug(unsigned int type);
void EventDebugSet(unsigned int type, int value);
#else #else
#define EventDebug(type) 0 #define EventDebug(type) 0
#define EventDebugSet(type, value)
#endif #endif
void EventsInit(void); void EventsInit(void);
void CheckEvent(void); void CheckEvent(void);

View File

@ -71,8 +71,8 @@ static void
EventsExtensionShowInfo(const char *name, int major, int minor, EventsExtensionShowInfo(const char *name, int major, int minor,
int event_base, int error_base) int event_base, int error_base)
{ {
if (Mode.debug) if (EventDebug(EDBUG_TYPE_VERBOSE))
Eprintf("Found extension %-8s version %d.%d -" Eprintf("Found extension %-10s version %d.%d -"
" Event/error base = %d/%d\n", name, " Event/error base = %d/%d\n", name,
major, minor, event_base, error_base); major, minor, event_base, error_base);
} }
@ -356,12 +356,14 @@ EventsCompress(XEvent * evq, int count)
int i, j, n; int i, j, n;
int xa, ya, xb, yb; int xa, ya, xb, yb;
#if ENABLE_DEBUG_EVENTS
/* Debug - should be taken out */ /* Debug - should be taken out */
if (EventDebug(EDBUG_TYPE_COMPRESSION)) if (EventDebug(EDBUG_TYPE_COMPRESSION))
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (evq[i].type) if (evq[i].type)
Eprintf("EventsCompress-1 %3d %s w=%#lx\n", i, Eprintf("EventsCompress-1 %3d %s w=%#lx\n", i,
EventName(evq[i].type), evq[i].xany.window); EventName(evq[i].type), evq[i].xany.window);
#endif
/* Loop through event list, starting with latest */ /* Loop through event list, starting with latest */
for (i = count - 1; i > 0; i--) for (i = count - 1; i > 0; i--)
@ -389,10 +391,12 @@ EventsCompress(XEvent * evq, int count)
ev2->type = 0; ev2->type = 0;
} }
} }
#if ENABLE_DEBUG_EVENTS
if (n && EventDebug(EDBUG_TYPE_COMPRESSION)) if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
Eprintf("EventsCompress n=%4d %s %#lx x,y = %d,%d\n", Eprintf("EventsCompress n=%4d %s %#lx x,y = %d,%d\n",
n, EventName(ev->type), ev->xmotion.window, n, EventName(ev->type), ev->xmotion.window,
ev->xmotion.x, ev->xmotion.y); ev->xmotion.x, ev->xmotion.y);
#endif
break; break;
case Expose: case Expose:
@ -426,10 +430,12 @@ EventsCompress(XEvent * evq, int count)
ev->xexpose.y = ya; ev->xexpose.y = ya;
ev->xexpose.height = yb - ya; ev->xexpose.height = yb - ya;
} }
#if ENABLE_DEBUG_EVENTS
if (EventDebug(EDBUG_TYPE_COMPRESSION)) if (EventDebug(EDBUG_TYPE_COMPRESSION))
Eprintf("EventsCompress n=%4d %s %#lx x=%4d-%4d y=%4d-%4d\n", Eprintf("EventsCompress n=%4d %s %#lx x=%4d-%4d y=%4d-%4d\n",
n, EventName(ev->type), ev->xexpose.window, n, EventName(ev->type), ev->xexpose.window,
xa, xb, ya, yb); xa, xb, ya, yb);
#endif
break; break;
default: default:
@ -446,20 +452,24 @@ EventsCompress(XEvent * evq, int count)
ev2->type = 0; ev2->type = 0;
} }
} }
#if ENABLE_DEBUG_EVENTS
if (n && EventDebug(EDBUG_TYPE_COMPRESSION)) if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
Eprintf("EventsCompress n=%4d %s %#lx\n", Eprintf("EventsCompress n=%4d %s %#lx\n",
n, EventName(ev->type), ev->xmotion.window); n, EventName(ev->type), ev->xmotion.window);
#endif
} }
break; break;
} }
} }
#if ENABLE_DEBUG_EVENTS
/* Debug - should be taken out */ /* Debug - should be taken out */
if (EventDebug(EDBUG_TYPE_COMPRESSION)) if (EventDebug(EDBUG_TYPE_COMPRESSION))
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (evq[i].type) if (evq[i].type)
Eprintf("EventsCompress-2 %3d %s w=%#lx\n", i, Eprintf("EventsCompress-2 %3d %s w=%#lx\n", i,
EventName(evq[i].type), evq[i].xany.window); EventName(evq[i].type), evq[i].xany.window);
#endif
} }
static int static int
@ -737,6 +747,16 @@ EventDebug(unsigned int type)
return ev_debug && (type < sizeof(ev_debug_flags)) && ev_debug_flags[type]; return ev_debug && (type < sizeof(ev_debug_flags)) && ev_debug_flags[type];
} }
void
EventDebugSet(unsigned int type, int value)
{
if (type >= sizeof(ev_debug_flags))
return;
ev_debug = 1;
ev_debug_flags[type] = value;
}
static const char *const TxtEventNames[] = { static const char *const TxtEventNames[] = {
"Error", "Reply", "KeyPress", "KeyRelease", "ButtonPress", "Error", "Reply", "KeyPress", "KeyRelease", "ButtonPress",
"ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn",
@ -936,7 +956,7 @@ EventShow(const XEvent * ev)
#else #else
void void
EventDebugInit(const char *param) EventDebugInit(const char *param __UNUSED__)
{ {
} }

View File

@ -154,9 +154,12 @@ LangInit(void)
else else
enc_int = enc_loc; enc_int = enc_loc;
if (Mode.debug >= 1) if (EventDebug(EDBUG_TYPE_VERBOSE))
Eprintf("Locale: %s Character encoding: locale=%s internal=%s\n", {
setlocale(LC_ALL, NULL), enc_loc, enc_int); Eprintf("Locale: %s\n", setlocale(LC_ALL, NULL));
Eprintf("Character encoding: locale=%s internal=%s\n", enc_loc,
enc_int);
}
if (!strcasecmp(enc_loc, "utf8") || !strcasecmp(enc_loc, "utf-8")) if (!strcasecmp(enc_loc, "utf8") || !strcasecmp(enc_loc, "utf-8"))
Mode.text.utf8_loc = 1; Mode.text.utf8_loc = 1;

View File

@ -73,13 +73,10 @@ main(int argc, char **argv)
Mode.wm.startup = 1; Mode.wm.startup = 1;
Mode.move.check = 1; Mode.move.check = 1;
str = getenv("EDBUG"); str = getenv("EDEBUG");
if (str)
Mode.debug = atoi(str);
str = getenv("EDBUG_FLAGS");
if (str) if (str)
EventDebugInit(str); EventDebugInit(str);
str = getenv("EDBUG_COREDUMP"); str = getenv("EDEBUG_COREDUMP");
if (str) if (str)
Mode.wm.coredump = 1; Mode.wm.coredump = 1;
@ -102,9 +99,6 @@ main(int argc, char **argv)
if (!Mode.wm.machine_name) if (!Mode.wm.machine_name)
Mode.wm.machine_name = Estrdup("localhost"); Mode.wm.machine_name = Estrdup("localhost");
/* Initialise internationalisation */
LangInit();
/* Now we're going to interpret any of the commandline parameters /* Now we're going to interpret any of the commandline parameters
* that are passed to it -- Well, at least the ones that we * that are passed to it -- Well, at least the ones that we
* understand. * understand.
@ -185,13 +179,13 @@ main(int argc, char **argv)
(!strcmp("-version", argv[i])) || (!strcmp("-version", argv[i])) ||
(!strcmp("--version", argv[i]))) (!strcmp("--version", argv[i])))
{ {
printf(_("Enlightenment Version: %s\nLast updated on: %s\n"), printf("Enlightenment %s - %s\n",
ENLIGHTENMENT_VERSION, E_CHECKOUT_DATE); ENLIGHTENMENT_VERSION, E_CHECKOUT_DATE);
exit(0); exit(0);
} }
else if ((!strcmp("-v", argv[i])) || (!strcmp("-verbose", argv[i]))) else if ((!strcmp("-v", argv[i])) || (!strcmp("-verbose", argv[i])))
{ {
Mode.debug++; EventDebugSet(EDBUG_TYPE_VERBOSE, 1);
} }
#if USE_COMPOSITE #if USE_COMPOSITE
else if ((!strcmp("-C", argv[i]))) else if ((!strcmp("-C", argv[i])))
@ -201,6 +195,9 @@ main(int argc, char **argv)
#endif #endif
} }
/* Initialise internationalisation */
LangInit();
/* run most of the setup */ /* run most of the setup */
AlertInit(); /* Set up all the text bits that belong on the GSOD */ AlertInit(); /* Set up all the text bits that belong on the GSOD */
SignalsSetup(); SignalsSetup();