gnome-terminal r3223 - in trunk: . src



Author: chpe
Date: Sat Nov 29 20:11:40 2008
New Revision: 3223
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=3223&view=rev

Log:
Make geometry debugging a runtime option instead of a compile-time
option.

Modified:
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/terminal-screen.c
   trunk/src/terminal-window.c
   trunk/src/terminal.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Nov 29 20:11:40 2008
@@ -32,6 +32,7 @@
 IT_PROG_INTLTOOL([0.40.0])
 
 GNOME_COMMON_INIT
+GNOME_DEBUG_CHECK
 GNOME_COMPILE_WARNINGS([maximum])
 GNOME_MAINTAINER_MODE_DEFINES
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Nov 29 20:11:40 2008
@@ -16,6 +16,8 @@
 	terminal-accels.h \
 	terminal-app.c \
 	terminal-app.h \
+	terminal-debug.c \
+	terminal-debug.h \
 	terminal-encoding.c \
 	terminal-encoding.h \
 	terminal-factory-client.h \

Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c	(original)
+++ trunk/src/terminal-screen.c	Sat Nov 29 20:11:40 2008
@@ -34,6 +34,7 @@
 
 #include "terminal-accels.h"
 #include "terminal-app.h"
+#include "terminal-debug.h"
 #include "terminal-intl.h"
 #include "terminal-marshal.h"
 #include "terminal-profile.h"
@@ -189,13 +190,13 @@
   g_slice_free (TagData, tagdata);
 }
 
-#ifdef DEBUG_GEOMETRY
 static void
 parent_size_request (GtkWidget *scrolled_window, GtkRequisition *req, GtkWidget *screen)
 {
-  g_print ("screen %p scrolled-window size req %d : %d\n", screen, req->width, req->height);
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[screen %p] scrolled-window size req %d : %d\n",
+                         screen, req->width, req->height);
 }
-#endif
 
 static void
 parent_parent_set_cb (GtkWidget *widget,
@@ -228,12 +229,13 @@
   if (widget->parent)
     g_signal_connect (widget->parent, "parent-set", G_CALLBACK (parent_parent_set_cb), widget);
 
-#ifdef DEBUG_GEOMETRY
-  if (old_parent)
-    g_signal_handlers_disconnect_by_func (old_parent, G_CALLBACK (parent_size_request), widget);
-  if (widget->parent)
-    g_signal_connect (widget->parent, "size-request", G_CALLBACK (parent_size_request), widget);
-#endif
+  if (_terminal_debug_on (TERMINAL_DEBUG_GEOMETRY))
+    {
+      if (old_parent)
+        g_signal_handlers_disconnect_by_func (old_parent, G_CALLBACK (parent_size_request), widget);
+      if (widget->parent)
+        g_signal_connect (widget->parent, "size-request", G_CALLBACK (parent_size_request), widget);
+    }
 }
 
 static void
@@ -297,20 +299,24 @@
     terminal_screen_change_font (screen);
 }
 
-#ifdef DEBUG_GEOMETRY
-
-static void size_request (GtkWidget *widget, GtkRequisition *req)
+static void
+size_request (GtkWidget *widget,
+              GtkRequisition *req)
 {
-  g_print ("Screen %p size-request %d : %d\n", widget, req->width, req->height);
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[screen %p] size-request %d : %d\n",
+                         widget, req->width, req->height);
 }
 
-static void size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+static void
+size_allocate (GtkWidget *widget,
+               GtkAllocation *allocation)
 {
-  g_print ("Screen %p size-alloc   %d : %d at (%d, %d)\n", widget, allocation->width, allocation->height, allocation->x, allocation->y);
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[screen %p] size-alloc   %d : %d at (%d, %d)\n",
+                         widget, allocation->width, allocation->height, allocation->x, allocation->y);
 }
 
-#endif
-
 static void
 terminal_screen_init (TerminalScreen *screen)
 {
@@ -387,10 +393,11 @@
 
   g_signal_connect (screen, "parent-set", G_CALLBACK (parent_set_callback), NULL);
 
-#ifdef DEBUG_GEOMETRY
-  g_signal_connect_after (screen, "size-request", G_CALLBACK (size_request), NULL);
-  g_signal_connect_after (screen, "size-allocate", G_CALLBACK (size_allocate), NULL);
-#endif
+  if (_terminal_debug_on (TERMINAL_DEBUG_GEOMETRY))
+    {
+      g_signal_connect_after (screen, "size-request", G_CALLBACK (size_request), NULL);
+      g_signal_connect_after (screen, "size-allocate", G_CALLBACK (size_allocate), NULL);
+    }
 }
 
 static void
