From: Thomas Debesse Date: Mon, 25 May 2020 11:26:36 +0000 (+0200) Subject: Merge commit 'f6b9708d076f575f8ecc2baec9d5057824dbfcae' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5065eec;p=xonotic%2Fnetradiant.git Merge commit 'f6b9708d076f575f8ecc2baec9d5057824dbfcae' into garux-merge --- c5065eecd29651649c2f3d04be8af9a19d189733 diff --cc radiant/gtkdlgs.cpp index 5c16c706,57479b32..0a220606 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@@ -798,10 -838,11 +798,11 @@@ static void DoGtkTextEditor( const char g_object_set_data( G_OBJECT( text_editor ), "filename", strdup( filename ) ); // trying to show later - gtk_widget_show( text_editor ); + text_editor.show(); + gtk_window_present( GTK_WINDOW( text_editor ) ); -#ifdef WIN32 - process_gui(); +#if GDEF_OS_WINDOWS + ui::process(); #endif // only move the cursor if it's not exceeding the size.. diff --cc radiant/plugintoolbar.cpp index aea1b321,8fd420d7..6e24976d --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@@ -55,43 -65,39 +55,53 @@@ ui::Image new_plugin_image( const char return image_new_missing(); } -inline GtkToolbarChildType gtktoolbarchildtype_for_toolbarbuttontype( IToolbarButton::EType type ){ - switch ( type ) - { - case IToolbarButton::eSpace: - return GTK_TOOLBAR_CHILD_SPACE; - case IToolbarButton::eButton: - return GTK_TOOLBAR_CHILD_BUTTON; - case IToolbarButton::eToggleButton: - return GTK_TOOLBAR_CHILD_TOGGLEBUTTON; - case IToolbarButton::eRadioButton: - return GTK_TOOLBAR_CHILD_RADIOBUTTON; +void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){ + if (type == IToolbarButton::eSpace) { + auto it = ui::ToolItem::from(gtk_separator_tool_item_new()); + it.show(); + toolbar.add(it); + return; } - ERROR_MESSAGE( "invalid toolbar button type" ); - return (GtkToolbarChildType)0; -} - -void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GtkSignalFunc handler, gpointer data ){ - GtkWidget* widget = gtk_toolbar_append_element( toolbar, gtktoolbarchildtype_for_toolbarbuttontype( type ), 0, text, tooltip, "", GTK_WIDGET( new_plugin_image( icon ) ), handler, data ); - if( type != IToolbarButton::eSpace ){ ++ #define GARUX_DISABLE_SPACER_NOFOCUS ++ #ifndef GARUX_DISABLE_SPACER_NOFOCUS ++ else { + GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_FOCUS ); + GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_DEFAULT ); + } ++ #endif // GARUX_DISABLE_SPACER_NOFOCUS ++ + if (type == IToolbarButton::eButton) { + auto button = ui::ToolButton::from(gtk_tool_button_new(new_plugin_image(icon), text)); + gtk_widget_set_tooltip_text(button, tooltip); + gtk_widget_show_all(button); + button.connect("clicked", G_CALLBACK(handler), data); + toolbar.add(button); + return; + } ++ + if (type == IToolbarButton::eToggleButton) { + auto button = ui::ToolButton::from(gtk_toggle_tool_button_new()); + gtk_tool_button_set_icon_widget(button, new_plugin_image(icon)); + gtk_tool_button_set_label(button, text); + gtk_widget_set_tooltip_text(button, tooltip); + gtk_widget_show_all(button); + button.connect("toggled", G_CALLBACK(handler), data); + toolbar.add(button); + return; + } ++ + ERROR_MESSAGE( "invalid toolbar button type" ); } -void ActivateToolbarButton( GtkWidget *widget, gpointer data ){ - const_cast( reinterpret_cast( data ) )->activate(); +void ActivateToolbarButton( ui::ToolButton widget, gpointer data ){ + (const_cast( reinterpret_cast( data )))->activate(); } -void PlugInToolbar_AddButton( GtkToolbar* toolbar, const IToolbarButton* button ){ - toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), GTK_SIGNAL_FUNC( ActivateToolbarButton ), reinterpret_cast( const_cast( button ) ) ); +void PlugInToolbar_AddButton( ui::Toolbar toolbar, const IToolbarButton* button ){ + toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast( const_cast( button ) ) ); } -GtkToolbar* g_plugin_toolbar = 0; +ui::Toolbar g_plugin_toolbar{ui::null}; void PluginToolbar_populate(){ class AddToolbarItemVisitor : public ToolbarModules::Visitor diff --cc radiant/qe3.cpp index b0737521,82d5d855..efae51c4 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@@ -92,7 -83,7 +92,7 @@@ void QE_InitVFS() // if we have a mod dir if ( !string_equal( gamename, basegame ) ) { // ~/./ - if ( userRoot && !g_disableHomePath ) { - if ( userRoot && !string_equal( globalRoot, userRoot ) ) { ++ if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) { StringOutputStream userGamePath( 256 ); userGamePath << userRoot << gamename << '/'; GlobalFileSystem().initDirectory( userGamePath.c_str() ); @@@ -107,7 -98,7 +107,7 @@@ } // ~/./ - if ( userRoot && !g_disableHomePath ) { - if ( userRoot && !string_equal( globalRoot, userRoot ) ) { ++ if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) { StringOutputStream userBasePath( 256 ); userBasePath << userRoot << basegame << '/'; GlobalFileSystem().initDirectory( userBasePath.c_str() ); diff --cc radiant/texwindow.cpp index 6c17ba96,d18a152e..72573afe --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -1525,10 -1423,9 +1525,11 @@@ gboolean TextureBrowser_button_press( u } } } - else if ( event->type == GDK_2BUTTON_PRESS ) { + else if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) { + #define GARUX_DISABLE_2BUTTON + #ifndef GARUX_DISABLE_2BUTTON + CopiedString texName = textureBrowser->shader; - const char* sh = texName.c_str(); + const char* sh = textureBrowser->shader.c_str(); char* dir = strrchr( sh, '/' ); if( dir != NULL ){ *(dir + 1) = '\0'; @@@ -1542,9 -1440,8 +1544,9 @@@ } } } + #endif } - else if ( event->type == GDK_3BUTTON_PRESS ) { + else if ( event->type == GDK_2BUTTON_PRESS && event->button == 3 ) { ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getComonShadersDir(), "Loading Textures" ); TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() ); TextureBrowser_queueDraw( *textureBrowser );