make this always return FALSE for now, to avoid bug reports.

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
This commit is contained in:
Havoc Pennington 2002-12-08 19:17:17 +00:00 committed by Havoc Pennington
parent 15d28dfd97
commit 8d314aead8
13 changed files with 309 additions and 69 deletions

View File

@ -1,3 +1,37 @@
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> 2002-12-08 Havoc Pennington <hp@pobox.com>
* src/prefs.c (update_workspace_name): also treat empty string as * src/prefs.c (update_workspace_name): also treat empty string as

View File

@ -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

View File

@ -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 "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
GETTEXTIZE="" GETTEXTIZE=""

View File

@ -11,7 +11,7 @@ ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
GETTEXT_PACKAGE=metacity GETTEXT_PACKAGE=metacity
AC_SUBST(GETTEXT_PACKAGE) 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 AM_MAINTAINER_MODE
@ -19,7 +19,6 @@ AC_PROG_INTLTOOL([0.21])
AC_PROG_CC AC_PROG_CC
AC_ISC_POSIX AC_ISC_POSIX
AC_HEADER_STDC AC_HEADER_STDC
AC_ARG_PROGRAM
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
changequote(,)dnl changequote(,)dnl
@ -83,6 +82,8 @@ if test "x$GCC" = "xyes"; then
fi fi
changequote([,])dnl 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) 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) 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]) AC_DEFINE(BUILD_CONFIG_DIALOG,1,[Build configuration dialog])
fi 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 ## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(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" 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 AM_GLIB_GNU_GETTEXT
## here we get the flags we'll actually use ## here we get the flags we'll actually use
PKG_CHECK_MODULES(METACITY_MESSAGE, gtk+-2.0 >= 2.0.0) 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_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 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 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" 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) METACITY_PC_MODULES="$METACITY_PC_MODULES libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION"
AC_DEFINE(HAVE_STARTUP_NOTIFICATION) AC_DEFINE(HAVE_STARTUP_NOTIFICATION, , [Building with startup notification support])
with_startup_notification=yes
else else
echo "Building without libstartup-notification" 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 fi
PKG_CHECK_MODULES(METACITY, $METACITY_PC_MODULES)
if $PKG_CONFIG --atleast-version 2.1.0 gtk+-2.0; then if $PKG_CONFIG --atleast-version 2.1.0 gtk+-2.0; then
AC_DEFINE(HAVE_GTK_MULTIHEAD,,[gtk+ with multihead support found]) AC_DEFINE(HAVE_GTK_MULTIHEAD,,[gtk+ with multihead support found])
with_multihead=yes with_multihead=yes
@ -143,8 +179,8 @@ case "$host" in
if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS" X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
fi fi
AC_DEFINE(HAVE_SOLARIS_XINERAMA) AC_DEFINE(HAVE_SOLARIS_XINERAMA, , [Have Solaris-style Xinerama])
AC_DEFINE(HAVE_XINERAMA), AC_DEFINE(HAVE_XINERAMA, , [Have some version of Xinerama]),
use_solaris_xinerama=no, use_solaris_xinerama=no,
[#include <X11/Xlib.h>]) [#include <X11/Xlib.h>])
fi fi
@ -160,8 +196,8 @@ case "$host" in
if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS" X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
fi fi
AC_DEFINE(HAVE_XFREE_XINERAMA) AC_DEFINE(HAVE_XFREE_XINERAMA, , [Have XFree86-style Xinerama])
AC_DEFINE(HAVE_XINERAMA), AC_DEFINE(HAVE_XINERAMA,, [Have some version of Xinerama]),
use_xfree_xinerama=no, use_xfree_xinerama=no,
[#include <X11/Xlib.h>])], [#include <X11/Xlib.h>])],
use_xfree_xinerama=no, -lXext $ALL_X_LIBS) use_xfree_xinerama=no, -lXext $ALL_X_LIBS)
@ -180,7 +216,7 @@ AC_CHECK_LIB(Xext, XShapeQueryExtension,
, $ALL_X_LIBS) , $ALL_X_LIBS)
if test "x$found_shape" = "xyes"; then if test "x$found_shape" = "xyes"; then
AC_DEFINE(HAVE_SHAPE) AC_DEFINE(HAVE_SHAPE, , [Have the shape extension library])
fi fi
RANDR_LIBS= RANDR_LIBS=
@ -192,7 +228,7 @@ AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
, -lXrender $ALL_X_LIBS) , -lXrender $ALL_X_LIBS)
if test "x$found_randr" = "xyes"; then if test "x$found_randr" = "xyes"; then
AC_DEFINE(HAVE_RANDR) AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
fi fi
METACITY_LIBS="$RANDR_LIBS $SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS" 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 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 if test "$found_sm" = "yes"; then
AC_DEFINE(HAVE_SM) AC_DEFINE(HAVE_SM, , [Building with SM support])
fi fi
AM_CONDITIONAL(HAVE_SM, test "$found_sm" = "yes") AM_CONDITIONAL(HAVE_SM, test "$found_sm" = "yes")
@ -236,14 +283,15 @@ LDFLAGS="$METACITY_LIBS $LDFLAGS"
AC_CHECK_FUNCS(gdk_pixbuf_new_from_stream) AC_CHECK_FUNCS(gdk_pixbuf_new_from_stream)
LDFLAGS=$save_LDFLAGS 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 AM_GCONF_SOURCE_2
AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
fi fi
AM_GCONF_SOURCE_2
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
doc/Makefile doc/Makefile
@ -256,6 +304,24 @@ po/Makefile.in
metacity.spec 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 ========================================================================== dnl ==========================================================================
echo " echo "
metacity-$VERSION: metacity-$VERSION:
@ -264,10 +330,11 @@ metacity-$VERSION:
source code location: ${srcdir} source code location: ${srcdir}
compiler: ${CC} compiler: ${CC}
GConf: ${enable_gconf}
XFree86 Xinerama: ${use_xfree_xinerama} XFree86 Xinerama: ${use_xfree_xinerama}
Solaris Xinerama: ${use_solaris_xinerama} Solaris Xinerama: ${use_solaris_xinerama}
Multihead: ${with_multihead} Multihead: ${with_multihead}
Startup notification: ${with_startup_notification} Startup notification: ${have_startup_notification}
Session management: ${found_sm} Session management: ${found_sm}
Shape extension: ${found_shape} Shape extension: ${found_shape}
Resize-and-rotate: ${found_randr} Resize-and-rotate: ${found_randr}

