Reorganize idle system code.
Installing idle handler from GTK callbacks is no longer necessary. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxApp;
|
||||
class WXDLLIMPEXP_BASE wxLog;
|
||||
#if wxUSE_THREADS
|
||||
class WXDLLIMPEXP_BASE wxMutex;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxApp
|
||||
@@ -40,16 +41,12 @@ public:
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
|
||||
static bool InitialzeVisual();
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
virtual void OnAssertFailure(const wxChar *file,
|
||||
int line,
|
||||
const wxChar *func,
|
||||
const wxChar *cond,
|
||||
const wxChar *msg);
|
||||
|
||||
bool IsInAssert() const { return m_isInAssert; }
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
// GTK-specific methods
|
||||
@@ -65,19 +62,23 @@ public:
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
guint m_idleTag;
|
||||
// temporarily disable idle events
|
||||
void SuspendIdleCallback();
|
||||
|
||||
// This returns the current visual: either that used by wxRootWindow
|
||||
// or the XVisualInfo* for SGI.
|
||||
GdkVisual *GetGdkVisual();
|
||||
|
||||
// check for pending events, without interference from our idle source
|
||||
bool EventsPending();
|
||||
bool DoIdle();
|
||||
|
||||
private:
|
||||
// true if we're inside an assert modal dialog
|
||||
#ifdef __WXDEBUG__
|
||||
bool m_isInAssert;
|
||||
#endif // __WXDEBUG__
|
||||
#if wxUSE_THREADS
|
||||
wxMutex* m_idleMutex;
|
||||
#endif
|
||||
guint m_idleSourceId;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@@ -106,13 +106,6 @@ void gtk_window_set_policy (GtkWindow *window,
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// idle system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern void wxapp_install_idle_handler();
|
||||
extern bool g_isIdle;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Misc. functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
282
src/gtk/app.cpp
282
src/gtk/app.cpp
@@ -54,16 +54,6 @@ bool g_mainThreadLocked = false;
|
||||
|
||||
static GtkWidget *gs_RootWindow = (GtkWidget*) NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// idle system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void wxapp_install_idle_handler();
|
||||
|
||||
#if wxUSE_THREADS
|
||||
static wxMutex gs_idleTagsMutex;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxYield
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -95,17 +85,13 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
||||
|
||||
wxIsInsideYield = true;
|
||||
|
||||
// We need to remove idle callbacks or the loop will
|
||||
// never finish.
|
||||
SuspendIdleCallback();
|
||||
|
||||
#if wxUSE_LOG
|
||||
// disable log flushing from here because a call to wxYield() shouldn't
|
||||
// normally result in message boxes popping up &c
|
||||
wxLog::Suspend();
|
||||
#endif
|
||||
|
||||
while (gtk_events_pending())
|
||||
while (EventsPending())
|
||||
gtk_main_iteration();
|
||||
|
||||
// It's necessary to call ProcessIdle() to update the frames sizes which
|
||||
@@ -126,119 +112,113 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWakeUpIdle
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// RR/KH: No wxMutexGui calls are needed here according to the GTK faq,
|
||||
// http://www.gtk.org/faq/#AEN500 - this caused problems for wxPostEvent.
|
||||
|
||||
void wxApp::WakeUpIdle()
|
||||
{
|
||||
wxapp_install_idle_handler();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// local functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// the callback functions must be extern "C" to comply with GTK+ declarations
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// One-shot emission hook for "event" signal, to install idle handler.
|
||||
// This will be called when the "event" signal is issued on any GtkWidget object.
|
||||
// One-shot signal emission hook, to install idle handler.
|
||||
extern "C" {
|
||||
static gboolean
|
||||
event_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer)
|
||||
wx_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer data)
|
||||
{
|
||||
wxapp_install_idle_handler();
|
||||
wxApp* app = wxTheApp;
|
||||
if (app != NULL)
|
||||
app->WakeUpIdle();
|
||||
gulong* hook_id = (gulong*)data;
|
||||
// record that hook is not installed
|
||||
*hook_id = 0;
|
||||
// remove hook
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// add emission hook for "event" signal, to re-install idle handler when needed
|
||||
static inline void wxAddEmissionHook()
|
||||
// Add signal emission hooks, to re-install idle handler when needed.
|
||||
static void wx_add_idle_hooks()
|
||||
{
|
||||
GType widgetType = GTK_TYPE_WIDGET;
|
||||
// if GtkWidget type is loaded
|
||||
if (g_type_class_peek(widgetType) != NULL)
|
||||
// "event" hook
|
||||
{
|
||||
guint sig_id = g_signal_lookup("event", widgetType);
|
||||
g_signal_add_emission_hook(sig_id, 0, event_emission_hook, NULL, NULL);
|
||||
static gulong hook_id = 0;
|
||||
if (hook_id == 0)
|
||||
{
|
||||
static guint sig_id = 0;
|
||||
if (sig_id == 0)
|
||||
sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET);
|
||||
hook_id = g_signal_add_emission_hook(
|
||||
sig_id, 0, wx_emission_hook, &hook_id, NULL);
|
||||
}
|
||||
}
|
||||
// "size_allocate" hook
|
||||
// Needed to match the behavior of the old idle system,
|
||||
// but probably not necessary.
|
||||
{
|
||||
static gulong hook_id = 0;
|
||||
if (hook_id == 0)
|
||||
{
|
||||
static guint sig_id = 0;
|
||||
if (sig_id == 0)
|
||||
sig_id = g_signal_lookup("size_allocate", GTK_TYPE_WIDGET);
|
||||
hook_id = g_signal_add_emission_hook(
|
||||
sig_id, 0, wx_emission_hook, &hook_id, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
||||
extern "C" {
|
||||
static gboolean wxapp_idle_callback(gpointer)
|
||||
{
|
||||
// this does not look possible, but just in case...
|
||||
if (!wxTheApp)
|
||||
return false;
|
||||
|
||||
bool moreIdles = false;
|
||||
return wxTheApp->DoIdle();
|
||||
}
|
||||
}
|
||||
|
||||
bool wxApp::DoIdle()
|
||||
{
|
||||
guint id_save;
|
||||
{
|
||||
// Allow another idle source to be added while this one is busy.
|
||||
// Needed if an idle event handler runs a new event loop,
|
||||
// for example by showing a dialog.
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(*m_idleMutex);
|
||||
#endif
|
||||
id_save = m_idleSourceId;
|
||||
m_idleSourceId = 0;
|
||||
wx_add_idle_hooks();
|
||||
#ifdef __WXDEBUG__
|
||||
// don't generate the idle events while the assert modal dialog is shown,
|
||||
// this matches the behavior of wxMSW
|
||||
if (!wxTheApp->IsInAssert())
|
||||
#endif // __WXDEBUG__
|
||||
{
|
||||
guint idleID_save;
|
||||
{
|
||||
// Allow another idle source to be added while this one is busy.
|
||||
// Needed if an idle event handler runs a new event loop,
|
||||
// for example by showing a dialog.
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(gs_idleTagsMutex);
|
||||
// don't generate the idle events while the assert modal dialog is shown,
|
||||
// this matches the behavior of wxMSW
|
||||
if (m_isInAssert)
|
||||
return false;
|
||||
#endif
|
||||
idleID_save = wxTheApp->m_idleTag;
|
||||
wxTheApp->m_idleTag = 0;
|
||||
g_isIdle = true;
|
||||
wxAddEmissionHook();
|
||||
}
|
||||
|
||||
// When getting called from GDK's time-out handler
|
||||
// we are no longer within GDK's grab on the GUI
|
||||
// thread so we must lock it here ourselves.
|
||||
gdk_threads_enter();
|
||||
|
||||
// Send idle event to all who request them as long as
|
||||
// no events have popped up in the event queue.
|
||||
do {
|
||||
moreIdles = wxTheApp->ProcessIdle();
|
||||
} while (moreIdles && gtk_events_pending() == 0);
|
||||
|
||||
// Release lock again
|
||||
gdk_threads_leave();
|
||||
|
||||
{
|
||||
// If another idle source was added, remove it
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(gs_idleTagsMutex);
|
||||
#endif
|
||||
if (wxTheApp->m_idleTag != 0)
|
||||
g_source_remove(wxTheApp->m_idleTag);
|
||||
wxTheApp->m_idleTag = idleID_save;
|
||||
g_isIdle = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!moreIdles)
|
||||
{
|
||||
gdk_threads_enter();
|
||||
bool needMore;
|
||||
do {
|
||||
needMore = ProcessIdle();
|
||||
} while (needMore && gtk_events_pending() == 0);
|
||||
gdk_threads_leave();
|
||||
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(gs_idleTagsMutex);
|
||||
wxMutexLocker lock(*m_idleMutex);
|
||||
#endif
|
||||
// Indicate that we are now in idle mode and event handlers
|
||||
// will have to reinstall the idle handler again.
|
||||
g_isIdle = true;
|
||||
wxTheApp->m_idleTag = 0;
|
||||
|
||||
wxAddEmissionHook();
|
||||
// if a new idle source was added during ProcessIdle
|
||||
if (m_idleSourceId != 0)
|
||||
{
|
||||
// remove it
|
||||
g_source_remove(m_idleSourceId);
|
||||
m_idleSourceId = 0;
|
||||
}
|
||||
|
||||
// Return FALSE if no more idle events are to be sent
|
||||
return moreIdles;
|
||||
// if more idle processing requested
|
||||
if (needMore)
|
||||
{
|
||||
// keep this source installed
|
||||
m_idleSourceId = id_save;
|
||||
return true;
|
||||
}
|
||||
// add hooks and remove this source
|
||||
wx_add_idle_hooks();
|
||||
return false;
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
#if wxUSE_THREADS
|
||||
|
||||
@@ -265,37 +245,6 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
|
||||
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
void wxapp_install_idle_handler()
|
||||
{
|
||||
if (wxTheApp == NULL)
|
||||
return;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(gs_idleTagsMutex);
|
||||
#endif
|
||||
|
||||
// Don't install the handler if it's already installed. This test *MUST*
|
||||
// be done when gs_idleTagsMutex is locked!
|
||||
if (!g_isIdle)
|
||||
return;
|
||||
|
||||
// GD: this assert is raised when using the thread sample (which works)
|
||||
// so the test is probably not so easy. Can widget callbacks be
|
||||
// triggered from child threads and, if so, for which widgets?
|
||||
// wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") );
|
||||
|
||||
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
|
||||
|
||||
g_isIdle = false;
|
||||
|
||||
// This routine gets called by all event handlers
|
||||
// indicating that the idle is over. It may also
|
||||
// get called from other thread for sending events
|
||||
// to the main thread (and processing these in
|
||||
// idle time). Very low priority.
|
||||
wxTheApp->m_idleTag = g_idle_add_full(G_PRIORITY_LOW, wxapp_idle_callback, NULL, NULL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Access to the root window global
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -325,16 +274,14 @@ wxApp::wxApp()
|
||||
#ifdef __WXDEBUG__
|
||||
m_isInAssert = false;
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
m_idleTag = 0;
|
||||
g_isIdle = true;
|
||||
wxapp_install_idle_handler();
|
||||
#if wxUSE_THREADS
|
||||
m_idleMutex = NULL;
|
||||
#endif
|
||||
m_idleSourceId = 0;
|
||||
}
|
||||
|
||||
wxApp::~wxApp()
|
||||
{
|
||||
if (m_idleTag)
|
||||
g_source_remove( m_idleTag );
|
||||
}
|
||||
|
||||
bool wxApp::OnInitGui()
|
||||
@@ -518,16 +465,57 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
|
||||
#endif
|
||||
|
||||
#if wxUSE_THREADS
|
||||
m_idleMutex = new wxMutex;
|
||||
#endif
|
||||
// make sure GtkWidget type is loaded, idle hooks need it
|
||||
g_type_class_ref(GTK_TYPE_WIDGET);
|
||||
WakeUpIdle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxApp::CleanUp()
|
||||
{
|
||||
if (m_idleSourceId != 0)
|
||||
g_source_remove(m_idleSourceId);
|
||||
#if wxUSE_THREADS
|
||||
delete m_idleMutex;
|
||||
m_idleMutex = NULL;
|
||||
#endif
|
||||
// release reference acquired by Initialize()
|
||||
g_type_class_unref(g_type_class_peek(GTK_TYPE_WIDGET));
|
||||
|
||||
gdk_threads_leave();
|
||||
|
||||
wxAppBase::CleanUp();
|
||||
}
|
||||
|
||||
void wxApp::WakeUpIdle()
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(*m_idleMutex);
|
||||
#endif
|
||||
if (m_idleSourceId == 0)
|
||||
m_idleSourceId = g_idle_add_full(G_PRIORITY_LOW, wxapp_idle_callback, NULL, NULL);
|
||||
}
|
||||
|
||||
// Checking for pending events requires first removing our idle source,
|
||||
// otherwise it will cause the check to always return true.
|
||||
bool wxApp::EventsPending()
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(*m_idleMutex);
|
||||
#endif
|
||||
if (m_idleSourceId != 0)
|
||||
{
|
||||
g_source_remove(m_idleSourceId);
|
||||
m_idleSourceId = 0;
|
||||
wx_add_idle_hooks();
|
||||
}
|
||||
return gtk_events_pending() != 0;
|
||||
}
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
|
||||
void wxApp::OnAssertFailure(const wxChar *file,
|
||||
@@ -546,17 +534,3 @@ void wxApp::OnAssertFailure(const wxChar *file,
|
||||
}
|
||||
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
void wxApp::SuspendIdleCallback()
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexLocker lock(gs_idleTagsMutex);
|
||||
#endif
|
||||
if (m_idleTag != 0)
|
||||
{
|
||||
g_source_remove(m_idleTag);
|
||||
m_idleTag = 0;
|
||||
g_isIdle = true;
|
||||
wxAddEmissionHook();
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "wx/bmpbuttn.h"
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@@ -35,9 +35,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!button->m_hasVMT) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include "wx/stockitem.h"
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@@ -40,9 +39,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!button->m_hasVMT) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
@@ -59,9 +55,6 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
|
||||
static gint
|
||||
gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), wxButton *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
int left_border = 0;
|
||||
int right_border = 0;
|
||||
int top_border = 0;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
@@ -29,8 +29,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb)
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!cb->m_hasVMT) return;
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
@@ -40,9 +40,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!choice->m_hasVMT) return;
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
@@ -45,8 +45,6 @@ extern "C" {
|
||||
static void
|
||||
gtkcombo_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (combo->m_ignoreNextUpdate)
|
||||
{
|
||||
combo->m_ignoreNextUpdate = false;
|
||||
@@ -118,8 +116,6 @@ extern "C" {
|
||||
static void
|
||||
gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!combo->m_hasVMT) return;
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
@@ -171,8 +167,6 @@ extern "C" {
|
||||
static void
|
||||
gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!combo->m_hasVMT) return;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
||||
@@ -186,8 +180,6 @@ extern "C" {
|
||||
static void
|
||||
gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!combo->m_hasVMT) return;
|
||||
|
||||
if (combo->GetSelection() == -1)
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "wx/colour.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/gtk/private.h" //for idle stuff
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCursor
|
||||
@@ -431,8 +431,6 @@ bool wxIsBusy()
|
||||
|
||||
void wxSetCursor( const wxCursor& cursor )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
g_globalCursor = cursor;
|
||||
wxTheApp->WakeUpIdle();
|
||||
}
|
||||
|
@@ -26,7 +26,3 @@ bool g_blockEventsOnScroll = false;
|
||||
|
||||
/* Don't allow window closing if there are open dialogs */
|
||||
int g_openDialogs = 0;
|
||||
|
||||
/* true when the message queue is empty. this gets set to
|
||||
false by all event callbacks before anything else is done */
|
||||
bool g_isIdle = false;
|
||||
|
@@ -72,8 +72,6 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
|
||||
gint response,
|
||||
wxDirDialog *dialog)
|
||||
{
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
gtk_dirdialog_ok_callback(w, dialog);
|
||||
else // GTK_RESPONSE_CANCEL or GTK_RESPONSE_NONE
|
||||
|
@@ -23,12 +23,7 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#include <gtk/gtkdnd.h>
|
||||
#include <gtk/gtkselection.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// global data
|
||||
@@ -167,8 +162,6 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
||||
guint WXUNUSED(time),
|
||||
wxDropTarget *drop_target )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
/* inform the wxDropTarget about the current GdkDragContext.
|
||||
this is only valid for the duration of this call */
|
||||
drop_target->SetDragContext( context );
|
||||
@@ -197,8 +190,6 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
||||
guint time,
|
||||
wxDropTarget *drop_target )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
/* Owen Taylor: "if the coordinates not in a drop zone,
|
||||
return FALSE, otherwise call gtk_drag_status() and
|
||||
return TRUE" */
|
||||
@@ -295,8 +286,6 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
||||
guint time,
|
||||
wxDropTarget *drop_target )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
/* Owen Taylor: "if the drop is not in a drop zone,
|
||||
return FALSE, otherwise, if you aren't accepting
|
||||
the drop, call gtk_drag_finish() with success == FALSE
|
||||
@@ -402,8 +391,6 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
||||
guint time,
|
||||
wxDropTarget *drop_target )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
/* Owen Taylor: "call gtk_drag_finish() with
|
||||
success == TRUE" */
|
||||
|
||||
@@ -607,8 +594,6 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
guint WXUNUSED(time),
|
||||
wxDropSource *drop_source )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
wxDataFormat format( selection_data->target );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
@@ -674,38 +659,6 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// "drag_data_delete"
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
extern "C" {
|
||||
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
||||
GdkDragContext *WXUNUSED(context),
|
||||
wxDropSource *WXUNUSED(drop_source) )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
// printf( "Drag source: drag_data_delete\n" );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// "drag_begin"
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
extern "C" {
|
||||
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
||||
GdkDragContext *WXUNUSED(context),
|
||||
wxDropSource *WXUNUSED(drop_source) )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
// printf( "Drag source: drag_begin.\n" );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// "drag_end"
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -715,8 +668,6 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
||||
GdkDragContext *WXUNUSED(context),
|
||||
wxDropSource *drop_source )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
// printf( "Drag source: drag_end.\n" );
|
||||
|
||||
drop_source->m_waiting = false;
|
||||
@@ -731,8 +682,6 @@ extern "C" {
|
||||
static gint
|
||||
gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDropSource *source )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
source->GiveFeedback( ConvertFromGTK(source->m_dragContext->action) );
|
||||
|
||||
return 0;
|
||||
@@ -925,10 +874,6 @@ void wxDropSource::RegisterWindow()
|
||||
|
||||
g_signal_connect (m_widget, "drag_data_get",
|
||||
G_CALLBACK (source_drag_data_get), this);
|
||||
g_signal_connect (m_widget, "drag_data_delete",
|
||||
G_CALLBACK (source_drag_data_delete), this);
|
||||
g_signal_connect (m_widget, "drag_begin",
|
||||
G_CALLBACK (source_drag_begin), this);
|
||||
g_signal_connect (m_widget, "drag_end",
|
||||
G_CALLBACK (source_drag_end), this);
|
||||
|
||||
@@ -942,12 +887,6 @@ void wxDropSource::UnregisterWindow()
|
||||
g_signal_handlers_disconnect_by_func (m_widget,
|
||||
(gpointer) source_drag_data_get,
|
||||
this);
|
||||
g_signal_handlers_disconnect_by_func (m_widget,
|
||||
(gpointer) source_drag_data_delete,
|
||||
this);
|
||||
g_signal_handlers_disconnect_by_func (m_widget,
|
||||
(gpointer) source_drag_begin,
|
||||
this);
|
||||
g_signal_handlers_disconnect_by_func (m_widget,
|
||||
(gpointer) source_drag_end,
|
||||
this);
|
||||
|
@@ -98,14 +98,14 @@ void wxEventLoop::Exit(int rc)
|
||||
|
||||
bool wxEventLoop::Pending() const
|
||||
{
|
||||
if (wxTheApp)
|
||||
{
|
||||
// We need to remove idle callbacks or gtk_events_pending will
|
||||
// never return false.
|
||||
wxTheApp->SuspendIdleCallback();
|
||||
}
|
||||
|
||||
return gtk_events_pending();
|
||||
bool pending;
|
||||
wxApp* app = wxTheApp;
|
||||
if (app != NULL)
|
||||
// app->EventsPending() avoids false positives from our idle source
|
||||
pending = app->EventsPending();
|
||||
else
|
||||
pending = gtk_events_pending() != 0;
|
||||
return pending;
|
||||
}
|
||||
|
||||
bool wxEventLoop::Dispatch()
|
||||
|
@@ -28,12 +28,6 @@
|
||||
#include "wx/tokenzr.h" // wxStringTokenizer
|
||||
#include "wx/filefn.h" // ::wxGetCwd
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// idle system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern void wxapp_install_idle_handler();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "clicked" for OK-button
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -97,8 +91,6 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
|
||||
gint response,
|
||||
wxFileDialog *dialog)
|
||||
{
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
gtk_filedialog_ok_callback(w, dialog);
|
||||
else // GTK_RESPONSE_CANCEL or GTK_RESPONSE_NONE
|
||||
|
@@ -32,8 +32,6 @@ extern "C" {
|
||||
static
|
||||
bool gtk_fontdialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
/*
|
||||
printf( "OnDelete from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
@@ -55,9 +53,6 @@ extern "C" {
|
||||
static
|
||||
void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dialog )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget);
|
||||
|
||||
wxGtkString fontname(gtk_font_selection_dialog_get_font_name(fontdlg));
|
||||
@@ -77,9 +72,6 @@ extern "C" {
|
||||
static
|
||||
void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialog )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||
event.SetEventObject( dialog );
|
||||
dialog->GetEventHandler()->ProcessEvent( event );
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "wx/statusbr.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -65,9 +65,6 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
||||
extern "C" {
|
||||
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!win->m_hasVMT) return;
|
||||
|
||||
// Raise the client area area
|
||||
@@ -102,9 +99,6 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
||||
extern "C" {
|
||||
static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!win->m_hasVMT) return;
|
||||
|
||||
// Raise the client area area
|
||||
|
@@ -23,15 +23,10 @@
|
||||
#include "wx/module.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "gtk/gtk.h"
|
||||
#include "gdk/gdk.h"
|
||||
#include "gdk/gdkx.h"
|
||||
}
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
@@ -78,8 +73,6 @@ extern "C" {
|
||||
static gboolean
|
||||
gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
win->m_exposed = true;
|
||||
|
||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||
@@ -98,9 +91,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "wx/tooltip.h"
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
@@ -68,8 +67,6 @@ gtk_listbox_row_activated_callback(GtkTreeView *treeview,
|
||||
GtkTreeViewColumn *col,
|
||||
wxListBox *listbox)
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (g_blockEventsOnScroll) return;
|
||||
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
@@ -49,9 +47,6 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||
gint WXUNUSED(page_num),
|
||||
wxMDIParentFrame *parent )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
// send deactivate event to old child
|
||||
|
||||
wxMDIChildFrame *child = parent->GetActiveChild();
|
||||
@@ -441,8 +436,6 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
||||
extern "C" {
|
||||
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if ((win->m_x == alloc->x) &&
|
||||
(win->m_y == alloc->y) &&
|
||||
(win->m_width == alloc->width) &&
|
||||
|
@@ -97,9 +97,6 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
||||
|
||||
static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event)
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
event.SetEventObject( menu );
|
||||
|
||||
wxEvtHandler* handler = menu->GetEventHandler();
|
||||
@@ -560,9 +557,6 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
|
||||
extern "C" {
|
||||
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
int id = menu->FindMenuIdByMenuItem(widget);
|
||||
|
||||
/* should find it for normal (not popup) menu */
|
||||
@@ -637,8 +631,6 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
extern "C" {
|
||||
static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
int id = menu->FindMenuIdByMenuItem(widget);
|
||||
|
||||
wxASSERT( id != -1 ); // should find it!
|
||||
@@ -665,8 +657,6 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
extern "C" {
|
||||
static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
int id = menu->FindMenuIdByMenuItem(widget);
|
||||
|
||||
wxASSERT( id != -1 ); // should find it!
|
||||
|
@@ -60,8 +60,6 @@ static wxColor LightContrastColour(const wxColour& c)
|
||||
extern "C" {
|
||||
static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose* gdk_event, wxMiniFrame* win)
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT || gdk_event->count > 0)
|
||||
return false;
|
||||
|
||||
@@ -118,8 +116,6 @@ static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose
|
||||
extern "C" {
|
||||
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnScroll) return TRUE;
|
||||
@@ -204,8 +200,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
extern "C" {
|
||||
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnScroll) return TRUE;
|
||||
@@ -239,8 +233,6 @@ extern "C" {
|
||||
static gboolean
|
||||
gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxMiniFrame *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
@@ -258,8 +250,6 @@ extern "C" {
|
||||
static gint
|
||||
gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnScroll) return TRUE;
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "wx/fontutil.h"
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
@@ -119,9 +118,6 @@ static void gtk_notebook_page_changed_callback( GtkNotebook *widget,
|
||||
extern "C" {
|
||||
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if ((win->m_x == alloc->x) &&
|
||||
(win->m_y == alloc->y) &&
|
||||
(win->m_width == alloc->width) &&
|
||||
@@ -153,9 +149,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
|
||||
here in order to make repositioning before showing to take effect. */
|
||||
gtk_widget_queue_resize( win->m_widget );
|
||||
|
@@ -20,11 +20,8 @@
|
||||
#include "wx/cursor.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "wx/gtk/private.h" //for idle stuff
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -72,9 +69,6 @@ static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPo
|
||||
extern "C" {
|
||||
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxPopupWindow *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (win->IsEnabled())
|
||||
win->Close();
|
||||
|
||||
@@ -93,9 +87,6 @@ extern "C" {
|
||||
static gint
|
||||
gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||
recognized by other WM as well. not tested. */
|
||||
long decor = (long) GDK_DECOR_BORDER;
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxGTKRadioButtonInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -60,8 +58,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!rb->m_hasVMT) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
@@ -82,8 +78,6 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo
|
||||
extern "C" {
|
||||
static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!rb->m_hasVMT) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
|
@@ -30,8 +30,6 @@ extern "C" {
|
||||
static
|
||||
void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (!rb->m_hasVMT) return;
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
@@ -57,8 +57,6 @@ extern "C" {
|
||||
static gboolean
|
||||
gtk_button_press_event(GtkRange*, GdkEventButton*, wxScrollBar* win)
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
win->m_mouseButtonDown = true;
|
||||
return false;
|
||||
}
|
||||
@@ -98,8 +96,6 @@ extern "C" {
|
||||
static gboolean
|
||||
gtk_button_release_event(GtkRange* range, GdkEventButton*, wxScrollBar* win)
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
win->m_mouseButtonDown = false;
|
||||
// If thumb tracking
|
||||
if (win->m_isScrolling)
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "wx/math.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
@@ -124,8 +124,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_value_changed(GtkRange* range, wxSlider* win)
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
GtkAdjustment* adj = gtk_range_get_adjustment (range);
|
||||
const int pos = wxRound(adj->value);
|
||||
const double oldPos = win->m_pos;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "wx/utils.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
@@ -35,8 +35,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win)
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
const double value = gtk_spin_button_get_value(spinbutton);
|
||||
const int pos = int(value);
|
||||
const int oldPos = win->m_pos;
|
||||
|
@@ -36,8 +36,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
win->m_pos = int(gtk_spin_button_get_value(spinbutton));
|
||||
if (!win->m_hasVMT || g_blockEventsOnDrag || win->m_blockScrollEvent)
|
||||
return;
|
||||
@@ -64,9 +62,6 @@ extern "C" {
|
||||
static void
|
||||
gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!win->m_hasVMT || win->m_blockScrollEvent)
|
||||
return;
|
||||
|
||||
|
@@ -157,9 +157,6 @@ extern "C" {
|
||||
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget),
|
||||
wxToolBarTool *tool )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
wxToolBar *tbar = (wxToolBar *)tool->GetToolBar();
|
||||
|
||||
if (tbar->m_blockEvent) return;
|
||||
@@ -199,8 +196,6 @@ static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget),
|
||||
GdkEventCrossing *gdk_event,
|
||||
wxToolBarTool *tool )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
wxToolBar *tb = (wxToolBar *)tool->GetToolBar();
|
||||
|
@@ -298,9 +298,6 @@ gtk_insert_text_callback(GtkEditable *editable,
|
||||
gint *position,
|
||||
wxTextCtrl *win)
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
// we should only be called if we have a max len limit at all
|
||||
GtkEntry *entry = GTK_ENTRY (editable);
|
||||
|
||||
@@ -547,9 +544,6 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win )
|
||||
|
||||
if (!win->m_hasVMT) return;
|
||||
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if ( win->MarkDirtyOnChange() )
|
||||
win->MarkDirty();
|
||||
|
||||
|
@@ -28,9 +28,6 @@ extern bool g_blockEventsOnDrag;
|
||||
extern "C" {
|
||||
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
||||
return;
|
||||
|
||||
|
@@ -112,8 +112,6 @@ static gboolean gtk_frame_focus_in_callback( GtkWidget *widget,
|
||||
GdkEvent *WXUNUSED(event),
|
||||
wxTopLevelWindowGTK *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
switch ( g_sendActivateEvent )
|
||||
{
|
||||
case -1:
|
||||
@@ -173,8 +171,6 @@ static gboolean gtk_frame_focus_out_callback( GtkWidget *widget,
|
||||
GdkEventFocus *WXUNUSED(gdk_event),
|
||||
wxTopLevelWindowGTK *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
// if the focus goes out of our app alltogether, OnIdle() will send
|
||||
// wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset
|
||||
// g_sendActivateEvent to -1
|
||||
@@ -205,9 +201,6 @@ static gboolean gtk_frame_focus_out_callback( GtkWidget *widget,
|
||||
extern "C" {
|
||||
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxTopLevelWindowGTK *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
@@ -260,8 +253,6 @@ gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget),
|
||||
GdkEvent *WXUNUSED(event),
|
||||
wxTopLevelWindowGTK *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (win->IsEnabled() &&
|
||||
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) ||
|
||||
win->IsGrabbed()))
|
||||
@@ -282,8 +273,6 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget),
|
||||
GdkEventConfigure *WXUNUSED(event),
|
||||
wxTopLevelWindowGTK *win )
|
||||
{
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT || !win->IsShown())
|
||||
return FALSE;
|
||||
|
||||
@@ -314,9 +303,6 @@ static void
|
||||
gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget),
|
||||
wxTopLevelWindowGTK *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
// All this is for Motif Window Manager "hints" and is supposed to be
|
||||
// recognized by other WM as well. Not tested.
|
||||
gdk_window_set_decorations(win->m_widget->window,
|
||||
@@ -1119,8 +1105,6 @@ void wxTopLevelWindowGTK::OnInternalIdle()
|
||||
GtkOnSize();
|
||||
|
||||
// we'll come back later
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -469,8 +469,6 @@ gtk_window_expose_callback( GtkWidget *widget,
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
// This callback gets called in drawing-idle time under
|
||||
// GTK 2.0, so we don't need to defer anything to idle
|
||||
// time anymore.
|
||||
@@ -982,8 +980,6 @@ gtk_window_key_press_callback( GtkWidget *widget,
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT)
|
||||
return FALSE;
|
||||
if (g_blockEventsOnDrag)
|
||||
@@ -1200,8 +1196,6 @@ gtk_window_key_release_callback( GtkWidget *widget,
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!win->m_hasVMT)
|
||||
return FALSE;
|
||||
|
||||
@@ -1378,8 +1372,6 @@ int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (!m_hasVMT)
|
||||
return FALSE;
|
||||
if (g_blockEventsOnDrag)
|
||||
@@ -1746,8 +1738,6 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (gdk_event->direction != GDK_SCROLL_UP &&
|
||||
gdk_event->direction != GDK_SCROLL_DOWN)
|
||||
{
|
||||
@@ -1804,8 +1794,6 @@ gtk_window_focus_in_callback( GtkWidget *widget,
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (win->m_imData)
|
||||
gtk_im_context_focus_in(win->m_imData->context);
|
||||
|
||||
@@ -1856,8 +1844,6 @@ gtk_window_focus_out_callback( GtkWidget *widget,
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
if (win->m_imData)
|
||||
gtk_im_context_focus_out(win->m_imData->context);
|
||||
|
||||
@@ -2037,8 +2023,6 @@ gtk_scrollbar_button_press_event(GtkRange*, GdkEventButton*, wxWindow* win)
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
// don't need to install idle handler, its done from "event" signal
|
||||
|
||||
g_blockEventsOnScroll = true;
|
||||
win->m_mouseButtonDown = true;
|
||||
|
||||
@@ -2100,9 +2084,6 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
if (win->m_imData)
|
||||
{
|
||||
GtkPizza *pizza = GTK_PIZZA( m_widget );
|
||||
@@ -2124,9 +2105,6 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
|
||||
GtkAllocation *alloc,
|
||||
wxWindow *win )
|
||||
{
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
int client_width = 0;
|
||||
int client_height = 0;
|
||||
win->GetClientSize( &client_width, &client_height );
|
||||
@@ -3330,16 +3308,14 @@ void wxWindowGTK::AddChild(wxWindowBase *child)
|
||||
{
|
||||
wxWindowBase::AddChild(child);
|
||||
m_dirtyTabOrder = true;
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
wxTheApp->WakeUpIdle();
|
||||
}
|
||||
|
||||
void wxWindowGTK::RemoveChild(wxWindowBase *child)
|
||||
{
|
||||
wxWindowBase::RemoveChild(child);
|
||||
m_dirtyTabOrder = true;
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
wxTheApp->WakeUpIdle();
|
||||
}
|
||||
|
||||
/* static */
|
||||
@@ -3403,8 +3379,7 @@ void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
||||
{
|
||||
wxWindowBase::DoMoveInTabOrder(win, move);
|
||||
m_dirtyTabOrder = true;
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
wxTheApp->WakeUpIdle();
|
||||
}
|
||||
|
||||
bool wxWindowGTK::DoNavigateIn(int flags)
|
||||
@@ -4247,9 +4222,6 @@ wxEventType wxWindowGTK::GetScrollEventType(GtkRange* range)
|
||||
{
|
||||
DEBUG_MAIN_THREAD
|
||||
|
||||
if (g_isIdle)
|
||||
wxapp_install_idle_handler();
|
||||
|
||||
wxASSERT(range == m_scrollBar[0] || range == m_scrollBar[1]);
|
||||
|
||||
const int barIndex = range == m_scrollBar[1];
|
||||
|
Reference in New Issue
Block a user