Doc corrections,
made wxHTML a chapter GUI thread work git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -226,12 +226,29 @@ void wxapp_install_idle_handler()
|
||||
g_isIdle = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
#if wxUSE_THREADS
|
||||
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
|
||||
|
||||
/* forward declaration */
|
||||
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
|
||||
|
||||
void wxapp_install_thread_wakeup()
|
||||
{
|
||||
if (wxTheApp->m_wakeUpTimerTag) return;
|
||||
|
||||
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 100, wxapp_wakeup_timerout_callback, (gpointer) NULL );
|
||||
}
|
||||
|
||||
void wxapp_uninstall_thread_wakeup()
|
||||
{
|
||||
if (!wxTheApp->m_wakeUpTimerTag) return;
|
||||
|
||||
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
|
||||
wxTheApp->m_wakeUpTimerTag = 0;
|
||||
}
|
||||
|
||||
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
|
||||
{
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
// when getting called from GDK's time-out handler
|
||||
@@ -254,12 +271,11 @@ static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
|
||||
GDK_THREADS_LEAVE ();
|
||||
#endif
|
||||
|
||||
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 20, wxapp_wakeup_timerout_callback, (gpointer) NULL );
|
||||
wxapp_install_thread_wakeup();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxApp
|
||||
@@ -280,11 +296,10 @@ wxApp::wxApp()
|
||||
|
||||
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
|
||||
|
||||
/*
|
||||
#if wxUSE_THREADS
|
||||
m_wakeUpTimerTag = gtk_timeout_add( 20, wxapp_wakeup_timerout_callback, (gpointer) NULL );
|
||||
m_wakeUpTimerTag = 0;
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
*/
|
||||
|
||||
m_colorCube = (unsigned char*) NULL;
|
||||
}
|
||||
@@ -293,11 +308,9 @@ wxApp::~wxApp()
|
||||
{
|
||||
if (m_idleTag) gtk_idle_remove( m_idleTag );
|
||||
|
||||
/*
|
||||
#if wxUSE_THREADS
|
||||
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
*/
|
||||
|
||||
if (m_colorCube) free(m_colorCube);
|
||||
}
|
||||
|
@@ -21,6 +21,15 @@
|
||||
#include "gdk/gdk.h"
|
||||
#include "gtk/gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// thread system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_THREADS
|
||||
extern void wxapp_install_thread_wakeup();
|
||||
extern void wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -386,9 +395,13 @@ void wxClipboard::Clear()
|
||||
{
|
||||
if (m_dataBroker)
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
/* As we have data we also own the clipboard. Once we no longer own
|
||||
it, clear_selection is called which will set m_data to zero */
|
||||
|
||||
if (gdk_selection_owner_get( g_clipboardAtom ) == m_clipboardWidget->window)
|
||||
{
|
||||
m_waiting = TRUE;
|
||||
@@ -412,6 +425,11 @@ void wxClipboard::Clear()
|
||||
delete m_dataBroker;
|
||||
m_dataBroker = (wxDataBroker*) NULL;
|
||||
}
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
}
|
||||
|
||||
m_targetRequested = 0;
|
||||
@@ -494,11 +512,20 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
(gpointer) NULL );
|
||||
#endif
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
/* Tell the world we offer clipboard data */
|
||||
if (!gtk_selection_owner_set( m_clipboardWidget,
|
||||
g_clipboardAtom,
|
||||
GDK_CURRENT_TIME ))
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
m_ownsClipboard = TRUE;
|
||||
@@ -507,9 +534,18 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
GDK_SELECTION_PRIMARY,
|
||||
GDK_CURRENT_TIME ))
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
m_ownsPrimarySelection = TRUE;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -35,6 +35,15 @@
|
||||
extern void wxapp_install_idle_handler();
|
||||
extern bool g_isIdle;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// thread system
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_THREADS
|
||||
extern void wxapp_install_thread_wakeup();
|
||||
extern void wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// global data
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -363,12 +372,22 @@ bool wxDropTarget::RequestData( wxDataFormat format )
|
||||
if (format.GetType() == wxDF_TEXT) wxPrintf( _T("text data.\n") );
|
||||
*/
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
/* this should trigger an "drag_data_received" event */
|
||||
gtk_drag_get_data( m_dragWidget,
|
||||
m_dragContext,
|
||||
format.GetAtom(),
|
||||
m_dragTime );
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -617,23 +636,32 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
wxDataObject *data_object = (wxDataObject*) node->Data();
|
||||
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
||||
{
|
||||
// printf( "format found.\n" );
|
||||
// printf( "format found.\n" );
|
||||
|
||||
size_t data_size = data_object->GetSize();
|
||||
|
||||
if (data_size > 0)
|
||||
{
|
||||
// printf( "data size: %d.\n", (int)data_size );
|
||||
// printf( "data size: %d.\n", (int)data_size );
|
||||
|
||||
guchar *buffer = new guchar[data_size];
|
||||
data_object->WriteData( buffer );
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
gtk_selection_data_set( selection_data,
|
||||
selection_data->target,
|
||||
8, // 8-bit
|
||||
buffer,
|
||||
data_size );
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
free( buffer );
|
||||
|
||||
/* so far only copy, no moves. TODO. */
|
||||
@@ -659,7 +687,7 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
// printf( "Delete the data!\n" );
|
||||
// printf( "Delete the data!\n" );
|
||||
|
||||
drop_source->m_retValue = wxDragMove;
|
||||
}
|
||||
@@ -674,7 +702,7 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
// printf( "drag_begin.\n" );
|
||||
// printf( "drag_begin.\n" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -687,7 +715,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
// printf( "drag_end.\n" );
|
||||
// printf( "drag_end.\n" );
|
||||
|
||||
drop_source->m_waiting = FALSE;
|
||||
}
|
||||
@@ -800,7 +828,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
m_waiting = TRUE;
|
||||
|
||||
GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
|
||||
// wxPrintf( _T("atom id: %d.\n"), (int)atom );
|
||||
// printf( "atom id: %d.\n", (int)atom );
|
||||
|
||||
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
|
||||
gtk_target_list_add( target_list, atom, 0, 0 );
|
||||
@@ -822,6 +850,11 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
else if (event.state & GDK_BUTTON2_MASK) button_number = 2;
|
||||
else if (event.state & GDK_BUTTON3_MASK) button_number = 3;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
/* don't start dragging if no button is down */
|
||||
if (button_number)
|
||||
{
|
||||
@@ -846,6 +879,11 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
while (m_waiting) gtk_main_iteration();;
|
||||
}
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
|
||||
g_blockEventsOnDrag = FALSE;
|
||||
|
||||
UnregisterWindow();
|
||||
|
Reference in New Issue
Block a user