1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-06 16:25:50 +01:00

Bug fixes related to global icons in Clip.

This commit is contained in:
dan
1999-05-17 01:31:16 +00:00
parent 237fa3ce01
commit b06fb162df
3 changed files with 55 additions and 11 deletions

View File

@@ -2535,6 +2535,7 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
{ {
WScreen *scr = dock->screen_ptr; WScreen *scr = dock->screen_ptr;
WAppIcon *btn; WAppIcon *btn;
WAppIconChain *chain;
unsigned char *slot_map; unsigned char *slot_map;
int mwidth; int mwidth;
int r; int r;
@@ -2542,10 +2543,14 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
int i, done = False; int i, done = False;
int corner; int corner;
int sx=0, sy=0, ex=scr->scr_width, ey=scr->scr_height; int sx=0, sy=0, ex=scr->scr_width, ey=scr->scr_height;
int extra_count=0;
if (dock->type == WM_CLIP &&
dock != scr->workspaces[scr->current_workspace]->clip)
extra_count = scr->global_icon_count;
/* if the dock is full */ /* if the dock is full */
if (dock->icon_count >= dock->max_icons) { if (dock->icon_count+extra_count >= dock->max_icons) {
return False; return False;
} }
@@ -2606,7 +2611,15 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
vmap[btn->yindex] = 1; vmap[btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount) else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount)
hmap[btn->xindex] = 1; hmap[btn->xindex] = 1;
} }
for (chain=scr->global_icons; chain!=NULL; chain=chain->next) {
btn = chain->aicon;
if (btn->xindex==0 && btn->yindex > 0 && btn->yindex < vcount)
vmap[btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount)
hmap[btn->xindex] = 1;
}
break;
case C_NW: case C_NW:
for (i=0; i<dock->max_icons; i++) { for (i=0; i<dock->max_icons; i++) {
btn = dock->icon_array[i]; btn = dock->icon_array[i];
@@ -2617,7 +2630,15 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
vmap[btn->yindex] = 1; vmap[btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount) else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount)
hmap[-btn->xindex] = 1; hmap[-btn->xindex] = 1;
} }
for (chain=scr->global_icons; chain!=NULL; chain=chain->next) {
btn = chain->aicon;
if (btn->xindex==0 && btn->yindex > 0 && btn->yindex < vcount)
vmap[btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount)
hmap[-btn->xindex] = 1;
}
break;
case C_SE: case C_SE:
for (i=0; i<dock->max_icons; i++) { for (i=0; i<dock->max_icons; i++) {
btn = dock->icon_array[i]; btn = dock->icon_array[i];
@@ -2628,7 +2649,15 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
vmap[-btn->yindex] = 1; vmap[-btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount) else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount)
hmap[btn->xindex] = 1; hmap[btn->xindex] = 1;
} }
for (chain=scr->global_icons; chain!=NULL; chain=chain->next) {
btn = chain->aicon;
if (btn->xindex==0 && btn->yindex < 0 && btn->yindex > -vcount)
vmap[-btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex>0 && btn->xindex<hcount)
hmap[btn->xindex] = 1;
}
break;
case C_SW: case C_SW:
default: default:
for (i=0; i<dock->max_icons; i++) { for (i=0; i<dock->max_icons; i++) {
@@ -2641,6 +2670,13 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount) else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount)
hmap[-btn->xindex] = 1; hmap[-btn->xindex] = 1;
} }
for (chain=scr->global_icons; chain!=NULL; chain=chain->next) {
btn = chain->aicon;
if (btn->xindex==0 && btn->yindex < 0 && btn->yindex > -vcount)
vmap[-btn->yindex] = 1;
else if (btn->yindex==0 && btn->xindex<0 &&btn->xindex>-hcount)
hmap[-btn->xindex] = 1;
}
} }
x=0; y=0; x=0; y=0;
done = 0; done = 0;
@@ -2703,6 +2739,9 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
if (btn) if (btn)
slot_map[XY2OFS(btn->xindex, btn->yindex)] = 1; slot_map[XY2OFS(btn->xindex, btn->yindex)] = 1;
} }
for (chain=scr->global_icons; chain!=NULL; chain=chain->next) {
slot_map[XY2OFS(chain->aicon->xindex, chain->aicon->yindex)] = 1;
}
/* Find closest slot from the center that is free by scanning the /* Find closest slot from the center that is free by scanning the
* map from the center to outward in circular passes. * map from the center to outward in circular passes.
* This will not result in a neat layout, but will be optimal * This will not result in a neat layout, but will be optimal
@@ -4191,7 +4230,6 @@ iconCanBeOmnipresent(WAppIcon *aicon)
WDock *clip; WDock *clip;
WAppIcon *btn; WAppIcon *btn;
int i, j; int i, j;
Bool ocupied = False;
for (i=0; i<scr->workspace_count; i++) { for (i=0; i<scr->workspace_count; i++) {
clip = scr->workspaces[i]->clip; clip = scr->workspaces[i]->clip;
@@ -4199,16 +4237,17 @@ iconCanBeOmnipresent(WAppIcon *aicon)
if (clip == aicon->dock) if (clip == aicon->dock)
continue; continue;
if (clip->icon_count + scr->global_icon_count >= clip->max_icons)
return False; /* Clip is full in some workspace */
for (j=0; j<clip->max_icons; j++) { for (j=0; j<clip->max_icons; j++) {
btn = clip->icon_array[j]; btn = clip->icon_array[j];
if(btn && btn->xindex==aicon->xindex && btn->yindex==aicon->yindex) { if(btn && btn->xindex==aicon->xindex && btn->yindex==aicon->yindex)
ocupied = True; return False;
break;
}
} }
} }
return !ocupied; return True;
} }
@@ -4240,6 +4279,7 @@ wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent)
tmp->next = new_entry; tmp->next = new_entry;
} }
scr->global_icon_count++;
} else { } else {
aicon->omnipresent = 0; aicon->omnipresent = 0;
status = WO_FAILED; status = WO_FAILED;
@@ -4250,6 +4290,7 @@ wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent)
tmp = scr->global_icons->next; tmp = scr->global_icons->next;
free(scr->global_icons); free(scr->global_icons);
scr->global_icons = tmp; scr->global_icons = tmp;
scr->global_icon_count--;
} else { } else {
tmp = scr->global_icons; tmp = scr->global_icons;
while (tmp->next) { while (tmp->next) {
@@ -4257,6 +4298,7 @@ wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent)
tmp1 = tmp->next->next; tmp1 = tmp->next->next;
free(tmp->next); free(tmp->next);
tmp->next = tmp1; tmp->next = tmp1;
scr->global_icon_count--;
break; break;
} }
tmp = tmp->next; tmp = tmp->next;

View File

@@ -252,7 +252,8 @@ panelBtnCallback(WMWidget *self, void *data)
_("Sorry, icon cannot be made omnipresent. " _("Sorry, icon cannot be made omnipresent. "
"Please make sure that no other icon is " "Please make sure that no other icon is "
"docked in the same position on the other " "docked in the same position on the other "
"workspaces, and try again."), "workspaces, and the Clip is not full in "
"some workspace, then try again."),
_("OK"), NULL, NULL); _("OK"), NULL, NULL);
return; return;
} }

View File

@@ -236,6 +236,7 @@ typedef struct _WScreen {
struct WMenu *clip_ws_menu; /* workspace menu for clip */ struct WMenu *clip_ws_menu; /* workspace menu for clip */
struct WDock *last_dock; struct WDock *last_dock;
WAppIconChain *global_icons; /* for omnipresent icons chain in clip */ WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
int global_icon_count; /* How many global icons do we have */
Window clip_balloon; /* window for workspace name */ Window clip_balloon; /* window for workspace name */