From: Mario Date: Mon, 6 Jun 2016 09:07:47 +0000 (+1000) Subject: Apply the old workaround to fix the blank texture browser issue (causes runtime error... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8e4989b0297b5c09855be08aa1b2acf78401e551;p=xonotic%2Fnetradiant.git Apply the old workaround to fix the blank texture browser issue (causes runtime errors on some maps) --- diff --git a/libs/gtkutil/widget.h b/libs/gtkutil/widget.h index ceb92409..e6db9c3e 100644 --- a/libs/gtkutil/widget.h +++ b/libs/gtkutil/widget.h @@ -30,6 +30,14 @@ inline void widget_set_visible( GtkWidget* widget, bool shown ){ if ( shown ) { + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "glwidget" ) ); + if ( glwidget ){ + //if ( widget_is_visible( glwidget ) ) + //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */ + gtk_widget_hide( glwidget ); + gtk_widget_show( glwidget ); + } gtk_widget_show( widget ); } else diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index 48b174b3..3ed7097c 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -29,12 +29,18 @@ inline void CHECK_RESTORE( GtkWidget* w ){ if ( gpointer_to_int( g_object_get_data( G_OBJECT( w ), "was_mapped" ) ) != 0 ) { gtk_widget_show( w ); + /* workaround for gtk 2.24 issue: not displayed glwidget after min/restore */ + GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( w ), "glwidget" ) ); + if ( glwidget ){ + gtk_widget_hide( glwidget ); + gtk_widget_show( glwidget ); + } } } inline void CHECK_MINIMIZE( GtkWidget* w ){ g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( GTK_WIDGET_VISIBLE( w ) ) ); - gtk_widget_hide( w ); + //gtk_widget_hide( w ); //fix for gtk 2.24 + the whole scheme isn't needed with gtk 2.16, 2.24; they do it all alone } static gboolean main_window_iconified( GtkWidget* widget, GdkEventWindowState* event, gpointer data ){ diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index 2e717d12..dc94603b 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -61,6 +61,14 @@ void Create( GtkWindow* parent ); void Show(){ // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event m_position_tracker.sync( m_window ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( m_window ), "glwidget" ) ); + if ( glwidget ){ + //if ( widget_is_visible( glwidget ) ) + //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */ + gtk_widget_hide( glwidget ); + gtk_widget_show( glwidget ); + } gtk_widget_show( GTK_WIDGET( m_window ) ); } void Hide(){ diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 0e430f11..47d05c48 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2883,6 +2883,8 @@ void MainFrame::Create(){ gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) ); } CamWnd_setParent( *m_pCamWnd, window ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( window ), "glwidget", CamWnd_getWidget( *m_pCamWnd ) ); g_floating_windows.push_back( GTK_WIDGET( window ) ); } @@ -2902,6 +2904,8 @@ void MainFrame::Create(){ gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) ); } XY_Top_Shown_Construct( window ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( window ), "glwidget", m_pXYWnd->GetWidget() ); g_floating_windows.push_back( GTK_WIDGET( window ) ); } @@ -2921,6 +2925,8 @@ void MainFrame::Create(){ } XZ_Front_Shown_Construct( window ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( window ), "glwidget", m_pXZWnd->GetWidget() ); g_floating_windows.push_back( GTK_WIDGET( window ) ); } @@ -2940,6 +2946,8 @@ void MainFrame::Create(){ } YZ_Side_Shown_Construct( window ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( window ), "glwidget", m_pYZWnd->GetWidget() ); g_floating_windows.push_back( GTK_WIDGET( window ) ); } @@ -2947,6 +2955,8 @@ void MainFrame::Create(){ { GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() ); } GroupDialog_show(); @@ -2980,6 +2990,8 @@ void MainFrame::Create(){ { GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) ); g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() ); + /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ + g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() ); } } diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 33e7e5c2..74c8c7e6 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -2608,3 +2608,7 @@ void TextureBrowser_Destroy(){ Textures_setModeChangedNotify( Callback() ); } + +GtkWidget* TextureBrowser_getGLWidget(){ + return GlobalTextureBrowser().m_gl_widget; +} diff --git a/radiant/texwindow.h b/radiant/texwindow.h index 3a872014..d62c772a 100644 --- a/radiant/texwindow.h +++ b/radiant/texwindow.h @@ -59,4 +59,6 @@ void TextureBrowser_setBackgroundColour( TextureBrowser& textureBrowser, const V void TextureBrowser_addActiveShadersChangedCallback( const SignalHandler& handler ); void TextureBrowser_addShadersRealiseCallback( const SignalHandler& handler ); +GtkWidget* TextureBrowser_getGLWidget(); + #endif