From: Thomas Debesse Date: Sun, 21 Mar 2021 18:15:14 +0000 (+0100) Subject: radiant/texwindow: make glarea redraw code reusable X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=89d49bde42fa0937db1a7a17e1a142adc8b292a0;p=xonotic%2Fnetradiant.git radiant/texwindow: make glarea redraw code reusable --- diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index c791e17f..dda6fb77 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1517,7 +1517,7 @@ gboolean TextureBrowser_size_allocate( ui::Widget widget, GtkAllocation* allocat return FALSE; } -gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){ +void TextureBrowser_redraw( TextureBrowser* textureBrowser ){ if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) { GlobalOpenGL_debugAssertNoErrors(); TextureBrowser_evaluateHeight( *textureBrowser ); @@ -1525,6 +1525,10 @@ gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, Textur GlobalOpenGL_debugAssertNoErrors(); glwidget_swap_buffers( textureBrowser->m_gl_widget ); } +} + +gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){ + TextureBrowser_redraw( textureBrowser ); return FALSE; } @@ -2408,8 +2412,7 @@ void TextureBrowser_hideGLWidget(){ textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hframe, FALSE, FALSE, 0, ui::Packing::END ); textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hfiller, TRUE, TRUE, 0, ui::Packing::START); textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, FALSE, FALSE, 0, ui::Packing::END ); - GdkEventExpose event = {}; - TextureBrowser_expose( GlobalTextureBrowser().m_gl_widget, &event, &GlobalTextureBrowser() ); + TextureBrowser_redraw( &GlobalTextureBrowser() ); // The hack needs the GL widget to not be hidden to work, // so resizing it triggers the redraw of it with the new size. // GlobalTextureBrowser().m_gl_widget.hide();