|
marco 1.29.1
Window manager
|
Program startup. More...
#include <config.h>#include <glib/gi18n-lib.h>#include "main.h"#include "util.h"#include "display-private.h"#include "errors.h"#include "keybindings.h"#include "ui.h"#include "session.h"#include "prefs.h"#include "core.h"#include <glib-object.h>#include <glib/gprintf.h>#include <stdlib.h>#include <sys/types.h>#include <sys/wait.h>#include <stdio.h>#include <string.h>#include <signal.h>#include <unistd.h>#include <errno.h>#include <fcntl.h>#include <locale.h>#include <time.h>Data Structures | |
| struct | MetaArguments |
| The set of possible options that can be set on Marco's command line. More... | |
Macros | |
| #define | _GNU_SOURCE |
| #define | _XOPEN_SOURCE /* for putenv() and some signal-related functions */ |
| #define | COMPOSITE_OPTS_FLAGS G_OPTION_FLAG_HIDDEN |
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 | meta_print_compilation_info (void) |
| Prints a list of which configure script options were used to build this copy of Marco. | |
| 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 Marco. | |
| static void | meta_parse_options (int *argc, char ***argv, MetaArguments *meta_args) |
| Parses argc and argv and returns the arguments that Marco understands in meta_args. | |
| static void | meta_select_display (gchar *display_name) |
| Selects which display Marco should use. | |
| static void | meta_finalize (void) |
| static void | sigterm_handler (int signum) |
| static gboolean | on_sigterm (GIOChannel *source, GIOCondition condition, gpointer user_data) |
| int | main (int argc, char **argv) |
| This is where the story begins. | |
| void | meta_quit (MetaExitCode code) |
| Stops Marco. | |
| void | meta_restart (void) |
| Restarts Marco. | |
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 Marco down. | |
| static gboolean | meta_restart_after_quit = FALSE |
| If set, Marco will spawn an identical copy of itself immediately before quitting. | |
| static int | sigterm_pipe_fds [2] = { -1, -1 } |
Program startup.
Functions which parse the command-line arguments, create the display, kick everything off and then close down Marco when it's time to go.
| #define _GNU_SOURCE |
| #define _XOPEN_SOURCE /* for putenv() and some signal-related functions */ |
| #define COMPOSITE_OPTS_FLAGS G_OPTION_FLAG_HIDDEN |
|
static |
Prints log messages.
If Marco was compiled with backtrace support, also prints a backtrace (see meta_print_backtrace()).
| 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) |
References meta_print_backtrace(), and meta_warning().
Referenced by main().
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
This is where the story begins.
It parses commandline options and environment variables, sets up the screen, hands control off to GTK, and cleans up afterwards.
| argc | Number of arguments (as usual) |
| argv | Array of arguments (as usual) |
References _, MetaArguments::client_id, MetaArguments::composite, MetaArguments::disable_sm, MetaArguments::display_name, FALSE, log_handler(), meta_display_open(), meta_exit(), meta_exit_code, META_EXIT_ERROR, meta_fatal(), meta_finalize(), meta_main_loop, meta_parse_options(), meta_prefs_add_listener(), meta_prefs_get_theme(), meta_prefs_init(), meta_prefs_set_force_compositing_manager(), meta_prefs_set_force_fullscreen(), meta_print_self_identity(), meta_restart_after_quit, meta_select_display(), meta_session_init(), meta_set_debugging(), meta_set_keybindings_disabled(), meta_set_replace_current_wm(), meta_set_syncing(), meta_set_verbose(), meta_ui_have_a_theme(), meta_ui_init(), meta_ui_set_current_theme(), meta_warning(), MetaArguments::no_composite, MetaArguments::no_force_fullscreen, MetaArguments::no_keybindings, NULL, on_sigterm(), prefs_changed_callback(), MetaArguments::print_version, MetaArguments::replace_wm, MetaArguments::save_file, sigterm_handler(), sigterm_pipe_fds, MetaArguments::sync, and TRUE.
|
static |
References meta_display_close(), meta_get_display(), and meta_session_shutdown().
Referenced by main().
|
static |
Parses argc and argv and returns the arguments that Marco 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.
| argc | Pointer to the number of arguments Marco was given |
| argv | Pointer to the array of arguments Marco was given |
| meta_args | The result of parsing the arguments. |
References MetaArguments::client_id, MetaArguments::composite, COMPOSITE_OPTS_FLAGS, MetaArguments::disable_sm, MetaArguments::display_name, FALSE, MetaArguments::no_composite, MetaArguments::no_force_fullscreen, MetaArguments::no_keybindings, NULL, MetaArguments::print_version, MetaArguments::replace_wm, MetaArguments::save_file, and MetaArguments::sync.
Referenced by main().
|
static |
Prints a list of which configure script options were used to build this copy of Marco.
This is actually always called on startup, but it's all no-op unless we're in verbose mode (see meta_set_verbose).
References META_DEBUG_XINERAMA.
Referenced by meta_print_self_identity().
|
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 Marco.
This is actually always called on startup, but it's all no-op unless we're in verbose mode (see meta_set_verbose).
References meta_print_compilation_info(), and NULL.
Referenced by main().
| void meta_quit | ( | MetaExitCode | code | ) |
Stops Marco.
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.
| code | The success or failure code to return to the calling process. |
References meta_exit_code, and meta_main_loop.
Referenced by meta_display_close(), meta_restart(), and on_sigterm().
| void meta_restart | ( | void | ) |
Restarts Marco.
In practice, this tells the event loop to stop processing, having first set the meta_restart_after_quit flag which tells Marco to spawn an identical copy of itself before quitting. This happens on receipt of a _MARCO_RESTART_MESSAGE client event.
References META_EXIT_SUCCESS, meta_quit(), meta_restart_after_quit, and TRUE.
Referenced by event_callback().
|
static |
|
static |
References FALSE, META_EXIT_SUCCESS, and meta_quit().
Referenced by main().
|
static |
Called on pref changes.
(One of several functions of its kind and purpose.)
| pref | Which preference has changed |
| data | Arbitrary data (which we ignore) |
References FALSE, meta_display_retheme_all(), meta_display_set_cursor_theme(), meta_invalidate_all_icons(), META_PREF_CURSOR_SIZE, META_PREF_CURSOR_THEME, META_PREF_ICON_SIZE, META_PREF_THEME, meta_prefs_get_cursor_size(), meta_prefs_get_cursor_theme(), meta_prefs_get_theme(), and meta_ui_set_current_theme().
Referenced by main().
|
static |
References sigterm_pipe_fds.
Referenced by main().
|
static |
The exit code we'll return to our parent process when we eventually die.
Referenced by main(), and meta_quit().
|
static |
Handle on the main loop, so that we have an easy way of shutting Marco down.
Referenced by main(), and meta_quit().
|
static |
If set, Marco will spawn an identical copy of itself immediately before quitting.
Referenced by main(), and meta_restart().
|
static |
Referenced by main(), and sigterm_handler().