View File

@ -38,11 +38,9 @@ delete_ping_reply_func (MetaDisplay *display,
Window xwindow, Window xwindow,
void *user_data) void *user_data)
{ {
MetaWindow *window = user_data;
meta_topic (META_DEBUG_PING, meta_topic (META_DEBUG_PING,
"Got reply to delete ping for %s\n", "Got reply to delete ping for %s\n",
window->desc); ((MetaWindow*)user_data)->desc);
/* we do nothing */ /* we do nothing */
} }

View File

@ -252,7 +252,8 @@ meta_display_open (const char *name)
"_NET_WM_ACTION_CLOSE", "_NET_WM_ACTION_CLOSE",
"_NET_WM_STATE_ABOVE", "_NET_WM_STATE_ABOVE",
"_NET_WM_STATE_BELOW", "_NET_WM_STATE_BELOW",
"_NET_STARTUP_ID" "_NET_STARTUP_ID",
"_METACITY_TOGGLE_VERBOSE"
}; };
Atom atoms[G_N_ELEMENTS(atom_names)]; 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_above = atoms[75];
display->atom_net_wm_state_below = atoms[76]; display->atom_net_wm_state_below = atoms[76];
display->atom_net_startup_id = atoms[77]; display->atom_net_startup_id = atoms[77];
display->atom_metacity_toggle_verbose = atoms[78];
display->prop_hooks = NULL; display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display); meta_display_init_window_prop_hooks (display);
@ -1665,6 +1667,12 @@ event_callback (XEvent *event,
(int) event->xclient.data.l[0]); (int) event->xclient.data.l[0]);
meta_set_keybindings_disabled (!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 == else if (event->xclient.message_type ==
display->atom_wm_protocols) display->atom_wm_protocols)
{ {

View File

@ -161,6 +161,7 @@ struct _MetaDisplay
Atom atom_net_wm_state_above; Atom atom_net_wm_state_above;
Atom atom_net_wm_state_below; Atom atom_net_wm_state_below;
Atom atom_net_startup_id; Atom atom_net_startup_id;
Atom atom_metacity_toggle_verbose;
/* This is the actual window from focus events, /* This is the actual window from focus events,
* not the one we last set * not the one we last set

View File

@ -23,7 +23,9 @@
#include "prefs.h" #include "prefs.h"
#include "ui.h" #include "ui.h"
#include "util.h" #include "util.h"
#ifdef HAVE_GCONF
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -52,10 +54,13 @@
#define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_" #define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_"
#ifdef HAVE_GCONF
static GConfClient *default_client = NULL; static GConfClient *default_client = NULL;
static GList *listeners = NULL;
static GList *changes = NULL; static GList *changes = NULL;
static guint changed_idle; static guint changed_idle;
#endif
static GList *listeners = NULL;
static gboolean use_system_font = TRUE; static gboolean use_system_font = TRUE;
static PangoFontDescription *titlebar_font = NULL; static PangoFontDescription *titlebar_font = NULL;
static MetaVirtualModifier mouse_button_mods = Mod1Mask; static MetaVirtualModifier mouse_button_mods = Mod1Mask;
@ -87,7 +92,7 @@ static char *commands[MAX_COMMANDS] = { NULL, };
static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, }; static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
#ifdef HAVE_GCONF
static gboolean update_use_system_font (gboolean value); static gboolean update_use_system_font (gboolean value);
static gboolean update_titlebar_font (const char *value); static gboolean update_titlebar_font (const char *value);
static gboolean update_mouse_button_mods (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); const char *value);
static gboolean update_screen_binding (const char *name, static gboolean update_screen_binding (const char *name,
const char *value); const char *value);
static void init_bindings (void);
static gboolean update_binding (MetaKeyPref *binding, static gboolean update_binding (MetaKeyPref *binding,
const char *value); const char *value);
static gboolean update_command (const char *name, static gboolean update_command (const char *name,
const char *value); const char *value);
static void init_commands (void);
static gboolean update_workspace_name (const char *name, static gboolean update_workspace_name (const char *name,
const char *value); const char *value);
static void init_workspace_names (void);
static void queue_changed (MetaPreference pref);
static void change_notify (GConfClient *client, static void change_notify (GConfClient *client,
guint cnxn_id, guint cnxn_id,
GConfEntry *entry, GConfEntry *entry,
@ -122,6 +123,14 @@ static void change_notify (GConfClient *client,
static char* gconf_key_for_workspace_name (int i); 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 typedef struct
{ {
MetaPrefsChangedFunc func; MetaPrefsChangedFunc func;
@ -167,6 +176,7 @@ meta_prefs_remove_listener (MetaPrefsChangedFunc func,
meta_bug ("Did not find listener to remove\n"); meta_bug ("Did not find listener to remove\n");
} }
#ifdef HAVE_GCONF
static void static void
emit_changed (MetaPreference pref) emit_changed (MetaPreference pref)
{ {
@ -190,7 +200,9 @@ emit_changed (MetaPreference pref)
g_list_free (copy); g_list_free (copy);
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
changed_idle_handler (gpointer data) changed_idle_handler (gpointer data)
{ {
@ -218,7 +230,9 @@ changed_idle_handler (gpointer data)
return FALSE; return FALSE;
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static void static void
queue_changed (MetaPreference pref) queue_changed (MetaPreference pref)
{ {
@ -236,7 +250,9 @@ queue_changed (MetaPreference pref)
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY, changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
changed_idle_handler, NULL, NULL); changed_idle_handler, NULL, NULL);
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static void static void
cleanup_error (GError **error) cleanup_error (GError **error)
{ {
@ -248,10 +264,12 @@ cleanup_error (GError **error)
*error = NULL; *error = NULL;
} }
} }
#endif /* HAVE_GCONF */
void void
meta_prefs_init (void) meta_prefs_init (void)
{ {
#ifdef HAVE_GCONF
GError *err = NULL; GError *err = NULL;
char *str_val; char *str_val;
int int_val; int int_val;
@ -340,6 +358,7 @@ meta_prefs_init (void)
cleanup_error (&err); cleanup_error (&err);
update_button_layout (str_val); update_button_layout (str_val);
g_free (str_val); g_free (str_val);
#endif /* HAVE_GCONF */
/* Load keybindings prefs */ /* Load keybindings prefs */
init_bindings (); init_bindings ();
@ -350,14 +369,17 @@ meta_prefs_init (void)
/* workspace names */ /* workspace names */
init_workspace_names (); init_workspace_names ();
#ifdef HAVE_GCONF
gconf_client_notify_add (default_client, "/apps/metacity", gconf_client_notify_add (default_client, "/apps/metacity",
change_notify, change_notify,
NULL, NULL,
NULL, NULL,
&err); &err);
cleanup_error (&err); cleanup_error (&err);
#endif /* HAVE_GCONF */
} }
#ifdef HAVE_GCONF
/* from eel */ /* from eel */
static gboolean static gboolean
str_has_prefix (const char *haystack, const char *needle) str_has_prefix (const char *haystack, const char *needle)
@ -662,7 +684,9 @@ change_notify (GConfClient *client,
/* nothing */ /* nothing */
return; /* AIX compiler wants something after a label like out: */ return; /* AIX compiler wants something after a label like out: */
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
update_mouse_button_mods (const char *value) update_mouse_button_mods (const char *value)
{ {
@ -692,7 +716,9 @@ update_mouse_button_mods (const char *value)
return old_mods != mouse_button_mods; return old_mods != mouse_button_mods;
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
update_focus_mode (const char *value) update_focus_mode (const char *value)
{ {
@ -713,7 +739,9 @@ update_focus_mode (const char *value)
return (old_mode != focus_mode); return (old_mode != focus_mode);
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
update_theme (const char *value) update_theme (const char *value)
{ {
@ -745,7 +773,7 @@ update_theme (const char *value)
return changed; return changed;
} }
#endif /* HAVE_GCONF */
MetaVirtualModifier MetaVirtualModifier
meta_prefs_get_mouse_button_mods (void) meta_prefs_get_mouse_button_mods (void)
@ -765,6 +793,7 @@ meta_prefs_get_theme (void)
return current_theme; return current_theme;
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_use_system_font (gboolean value) update_use_system_font (gboolean value)
{ {
@ -774,7 +803,9 @@ update_use_system_font (gboolean value)
return old != value; return old != value;
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
update_titlebar_font (const char *value) update_titlebar_font (const char *value)
{ {
@ -806,7 +837,9 @@ update_titlebar_font (const char *value)
return TRUE; return TRUE;
} }
} }
#endif /* HAVE_GCONF */
#ifdef HAVE_GCONF
static gboolean static gboolean
button_layout_equal (const MetaButtonLayout *a, button_layout_equal (const MetaButtonLayout *a,
const MetaButtonLayout *b) const MetaButtonLayout *b)
@ -950,6 +983,7 @@ update_button_layout (const char *value)
return changed; return changed;
} }
#endif /* HAVE_GCONF */
const PangoFontDescription* const PangoFontDescription*
meta_prefs_get_titlebar_font (void) meta_prefs_get_titlebar_font (void)
@ -960,6 +994,7 @@ meta_prefs_get_titlebar_font (void)
return titlebar_font; return titlebar_font;
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_num_workspaces (int value) update_num_workspaces (int value)
{ {
@ -979,6 +1014,7 @@ update_num_workspaces (int value)
return old != num_workspaces; return old != num_workspaces;
} }
#endif /* HAVE_GCONF */
int int
meta_prefs_get_num_workspaces (void) meta_prefs_get_num_workspaces (void)
@ -986,6 +1022,7 @@ meta_prefs_get_num_workspaces (void)
return num_workspaces; return num_workspaces;
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_application_based (gboolean value) update_application_based (gboolean value)
{ {
@ -995,13 +1032,17 @@ update_application_based (gboolean value)
return old != application_based; return old != application_based;
} }
#endif /* HAVE_GCONF */
gboolean gboolean
meta_prefs_get_application_based (void) meta_prefs_get_application_based (void)
{ {
return FALSE; /* For now, we never want this to do anything */
return application_based; return application_based;
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_disable_workarounds (gboolean value) update_disable_workarounds (gboolean value)
{ {
@ -1022,6 +1063,7 @@ update_disable_workarounds (gboolean value)
return old != disable_workarounds; return old != disable_workarounds;
} }
#endif /* HAVE_GCONF */
gboolean gboolean
meta_prefs_get_disable_workarounds (void) meta_prefs_get_disable_workarounds (void)
@ -1029,6 +1071,7 @@ meta_prefs_get_disable_workarounds (void)
return disable_workarounds; return disable_workarounds;
} }
#ifdef HAVE_GCONF
static MetaActionDoubleClickTitlebar static MetaActionDoubleClickTitlebar
action_double_click_titlebar_from_string (const char *str) action_double_click_titlebar_from_string (const char *str)
{ {
@ -1089,7 +1132,9 @@ update_auto_raise_delay (int value)
return old != auto_raise_delay; return old != auto_raise_delay;
} }
#endif /* HAVE_GCONF */
#ifdef WITH_VERBOSE_MODE
const char* const char*
meta_preference_to_string (MetaPreference pref) meta_preference_to_string (MetaPreference pref)
{ {
@ -1145,10 +1190,12 @@ meta_preference_to_string (MetaPreference pref)
return "(unknown)"; return "(unknown)";
} }
#endif /* WITH_VERBOSE_MODE */
void void
meta_prefs_set_num_workspaces (int n_workspaces) meta_prefs_set_num_workspaces (int n_workspaces)
{ {
#ifdef HAVE_GCONF
GError *err; GError *err;
if (default_client == NULL) if (default_client == NULL)
@ -1172,6 +1219,7 @@ meta_prefs_set_num_workspaces (int n_workspaces)
err->message); err->message);
g_error_free (err); g_error_free (err);
} }
#endif /* HAVE_GCONF */
} }
/* Indexes must correspond to MetaKeybindingAction */ /* Indexes must correspond to MetaKeybindingAction */
@ -1253,6 +1301,7 @@ static MetaKeyPref window_bindings[] = {
static void static void
init_bindings (void) init_bindings (void)
{ {
#ifdef HAVE_GCONF
int i; int i;
GError *err; GError *err;
@ -1297,11 +1346,13 @@ init_bindings (void)
++i; ++i;
} }
#endif /* HAVE_GCONF */
} }
static void static void
init_commands (void) init_commands (void)
{ {
#ifdef HAVE_GCONF
int i; int i;
GError *err; GError *err;
@ -1324,11 +1375,13 @@ init_commands (void)
++i; ++i;
} }
#endif /* HAVE_GCONF */
} }
static void static void
init_workspace_names (void) init_workspace_names (void)
{ {
#ifdef HAVE_GCONF
int i; int i;
GError *err; GError *err;
@ -1353,8 +1406,10 @@ init_workspace_names (void)
++i; ++i;
} }
#endif /* HAVE_GCONF */
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_binding (MetaKeyPref *binding, update_binding (MetaKeyPref *binding,
const char *value) const char *value)
@ -1506,6 +1561,7 @@ update_command (const char *name,
return TRUE; return TRUE;
} }
#endif /* HAVE_GCONF */
const char* const char*
meta_prefs_get_command (int i) meta_prefs_get_command (int i)
@ -1525,6 +1581,7 @@ meta_prefs_get_gconf_key_for_command (int i)
return key; return key;
} }
#ifdef HAVE_GCONF
static gboolean static gboolean
update_workspace_name (const char *name, update_workspace_name (const char *name,
const char *value) const char *value)
@ -1601,6 +1658,7 @@ update_workspace_name (const char *name,
return TRUE; return TRUE;
} }
#endif /* HAVE_GCONF */
const char* const char*
meta_prefs_get_workspace_name (int i) meta_prefs_get_workspace_name (int i)
@ -1620,6 +1678,7 @@ void
meta_prefs_change_workspace_name (int i, meta_prefs_change_workspace_name (int i,
const char *name) const char *name)
{ {
#ifdef HAVE_GCONF
char *key; char *key;
GError *err; GError *err;
@ -1663,8 +1722,10 @@ meta_prefs_change_workspace_name (int i,
} }
g_free (key); g_free (key);
#endif /* HAVE_GCONF */
} }
#ifdef HAVE_GCONF
static char* static char*
gconf_key_for_workspace_name (int i) gconf_key_for_workspace_name (int i)
{ {
@ -1674,6 +1735,7 @@ gconf_key_for_workspace_name (int i)
return key; return key;
} }
#endif /* HAVE_GCONF */
void void
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p) meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)

