From 08fc17448ab46b588435887cf6418565d40b5298 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 5 May 1999 20:05:26 +0000 Subject: [PATCH] fix for menu separator wxGlCanvas works again (but flickers) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/menu.cpp | 14 ++++++++++++++ src/gtk/window.cpp | 3 --- src/gtk1/menu.cpp | 14 ++++++++++++++ src/gtk1/window.cpp | 3 --- utils/glcanvas/gtk/glcanvas.cpp | 31 ++++++++++++++----------------- 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index aa5e5d9c43..f5662e116a 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -597,9 +597,23 @@ void wxMenu::AppendSeparator() wxMenuItem *mitem = new wxMenuItem(); mitem->SetId(ID_SEPARATOR); +#if (GTK_MINOR_VERSION > 0) + GtkItemFactoryEntry entry; + entry.path = "/sep"; + entry.callback = (GtkItemFactoryCallback) NULL; + entry.callback_action = 0; + entry.item_type = ""; + entry.accelerator = (gchar*) NULL; + + gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ + + /* this will be wrong for more than one separator. do we care? */ + GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "
/sep" ); +#else GtkWidget *menuItem = gtk_menu_item_new(); gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_widget_show( menuItem ); +#endif mitem->SetMenuItem(menuItem); m_items.Append( mitem ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 1f40d20ec1..9200b4e12b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2002,9 +2002,6 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) } else { - int old_width = m_width; - int old_height = m_height; - if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) { if (x != -1) m_x = x; diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index aa5e5d9c43..f5662e116a 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -597,9 +597,23 @@ void wxMenu::AppendSeparator() wxMenuItem *mitem = new wxMenuItem(); mitem->SetId(ID_SEPARATOR); +#if (GTK_MINOR_VERSION > 0) + GtkItemFactoryEntry entry; + entry.path = "/sep"; + entry.callback = (GtkItemFactoryCallback) NULL; + entry.callback_action = 0; + entry.item_type = ""; + entry.accelerator = (gchar*) NULL; + + gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ + + /* this will be wrong for more than one separator. do we care? */ + GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "
/sep" ); +#else GtkWidget *menuItem = gtk_menu_item_new(); gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_widget_show( menuItem ); +#endif mitem->SetMenuItem(menuItem); m_items.Append( mitem ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 1f40d20ec1..9200b4e12b 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2002,9 +2002,6 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) } else { - int old_width = m_width; - int old_height = m_height; - if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) { if (x != -1) m_x = x; diff --git a/utils/glcanvas/gtk/glcanvas.cpp b/utils/glcanvas/gtk/glcanvas.cpp index 7fe94697e3..d8d12a8ab4 100644 --- a/utils/glcanvas/gtk/glcanvas.cpp +++ b/utils/glcanvas/gtk/glcanvas.cpp @@ -208,7 +208,7 @@ bool wxGLCanvas::Create( wxWindow *parent, wxWindowID id, GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_SET_FLAGS( m_glWidget, GTK_CAN_FOCUS ); - gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), m_glWidget, 0, 0 ); + gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), m_glWidget, 0, 0, m_width, m_height ); gtk_signal_connect( GTK_OBJECT(m_glWidget), "expose_event", GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); @@ -316,22 +316,19 @@ void wxGLCanvas::DoSetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y ); - - if ((old_width != m_width) || (old_height != m_height)) - { - gtk_widget_set_usize( m_widget, m_width, m_height ); - - gtk_widget_set_usize( m_glWidget, m_width, m_height ); - - GtkAllocation allo; - allo.x = 0; - allo.y = 0; - allo.width = m_width; - allo.height = m_height; - gtk_widget_size_allocate( m_glWidget, &allo ); - - } + gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), + m_widget, + m_x, + m_y, + m_width, + m_height ); + + gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow), + m_glWidget, + m_x, + m_y, + m_width, + m_height ); } m_sizeSet = TRUE; -- 2.45.2