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:
@@ -23,6 +23,7 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
|
#include "wx/dirdlg.h"
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
#error Sorry, drag and drop is not yet implemented on wxMotif.
|
#error Sorry, drag and drop is not yet implemented on wxMotif.
|
||||||
|
@@ -143,39 +143,29 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
|||||||
|
|
||||||
bool wxYield()
|
bool wxYield()
|
||||||
{
|
{
|
||||||
/* it's necessary to call ProcessIdle() to update the frames sizes which
|
bool has_idle = (wxTheApp->m_idleTag != 0);
|
||||||
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
|
if (has_idle)
|
||||||
for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
|
|
||||||
node;
|
|
||||||
node = node->GetNext() )
|
|
||||||
{
|
|
||||||
wxWindow *win = node->GetData();
|
|
||||||
win->OnInternalIdle();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wxTheApp->m_idleTag)
|
|
||||||
{
|
{
|
||||||
/* We need to temporarily remove idle callbacks or the loop will
|
/* We need to temporarily remove idle callbacks or the loop will
|
||||||
never finish. */
|
never finish. */
|
||||||
gtk_idle_remove( wxTheApp->m_idleTag );
|
gtk_idle_remove( wxTheApp->m_idleTag );
|
||||||
wxTheApp->m_idleTag = 0;
|
wxTheApp->m_idleTag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (gtk_events_pending())
|
while (gtk_events_pending())
|
||||||
gtk_main_iteration();
|
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 */
|
/* re-add idle handler */
|
||||||
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
|
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
while (gtk_events_pending())
|
|
||||||
gtk_main_iteration();
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -424,18 +414,26 @@ bool wxApp::ProcessIdle()
|
|||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
ProcessEvent( event );
|
ProcessEvent( event );
|
||||||
|
|
||||||
|
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxWindow* win = node->GetData();
|
||||||
|
win->OnInternalIdle();
|
||||||
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
return event.MoreRequested();
|
return event.MoreRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::OnIdle( wxIdleEvent &event )
|
void wxApp::OnIdle( wxIdleEvent &event )
|
||||||
{
|
{
|
||||||
static bool inOnIdle = FALSE;
|
static bool s_inOnIdle = FALSE;
|
||||||
|
|
||||||
/* Avoid recursion (via ProcessEvent default case) */
|
/* Avoid recursion (via ProcessEvent default case) */
|
||||||
if (inOnIdle)
|
if (s_inOnIdle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
/* Resend in the main thread events which have been prepared in other
|
/* Resend in the main thread events which have been prepared in other
|
||||||
@@ -459,7 +457,7 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
|
||||||
inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
@@ -485,8 +483,6 @@ bool wxApp::SendIdleEvents( wxWindow* win )
|
|||||||
wxIdleEvent event;
|
wxIdleEvent event;
|
||||||
event.SetEventObject(win);
|
event.SetEventObject(win);
|
||||||
|
|
||||||
win->OnInternalIdle();
|
|
||||||
|
|
||||||
win->ProcessEvent(event);
|
win->ProcessEvent(event);
|
||||||
|
|
||||||
if (event.MoreRequested())
|
if (event.MoreRequested())
|
||||||
|
@@ -995,28 +995,25 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
m_brush.GetColour().CalcPixel( m_cmap );
|
m_brush.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
||||||
|
|
||||||
GdkFill fillStyle = GDK_SOLID;
|
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||||
switch (m_brush.GetStyle())
|
|
||||||
{
|
|
||||||
case wxSOLID:
|
|
||||||
case wxTRANSPARENT:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fillStyle = GDK_STIPPLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, fillStyle );
|
|
||||||
|
|
||||||
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
||||||
{
|
{
|
||||||
if (m_brush.GetStipple()->GetPixmap())
|
if (m_brush.GetStipple()->GetPixmap())
|
||||||
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_TILED );
|
||||||
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
|
||||||
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_HATCH(m_brush.GetStyle()))
|
if (IS_HATCH(m_brush.GetStyle()))
|
||||||
{
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
|
||||||
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
|
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
|
||||||
gdk_gc_set_stipple( m_brushGC, hatches[num] );
|
gdk_gc_set_stipple( m_brushGC, hatches[num] );
|
||||||
}
|
}
|
||||||
|
@@ -2909,7 +2909,11 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
|
|||||||
0 //gs_timeLastClick // the time of activation
|
0 //gs_timeLastClick // the time of activation
|
||||||
);
|
);
|
||||||
|
|
||||||
while (is_waiting) wxYield();
|
while (is_waiting)
|
||||||
|
{
|
||||||
|
while (gtk_events_pending())
|
||||||
|
gtk_main_iteration();
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -143,39 +143,29 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
|||||||
|
|
||||||
bool wxYield()
|
bool wxYield()
|
||||||
{
|
{
|
||||||
/* it's necessary to call ProcessIdle() to update the frames sizes which
|
bool has_idle = (wxTheApp->m_idleTag != 0);
|
||||||
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
|
if (has_idle)
|
||||||
for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
|
|
||||||
node;
|
|
||||||
node = node->GetNext() )
|
|
||||||
{
|
|
||||||
wxWindow *win = node->GetData();
|
|
||||||
win->OnInternalIdle();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wxTheApp->m_idleTag)
|
|
||||||
{
|
{
|
||||||
/* We need to temporarily remove idle callbacks or the loop will
|
/* We need to temporarily remove idle callbacks or the loop will
|
||||||
never finish. */
|
never finish. */
|
||||||
gtk_idle_remove( wxTheApp->m_idleTag );
|
gtk_idle_remove( wxTheApp->m_idleTag );
|
||||||
wxTheApp->m_idleTag = 0;
|
wxTheApp->m_idleTag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (gtk_events_pending())
|
while (gtk_events_pending())
|
||||||
gtk_main_iteration();
|
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 */
|
/* re-add idle handler */
|
||||||
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
|
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
while (gtk_events_pending())
|
|
||||||
gtk_main_iteration();
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -424,18 +414,26 @@ bool wxApp::ProcessIdle()
|
|||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
ProcessEvent( event );
|
ProcessEvent( event );
|
||||||
|
|
||||||
|
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxWindow* win = node->GetData();
|
||||||
|
win->OnInternalIdle();
|
||||||
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
return event.MoreRequested();
|
return event.MoreRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::OnIdle( wxIdleEvent &event )
|
void wxApp::OnIdle( wxIdleEvent &event )
|
||||||
{
|
{
|
||||||
static bool inOnIdle = FALSE;
|
static bool s_inOnIdle = FALSE;
|
||||||
|
|
||||||
/* Avoid recursion (via ProcessEvent default case) */
|
/* Avoid recursion (via ProcessEvent default case) */
|
||||||
if (inOnIdle)
|
if (s_inOnIdle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
/* Resend in the main thread events which have been prepared in other
|
/* Resend in the main thread events which have been prepared in other
|
||||||
@@ -459,7 +457,7 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
|
||||||
inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
@@ -485,8 +483,6 @@ bool wxApp::SendIdleEvents( wxWindow* win )
|
|||||||
wxIdleEvent event;
|
wxIdleEvent event;
|
||||||
event.SetEventObject(win);
|
event.SetEventObject(win);
|
||||||
|
|
||||||
win->OnInternalIdle();
|
|
||||||
|
|
||||||
win->ProcessEvent(event);
|
win->ProcessEvent(event);
|
||||||
|
|
||||||
if (event.MoreRequested())
|
if (event.MoreRequested())
|
||||||
|
@@ -995,28 +995,25 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
m_brush.GetColour().CalcPixel( m_cmap );
|
m_brush.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
||||||
|
|
||||||
GdkFill fillStyle = GDK_SOLID;
|
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||||
switch (m_brush.GetStyle())
|
|
||||||
{
|
|
||||||
case wxSOLID:
|
|
||||||
case wxTRANSPARENT:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fillStyle = GDK_STIPPLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, fillStyle );
|
|
||||||
|
|
||||||
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
||||||
{
|
{
|
||||||
if (m_brush.GetStipple()->GetPixmap())
|
if (m_brush.GetStipple()->GetPixmap())
|
||||||
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_TILED );
|
||||||
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
|
||||||
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_HATCH(m_brush.GetStyle()))
|
if (IS_HATCH(m_brush.GetStyle()))
|
||||||
{
|
{
|
||||||
|
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
|
||||||
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
|
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
|
||||||
gdk_gc_set_stipple( m_brushGC, hatches[num] );
|
gdk_gc_set_stipple( m_brushGC, hatches[num] );
|
||||||
}
|
}
|
||||||
|
@@ -2909,7 +2909,11 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
|
|||||||
0 //gs_timeLastClick // the time of activation
|
0 //gs_timeLastClick // the time of activation
|
||||||
);
|
);
|
||||||
|
|
||||||
while (is_waiting) wxYield();
|
while (is_waiting)
|
||||||
|
{
|
||||||
|
while (gtk_events_pending())
|
||||||
|
gtk_main_iteration();
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user