Applied patch for stipppled brushes,

Corrected idle behaviour after popmenu call


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-08-05 11:14:07 +00:00
parent 867673d4f2
commit 956dbab1eb
7 changed files with 81 additions and 86 deletions

View File

@@ -23,6 +23,7 @@
#include "wx/log.h"
#include "wx/dnd.h"
#include "wx/dirdlg.h"
#ifdef __WXMOTIF__
#error Sorry, drag and drop is not yet implemented on wxMotif.

View File

@@ -143,47 +143,37 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) );
bool wxYield()
{
/* it's necessary to call ProcessIdle() to update the frames sizes which
might have been changed (it also will update other things set from
OnUpdateUI() which is a nice (and desired) side effect) */
while (wxTheApp->ProcessIdle()) { }
#if 0
for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
wxWindow *win = node->GetData();
win->OnInternalIdle();
}
#endif
if (wxTheApp->m_idleTag)
bool has_idle = (wxTheApp->m_idleTag != 0);
if (has_idle)
{
/* 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();
/* it's necessary to call ProcessIdle() to update the frames sizes which
might have been changed (it also will update other things set from
OnUpdateUI() which is a nice (and desired) side effect) */
while (wxTheApp->ProcessIdle()) { }
if (has_idle)
{
/* 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;
#if (GTK_MINOR_VERSION > 0)
/* when getting called from GDK's idle handler we
are no longer within GDK's grab on the GUI
@@ -424,18 +414,26 @@ bool wxApp::ProcessIdle()
event.SetEventObject( this );
ProcessEvent( event );
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
win->OnInternalIdle();
node = node->GetNext();
}
return event.MoreRequested();
}
void wxApp::OnIdle( wxIdleEvent &event )
{
static bool inOnIdle = FALSE;
static bool s_inOnIdle = FALSE;
/* Avoid recursion (via ProcessEvent default case) */
if (inOnIdle)
if (s_inOnIdle)
return;
inOnIdle = TRUE;
s_inOnIdle = TRUE;
#if wxUSE_THREADS
/* Resend in the main thread events which have been prepared in other
@@ -459,7 +457,7 @@ void wxApp::OnIdle( wxIdleEvent &event )
if (needMore)
event.RequestMore(TRUE);
inOnIdle = FALSE;
s_inOnIdle = FALSE;
}
bool wxApp::SendIdleEvents()
@@ -485,8 +483,6 @@ bool wxApp::SendIdleEvents( wxWindow* win )
wxIdleEvent event;
event.SetEventObject(win);
win->OnInternalIdle();
win->ProcessEvent(event);
if (event.MoreRequested())

View File

@@ -995,28 +995,25 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
m_brush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
GdkFill fillStyle = GDK_SOLID;
switch (m_brush.GetStyle())
{
case wxSOLID:
case wxTRANSPARENT:
break;
default:
fillStyle = GDK_STIPPLED;
}
gdk_gc_set_fill( m_brushGC, fillStyle );
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
{
if (m_brush.GetStipple()->GetPixmap())
{
gdk_gc_set_fill( m_brushGC, GDK_TILED );
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
}
else
{
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
}
}
if (IS_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_brushGC, hatches[num] );
}

View File

@@ -2909,7 +2909,11 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
0 //gs_timeLastClick // the time of activation
);
while (is_waiting) wxYield();
while (is_waiting)
{
while (gtk_events_pending())
gtk_main_iteration();
}
return TRUE;
}

View File

@@ -143,47 +143,37 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) );
bool wxYield()
{
/* it's necessary to call ProcessIdle() to update the frames sizes which
might have been changed (it also will update other things set from
OnUpdateUI() which is a nice (and desired) side effect) */
while (wxTheApp->ProcessIdle()) { }
#if 0
for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
wxWindow *win = node->GetData();
win->OnInternalIdle();
}
#endif
if (wxTheApp->m_idleTag)
bool has_idle = (wxTheApp->m_idleTag != 0);
if (has_idle)
{
/* 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();
/* it's necessary to call ProcessIdle() to update the frames sizes which
might have been changed (it also will update other things set from
OnUpdateUI() which is a nice (and desired) side effect) */
while (wxTheApp->ProcessIdle()) { }
if (has_idle)
{
/* 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;
#if (GTK_MINOR_VERSION > 0)
/* when getting called from GDK's idle handler we
are no longer within GDK's grab on the GUI
@@ -424,18 +414,26 @@ bool wxApp::ProcessIdle()
event.SetEventObject( this );
ProcessEvent( event );
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
win->OnInternalIdle();
node = node->GetNext();
}
return event.MoreRequested();
}
void wxApp::OnIdle( wxIdleEvent &event )
{
static bool inOnIdle = FALSE;
static bool s_inOnIdle = FALSE;
/* Avoid recursion (via ProcessEvent default case) */
if (inOnIdle)
if (s_inOnIdle)
return;
inOnIdle = TRUE;
s_inOnIdle = TRUE;
#if wxUSE_THREADS
/* Resend in the main thread events which have been prepared in other
@@ -459,7 +457,7 @@ void wxApp::OnIdle( wxIdleEvent &event )
if (needMore)
event.RequestMore(TRUE);
inOnIdle = FALSE;
s_inOnIdle = FALSE;
}
bool wxApp::SendIdleEvents()
@@ -485,8 +483,6 @@ bool wxApp::SendIdleEvents( wxWindow* win )
wxIdleEvent event;
event.SetEventObject(win);
win->OnInternalIdle();
win->ProcessEvent(event);
if (event.MoreRequested())

View File

@@ -995,28 +995,25 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
m_brush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
GdkFill fillStyle = GDK_SOLID;
switch (m_brush.GetStyle())
{
case wxSOLID:
case wxTRANSPARENT:
break;
default:
fillStyle = GDK_STIPPLED;
}
gdk_gc_set_fill( m_brushGC, fillStyle );
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
{
if (m_brush.GetStipple()->GetPixmap())
{
gdk_gc_set_fill( m_brushGC, GDK_TILED );
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
}
else
{
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
}
}
if (IS_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_brushGC, hatches[num] );
}

View File

@@ -2909,7 +2909,11 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
0 //gs_timeLastClick // the time of activation
);
while (is_waiting) wxYield();
while (is_waiting)
{
while (gtk_events_pending())
gtk_main_iteration();
}
return TRUE;
}