/[svn]/gigedit/trunk/src/gigedit/main.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1322 by schoenebeck, Tue Sep 4 11:04:56 2007 UTC revision 3364 by schoenebeck, Tue Nov 14 18:07:25 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006 - 2017 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20    #include "global.h"
21    #include <gtk/gtk.h>
22  #include "gigedit.h"  #include "gigedit.h"
23    #ifdef GTKMM_HEADER_FILE
24    # include GTKMM_HEADER_FILE(gtkmm.h)
25    #else
26    # include <gtkmm.h>
27    #endif
28    
29    #if GTKMM_MAJOR_VERSION >= 3
30    
31    /**
32     * This is required since GTK 3, because those GTK super heros came up with
33     * the clever idea to simply disable things like icons and keyboard shortcuts
34     * for menus and for buttons by default for all users, all devices and all
35     * apps. Yey! Seriously, I have no idea what came on their mind to find that
36     * was a good idea!
37     */
38    static void enforceGtk3Settings(int argc, char* argv[]) {
39    #if GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && (GTK_MINOR_VERSION > 89) || (GTK_MINOR_VERSION == 89 && GTK_MICRO_VERSION >= 3)) // GTK >= 3.89.3
40        gtk_init();
41    #else
42        gtk_init(&argc, &argv);
43    #endif
44    
45        // got no behavior change on those 2 settings, so ignoring them for now,
46        // actually I though I could use them to show the mnemonics in the GTK 3
47        // menus again, but it seems that was entirely removed from around GTK 3.10.
48        //g_object_set(gtk_settings_get_default(), "gtk-auto-mnemonics", false, NULL);
49        //g_object_set(gtk_settings_get_default(), "gtk-can-change-accels", true, NULL);
50    
51        // bring back keyboard accelerators with GTK 3
52        g_object_set(gtk_settings_get_default(), "gtk-enable-accels", true, NULL);
53        g_object_set(gtk_settings_get_default(), "gtk-enable-mnemonics", true, NULL);
54    
55        // bring back icons with GTK 3
56        g_object_set(gtk_settings_get_default(), "gtk-menu-images", true, NULL);
57        g_object_set(gtk_settings_get_default(), "gtk-button-images", true, NULL);
58    
59        // who knows ... one day those GTK "masterminds" decide to disable tooltips by default as well
60        g_object_set(gtk_settings_get_default(), "gtk-enable-tooltips", true, NULL);
61    }
62    
63    #endif // GTKM 3
64    
65    #if defined(WIN32)
66    #include <windows.h>
67    
68    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
69        LPSTR lpCmdLine, int nCmdShow)
70    {
71        #if GTKMM_MAJOR_VERSION >= 3
72        enforceGtk3Settings(__argc, __argv);
73        #endif
74    
75        GigEdit app;
76        return app.run(__argc, __argv);
77    }
78    
79    #else
80    
81  int main(int argc, char* argv[])  int main(int argc, char* argv[])
82  {  {
83        #if GTKMM_MAJOR_VERSION >= 3
84        enforceGtk3Settings(argc, argv);
85        #endif
86    
87    #ifdef __APPLE__
88        // remove the argument added by the OS
89        if (argc > 1 && strncmp(argv[1], "-psn", 4) == 0) {
90            argc--;
91            for (int i = 1 ; i < argc ; i++) {
92                argv[i] = argv[i + 1];
93            }
94        }
95    #endif
96      GigEdit app;      GigEdit app;
97      return (argc >= 2) ? app.run(argv[1])      return app.run(argc, argv);
                        : app.run();  
98  }  }
99    
100    #endif

Legend:
Removed from v.1322  
changed lines
  Added in v.3364

  ViewVC Help
Powered by ViewVC