New idle handling. Only that.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-04-27 19:32:19 +00:00
parent e5e41feafa
commit acfd422afa
46 changed files with 724 additions and 100 deletions

View File

@ -51,6 +51,7 @@ extern wxList *wxPendingEvents;
extern wxCriticalSection *wxPendingEventsLocker;
#endif
extern wxResourceCache *wxTheResourceCache;
extern bool g_isIdle;
unsigned char g_palette[64*3] =
{
@ -135,7 +136,7 @@ void wxExit()
gtk_main_quit();
}
// forward decl
/* forward declaration */
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
bool wxYield()
@ -151,15 +152,62 @@ bool wxYield()
win->OnInternalIdle();
}
// We need to temporarily remove idle callbacks or the loop will
// never finish.
gtk_idle_remove( wxTheApp->m_idleTag );
if (wxTheApp->m_idleTag)
{
/* We need to temporarily remove idle callbacks or the loop will
never finish. */
gtk_idle_remove( wxTheApp->m_idleTag );
wxTheApp->m_idleTag = 0;
while (gtk_events_pending())
gtk_main_iteration();
while (gtk_events_pending())
gtk_main_iteration();
/* re-add idle handler */
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
}
else
{
while (gtk_events_pending())
gtk_main_iteration();
}
return TRUE;
}
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (!wxTheApp) return TRUE;
/* sent idle event to all who request them */
while (wxTheApp->ProcessIdle()) { }
/* we don't want any more idle events until the next event is
sent to wxGTK */
gtk_idle_remove( wxTheApp->m_idleTag );
wxTheApp->m_idleTag = 0;
/* indicate that we are now in idle mode - even so deeply
in idle mode that we don't get any idle events anymore.
this is like wxMSW where an idle event is sent only
once each time after the event queue has been completely
emptied */
g_isIdle = TRUE;
/* wxMutexGuiLeave();
wxUsleep(10);
wxMutexGuiEnter(); */
return TRUE;
}
void wxapp_install_idle_handler()
{
/* this routine gets called by all event handlers
indicating that the idle is over. */
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
return TRUE;
g_isIdle = FALSE;
}
//-----------------------------------------------------------------------------
@ -172,22 +220,6 @@ BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
EVT_IDLE(wxApp::OnIdle)
END_EVENT_TABLE()
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (wxTheApp)
{
while (wxTheApp->ProcessIdle())
{
}
}
wxMutexGuiLeave();
wxUsleep(10);
wxMutexGuiEnter();
return TRUE;
}
wxApp::wxApp()
{
wxTheApp = this;
@ -202,7 +234,7 @@ wxApp::wxApp()
wxApp::~wxApp()
{
gtk_idle_remove( m_idleTag );
if (m_idleTag) gtk_idle_remove( m_idleTag );
if (m_colorCube) free(m_colorCube);
}
@ -255,14 +287,14 @@ bool wxApp::OnInitGui()
int bb = (b << 3) | (b >> 2);
GdkColor *colors = cmap->colors;
int max = 3 * (65536);
int max = 3 * 65536;
int index = -1;
for (int i = 0; i < cmap->size; i++)
{
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8)- colors[i].green);
int bdiff = ((bb << 8)- colors[i].blue);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; }
}
@ -272,7 +304,6 @@ bool wxApp::OnInitGui()
}
}
return TRUE;
}
@ -378,7 +409,7 @@ bool wxApp::Initialized()
bool wxApp::Pending()
{
return gtk_events_pending();
return (gtk_events_pending() > 0);
}
void wxApp::Dispatch()

View File

@ -22,6 +22,13 @@
class wxBitmapButton;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -34,6 +41,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -22,6 +22,13 @@
class wxButton;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -34,12 +41,14 @@ extern bool g_blockEventsOnDrag;
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (g_isIdle) wxapp_install_idle_handler();
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
}
//-----------------------------------------------------------------------------
@ -54,7 +63,7 @@ wxButton::wxButton()
wxButton::~wxButton()
{
if (m_clientData) delete m_clientData;
if (m_clientData) delete m_clientData;
}
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,

View File

@ -17,6 +17,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,6 +36,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!cb->HasVMT()) return;
if (cb->m_blockFirstEvent)

View File

