summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren gmail com>2006-03-17 02:55:21 +0000
committerElijah Newren <newren@src.gnome.org>2006-03-17 02:55:21 +0000
commitef47c243c518502b751679a371fcd09b0035784d (patch)
treeff9a7d8441a57a6bcf3e90428b2e3be23f67bb26
parent01cd31f7f4960830c9580a5d7964651577d81e76 (diff)
downloadmetacity-ef47c243c518502b751679a371fcd09b0035784d.tar.gz
Add debugging information for edge resistance
2006-03-16 Elijah Newren <newren gmail com> Add debugging information for edge resistance * src/edge-resistance.c (cache_edges): print out the edges that are being cached if in verbose mode, (meta_window_edge_resistance_for_move, meta_window_edge_resistance_for_resize): if edge resistance kicked in then print out a message about it * src/util.c: * src/util.h: Add META_DEBUG_EDGE_RESISTANCE to MetaDebugTopic enum list
-rw-r--r--ChangeLog14
-rw-r--r--src/edge-resistance.c46
-rw-r--r--src/util.c2
-rw-r--r--src/util.h44
4 files changed, 79 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 05e9fa14..0213f432 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-03-16 Elijah Newren <newren gmail com>
+
+ Add debugging information for edge resistance
+
+ * src/edge-resistance.c (cache_edges): print out the edges that
+ are being cached if in verbose mode,
+ (meta_window_edge_resistance_for_move,
+ meta_window_edge_resistance_for_resize): if edge resistance kicked
+ in then print out a message about it
+
+ * src/util.c:
+ * src/util.h:
+ Add META_DEBUG_EDGE_RESISTANCE to MetaDebugTopic enum list
+
Thu Mar 16 14:55:18 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-screen.c (struct WindowInfo): Maintain the size of the
diff --git a/src/edge-resistance.c b/src/edge-resistance.c
index b1eaadd1..189b9e36 100644
--- a/src/edge-resistance.c
+++ b/src/edge-resistance.c
@@ -747,6 +747,31 @@ cache_edges (MetaDisplay *display,
int i;
/*
+ * 0th: Print debugging information to the log about the edges
+ */
+#ifdef WITH_VERBOSE_MODE
+ if (meta_is_verbose())
+ {
+ int max_edges = MAX (MAX( g_list_length (window_edges),
+ g_list_length (xinerama_edges)),
+ g_list_length (screen_edges));
+ char big_buffer[(EDGE_LENGTH+2)*max_edges];
+
+ meta_rectangle_edge_list_to_string (window_edges, ", ", big_buffer);
+ meta_topic (META_DEBUG_EDGE_RESISTANCE,
+ "Window edges for resistance : %s\n", big_buffer);
+
+ meta_rectangle_edge_list_to_string (xinerama_edges, ", ", big_buffer);
+ meta_topic (META_DEBUG_EDGE_RESISTANCE,
+ "Xinerama edges for resistance: %s\n", big_buffer);
+
+ meta_rectangle_edge_list_to_string (screen_edges, ", ", big_buffer);
+ meta_topic (META_DEBUG_EDGE_RESISTANCE,
+ "Screen edges for resistance : %s\n", big_buffer);
+ }
+#endif
+
+ /*
* 1st: Get the total number of each kind of edge
*/
num_left = num_right = num_top = num_bottom = 0;
@@ -1163,6 +1188,12 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
(BOX_LEFT (*reference) - BOX_LEFT (old_outer));
*new_y = old_y + smaller_y_change +
(BOX_TOP (*reference) - BOX_TOP (old_outer));
+
+ meta_topic (META_DEBUG_EDGE_RESISTANCE,
+ "outer x & y move-to coordinate changed from %d,%d to %d,%d\n",
+ proposed_outer.x, proposed_outer.y,
+ old_outer.x + (*new_x - old_x),
+ old_outer.y + (*new_y - old_y));
}
}
@@ -1181,7 +1212,7 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
gboolean is_keyboard_op)
{
MetaRectangle old_outer, new_outer;
- int new_outer_width, new_outer_height;
+ int proposed_outer_width, proposed_outer_height;
if (window == window->display->grab_window &&
window->display->grab_wireframe_active)
@@ -1194,13 +1225,13 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
{
meta_window_get_outer_rect (window, &old_outer);
}
- new_outer_width = old_outer.width + (*new_width - old_width);
- new_outer_height = old_outer.height + (*new_height - old_height);
+ proposed_outer_width = old_outer.width + (*new_width - old_width);
+ proposed_outer_height = old_outer.height + (*new_height - old_height);
meta_rectangle_resize_with_gravity (&old_outer,
&new_outer,
gravity,
- new_outer_width,
- new_outer_height);
+ proposed_outer_width,
+ proposed_outer_height);
window->display->grab_last_user_action_was_snap = snap;
if (apply_edge_resistance_to_each_side (window->display,
@@ -1213,5 +1244,10 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
{
*new_width = old_width + (new_outer.width - old_outer.width);
*new_height = old_height + (new_outer.height - old_outer.height);
+
+ meta_topic (META_DEBUG_EDGE_RESISTANCE,
+ "outer width & height got changed from %d,%d to %d,%d\n",
+ proposed_outer_width, proposed_outer_height,
+ new_outer.width, new_outer.height);
}
}
diff --git a/src/util.c b/src/util.c
index e5541582..9280df13 100644
--- a/src/util.c
+++ b/src/util.c
@@ -303,6 +303,8 @@ topic_name (MetaDebugTopic topic)
return "SHAPES";
case META_DEBUG_COMPOSITOR:
return "COMPOSITOR";
+ case META_DEBUG_EDGE_RESISTANCE:
+ return "EDGE_RESISTANCE";
}
return "WM";
diff --git a/src/util.h b/src/util.h
index 67c7b015..f51cb88d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -48,28 +48,28 @@ void meta_fatal (const char *format,
typedef enum
{
- META_DEBUG_FOCUS = 1 << 0,
- META_DEBUG_WORKAREA = 1 << 1,
- META_DEBUG_STACK = 1 << 2,
- META_DEBUG_THEMES = 1 << 3,
- META_DEBUG_SM = 1 << 4,
- META_DEBUG_EVENTS = 1 << 5,
- META_DEBUG_WINDOW_STATE = 1 << 6,
- META_DEBUG_WINDOW_OPS = 1 << 7,
- META_DEBUG_GEOMETRY = 1 << 8,
- META_DEBUG_PLACEMENT = 1 << 9,
- META_DEBUG_PING = 1 << 10,
- META_DEBUG_XINERAMA = 1 << 11,
- META_DEBUG_KEYBINDINGS = 1 << 12,
- META_DEBUG_SYNC = 1 << 13,
- META_DEBUG_ERRORS = 1 << 14,
- META_DEBUG_STARTUP = 1 << 15,
- META_DEBUG_PREFS = 1 << 16,
- META_DEBUG_GROUPS = 1 << 17,
- META_DEBUG_RESIZING = 1 << 18,
- META_DEBUG_SHAPES = 1 << 19,
- META_DEBUG_COMPOSITOR = 1 << 20
-
+ META_DEBUG_FOCUS = 1 << 0,
+ META_DEBUG_WORKAREA = 1 << 1,
+ META_DEBUG_STACK = 1 << 2,
+ META_DEBUG_THEMES = 1 << 3,
+ META_DEBUG_SM = 1 << 4,
+ META_DEBUG_EVENTS = 1 << 5,
+ META_DEBUG_WINDOW_STATE = 1 << 6,
+ META_DEBUG_WINDOW_OPS = 1 << 7,
+ META_DEBUG_GEOMETRY = 1 << 8,
+ META_DEBUG_PLACEMENT = 1 << 9,
+ META_DEBUG_PING = 1 << 10,
+ META_DEBUG_XINERAMA = 1 << 11,
+ META_DEBUG_KEYBINDINGS = 1 << 12,
+ META_DEBUG_SYNC = 1 << 13,
+ META_DEBUG_ERRORS = 1 << 14,
+ META_DEBUG_STARTUP = 1 << 15,
+ META_DEBUG_PREFS = 1 << 16,
+ META_DEBUG_GROUPS = 1 << 17,
+ META_DEBUG_RESIZING = 1 << 18,
+ META_DEBUG_SHAPES = 1 << 19,
+ META_DEBUG_COMPOSITOR = 1 << 20,
+ META_DEBUG_EDGE_RESISTANCE = 1 << 21
} MetaDebugTopic;
void meta_topic_real (MetaDebugTopic topic,