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
if ( lib != 0 ) {
void ( WINAPI *qDwmEnableComposition )( bool bEnable ) = ( void (WINAPI *) ( bool bEnable ) )GetProcAddress( lib, "DwmEnableComposition" );
if ( qDwmEnableComposition ) {
- qDwmEnableComposition( FALSE );
+ bool Aero = false;
+ for ( int i = 1; i < argc; ++i ){
+ if ( !stricmp( argv[i], "-aero" ) ){
+ Aero = true;
+ qDwmEnableComposition( TRUE );
+ break;
+ }
+ }
+ // disable Aero
+ if ( !Aero ){
+ qDwmEnableComposition( FALSE );
+ }
}
FreeLibrary( lib );
}
+ _setmaxstdio(2048);
#endif
const char* mapname = NULL;
}
// Gtk already removed parsed `--options`
- if ( argc == 2 ) {
- if ( strlen( argv[ 1 ] ) > 1 ) {
- mapname = argv[ 1 ];
+ if (argc == 2) {
+ if ( strlen( argv[1] ) > 1 ) {
+ mapname = argv[1];
if ( g_str_has_suffix( mapname, ".map" ) ) {
if ( !g_path_is_absolute( mapname ) ) {
}
}
}
- else if ( argc > 2 ) {
+ else if (argc > 2) {
g_print ( "%s\n", "too many arguments" );
return -1;
}
paths_init();
+ add_local_rc_files();
+
show_splash();
create_global_pid();
hide_splash();
- if ( mapname != NULL ) {
+ if( openCmdMap && *openCmdMap ){
+ Map_LoadFile( openCmdMap );
+ }
+ else if ( mapname != NULL ) {
Map_LoadFile( mapname );
}
else if ( g_bLoadLastMap && !g_strLastMap.empty() ) {
remove_local_pid();
+ /* 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() ) {