]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Apply the old workaround to fix the blank texture browser issue (causes runtime error...
authorMario <mario@smbclan.net>
Mon, 6 Jun 2016 09:07:47 +0000 (19:07 +1000)
committerMario <mario@smbclan.net>
Mon, 6 Jun 2016 09:07:47 +0000 (19:07 +1000)
libs/gtkutil/widget.h
libs/gtkutil/window.cpp
radiant/groupdialog.cpp
radiant/mainframe.cpp
radiant/texwindow.cpp
radiant/texwindow.h

index ceb92409f8bf9c6553fdc193812ca3b41f43ecdf..e6db9c3e8ae4beddd234488465d58d36a87176c1 100644 (file)
 
 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
index 48b174b37a6c24baf7b9e17f313cb6987d248aca..3ed7097ce26c7976ff78a496e4c4b4fbbb21d13d 100644 (file)
 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 ){
index 2e717d121d631d44e8cabdb96b665e749f278f14..dc94603bfa7c9668bec2130e6ec10d15a64bbe67 100644 (file)
@@ -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(){
index 0e430f11c634a87b6298e64edb86cd72c4e97e37..47d05c48fc12113f023f1e7c30b53dd6ad16009b 100644 (file)
@@ -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() );
                }
        }
 
index 33e7e5c257d8ef227a6e13f75fffa9cf2868953a..74c8c7e651e9871a0c5cd0b0fe12e55cd35fb70a 100644 (file)
@@ -2608,3 +2608,7 @@ void TextureBrowser_Destroy(){
 
        Textures_setModeChangedNotify( Callback() );
 }
+
+GtkWidget* TextureBrowser_getGLWidget(){
+       return GlobalTextureBrowser().m_gl_widget;
+}
index 3a872014c2925a410f1a01ff7106ca82cd431317..d62c772a5a13cafc23d1421be2944e50d8b5aee8 100644 (file)
@@ -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