]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/app.cpp
added default style wxFRAME_TOOL_WINDOW to creation
[wxWidgets.git] / src / x11 / app.cpp
index 21eff48925f3452d157496f40dc73e4dec2ec85a..d45ff95d4a9230ba17bff32026c146f450699902 100644 (file)
@@ -26,6 +26,9 @@
 #include "wx/intl.h"
 #include "wx/evtloop.h"
 
+#include "wx/univ/theme.h"
+#include "wx/univ/renderer.h"
+
 #if wxUSE_THREADS
     #include "wx/thread.h"
 #endif
@@ -248,7 +251,7 @@ int wxEntryStart( int& argc, char *argv[] )
     
     XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
         
-//    wxSetDetectableAutoRepeat( TRUE );
+    wxSetDetectableAutoRepeat( TRUE );
 
     if (!wxApp::Initialize())
         return -1;
@@ -405,7 +408,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
     wxWindow* win = NULL;
     Window window = event->xany.window;
     Window actualWindow = window;
-
+    
     // Find the first wxWindow that corresponds to this event window
     // Because we're receiving events after a window
     // has been destroyed, assume a 1:1 match between
@@ -481,8 +484,8 @@ void wxApp::ProcessXEvent(WXEvent* _event)
             if (win && !win->IsEnabled())
                 return;
 
-            Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);;
-            Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);;
+            Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);
+            Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);
 
             if (event->xclient.message_type == wm_protocols)
             {
@@ -541,9 +544,35 @@ void wxApp::ProcessXEvent(WXEvent* _event)
                                               
                 win->GetClearRegion().Union( event->xexpose.x, event->xexpose.y,
                                              event->xexpose.width, event->xexpose.height);
+                
+                if (event->xexpose.count == 0)
+                {
+                    // Only erase background, paint in idle time.
+                    win->SendEraseEvents();
+                }
+            }
+
+            return;
+        }
+        case GraphicsExpose:
+        {
+            if (win)
+            {
+                // wxLogDebug( "GraphicsExpose from %s", win->GetName().c_str(),
+                //                              event->xgraphicsexpose.x, event->xgraphicsexpose.y,
+                //                              event->xgraphicsexpose.width, event->xgraphicsexpose.height);
+                    
+                win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
+                                              event->xgraphicsexpose.width, event->xgraphicsexpose.height);
                                               
-                // if (event->xexpose.count == 0)
-                //    win->Update();
+                win->GetClearRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
+                                             event->xgraphicsexpose.width, event->xgraphicsexpose.height);
+                                              
+                if (event->xgraphicsexpose.count == 0)
+                {
+                    // Only erase background, paint in idle time.
+                    win->SendEraseEvents();
+                }
             }
 
             return;
@@ -554,15 +583,23 @@ void wxApp::ProcessXEvent(WXEvent* _event)
         case ButtonRelease:
         case MotionNotify:
         {
-            if (win && !win->IsEnabled())
+            if (!win)
                 return;
-
-            if (win)
+                
+            if (!win->IsEnabled())
+                return;
+            
+#if 1
+            if (event->type == ButtonPress)
             {
-                wxMouseEvent wxevent;
-                wxTranslateMouseEvent(wxevent, win, window, event);
-                win->GetEventHandler()->ProcessEvent( wxevent );
+                if ((win != wxWindow::FindFocus()) && win->AcceptsFocus())
+                   win->SetFocus();
             }
+#endif
+
+            wxMouseEvent wxevent;
+            wxTranslateMouseEvent(wxevent, win, window, event);
+            win->GetEventHandler()->ProcessEvent( wxevent );
             return;
         }
         case FocusIn:
@@ -585,7 +622,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
                 if (win && event->xfocus.detail != NotifyPointer)
 #endif
                 {
-                    wxLogDebug( "FocusOut from %s\n", win->GetName().c_str() );
+                    wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
                     
                     wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
                     focusEvent.SetEventObject(win);
@@ -838,37 +875,9 @@ bool wxApp::Yield(bool onlyIfNeeded)
     return TRUE;
 }
 
-// XPM hack: make the arrays const
-#define static static const
-
-#include "wx/generic/info.xpm"
-#include "wx/generic/error.xpm"
-#include "wx/generic/question.xpm"
-#include "wx/generic/warning.xpm"
-
-#undef static
-
-wxIcon
-wxApp::GetStdIcon(int which) const
+wxIcon wxApp::GetStdIcon(int which) const
 {
-    switch(which)
-    {
-        case wxICON_INFORMATION:
-            return wxIcon(info_xpm);
-
-        case wxICON_QUESTION:
-            return wxIcon(question_xpm);
-
-        case wxICON_EXCLAMATION:
-            return wxIcon(warning_xpm);
-
-        default:
-            wxFAIL_MSG("requested non existent standard icon");
-            // still fall through
-
-        case wxICON_HAND:
-            return wxIcon(error_xpm);
-    }
+    return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
 }
 
 void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)