View File

@ -19,11 +19,17 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <config.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x
static void static void
send_restart (void) send_restart (void)
{ {
@ -108,10 +114,41 @@ send_set_keybindings (gboolean enabled)
XSync (gdk_display, False); 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 static void
usage (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); exit (1);
} }
@ -131,6 +168,15 @@ main (int argc, char **argv)
send_set_keybindings (TRUE); send_set_keybindings (TRUE);
else if (strcmp (argv[1], "disable-keybindings") == 0) else if (strcmp (argv[1], "disable-keybindings") == 0)
send_set_keybindings (FALSE); 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 else
usage (); usage ();

View File

@ -104,7 +104,7 @@ ensure_logfile (void)
} }
else else
{ {
g_print (_("Opened log file %s\n"), filename); g_printerr (_("Opened log file %s\n"), filename);
} }
g_free (filename); g_free (filename);
@ -120,6 +120,11 @@ meta_is_verbose (void)
void void
meta_set_verbose (gboolean setting) 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) if (setting)
ensure_logfile (); ensure_logfile ();
@ -172,8 +177,9 @@ utf8_fputs (const char *str,
return retval; return retval;
} }
#ifdef WITH_VERBOSE_MODE
void void
meta_debug_spew (const char *format, ...) meta_debug_spew_real (const char *format, ...)
{ {
va_list args; va_list args;
gchar *str; gchar *str;
@ -198,9 +204,11 @@ meta_debug_spew (const char *format, ...)
g_free (str); g_free (str);
} }
#endif /* WITH_VERBOSE_MODE */
#ifdef WITH_VERBOSE_MODE
void void
meta_verbose (const char *format, ...) meta_verbose_real (const char *format, ...)
{ {
va_list args; va_list args;
gchar *str; gchar *str;
@ -225,7 +233,9 @@ meta_verbose (const char *format, ...)
g_free (str); g_free (str);
} }
#endif /* WITH_VERBOSE_MODE */
#ifdef WITH_VERBOSE_MODE
static const char* static const char*
topic_name (MetaDebugTopic topic) topic_name (MetaDebugTopic topic)
{ {
@ -275,9 +285,9 @@ topic_name (MetaDebugTopic topic)
static int sync_count = 0; static int sync_count = 0;
void void
meta_topic (MetaDebugTopic topic, meta_topic_real (MetaDebugTopic topic,
const char *format, const char *format,
...) ...)
{ {
va_list args; va_list args;
gchar *str; gchar *str;
@ -309,6 +319,7 @@ meta_topic (MetaDebugTopic topic,
g_free (str); g_free (str);
} }
#endif /* WITH_VERBOSE_MODE */
void void
meta_bug (const char *format, ...) meta_bug (const char *format, ...)

View File

@ -33,10 +33,11 @@ void meta_set_syncing (gboolean setting);
gboolean meta_get_replace_current_wm (void); gboolean meta_get_replace_current_wm (void);
void meta_set_replace_current_wm (gboolean setting); void meta_set_replace_current_wm (gboolean setting);
void meta_debug_spew (const char *format, void meta_debug_spew_real (const char *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
void meta_verbose (const char *format, void meta_verbose_real (const char *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
void meta_bug (const char *format, void meta_bug (const char *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
void meta_warning (const char *format, void meta_warning (const char *format,
@ -67,9 +68,9 @@ typedef enum
} MetaDebugTopic; } MetaDebugTopic;
void meta_topic (MetaDebugTopic topic, void meta_topic_real (MetaDebugTopic topic,
const char *format, const char *format,
...) G_GNUC_PRINTF (2, 3); ...) G_GNUC_PRINTF (2, 3);
void meta_push_no_msg_prefix (void); void meta_push_no_msg_prefix (void);
void meta_pop_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 _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) 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 */

View File

@ -131,6 +131,7 @@ void meta_window_flush_move_resize (MetaWindow *window);
static void meta_window_apply_session_info (MetaWindow *window, static void meta_window_apply_session_info (MetaWindow *window,
const MetaWindowSessionInfo *info); const MetaWindowSessionInfo *info);
#ifdef WITH_VERBOSE_MODE
static const char* static const char*
wm_state_to_string (int state) wm_state_to_string (int state)
{ {
@ -146,6 +147,7 @@ wm_state_to_string (int state)
return "Unknown"; return "Unknown";
} }
#endif
MetaWindow* MetaWindow*
meta_window_new (MetaDisplay *display, meta_window_new (MetaDisplay *display,

View File

@ -415,6 +415,7 @@ meta_workspace_get_work_area (MetaWorkspace *workspace,
*area = workspace->work_area; *area = workspace->work_area;
} }
#ifdef WITH_VERBOSE_MODE
static char * static char *
meta_motion_direction_to_string (MetaMotionDirection direction) meta_motion_direction_to_string (MetaMotionDirection direction)
{ {
@ -432,7 +433,9 @@ meta_motion_direction_to_string (MetaMotionDirection direction)
return "Unknown"; return "Unknown";
} }
#endif /* WITH_VERBOSE_MODE */
#ifdef WITH_VERBOSE_MODE
static char * static char *
meta_screen_corner_to_string (MetaScreenCorner corner) meta_screen_corner_to_string (MetaScreenCorner corner)
{ {
@ -450,6 +453,7 @@ meta_screen_corner_to_string (MetaScreenCorner corner)
return "Unknown"; return "Unknown";
} }
#endif /* WITH_VERBOSE_MODE */
MetaWorkspace* MetaWorkspace*
meta_workspace_get_neighbor (MetaWorkspace *workspace, meta_workspace_get_neighbor (MetaWorkspace *workspace,