]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/app.cpp
Fixed caret droppings left when scrolling
[wxWidgets.git] / src / gtk / app.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
88a7a4e1 2// Name: src/gtk/app.cpp
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
32e9da8b 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling, Julian Smart
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
df744f4d 10#ifdef __VMS
f3858bf5
JJ
11// vms_jackets.h should for proper working be included before anything else
12# include <vms_jackets.h>
ff7d1dcb 13#undef ConnectionNumber
df744f4d
JJ
14#endif
15
f3858bf5
JJ
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
c801d85f 19#include "wx/app.h"
88a7a4e1
WS
20
21#ifndef WX_PRECOMP
22 #include "wx/intl.h"
e4db172a 23 #include "wx/log.h"
de6185e2 24 #include "wx/utils.h"
5b56bffb 25 #include "wx/memory.h"
48a1108e 26 #include "wx/font.h"
88a7a4e1
WS
27#endif
28
b1ac3b56 29#include "wx/file.h"
2b5f62a0 30#include "wx/filename.h"
fe593cc5 31#include "wx/thread.h"
afb74891 32
62be94e1 33#ifdef __WXGPE__
88a7a4e1 34 #include <gpe/init.h>
62be94e1
RR
35#endif
36
df028524
VS
37#ifdef __WXUNIVERSAL__
38 #include "wx/univ/theme.h"
39 #include "wx/univ/renderer.h"
40#endif
41
20e05ffb 42#include <unistd.h>
2b5f62a0
VZ
43
44#ifdef HAVE_POLL
45 #if defined(__VMS)
46 #include <poll.h>
47 #else
48 // bug in the OpenBSD headers: at least in 3.1 there is no extern "C"
49 // in neither poll.h nor sys/poll.h which results in link errors later
50 #ifdef __OPENBSD__
51 extern "C"
52 {
53 #endif
54
55 #include <sys/poll.h>
56
57 #ifdef __OPENBSD__
58 };
59 #endif
60 #endif // platform
61#else // !HAVE_POLL
62 // we implement poll() ourselves using select() which is supposed exist in
63 // all modern Unices
64 #include <sys/types.h>
65 #include <sys/time.h>
66 #include <unistd.h>
bc023abb
MW
67 #ifdef HAVE_SYS_SELECT_H
68 #include <sys/select.h>
69 #endif
2b5f62a0
VZ
70#endif // HAVE_POLL/!HAVE_POLL
71
17a1ebd1 72#include "wx/unix/private.h"
e8106239 73#include "wx/gtk/win_gtk.h"
84833214 74#include "wx/gtk/private.h"
c801d85f 75
c259ffdf 76#include <gdk/gdkx.h>
24178e4a 77
2b850ae1
RR
78//-----------------------------------------------------------------------------
79// link GnomeVFS
80//-----------------------------------------------------------------------------
81
82#if wxUSE_LIBGNOMEVFS
83#include "wx/html/forcelnk.h"
84FORCE_LINK(gnome_vfs)
85#endif
86
c801d85f
KB
87//-----------------------------------------------------------------------------
88// global data
89//-----------------------------------------------------------------------------
90
de6185e2 91bool g_mainThreadLocked = false;
3ac8d3bc 92
c2fa61e8 93static GtkWidget *gs_RootWindow = (GtkWidget*) NULL;
d76fe38b 94
c801d85f 95//-----------------------------------------------------------------------------
3133cb9f 96// idle system
c801d85f
KB
97//-----------------------------------------------------------------------------
98
90350682 99void wxapp_install_idle_handler();
bf9e3e73 100
fe593cc5
VS
101#if wxUSE_THREADS
102static wxMutex gs_idleTagsMutex;
103#endif
104
bf9e3e73
RR
105//-----------------------------------------------------------------------------
106// wxYield
107//-----------------------------------------------------------------------------
53a8af59 108
1ee339ee
VZ
109// not static because used by textctrl.cpp
110//
111// MT-FIXME
88a7a4e1 112bool wxIsInsideYield = false;
1ee339ee 113
8461e4c2 114bool wxApp::Yield(bool onlyIfNeeded)
c801d85f 115{
1ee339ee 116 if ( wxIsInsideYield )
8461e4c2
VZ
117 {
118 if ( !onlyIfNeeded )
119 {
120 wxFAIL_MSG( wxT("wxYield called recursively" ) );
121 }
122
88a7a4e1 123 return false;
8461e4c2
VZ
124 }
125
6dc5fd71
VZ
126#if wxUSE_THREADS
127 if ( !wxThread::IsMain() )
128 {
129 // can't call gtk_main_iteration() from other threads like this
88a7a4e1 130 return true;
6dc5fd71
VZ
131 }
132#endif // wxUSE_THREADS
133
88a7a4e1 134 wxIsInsideYield = true;
e90c1d2a 135
c263eb03
VS
136 // We need to remove idle callbacks or the loop will
137 // never finish.
8a378a9e 138 RemoveIdleSource();
acfd422a 139
dd7641ef 140#if wxUSE_LOG
2ed3265e
VZ
141 // disable log flushing from here because a call to wxYield() shouldn't
142 // normally result in message boxes popping up &c
143 wxLog::Suspend();
dd7641ef 144#endif
2ed3265e 145
406a6f6b
VZ
146 while (gtk_events_pending())
147 gtk_main_iteration();
148
5375a1f5
RR
149 // It's necessary to call ProcessIdle() to update the frames sizes which
150 // might have been changed (it also will update other things set from
be88a6ad 151 // OnUpdateUI() which is a nice (and desired) side effect). But we
5375a1f5
RR
152 // call ProcessIdle() only once since this is not meant for longish
153 // background jobs (controlled by wxIdleEvent::RequestMore() and the
154 // return value of Processidle().
155 ProcessIdle();
2ed3265e 156
dd7641ef 157#if wxUSE_LOG
2ed3265e
VZ
158 // let the logs be flashed again
159 wxLog::Resume();
dd7641ef 160#endif
7741c4e1 161
88a7a4e1 162 wxIsInsideYield = false;
99ba739f 163
88a7a4e1 164 return true;
acfd422a
RR
165}
166
bf9e3e73
RR
167//-----------------------------------------------------------------------------
168// wxWakeUpIdle
169//-----------------------------------------------------------------------------
170
68567a96
MR
171// RR/KH: No wxMutexGui calls are needed here according to the GTK faq,
172// http://www.gtk.org/faq/#AEN500 - this caused problems for wxPostEvent.
19722331 173
e2478fde 174void wxApp::WakeUpIdle()
bf9e3e73 175{
c263eb03 176 wxapp_install_idle_handler();
bf9e3e73
RR
177}
178
179//-----------------------------------------------------------------------------
180// local functions
181//-----------------------------------------------------------------------------
182
90350682
VZ
183// the callback functions must be extern "C" to comply with GTK+ declarations
184extern "C"
185{
186
14819684
PC
187// One-shot emission hook for "event" signal, to install idle handler.
188// This will be called when the "event" signal is issued on any GtkWidget object.
189static gboolean
190event_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer)
191{
192 wxapp_install_idle_handler();
193 // remove hook
194 return false;
195}
196
8a378a9e
PC
197static inline void wxAddEmissionHook()
198{
199 // add emission hook for "event" signal, to re-install idle handler when needed
200 guint sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET);
201 g_signal_add_emission_hook(sig_id, 0, event_emission_hook, NULL, NULL);
202}
203
3133cb9f 204static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
96997d65 205{
a5f1fd3e 206 if (!wxTheApp)
1136ac0b 207 return false;
a5f1fd3e
VZ
208
209#ifdef __WXDEBUG__
6d477bb4
VZ
210 // don't generate the idle events while the assert modal dialog is shown,
211 // this completely confuses the apps which don't expect to be reentered
212 // from some safely-looking functions
a5f1fd3e 213 if ( wxTheApp->IsInAssert() )
1136ac0b 214 return false;
a5f1fd3e 215#endif // __WXDEBUG__
c2fa61e8 216
5375a1f5 217 // When getting called from GDK's time-out handler
924ef850 218 // we are no longer within GDK's grab on the GUI
5375a1f5 219 // thread so we must lock it here ourselves.
924ef850 220 gdk_threads_enter();
094637f6 221
5375a1f5
RR
222 // Indicate that we are now in idle mode and event handlers
223 // will have to reinstall the idle handler again.
fe593cc5
VS
224 {
225#if wxUSE_THREADS
226 wxMutexLocker lock(gs_idleTagsMutex);
227#endif
e4db172a 228 g_isIdle = true;
fe593cc5
VS
229 wxTheApp->m_idleTag = 0;
230 }
094637f6 231
0faa7620 232 bool moreIdles;
8ab9a536 233
3133cb9f 234 // Send idle event to all who request them as long as
5375a1f5 235 // no events have popped up in the event queue.
0faa7620 236 while ( (moreIdles = wxTheApp->ProcessIdle()) && gtk_events_pending() == 0)
6d477bb4 237 ;
c9e35272 238
96997d65 239 // Release lock again
924ef850 240 gdk_threads_leave();
acfd422a 241
14819684 242 if (!moreIdles)
8a378a9e 243 wxAddEmissionHook();
14819684 244
8ab9a536
RR
245 // Return FALSE if no more idle events are to be sent
246 return moreIdles;
acfd422a 247}
8801832d 248
90350682
VZ
249#if wxUSE_THREADS
250
2b5f62a0
VZ
251#ifdef HAVE_POLL
252 #define wxPoll poll
253 #define wxPollFd pollfd
254#else // !HAVE_POLL
255
256typedef GPollFD wxPollFd;
257
258int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
259{
260 // convert timeout from ms to struct timeval (s/us)
261 timeval tv_timeout;
262 tv_timeout.tv_sec = timeout/1000;
263 tv_timeout.tv_usec = (timeout%1000)*1000;
264
265 // remember the highest fd used here
266 int fdMax = -1;
267
268 // and fill the sets for select()
269 fd_set readfds;
270 fd_set writefds;
271 fd_set exceptfds;
17a1ebd1
VZ
272 wxFD_ZERO(&readfds);
273 wxFD_ZERO(&writefds);
274 wxFD_ZERO(&exceptfds);
2b5f62a0
VZ
275
276 unsigned int i;
277 for ( i = 0; i < nfds; i++ )
278 {
17a1ebd1 279 wxASSERT_MSG( ufds[i].fd < wxFD_SETSIZE, _T("fd out of range") );
2b5f62a0
VZ
280
281 if ( ufds[i].events & G_IO_IN )
17a1ebd1 282 wxFD_SET(ufds[i].fd, &readfds);
2b5f62a0
VZ
283
284 if ( ufds[i].events & G_IO_PRI )
17a1ebd1 285 wxFD_SET(ufds[i].fd, &exceptfds);
2b5f62a0
VZ
286
287 if ( ufds[i].events & G_IO_OUT )
17a1ebd1 288 wxFD_SET(ufds[i].fd, &writefds);
2b5f62a0
VZ
289
290 if ( ufds[i].fd > fdMax )
291 fdMax = ufds[i].fd;
292 }
293
294 fdMax++;
295 int res = select(fdMax, &readfds, &writefds, &exceptfds, &tv_timeout);
296
297 // translate the results back
298 for ( i = 0; i < nfds; i++ )
299 {
300 ufds[i].revents = 0;
301
17a1ebd1 302 if ( wxFD_ISSET(ufds[i].fd, &readfds ) )
2b5f62a0
VZ
303 ufds[i].revents |= G_IO_IN;
304
17a1ebd1 305 if ( wxFD_ISSET(ufds[i].fd, &exceptfds ) )
2b5f62a0
VZ
306 ufds[i].revents |= G_IO_PRI;
307
17a1ebd1 308 if ( wxFD_ISSET(ufds[i].fd, &writefds ) )
2b5f62a0
VZ
309 ufds[i].revents |= G_IO_OUT;
310 }
311
312 return res;
313}
314
315#endif // HAVE_POLL/!HAVE_POLL
316
3133cb9f 317static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
acfd422a 318{
90350682 319 gdk_threads_enter();
7b90a8f2 320
90350682 321 wxMutexGuiLeave();
e4db172a 322 g_mainThreadLocked = true;
7941ba11 323
2b5f62a0
VZ
324 // we rely on the fact that glib GPollFD struct is really just pollfd but
325 // I wonder how wise is this in the long term (VZ)
326 gint res = wxPoll( (wxPollFd *) ufds, nfds, timeout );
90350682 327
90350682 328 wxMutexGuiEnter();
de6185e2 329 g_mainThreadLocked = false;
90350682 330
90350682
VZ
331 gdk_threads_leave();
332
3133cb9f 333 return res;
ff7b1510 334}
c801d85f 335
90350682
VZ
336#endif // wxUSE_THREADS
337
338} // extern "C"
339
3133cb9f 340void wxapp_install_idle_handler()
b453e1b2 341{
fe593cc5
VS
342#if wxUSE_THREADS
343 wxMutexLocker lock(gs_idleTagsMutex);
344#endif
345
c263eb03
VS
346 // Don't install the handler if it's already installed. This test *MUST*
347 // be done when gs_idleTagsMutex is locked!
348 if (!g_isIdle)
349 return;
350
e8617760
GD
351 // GD: this assert is raised when using the thread sample (which works)
352 // so the test is probably not so easy. Can widget callbacks be
353 // triggered from child threads and, if so, for which widgets?
354 // wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") );
d5f3e1eb 355
3133cb9f 356 wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
c2fa61e8 357
de6185e2 358 g_isIdle = false;
96997d65 359
3133cb9f
RR
360 // This routine gets called by all event handlers
361 // indicating that the idle is over. It may also
362 // get called from other thread for sending events
363 // to the main thread (and processing these in
364 // idle time). Very low priority.
6a555739 365 wxTheApp->m_idleTag = g_idle_add_full(G_PRIORITY_LOW, wxapp_idle_callback, NULL, NULL);
b453e1b2
RR
366}
367
005f5d18
RR
368//-----------------------------------------------------------------------------
369// Access to the root window global
370//-----------------------------------------------------------------------------
371
372GtkWidget* wxGetRootWindow()
373{
374 if (gs_RootWindow == NULL)
375 {
376 gs_RootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
377 gtk_widget_realize( gs_RootWindow );
378 }
379 return gs_RootWindow;
380}
381
c801d85f
KB
382//-----------------------------------------------------------------------------
383// wxApp
384//-----------------------------------------------------------------------------
385
386IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
387
53010e52 388BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
955a9197 389 EVT_IDLE(wxAppBase::OnIdle)
53010e52
RR
390END_EVENT_TABLE()
391
c801d85f
KB
392wxApp::wxApp()
393{
a5f1fd3e 394#ifdef __WXDEBUG__
de6185e2 395 m_isInAssert = false;
a5f1fd3e
VZ
396#endif // __WXDEBUG__
397
df5ddbca 398 m_idleTag = 0;
e4db172a 399 g_isIdle = true;
df5ddbca 400 wxapp_install_idle_handler();
094637f6 401
6b3eb77a 402#if wxUSE_THREADS
15894949 403 g_main_context_set_poll_func( NULL, wxapp_poll_func );
6b3eb77a 404#endif
60acb947 405
a6f5aa49
VZ
406 // this is NULL for a "regular" wxApp, but is set (and freed) by a wxGLApp
407 m_glVisualInfo = (void *) NULL;
34a34b02 408 m_glFBCInfo = (void *) NULL;
ff7b1510 409}
c801d85f 410
60acb947 411wxApp::~wxApp()
c801d85f 412{
5d038ec5
MR
413 if (m_idleTag)
414 g_source_remove( m_idleTag );
ff7b1510 415}
c801d85f 416
0d2a2b60 417bool wxApp::OnInitGui()
c801d85f 418{
1e6feb95 419 if ( !wxAppBase::OnInitGui() )
de6185e2 420 return false;
1e6feb95 421
a6f5aa49
VZ
422 // if this is a wxGLApp (derived from wxApp), and we've already
423 // chosen a specific visual, then derive the GdkVisual from that
005f5d18
RR
424 if (m_glVisualInfo != NULL)
425 {
005f5d18 426 // seems gtk_widget_set_default_visual no longer exists?
a6f5aa49 427 GdkVisual* vis = gtk_widget_get_default_visual();
a6f5aa49
VZ
428
429 GdkColormap *colormap = gdk_colormap_new( vis, FALSE );
430 gtk_widget_set_default_colormap( colormap );
a6f5aa49 431 }
be88a6ad 432
005f5d18
RR
433 // On some machines, the default visual is just 256 colours, so
434 // we make sure we get the best. This can sometimes be wasteful.
2286341c 435
005f5d18
RR
436 else
437 if ((gdk_visual_get_best() != gdk_visual_get_system()) && (m_useBestVisual))
b134516c 438 {
2d4dc3a4
OK
439 /* seems gtk_widget_set_default_visual no longer exists? */
440 GdkVisual* vis = gtk_widget_get_default_visual();
f6fcbb63 441
b134516c
RR
442 GdkColormap *colormap = gdk_colormap_new( vis, FALSE );
443 gtk_widget_set_default_colormap( colormap );
f6fcbb63 444 }
c801d85f 445
88a7a4e1 446 return true;
bbe0af5b
RR
447}
448
005f5d18
RR
449GdkVisual *wxApp::GetGdkVisual()
450{
451 GdkVisual *visual = NULL;
be88a6ad 452
005f5d18 453 if (m_glVisualInfo)
7b775074 454 visual = gdkx_visual_get( ((XVisualInfo *) m_glVisualInfo)->visualid );
005f5d18 455 else
22a3bce4 456 visual = gdk_drawable_get_visual( wxGetRootWindow()->window );
be88a6ad 457
005f5d18 458 wxASSERT( visual );
be88a6ad 459
005f5d18
RR
460 return visual;
461}
462
abca8ebf 463bool wxApp::Initialize(int& argc, wxChar **argv)
c801d85f 464{
c156411a 465 bool init_result;
68567a96 466
924ef850 467#if wxUSE_THREADS
ac131bab
MR
468 if (!g_thread_supported())
469 g_thread_init(NULL);
05e2b077 470#endif // wxUSE_THREADS
2286341c 471
0d2a2b60 472 gtk_set_locale();
c801d85f 473
f9862abd
JS
474 // We should have the wxUSE_WCHAR_T test on the _outside_
475#if wxUSE_WCHAR_T
68567a96
MR
476 // gtk+ 2.0 supports Unicode through UTF-8 strings
477 wxConvCurrent = &wxConvUTF8;
05e2b077
VZ
478#else // !wxUSE_WCHAR_T
479 if (!wxOKlibc())
480 wxConvCurrent = (wxMBConv*) NULL;
481#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T
002f4218 482
845905d5
MW
483 // decide which conversion to use for the file names
484
485 // (1) this variable exists for the sole purpose of specifying the encoding
486 // of the filenames for GTK+ programs, so use it if it is set
487 wxString encName(wxGetenv(_T("G_FILENAME_ENCODING")));
29c326b7 488 encName = encName.BeforeFirst(_T(','));
d24b23b7
MW
489 if (encName == _T("@locale"))
490 encName.clear();
845905d5 491 encName.MakeUpper();
68567a96 492#if wxUSE_INTL
845905d5
MW
493 if (encName.empty())
494 {
495 // (2) if a non default locale is set, assume that the user wants his
496 // filenames in this locale too
497 encName = wxLocale::GetSystemEncodingName().Upper();
498 // (3) finally use UTF-8 by default
499 if (encName.empty() || encName == _T("US-ASCII"))
500 encName = _T("UTF-8");
501 wxSetEnv(_T("G_FILENAME_ENCODING"), encName);
502 }
503#else
504 if (encName.empty())
505 encName = _T("UTF-8");
506#endif // wxUSE_INTL
507 static wxConvBrokenFileNames fileconv(encName);
508 wxConvFileName = &fileconv;
66bf0099 509
05e2b077
VZ
510#if wxUSE_UNICODE
511 // gtk_init() wants UTF-8, not wchar_t, so convert
512 int i;
0d8dda32 513 char **argvGTK = new char *[argc + 1];
05e2b077 514 for ( i = 0; i < argc; i++ )
924ef850 515 {
05e2b077 516 argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv[i]));
924ef850 517 }
0cf2cb36 518
05e2b077 519 argvGTK[argc] = NULL;
954de0f1 520
05e2b077 521 int argcGTK = argc;
68567a96 522
62be94e1 523#ifdef __WXGPE__
c156411a 524 init_result = true; // is there a _check() version of this?
62be94e1
RR
525 gpe_application_init( &argcGTK, &argvGTK );
526#else
c156411a 527 init_result = gtk_init_check( &argcGTK, &argvGTK );
62be94e1 528#endif
954de0f1 529
05e2b077 530 if ( argcGTK != argc )
924ef850 531 {
05e2b077
VZ
532 // we have to drop the parameters which were consumed by GTK+
533 for ( i = 0; i < argcGTK; i++ )
534 {
0d8dda32 535 while ( strcmp(wxConvUTF8.cWX2MB(argv[i]), argvGTK[i]) != 0 )
05e2b077
VZ
536 {
537 memmove(argv + i, argv + i + 1, argc - i);
538 }
539 }
0cf2cb36 540
05e2b077 541 argc = argcGTK;
2b5f62a0 542 }
05e2b077 543 //else: gtk_init() didn't modify our parameters
e0253070 544
05e2b077
VZ
545 // free our copy
546 for ( i = 0; i < argcGTK; i++ )
0151c3eb 547 {
05e2b077 548 free(argvGTK[i]);
0151c3eb 549 }
0cf2cb36 550
05e2b077
VZ
551 delete [] argvGTK;
552#else // !wxUSE_UNICODE
553 // gtk_init() shouldn't actually change argv itself (just its contents) so
554 // it's ok to pass pointer to it
c156411a 555 init_result = gtk_init_check( &argc, &argv );
05e2b077 556#endif // wxUSE_UNICODE/!wxUSE_UNICODE
0cf2cb36 557
c156411a
RD
558 if (!init_result) {
559 wxLogError(wxT("Unable to initialize gtk, is DISPLAY set properly?"));
560 return false;
561 }
68567a96 562
05e2b077
VZ
563 // we can not enter threads before gtk_init is done
564 gdk_threads_enter();
0cf2cb36 565
abca8ebf
VZ
566 if ( !wxAppBase::Initialize(argc, argv) )
567 {
568 gdk_threads_leave();
569
570 return false;
571 }
572
e4db172a 573 wxSetDetectableAutoRepeat( true );
be88a6ad 574
05e2b077
VZ
575#if wxUSE_INTL
576 wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
577#endif
be88a6ad 578
05e2b077
VZ
579 return true;
580}
0cf2cb36 581
05e2b077
VZ
582void wxApp::CleanUp()
583{
05e2b077 584 gdk_threads_leave();
abca8ebf
VZ
585
586 wxAppBase::CleanUp();
ff7b1510 587}
1a56f55c 588
a5f1fd3e
VZ
589#ifdef __WXDEBUG__
590
2d97237d
VZ
591void wxApp::OnAssertFailure(const wxChar *file,
592 int line,
593 const wxChar* func,
594 const wxChar* cond,
595 const wxChar *msg)
a5f1fd3e 596{
88a7a4e1 597 m_isInAssert = true;
a5f1fd3e 598
2d97237d 599 wxAppBase::OnAssertFailure(file, line, func, cond, msg);
a5f1fd3e 600
de6185e2 601 m_isInAssert = false;
a5f1fd3e
VZ
602}
603
604#endif // __WXDEBUG__
605
8a378a9e 606void wxApp::RemoveIdleSource()
fe593cc5
VS
607{
608#if wxUSE_THREADS
609 wxMutexLocker lock(gs_idleTagsMutex);
610#endif
8a378a9e 611 if (m_idleTag != 0)
c263eb03 612 {
8a378a9e
PC
613 g_source_remove(m_idleTag);
614 m_idleTag = 0;
e4db172a 615 g_isIdle = true;
8a378a9e 616 wxAddEmissionHook();
c263eb03 617 }
fe593cc5 618}