main.c File Reference

Program startup. More...

Go to the source code of this file.

Data Structures

struct  MetaArguments
 The set of possible options that can be set on Metacity's command line. More...

Defines

#define _GNU_SOURCE
#define _SVID_SOURCE

Functions

static void prefs_changed_callback (MetaPreference pref, gpointer data)
 Called on pref changes.
static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
 Prints log messages.
static void version (void)
 Prints the version notice.
static void meta_print_compilation_info (void)
 Prints a list of which configure script options were used to build this copy of Metacity.
static void meta_print_self_identity (void)
 Prints the version number, the current timestamp (not the build date), the locale, the character encoding, and a list of configure script options that were used to build this copy of Metacity.
static void meta_parse_options (int *argc, char ***argv, MetaArguments *meta_args)
 Parses argc and argv and returns the arguments that Metacity understands in meta_args.
static void meta_select_display (gchar *display_name)
 Selects which display Metacity should use.
int main (int argc, char **argv)
 This is where the story begins.
void meta_quit (MetaExitCode code)
 Stops Metacity.
void meta_restart (void)
 Restarts Metacity.

Variables

static MetaExitCode meta_exit_code = META_EXIT_SUCCESS
 The exit code we'll return to our parent process when we eventually die.
static GMainLoop * meta_main_loop = NULL
 Handle on the main loop, so that we have an easy way of shutting Metacity down.
static gboolean meta_restart_after_quit = FALSE
 If set, Metacity will spawn an identical copy of itself immediately before quitting.


Detailed Description

Program startup.

Functions which parse the command-line arguments, create the display, kick everything off and then close down Metacity when it's time to go.

Definition in file main.c.


Define Documentation

#define _GNU_SOURCE

Definition at line 44 of file main.c.

#define _SVID_SOURCE

Definition at line 45 of file main.c.


Function Documentation

static void log_handler ( const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data 
) [static]

Prints log messages.

If Metacity was compiled with backtrace support, also prints a backtrace (see meta_print_backtrace()).

Parameters:
log_domain the domain the error occurred in (we ignore this)
log_level the log level so that we can filter out less important messages
message the message to log
user_data arbitrary data (we ignore this)

Definition at line 100 of file main.c.

References meta_print_backtrace(), and meta_warning().

Referenced by main().

int main ( int  argc,
char **  argv 
)

static void meta_parse_options ( int *  argc,
char ***  argv,
MetaArguments meta_args 
) [static]

Parses argc and argv and returns the arguments that Metacity understands in meta_args.

The strange call signature has to be written like it is so that g_option_context_parse() gets a chance to modify argc and argv.

Parameters:
argc Pointer to the number of arguments Metacity was given
argv Pointer to the array of arguments Metacity was given
meta_args The result of parsing the arguments.

Definition at line 235 of file main.c.

References MetaArguments::client_id, MetaArguments::disable_sm, MetaArguments::display_name, FALSE, N_, NULL, options, MetaArguments::print_version, MetaArguments::replace_wm, MetaArguments::save_file, and MetaArguments::sync.

Referenced by main().

static void meta_print_compilation_info ( void   )  [static]

Prints a list of which configure script options were used to build this copy of Metacity.

This is actually always called on startup, but it's all no-op unless we're in verbose mode (see meta_set_verbose).

Definition at line 131 of file main.c.

References META_DEBUG_XINERAMA.

Referenced by meta_print_self_identity().

static void meta_print_self_identity ( void   )  [static]

Prints the version number, the current timestamp (not the build date), the locale, the character encoding, and a list of configure script options that were used to build this copy of Metacity.

This is actually always called on startup, but it's all no-op unless we're in verbose mode (see meta_set_verbose).

Definition at line 184 of file main.c.

References meta_print_compilation_info(), and NULL.

Referenced by main().

void meta_quit ( MetaExitCode  code  ) 

Stops Metacity.

This tells the event loop to stop processing; it is rather dangerous to use this rather than meta_restart() because this will leave the user with no window manager. We generally do this only if, for example, the session manager asks us to; we assume the session manager knows what it's talking about.

Parameters:
code The success or failure code to return to the calling process.

Definition at line 521 of file main.c.

References meta_exit_code, and meta_main_loop.

Referenced by die_callback(), meta_display_close(), and meta_restart().

void meta_restart ( void   ) 

Restarts Metacity.

In practice, this tells the event loop to stop processing, having first set the meta_restart_after_quit flag which tells Metacity to spawn an identical copy of itself before quitting. This happens on receipt of a _METACITY_RESTART_MESSAGE client event.

Definition at line 536 of file main.c.

References META_EXIT_SUCCESS, meta_quit(), meta_restart_after_quit, and TRUE.

Referenced by event_callback().

static void meta_select_display ( gchar *  display_name  )  [static]

Selects which display Metacity should use.

It first tries to use display_name as the display. If display_name is NULL then try to use the environment variable METACITY_DISPLAY. If that also is NULL, use the default - :0.0

Definition at line 305 of file main.c.

References NULL.

Referenced by main().

static void prefs_changed_callback ( MetaPreference  pref,
gpointer  data 
) [static]

Called on pref changes.

(One of several functions of its kind and purpose.)

Bug:
Why are these particular prefs handled in main.c and not others? Should they be?
Parameters:
pref Which preference has changed
data Arbitrary data (which we ignore)

Definition at line 552 of file main.c.

References FALSE, meta_display_retheme_all(), meta_display_set_cursor_theme(), META_PREF_CURSOR_SIZE, META_PREF_CURSOR_THEME, META_PREF_THEME, meta_prefs_get_cursor_size(), meta_prefs_get_cursor_theme(), meta_prefs_get_theme(), and meta_ui_set_current_theme().

static void version ( void   )  [static]

Prints the version notice.

This is shown when Metacity is called with the --version switch.

Definition at line 114 of file main.c.

References _.

Referenced by main(), and meta_theme_load().


Variable Documentation

MetaExitCode meta_exit_code = META_EXIT_SUCCESS [static]

The exit code we'll return to our parent process when we eventually die.

Definition at line 72 of file main.c.

Referenced by main(), and meta_quit().

GMainLoop* meta_main_loop = NULL [static]

Handle on the main loop, so that we have an easy way of shutting Metacity down.

Definition at line 78 of file main.c.

Referenced by main(), and meta_quit().

gboolean meta_restart_after_quit = FALSE [static]

If set, Metacity will spawn an identical copy of itself immediately before quitting.

Definition at line 84 of file main.c.

Referenced by main(), and meta_restart().


Generated on Sat Aug 23 22:04:21 2008 for metacity by  doxygen 1.5.5