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
This commit is contained in:
Elijah Newren 2006-03-17 02:55:21 +00:00 committed by Elijah Newren
parent 01cd31f7f4
commit ef47c243c5
4 changed files with 79 additions and 27 deletions

View File

@ -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> Thu Mar 16 14:55:18 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-screen.c (struct WindowInfo): Maintain the size of the * src/c-screen.c (struct WindowInfo): Maintain the size of the

View File

@ -746,6 +746,31 @@ cache_edges (MetaDisplay *display,
int num_left, num_right, num_top, num_bottom; int num_left, num_right, num_top, num_bottom;
int i; 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 * 1st: Get the total number of each kind of edge
*/ */
@ -1163,6 +1188,12 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
(BOX_LEFT (*reference) - BOX_LEFT (old_outer)); (BOX_LEFT (*reference) - BOX_LEFT (old_outer));
*new_y = old_y + smaller_y_change + *new_y = old_y + smaller_y_change +
(BOX_TOP (*reference) - BOX_TOP (old_outer)); (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) gboolean is_keyboard_op)
{ {
MetaRectangle old_outer, new_outer; 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 && if (window == window->display->grab_window &&
window->display->grab_wireframe_active) 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); meta_window_get_outer_rect (window, &old_outer);
} }
new_outer_width = old_outer.width + (*new_width - old_width); proposed_outer_width = old_outer.width + (*new_width - old_width);
new_outer_height = old_outer.height + (*new_height - old_height); proposed_outer_height = old_outer.height + (*new_height - old_height);
meta_rectangle_resize_with_gravity (&old_outer, meta_rectangle_resize_with_gravity (&old_outer,
&new_outer, &new_outer,
gravity, gravity,
new_outer_width, proposed_outer_width,
new_outer_height); proposed_outer_height);
window->display->grab_last_user_action_was_snap = snap; window->display->grab_last_user_action_was_snap = snap;
if (apply_edge_resistance_to_each_side (window->display, 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_width = old_width + (new_outer.width - old_outer.width);
*new_height = old_height + (new_outer.height - old_outer.height); *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);
} }
} }

View File

@ -303,6 +303,8 @@ topic_name (MetaDebugTopic topic)
return "SHAPES"; return "SHAPES";
case META_DEBUG_COMPOSITOR: case META_DEBUG_COMPOSITOR:
return "COMPOSITOR"; return "COMPOSITOR";
case META_DEBUG_EDGE_RESISTANCE:
return "EDGE_RESISTANCE";
} }
return "WM"; return "WM";

View File

@ -48,28 +48,28 @@ void meta_fatal (const char *format,
typedef enum typedef enum
{ {
META_DEBUG_FOCUS = 1 << 0, META_DEBUG_FOCUS = 1 << 0,
META_DEBUG_WORKAREA = 1 << 1, META_DEBUG_WORKAREA = 1 << 1,
META_DEBUG_STACK = 1 << 2, META_DEBUG_STACK = 1 << 2,
META_DEBUG_THEMES = 1 << 3, META_DEBUG_THEMES = 1 << 3,
META_DEBUG_SM = 1 << 4, META_DEBUG_SM = 1 << 4,
META_DEBUG_EVENTS = 1 << 5, META_DEBUG_EVENTS = 1 << 5,
META_DEBUG_WINDOW_STATE = 1 << 6, META_DEBUG_WINDOW_STATE = 1 << 6,
META_DEBUG_WINDOW_OPS = 1 << 7, META_DEBUG_WINDOW_OPS = 1 << 7,
META_DEBUG_GEOMETRY = 1 << 8, META_DEBUG_GEOMETRY = 1 << 8,
META_DEBUG_PLACEMENT = 1 << 9, META_DEBUG_PLACEMENT = 1 << 9,
META_DEBUG_PING = 1 << 10, META_DEBUG_PING = 1 << 10,
META_DEBUG_XINERAMA = 1 << 11, META_DEBUG_XINERAMA = 1 << 11,
META_DEBUG_KEYBINDINGS = 1 << 12, META_DEBUG_KEYBINDINGS = 1 << 12,
META_DEBUG_SYNC = 1 << 13, META_DEBUG_SYNC = 1 << 13,
META_DEBUG_ERRORS = 1 << 14, META_DEBUG_ERRORS = 1 << 14,
META_DEBUG_STARTUP = 1 << 15, META_DEBUG_STARTUP = 1 << 15,
META_DEBUG_PREFS = 1 << 16, META_DEBUG_PREFS = 1 << 16,
META_DEBUG_GROUPS = 1 << 17, META_DEBUG_GROUPS = 1 << 17,
META_DEBUG_RESIZING = 1 << 18, META_DEBUG_RESIZING = 1 << 18,
META_DEBUG_SHAPES = 1 << 19, META_DEBUG_SHAPES = 1 << 19,
META_DEBUG_COMPOSITOR = 1 << 20 META_DEBUG_COMPOSITOR = 1 << 20,
META_DEBUG_EDGE_RESISTANCE = 1 << 21
} MetaDebugTopic; } MetaDebugTopic;
void meta_topic_real (MetaDebugTopic topic, void meta_topic_real (MetaDebugTopic topic,