mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-26 00:12:31 +01:00
- added WMRemoveFromArrayMatching(array, match, cdata), which will remove the
first element in the array that is matched by match(item, cdata)==True. - added WMArrayFirst(), WMArrayLast(), WMArrayNext() and WMArrayPrevious() functions and also WM_ITERATE_ARRAY() and WM_ETARETI_ARRAY() macros, to make interfaces to WMBag and WMArray similar and to make life a little simpler when iterating through all elements of an array. - replaced bags with arrays wherever appropriate. This will improve performance a bit. - replaced some recursive code with iterative code in WINGs/selection.c - some code cleanup is src/
This commit is contained in:
@@ -203,25 +203,17 @@ makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
int index = entry->order-WO_ENTRIES;
|
||||
|
||||
if (scr->shortcutWindows[index]) {
|
||||
WMFreeBag(scr->shortcutWindows[index]);
|
||||
WMFreeArray(scr->shortcutWindows[index]);
|
||||
scr->shortcutWindows[index] = NULL;
|
||||
}
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
WMBag *selwin = scr->selected_windows;
|
||||
int i;
|
||||
|
||||
scr->shortcutWindows[index] = WMCreateBag(4);
|
||||
|
||||
for (i = 0; i < WMGetBagItemCount(selwin); i++) {
|
||||
WWindow *tmp = WMGetFromBag(selwin, i);
|
||||
|
||||
WMPutInBag(scr->shortcutWindows[index], tmp);
|
||||
}
|
||||
scr->shortcutWindows[index] = WMDuplicateArray(scr->selected_windows);
|
||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin);*/
|
||||
} else {
|
||||
scr->shortcutWindows[index] = WMCreateBag(4);
|
||||
|
||||
WMPutInBag(scr->shortcutWindows[index], wwin);
|
||||
scr->shortcutWindows[index] = WMCreateArray(4);
|
||||
WMAddToArray(scr->shortcutWindows[index], wwin);
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
@@ -281,7 +273,7 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
char *tmp;
|
||||
int shortcutNo = i-WO_ENTRIES;
|
||||
WMenuEntry *entry = smenu->entries[i];
|
||||
WMBag *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
|
||||
WMArray *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
|
||||
|
||||
sprintf(buffer, "%s %i", _("Set Shortcut"), shortcutNo+1);
|
||||
|
||||
@@ -289,7 +281,7 @@ updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
entry->flags.indicator_on = 0;
|
||||
} else {
|
||||
entry->flags.indicator_on = 1;
|
||||
if (WMCountInBag(shortSelWindows, wwin))
|
||||
if (WMCountInArray(shortSelWindows, wwin))
|
||||
entry->flags.indicator_type = MI_DIAMOND;
|
||||
else
|
||||
entry->flags.indicator_type = MI_CHECK;
|
||||
|
||||
Reference in New Issue
Block a user