SaveCommandMap( path.c_str() );
}
+ void add_local_rc_files(){
+ #define GARUX_DISABLE_GTKTHEME
+ #ifndef GARUX_DISABLE_GTKTHEME
+ /* FIXME: HACK: not GTK3 compatible
+ https://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html#gtk-rc-add-default-file
+ https://developer.gnome.org/gtk3/stable/gtk3-Resource-Files.html#gtk-rc-add-default-file
+ > gtk_rc_add_default_file has been deprecated since version 3.0 and should not be used in newly-written code.
+ > Use GtkStyleContext with a custom GtkStyleProvider instead
+ */
+
+ {
+ StringOutputStream path( 512 );
+ path << AppPath_get() << ".gtkrc-2.0.radiant";
+ gtk_rc_add_default_file( path.c_str() );
+ }
+ #ifdef WIN32
+ {
+ StringOutputStream path( 512 );
+ path << AppPath_get() << ".gtkrc-2.0.win";
+ gtk_rc_add_default_file( path.c_str() );
+ }
+ #endif
+ #endif // GARUX_DISABLE_GTKTHEME
+ }
+
+/* HACK: If ui::main is not called yet,
+gtk_main_quit will not quit, so tell main
+to not call ui::main. This happens when a
+map is loaded from command line and require
+a restart because of wrong format.
+Delete this when the code to not have to
+restart to load another format is merged. */
+bool g_dontStart = false;
+
int main( int argc, char* argv[] ){
+#if GTK_TARGET == 3
+ // HACK: force legacy GL backend as we don't support GL3 yet
+ setenv("GDK_GL", "LEGACY", 0);
+#if GDEF_OS_LINUX || GDEF_OS_BSD
+ setenv("GDK_BACKEND", "x11", 0);
+#endif
+#endif // GTK_TARGET == 3
crt_init();
streams_init();
}
// Gtk already removed parsed `--options`
- if ( argc == 2 ) {
- if ( strlen( argv[ 1 ] ) > 1 ) {
- mapname = argv[ 1 ];
+ if (argc == 2) {
+ if ( strlen( argv[1] ) > 1 ) {
- if ( g_str_has_suffix( argv[1], ".map" ) ) {
- if ( g_path_is_absolute( argv[1] ) ) {
+ mapname = argv[1];
+
+ if ( g_str_has_suffix( mapname, ".map" ) ) {
+ if ( !g_path_is_absolute( mapname ) ) {
+ mapname = g_build_filename( g_get_current_dir(), mapname, NULL );
}
- else {
- mapname = g_build_filename( g_get_current_dir(), argv[1], NULL );
- }
+
+#if GDEF_OS_WINDOWS
+ mapname_buffer << PathCleaned( mapname );
+ mapname = mapname_buffer.c_str();
+#endif
}
else {
- g_print( "bad file name, will not load: %s\n", argv[1] );
+ g_print( "bad file name, will not load: %s\n", mapname );
+ mapname = NULL;
}
}
}
paths_init();
- if ( !check_version() ) {
- return EXIT_FAILURE;
- }
-
+ add_local_rc_files();
+
show_splash();
create_global_pid();
remove_local_pid();
- ui::main();
+ /* HACK: If ui::main is not called yet,
+ gtk_main_quit will not quit, so tell main
+ to not call ui::main. This happens when a
+ map is loaded from command line and require
+ a restart because of wrong format.
+ Delete this when the code to not have to
+ restart to load another format is merged. */
+ if ( !g_dontStart )
+ {
+ ui::main();
+ }
// avoid saving prefs when the app is minimized
if ( g_pParentWnd->IsSleeping() ) {
#include "texwindow.h"
#include "filterbar.h"
-
+#if GDEF_OS_WINDOWS
+#include <process.h>
+#else
+#include <spawn.h>
+#endif
+
+#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
+
+ #define GARUX_DISABLE_GTKTHEME
+ #ifndef GARUX_DISABLE_GTKTHEME
+ #include "gtktheme.h"
+ #endif
+
struct layout_globals_t
{
WindowPosition m_position;
create_menu_item_with_mnemonic( menu_3, "Q3Radiant Original", "ColorSchemeQER" );
create_menu_item_with_mnemonic( menu_3, "Black and Green", "ColorSchemeBlackAndGreen" );
create_menu_item_with_mnemonic( menu_3, "Maya/Max/Lightwave Emulation", "ColorSchemeYdnar" );
+ create_menu_item_with_mnemonic(menu_3, "Adwaita Dark", "ColorSchemeAdwaitaDark");
+ #ifndef GARUX_DISABLE_GTKTHEME
+ create_menu_item_with_mnemonic( menu_in_menu, "GTK Theme...", "gtkThemeDlg" );
+ #endif
+
menu_separator( menu_in_menu );
create_menu_item_with_mnemonic( menu_in_menu, "_Texture Background...", "ChooseTextureBackgroundColor" );