< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.c

Print this page




  28 #include "gtk_interface.h"
  29 
  30 GtkApi* gtk2_load(JNIEnv *env, const char* lib_name);
  31 GtkApi* gtk3_load(JNIEnv *env, const char* lib_name);
  32 
  33 gboolean gtk2_check(const char* lib_name, gboolean load);
  34 gboolean gtk3_check(const char* lib_name, gboolean load);
  35 
  36 GtkApi *gtk;
  37 
  38 typedef struct {
  39     GtkVersion version;
  40     const char* name;
  41     const char* vname;
  42     GtkApi* (*load)(JNIEnv *env, const char* lib_name);
  43     gboolean (*check)(const char* lib_name, gboolean load);
  44 } GtkLib;
  45 
  46 static GtkLib gtk_libs[] = {
  47     {
  48         GTK_2,
  49         JNI_LIB_NAME("gtk-x11-2.0"),
  50         VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0"),
  51         &gtk2_load,
  52         &gtk2_check
  53     },
  54     {
  55         GTK_3,
  56         JNI_LIB_NAME("gtk-3"),
  57         VERSIONED_JNI_LIB_NAME("gtk-3", "0"),
  58         &gtk3_load,
  59         &gtk3_check







  60     }
  61 };
  62 
  63 static GtkLib** get_libs_order(GtkVersion version) {
  64     static GtkLib** load_order;
  65     static int n_libs = 0;
  66     if (!n_libs) {
  67         n_libs = sizeof(gtk_libs) / sizeof(GtkLib);
  68         load_order = calloc(n_libs + 1, sizeof(GtkLib *));
  69     }
  70     int i, first = 0;
  71     for (i = 0; i < n_libs; i++) {
  72         load_order[i] = &gtk_libs[i];
  73         if (load_order[i]->version == version) {
  74             first = i;
  75         }
  76     }
  77     if (first) {
  78         for (i = first; i > 0; i--) {
  79             load_order[i] = load_order[i - 1];




  28 #include "gtk_interface.h"
  29 
  30 GtkApi* gtk2_load(JNIEnv *env, const char* lib_name);
  31 GtkApi* gtk3_load(JNIEnv *env, const char* lib_name);
  32 
  33 gboolean gtk2_check(const char* lib_name, gboolean load);
  34 gboolean gtk3_check(const char* lib_name, gboolean load);
  35 
  36 GtkApi *gtk;
  37 
  38 typedef struct {
  39     GtkVersion version;
  40     const char* name;
  41     const char* vname;
  42     GtkApi* (*load)(JNIEnv *env, const char* lib_name);
  43     gboolean (*check)(const char* lib_name, gboolean load);
  44 } GtkLib;
  45 
  46 static GtkLib gtk_libs[] = {
  47     {







  48         GTK_3,
  49         JNI_LIB_NAME("gtk-3"),
  50         VERSIONED_JNI_LIB_NAME("gtk-3", "0"),
  51         &gtk3_load,
  52         &gtk3_check
  53     },
  54     {
  55         GTK_2,
  56         JNI_LIB_NAME("gtk-x11-2.0"),
  57         VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0"),
  58         &gtk2_load,
  59         &gtk2_check
  60     }
  61 };
  62 
  63 static GtkLib** get_libs_order(GtkVersion version) {
  64     static GtkLib** load_order;
  65     static int n_libs = 0;
  66     if (!n_libs) {
  67         n_libs = sizeof(gtk_libs) / sizeof(GtkLib);
  68         load_order = calloc(n_libs + 1, sizeof(GtkLib *));
  69     }
  70     int i, first = 0;
  71     for (i = 0; i < n_libs; i++) {
  72         load_order[i] = &gtk_libs[i];
  73         if (load_order[i]->version == version) {
  74             first = i;
  75         }
  76     }
  77     if (first) {
  78         for (i = first; i > 0; i--) {
  79             load_order[i] = load_order[i - 1];


< prev index next >