aleksej patch for segv on moving window to a new desk if its negative desk

count :)


SVN revision: 18817
This commit is contained in:
Carsten Haitzler 2005-12-04 03:25:34 +00:00
parent d8c635f964
commit 9bb58eca2c
2 changed files with 37 additions and 3 deletions

View File

@ -700,11 +700,43 @@ ACT_FN_GO(window_desk_move_by)
{
E_Desk *desk;
int dx, dy;
int to_x = 0, to_y = 0;
e_desk_xy_get(bd->desk, &dx, &dy);
desk = e_desk_at_xy_get(bd->zone, dx + x, dy + y);
to_x = dx + x; to_y = dy + y;
while( ( desk = e_desk_at_xy_get(bd->zone, to_x , to_y ) ) == NULL )
{
// here we are out of our desktop range
while( to_x >= bd->zone->desk_x_count )
{
to_x -= bd->zone->desk_x_count;
to_y ++;
}
while( to_x < 0 )
{
to_x += bd->zone->desk_x_count;
to_y --;
}
while( to_y >= bd->zone->desk_y_count )
{
to_y -= bd->zone->desk_y_count;
}
while( to_y < 0 )
{
to_y += bd->zone->desk_y_count;
}
}
if (desk)
e_border_desk_set(bd, desk);
{
// switch desktop. Quite usefull from the interface point of view.
e_zone_desk_flip_by( bd->zone, to_x - dx , to_y - dy );
// send the border to the required desktop.
e_border_desk_set(bd, desk);
e_border_focus_set( bd, 1, 1);
}
}
}

View File

@ -313,7 +313,9 @@ e_desk_at_xy_get(E_Zone *zone, int x, int y)
if ((x >= zone->desk_x_count) || (y >= zone->desk_y_count))
return NULL;
else if ((x < 0) || (y < 0))
return NULL;
return zone->desks[x + (y * zone->desk_x_count)];
}