]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
ignore these
[wxWidgets.git] / src / gtk1 / window.cpp
index ee398f439a8c5c03e6e6ee44a0f0609f0faa57a1..c61a2a2c67899f873a889e16ec1e773ecd8ce791 100644 (file)
@@ -661,7 +661,10 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
 static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
 {
 
 static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
 {
-    if ( !win->m_hasVMT )
+    if (!win->m_hasVMT)
+        return;
+
+    if (gdk_event->window != win->m_wxwindow->window)
         return;
 
     win->GetUpdateRegion().Union( gdk_event->area.x,
         return;
 
     win->GetUpdateRegion().Union( gdk_event->area.x,
@@ -669,20 +672,23 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
                                   gdk_event->area.width,
                                   gdk_event->area.height );
 
                                   gdk_event->area.width,
                                   gdk_event->area.height );
 
-    if ( gdk_event->count > 0 )
+    if (gdk_event->count > 0)
         return;
 
         return;
 
-/*
-    printf( "OnExpose from " );
-    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-        printf( win->GetClassInfo()->GetClassName() );
-    printf( ".\n" );
-*/
-
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
 
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
 
+/*
+    wxPrintf( "OnExpose from " );
+    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+        wxPrintf( win->GetClassInfo()->GetClassName() );
+    wxPrintf( " %d %d %d %d\n", (int)gdk_event->area.x,
+                                (int)gdk_event->area.y,
+                                (int)gdk_event->area.width,
+                                (int)gdk_event->area.height );
+*/
+
     win->GetUpdateRegion().Clear();
 }
 
     win->GetUpdateRegion().Clear();
 }
 
@@ -703,6 +709,17 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
 
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
 
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
+
+/*
+    wxPrintf( "OnDraw from " );
+    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+        printf( win->GetClassInfo()->GetClassName() );
+    wxPrintf( " %d %d %d %d\n", (int)rect->x,
+                                (int)rect->y,
+                                (int)rect->width,
+                                (int)rect->height );
+*/
+
     win->GetEventHandler()->ProcessEvent( event );
 
     win->GetUpdateRegion().Clear();
     win->GetEventHandler()->ProcessEvent( event );
 
     win->GetUpdateRegion().Clear();
@@ -2191,18 +2208,33 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 
 void wxWindow::OnInternalIdle()
 {
 
 void wxWindow::OnInternalIdle()
 {
-        GdkWindow *window = GetConnectWidget()->window;
-        if (window)
+    wxCursor cursor = m_cursor;
+    if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+    if (cursor.Ok() && m_currentGdkCursor != cursor)
+    {
+        m_currentGdkCursor = cursor;
+       
+        if (m_wxwindow)
         {
         {
-            wxCursor cursor = m_cursor;
-            if (g_globalCursor.Ok()) cursor = g_globalCursor;
+            GdkWindow *window = m_wxwindow->window;
+            if (window)
+                gdk_window_set_cursor( window, cursor.GetCursor() );
 
 
-            if (cursor.Ok() && m_currentGdkCursor != cursor)
-            {
+            if (!g_globalCursor.Ok())
+                cursor = *wxSTANDARD_CURSOR;
+
+            window = m_widget->window;
+            if (window)
                 gdk_window_set_cursor( window, cursor.GetCursor() );
                 gdk_window_set_cursor( window, cursor.GetCursor() );
-                m_currentGdkCursor = cursor;
-            }
         }
         }
+        else
+        {
+            GdkWindow *window = m_widget->window;
+            if (window)
+               gdk_window_set_cursor( window, cursor.GetCursor() );
+        }
+    }
 
     UpdateWindowUI();
 }
 
     UpdateWindowUI();
 }
@@ -2228,32 +2260,32 @@ void wxWindow::DoSetClientSize( int width, int height )
         int dw = 0;
         int dh = 0;
 
         int dw = 0;
         int dh = 0;
 