@@ -1687,7 +1694,7 @@
                                     const char     *title)
 {
   TerminalScreenPrivate *priv = screen->priv;
-  const char *old_title;
+  char *old_title;
 
   old_title = priv->override_title;
   priv->override_title = g_strdup (title);

Modified: trunk/src/terminal-window.c
==============================================================================
--- trunk/src/terminal-window.c	(original)
+++ trunk/src/terminal-window.c	Sat Nov 29 20:11:40 2008
@@ -29,6 +29,7 @@
 #include "skey-popup.h"
 #include "terminal-accels.h"
 #include "terminal-app.h"
+#include "terminal-debug.h"
 #include "terminal-encoding.h"
 #include "terminal-intl.h"
 #include "terminal-screen-container.h"
@@ -2184,9 +2185,10 @@
 
   if (priv->active_screen)
     {
-#ifdef DEBUG_GEOMETRY
-      g_printerr ("setting size after toggling menubar visibility\n");
-#endif
+      _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                             "[window %p] setting size after toggling menubar visibility\n",
+                             window);
+
       terminal_window_set_size (window, priv->active_screen, TRUE);
     }
 }
@@ -2247,11 +2249,11 @@
   gtk_widget_size_request (app, &toplevel_request);
   gtk_widget_size_request (widget, &widget_request);
 
-#ifdef DEBUG_GEOMETRY
-  g_printerr ("set size: toplevel %dx%d widget %dx%d\n",
-           toplevel_request.width, toplevel_request.height,
-           widget_request.width, widget_request.height);
-#endif
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[window %p] set size: toplevel %dx%d widget %dx%d\n",
+                         window,
+                         toplevel_request.width, toplevel_request.height,
+                         widget_request.width, widget_request.height);
   
   w = toplevel_request.width - widget_request.width;
   h = toplevel_request.height - widget_request.height;
@@ -2269,10 +2271,10 @@
   w += xpad * 2 + char_width * grid_width;
   h += ypad * 2 + char_height * grid_height;
 
-#ifdef DEBUG_GEOMETRY
-  g_printerr ("set size: grid %dx%d force %dx%d setting %dx%d pixels\n",
-           grid_width, grid_height, force_grid_width, force_grid_height, w, h);
-#endif
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[window %p] set size: grid %dx%d force %dx%d setting %dx%d pixels\n",
+                         window,
+                         grid_width, grid_height, force_grid_width, force_grid_height, w, h);
 
   if (even_if_mapped && GTK_WIDGET_MAPPED (app)) {
     gtk_window_resize (GTK_WINDOW (app), w, h);
@@ -2328,9 +2330,9 @@
   sync_screen_icon_title (screen, NULL, window);
 
   /* set size of window to current grid size */
-#ifdef DEBUG_GEOMETRY
-  g_printerr ("setting size after flipping notebook pages\n");
-#endif
+  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                         "[window %p] setting size after flipping notebook pages\n",
+                         window);
   terminal_window_set_size (window, screen, TRUE);
 
   terminal_window_update_encoding_menu_active_encoding (window);
@@ -2650,26 +2652,26 @@
                                      GDK_HINT_MIN_SIZE |
                                      GDK_HINT_BASE_SIZE);
 
-#ifdef DEBUG_GEOMETRY
-      g_printerr ("hints: base %dx%d min %dx%d inc %d %d\n",
-               hints.base_width,
-               hints.base_height,
-               hints.min_width,
-               hints.min_height,
-               hints.width_inc,
-               hints.height_inc);
-#endif
+      _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                             "[window %p] hints: base %dx%d min %dx%d inc %d %d\n",
+                             window,
+                             hints.base_width,
+                             hints.base_height,
+                             hints.min_width,
+                             hints.min_height,
+                             hints.width_inc,
+                             hints.height_inc);
       
       priv->old_char_width = hints.width_inc;
       priv->old_char_height = hints.height_inc;
       priv->old_geometry_widget = widget;
     }
-#ifdef DEBUG_GEOMETRY
   else
     {
-      g_printerr ("hints: increment unchanged, not setting\n");
+      _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                             "[window %p] hints: increment unchanged, not setting\n",
+                             window);
     }
-#endif
 }
 
 static void

Modified: trunk/src/terminal.c
==============================================================================
--- trunk/src/terminal.c	(original)
+++ trunk/src/terminal.c	Sat Nov 29 20:11:40 2008
@@ -23,12 +23,6 @@
 
 #include <glib.h>
 
-#include "terminal-intl.h"
-
-#include "terminal-app.h"
-#include "terminal-accels.h"
-#include "terminal-options.h"
-#include "terminal-util.h"
 #include <stdlib.h>
 #include <time.h>
 #include <gdk/gdkx.h>
@@ -42,6 +36,13 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
 
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+#include "terminal-options.h"
+#include "terminal-util.h"
+
 #define TERMINAL_FACTORY_SERVICE_NAME   "org.gnome.Terminal.Factory"
 #define TERMINAL_FACTORY_SERVICE_PATH   "/org/gnome/Terminal/Factory"
 #define TERMINAL_FACTORY_INTERFACE_NAME "org.gnome.Terminal.Factory"
@@ -223,6 +224,8 @@
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
+  _terminal_debug_init ();
+
   /* Make a NULL-terminated copy since we may need it later */
   argv_copy = g_new (char *, argc + 1);
   for (i = 0; i < argc; ++i)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]