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
This commit is contained in:
Elijah Newren 2006-01-02 18:37:46 +00:00 committed by Elijah Newren
parent d530c3e405
commit ebd0c7e9a6
6 changed files with 115 additions and 79 deletions

View File

@ -1,3 +1,26 @@
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
2006-01-02 Elijah Newren <newren@gmail.com>
* configure.in: post-release version bump to 2.13.13

View File

@ -55,11 +55,12 @@ meta_rectangle_region_to_string (GList *region,
*/
char rect_string[RECT_LENGTH];
GList *tmp = region;
char *cur = output;
if (region == NULL)
snprintf (output, 10, "(EMPTY)");
char *cur = output;
GList *tmp = region;
while (tmp)
{
MetaRectangle *rect = tmp->data;
@ -107,11 +108,12 @@ meta_rectangle_edge_list_to_string (GList *edge_list,
*/
char rect_string[EDGE_LENGTH];
char *cur = output;
GList *tmp = edge_list;
if (edge_list == NULL)
snprintf (output, 10, "(EMPTY)");
char *cur = output;
GList *tmp = edge_list;
while (tmp)
{
MetaEdge *edge = tmp->data;
@ -1453,11 +1455,12 @@ fix_up_edges (MetaRectangle *strut, MetaEdge *edge,
/* If this is the edge that overlaps, then we need to split it */
if (edges_overlap (cur, &overlap))
{
GList *delete_me = tmp;
/* Split this edge into some new ones */
*strut_edges = split_edge (*strut_edges, cur, &overlap);
/* Delete the old one */
GList *delete_me = tmp;
tmp = tmp->next;
g_free (cur);
*strut_edges = g_list_delete_link (*strut_edges, delete_me);

View File

@ -261,6 +261,8 @@ meta_window_constrain (MetaWindow *window,
MetaRectangle *new)
{
ConstraintInfo info;
ConstraintPriority priority = PRIORITY_MINIMUM;
gboolean satisfied = FALSE;
/* WARNING: orig and new specify positions and sizes of the inner window,
* not the outer. This is a common gotcha since half the constraints
@ -282,8 +284,6 @@ meta_window_constrain (MetaWindow *window,
new);
place_window_if_needed (window, &info);
ConstraintPriority priority = PRIORITY_MINIMUM;
gboolean satisfied = FALSE;
while (!satisfied && priority <= PRIORITY_MAXIMUM) {
gboolean check_only = TRUE;
@ -325,6 +325,9 @@ setup_constraint_info (ConstraintInfo *info,
const MetaRectangle *orig,
MetaRectangle *new)
{
const MetaXineramaScreenInfo *xinerama_info;
MetaWorkspace *cur_workspace;
info->orig = *orig;
info->current = *new;
@ -364,11 +367,11 @@ setup_constraint_info (ConstraintInfo *info,
meta_window_get_work_area_current_xinerama (window, &info->work_area_xinerama);
const MetaXineramaScreenInfo *xinerama_info =
xinerama_info =
meta_screen_get_xinerama_for_window (window->screen, window);
info->entire_xinerama = xinerama_info->rect;
MetaWorkspace *cur_workspace = window->screen->active_workspace;
cur_workspace = window->screen->active_workspace;
info->usable_screen_region =
meta_workspace_get_onscreen_region (cur_workspace);
info->usable_xinerama_region =
@ -427,6 +430,8 @@ place_window_if_needed(MetaWindow *window,
!window->fullscreen)
{
MetaRectangle placed_rect = info->orig;
MetaWorkspace *cur_workspace;
const MetaXineramaScreenInfo *xinerama_info;
meta_window_place (window, info->fgeom, info->orig.x, info->orig.y,
&placed_rect.x, &placed_rect.y);
@ -435,13 +440,13 @@ place_window_if_needed(MetaWindow *window,
/* placing the window may have changed the xinerama. Find the
* new xinerama and update the ConstraintInfo
*/
const MetaXineramaScreenInfo *xinerama_info =
xinerama_info =
meta_screen_get_xinerama_for_rect (window->screen, &placed_rect);
info->entire_xinerama = xinerama_info->rect;
meta_window_get_work_area_for_xinerama (window,
xinerama_info->number,
&info->work_area_xinerama);
MetaWorkspace *cur_workspace = window->screen->active_workspace;
cur_workspace = window->screen->active_workspace;
info->usable_xinerama_region =
meta_workspace_get_onxinerama_region (cur_workspace,
xinerama_info->number);
@ -620,6 +625,11 @@ constrain_maximization (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
MetaRectangle min_size, max_size, work_area;
gboolean hminbad, vminbad, hmaxbad, vmaxbad;
gboolean horiz_equal, vert_equal;
gboolean constraint_already_satisfied;
if (priority > PRIORITY_MAXIMIZATION)
return TRUE;
@ -627,12 +637,10 @@ constrain_maximization (MetaWindow *window,
if (!window->maximized_horizontally && !window->maximized_vertically)
return TRUE;
MetaRectangle min_size, max_size;
MetaRectangle work_area = info->work_area_xinerama;
work_area = info->work_area_xinerama;
unextend_by_frame (&work_area, info->fgeom);
get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
gboolean hminbad, vminbad, hmaxbad, vmaxbad;
hminbad = work_area.width < min_size.width && window->maximized_horizontally;
vminbad = work_area.height < min_size.height && window->maximized_vertically;
hmaxbad = work_area.width > max_size.width && window->maximized_horizontally;
@ -641,12 +649,11 @@ constrain_maximization (MetaWindow *window,
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
gboolean horiz_equal, vert_equal;
horiz_equal = work_area.x == info->current.x &&
work_area.width == info->current.width;
vert_equal = work_area.y == info->current.y &&
work_area.height == info->current.height;
gboolean constraint_already_satisfied =
constraint_already_satisfied =
(horiz_equal || !window->maximized_horizontally) &&
(vert_equal || !window->maximized_vertically);
if (check_only || constraint_already_satisfied)
@ -672,22 +679,24 @@ constrain_fullscreen (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
MetaRectangle min_size, max_size, xinerama;
gboolean too_big, too_small, constraint_already_satisfied;
if (priority > PRIORITY_FULLSCREEN)
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
if (!window->fullscreen)
return TRUE;
MetaRectangle min_size, max_size;
MetaRectangle xinerama = info->entire_xinerama;
xinerama = info->entire_xinerama;
get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
gboolean too_big = !meta_rectangle_could_fit_rect (&xinerama, &min_size);
gboolean too_small = !meta_rectangle_could_fit_rect (&max_size, &xinerama);
too_big = !meta_rectangle_could_fit_rect (&xinerama, &min_size);
too_small = !meta_rectangle_could_fit_rect (&max_size, &xinerama);
if (too_big || too_small)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
gboolean constraint_already_satisfied =
constraint_already_satisfied =
meta_rectangle_equal (&info->current, &xinerama);
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
@ -703,6 +712,9 @@ constrain_size_increments (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
int bh, hi, bw, wi, extra_height, extra_width;
gboolean constraint_already_satisfied;
if (priority > PRIORITY_SIZE_HINTS_INCREMENTS)
return TRUE;
@ -712,7 +724,6 @@ constrain_size_increments (MetaWindow *window,
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
int bh, hi, bw, wi, extra_height, extra_width;
bh = window->size_hints.base_height;
hi = window->size_hints.height_inc;
bw = window->size_hints.base_width;
@ -723,7 +734,7 @@ constrain_size_increments (MetaWindow *window,
extra_width *= 0;
if (window->maximized_vertically)
extra_height *= 0;
gboolean constraint_already_satisfied =
constraint_already_satisfied =
(extra_height == 0 && extra_width == 0);
if (check_only || constraint_already_satisfied)
@ -745,6 +756,10 @@ constrain_size_limits (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
MetaRectangle min_size, max_size;
gboolean too_big, too_small, constraint_already_satisfied;
int new_width, new_height;
if (priority > PRIORITY_SIZE_HINTS_LIMITS)
return TRUE;
@ -757,18 +772,14 @@ constrain_size_limits (MetaWindow *window,
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
MetaRectangle min_size, max_size;
get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
gboolean too_big =
!meta_rectangle_could_fit_rect (&info->current, &min_size);
gboolean too_small =
!meta_rectangle_could_fit_rect (&max_size, &info->current);
gboolean constraint_already_satisfied = !too_big && !too_small;
too_big = !meta_rectangle_could_fit_rect (&info->current, &min_size);
too_small = !meta_rectangle_could_fit_rect (&max_size, &info->current);
constraint_already_satisfied = !too_big && !too_small;
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
/*** Enforce constraint ***/
int new_width, new_height;
new_width = CLAMP (info->current.width, min_size.width, max_size.width);
new_height = CLAMP (info->current.height, min_size.height, max_size.height);
meta_rectangle_resize_with_gravity (&info->orig,
@ -785,16 +796,21 @@ constrain_aspect_ratio (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
double minr, maxr;
gboolean constraints_are_inconsistent, constraint_already_satisfied;
int fudge, new_width, new_height;
double best_width, best_height;
double alt_width, alt_height;
if (priority > PRIORITY_ASPECT_RATIO)
return TRUE;
/* Determine whether constraint applies; exit if it doesn't. */
double minr, maxr;
minr = window->size_hints.min_aspect.x /
(double)window->size_hints.min_aspect.y;
maxr = window->size_hints.max_aspect.x /
(double)window->size_hints.max_aspect.y;
gboolean constraints_are_inconsistent = minr > maxr;
constraints_are_inconsistent = minr > maxr;
if (constraints_are_inconsistent ||
META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
info->action_type == ACTION_MOVE)
@ -816,7 +832,6 @@ constrain_aspect_ratio (MetaWindow *window,
* being a resize increment (FIXME: I should handle real resize
* increments better here...)
*/
int fudge;
switch (info->resize_gravity)
{
case WestGravity:
@ -836,16 +851,13 @@ constrain_aspect_ratio (MetaWindow *window,
fudge = 1;
break;
}
gboolean constraint_already_satisfied =
constraint_already_satisfied =
info->current.width - (info->current.height * minr ) > -minr*fudge &&
info->current.width - (info->current.height * maxr ) < maxr*fudge;
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
/*** Enforce constraint ***/
int new_width, new_height;
double best_width, best_height;
double alt_width, alt_height;
new_width = info->current.width;
new_height = info->current.height;
@ -910,7 +922,8 @@ do_screen_and_xinerama_relative_constraints (
ConstraintInfo *info,
gboolean check_only)
{
gboolean exit_early = FALSE;
gboolean exit_early = FALSE, constraint_satisfied;
MetaRectangle how_far_it_can_be_smushed, min_size, max_size;
/* First, log some debugging information */
char spanning_region[1 + 28 * g_list_length (region_spanning_rectangles)];
@ -921,7 +934,6 @@ do_screen_and_xinerama_relative_constraints (
spanning_region));
/* Determine whether constraint applies; exit if it doesn't */
MetaRectangle how_far_it_can_be_smushed, min_size, max_size;
how_far_it_can_be_smushed = info->current;
get_size_limits (window, info->fgeom, TRUE, &min_size, &max_size);
extend_by_frame (&info->current, info->fgeom);
@ -939,7 +951,7 @@ do_screen_and_xinerama_relative_constraints (
exit_early = TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
gboolean constraint_satisfied =
constraint_satisfied =
meta_rectangle_contained_in_region (region_spanning_rectangles,
&info->current);
if (exit_early || constraint_satisfied || check_only)
@ -995,14 +1007,10 @@ constrain_to_single_xinerama (MetaWindow *window,
return TRUE;
/* Have a helper function handle the constraint for us */
gboolean retval =
do_screen_and_xinerama_relative_constraints (window,
return do_screen_and_xinerama_relative_constraints (window,
info->usable_xinerama_region,
info,
check_only);
/* Free up the data we allocated */
return retval;
}
static gboolean
@ -1025,13 +1033,10 @@ constrain_fully_onscreen (MetaWindow *window,
return TRUE;
/* Have a helper function handle the constraint for us */
gboolean retval =
do_screen_and_xinerama_relative_constraints (window,
return do_screen_and_xinerama_relative_constraints (window,
info->usable_screen_region,
info,
check_only);
return retval;
}
static gboolean
@ -1040,6 +1045,9 @@ constrain_partially_onscreen (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
gboolean retval;
int top_amount, bottom_amount, horiz_amount, vert_amount;
if (priority > PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA)
return TRUE;
@ -1058,9 +1066,8 @@ constrain_partially_onscreen (MetaWindow *window,
* Then, the amount that is allowed off is just the window size minus
* this amount.
*/
int top_amount, bottom_amount;
int horiz_amount = info->current.width / 4;
int vert_amount = info->current.height / 4;
horiz_amount = info->current.width / 4;
vert_amount = info->current.height / 4;
horiz_amount = CLAMP (horiz_amount, 10, 75);
vert_amount = CLAMP (vert_amount, 10, 75);
horiz_amount = info->current.width - horiz_amount;
@ -1082,7 +1089,7 @@ constrain_partially_onscreen (MetaWindow *window,
horiz_amount,
top_amount,
bottom_amount);
gboolean retval =
retval =
do_screen_and_xinerama_relative_constraints (window,
info->usable_screen_region,
info,

View File

@ -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)
{
MetaEdgeResistanceData *edge_data = display->grab_edge_resistance_data;
g_assert (edge_data != NULL);
guint i,j;
MetaEdgeResistanceData *edge_data = display->grab_edge_resistance_data;
g_assert (edge_data != NULL);
/* We first need to clean out any window edges */
for (i = 0; i < 4; i++)

View File

@ -706,11 +706,11 @@ test_clamping_to_region ()
MetaRectangle rect;
MetaRectangle min_size;
FixedDirections fixed_directions;
int i;
min_size.height = min_size.width = 1;
fixed_directions = 0;
int i;
region = get_screen_region (3);
for (i = 0; i < NUM_RANDOM_RUNS; i++)
{
@ -817,11 +817,9 @@ test_clipping_to_region ()
{
GList* region;
MetaRectangle rect, temp;
FixedDirections fixed_directions;
fixed_directions = 0;
FixedDirections fixed_directions = 0;
int i;
region = get_screen_region (3);
for (i = 0; i < NUM_RANDOM_RUNS; i++)
{
@ -881,11 +879,9 @@ test_shoving_into_region ()
{
GList* region;
MetaRectangle rect, temp;
FixedDirections fixed_directions;
fixed_directions = 0;
FixedDirections fixed_directions = 0;
int i;
region = get_screen_region (3);
for (i = 0; i < NUM_RANDOM_RUNS; i++)
{

View File

@ -231,6 +231,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
MetaWorkspace *space;
gulong existing_wm_state;
gulong event_mask;
MetaMoveResizeFlags flags;
#define N_INITIAL_PROPS 13
Atom initial_props[N_INITIAL_PROPS];
int i;
@ -698,7 +699,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
* passing TRUE for is_configure_request, ICCCM says
* initial map is handled same as configure request
*/
MetaMoveResizeFlags flags =
flags =
META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
@ -862,6 +863,7 @@ meta_window_apply_session_info (MetaWindow *window,
if (info->geometry_set)
{
int x, y, w, h;
MetaMoveResizeFlags flags;
window->placed = TRUE; /* don't do placement algorithms later */
@ -880,8 +882,7 @@ meta_window_apply_session_info (MetaWindow *window,
"Restoring pos %d,%d size %d x %d for %s\n",
x, y, w, h, window->desc);
MetaMoveResizeFlags flags =
META_DO_GRAVITY_ADJUST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
flags = META_DO_GRAVITY_ADJUST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
window->size_hints.win_gravity,
@ -2989,11 +2990,11 @@ meta_window_resize (MetaWindow *window,
int h)
{
int x, y;
MetaMoveResizeFlags flags;
meta_window_get_position (window, &x, &y);
MetaMoveResizeFlags flags =
(user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
@ -3042,11 +3043,11 @@ meta_window_resize_with_gravity (MetaWindow *window,
int gravity)
{
int x, y;
MetaMoveResizeFlags flags;
meta_window_get_position (window, &x, &y);
MetaMoveResizeFlags flags =
(user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
gravity,
@ -3916,6 +3917,7 @@ meta_window_configure_request (MetaWindow *window,
gboolean only_resize;
gboolean allow_position_change;
gboolean in_grab_op;
MetaMoveResizeFlags flags;
/* We ignore configure requests while the user is moving/resizing
* the window, since these represent the app sucking and fighting
@ -4055,8 +4057,7 @@ meta_window_configure_request (MetaWindow *window,
* have a different setup for meta_window_move_resize_internal()...
*/
MetaMoveResizeFlags flags =
META_IS_CONFIGURE_REQUEST;
flags = META_IS_CONFIGURE_REQUEST;
if (event->xconfigurerequest.value_mask & (CWX | CWY))
flags |= META_IS_MOVE_ACTION;
if (event->xconfigurerequest.value_mask & (CWWidth | CWHeight))