From 8cb9f0d0f82650b707adc39823a73531d080ffec Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 14 Mar 2000 20:08:31 +0000 Subject: [PATCH] Fixed missing paint events when overriding DoMoveWindow() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/win_gtk.h | 3 +++ include/wx/gtk1/win_gtk.h | 3 +++ samples/calendar/calendar.cpp | 2 +- src/gtk/frame.cpp | 4 +++- src/gtk/win_gtk.c | 27 +++++++++++++++++++++++++++ src/gtk/window.cpp | 22 ++++++++++++++++------ src/gtk1/frame.cpp | 4 +++- src/gtk1/win_gtk.c | 27 +++++++++++++++++++++++++++ src/gtk1/window.cpp | 22 ++++++++++++++++------ 9 files changed, 99 insertions(+), 15 deletions(-) diff --git a/include/wx/gtk/win_gtk.h b/include/wx/gtk/win_gtk.h index b3c92cec54..12e51bd180 100644 --- a/include/wx/gtk/win_gtk.h +++ b/include/wx/gtk/win_gtk.h @@ -97,6 +97,9 @@ void gtk_pizza_set_external (GtkPizza *pizza, void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy); + +gint gtk_pizza_child_resized (GtkPizza *pizza, + GtkWidget *widget); void gtk_pizza_put (GtkPizza *pizza, GtkWidget *widget, diff --git a/include/wx/gtk1/win_gtk.h b/include/wx/gtk1/win_gtk.h index b3c92cec54..12e51bd180 100644 --- a/include/wx/gtk1/win_gtk.h +++ b/include/wx/gtk1/win_gtk.h @@ -97,6 +97,9 @@ void gtk_pizza_set_external (GtkPizza *pizza, void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy); + +gint gtk_pizza_child_resized (GtkPizza *pizza, + GtkWidget *widget); void gtk_pizza_put (GtkPizza *pizza, GtkWidget *widget, diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 50a42c800f..1a05ab23d7 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -301,7 +301,7 @@ MyPanel::MyPanel(wxFrame *frame) { // using constraints doesn't work under GTK - the calendar window is never // repainted after it had been moved at least once! -#if 0 +#if 1 SetAutoLayout(TRUE); wxString date; diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index c20496ef80..13d018c53b 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -126,6 +126,7 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->m_width = alloc->width; win->m_height = alloc->height; + win->m_queuedFullRedraw = TRUE; win->GtkUpdateSize(); } } @@ -402,7 +403,7 @@ void wxFrame::Init() m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; m_insertInClientArea = TRUE; - m_isFrame = TRUE; + m_isFrame = FALSE; } bool wxFrame::Create( wxWindow *parent, @@ -416,6 +417,7 @@ bool wxFrame::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); m_needParent = FALSE; + m_isFrame = TRUE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index 20d0181db6..a79465d94f 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -424,6 +424,33 @@ gtk_pizza_set_size (GtkPizza *pizza, } } +gint +gtk_pizza_child_resized (GtkPizza *pizza, + GtkWidget *widget) +{ + GtkPizzaChild *child; + GList *children; + + g_return_val_if_fail (pizza != NULL, FALSE); + g_return_val_if_fail (GTK_IS_PIZZA (pizza), FALSE); + g_return_val_if_fail (widget != NULL, FALSE); + + children = pizza->children; + while (children) + { + child = children->data; + children = children->next; + + if (child->widget == widget) + { + return ((child->width == widget->allocation.width) && + (child->height == widget->allocation.height)); + } + } + + return FALSE; +} + static void gtk_pizza_map (GtkWidget *widget) { diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ba648e96bf..74e06e0af0 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -46,10 +46,13 @@ #include #include #include -#include - #include +#include +#include + +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- @@ -621,7 +624,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev wxapp_install_idle_handler(); /* - if (win->GetName() == wxT("status_line")) + if (win->GetName() == wxT("panel")) { wxPrintf( wxT("OnExpose from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -721,7 +724,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW wxapp_install_idle_handler(); /* - if (win->GetName() == wxT("status_line")) + if (win->GetName() == wxT("panel")) { wxPrintf( wxT("OnDraw from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -737,6 +740,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW if (!win->m_queuedFullRedraw) { + if (!(GTK_WIDGET_APP_PAINTABLE (widget)) && (pizza->clear_on_draw)) { @@ -2571,8 +2575,14 @@ void wxWindow::OnInternalIdle() the actual size of window, in which case all expose events that resulted from resizing the window have been sent (and discarded) and we can now do our full redraw and switch on expose event handling again. */ - - if ((m_width == m_widget->allocation.width) && (m_height == m_widget->allocation.height)) + + bool child_already_resized = FALSE; + if (m_isFrame) + child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_wxwindow->parent), m_wxwindow ); + else + child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_widget->parent), m_widget ); + + if (child_already_resized) { m_queuedFullRedraw = FALSE; m_updateRegion.Clear(); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index c20496ef80..13d018c53b 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -126,6 +126,7 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->m_width = alloc->width; win->m_height = alloc->height; + win->m_queuedFullRedraw = TRUE; win->GtkUpdateSize(); } } @@ -402,7 +403,7 @@ void wxFrame::Init() m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; m_insertInClientArea = TRUE; - m_isFrame = TRUE; + m_isFrame = FALSE; } bool wxFrame::Create( wxWindow *parent, @@ -416,6 +417,7 @@ bool wxFrame::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); m_needParent = FALSE; + m_isFrame = TRUE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) diff --git a/src/gtk1/win_gtk.c b/src/gtk1/win_gtk.c index 20d0181db6..a79465d94f 100644 --- a/src/gtk1/win_gtk.c +++ b/src/gtk1/win_gtk.c @@ -424,6 +424,33 @@ gtk_pizza_set_size (GtkPizza *pizza, } } +gint +gtk_pizza_child_resized (GtkPizza *pizza, + GtkWidget *widget) +{ + GtkPizzaChild *child; + GList *children; + + g_return_val_if_fail (pizza != NULL, FALSE); + g_return_val_if_fail (GTK_IS_PIZZA (pizza), FALSE); + g_return_val_if_fail (widget != NULL, FALSE); + + children = pizza->children; + while (children) + { + child = children->data; + children = children->next; + + if (child->widget == widget) + { + return ((child->width == widget->allocation.width) && + (child->height == widget->allocation.height)); + } + } + + return FALSE; +} + static void gtk_pizza_map (GtkWidget *widget) { diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index ba648e96bf..74e06e0af0 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -46,10 +46,13 @@ #include #include #include -#include - #include +#include +#include + +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- @@ -621,7 +624,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev wxapp_install_idle_handler(); /* - if (win->GetName() == wxT("status_line")) + if (win->GetName() == wxT("panel")) { wxPrintf( wxT("OnExpose from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -721,7 +724,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW wxapp_install_idle_handler(); /* - if (win->GetName() == wxT("status_line")) + if (win->GetName() == wxT("panel")) { wxPrintf( wxT("OnDraw from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -737,6 +740,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW if (!win->m_queuedFullRedraw) { + if (!(GTK_WIDGET_APP_PAINTABLE (widget)) && (pizza->clear_on_draw)) { @@ -2571,8 +2575,14 @@ void wxWindow::OnInternalIdle() the actual size of window, in which case all expose events that resulted from resizing the window have been sent (and discarded) and we can now do our full redraw and switch on expose event handling again. */ - - if ((m_width == m_widget->allocation.width) && (m_height == m_widget->allocation.height)) + + bool child_already_resized = FALSE; + if (m_isFrame) + child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_wxwindow->parent), m_wxwindow ); + else + child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_widget->parent), m_widget ); + + if (child_already_resized) { m_queuedFullRedraw = FALSE; m_updateRegion.Clear(); -- 2.45.2