1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-28 10:55:48 +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:
dan
2001-04-15 01:22:56 +00:00
parent a41b8993e5
commit 046403dbbb
27 changed files with 581 additions and 662 deletions

View File

@@ -337,7 +337,7 @@ typedef struct W_View {
struct W_View *nextSister; /* next on parent's children list */
WMBag *eventHandlers; /* event handlers for this window */
WMArray *eventHandlers; /* event handlers for this window */
unsigned long attribFlags;
XSetWindowAttributes attribs;
@@ -481,8 +481,6 @@ void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
WMReliefType relief,
GC black, GC dark, GC light, GC white);
void W_CleanUpEvents(W_View *view);
void W_CallDestroyHandlers(W_View *view);
void W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,

View File

@@ -178,6 +178,7 @@ typedef struct {
} WMHashTableCallbacks;
typedef int WMArrayIterator;
typedef void *WMBagIterator;
@@ -415,7 +416,9 @@ void* WMReplaceInArray(WMArray *array, int index, void *item);
*/
int WMDeleteFromArray(WMArray *array, int index);
int WMRemoveFromArray(WMArray *array, void *item);
#define WMRemoveFromArray(array, item) WMRemoveFromArrayMatching(array, NULL, item)
int WMRemoveFromArrayMatching(WMArray *array, WMMatchDataProc *match, void *cdata);
void* WMGetFromArray(WMArray *array, int index);
@@ -442,6 +445,24 @@ void WMMapArray(WMArray *array, void (*function)(void*, void*), void *data);
WMArray* WMGetSubarrayWithRange(WMArray* array, WMRange aRange);
void* WMArrayFirst(WMArray *array, WMArrayIterator *iter);
void* WMArrayLast(WMArray *array, WMArrayIterator *iter);
/* The following 2 functions assume that the array doesn't change between calls */
void* WMArrayNext(WMArray *array, WMArrayIterator *iter);
void* WMArrayPrevious(WMArray *array, WMArrayIterator *iter);
/* The following 2 macros assume that the array doesn't change in the for loop */
#define WM_ITERATE_ARRAY(array, var, i) \
for (var = WMArrayFirst(array, &(i)); (i) != WANotFound; \
var = WMArrayNext(array, &(i)))
#define WM_ETARETI_ARRAY(array, var, i) \
for (var = WMArrayLast(array, &(i)); (i) != WANotFound; \
var = WMArrayPrevious(array, &(i)))
/*..........................................................................*/
@@ -514,6 +535,7 @@ void* WMBagFirst(WMBag *bag, WMBagIterator *ptr);
void* WMBagLast(WMBag *bag, WMBagIterator *ptr);
/* The following 4 functions assume that the bag doesn't change between calls */
void* WMBagNext(WMBag *bag, WMBagIterator *ptr);
void* WMBagPrevious(WMBag *bag, WMBagIterator *ptr);
@@ -523,6 +545,7 @@ void* WMBagIteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr);
int WMBagIndexForIterator(WMBag *bag, WMBagIterator ptr);
/* The following 2 macros assume that the bag doesn't change in the for loop */
#define WM_ITERATE_BAG(bag, var, i) \
for (var = WMBagFirst(bag, &(i)); (i) != NULL; \
var = WMBagNext(bag, &(i)))