]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/widget.h
Radiant:
[xonotic/netradiant.git] / libs / gtkutil / widget.h
index ceb92409f8bf9c6553fdc193812ca3b41f43ecdf..f4bc32671b80efce8375799b0a910c5bd565fd33 100644 (file)
 #include "warnings.h"
 #include "debugging/debugging.h"
 
-inline void widget_set_visible( GtkWidget* widget, bool shown ){
-       if ( shown ) {
+inline bool widget_is_visible( GtkWidget* widget ){
+       return GTK_WIDGET_VISIBLE( widget ) != FALSE;
+}
+
+inline void widget_set_visible( GtkWidget* widget, bool show ){
+       if ( show ) {
+               /* 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
@@ -38,9 +50,6 @@ inline void widget_set_visible( GtkWidget* widget, bool shown ){
        }
 }
 
-inline bool widget_is_visible( GtkWidget* widget ){
-       return GTK_WIDGET_VISIBLE( widget ) != FALSE;
-}
 
 inline void widget_toggle_visible( GtkWidget* widget ){
        widget_set_visible( widget, !widget_is_visible( widget ) );