1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Fixes a small bug in grid registration: when an object is placed over another object (can be done manually) and then removed from there, the registration of the covered object is removed as well (that is it's cell is considered empty).

The patch converts desktop_grid[] from Boolean array into array of
counters of objects, which are placed on cells. When object is
placed on /removed from   the screen  the counter gets incremented/decremented.
This commit is contained in:
Eugene Doudine 2014-04-15 18:39:43 +03:00 committed by Jon Trulson
parent 5544a0fb39
commit a9dbe60805

View file

@ -149,7 +149,7 @@ static char DESKTOP_SAVE_NAME[] = ".!dtdesktop";
DesktopData *desktop_data; DesktopData *desktop_data;
Widget widget_dragged; Widget widget_dragged;
DesktopRec *sacredDesktop; DesktopRec *sacredDesktop;
Boolean *desktop_grid; unsigned char *desktop_grid;
unsigned short int desktop_grid_size; unsigned short int desktop_grid_size;
@ -2543,7 +2543,19 @@ RegisterInGrid(
{ {
for (j = (row > 0) ? row : 0; j <= rowHeight ; j++) for (j = (row > 0) ? row : 0; j <= rowHeight ; j++)
{ {
desktop_grid[ desktop_grid_index + (i * numRows) + j] = type; if (type)
{
/* increase count of objects at given cell */
desktop_grid[ desktop_grid_index + (i * numRows) + j] ++;
}
else
{
/* decrease count of objects at given cell */
if (desktop_grid[ desktop_grid_index + (i * numRows) + j] > 0)
{
desktop_grid[ desktop_grid_index + (i * numRows) + j] --;
}
}
} }
} }
} }
@ -2777,7 +2789,7 @@ CalculateRootCoordinates (
ws_num = ((ws_num - 1) * numColumns * numRows); ws_num = ((ws_num - 1) * numColumns * numRows);
while(1) while(1)
{ {
if(desktop_grid[ws_num + (column * numRows) + row] == False) if(desktop_grid[ws_num + (column * numRows) + row] == 0)
{ {
if(numGridsR == 1 && numGridsC == 1) if(numGridsR == 1 && numGridsC == 1)
{ {
@ -2798,8 +2810,7 @@ CalculateRootCoordinates (
{ {
for(j = 0; j < numGridsC; j++) for(j = 0; j < numGridsC; j++)
{ {
if(desktop_grid[ws_num + ((column + j) * numRows) + (row + i)] if(desktop_grid[ws_num + ((column + j) * numRows) + (row + i)] > 0)
== True)
{ {
error = True; error = True;
break; break;
@ -3627,7 +3638,7 @@ InitializeNewWorkspaces (
for(j = 0; j < numColumns; j++) for(j = 0; j < numColumns; j++)
for(k = 0; k < numRows; k++) for(k = 0; k < numRows; k++)
desktop_grid[(i * numRows * numColumns) + desktop_grid[(i * numRows * numColumns) +
(j * numRows) + k] = False; (j * numRows) + k] = 0;
RegisterPanelInGrid( i + 1, RegisterPanelInGrid( i + 1,
DisplayWidth(display,screen), DisplayWidth(display,screen),