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;
char *machine_name;
} wm;
int debug;
int mode;
char place;
char flipp;
@ -1538,10 +1537,13 @@ int EobjIsShaped(const EObj * eo);
#define EDBUG_TYPE_IPC 141
#define EDBUG_TYPE_EVENTS 142
#define EDBUG_TYPE_ICONBOX 143
#define EDBUG_TYPE_VERBOSE 144
int EventDebug(unsigned int type);
void EventDebugSet(unsigned int type, int value);
#else
#define EventDebug(type) 0
#define EventDebugSet(type, value)
#endif
void EventsInit(void);
void CheckEvent(void);

View File

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

View File

@ -154,9 +154,12 @@ LangInit(void)
else
enc_int = enc_loc;
if (Mode.debug >= 1)
Eprintf("Locale: %s Character encoding: locale=%s internal=%s\n",
setlocale(LC_ALL, NULL), enc_loc, enc_int);
if (EventDebug(EDBUG_TYPE_VERBOSE))
{
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"))
Mode.text.utf8_loc = 1;

View File

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