comparison src/observer.c @ 822:586e50f82c1f

Unify coding style tag for emacs and vim.
author Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
date Tue, 14 Sep 2010 01:08:39 +0800
parents 29e1b2bffe4c
children e415c55b4a0d
comparison
equal deleted inserted replaced
821:bfdc82bbd6e4 822:586e50f82c1f
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
2 // vim: sw=4:ts=8:sts=4
1 #include <stdio.h> 3 #include <stdio.h>
2 #include "mb_redraw_man.h" 4 #include "mb_redraw_man.h"
3 #include "mb_observer.h" 5 #include "mb_observer.h"
4 #include "mb_tools.h" 6 #include "mb_tools.h"
5 7
39 * SUBF_BUSY means in subject_notify(). 41 * SUBF_BUSY means in subject_notify().
40 */ 42 */
41 subject->flags |= SUBF_FREE; 43 subject->flags |= SUBF_FREE;
42 return; 44 return;
43 } 45 }
44 46
45 if(subject->monitor_sub) { 47 if(subject->monitor_sub) {
46 mevt.event.type = EVT_MONITOR_FREE; 48 mevt.event.type = EVT_MONITOR_FREE;
47 mevt.subject = subject; 49 mevt.subject = subject;
48 mevt.observer = NULL; 50 mevt.observer = NULL;
49 subject_notify(subject->monitor_sub, (event_t *)&mevt); 51 subject_notify(subject->monitor_sub, (event_t *)&mevt);
79 for(observer = STAILQ_HEAD(subject->observers); 81 for(observer = STAILQ_HEAD(subject->observers);
80 observer != NULL; 82 observer != NULL;
81 observer = STAILQ_NEXT(observer_t, next, observer)) { 83 observer = STAILQ_NEXT(observer_t, next, observer)) {
82 if (observer->type == EVT_ANY || observer->type == evt->type) { 84 if (observer->type == EVT_ANY || observer->type == evt->type) {
83 observer->hdr(evt, observer->arg); 85 observer->hdr(evt, observer->arg);
84 86
85 if(evt->flags & EVTF_STOP_NOTIFY) { 87 if(evt->flags & EVTF_STOP_NOTIFY) {
86 stop_propagate = 1; 88 stop_propagate = 1;
87 break; 89 break;
88 } 90 }
89 if(evt->flags & EVTF_STOP_PROPAGATE) 91 if(evt->flags & EVTF_STOP_PROPAGATE)
166 observer_t *observer) { 168 observer_t *observer) {
167 ob_factory_t *factory = subject->factory; 169 ob_factory_t *factory = subject->factory;
168 monitor_event_t mevt; 170 monitor_event_t mevt;
169 171
170 STAILQ_REMOVE(subject->observers, observer_t, next, observer); 172 STAILQ_REMOVE(subject->observers, observer_t, next, observer);
171 173
172 if(subject->monitor_sub) { 174 if(subject->monitor_sub) {
173 mevt.event.type = EVT_MONITOR_REMOVE; 175 mevt.event.type = EVT_MONITOR_REMOVE;
174 mevt.subject = subject; 176 mevt.subject = subject;
175 mevt.observer = observer; 177 mevt.observer = observer;
176 subject_notify(subject->monitor_sub, (event_t *)&mevt); 178 subject_notify(subject->monitor_sub, (event_t *)&mevt);