summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog34
-rw-r--r--acconfig.h19
-rwxr-xr-xautogen.sh1
-rw-r--r--configure.in111
-rw-r--r--src/delete.c4
-rw-r--r--src/display.c10
-rw-r--r--src/display.h1
-rw-r--r--src/prefs.c80
-rw-r--r--src/tools/metacity-message.c48
-rw-r--r--src/util.c23
-rw-r--r--src/util.h41
-rw-r--r--src/window.c2
-rw-r--r--src/workspace.c4
13 files changed, 309 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index b843114..d96f45b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,39 @@
2002-12-08 Havoc Pennington <hp@pobox.com>
+ * src/prefs.c (meta_prefs_get_application_based): make this always
+ return FALSE for now, to avoid bug reports.
+
+ * src/util.c (ensure_logfile): put "opened log file" message on
+ stderr so it will normally land in ~/.xsession-errors
+
+ * configure.in: remove extra AC_ARG_PROGRAM
+
+ * src/display.c (event_callback): handle the toggle-verbose message
+
+ * src/tools/metacity-message.c: add a toggle-verbose message, been
+ meaning to do this for a while.
+
+ * src/util.c (meta_set_verbose): if verbose mode is enabled and we
+ don't support it, then exit.
+
+ * src/prefs.c: allow building without gconf (currently means some
+ prefs are no-ops)
+
+ * src/util.c, src/util.h: support defining macros to
+ kill all verbose output entirely. (Removes the code and strings
+ associated with it)
+
+ * configure.in: don't get METACITY_PROPS_LIBS if not building the
+ config dialog.
+ (HAVE_GCONF): allow building sans gconf, if you are size-sensitive
+ and not using gnome.
+ (WITH_VERBOSE_MODE): add ability to disable all the verbose debug
+ spew strings, to shrink the binary.
+ (--disable-sm): allow SM support to be forced on or off
+ (--disable-startup-notification): allow forcing this on or off
+
+2002-12-08 Havoc Pennington <hp@pobox.com>
+
* src/prefs.c (update_workspace_name): also treat empty string as
"unset" in this function.
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index 7cf408a..0000000
--- a/acconfig.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#undef PACKAGE
-#undef VERSION
-#undef HAVE_CATGETS
-#undef HAVE_GETTEXT
-#undef HAVE_LC_MESSAGES
-#undef HAVE_STPCPY
-#undef ENABLE_NLS
-#undef HAVE_PTHREAD_H
-#undef GETTEXT_PACKAGE
-#undef HAVE_SHAPE_EXT
-#undef HAVE_XFT
-#undef HAVE_SM
-#undef HAVE_XINERAMA
-#undef HAVE_SOLARIS_XINERAMA
-#undef HAVE_XFREE_XINERAMA
-#undef HAVE_SHAPE
-#undef HAVE_RANDR
-#undef HAVE_STARTUP_NOTIFICATION
-
diff --git a/autogen.sh b/autogen.sh
index 35e63cc..ca19b07 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -46,6 +46,7 @@ ACLOCAL=aclocal-1.4
}
}
+CONFIGURE=configure.in
if grep "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
GETTEXTIZE=""
diff --git a/configure.in b/configure.in
index b361af5..d18f6fc 100644
--- a/configure.in
+++ b/configure.in
@@ -11,7 +11,7 @@ ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
GETTEXT_PACKAGE=metacity
AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Name of default gettext domain])
AM_MAINTAINER_MODE
@@ -19,7 +19,6 @@ AC_PROG_INTLTOOL([0.21])
AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
-AC_ARG_PROGRAM
AM_PROG_LIBTOOL
changequote(,)dnl
@@ -83,6 +82,8 @@ if test "x$GCC" = "xyes"; then
fi
changequote([,])dnl
+METACITY_PC_MODULES='gtk+-2.0 >= 2.0.0'
+
AC_ARG_ENABLE(config-dialog, [ --enable-config-dialog enable the config dialog that you need with GNOME 2.0 (obsolete with GNOME 2.2)],enable_config_dialog=yes,enable_config_dialog=no)
AM_CONDITIONAL(BUILD_CONFIG_DIALOG, test x$enable_config_dialog = xyes)
@@ -90,30 +91,65 @@ if test x$enable_config_dialog = xyes; then
AC_DEFINE(BUILD_CONFIG_DIALOG,1,[Build configuration dialog])
fi
+AC_ARG_ENABLE(gconf, [ --disable-gconf disable gconf usage, for embedded/size-sensitive non-GNOME builds],enable_gconf=no,enable_gconf=yes)
+
+if test x$enable_gconf = xyes; then
+ AC_DEFINE(HAVE_GCONF,1,[Build with gconf support])
+ METACITY_PC_MODULES="$METACITY_PC_MODULES gconf-2.0 >= 1.2.0"
+fi
+
+AC_ARG_ENABLE(verbose-mode, [ --disable-verbose disable metacity's ability to do verbose logging, for embedded/size-sensitive custom builds],enable_verbose_mode=no,enable_verbose_mode=yes)
+
+if test x$enable_verbose_mode = xyes; then
+ AC_DEFINE(WITH_VERBOSE_MODE,1,[Build with verbose mode support])
+fi
+
+AC_ARG_ENABLE(sm, [ --disable-sm disable metacity's session management support, for embedded/size-sensitive custom non-GNOME builds],enable_sm=no,enable_sm=auto)
+
+AC_ARG_ENABLE(startup-notification, [ --disable-startup-notification disable metacity's startup notification support, for embedded/size-sensitive custom non-GNOME builds],enable_startup_notification=no,enable_startup_notification=auto)
+
## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
-
ALL_LINGUAS="az ca cs da de el es fr gl hu it ja ko lv ms no pl pt pt_BR ro ru sk sv tr uk vi zh_CN zh_TW"
AM_GLIB_GNU_GETTEXT
## here we get the flags we'll actually use
PKG_CHECK_MODULES(METACITY_MESSAGE, gtk+-2.0 >= 2.0.0)
PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 2.0.0)
-PKG_CHECK_MODULES(METACITY_PROPS, gtk+-2.0 >= 2.0.0 gconf-2.0 >= 1.1.9 libglade-2.0)
+
+if test x$enable_config_dialog = xyes; then
+ PKG_CHECK_MODULES(METACITY_PROPS, gtk+-2.0 >= 2.0.0 gconf-2.0 >= 1.1.9 libglade-2.0)
+fi
STARTUP_NOTIFICATION_VERSION=0.4
+AC_MSG_CHECKING([Startup notification library >= $STARTUP_NOTIFICATION_VERSION])
if $PKG_CONFIG --atleast-version $STARTUP_NOTIFICATION_VERSION libstartup-notification-1.0; then
+ have_startup_notification=yes
+else
+ have_startup_notification=no
+fi
+AC_MSG_RESULT($have_startup_notification)
+
+if test x$enable_startup_notification = xyes; then
+ have_startup_notification=yes
+ echo "startup-notification support forced on"
+elif test x$enable_startup_notification = xauto; then
+ true
+else
+ have_startup_notification=no
+fi
+
+if test x$have_startup_notification = xyes; then
echo "Building with libstartup-notification"
- PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 2.0.0 gconf-2.0 >= 1.1.9 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION)
- AC_DEFINE(HAVE_STARTUP_NOTIFICATION)
- with_startup_notification=yes
+ METACITY_PC_MODULES="$METACITY_PC_MODULES libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION"
+ AC_DEFINE(HAVE_STARTUP_NOTIFICATION, , [Building with startup notification support])
else
echo "Building without libstartup-notification"
- PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 2.0.0 gconf-2.0 >= 1.1.9)
- with_startup_notification=no
fi
+PKG_CHECK_MODULES(METACITY, $METACITY_PC_MODULES)
+
if $PKG_CONFIG --atleast-version 2.1.0 gtk+-2.0; then
AC_DEFINE(HAVE_GTK_MULTIHEAD,,[gtk+ with multihead support found])
with_multihead=yes
@@ -143,8 +179,8 @@ case "$host" in
if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
fi
- AC_DEFINE(HAVE_SOLARIS_XINERAMA)
- AC_DEFINE(HAVE_XINERAMA),
+ AC_DEFINE(HAVE_SOLARIS_XINERAMA, , [Have Solaris-style Xinerama])
+ AC_DEFINE(HAVE_XINERAMA, , [Have some version of Xinerama]),
use_solaris_xinerama=no,
[#include <X11/Xlib.h>])
fi
@@ -160,8 +196,8 @@ case "$host" in
if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
fi
- AC_DEFINE(HAVE_XFREE_XINERAMA)
- AC_DEFINE(HAVE_XINERAMA),
+ AC_DEFINE(HAVE_XFREE_XINERAMA, , [Have XFree86-style Xinerama])
+ AC_DEFINE(HAVE_XINERAMA,, [Have some version of Xinerama]),
use_xfree_xinerama=no,
[#include <X11/Xlib.h>])],
use_xfree_xinerama=no, -lXext $ALL_X_LIBS)
@@ -180,7 +216,7 @@ AC_CHECK_LIB(Xext, XShapeQueryExtension,
, $ALL_X_LIBS)
if test "x$found_shape" = "xyes"; then
- AC_DEFINE(HAVE_SHAPE)
+ AC_DEFINE(HAVE_SHAPE, , [Have the shape extension library])
fi
RANDR_LIBS=
@@ -192,7 +228,7 @@ AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
, -lXrender $ALL_X_LIBS)
if test "x$found_randr" = "xyes"; then
- AC_DEFINE(HAVE_RANDR)
+ AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
fi
METACITY_LIBS="$RANDR_LIBS $SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS"
@@ -213,8 +249,19 @@ case "$METACITY_LIBS" in
;;
esac
+if test x$enable_sm = xno; then
+ found_sm=no
+fi
+
+if test x$enable_sm = xyes; then
+ if test "$found_sm" = "no"; then
+ AC_MSG_ERROR([--enable-sm forced and -lSM not found])
+ exit 1
+ fi
+fi
+
if test "$found_sm" = "yes"; then
- AC_DEFINE(HAVE_SM)
+ AC_DEFINE(HAVE_SM, , [Building with SM support])
fi
AM_CONDITIONAL(HAVE_SM, test "$found_sm" = "yes")
@@ -236,14 +283,15 @@ LDFLAGS="$METACITY_LIBS $LDFLAGS"
AC_CHECK_FUNCS(gdk_pixbuf_new_from_stream)
LDFLAGS=$save_LDFLAGS
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+if test x$enable_gconf = xyes; then
+ AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+ if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ fi
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ AM_GCONF_SOURCE_2
fi
-AM_GCONF_SOURCE_2
-
AC_OUTPUT([
Makefile
doc/Makefile
@@ -256,6 +304,24 @@ po/Makefile.in
metacity.spec
])
+if test x$enable_gconf = xno; then
+ echo "*** WARNING WARNING WARNING WARNING WARNING"
+ echo "*** Building without GConf"
+ echo "*** This means there's no way to change prefs except"
+ echo "*** hacking source code, at least for now."
+ echo "*** Also, some prefs may have broken defaults."
+ echo "*** Patches needed for a simple no-gconf config file."
+ echo "*** This is intended for embedded systems etc., not for normal use."
+fi
+
+if test x$enable_verbose_mode = xno; then
+ echo "*** WARNING WARNING WARNING WARNING WARNING"
+ echo "*** Building without verbose mode"
+ echo "*** This means there's no way to debug metacity problems."
+ echo "*** Please build normal desktop versions of metacity"
+ echo "*** with verbose mode enabled so users can use it when they report bugs."
+fi
+
dnl ==========================================================================
echo "
metacity-$VERSION:
@@ -264,10 +330,11 @@ metacity-$VERSION:
source code location: ${srcdir}
compiler: ${CC}
+ GConf: ${enable_gconf}
XFree86 Xinerama: ${use_xfree_xinerama}
Solaris Xinerama: ${use_solaris_xinerama}
Multihead: ${with_multihead}
- Startup notification: ${with_startup_notification}
+ Startup notification: ${have_startup_notification}
Session management: ${found_sm}
Shape extension: ${found_shape}
Resize-and-rotate: ${found_randr}
diff --git a/src/delete.c b/src/delete.c
index c8a3804..5e95449 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -38,11 +38,9 @@ delete_ping_reply_func (MetaDisplay *display,
Window xwindow,
void *user_data)
{
- MetaWindow *window = user_data;
-
meta_topic (META_DEBUG_PING,
"Got reply to delete ping for %s\n",
- window->desc);
+ ((MetaWindow*)user_data)->desc);
/* we do nothing */
}
diff --git a/src/display.c b/src/display.c
index 944b8d7..6d9b034 100644
--- a/src/display.c
+++ b/src/display.c
@@ -252,7 +252,8 @@ meta_display_open (const char *name)
"_NET_WM_ACTION_CLOSE",
"_NET_WM_STATE_ABOVE",
"_NET_WM_STATE_BELOW",
- "_NET_STARTUP_ID"
+ "_NET_STARTUP_ID",
+ "_METACITY_TOGGLE_VERBOSE"
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@@ -387,6 +388,7 @@ meta_display_open (const char *name)
display->atom_net_wm_state_above = atoms[75];
display->atom_net_wm_state_below = atoms[76];
display->atom_net_startup_id = atoms[77];
+ display->atom_metacity_toggle_verbose = atoms[78];
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
@@ -1665,6 +1667,12 @@ event_callback (XEvent *event,
(int) event->xclient.data.l[0]);
meta_set_keybindings_disabled (!event->xclient.data.l[0]);
}
+ else if (event->xclient.message_type ==
+ display->atom_metacity_toggle_verbose)
+ {
+ meta_verbose ("Received toggle verbose message\n");
+ meta_set_verbose (!meta_is_verbose ());
+ }
else if (event->xclient.message_type ==
display->atom_wm_protocols)
{
diff --git a/src/display.h b/src/display.h
index 4aa3ffd..efd125c 100644
--- a/src/display.h
+++ b/src/display.h
@@ -161,6 +161,7 @@ struct _MetaDisplay
Atom atom_net_wm_state_above;
Atom atom_net_wm_state_below;
Atom atom_net_startup_id;
+ Atom atom_metacity_toggle_verbose;
/* This is the actual window from focus events,
* not the one we last set
diff --git a/src/prefs.c b/src/prefs.c
index 9eb4c2a..9ef8fbf 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -23,7 +23,9 @@
#include "prefs.h"
#include "ui.h"
#include "util.h"
+#ifdef HAVE_GCONF
#include <gconf/gconf-client.h>
+#endif
#include <string.h>
#include <stdlib.h>
@@ -52,10 +54,13 @@
#define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_"
+#ifdef HAVE_GCONF
static GConfClient *default_client = NULL;
-static GList *listeners = NULL;
static GList *changes = NULL;
static guint changed_idle;
+#endif
+static GList *listeners = NULL;
+
static gboolean use_system_font = TRUE;
static PangoFontDescription *titlebar_font = NULL;
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
@@ -87,7 +92,7 @@ static char *commands[MAX_COMMANDS] = { NULL, };
static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
-
+#ifdef HAVE_GCONF
static gboolean update_use_system_font (gboolean value);
static gboolean update_titlebar_font (const char *value);
static gboolean update_mouse_button_mods (const char *value);
@@ -104,17 +109,13 @@ static gboolean update_window_binding (const char *name,
const char *value);
static gboolean update_screen_binding (const char *name,
const char *value);
-static void init_bindings (void);
static gboolean update_binding (MetaKeyPref *binding,
const char *value);
static gboolean update_command (const char *name,
const char *value);
-static void init_commands (void);
static gboolean update_workspace_name (const char *name,
const char *value);
-static void init_workspace_names (void);
-static void queue_changed (MetaPreference pref);
static void change_notify (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
@@ -122,6 +123,14 @@ static void change_notify (GConfClient *client,
static char* gconf_key_for_workspace_name (int i);
+static void queue_changed (MetaPreference pref);
+#endif /* HAVE_GCONF */
+
+static void init_bindings (void);
+static void init_commands (void);
+static void init_workspace_names (void);
+
+
typedef struct
{
MetaPrefsChangedFunc func;
@@ -167,6 +176,7 @@ meta_prefs_remove_listener (MetaPrefsChangedFunc func,
meta_bug ("Did not find listener to remove\n");
}
+#ifdef HAVE_GCONF
static void
emit_changed (MetaPreference pref)
{
@@ -190,7 +200,9 @@ emit_changed (MetaPreference pref)
g_list_free (copy);
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
changed_idle_handler (gpointer data)
{
@@ -218,7 +230,9 @@ changed_idle_handler (gpointer data)
return FALSE;
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static void
queue_changed (MetaPreference pref)
{
@@ -236,7 +250,9 @@ queue_changed (MetaPreference pref)
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
changed_idle_handler, NULL, NULL);
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static void
cleanup_error (GError **error)
{
@@ -248,10 +264,12 @@ cleanup_error (GError **error)
*error = NULL;
}
}
+#endif /* HAVE_GCONF */
void
meta_prefs_init (void)
{
+#ifdef HAVE_GCONF
GError *err = NULL;
char *str_val;
int int_val;
@@ -340,6 +358,7 @@ meta_prefs_init (void)
cleanup_error (&err);
update_button_layout (str_val);
g_free (str_val);
+#endif /* HAVE_GCONF */
/* Load keybindings prefs */
init_bindings ();
@@ -349,15 +368,18 @@ meta_prefs_init (void)
/* workspace names */
init_workspace_names ();
-
+
+#ifdef HAVE_GCONF
gconf_client_notify_add (default_client, "/apps/metacity",
change_notify,
NULL,
NULL,
&err);
- cleanup_error (&err);
+ cleanup_error (&err);
+#endif /* HAVE_GCONF */
}
+#ifdef HAVE_GCONF
/* from eel */
static gboolean
str_has_prefix (const char *haystack, const char *needle)
@@ -662,7 +684,9 @@ change_notify (GConfClient *client,
/* nothing */
return; /* AIX compiler wants something after a label like out: */
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
update_mouse_button_mods (const char *value)
{
@@ -692,7 +716,9 @@ update_mouse_button_mods (const char *value)
return old_mods != mouse_button_mods;
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
update_focus_mode (const char *value)
{
@@ -713,7 +739,9 @@ update_focus_mode (const char *value)
return (old_mode != focus_mode);
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
update_theme (const char *value)
{
@@ -745,7 +773,7 @@ update_theme (const char *value)
return changed;
}
-
+#endif /* HAVE_GCONF */
MetaVirtualModifier
meta_prefs_get_mouse_button_mods (void)
@@ -765,6 +793,7 @@ meta_prefs_get_theme (void)
return current_theme;
}
+#ifdef HAVE_GCONF
static gboolean
update_use_system_font (gboolean value)
{
@@ -774,7 +803,9 @@ update_use_system_font (gboolean value)
return old != value;
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
update_titlebar_font (const char *value)
{
@@ -806,7 +837,9 @@ update_titlebar_font (const char *value)
return TRUE;
}
}
+#endif /* HAVE_GCONF */
+#ifdef HAVE_GCONF
static gboolean
button_layout_equal (const MetaButtonLayout *a,
const MetaButtonLayout *b)
@@ -950,6 +983,7 @@ update_button_layout (const char *value)
return changed;
}
+#endif /* HAVE_GCONF */
const PangoFontDescription*
meta_prefs_get_titlebar_font (void)
@@ -960,6 +994,7 @@ meta_prefs_get_titlebar_font (void)
return titlebar_font;
}
+#ifdef HAVE_GCONF
static gboolean
update_num_workspaces (int value)
{
@@ -979,6 +1014,7 @@ update_num_workspaces (int value)
return old != num_workspaces;
}
+#endif /* HAVE_GCONF */
int
meta_prefs_get_num_workspaces (void)
@@ -986,6 +1022,7 @@ meta_prefs_get_num_workspaces (void)
return num_workspaces;
}
+#ifdef HAVE_GCONF
static gboolean
update_application_based (gboolean value)
{
@@ -995,13 +1032,17 @@ update_application_based (gboolean value)
return old != application_based;
}
+#endif /* HAVE_GCONF */
gboolean
meta_prefs_get_application_based (void)
{
+ return FALSE; /* For now, we never want this to do anything */
+
return application_based;
}
+#ifdef HAVE_GCONF
static gboolean
update_disable_workarounds (gboolean value)
{
@@ -1022,6 +1063,7 @@ update_disable_workarounds (gboolean value)
return old != disable_workarounds;
}
+#endif /* HAVE_GCONF */
gboolean
meta_prefs_get_disable_workarounds (void)
@@ -1029,6 +1071,7 @@ meta_prefs_get_disable_workarounds (void)
return disable_workarounds;
}
+#ifdef HAVE_GCONF
static MetaActionDoubleClickTitlebar
action_double_click_titlebar_from_string (const char *str)
{
@@ -1089,7 +1132,9 @@ update_auto_raise_delay (int value)
return old != auto_raise_delay;
}
+#endif /* HAVE_GCONF */
+#ifdef WITH_VERBOSE_MODE
const char*
meta_preference_to_string (MetaPreference pref)
{
@@ -1145,10 +1190,12 @@ meta_preference_to_string (MetaPreference pref)
return "(unknown)";
}
+#endif /* WITH_VERBOSE_MODE */
void
meta_prefs_set_num_workspaces (int n_workspaces)
{
+#ifdef HAVE_GCONF
GError *err;
if (default_client == NULL)
@@ -1172,6 +1219,7 @@ meta_prefs_set_num_workspaces (int n_workspaces)
err->message);
g_error_free (err);
}
+#endif /* HAVE_GCONF */
}
/* Indexes must correspond to MetaKeybindingAction */
@@ -1253,6 +1301,7 @@ static MetaKeyPref window_bindings[] = {
static void
init_bindings (void)
{
+#ifdef HAVE_GCONF
int i;
GError *err;
@@ -1297,11 +1346,13 @@ init_bindings (void)
++i;
}
+#endif /* HAVE_GCONF */
}
static void
init_commands (void)
{
+#ifdef HAVE_GCONF
int i;
GError *err;
@@ -1324,11 +1375,13 @@ init_commands (void)
++i;
}
+#endif /* HAVE_GCONF */
}
static void
init_workspace_names (void)
{
+#ifdef HAVE_GCONF
int i;
GError *err;
@@ -1353,8 +1406,10 @@ init_workspace_names (void)
++i;
}
+#endif /* HAVE_GCONF */
}
+#ifdef HAVE_GCONF
static gboolean
update_binding (MetaKeyPref *binding,
const char *value)
@@ -1506,6 +1561,7 @@ update_command (const char *name,
return TRUE;
}
+#endif /* HAVE_GCONF */
const char*
meta_prefs_get_command (int i)
@@ -1525,6 +1581,7 @@ meta_prefs_get_gconf_key_for_command (int i)
return key;
}
+#ifdef HAVE_GCONF
static gboolean
update_workspace_name (const char *name,
const char *value)
@@ -1601,6 +1658,7 @@ update_workspace_name (const char *name,
return TRUE;
}
+#endif /* HAVE_GCONF */
const char*
meta_prefs_get_workspace_name (int i)
@@ -1620,6 +1678,7 @@ void
meta_prefs_change_workspace_name (int i,
const char *name)
{
+#ifdef HAVE_GCONF
char *key;
GError *err;
@@ -1663,8 +1722,10 @@ meta_prefs_change_workspace_name (int i,
}
g_free (key);
+#endif /* HAVE_GCONF */
}
+#ifdef HAVE_GCONF
static char*
gconf_key_for_workspace_name (int i)
{
@@ -1674,6 +1735,7 @@ gconf_key_for_workspace_name (int i)
return key;
}
+#endif /* HAVE_GCONF */
void
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
diff --git a/src/tools/metacity-message.c b/src/tools/metacity-message.c
index 5188615..0c20258 100644
--- a/src/tools/metacity-message.c
+++ b/src/tools/metacity-message.c
@@ -19,11 +19,17 @@
* 02111-1307, USA.
*/
+#include <config.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <stdlib.h>
#include <string.h>
+#include <libintl.h>
+#define _(x) dgettext (GETTEXT_PACKAGE, x)
+#define N_(x) x
+
+
static void
send_restart (void)
{
@@ -108,10 +114,41 @@ send_set_keybindings (gboolean enabled)
XSync (gdk_display, False);
}
+#ifdef WITH_VERBOSE_MODE
+static void
+send_toggle_verbose (void)
+{
+ XEvent xev;
+
+ xev.xclient.type = ClientMessage;
+ xev.xclient.serial = 0;
+ xev.xclient.send_event = True;
+ xev.xclient.display = gdk_display;
+ xev.xclient.window = gdk_x11_get_default_root_xwindow ();
+ xev.xclient.message_type = XInternAtom (gdk_display,
+ "_METACITY_TOGGLE_VERBOSE",
+ False);
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = 0;
+ xev.xclient.data.l[1] = 0;
+ xev.xclient.data.l[2] = 0;
+
+ XSendEvent (gdk_display,
+ gdk_x11_get_default_root_xwindow (),
+ False,
+ SubstructureRedirectMask | SubstructureNotifyMask,
+ &xev);
+
+ XFlush (gdk_display);
+ XSync (gdk_display, False);
+}
+#endif
+
static void
usage (void)
{
- g_printerr ("Usage: metacity-message (restart|reload-theme|enable-keybindings|disable-keybindings)\n");
+ g_printerr (_("Usage: %s\n"),
+ "metacity-message (restart|reload-theme|enable-keybindings|disable-keybindings|toggle-verbose)");
exit (1);
}
@@ -131,6 +168,15 @@ main (int argc, char **argv)
send_set_keybindings (TRUE);
else if (strcmp (argv[1], "disable-keybindings") == 0)
send_set_keybindings (FALSE);
+ else if (strcmp (argv[1], "toggle-verbose") == 0)
+ {
+#ifndef WITH_VERBOSE_MODE
+ g_printerr (_("Metacity was compiled without support for verbose mode\n"));
+ return 1;
+#else
+ send_toggle_verbose ();
+#endif
+ }
else
usage ();
diff --git a/src/util.c b/src/util.c
index 92b96f8..0a8af04 100644
--- a/src/util.c
+++ b/src/util.c
@@ -104,7 +104,7 @@ ensure_logfile (void)
}
else
{
- g_print (_("Opened log file %s\n"), filename);
+ g_printerr (_("Opened log file %s\n"), filename);
}
g_free (filename);
@@ -120,6 +120,11 @@ meta_is_verbose (void)
void
meta_set_verbose (gboolean setting)
{
+#ifndef WITH_VERBOSE_MODE
+ if (setting)
+ meta_fatal (_("Metacity was compiled without support for verbose mode\n"));
+#endif
+
if (setting)
ensure_logfile ();
@@ -172,8 +177,9 @@ utf8_fputs (const char *str,
return retval;
}
+#ifdef WITH_VERBOSE_MODE
void
-meta_debug_spew (const char *format, ...)
+meta_debug_spew_real (const char *format, ...)
{
va_list args;
gchar *str;
@@ -198,9 +204,11 @@ meta_debug_spew (const char *format, ...)
g_free (str);
}
+#endif /* WITH_VERBOSE_MODE */
+#ifdef WITH_VERBOSE_MODE
void
-meta_verbose (const char *format, ...)
+meta_verbose_real (const char *format, ...)
{
va_list args;
gchar *str;
@@ -225,7 +233,9 @@ meta_verbose (const char *format, ...)
g_free (str);
}
+#endif /* WITH_VERBOSE_MODE */
+#ifdef WITH_VERBOSE_MODE
static const char*
topic_name (MetaDebugTopic topic)
{
@@ -275,9 +285,9 @@ topic_name (MetaDebugTopic topic)
static int sync_count = 0;
void
-meta_topic (MetaDebugTopic topic,
- const char *format,
- ...)
+meta_topic_real (MetaDebugTopic topic,
+ const char *format,
+ ...)
{
va_list args;
gchar *str;
@@ -309,6 +319,7 @@ meta_topic (MetaDebugTopic topic,
g_free (str);
}
+#endif /* WITH_VERBOSE_MODE */
void
meta_bug (const char *format, ...)
diff --git a/src/util.h b/src/util.h
index a339352..280e7ee 100644
--- a/src/util.h
+++ b/src/util.h
@@ -33,10 +33,11 @@ void meta_set_syncing (gboolean setting);
gboolean meta_get_replace_current_wm (void);
void meta_set_replace_current_wm (gboolean setting);
-void meta_debug_spew (const char *format,
- ...) G_GNUC_PRINTF (1, 2);
-void meta_verbose (const char *format,
- ...) G_GNUC_PRINTF (1, 2);
+void meta_debug_spew_real (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void meta_verbose_real (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+
void meta_bug (const char *format,
...) G_GNUC_PRINTF (1, 2);
void meta_warning (const char *format,
@@ -67,9 +68,9 @@ typedef enum
} MetaDebugTopic;
-void meta_topic (MetaDebugTopic topic,
- const char *format,
- ...) G_GNUC_PRINTF (2, 3);
+void meta_topic_real (MetaDebugTopic topic,
+ const char *format,
+ ...) G_GNUC_PRINTF (2, 3);
void meta_push_no_msg_prefix (void);
void meta_pop_no_msg_prefix (void);
@@ -84,6 +85,30 @@ void meta_print_backtrace (void);
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x
-#endif
+
+/* To disable verbose mode, we make these functions into no-ops */
+#ifdef WITH_VERBOSE_MODE
+
+#define meta_debug_spew meta_debug_spew_real
+#define meta_verbose meta_verbose_real
+#define meta_topic meta_topic_real
+
+#else
+
+# ifdef G_HAVE_ISO_VARARGS
+# define meta_debug_spew(...)
+# define meta_verbose(...)
+# define meta_topic(...)
+# elif defined(G_HAVE_GNUC_VARARGS)
+# define meta_debug_spew(format...)
+# define meta_verbose(format...)
+# define meta_topic(format...)
+# else
+# error "This compiler does not support varargs macros and thus verbose mode can't be disabled meaningfully"
+# endif
+
+#endif /* !WITH_VERBOSE_MODE */
+
+#endif /* META_UTIL_H */
diff --git a/src/window.c b/src/window.c
index dbfcd84..b4f80cf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -131,6 +131,7 @@ void meta_window_flush_move_resize (MetaWindow *window);
static void meta_window_apply_session_info (MetaWindow *window,
const MetaWindowSessionInfo *info);
+#ifdef WITH_VERBOSE_MODE
static const char*
wm_state_to_string (int state)
{
@@ -146,6 +147,7 @@ wm_state_to_string (int state)
return "Unknown";
}
+#endif
MetaWindow*
meta_window_new (MetaDisplay *display,
diff --git a/src/workspace.c b/src/workspace.c
index e034f1e..d49fd39 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -415,6 +415,7 @@ meta_workspace_get_work_area (MetaWorkspace *workspace,
*area = workspace->work_area;
}
+#ifdef WITH_VERBOSE_MODE
static char *
meta_motion_direction_to_string (MetaMotionDirection direction)
{
@@ -432,7 +433,9 @@ meta_motion_direction_to_string (MetaMotionDirection direction)
return "Unknown";
}
+#endif /* WITH_VERBOSE_MODE */
+#ifdef WITH_VERBOSE_MODE
static char *
meta_screen_corner_to_string (MetaScreenCorner corner)
{
@@ -450,6 +453,7 @@ meta_screen_corner_to_string (MetaScreenCorner corner)
return "Unknown";
}
+#endif /* WITH_VERBOSE_MODE */
MetaWorkspace*
meta_workspace_get_neighbor (MetaWorkspace *workspace,