@ -17,6 +17,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,17 +36,17 @@ extern bool g_blockEventsOnDrag;
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
if (!choice->HasVMT())
return;
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag)
return;
if (!choice->HasVMT()) return;
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
}
//-----------------------------------------------------------------------------

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -31,11 +38,11 @@ extern bool g_blockEventsOnDrag;
static void
gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (!combo->HasVMT())
return;
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag)
return;
if (!combo->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (combo->m_alreadySent)
{
@ -60,6 +67,8 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (g_isIdle) wxapp_install_idle_handler();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event.SetString( combo->GetValue() );
event.SetEventObject( combo );

View File

@ -54,6 +54,10 @@ bool g_blockEventsOnDrag = FALSE;
/* Don't allow mouse event propagation during scroll */
bool g_blockEventsOnScroll = FALSE;
/* 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;
/* Message Strings for Internationalization */
char **wx_msg_str = (char**)NULL;

View File

@ -19,6 +19,15 @@
#include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
@ -29,6 +38,8 @@ extern wxList wxPendingDelete;
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -47,6 +58,8 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
/*
@ -70,6 +83,8 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
@ -92,6 +107,8 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
static gint
gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *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_ALL;

View File

@ -18,6 +18,13 @@
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// "delete_event"
//-----------------------------------------------------------------------------
@ -25,6 +32,8 @@
static
bool gtk_filedialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -44,6 +53,8 @@ bool gtk_filedialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUN
static
void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dialog )
{
if (g_isIdle) wxapp_install_idle_handler();
int style = dialog->GetStyle();
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
@ -85,6 +96,8 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial
static
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialog )
{
if (g_isIdle) wxapp_install_idle_handler();
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
event.SetEventObject( dialog );
dialog->GetEventHandler()->ProcessEvent( event );

View File

@ -33,6 +33,13 @@ const int wxMENU_HEIGHT = 27;
const int wxSTATUS_HEIGHT = 25;
const int wxPLACE_HOLDER = 0;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -45,6 +52,8 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
/*
@ -68,6 +77,8 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -86,6 +97,8 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_menuBarDetached = FALSE;
@ -98,6 +111,8 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_menuBarDetached = TRUE;
@ -110,6 +125,8 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_toolBarDetached = FALSE;
@ -122,6 +139,8 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_toolBarDetached = TRUE;
@ -134,6 +153,8 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
@ -156,6 +177,8 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
static gint
gtk_frame_realized_callback( GtkWidget *widget, wxFrame *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_ALL;

View File

@ -29,6 +29,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-------------------------------------------------------------------------
// conditional compilation
//-------------------------------------------------------------------------
@ -63,6 +70,8 @@ extern bool g_blockEventsOnScroll;
static gint
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -116,6 +125,8 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
static gint
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (!listbox->HasVMT()) return FALSE;
@ -142,6 +153,8 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!listbox->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -27,6 +27,13 @@
const int wxMENU_HEIGHT = 27;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// globals
//-----------------------------------------------------------------------------
@ -314,6 +321,8 @@ void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
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) &&

View File

@ -20,6 +20,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
@ -343,6 +350,8 @@ wxString wxMenuBar::GetHelpString( int id ) const
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 */
@ -392,6 +401,8 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
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!
@ -424,6 +435,8 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
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!

View File

@ -21,6 +21,13 @@
#include "gdk/gdkprivate.h"
#include "gdk/gdkx.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -56,6 +63,8 @@ static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h )
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (gdk_event->count > 0) return;
@ -73,6 +82,8 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
gtk_draw_shadow( widget->style,
@ -89,6 +100,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -124,6 +137,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -155,6 +170,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -186,6 +203,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf )
{
if (g_isIdle) wxapp_install_idle_handler();
mf->Close();
}

View File

@ -23,6 +23,13 @@
#include "wx/gtk/win_gtk.h"
#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -86,6 +93,8 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
gint nPage,
gpointer data)
{
if (g_isIdle) wxapp_install_idle_handler();
wxNotebook *notebook = (wxNotebook *)data;
int old = notebook->GetSelection();
@ -104,6 +113,8 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
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) &&
@ -124,6 +135,8 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
static gint
gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (!notebook->HasVMT()) return FALSE;

View File

@ -19,6 +19,13 @@
#include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -31,6 +38,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -16,6 +16,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,6 +36,8 @@ extern bool g_blockEventsOnDrag;
static
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->HasVMT()) return;
if (rb->m_blockFirstEvent)

View File

