зеркало из https://github.com/mozilla/gecko-dev.git
Add some useful debuggin information. This change does not affect any
functionality at all. Its just a rearranging of some code and adding debug stuff so that we can debug event related bugs. In particular (but not limited to) focus events.
This commit is contained in:
Родитель
1c9b82ff42
Коммит
8a4543dc29
|
@ -1210,105 +1210,6 @@ nsWidget::DebugPrintEvent(nsGUIEvent & aEvent,
|
|||
PRBool aPrintCoords,
|
||||
PRBool aPrintXID)
|
||||
{
|
||||
nsString eventName = "UNKNOWN";
|
||||
|
||||
switch(aEvent.message)
|
||||
{
|
||||
case NS_MOUSE_MOVE:
|
||||
eventName = "NS_MOUSE_MOVE";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
eventName = "NS_MOUSE_LEFT_BUTTON_UP";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
eventName = "NS_MOUSE_LEFT_BUTTON_DOWN";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
eventName = "NS_MOUSE_MIDDLE_BUTTON_UP";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
eventName = "NS_MOUSE_MIDDLE_BUTTON_DOWN";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
eventName = "NS_MOUSE_RIGHT_BUTTON_UP";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
eventName = "NS_MOUSE_RIGHT_BUTTON_DOWN";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_ENTER:
|
||||
eventName = "NS_MOUSE_ENTER";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_EXIT:
|
||||
eventName = "NS_MOUSE_EXIT";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
eventName = "NS_MOUSE_LEFT_DOUBLECLICK";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MIDDLE_DOUBLECLICK:
|
||||
eventName = "NS_MOUSE_MIDDLE_DOUBLECLICK";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
eventName = "NS_MOUSE_RIGHT_DOUBLECLICK";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
eventName = "NS_MOUSE_LEFT_CLICK";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MIDDLE_CLICK:
|
||||
eventName = "NS_MOUSE_MIDDLE_CLICK";
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_CLICK:
|
||||
eventName = "NS_MOUSE_RIGHT_CLICK";
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_ENTER:
|
||||
eventName = "NS_DRAGDROP_ENTER";
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_OVER:
|
||||
eventName = "NS_DRAGDROP_OVER";
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_EXIT:
|
||||
eventName = "NS_DRAGDROP_EXIT";
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_DROP:
|
||||
eventName = "NS_DRAGDROP_DROP";
|
||||
break;
|
||||
|
||||
case NS_GOTFOCUS:
|
||||
eventName = "NS_GOTFOCUS";
|
||||
break;
|
||||
|
||||
case NS_LOSTFOCUS:
|
||||
eventName = "NS_LOSTFOCUS";
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
sprintf(buf,"%d",aEvent.message);
|
||||
|
||||
eventName = buf;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
static int sPrintCount=0;
|
||||
|
||||
printf("%4d %-14s(this=%-8p , name=%-12s",
|
||||
|
@ -1324,7 +1225,7 @@ nsWidget::DebugPrintEvent(nsGUIEvent & aEvent,
|
|||
}
|
||||
|
||||
printf(" , event=%-16s",
|
||||
(const char *) nsAutoCString(eventName));
|
||||
(const char *) nsAutoCString(GuiEventToString(aEvent)));
|
||||
|
||||
if (aPrintCoords)
|
||||
{
|
||||
|
|
|
@ -379,6 +379,62 @@ PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Turning TRACE_EVENTS on will cause printfs for most
|
||||
// events that are dispatched.
|
||||
//
|
||||
// Motion events are extra noisy so they get their own
|
||||
// define: TRACE_EVENTS_MOTION
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
#undef TRACE_EVENTS
|
||||
#undef TRACE_EVENTS_MOTION
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsWindow::DebugPrintEvent(nsGUIEvent & aEvent,
|
||||
char * sMessage,
|
||||
HWND aWnd,
|
||||
PRBool aPrintCoords)
|
||||
{
|
||||
nsString eventName = "UNKNOWN";
|
||||
|
||||
#ifndef TRACE_EVENTS_MOTION
|
||||
if (aEvent.message == NS_MOUSE_MOVE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int sPrintCount=0;
|
||||
|
||||
printf("%4d %-14s(this=%-8p , HWND=%-8p",
|
||||
sPrintCount++,
|
||||
sMessage,
|
||||
this,
|
||||
aWnd);
|
||||
|
||||
printf(" , event=%-16s",
|
||||
(const char *) nsAutoCString(GuiEventToString(aEvent)));
|
||||
|
||||
if (aPrintCoords)
|
||||
{
|
||||
printf(" , x=%-3d, y=%d)",
|
||||
aEvent.point.x,
|
||||
aEvent.point.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(")");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
#endif // DEBUG
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Initialize an event to dispatch
|
||||
|
@ -450,6 +506,10 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
|
|||
//-------------------------------------------------------------------------
|
||||
PRBool nsWindow::DispatchWindowEvent(nsGUIEvent* event)
|
||||
{
|
||||
#ifdef TRACE_EVENTS
|
||||
DebugPrintEvent(*event,"Something",mWnd,PR_TRUE);
|
||||
#endif
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(event, status);
|
||||
return ConvertStatus(status);
|
||||
|
|
|
@ -201,6 +201,15 @@ protected:
|
|||
void HandleEndComposition(void);
|
||||
void MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthResult, nsTextRangeArray* textRangeListResult);
|
||||
|
||||
private:
|
||||
|
||||
#ifdef DEBUG
|
||||
void DebugPrintEvent(nsGUIEvent & aEvent,
|
||||
char * sMessage,
|
||||
HWND aWnd,
|
||||
PRBool aPrintCoords);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static nsWindow* gCurrentWindow;
|
||||
nsPoint mLastPoint;
|
||||
|
|
Загрузка…
Ссылка в новой задаче