GSK Reference Manual | ||||
---|---|---|---|---|
Library InitializationLibrary Initialization — Perform general initialization with limited argument parsing. |
GskInitInfo; void gsk_init_info_get_defaults (GskInitInfo *info); void gsk_init (int *argc, char ***argv, GskInitInfo *info); void gsk_init_without_threads (int *argc, char ***argv); #define gsk_init_get_support_threads () void gsk_init_info_parse_args (GskInitInfo *in_out, int *argc, char ***argv); void gsk_init_raw (GskInitInfo *info); enum _GskInitFlags; extern _GskInitFlags gsk_init_flags; extern gpointer gsk_main_thread;
Almost always one run gsk_init()
at the top of main and forgets about it.
But sometimes you wish to separate the parsing and the initialization
so these routines give you more fine-grained control,
by separating the parsing into gsk_init_info_parse_args()
and
the real initialization into gsk_init_raw()
.
typedef struct { char *prgname; guint needs_threads : 1; } GskInitInfo;
Information about how to initialize GSK.
char *prgname ; |
The name of the program, may be NULL. |
guint needs_threads : 1; |
Whether the program needs threads. True by default. |
void gsk_init_info_get_defaults (GskInitInfo *info);
Obtain the default initialization information.
This should be run before gsk_init()
or gsk_init_info_parse_args()
.
This API has been deprecated for public use, because it doesn't allow us to expand GskInitInfo without breaking binary-compatibility.
Use gsk_init_info_new()
instead.
info : |
the GskInitInfo to fill. |
void gsk_init (int *argc, char ***argv, GskInitInfo *info);
Initialize the GSK library.
argc : |
a reference to main() 's argc;
this will be decreased if arguments are parsed
out of the argument array.
|
argv : |
a reference to main() 's argc;
this may have arguments removed.
|
info : |
the GskInitInfo to use as hints, which will be filled with the actual initialization information used. If NULL, default initialization parameters will be used. |
void gsk_init_without_threads (int *argc, char ***argv);
Initialize the GSK library indicating that you will not use threads.
argc : |
a reference to main() 's argc;
this will be decreased if arguments are parsed
out of the argument array.
|
argv : |
a reference to main() 's argc;
this may have arguments removed.
|
#define gsk_init_get_support_threads() ((gsk_init_flags & _GSK_INIT_SUPPORT_THREADS) == _GSK_INIT_SUPPORT_THREADS)
Ascertain whether thread support is necessary.
void gsk_init_info_parse_args (GskInitInfo *in_out, int *argc, char ***argv);
Parse/modify arguments and return their values in in_out
.
The only currently supported argument is --gsk-debug=FLAGS.
in_out : |
the GskInitInfo to fill. |
argc : |
the argument count (may be modified) |
argv : |
the arguments (may be modified) |
void gsk_init_raw (GskInitInfo *info);
Initialize GSK.
info : |
information to use for initializing. |