@ -19,6 +19,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -32,6 +39,8 @@ extern bool g_blockEventsOnScroll;
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
@ -83,10 +92,12 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
win->m_isScrolling = TRUE;
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = TRUE;
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
return FALSE;
return FALSE;
}
//-----------------------------------------------------------------------------
@ -97,6 +108,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = FALSE;
// g_blockEventsOnScroll = FALSE;

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -30,6 +37,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -19,6 +19,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -33,6 +40,8 @@ static const float sensitivity = 0.2;
static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -30,6 +37,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
if (!tool->m_enabled) return;
@ -45,6 +54,8 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
GdkEventCrossing *WXUNUSED(gdk_event), wxToolBarTool *tool )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return TRUE;
/* we grey-out the tip text of disabled tool */

View File

@ -24,6 +24,13 @@
#include "gtk/gtk.h"
#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -37,6 +44,8 @@ extern bool g_blockEventsOnDrag;
static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->m_hasVMT) return;
win->SetModified();
@ -54,6 +63,8 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
static void
gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->m_hasVMT) return;
win->CalculateScrollbar();

View File

@ -128,6 +128,7 @@
extern wxList wxPendingDelete;
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
extern bool g_isIdle;
static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL;
@ -135,6 +136,13 @@ static wxWindow *g_focusWindow = (wxWindow*) NULL;
the last click here */
static guint32 gs_timeLastClick = 0;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
#if (GTK_MINOR_VERSION > 0)
//-----------------------------------------------------------------------------
@ -231,6 +239,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_updateRegion.Union( gdk_event->area.x,
@ -260,6 +270,8 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
@ -277,6 +289,8 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -456,6 +470,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -572,6 +588,8 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
wxPrintf( _T("1) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -734,6 +752,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -838,6 +858,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -945,6 +967,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -992,6 +1016,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1028,6 +1054,8 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1078,6 +1106,8 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1128,6 +1158,8 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1176,6 +1208,8 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1224,6 +1258,8 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1249,6 +1285,8 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1276,6 +1314,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
// a different window then the slider
//
@ -1295,6 +1335,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
// a different window then the slider
@ -1324,6 +1365,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static gint
gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (win->m_font != *wxSWISS_FONT)
{
wxFont font( win->m_font );

View File

@ -51,6 +51,7 @@ extern wxList *wxPendingEvents;
extern wxCriticalSection *wxPendingEventsLocker;
#endif
extern wxResourceCache *wxTheResourceCache;
extern bool g_isIdle;
unsigned char g_palette[64*3] =
{
@ -135,7 +136,7 @@ void wxExit()
gtk_main_quit();
}
// forward decl
/* forward declaration */
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
bool wxYield()
@ -151,15 +152,62 @@ bool wxYield()
win->OnInternalIdle();
}
// We need to temporarily remove idle callbacks or the loop will
// never finish.
gtk_idle_remove( wxTheApp->m_idleTag );
if (wxTheApp->m_idleTag)
{
/* We need to temporarily remove idle callbacks or the loop will
never finish. */
gtk_idle_remove( wxTheApp->m_idleTag );
wxTheApp->m_idleTag = 0;
while (gtk_events_pending())
gtk_main_iteration();
while (gtk_events_pending())
gtk_main_iteration();
/* re-add idle handler */
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
}
else
{
while (gtk_events_pending())
gtk_main_iteration();
}
return TRUE;
}
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (!wxTheApp) return TRUE;
/* sent idle event to all who request them */
while (wxTheApp->ProcessIdle()) { }
/* we don't want any more idle events until the next event is
sent to wxGTK */
gtk_idle_remove( wxTheApp->m_idleTag );
wxTheApp->m_idleTag = 0;
/* indicate that we are now in idle mode - even so deeply
in idle mode that we don't get any idle events anymore.
this is like wxMSW where an idle event is sent only
once each time after the event queue has been completely
emptied */
g_isIdle = TRUE;
/* wxMutexGuiLeave();
wxUsleep(10);
wxMutexGuiEnter(); */
return TRUE;
}
void wxapp_install_idle_handler()
{
/* this routine gets called by all event handlers
indicating that the idle is over. */
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
return TRUE;
g_isIdle = FALSE;
}
//-----------------------------------------------------------------------------
@ -172,22 +220,6 @@ BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
EVT_IDLE(wxApp::OnIdle)
END_EVENT_TABLE()
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (wxTheApp)
{
while (wxTheApp->ProcessIdle())
{
}
}
wxMutexGuiLeave();
wxUsleep(10);
wxMutexGuiEnter();
return TRUE;
}
wxApp::wxApp()
{
wxTheApp = this;
@ -202,7 +234,7 @@ wxApp::wxApp()
wxApp::~wxApp()
{
gtk_idle_remove( m_idleTag );
if (m_idleTag) gtk_idle_remove( m_idleTag );
if (m_colorCube) free(m_colorCube);
}
@ -255,14 +287,14 @@ bool wxApp::OnInitGui()
int bb = (b << 3) | (b >> 2);
GdkColor *colors = cmap->colors;
int max = 3 * (65536);
int max = 3 * 65536;
int index = -1;
for (int i = 0; i < cmap->size; i++)
{
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8)- colors[i].green);
int bdiff = ((bb << 8)- colors[i].blue);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; }
}
@ -272,7 +304,6 @@ bool wxApp::OnInitGui()
}
}
return TRUE;
}
@ -378,7 +409,7 @@ bool wxApp::Initialized()
bool wxApp::Pending()
{
return gtk_events_pending();
return (gtk_events_pending() > 0);
}
void wxApp::Dispatch()

