ProcessXEvent now returns TRUE if processed, FALSE if not
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -74,7 +74,7 @@ public:
|
|||||||
bool SendIdleEvents(wxWindow* win);
|
bool SendIdleEvents(wxWindow* win);
|
||||||
|
|
||||||
// Processes an X event.
|
// Processes an X event.
|
||||||
virtual void ProcessXEvent(WXEvent* event);
|
virtual bool ProcessXEvent(WXEvent* event);
|
||||||
|
|
||||||
virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
|
virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
long GetMaxRequestSize() const { return m_maxRequestSize; }
|
long GetMaxRequestSize() const { return m_maxRequestSize; }
|
||||||
|
|
||||||
// This handler is called when a property change event occurs
|
// This handler is called when a property change event occurs
|
||||||
virtual void HandlePropertyChange(WXEvent *event);
|
virtual bool HandlePropertyChange(WXEvent *event);
|
||||||
|
|
||||||
// We need this before create the app
|
// We need this before create the app
|
||||||
static WXDisplay* GetDisplay() { return ms_display; }
|
static WXDisplay* GetDisplay() { return ms_display; }
|
||||||
|
@@ -449,10 +449,10 @@ static Bool expose_predicate (Display *display, XEvent *xevent, XPointer arg)
|
|||||||
// wxUSE_NANOX
|
// wxUSE_NANOX
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Processes an X event.
|
// Processes an X event, returning TRUE if the event was processed.
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
void wxApp::ProcessXEvent(WXEvent* _event)
|
bool wxApp::ProcessXEvent(WXEvent* _event)
|
||||||
{
|
{
|
||||||
XEvent* event = (XEvent*) _event;
|
XEvent* event = (XEvent*) _event;
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
case KeyPress:
|
case KeyPress:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||||
@@ -491,20 +491,20 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
if (!win->GetEventHandler()->ProcessEvent( keyEvent ))
|
if (!win->GetEventHandler()->ProcessEvent( keyEvent ))
|
||||||
{
|
{
|
||||||
keyEvent.SetEventType(wxEVT_CHAR);
|
keyEvent.SetEventType(wxEVT_CHAR);
|
||||||
win->GetEventHandler()->ProcessEvent( keyEvent );
|
if (!win->GetEventHandler()->ProcessEvent( keyEvent ))
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
wxKeyEvent keyEvent(wxEVT_KEY_UP);
|
wxKeyEvent keyEvent(wxEVT_KEY_UP);
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||||
|
|
||||||
win->GetEventHandler()->ProcessEvent( keyEvent );
|
return win->GetEventHandler()->ProcessEvent( keyEvent );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
{
|
{
|
||||||
@@ -516,21 +516,21 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
|
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
|
||||||
sizeEvent.SetEventObject( win );
|
sizeEvent.SetEventObject( win );
|
||||||
|
|
||||||
win->GetEventHandler()->ProcessEvent( sizeEvent );
|
return win->GetEventHandler()->ProcessEvent( sizeEvent );
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
{
|
{
|
||||||
//wxLogDebug("PropertyNotify: %s", windowClass.c_str());
|
//wxLogDebug("PropertyNotify: %s", windowClass.c_str());
|
||||||
HandlePropertyChange(_event);
|
return HandlePropertyChange(_event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);
|
Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);
|
||||||
Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);
|
Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);
|
||||||
@@ -540,9 +540,10 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
if ((Atom) (event->xclient.data.l[0]) == wm_delete_window)
|
if ((Atom) (event->xclient.data.l[0]) == wm_delete_window)
|
||||||
{
|
{
|
||||||
win->Close(FALSE);
|
win->Close(FALSE);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
case ResizeRequest:
|
case ResizeRequest:
|
||||||
{
|
{
|
||||||
@@ -564,10 +565,10 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
wxSizeEvent sizeEvent(sz, win->GetId());
|
wxSizeEvent sizeEvent(sz, win->GetId());
|
||||||
sizeEvent.SetEventObject(win);
|
sizeEvent.SetEventObject(win);
|
||||||
|
|
||||||
win->GetEventHandler()->ProcessEvent( sizeEvent );
|
return win->GetEventHandler()->ProcessEvent( sizeEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_NANOX
|
#if wxUSE_NANOX
|
||||||
@@ -576,7 +577,9 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
win->Close(FALSE);
|
win->Close(FALSE);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -607,7 +610,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
|
|
||||||
win->SendEraseEvents();
|
win->SendEraseEvents();
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
case GraphicsExpose:
|
case GraphicsExpose:
|
||||||
@@ -628,7 +631,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
win->SendEraseEvents();
|
win->SendEraseEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
@@ -638,7 +641,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
// Here we check if the top level window is
|
// Here we check if the top level window is
|
||||||
// disabled, which is one aspect of modality.
|
// disabled, which is one aspect of modality.
|
||||||
@@ -646,7 +649,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
while (tlw && !tlw->IsTopLevel())
|
while (tlw && !tlw->IsTopLevel())
|
||||||
tlw = tlw->GetParent();
|
tlw = tlw->GetParent();
|
||||||
if (tlw && !tlw->IsEnabled())
|
if (tlw && !tlw->IsEnabled())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
if (event->type == ButtonPress)
|
if (event->type == ButtonPress)
|
||||||
{
|
{
|
||||||
@@ -658,6 +661,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
g_nextFocus = win;
|
g_nextFocus = win;
|
||||||
|
|
||||||
win->SetFocus();
|
win->SetFocus();
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,14 +670,12 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
{
|
{
|
||||||
// Throw out NotifyGrab and NotifyUngrab
|
// Throw out NotifyGrab and NotifyUngrab
|
||||||
if (event->xcrossing.mode != NotifyNormal)
|
if (event->xcrossing.mode != NotifyNormal)
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wxMouseEvent wxevent;
|
wxMouseEvent wxevent;
|
||||||
wxTranslateMouseEvent(wxevent, win, window, event);
|
wxTranslateMouseEvent(wxevent, win, window, event);
|
||||||
win->GetEventHandler()->ProcessEvent( wxevent );
|
return win->GetEventHandler()->ProcessEvent( wxevent );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
{
|
{
|
||||||
@@ -689,8 +691,9 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
focusEvent.SetWindow( g_prevFocus );
|
focusEvent.SetWindow( g_prevFocus );
|
||||||
g_prevFocus = NULL;
|
g_prevFocus = NULL;
|
||||||
|
|
||||||
win->GetEventHandler()->ProcessEvent(focusEvent);
|
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
@@ -706,8 +709,9 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
focusEvent.SetEventObject(win);
|
focusEvent.SetEventObject(win);
|
||||||
focusEvent.SetWindow( g_nextFocus );
|
focusEvent.SetWindow( g_nextFocus );
|
||||||
g_nextFocus = NULL;
|
g_nextFocus = NULL;
|
||||||
win->GetEventHandler()->ProcessEvent(focusEvent);
|
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef wxUSE_NANOX
|
#ifndef wxUSE_NANOX
|
||||||
@@ -715,6 +719,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
{
|
{
|
||||||
// Do we want to process this (for top-level windows)?
|
// Do we want to process this (for top-level windows)?
|
||||||
// But we want to be able to veto closes, anyway
|
// But we want to be able to veto closes, anyway
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -724,9 +729,11 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
//wxString eventName = wxGetXEventName(XEvent& event);
|
//wxString eventName = wxGetXEventName(XEvent& event);
|
||||||
//wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
|
//wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns TRUE if more time is needed.
|
// Returns TRUE if more time is needed.
|
||||||
@@ -761,11 +768,12 @@ void wxApp::Dispatch()
|
|||||||
|
|
||||||
// This should be redefined in a derived class for
|
// This should be redefined in a derived class for
|
||||||
// handling property change events for XAtom IPC.
|
// handling property change events for XAtom IPC.
|
||||||
void wxApp::HandlePropertyChange(WXEvent *event)
|
bool wxApp::HandlePropertyChange(WXEvent *event)
|
||||||
{
|
{
|
||||||
// by default do nothing special
|
// by default do nothing special
|
||||||
// TODO: what to do for X11
|
// TODO: what to do for X11
|
||||||
// XtDispatchEvent((XEvent*) event);
|
// XtDispatchEvent((XEvent*) event);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::OnIdle(wxIdleEvent& event)
|
void wxApp::OnIdle(wxIdleEvent& event)
|
||||||
|
@@ -42,8 +42,8 @@ public:
|
|||||||
// ctor
|
// ctor
|
||||||
wxEventLoopImpl() { SetExitCode(0); m_keepGoing = FALSE; }
|
wxEventLoopImpl() { SetExitCode(0); m_keepGoing = FALSE; }
|
||||||
|
|
||||||
// process an XEvent
|
// process an XEvent, return TRUE if it was processed
|
||||||
void ProcessEvent(XEvent* event);
|
bool ProcessEvent(XEvent* event);
|
||||||
|
|
||||||
// generate an idle message, return TRUE if more idle time requested
|
// generate an idle message, return TRUE if more idle time requested
|
||||||
bool SendIdleEvent();
|
bool SendIdleEvent();
|
||||||
@@ -71,15 +71,17 @@ public:
|
|||||||
// wxEventLoopImpl message processing
|
// wxEventLoopImpl message processing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxEventLoopImpl::ProcessEvent(XEvent *event)
|
bool wxEventLoopImpl::ProcessEvent(XEvent *event)
|
||||||
{
|
{
|
||||||
// give us the chance to preprocess the message first
|
// give us the chance to preprocess the message first
|
||||||
if ( !PreProcessEvent(event) )
|
if ( PreProcessEvent(event) )
|
||||||
{
|
return TRUE;
|
||||||
|
|
||||||
// if it wasn't done, dispatch it to the corresponding window
|
// if it wasn't done, dispatch it to the corresponding window
|
||||||
if (wxTheApp)
|
if (wxTheApp)
|
||||||
wxTheApp->ProcessXEvent((WXEvent*) event);
|
return wxTheApp->ProcessXEvent((WXEvent*) event);
|
||||||
}
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxEventLoopImpl::PreProcessEvent(XEvent *event)
|
bool wxEventLoopImpl::PreProcessEvent(XEvent *event)
|
||||||
@@ -222,7 +224,7 @@ bool wxEventLoop::Dispatch()
|
|||||||
// TODO allowing for threads, as per e.g. wxMSW
|
// TODO allowing for threads, as per e.g. wxMSW
|
||||||
|
|
||||||
XNextEvent((Display*) wxGetDisplay(), & event);
|
XNextEvent((Display*) wxGetDisplay(), & event);
|
||||||
m_impl->ProcessEvent(& event);
|
(void) m_impl->ProcessEvent(& event);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user