-        if (!m_hasScrolling)
+#if (GTK_MINOR_VERSION == 0)
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
         {
         {
-            GtkStyleClass *window_class = m_wxwindow->style->klass;
-
-            if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+            if (HasScrolling())
             {
             {
-                dw += 2 * window_class->xthickness;
-                dh += 2 * window_class->ythickness;
-            }
-        }
-        else
-        {
-            GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
-            GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+                GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+                GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
 
-#if (GTK_MINOR_VERSION == 0)
-            GtkWidget *viewport = scroll_window->viewport;
-            GtkStyleClass *viewport_class = viewport->style->klass;
+                GtkWidget *viewport = scroll_window->viewport;
+                GtkStyleClass *viewport_class = viewport->style->klass;
 
 
-            if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
-            {
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+        }
+#else
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+        {
+            /* when using GTK 1.2 we set the border size to 2 */
+            dw += 2 * 2;
+            dh += 2 * 2;
+        }
 #endif
 
 #endif
 
+        if (HasScrolling())
+        {
 /*
             GtkWidget *hscrollbar = scroll_window->hscrollbar;
             GtkWidget *vscrollbar = scroll_window->vscrollbar;
 /*
             GtkWidget *hscrollbar = scroll_window->hscrollbar;
             GtkWidget *vscrollbar = scroll_window->vscrollbar;
@@ -2261,6 +2293,9 @@ void wxWindow::DoSetClientSize( int width, int height )
             we use this instead:  range.slider_width = 11 + 2*2pts edge
 */
 
             we use this instead:  range.slider_width = 11 + 2*2pts edge
 */
 
+            GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+            GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+
             if (scroll_window->vscrollbar_visible)
             {
                 dw += 15;   /* dw += vscrollbar->allocation.width; */
             if (scroll_window->vscrollbar_visible)
             {
                 dw += 15;   /* dw += vscrollbar->allocation.width; */
@@ -2292,31 +2327,31 @@ void wxWindow::DoGetClientSize( int *width, int *height ) const
         int dw = 0;
         int dh = 0;
 
         int dw = 0;
         int dh = 0;
 
-        if (!m_hasScrolling)
+#if (GTK_MINOR_VERSION == 0)
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
         {
         {
-            GtkStyleClass *window_class = m_wxwindow->style->klass;
-
-            if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+            if (HasScrolling())
             {
             {
-                dw += 2 * window_class->xthickness;
-                dh += 2 * window_class->ythickness;
-            }
-        }
-        else
-        {
-            GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
-            GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+                GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+                GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
 
-#if (GTK_MINOR_VERSION == 0)
-            GtkWidget *viewport = scroll_window->viewport;
-            GtkStyleClass *viewport_class = viewport->style->klass;
+                GtkWidget *viewport = scroll_window->viewport;
+                GtkStyleClass *viewport_class = viewport->style->klass;
 
 
-            if ( HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER) )
-            {
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+        }
+#else
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+        {
+            /* when using GTK 1.2 we set the border size to 2 */
+            dw += 2 * 2;
+            dh += 2 * 2;
+        }
 #endif
 #endif
+        if (HasScrolling())
+        {
 /*
             GtkWidget *hscrollbar = scroll_window->hscrollbar;
             GtkWidget *vscrollbar = scroll_window->vscrollbar;
 /*
             GtkWidget *hscrollbar = scroll_window->hscrollbar;
             GtkWidget *vscrollbar = scroll_window->vscrollbar;
@@ -2324,6 +2359,9 @@ void wxWindow::DoGetClientSize( int *width, int *height ) const
             we use this instead:  range.slider_width = 11 + 2*2pts edge
 */
 
             we use this instead:  range.slider_width = 11 + 2*2pts edge
 */
 
+            GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+            GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+
             if (scroll_window->vscrollbar_visible)
             {
                 dw += 15;   /* dw += vscrollbar->allocation.width; */
             if (scroll_window->vscrollbar_visible)
             {
                 dw += 15;   /* dw += vscrollbar->allocation.width; */