View File

@ -22,6 +22,13 @@
class wxBitmapButton;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -34,6 +41,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -22,6 +22,13 @@
class wxButton;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -34,12 +41,14 @@ extern bool g_blockEventsOnDrag;
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (g_isIdle) wxapp_install_idle_handler();
if (!button->HasVMT()) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
}
//-----------------------------------------------------------------------------
@ -54,7 +63,7 @@ wxButton::wxButton()
wxButton::~wxButton()
{
if (m_clientData) delete m_clientData;
if (m_clientData) delete m_clientData;
}
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,

View File

@ -17,6 +17,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,6 +36,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!cb->HasVMT()) return;
if (cb->m_blockFirstEvent)

View File

@ -17,6 +17,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,17 +36,17 @@ extern bool g_blockEventsOnDrag;
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
if (!choice->HasVMT())
return;
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag)
return;
if (!choice->HasVMT()) return;
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
}
//-----------------------------------------------------------------------------

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -31,11 +38,11 @@ extern bool g_blockEventsOnDrag;
static void
gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (!combo->HasVMT())
return;
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag)
return;
if (!combo->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (combo->m_alreadySent)
{
@ -60,6 +67,8 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (g_isIdle) wxapp_install_idle_handler();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event.SetString( combo->GetValue() );
event.SetEventObject( combo );

View File

@ -54,6 +54,10 @@ bool g_blockEventsOnDrag = FALSE;
/* Don't allow mouse event propagation during scroll */
bool g_blockEventsOnScroll = FALSE;
/* 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;
/* Message Strings for Internationalization */
char **wx_msg_str = (char**)NULL;

View File

@ -19,6 +19,15 @@
#include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
@ -29,6 +38,8 @@ extern wxList wxPendingDelete;
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -47,6 +58,8 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
/*
@ -70,6 +83,8 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
@ -92,6 +107,8 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
static gint
gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *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_ALL;

View File

@ -18,6 +18,13 @@
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// "delete_event"
//-----------------------------------------------------------------------------
@ -25,6 +32,8 @@
static
bool gtk_filedialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -44,6 +53,8 @@ bool gtk_filedialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUN
static
void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dialog )
{
if (g_isIdle) wxapp_install_idle_handler();
int style = dialog->GetStyle();
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
@ -85,6 +96,8 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial
static
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialog )
{
if (g_isIdle) wxapp_install_idle_handler();
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
event.SetEventObject( dialog );
dialog->GetEventHandler()->ProcessEvent( event );

View File

@ -33,6 +33,13 @@ const int wxMENU_HEIGHT = 27;
const int wxSTATUS_HEIGHT = 25;
const int wxPLACE_HOLDER = 0;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -45,6 +52,8 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
/*
@ -68,6 +77,8 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -86,6 +97,8 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_menuBarDetached = FALSE;
@ -98,6 +111,8 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_menuBarDetached = TRUE;
@ -110,6 +125,8 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_toolBarDetached = FALSE;
@ -122,6 +139,8 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_toolBarDetached = TRUE;
@ -134,6 +153,8 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
@ -156,6 +177,8 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
static gint
gtk_frame_realized_callback( GtkWidget *widget, wxFrame *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_ALL;

View File

@ -29,6 +29,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-------------------------------------------------------------------------
// conditional compilation
//-------------------------------------------------------------------------
@ -63,6 +70,8 @@ extern bool g_blockEventsOnScroll;
static gint
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -116,6 +125,8 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
static gint
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (!listbox->HasVMT()) return FALSE;
@ -142,6 +153,8 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!listbox->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -27,6 +27,13 @@
const int wxMENU_HEIGHT = 27;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// globals
//-----------------------------------------------------------------------------
@ -314,6 +321,8 @@ void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
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) &&

View File

@ -20,6 +20,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
@ -343,6 +350,8 @@ wxString wxMenuBar::GetHelpString( int id ) const
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 */
@ -392,6 +401,8 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
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!
@ -424,6 +435,8 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
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!

View File

@ -21,6 +21,13 @@
#include "gdk/gdkprivate.h"
#include "gdk/gdkx.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -56,6 +63,8 @@ static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h )
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (gdk_event->count > 0) return;
@ -73,6 +82,8 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
gtk_draw_shadow( widget->style,
@ -89,6 +100,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -124,6 +137,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -155,6 +170,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
@ -186,6 +203,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf )
{
if (g_isIdle) wxapp_install_idle_handler();
mf->Close();
}

View File

@ -23,6 +23,13 @@
#include "wx/gtk/win_gtk.h"
#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -86,6 +93,8 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
gint nPage,
gpointer data)
{
if (g_isIdle) wxapp_install_idle_handler();
wxNotebook *notebook = (wxNotebook *)data;
int old = notebook->GetSelection();
@ -104,6 +113,8 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
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) &&
@ -124,6 +135,8 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
static gint
gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return FALSE;
if (!notebook->HasVMT()) return FALSE;

View File

@ -19,6 +19,13 @@
#include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -31,6 +38,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -16,6 +16,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -29,6 +36,8 @@ extern bool g_blockEventsOnDrag;
static
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->HasVMT()) return;
if (rb->m_blockFirstEvent)

