git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38336
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+// Name: src/x11/app.cpp
// Purpose: wxApp
// Author: Julian Smart
// Modified by:
// Purpose: wxApp
// Author: Julian Smart
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/utils.h"
wxWindowHash *wxWidgetHashTable = NULL;
wxWindowHash *wxClientWidgetHashTable = NULL;
wxWindowHash *wxWidgetHashTable = NULL;
wxWindowHash *wxClientWidgetHashTable = NULL;
-static bool g_showIconic = FALSE;
+static bool g_showIconic = false;
static wxSize g_initialSize = wxDefaultSize;
// This is required for wxFocusEvent::SetWindow(). It will only
static wxSize g_initialSize = wxDefaultSize;
// This is required for wxFocusEvent::SetWindow(). It will only
#endif // __WXDEBUG__
wxString displayName;
#endif // __WXDEBUG__
wxString displayName;
- bool syncDisplay = FALSE;
+ bool syncDisplay = false;
int argcOrig = argc;
for ( int i = 0; i < argcOrig; i++ )
int argcOrig = argc;
for ( int i = 0; i < argcOrig; i++ )
}
else if (wxStrcmp( argv[i], _T("-sync") ) == 0)
{
}
else if (wxStrcmp( argv[i], _T("-sync") ) == 0)
{
argv[i] = NULL;
argc--;
}
else if (wxStrcmp( argv[i], _T("-iconic") ) == 0)
{
argv[i] = NULL;
argc--;
}
else if (wxStrcmp( argv[i], _T("-iconic") ) == 0)
{
XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
// Misc.
XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
// Misc.
- wxSetDetectableAutoRepeat( TRUE );
+ wxSetDetectableAutoRepeat( true );
if ( !wxAppBase::Initialize(argc, argv) )
{
if ( !wxAppBase::Initialize(argc, argv) )
{
m_mainColormap = (WXColormap) NULL;
m_topLevelWidget = (WXWindow) NULL;
m_maxRequestSize = 0;
m_mainColormap = (WXColormap) NULL;
m_topLevelWidget = (WXWindow) NULL;
m_maxRequestSize = 0;
m_initialSize = wxDefaultSize;
#if !wxUSE_NANOX
m_initialSize = wxDefaultSize;
#if !wxUSE_NANOX
if (xevent->xany.type != Expose)
{
if (xevent->xany.type != Expose)
{
- info->found_non_matching = TRUE;
+ info->found_non_matching = true;
return FALSE;
}
if (xevent->xexpose.window != info->window)
{
return FALSE;
}
if (xevent->xexpose.window != info->window)
{
- info->found_non_matching = TRUE;
+ info->found_non_matching = true;
// 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)
win = wxGetClientWindowFromTable(window);
if (!win)
#endif
win = wxGetClientWindowFromTable(window);
if (!win)
#endif
XEvent tmp_event;
wxExposeInfo info;
info.window = event->xexpose.window;
XEvent tmp_event;
wxExposeInfo info;
info.window = event->xexpose.window;
- info.found_non_matching = FALSE;
+ info.found_non_matching = false;
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
{
// Don't worry about optimizing redrawing the border etc.
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
{
// Don't worry about optimizing redrawing the border etc.
XEvent tmp_event;
wxExposeInfo info;
info.window = event->xexpose.window;
XEvent tmp_event;
wxExposeInfo info;
info.window = event->xexpose.window;
- info.found_non_matching = FALSE;
+ info.found_non_matching = false;
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
{
win->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
{
win->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
}
#endif
case KeyPress:
{
if (!win->IsEnabled())
}
#endif
case KeyPress:
{
if (!win->IsEnabled())
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
wxTranslateKeyEvent(keyEvent, win, window, event);
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
wxTranslateKeyEvent(keyEvent, win, window, event);
// We didn't process wxEVT_KEY_DOWN, so send wxEVT_CHAR
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
// We didn't process wxEVT_KEY_DOWN, so send wxEVT_CHAR
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
keyEvent.SetEventType(wxEVT_CHAR);
// Do the translation again, retaining the ASCII
// code.
keyEvent.SetEventType(wxEVT_CHAR);
// Do the translation again, retaining the ASCII
// code.
- wxTranslateKeyEvent(keyEvent, win, window, event, TRUE);
+ wxTranslateKeyEvent(keyEvent, win, window, event, true);
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
if (win->GetEventHandler()->ProcessEvent( keyEvent ))
if ( (keyEvent.m_keyCode == WXK_TAB) &&
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
if ( (keyEvent.m_keyCode == WXK_TAB) &&
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
return win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
}
return win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
}
}
case KeyRelease:
{
if (!win->IsEnabled())
}
case KeyRelease:
{
if (!win->IsEnabled())
wxKeyEvent keyEvent(wxEVT_KEY_UP);
wxTranslateKeyEvent(keyEvent, win, window, event);
wxKeyEvent keyEvent(wxEVT_KEY_UP);
wxTranslateKeyEvent(keyEvent, win, window, event);
return win->GetEventHandler()->ProcessEvent( sizeEvent );
}
}
return win->GetEventHandler()->ProcessEvent( sizeEvent );
}
}
}
#if !wxUSE_NANOX
case PropertyNotify:
}
#if !wxUSE_NANOX
case PropertyNotify:
case ClientMessage:
{
if (!win->IsEnabled())
case ClientMessage:
{
if (!win->IsEnabled())
Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);
Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);
Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);
Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);
{
if ((Atom) (event->xclient.data.l[0]) == wm_delete_window)
{
{
if ((Atom) (event->xclient.data.l[0]) == wm_delete_window)
{
- win->Close(FALSE);
- return TRUE;
+ win->Close(false);
+ return true;
}
#if 0
case DestroyNotify:
}
#if 0
case DestroyNotify:
- win->Close(FALSE);
- return TRUE;
+ win->Close(false);
+ return true;
case MotionNotify:
{
if (!win->IsEnabled())
case MotionNotify:
{
if (!win->IsEnabled())
// Here we check if the top level window is
// disabled, which is one aspect of modality.
// Here we check if the top level window is
// disabled, which is one aspect of modality.
while (tlw && !tlw->IsTopLevel())
tlw = tlw->GetParent();
if (tlw && !tlw->IsEnabled())
while (tlw && !tlw->IsTopLevel())
tlw = tlw->GetParent();
if (tlw && !tlw->IsEnabled())
if (event->type == ButtonPress)
{
if (event->type == ButtonPress)
{
{
// Throw out NotifyGrab and NotifyUngrab
if (event->xcrossing.mode != NotifyNormal)
{
// Throw out NotifyGrab and NotifyUngrab
if (event->xcrossing.mode != NotifyNormal)
}
#endif
wxMouseEvent wxevent;
}
#endif
wxMouseEvent wxevent;
// caused by a child having its focus set.
g_GettingFocus = NULL;
wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
// caused by a child having its focus set.
g_GettingFocus = NULL;
wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
return win->GetEventHandler()->ProcessEvent(focusEvent);
}
}
return win->GetEventHandler()->ProcessEvent(focusEvent);
}
}
case FocusOut:
#if !wxUSE_NANOX
case FocusOut:
#if !wxUSE_NANOX
g_nextFocus = NULL;
return win->GetEventHandler()->ProcessEvent(focusEvent);
}
g_nextFocus = NULL;
return win->GetEventHandler()->ProcessEvent(focusEvent);
}
#ifdef __WXDEBUG__
default:
#ifdef __WXDEBUG__
default:
}
// This should be redefined in a derived class for
}
// This should be redefined in a derived class for
// by default do nothing special
// TODO: what to do for X11
// XtDispatchEvent((XEvent*) event);
// by default do nothing special
// TODO: what to do for X11
// XtDispatchEvent((XEvent*) event);
}
void wxApp::WakeUpIdle()
}
void wxApp::WakeUpIdle()
delete wxLog::SetActiveTarget(new wxLogStderr);
if (!wxAppBase::OnInitGui())
delete wxLog::SetActiveTarget(new wxLogStderr);
if (!wxAppBase::OnInitGui())
GetMainColormap( wxApp::GetDisplay() );
GetMainColormap( wxApp::GetDisplay() );
wxFillXVisualInfo( m_visualInfo, (Display*) wxApp::GetDisplay() );
#endif
wxFillXVisualInfo( m_visualInfo, (Display*) wxApp::GetDisplay() );
#endif
int i;
for (i = 0; i < 2; i++)
{
int i;
for (i = 0; i < 2; i++)
{
- static bool s_inYield = FALSE;
+ static bool s_inYield = false;
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
// Make sure we have an event loop object,
// or Pending/Dispatch will fail
// Make sure we have an event loop object,
// or Pending/Dispatch will fail