util.h

Go to the documentation of this file.
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 
00003 /* Metacity utilities */
00004 
00005 /* 
00006  * Copyright (C) 2001 Havoc Pennington
00007  * Copyright (C) 2005 Elijah Newren
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00022  * 02111-1307, USA.
00023  */
00024 
00025 #ifndef META_UTIL_H
00026 #define META_UTIL_H
00027 
00028 #include <glib.h>
00029 
00030 gboolean meta_is_verbose  (void);
00031 void     meta_set_verbose (gboolean setting);
00032 gboolean meta_is_debugging (void);
00033 void     meta_set_debugging (gboolean setting);
00034 gboolean meta_is_syncing (void);
00035 void     meta_set_syncing (gboolean setting);
00036 gboolean meta_get_replace_current_wm (void);
00037 void     meta_set_replace_current_wm (gboolean setting);
00038 
00039 void meta_debug_spew_real (const char *format,
00040                            ...) G_GNUC_PRINTF (1, 2);
00041 void meta_verbose_real    (const char *format,
00042                            ...) G_GNUC_PRINTF (1, 2);
00043 
00044 void meta_bug        (const char *format,
00045                       ...) G_GNUC_PRINTF (1, 2);
00046 void meta_warning    (const char *format,
00047                       ...) G_GNUC_PRINTF (1, 2);
00048 void meta_fatal      (const char *format,
00049                       ...) G_GNUC_PRINTF (1, 2);
00050 
00051 typedef enum
00052 {
00053   META_DEBUG_FOCUS           = 1 << 0,
00054   META_DEBUG_WORKAREA        = 1 << 1,
00055   META_DEBUG_STACK           = 1 << 2,
00056   META_DEBUG_THEMES          = 1 << 3,
00057   META_DEBUG_SM              = 1 << 4,
00058   META_DEBUG_EVENTS          = 1 << 5,
00059   META_DEBUG_WINDOW_STATE    = 1 << 6,
00060   META_DEBUG_WINDOW_OPS      = 1 << 7,
00061   META_DEBUG_GEOMETRY        = 1 << 8,
00062   META_DEBUG_PLACEMENT       = 1 << 9,
00063   META_DEBUG_PING            = 1 << 10,
00064   META_DEBUG_XINERAMA        = 1 << 11,
00065   META_DEBUG_KEYBINDINGS     = 1 << 12,
00066   META_DEBUG_SYNC            = 1 << 13,
00067   META_DEBUG_ERRORS          = 1 << 14,
00068   META_DEBUG_STARTUP         = 1 << 15,
00069   META_DEBUG_PREFS           = 1 << 16,
00070   META_DEBUG_GROUPS          = 1 << 17,
00071   META_DEBUG_RESIZING        = 1 << 18,
00072   META_DEBUG_SHAPES          = 1 << 19,
00073   META_DEBUG_COMPOSITOR      = 1 << 20,
00074   META_DEBUG_EDGE_RESISTANCE = 1 << 21
00075 } MetaDebugTopic;
00076 
00077 void meta_topic_real      (MetaDebugTopic topic,
00078                            const char    *format,
00079                            ...) G_GNUC_PRINTF (2, 3);
00080 
00081 void meta_push_no_msg_prefix (void);
00082 void meta_pop_no_msg_prefix  (void);
00083 
00084 gint  meta_unsigned_long_equal (gconstpointer v1,
00085                                 gconstpointer v2);
00086 guint meta_unsigned_long_hash  (gconstpointer v);
00087 
00088 void meta_print_backtrace (void);
00089 
00090 const char* meta_gravity_to_string (int gravity);
00091 
00092 #include <libintl.h>
00093 #define _(x) dgettext (GETTEXT_PACKAGE, x)
00094 #define N_(x) x
00095 
00096 char* meta_g_utf8_strndup (const gchar *src, gsize n);
00097 
00098 void  meta_free_gslist_and_elements (GSList *list_to_deep_free);
00099 
00100 /* To disable verbose mode, we make these functions into no-ops */
00101 #ifdef WITH_VERBOSE_MODE
00102 
00103 #define meta_debug_spew meta_debug_spew_real
00104 #define meta_verbose    meta_verbose_real
00105 #define meta_topic      meta_topic_real
00106 
00107 #else
00108 
00109 #  ifdef G_HAVE_ISO_VARARGS
00110 #    define meta_debug_spew(...)
00111 #    define meta_verbose(...)
00112 #    define meta_topic(...)
00113 #  elif defined(G_HAVE_GNUC_VARARGS)
00114 #    define meta_debug_spew(format...)
00115 #    define meta_verbose(format...)
00116 #    define meta_topic(format...)
00117 #  else
00118 #    error "This compiler does not support varargs macros and thus verbose mode can't be disabled meaningfully"
00119 #  endif
00120 
00121 #endif /* !WITH_VERBOSE_MODE */
00122 
00123 #endif /* META_UTIL_H */
00124 
00125 

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