View File

@ -19,6 +19,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -32,6 +39,8 @@ extern bool g_blockEventsOnScroll;
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
@ -83,10 +92,12 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
win->m_isScrolling = TRUE;
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = TRUE;
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
return FALSE;
return FALSE;
}
//-----------------------------------------------------------------------------
@ -97,6 +108,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = FALSE;
// g_blockEventsOnScroll = FALSE;

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -30,6 +37,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -19,6 +19,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -33,6 +40,8 @@ static const float sensitivity = 0.2;
static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;

View File

@ -18,6 +18,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -30,6 +37,8 @@ extern bool g_blockEventsOnDrag;
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
if (!tool->m_enabled) return;
@ -45,6 +54,8 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
GdkEventCrossing *WXUNUSED(gdk_event), wxToolBarTool *tool )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return TRUE;
/* we grey-out the tip text of disabled tool */

View File

@ -24,6 +24,13 @@
#include "gtk/gtk.h"
#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
@ -37,6 +44,8 @@ extern bool g_blockEventsOnDrag;
static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->m_hasVMT) return;
win->SetModified();
@ -54,6 +63,8 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
static void
gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->m_hasVMT) return;
win->CalculateScrollbar();

View File

@ -128,6 +128,7 @@
extern wxList wxPendingDelete;
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
extern bool g_isIdle;
static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL;
@ -135,6 +136,13 @@ static wxWindow *g_focusWindow = (wxWindow*) NULL;
the last click here */
static guint32 gs_timeLastClick = 0;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
#if (GTK_MINOR_VERSION > 0)
//-----------------------------------------------------------------------------
@ -231,6 +239,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_updateRegion.Union( gdk_event->area.x,
@ -260,6 +270,8 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return;
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
@ -277,6 +289,8 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -456,6 +470,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -572,6 +588,8 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
/*
wxPrintf( _T("1) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@ -734,6 +752,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -838,6 +858,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
@ -945,6 +967,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -992,6 +1016,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1028,6 +1054,8 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1078,6 +1106,8 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
@ -1128,6 +1158,8 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1176,6 +1208,8 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1224,6 +1258,8 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1249,6 +1285,8 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
/*
@ -1276,6 +1314,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
// a different window then the slider
//
@ -1295,6 +1335,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
// a different window then the slider
@ -1324,6 +1365,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static gint
gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (win->m_font != *wxSWISS_FONT)
{
wxFont font( win->m_font );