X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb411b9eea6ad06d0fcd7695ec6346cbdf26a314..aed08d7967af9365edd61723ca9fff977ca744c2:/src/gtk1/window.cpp?ds=sidebyside diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 2deaff54fe..c12e2fad49 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -54,6 +54,7 @@ #endif #include +#include #include "wx/gtk/private.h" #include @@ -518,7 +519,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, gdk_event->area.height ); // Actual redrawing takes place in idle time. - win->GtkUpdate(); + // win->GtkUpdate(); #ifdef __WXGTK20__ @@ -611,20 +612,12 @@ static void gtk_window_draw_callback( GtkWidget *widget, (char *)"base", 0, 0, -1, -1); } - - - if (!(GTK_WIDGET_APP_PAINTABLE (widget)) && - (pizza->clear_on_draw)) - { - gdk_window_clear_area( pizza->bin_window, - rect->x, rect->y, rect->width, rect->height); - } #endif + win->m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height ); win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height ); - // Actual redrawing takes place in idle time. - + // Update immediately, not in idle time. win->GtkUpdate(); #ifndef __WXUNIVERSAL__ @@ -953,7 +946,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, KeySym keysym = gdk_event->keyval; - wxLogTrace(TRACE_KEYS, _T("Key %s event: keysym = %d"), + wxLogTrace(TRACE_KEYS, _T("Key %s event: keysym = %ld"), event.GetEventType() == wxEVT_KEY_UP ? _T("release") : _T("press"), keysym); @@ -1023,7 +1016,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } } - wxLogTrace(TRACE_KEYS, _T("\t-> wxKeyCode %d"), key_code); + wxLogTrace(TRACE_KEYS, _T("\t-> wxKeyCode %ld"), key_code); // sending unknown key events doesn't really make sense if ( !key_code ) @@ -2503,17 +2496,17 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w { wxCHECK_MSG( !m_needParent || parent, FALSE, wxT("Need complete parent.") ); - /* this turns -1 into 20 so that a minimal window is - visible even although -1,-1 has been given as the - size of the window. the same trick is used in other - ports and should make debugging easier */ - m_width = WidthDefault(size.x); + // This turns -1 into 30 so that a minimal window is + // visible even although -1,-1 has been given as the + // size of the window. the same trick is used in other + // ports and should make debugging easier. + m_width = WidthDefault(size.x) ; m_height = HeightDefault(size.y); m_x = (int)pos.x; m_y = (int)pos.y; - /* some reasonable defaults */ + // some reasonable defaults if (!parent) { if (m_x == -1) @@ -2699,16 +2692,14 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags { if (x != -1) m_x = x + pizza->xoffset; if (y != -1) m_y = y + pizza->yoffset; - if (width != -1) m_width = width; - if (height != -1) m_height = height; } else { m_x = x + pizza->xoffset; m_y = y + pizza->yoffset; - m_width = width; - m_height = height; } + if (width != -1) m_width = width; + if (height != -1) m_height = height; if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH) { @@ -3149,7 +3140,7 @@ void wxWindowGTK::GetTextExtent( const wxString& string, wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); GdkFont *font = fontToUse.GetInternalFont( 1.0 ); - if (x) (*x) = gdk_string_width( font, string.mbc_str() ); + if (x) (*x) = gdk_string_width( font, wxGTK_CONV( string ) ); if (y) (*y) = font->ascent + font->descent; if (descent) (*descent) = font->descent; if (externalLeading) (*externalLeading) = 0; // ?? @@ -3316,11 +3307,12 @@ void wxWindowGTK::WarpPointer( int x, int y ) gdk_window_warp_pointer( window, x, y ); } + void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) { if (!m_widget) return; if (!m_widget->window) return; - + #ifndef __WXGTK20__ if (g_isIdle) wxapp_install_idle_handler(); @@ -3420,7 +3412,8 @@ void wxWindowGTK::GtkSendPaintEvents() // Clip to paint region in wxClientDC m_clipPaintRegion = TRUE; - + +#ifndef __WXGTK20__ if (GetThemeEnabled()) { // find ancestor from which to steal background @@ -3452,24 +3445,23 @@ void wxWindowGTK::GtkSendPaintEvents() } } else - // if (!m_clearRegion.IsEmpty()) // always send an erase event +#endif +#ifdef __WXGTK20__ + if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2 +#endif { - // If the clear region is empty, and the update region isn't, - // then we're going to clear more than we repaint, - // so let's make sure the two regions are in sync. - if (m_clearRegion.IsEmpty() && !m_updateRegion.IsEmpty()) - { - m_clearRegion = m_updateRegion ; - } - wxWindowDC dc( (wxWindow*)this ); - dc.SetClippingRegion( m_clearRegion ); + if (m_clearRegion.IsEmpty()) + dc.SetClippingRegion( m_updateRegion ); + else + dc.SetClippingRegion( m_clearRegion ); wxEraseEvent erase_event( GetId(), &dc ); erase_event.SetEventObject( this ); if (!GetEventHandler()->ProcessEvent(erase_event)) { +#ifndef __WXGTK20__ if (!g_eraseGC) { g_eraseGC = gdk_gc_new( pizza->bin_window ); @@ -3484,6 +3476,7 @@ void wxWindowGTK::GtkSendPaintEvents() upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); upd ++; } +#endif } m_clearRegion.Clear(); }