X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Ftags.c;fp=ioncore%2Ftags.c;h=f01385d301c8d1f507fe64eca491136cf0de1e1c;hp=383af0c116a0a3a67c2454dd644acfa7757d1b92;hb=de22e45179cb3bafa490294d31d47f361047a30a;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/ioncore/tags.c b/ioncore/tags.c index 383af0c..f01385d 100644 --- a/ioncore/tags.c +++ b/ioncore/tags.c @@ -70,9 +70,9 @@ bool region_is_tagged(WRegion *reg) * Untag all regions. */ EXTL_EXPORT -void ioncore_clear_tags() +void ioncore_tagged_clear() { - while(ioncore_tagged_take_first()!=NULL) + while(ioncore_tagged_first(TRUE)!=NULL) /* nothing */; } @@ -84,28 +84,29 @@ void ioncore_clear_tags() /*EXTL_DOC - * Returns first tagged object. + * Returns first tagged object, untagging it as well if \var{untag}is set. */ EXTL_SAFE EXTL_EXPORT -WRegion *ioncore_tagged_first() +WRegion *ioncore_tagged_first(bool untag) { - return (WRegion*)OBJLIST_FIRST(WRegion*, taglist); -} - - -WRegion *ioncore_tagged_take_first() -{ - WRegion *reg=(WRegion*)objlist_take_first(&taglist); + WRegion *reg; - if(reg!=NULL){ - reg->flags&=~REGION_TAGGED; - region_notify_change(reg, ioncore_g.notifies.tag); + if(!untag){ + reg=(WRegion*)OBJLIST_FIRST(WRegion*, taglist); + }else{ + reg=(WRegion*)objlist_take_first(&taglist); + + if(reg!=NULL){ + reg->flags&=~REGION_TAGGED; + region_notify_change(reg, ioncore_g.notifies.tag); + } } return reg; } + /*EXTL_DOC * Iterate over tagged regions until \var{iterfn} returns \code{false}. * The function itself returns \code{true} if it reaches the end of list