Source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: app.cpp
|
// Name: src/x11/app.cpp
|
||||||
// Purpose: wxApp
|
// Purpose: wxApp
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
@@ -45,7 +48,7 @@ extern wxList wxPendingDelete;
|
|||||||
wxWindowHash *wxWidgetHashTable = NULL;
|
wxWindowHash *wxWidgetHashTable = NULL;
|
||||||
wxWindowHash *wxClientWidgetHashTable = NULL;
|
wxWindowHash *wxClientWidgetHashTable = NULL;
|
||||||
|
|
||||||
static bool g_showIconic = FALSE;
|
static bool g_showIconic = false;
|
||||||
static wxSize g_initialSize = wxDefaultSize;
|
static wxSize g_initialSize = wxDefaultSize;
|
||||||
|
|
||||||
// This is required for wxFocusEvent::SetWindow(). It will only
|
// This is required for wxFocusEvent::SetWindow(). It will only
|
||||||
@@ -95,7 +98,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
wxString displayName;
|
wxString displayName;
|
||||||
bool syncDisplay = FALSE;
|
bool syncDisplay = false;
|
||||||
|
|
||||||
int argcOrig = argc;
|
int argcOrig = argc;
|
||||||
for ( int i = 0; i < argcOrig; i++ )
|
for ( int i = 0; i < argcOrig; i++ )
|
||||||
@@ -135,14 +138,14 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
}
|
}
|
||||||
else if (wxStrcmp( argv[i], _T("-sync") ) == 0)
|
else if (wxStrcmp( argv[i], _T("-sync") ) == 0)
|
||||||
{
|
{
|
||||||
syncDisplay = TRUE;
|
syncDisplay = true;
|
||||||
|
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
else if (wxStrcmp( argv[i], _T("-iconic") ) == 0)
|
else if (wxStrcmp( argv[i], _T("-iconic") ) == 0)
|
||||||
{
|
{
|
||||||
g_showIconic = TRUE;
|
g_showIconic = true;
|
||||||
|
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
argc--;
|
argc--;
|
||||||
@@ -181,7 +184,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
|
XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
|
||||||
|
|
||||||
// Misc.
|
// Misc.
|
||||||
wxSetDetectableAutoRepeat( TRUE );
|
wxSetDetectableAutoRepeat( true );
|
||||||
|
|
||||||
if ( !wxAppBase::Initialize(argc, argv) )
|
if ( !wxAppBase::Initialize(argc, argv) )
|
||||||
{
|
{
|
||||||
@@ -224,7 +227,7 @@ wxApp::wxApp()
|
|||||||
m_mainColormap = (WXColormap) NULL;
|
m_mainColormap = (WXColormap) NULL;
|
||||||
m_topLevelWidget = (WXWindow) NULL;
|
m_topLevelWidget = (WXWindow) NULL;
|
||||||
m_maxRequestSize = 0;
|
m_maxRequestSize = 0;
|
||||||
m_showIconic = FALSE;
|
m_showIconic = false;
|
||||||
m_initialSize = wxDefaultSize;
|
m_initialSize = wxDefaultSize;
|
||||||
|
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
@@ -259,13 +262,13 @@ static Bool expose_predicate (Display *display, XEvent *xevent, XPointer arg)
|
|||||||
|
|
||||||
if (xevent->xany.type != Expose)
|
if (xevent->xany.type != Expose)
|
||||||
{
|
{
|
||||||
info->found_non_matching = TRUE;
|
info->found_non_matching = true;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xevent->xexpose.window != info->window)
|
if (xevent->xexpose.window != info->window)
|
||||||
{
|
{
|
||||||
info->found_non_matching = TRUE;
|
info->found_non_matching = true;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +278,7 @@ static Bool expose_predicate (Display *display, XEvent *xevent, XPointer arg)
|
|||||||
// wxUSE_NANOX
|
// wxUSE_NANOX
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Processes an X event, returning TRUE if the event was processed.
|
// Processes an X event, returning true if the event was processed.
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxApp::ProcessXEvent(WXEvent* _event)
|
bool wxApp::ProcessXEvent(WXEvent* _event)
|
||||||
@@ -301,7 +304,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
win = wxGetClientWindowFromTable(window);
|
win = wxGetClientWindowFromTable(window);
|
||||||
if (!win)
|
if (!win)
|
||||||
#endif
|
#endif
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
@@ -318,7 +321,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
XEvent tmp_event;
|
XEvent tmp_event;
|
||||||
wxExposeInfo info;
|
wxExposeInfo info;
|
||||||
info.window = event->xexpose.window;
|
info.window = event->xexpose.window;
|
||||||
info.found_non_matching = FALSE;
|
info.found_non_matching = false;
|
||||||
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
|
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
|
||||||
{
|
{
|
||||||
// Don't worry about optimizing redrawing the border etc.
|
// Don't worry about optimizing redrawing the border etc.
|
||||||
@@ -337,7 +340,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
XEvent tmp_event;
|
XEvent tmp_event;
|
||||||
wxExposeInfo info;
|
wxExposeInfo info;
|
||||||
info.window = event->xexpose.window;
|
info.window = event->xexpose.window;
|
||||||
info.found_non_matching = FALSE;
|
info.found_non_matching = false;
|
||||||
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
|
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
|
||||||
{
|
{
|
||||||
win->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
|
win->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
|
||||||
@@ -365,7 +368,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
//win->Update();
|
//win->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
@@ -386,14 +389,14 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
// win->Update();
|
// win->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||||
@@ -402,14 +405,14 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
|
|
||||||
// We didn't process wxEVT_KEY_DOWN, so send wxEVT_CHAR
|
// We didn't process wxEVT_KEY_DOWN, so send wxEVT_CHAR
|
||||||
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
|
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
keyEvent.SetEventType(wxEVT_CHAR);
|
keyEvent.SetEventType(wxEVT_CHAR);
|
||||||
// Do the translation again, retaining the ASCII
|
// Do the translation again, retaining the ASCII
|
||||||
// code.
|
// code.
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event, TRUE);
|
wxTranslateKeyEvent(keyEvent, win, window, event, true);
|
||||||
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
|
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if ( (keyEvent.m_keyCode == WXK_TAB) &&
|
if ( (keyEvent.m_keyCode == WXK_TAB) &&
|
||||||
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
||||||
@@ -424,12 +427,12 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
return win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
|
return win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxKeyEvent keyEvent(wxEVT_KEY_UP);
|
wxKeyEvent keyEvent(wxEVT_KEY_UP);
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||||
@@ -461,7 +464,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
return win->GetEventHandler()->ProcessEvent( sizeEvent );
|
return win->GetEventHandler()->ProcessEvent( sizeEvent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
@@ -472,7 +475,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return FALSE;
|
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);
|
||||||
@@ -481,11 +484,11 @@ bool 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 true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
@@ -527,10 +530,10 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
{
|
{
|
||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
win->Close(FALSE);
|
win->Close(false);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -541,7 +544,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return FALSE;
|
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.
|
||||||
@@ -549,7 +552,7 @@ bool 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 FALSE;
|
return false;
|
||||||
|
|
||||||
if (event->type == ButtonPress)
|
if (event->type == ButtonPress)
|
||||||
{
|
{
|
||||||
@@ -578,7 +581,7 @@ bool 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 FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wxMouseEvent wxevent;
|
wxMouseEvent wxevent;
|
||||||
@@ -600,7 +603,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
// caused by a child having its focus set.
|
// caused by a child having its focus set.
|
||||||
g_GettingFocus = NULL;
|
g_GettingFocus = NULL;
|
||||||
wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
|
wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -612,7 +615,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
@@ -628,7 +631,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
g_nextFocus = NULL;
|
g_nextFocus = NULL;
|
||||||
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
return win->GetEventHandler()->ProcessEvent(focusEvent);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
default:
|
default:
|
||||||
@@ -638,7 +641,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should be redefined in a derived class for
|
// This should be redefined in a derived class for
|
||||||
@@ -648,7 +651,7 @@ 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::WakeUpIdle()
|
void wxApp::WakeUpIdle()
|
||||||
@@ -668,7 +671,7 @@ bool wxApp::OnInitGui()
|
|||||||
delete wxLog::SetActiveTarget(new wxLogStderr);
|
delete wxLog::SetActiveTarget(new wxLogStderr);
|
||||||
|
|
||||||
if (!wxAppBase::OnInitGui())
|
if (!wxAppBase::OnInitGui())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
GetMainColormap( wxApp::GetDisplay() );
|
GetMainColormap( wxApp::GetDisplay() );
|
||||||
|
|
||||||
@@ -679,7 +682,7 @@ bool wxApp::OnInitGui()
|
|||||||
wxFillXVisualInfo( m_visualInfo, (Display*) wxApp::GetDisplay() );
|
wxFillXVisualInfo( m_visualInfo, (Display*) wxApp::GetDisplay() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
@@ -785,7 +788,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
static bool s_inYield = FALSE;
|
static bool s_inYield = false;
|
||||||
|
|
||||||
if ( s_inYield )
|
if ( s_inYield )
|
||||||
{
|
{
|
||||||
@@ -794,10 +797,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
wxFAIL_MSG( wxT("wxYield called recursively" ) );
|
wxFAIL_MSG( wxT("wxYield called recursively" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_inYield = TRUE;
|
s_inYield = true;
|
||||||
|
|
||||||
// Make sure we have an event loop object,
|
// Make sure we have an event loop object,
|
||||||
// or Pending/Dispatch will fail
|
// or Pending/Dispatch will fail
|
||||||
@@ -827,10 +830,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
delete newEventLoop;
|
delete newEventLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_inYield = FALSE;
|
s_inYield = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
@@ -849,4 +852,3 @@ void wxApp::OnAssert(const wxChar *file, int line, const wxChar* cond, const wxC
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user