if (BUILD_RADIANT)
set(GTK_TARGET 2 CACHE STRING "GTK target")
add_definitions(-DGTK_TARGET=${GTK_TARGET})
+
+ if (GTK_TARGET EQUAL 2 AND WIN32)
+ add_definitions(-DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1)
+ endif ()
endif ()
#-----------------------------------------------------------------------
else
ifeq ($(OS),Win32)
- CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline
+ CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline -DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1
CFLAGS_COMMON += -mms-bitfields
LDFLAGS_DLL = -Wl,--add-stdcall-alias
LIBS_COMMON = -lws2_32 -luser32 -lgdi32 -lole32
inline void CHECK_RESTORE( ui::Widget w ){
if ( gpointer_to_int( g_object_get_data( G_OBJECT( w ), "was_mapped" ) ) != 0 ) {
+
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( w ), "glwidget" ) );
+ if ( glwidget ){
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
+
w.show();
}
}
void IWidget::visible(bool shown)
{
if (shown) {
+
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( this ), "glwidget" ) );
+ if ( glwidget ){
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
+
this.show();
} else {
this.hide();
gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
}
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+void GroupDialog_cycle();
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
+
void GroupDialog_showPage( ui::Widget page ){
if ( GroupDialog_getPage() == page ) {
GroupDialog_ToggleShow();
+
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ /* this is very ugly: cycle to next tab then return to current tab immediately to force the refresh
+ * this fixes the drawing of texture tab when window is restored and current tab is texture tab
+ * this is called for nothing when windows is minimized and called for nothing when current tab
+ * is not texture tab, hopefully it's a workaround that would disappear with gtk 3 */
+ GroupDialog_cycle();
+ GroupDialog_setPage( page );
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
+
}
else
{
#include "referencecache.h"
#include "texwindow.h"
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+#define WORKAROUND_GOBJECT_SET_GLWIDGET(window, widget) g_object_set_data( G_OBJECT( window ), "glwidget", G_OBJECT( widget ) )
+#else
+#define WORKAROUND_GOBJECT_SET_GLWIDGET(window, widget)
+#endif
struct layout_globals_t
{
}
CamWnd_setParent( *m_pCamWnd, window );
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, CamWnd_getWidget( *m_pCamWnd ) );
+
g_floating_windows.push_back( window );
}
}
XY_Top_Shown_Construct( window );
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pXYWnd->GetWidget() );
+
g_floating_windows.push_back( window );
}
XZ_Front_Shown_Construct( window );
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pXZWnd->GetWidget() );
+
g_floating_windows.push_back( window );
}
YZ_Side_Shown_Construct( window );
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pYZWnd->GetWidget() );
+
g_floating_windows.push_back( window );
}
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( GroupDialog_getWindow(), TextureBrowser_getGLWidget() );
}
GroupDialog_show();
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, TextureBrowser_getGLWidget() );
}
}
Textures_setModeChangedNotify( Callback<void()>() );
}
+
+#if WORKAROUND_WINDOWS_GTK2_GLWIDGET
+ui::GLArea TextureBrowser_getGLWidget(){
+ return GlobalTextureBrowser().m_gl_widget;
+}
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
void TextureBrowser_RefreshShaders();
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+ui::GLArea TextureBrowser_getGLWidget();
+#endif // WORKAROUND_WINDOWS_GTK2_GLWIDGET
+
#endif