mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
Fix removal of drawer with a single appicon
When removing a drawer containing a single appicon, the latter is docked where the drawer was, instead of being totally undocked.
This commit is contained in:
committed by
Carlos R. Mafra
parent
bf6bc79d37
commit
45799efa02
27
src/dock.c
27
src/dock.c
@@ -4382,13 +4382,26 @@ static void drawerDestroy(WDock *drawer)
|
||||
|
||||
wDefaultPurgeInfo(scr, drawer->icon_array[0]->wm_instance,
|
||||
drawer->icon_array[0]->wm_class);
|
||||
icons = WMCreateArray(drawer->icon_count - 1);
|
||||
for (i = 1; i < drawer->max_icons; i++) {
|
||||
if (!(aicon = drawer->icon_array[i]))
|
||||
continue;
|
||||
WMAddToArray(icons, aicon);
|
||||
if (drawer->icon_count == 2) {
|
||||
// Drawer contains a single appicon: dock it where the drawer was
|
||||
for (i = 1; i < drawer->max_icons; i++) {
|
||||
if ((aicon = drawer->icon_array[i]))
|
||||
break;
|
||||
}
|
||||
wDockMoveIconBetweenDocks(drawer, scr->dock, aicon,
|
||||
0, (drawer->y_pos - scr->dock->y_pos) / ICON_SIZE);
|
||||
XMoveWindow(dpy, aicon->icon->core->window, drawer->x_pos, drawer->y_pos);
|
||||
XMapWindow(dpy, aicon->icon->core->window);
|
||||
}
|
||||
else if (drawer->icon_count > 2) {
|
||||
icons = WMCreateArray(drawer->icon_count - 1);
|
||||
for (i = 1; i < drawer->max_icons; i++) {
|
||||
if (!(aicon = drawer->icon_array[i]))
|
||||
continue;
|
||||
WMAddToArray(icons, aicon);
|
||||
}
|
||||
removeIcons(icons, drawer);
|
||||
}
|
||||
removeIcons(icons, drawer);
|
||||
|
||||
if (drawer->auto_collapse_magic) {
|
||||
WMDeleteTimerHandler(drawer->auto_collapse_magic);
|
||||
@@ -4416,7 +4429,7 @@ static void removeDrawerCallback(WMenu *menu, WMenuEntry *entry)
|
||||
WDock *dock = ((WAppIcon*)entry->clientdata)->dock;
|
||||
assert(dock != NULL);
|
||||
|
||||
if (dock->icon_count > 1) {
|
||||
if (dock->icon_count > 2) {
|
||||
if (wMessageDialog(dock->screen_ptr, _("Drawer"),
|
||||
_("All icons in this drawer will be detached!"),
|
||||
_("OK"), _("Cancel"), NULL) != WAPRDefault)
|
||||
|
||||
Reference in New Issue
Block a user