summaryrefslogtreecommitdiff
path: root/src/edge-resistance.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2006-01-02 18:37:46 +0000
committerElijah Newren <newren@src.gnome.org>2006-01-02 18:37:46 +0000
commitebd0c7e9a689f4fa5f203a718bcf8e90917b42b5 (patch)
tree8f2fd1d3a96022c0fb85dcc592ad2fc969c9029c /src/edge-resistance.c
parentd530c3e4052740135e0d0077de3d22f5a6712537 (diff)
downloadmetacity-ebd0c7e9a689f4fa5f203a718bcf8e90917b42b5.tar.gz
Patch from Jens Granseuer to fix build with gcc 2.95. #322622.
2006-01-02 Elijah Newren <newren@gmail.com> Patch from Jens Granseuer to fix build with gcc 2.95. #322622. * src/boxes.c (meta_rectangle_region_to_string, meta_rectangle_edge_list_to_string, fix_up_edges): * src/constraints.c (meta_window_constrain, setup_constraint_info, place_window_if_needed, constrain_maximization, constrain_fullscreen, constrain_size_increments, constrain_size_limits, constrain_aspect_ratio, do_screen_and_xinerama_relative_constrai, constrain_to_single_xinerama, constrain_fully_onscreen, constrain_partially_onscreen): * src/edge-resistance.c (find_nearest_position, apply_edge_resistance, apply_edge_resistance_to_each_side): * src/testboxes.c (test_clamping_to_region, test_clipping_to_region, test_shoving_into_region): * src/window.c (meta_window_new_with_attrs, meta_window_apply_session_info, meta_window_resize, meta_window_resize_with_gravity, meta_window_configure_request): Remove C99 style variable initiailization
Diffstat (limited to 'src/edge-resistance.c')
-rw-r--r--src/edge-resistance.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/edge-resistance.c b/src/edge-resistance.c
index f4d17622..fc96d3c3 100644
--- a/src/edge-resistance.c
+++ b/src/edge-resistance.c
@@ -187,6 +187,7 @@ find_nearest_position (const GArray *edges,
int compare;
MetaEdge *edge;
int best, best_dist, i;
+ gboolean edges_align;
/* Initialize mid, edge, & compare in the off change that the array only
* has one element.
@@ -223,7 +224,7 @@ find_nearest_position (const GArray *edges,
/* Start the search at mid */
edge = g_array_index (edges, MetaEdge*, mid);
compare = horizontal ? edge->rect.x : edge->rect.y;
- gboolean edges_align = horizontal ?
+ edges_align = horizontal ?
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
if (edges_align &&
@@ -243,7 +244,7 @@ find_nearest_position (const GArray *edges,
edge = g_array_index (edges, MetaEdge*, i);
compare = horizontal ? edge->rect.x : edge->rect.y;
- gboolean edges_align = horizontal ?
+ edges_align = horizontal ?
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
@@ -267,7 +268,7 @@ find_nearest_position (const GArray *edges,
edge = g_array_index (edges, MetaEdge*, i);
compare = horizontal ? edge->rect.x : edge->rect.y;
- gboolean edges_align = horizontal ?
+ edges_align = horizontal ?
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
@@ -398,6 +399,8 @@ apply_edge_resistance (MetaWindow *window,
/* Rest is easier to read if we split on keyboard vs. mouse op */
if (keyboard_op)
{
+ int resistance, threshold;
+
/* KEYBOARD ENERGY BUILDUP RESISTANCE: If the user has is moving
* fast enough or has already built up enough "energy", then let
* the user past the edge, otherwise stop at this edge. If the
@@ -406,7 +409,7 @@ apply_edge_resistance (MetaWindow *window,
*/
/* First, determine the amount of the resistance */
- int resistance = 0;
+ resistance = 0;
switch (edge->edge_type)
{
case META_EDGE_WINDOW:
@@ -441,7 +444,7 @@ apply_edge_resistance (MetaWindow *window,
}
/* Determine the threshold */
- int threshold = resistance - resistance_data->keyboard_buildup;
+ threshold = resistance - resistance_data->keyboard_buildup;
/* See if threshold hasn't been met yet or not */
if (ABS (compare - new_pos) < threshold)
@@ -466,6 +469,8 @@ apply_edge_resistance (MetaWindow *window,
}
else /* mouse op */
{
+ int threshold;
+
/* INFINITE RESISTANCE for screen edges under certain cases; If
* the edge is relevant and we're moving towards it and it's a
* screen edge and infinite resistance has been requested for
@@ -529,7 +534,7 @@ apply_edge_resistance (MetaWindow *window,
*/
/* First, determine the threshold */
- int threshold = 0;
+ threshold = 0;
switch (edge->edge_type)
{
case META_EDGE_WINDOW:
@@ -750,9 +755,10 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
void
meta_display_cleanup_edges (MetaDisplay *display)
{
+ guint i,j;
MetaEdgeResistanceData *edge_data = display->grab_edge_resistance_data;
+
g_assert (edge_data != NULL);
- guint i,j;
/* We first need to clean out any window edges */
for (i = 0; i < 4; i++)