X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ddb22eb4b5b7ad1f85ff71e5e78fff659e2dc24a..5f9fd7ea86d211e3681a71c9f70303aa72b5de3c:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 7eba3ad0a0..befad324ff 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -612,27 +612,31 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp { DEBUG_MAIN_THREAD - if (!win->m_hasVMT) - return; - +/* + if (win->GetName() == wxT("grid window")) + { + wxPrintf( wxT("OnExpose from ") ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( wxT(" %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().Union( gdk_event->area.x, gdk_event->area.y, gdk_event->area.width, gdk_event->area.height ); -/* - 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 ); -*/ if (gdk_event->count > 0) return; + if (!win->m_hasVMT) + return; + wxEraseEvent eevent( win->GetId() ); eevent.SetEventObject( win ); win->GetEventHandler()->ProcessEvent(eevent); @@ -655,22 +659,28 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), if (g_isIdle) wxapp_install_idle_handler(); - - if (!win->m_hasVMT) + + if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1)) return; +/* + if (win->GetName() == wxT("grid window")) + { + wxPrintf( wxT("OnDraw from ") ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( wxT(" %d %d %d %d\n"), (int)rect->x, + (int)rect->y, + (int)rect->width, + (int)rect->height ); + } +*/ + win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height ); -/* - 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 ); -*/ + if (!win->m_hasVMT) + return; wxEraseEvent eevent( win->GetId() ); eevent.SetEventObject( win ); @@ -1718,7 +1728,7 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win ) wxWindowCreateEvent event( win ); event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); - + return FALSE; } @@ -2147,7 +2157,10 @@ wxWindow::~wxWindow() if (m_widgetStyle) { - gtk_style_unref( m_widgetStyle ); + // don't delete if it's a pixmap theme style + if (!m_widgetStyle->engine_data) + gtk_style_unref( m_widgetStyle ); + m_widgetStyle = (GtkStyle*) NULL; } @@ -2924,7 +2937,7 @@ void wxWindow::Clear() if (m_wxwindow && m_wxwindow->window) { - gdk_window_clear( m_wxwindow->window ); +// gdk_window_clear( m_wxwindow->window ); } } @@ -3040,6 +3053,18 @@ GtkStyle *wxWindow::GetWidgetStyle() void wxWindow::SetWidgetStyle() { + if (m_widget->style->engine_data) + { + static bool s_warningPrinted = FALSE; + if (!s_warningPrinted) + { + printf( "wxWindows warning: Widget styles disabled due to buggy GTK theme.\n" ); + s_warningPrinted = TRUE; + } + m_widgetStyle = m_widget->style; + return; + } + GtkStyle *style = GetWidgetStyle(); if (m_font != wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT )) @@ -3419,62 +3444,60 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); - -/* - printf( "ScrollWindow: %d %d\n", dx, dy ); -*/ + + if ((dx == 0) && (dy == 0)) return; gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); - -/* - if (!m_scrollGC) + +/* + if (m_children.GetCount() > 0) { - m_scrollGC = gdk_gc_new( m_wxwindow->window ); - gdk_gc_set_exposures( m_scrollGC, TRUE ); + gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); } - - wxNode *node = m_children.First(); - while (node) + else { - wxWindow *child = (wxWindow*) node->Data(); - int sx = 0; - int sy = 0; - child->GetSize( &sx, &sy ); - child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); - node = node->Next(); - } + GtkPizza *pizza = GTK_PIZZA(m_wxwindow); + + pizza->xoffset -= dx; + pizza->yoffset -= dy; + + GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_window ); + gdk_gc_set_exposures( m_scrollGC, TRUE ); - int cw = 0; - int ch = 0; - GetClientSize( &cw, &ch ); - int w = cw - abs(dx); - int h = ch - abs(dy); + int cw = 0; + int ch = 0; + GetClientSize( &cw, &ch ); + int w = cw - abs(dx); + int h = ch - abs(dy); - if ((h < 0) || (w < 0)) - { - Refresh(); - } - else - { - int s_x = 0; - int s_y = 0; - if (dx < 0) s_x = -dx; - if (dy < 0) s_y = -dy; - int d_x = 0; - int d_y = 0; - if (dx > 0) d_x = dx; - if (dy > 0) d_y = dy; - - gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y, - m_wxwindow->window, s_x, s_y, w, h ); - - wxRect rect; - if (dx < 0) rect.x = cw+dx; else rect.x = 0; - if (dy < 0) rect.y = ch+dy; else rect.y = 0; - if (dy != 0) rect.width = cw; else rect.width = abs(dx); - if (dx != 0) rect.height = ch; else rect.height = abs(dy); - - Refresh( TRUE, &rect ); + if ((h < 0) || (w < 0)) + { + Refresh(); + } + else + { + int s_x = 0; + int s_y = 0; + if (dx < 0) s_x = -dx; + if (dy < 0) s_y = -dy; + int d_x = 0; + int d_y = 0; + if (dx > 0) d_x = dx; + if (dy > 0) d_y = dy; + + gdk_window_copy_area( pizza->bin_window, m_scrollGC, d_x, d_y, + pizza->bin_window, s_x, s_y, w, h ); + + wxRect rect; + if (dx < 0) rect.x = cw+dx; else rect.x = 0; + if (dy < 0) rect.y = ch+dy; else rect.y = 0; + if (dy != 0) rect.width = cw; else rect.width = abs(dx); + if (dx != 0) rect.height = ch; else rect.height = abs(dy); + + Refresh( TRUE, &rect ); + } + + gdk_gc_unref( m_scrollGC ); } */ }