]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch for stipppled brushes,
authorRobert Roebling <robert@roebling.de>
Thu, 5 Aug 1999 11:14:07 +0000 (11:14 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 5 Aug 1999 11:14:07 +0000 (11:14 +0000)
  Corrected idle behaviour after popmenu call

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/dnd/dnd.cpp
src/gtk/app.cpp
src/gtk/dcclient.cpp
src/gtk/window.cpp
src/gtk1/app.cpp
src/gtk1/dcclient.cpp
src/gtk1/window.cpp

index 3fc5583e92c4c76839697c66fa419ff4bb96887d..046f9431995d0aaa490e4267d8e1aad4755b2bf8 100644 (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.
index c0ce494d7eab6731ab991a8fc6e7b52928c17870..a81c4dd2056a32f60d4b85936d345439f579017b 100644 (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())
index cbfcc44f33ee573a40f9468851dc6b27239ef7a3..6ec3b442236c187894e28fc3462b69a03a399ab2 100644 (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] );
     }
index f43608af41bfad97df510db175348d810796db9f..dfeb16b66f26727c2c9799e9d2032887330fc835 100644 (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;
 }
index c0ce494d7eab6731ab991a8fc6e7b52928c17870..a81c4dd2056a32f60d4b85936d345439f579017b 100644 (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())
index cbfcc44f33ee573a40f9468851dc6b27239ef7a3..6ec3b442236c187894e28fc3462b69a03a399ab2 100644 (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] );
     }
index f43608af41bfad97df510db175348d810796db9f..dfeb16b66f26727c2c9799e9d2032887330fc835 100644 (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;
 }