]> git.saurik.com Git - wxWidgets.git/blame - src/motif/app.cpp
More fixes to make Borland compile this in Unicode mode.
[wxWidgets.git] / src / motif / app.cpp
CommitLineData
4bb6408c
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.cpp
3// Purpose: wxApp
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
afb74891 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "app.h"
14#endif
15
16#include "wx/frame.h"
17#include "wx/app.h"
18#include "wx/utils.h"
19#include "wx/gdicmn.h"
20#include "wx/pen.h"
21#include "wx/brush.h"
22#include "wx/cursor.h"
23#include "wx/icon.h"
24#include "wx/palette.h"
25#include "wx/dc.h"
26#include "wx/dialog.h"
27#include "wx/msgdlg.h"
28#include "wx/log.h"
29#include "wx/module.h"
30#include "wx/memory.h"
b412f9be 31
7bcb11d3 32#if wxUSE_THREADS
aaa38880 33#include "wx/thread.h"
7bcb11d3 34#endif
4bb6408c 35
47d67540 36#if wxUSE_WX_RESOURCES
9c6e1335 37 #include "wx/resource.h"
4bb6408c
JS
38#endif
39
4bb6408c
JS
40#include <Xm/Xm.h>
41#include <X11/Xlib.h>
42#include <X11/Xutil.h>
43#include <X11/Xresource.h>
44#include <X11/Xatom.h>
45
46#include "wx/motif/private.h"
47
48#include <string.h>
49
50extern char *wxBuffer;
51extern wxList wxPendingDelete;
7491d644 52
7214297d 53#if wxUSE_THREADS
4d3a259a
GL
54extern wxList *wxPendingEvents;
55extern wxCriticalSection *wxPendingEventsLocker;
7491d644 56#endif // wxUSE_THREADS
4bb6408c
JS
57
58wxApp *wxTheApp = NULL;
59
60wxHashTable *wxWidgetHashTable = NULL;
61
62#if !USE_SHARED_LIBRARY
63IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
9c6e1335 64
4bb6408c 65BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
9c6e1335 66 EVT_IDLE(wxApp::OnIdle)
4bb6408c
JS
67END_EVENT_TABLE()
68#endif
69
70long wxApp::sm_lastMessageTime = 0;
71
72bool wxApp::Initialize()
73{
4bb6408c 74 wxBuffer = new char[BUFSIZ + 512];
afb74891 75
4bb6408c 76 wxClassInfo::InitializeClasses();
afb74891 77
4d3a259a
GL
78 // GL: I'm annoyed ... I don't know where to put this and I don't want to
79 // create a module for that as it's part of the core.
80#if wxUSE_THREADS
81 wxPendingEvents = new wxList();
82 wxPendingEventsLocker = new wxCriticalSection();
83#endif
84
4bb6408c
JS
85 wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
86 wxTheColourDatabase->Initialize();
afb74891 87
4b5f3fe6 88 wxInitializeStockLists();
4bb6408c 89 wxInitializeStockObjects();
afb74891 90
47d67540 91#if wxUSE_WX_RESOURCES
4bb6408c
JS
92 wxInitializeResourceSystem();
93#endif
afb74891 94
2d120f83 95 // For PostScript printing
47d67540 96#if wxUSE_POSTSCRIPT
2d120f83 97 /* Done using wxModule now
4bb6408c
JS
98 wxInitializePrintSetupData();
99 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
100 wxThePrintPaperDatabase->CreateDatabase();
2d120f83 101 */
4bb6408c 102#endif
afb74891 103
4bb6408c 104 wxBitmap::InitStandardHandlers();
afb74891 105
4bb6408c 106 wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
afb74891 107
4bb6408c 108 wxModule::RegisterModules();
aaa38880 109 if (!wxModule::InitializeModules()) return FALSE;
afb74891 110
4bb6408c
JS
111 return TRUE;
112}
113
114void wxApp::CleanUp()
115{
116 delete wxWidgetHashTable;
117 wxWidgetHashTable = NULL;
afb74891 118
4bb6408c 119 wxModule::CleanUpModules();
afb74891 120
47d67540 121#if wxUSE_WX_RESOURCES
4bb6408c
JS
122 wxCleanUpResourceSystem();
123#endif
afb74891 124
4bb6408c 125 wxDeleteStockObjects() ;
afb74891 126
4bb6408c 127 // Destroy all GDI lists, etc.
afb74891 128
4bb6408c
JS
129 delete wxTheBrushList;
130 wxTheBrushList = NULL;
afb74891 131
4bb6408c
JS
132 delete wxThePenList;
133 wxThePenList = NULL;
afb74891 134
4bb6408c
JS
135 delete wxTheFontList;
136 wxTheFontList = NULL;
afb74891 137
4bb6408c
JS
138 delete wxTheBitmapList;
139 wxTheBitmapList = NULL;
afb74891 140
4bb6408c
JS
141 delete wxTheColourDatabase;
142 wxTheColourDatabase = NULL;
afb74891 143
47d67540 144#if wxUSE_POSTSCRIPT
2d120f83 145 /* Done using wxModule now
4bb6408c
JS
146 wxInitializePrintSetupData(FALSE);
147 delete wxThePrintPaperDatabase;
148 wxThePrintPaperDatabase = NULL;
2d120f83 149 */
4bb6408c 150#endif
afb74891 151
4bb6408c 152 wxBitmap::CleanUpHandlers();
afb74891 153
4bb6408c
JS
154 delete[] wxBuffer;
155 wxBuffer = NULL;
afb74891 156
4bb6408c 157 wxClassInfo::CleanUpClasses();
afb74891 158
184b5d99
JS
159 delete wxTheApp;
160 wxTheApp = NULL;
afb74891 161
4d3a259a
GL
162 // GL: I'm annoyed ... I don't know where to put this and I don't want to
163 // create a module for that as it's part of the core.
164#if wxUSE_THREADS
165 delete wxPendingEvents;
166 delete wxPendingEventsLocker;
167#endif
168
184b5d99
JS
169#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
170 // At this point we want to check if there are any memory
171 // blocks that aren't part of the wxDebugContext itself,
172 // as a special case. Then when dumping we need to ignore
173 // wxDebugContext, too.
4fabb575 174 if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
184b5d99 175 {
2d120f83
JS
176 wxLogDebug("There were memory leaks.\n");
177 wxDebugContext::Dump();
178 wxDebugContext::PrintStatistics();
184b5d99 179 }
184b5d99 180#endif
afb74891 181
4bb6408c
JS
182 // do it as the very last thing because everything else can log messages
183 wxLog::DontCreateOnDemand();
184 // do it as the very last thing because everything else can log messages
185 delete wxLog::SetActiveTarget(NULL);
186}
187
188int wxEntry( int argc, char *argv[] )
189{
4fabb575
JS
190#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
191 // This seems to be necessary since there are 'rogue'
192 // objects present at this point (perhaps global objects?)
193 // Setting a checkpoint will ignore them as far as the
194 // memory checking facility is concerned.
195 // Of course you may argue that memory allocated in globals should be
196 // checked, but this is a reasonable compromise.
197 wxDebugContext::SetCheckpoint();
198#endif
afb74891 199
4bb6408c 200 if (!wxApp::Initialize())
2d120f83 201 return FALSE;
afb74891 202
4bb6408c
JS
203 if (!wxTheApp)
204 {
2d120f83
JS
205 if (!wxApp::GetInitializerFunction())
206 {
207 printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
208 return 0;
209 };
afb74891 210
2d120f83 211 wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
4bb6408c 212 };
afb74891 213
4bb6408c
JS
214 if (!wxTheApp)
215 {
2d120f83
JS
216 printf( "wxWindows error: wxTheApp == NULL\n" );
217 return 0;
4bb6408c 218 };
afb74891 219
4bb6408c
JS
220 wxTheApp->SetClassName(wxFileNameFromPath(argv[0]));
221 wxTheApp->SetAppName(wxFileNameFromPath(argv[0]));
afb74891 222
4bb6408c
JS
223 wxTheApp->argc = argc;
224 wxTheApp->argv = argv;
afb74891 225
4bb6408c
JS
226 // GUI-specific initialization, such as creating an app context.
227 wxTheApp->OnInitGui();
afb74891 228
e146b8c8
VZ
229 // Here frames insert themselves automatically into wxTopLevelWindows by
230 // getting created in OnInit().
afb74891 231
4bb6408c 232 int retValue = 0;
4fabb575
JS
233 if (wxTheApp->OnInit())
234 {
2d120f83 235 if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
4fabb575 236 }
afb74891 237
f57fe24c
JS
238 // flush the logged messages if any
239 wxLog *pLog = wxLog::GetActiveTarget();
240 if ( pLog != NULL && pLog->HasPendingMessages() )
2d120f83 241 pLog->Flush();
afb74891 242
f57fe24c 243 delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
2d120f83 244 // for further messages
afb74891 245
4bb6408c
JS
246 if (wxTheApp->GetTopWindow())
247 {
2d120f83
JS
248 delete wxTheApp->GetTopWindow();
249 wxTheApp->SetTopWindow(NULL);
4bb6408c 250 }
afb74891 251
4bb6408c 252 wxTheApp->DeletePendingObjects();
afb74891 253
4bb6408c 254 wxTheApp->OnExit();
afb74891 255
4bb6408c 256 wxApp::CleanUp();
afb74891 257
4bb6408c
JS
258 return retValue;
259};
260
261// Static member initialization
262wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
263
264wxApp::wxApp()
265{
266 m_topWindow = NULL;
267 wxTheApp = this;
268 m_className = "";
269 m_wantDebugOutput = TRUE ;
270 m_appName = "";
271 argc = 0;
272 argv = NULL;
273 m_printMode = wxPRINT_POSTSCRIPT;
274 m_exitOnFrameDelete = TRUE;
275 m_auto3D = TRUE;
afb74891 276
4bb6408c
JS
277 m_mainColormap = (WXColormap) NULL;
278 m_appContext = (WXAppContext) NULL;
279 m_topLevelWidget = (WXWidget) NULL;
280 m_maxRequestSize = 0;
47bc1060 281 m_initialDisplay = (WXDisplay*) 0;
4bb6408c
JS
282}
283
284bool wxApp::Initialized()
285{
286 if (GetTopWindow())
2d120f83 287 return TRUE;
4bb6408c 288 else
2d120f83 289 return FALSE;
4bb6408c
JS
290}
291
292int wxApp::MainLoop()
293{
294 m_keepGoing = TRUE;
afb74891 295
2d120f83 296 /*
4bb6408c
JS
297 * Sit around forever waiting to process X-events. Property Change
298 * event are handled special, because they have to refer to
299 * the root window rather than to a widget. therefore we can't
300 * use an Xt-eventhandler.
301 */
afb74891 302
4bb6408c 303 XSelectInput(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()),
2d120f83
JS
304 XDefaultRootWindow(XtDisplay((Widget) wxTheApp->GetTopLevelWidget())),
305 PropertyChangeMask);
afb74891 306
4bb6408c 307 XEvent event;
afb74891 308
4bb6408c
JS
309 // Use this flag to allow breaking the loop via wxApp::ExitMainLoop()
310 while (m_keepGoing)
311 {
2d120f83 312 XtAppNextEvent( (XtAppContext) wxTheApp->GetAppContext(), &event);
afb74891 313
2d120f83 314 ProcessXEvent((WXEvent*) & event);
afb74891 315
2d120f83
JS
316 if (XtAppPending( (XtAppContext) wxTheApp->GetAppContext() ) == 0)
317 {
318 if (!ProcessIdle())
afb74891 319 {
7bcb11d3 320#if wxUSE_THREADS
afb74891
VZ
321 // leave the main loop to give other threads a chance to
322 // perform their GUI work
2d120f83 323 wxMutexGuiLeave();
afb74891 324 wxUsleep(20);
2d120f83 325 wxMutexGuiEnter();
7bcb11d3 326#endif
2d120f83
JS
327 }
328 }
afb74891 329
8aa04e8b 330 }
afb74891 331
8aa04e8b
JS
332 return 0;
333}
334
335// Processes an X event.
336void wxApp::ProcessXEvent(WXEvent* _event)
337{
338 XEvent* event = (XEvent*) _event;
afb74891 339
f57fe24c 340 if ((event->type == KeyPress) && CheckForAccelerator(_event))
8aa04e8b
JS
341 {
342 // Do nothing! We intercepted and processed the event as an accelerator.
343 return;
344 }
345 else if (event->type == PropertyNotify)
346 {
347 HandlePropertyChange(_event);
348 return;
349 }
350 else if (event->type == ResizeRequest)
351 {
2d120f83
JS
352 /* Terry Gitnick <terryg@scientech.com> - 1/21/98
353 * If resize event, don't resize until the last resize event for this
354 * window is recieved. Prevents flicker as windows are resized.
355 */
afb74891 356
8aa04e8b
JS
357 Display *disp = XtDisplay((Widget) wxTheApp->GetTopLevelWidget());
358 Window win = event->xany.window;
359 XEvent report;
afb74891 360
8aa04e8b
JS
361 // to avoid flicker
362 report = * event;
363 while( XCheckTypedWindowEvent (disp, win, ResizeRequest, &report));
afb74891 364
f97c9854
JS
365 // TODO: when implementing refresh optimization, we can use
366 // XtAddExposureToRegion to expand the window's paint region.
afb74891 367
8aa04e8b
JS
368 XtDispatchEvent(event);
369 }
370 else
371 {
372 XtDispatchEvent(event);
4bb6408c 373 }
4bb6408c
JS
374}
375
376// Returns TRUE if more time is needed.
377bool wxApp::ProcessIdle()
378{
379 wxIdleEvent event;
380 event.SetEventObject(this);
381 ProcessEvent(event);
afb74891 382
4bb6408c
JS
383 return event.MoreRequested();
384}
385
386void wxApp::ExitMainLoop()
387{
388 m_keepGoing = FALSE;
389}
390
391// Is a message/event pending?
392bool wxApp::Pending()
393{
394 XFlush(XtDisplay( (Widget) wxTheApp->GetTopLevelWidget() ));
afb74891 395
8aa04e8b
JS
396 // Fix by Doug from STI, to prevent a stall if non-X event
397 // is found.
398 return ((XtAppPending( (XtAppContext) GetAppContext() ) & XtIMXEvent) != 0) ;
4bb6408c
JS
399}
400
401// Dispatch a message.
402void wxApp::Dispatch()
403{
2d120f83 404 // XtAppProcessEvent( (XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
afb74891 405
8aa04e8b
JS
406 XEvent event;
407 XtAppNextEvent((XtAppContext) GetAppContext(), &event);
408 ProcessXEvent((WXEvent*) & event);
4bb6408c
JS
409}
410
411// This should be redefined in a derived class for
412// handling property change events for XAtom IPC.
413void wxApp::HandlePropertyChange(WXEvent *event)
414{
415 // by default do nothing special
416 XtDispatchEvent((XEvent*) event); /* let Motif do the work */
417}
418
419void wxApp::OnIdle(wxIdleEvent& event)
420{
421 static bool inOnIdle = FALSE;
afb74891 422
4bb6408c
JS
423 // Avoid recursion (via ProcessEvent default case)
424 if (inOnIdle)
2d120f83 425 return;
afb74891 426
4bb6408c 427 inOnIdle = TRUE;
afb74891 428
4bb6408c
JS
429 // 'Garbage' collection of windows deleted with Close().
430 DeletePendingObjects();
afb74891 431
7214297d
GL
432#if wxUSE_THREADS
433 // Flush pending events.
434 ProcessPendingEvents();
435#endif
436
4bb6408c
JS
437 // flush the logged messages if any
438 wxLog *pLog = wxLog::GetActiveTarget();
439 if ( pLog != NULL && pLog->HasPendingMessages() )
2d120f83 440 pLog->Flush();
afb74891 441
4bb6408c
JS
442 // Send OnIdle events to all windows
443 bool needMore = SendIdleEvents();
afb74891 444
4bb6408c 445 if (needMore)
2d120f83 446 event.RequestMore(TRUE);
afb74891 447
4bb6408c
JS
448 inOnIdle = FALSE;
449}
450
451// Send idle event to all top-level windows
452bool wxApp::SendIdleEvents()
453{
454 bool needMore = FALSE;
e146b8c8
VZ
455
456 wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
2d120f83
JS
457 while (node)
458 {
e146b8c8 459 wxWindow* win = node->GetData();
2d120f83 460 if (SendIdleEvents(win))
4bb6408c 461 needMore = TRUE;
e146b8c8 462 node = node->GetNext();
2d120f83 463 }
e146b8c8 464
4bb6408c
JS
465 return needMore;
466}
467
468// Send idle event to window and all subwindows
469bool wxApp::SendIdleEvents(wxWindow* win)
470{
471 bool needMore = FALSE;
afb74891 472
2d120f83
JS
473 wxIdleEvent event;
474 event.SetEventObject(win);
475 win->ProcessEvent(event);
afb74891 476
4bb6408c
JS
477 if (event.MoreRequested())
478 needMore = TRUE;
afb74891 479
2d120f83
JS
480 wxNode* node = win->GetChildren().First();
481 while (node)
482 {
483 wxWindow* win = (wxWindow*) node->Data();
484 if (SendIdleEvents(win))
4bb6408c 485 needMore = TRUE;
afb74891 486
2d120f83
JS
487 node = node->Next();
488 }
4bb6408c
JS
489 return needMore ;
490}
491
492void wxApp::DeletePendingObjects()
493{
494 wxNode *node = wxPendingDelete.First();
495 while (node)
496 {
2d120f83 497 wxObject *obj = (wxObject *)node->Data();
afb74891 498
2d120f83 499 delete obj;
afb74891 500
2d120f83
JS
501 if (wxPendingDelete.Member(obj))
502 delete node;
afb74891 503
2d120f83
JS
504 // Deleting one object may have deleted other pending
505 // objects, so start from beginning of list again.
506 node = wxPendingDelete.First();
4bb6408c
JS
507 }
508}
509
7214297d
GL
510#if wxUSE_THREADS
511void wxApp::ProcessPendingEvents()
7491d644 512{
4d3a259a
GL
513 wxNode *node = wxPendingEvents->First();
514 wxCriticalSectionLocker locker(*wxPendingEventsLocker);
7214297d
GL
515
516 while (node)
517 {
518 wxEvtHandler *handler = (wxEvtHandler *)node->Data();
519
520 handler->ProcessPendingEvents();
521
522 delete node;
4d3a259a 523 node = wxPendingEvents->First();
7214297d 524 }
7491d644
VZ
525}
526#endif // wxUSE_THREADS
7214297d 527
4bb6408c
JS
528wxLog* wxApp::CreateLogTarget()
529{
530 return new wxLogGui;
531}
532
533wxWindow* wxApp::GetTopWindow() const
534{
535 if (m_topWindow)
536 return m_topWindow;
e146b8c8
VZ
537 else if (wxTopLevelWindows.GetCount() > 0)
538 return wxTopLevelWindows.GetFirst()->GetData();
4bb6408c
JS
539 else
540 return NULL;
541}
542
543// Create an application context
544bool wxApp::OnInitGui()
545{
546 XtToolkitInitialize() ;
547 wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext() ;
548 Display *dpy = XtOpenDisplay((XtAppContext) wxTheApp->m_appContext,(String)NULL,NULL,
9c6e1335 549 (const char*) wxTheApp->GetClassName(), NULL, 0,
4bb6408c 550# if XtSpecificationRelease < 5
9c6e1335 551 (Cardinal*) &argc,
4bb6408c 552# else
9c6e1335 553 &argc,
4bb6408c 554# endif
9c6e1335
VZ
555 argv);
556
4bb6408c 557 if (!dpy) {
7bcb11d3 558 wxString className(wxTheApp->GetClassName());
9c6e1335 559 wxLogError(_("wxWindows could not open display for '%s': exiting."),
7bcb11d3 560 (const char*) className);
2d120f83 561 exit(-1);
4bb6408c 562 }
47bc1060 563 m_initialDisplay = (WXDisplay*) dpy;
afb74891 564
4bb6408c 565 wxTheApp->m_topLevelWidget = (WXWidget) XtAppCreateShell((String)NULL, (const char*) wxTheApp->GetClassName(),
2d120f83
JS
566 applicationShellWidgetClass,dpy,
567 NULL,0) ;
afb74891 568
4bb6408c
JS
569 // Add general resize proc
570 XtActionsRec rec;
571 rec.string = "resize";
572 rec.proc = (XtActionProc)wxWidgetResizeProc;
573 XtAppAddActions((XtAppContext) wxTheApp->m_appContext, &rec, 1);
afb74891 574
4bb6408c
JS
575 GetMainColormap(dpy);
576 m_maxRequestSize = XMaxRequestSize((Display*) dpy);
afb74891 577
4bb6408c
JS
578 return TRUE;
579}
580
581WXColormap wxApp::GetMainColormap(WXDisplay* display)
582{
583 if (!display) /* Must be called first with non-NULL display */
2d120f83 584 return m_mainColormap;
a91b47e8
JS
585
586 int defaultScreen = DefaultScreen((Display*) display);
587 Screen* screen = XScreenOfDisplay((Display*) display, defaultScreen);
afb74891 588
a91b47e8 589 Colormap c = DefaultColormapOfScreen(screen);
afb74891 590
4bb6408c 591 if (!m_mainColormap)
2d120f83 592 m_mainColormap = (WXColormap) c;
afb74891 593
4bb6408c
JS
594 return (WXColormap) c;
595}
596
8aa04e8b
JS
597// Returns TRUE if an accelerator has been processed
598bool wxApp::CheckForAccelerator(WXEvent* event)
599{
600 XEvent* xEvent = (XEvent*) event;
601 if (xEvent->xany.type == KeyPress)
602 {
603 // Find a wxWindow for this window
604 // TODO: should get display for the window, not the current display
605 Widget widget = XtWindowToWidget((Display*) wxGetDisplay(), xEvent->xany.window);
606 wxWindow* win = NULL;
afb74891 607
8aa04e8b
JS
608 // Find the first wxWindow that corresponds to this event window
609 while (widget && !(win = wxGetWindowFromTable(widget)))
610 widget = XtParent(widget);
afb74891 611
8aa04e8b
JS
612 if (!widget || !win)
613 return FALSE;
afb74891 614
8aa04e8b
JS
615 wxKeyEvent keyEvent(wxEVT_CHAR);
616 wxTranslateKeyEvent(keyEvent, win, (Widget) 0, xEvent);
afb74891 617
8aa04e8b
JS
618 // Now we have a wxKeyEvent and we have a wxWindow.
619 // Go up the hierarchy until we find a matching accelerator,
620 // or we get to the top.
621 while (win)
622 {
623 if (win->ProcessAccelerator(keyEvent))
624 return TRUE;
625 win = win->GetParent();
626 }
627 return FALSE;
628 }
629 return FALSE;
630}
631
4bb6408c
JS
632void wxExit()
633{
634 int retValue = 0;
635 if (wxTheApp)
2d120f83 636 retValue = wxTheApp->OnExit();
afb74891 637
4bb6408c
JS
638 wxApp::CleanUp();
639 /*
2d120f83
JS
640 * Exit in some platform-specific way. Not recommended that the app calls this:
641 * only for emergencies.
642 */
4bb6408c
JS
643 exit(retValue);
644}
645
646// Yield to other processes
647bool wxYield()
648{
649 while (wxTheApp && wxTheApp->Pending())
2d120f83 650 wxTheApp->Dispatch();
518b5d2f
VZ
651
652 // VZ: is it the same as this (taken from old wxExecute)?
653#if 0
654 XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
655#endif
656
4bb6408c
JS
657 return TRUE;
658}
659