46 |
struct responder_info *ri = (struct responder_info *) resp->object; |
struct responder_info *ri = (struct responder_info *) resp->object; |
47 |
bool really_died = false; |
bool really_died = false; |
48 |
|
|
49 |
|
printf ("responder died: %x\n", (int) ri); |
50 |
|
|
51 |
pthread_mutex_lock (&ri->lock); |
pthread_mutex_lock (&ri->lock); |
52 |
really_died = (--ri->ref_count == 0); |
really_died = (--ri->ref_count == 0); |
53 |
pthread_mutex_unlock (&ri->lock); |
pthread_mutex_unlock (&ri->lock); |
54 |
|
|
55 |
if (really_died) |
if (really_died) |
56 |
{ |
{ |
57 |
|
printf ("really died\n"); |
58 |
if (ri->object_died) |
if (ri->object_died) |
59 |
(*ri->object_died) (ri); |
(*ri->object_died) (ri); |
60 |
} |
} |
61 |
|
|
62 |
|
#if 0 |
63 |
ports_destroy_right (ptr); |
ports_destroy_right (ptr); |
64 |
|
#endif |
65 |
} |
} |
66 |
|
|
67 |
void |
void |
172 |
|
|
173 |
/* Post a "mouse-moved" event to all responders for OBJECT. */ |
/* Post a "mouse-moved" event to all responders for OBJECT. */ |
174 |
void |
void |
175 |
responder_post_event_mouse_moved (void *object, int x, int y) |
responder_post_event_mouse_moved (void *object, int x, int y, int rx, int ry) |
176 |
{ |
{ |
177 |
struct responder_info *ri = (struct responder_info *) object; |
struct responder_info *ri = (struct responder_info *) object; |
178 |
struct responder *resp; |
struct responder *resp; |
182 |
{ |
{ |
183 |
if (resp->event_mask & CRUST_EVENT_MOUSE_MOVE |
if (resp->event_mask & CRUST_EVENT_MOUSE_MOVE |
184 |
&& resp->event_port) |
&& resp->event_port) |
185 |
window_server_event_mouse_move (resp->event_port, x, y); |
window_server_event_mouse_move (resp->event_port, x, y, rx, ry); |
186 |
} |
} |
187 |
pthread_mutex_unlock (&ri->lock); |
pthread_mutex_unlock (&ri->lock); |
188 |
} |
} |
223 |
|
|
224 |
/* Post a "mouse-down" event to all responders for OBJECT. */ |
/* Post a "mouse-down" event to all responders for OBJECT. */ |
225 |
void |
void |
226 |
responder_post_event_mouse_down (void *object, int button, int x, int y) |
responder_post_event_mouse_down (void *object, int button, int x, int y, |
227 |
|
int rx, int ry) |
228 |
{ |
{ |
229 |
struct responder_info *ri = (struct responder_info *) object; |
struct responder_info *ri = (struct responder_info *) object; |
230 |
struct responder *resp; |
struct responder *resp; |
234 |
{ |
{ |
235 |
if (resp->event_mask & CRUST_EVENT_MOUSE_DOWN |
if (resp->event_mask & CRUST_EVENT_MOUSE_DOWN |
236 |
&& resp->event_port) |
&& resp->event_port) |
237 |
window_server_event_mouse_down (resp->event_port, button, x, y); |
window_server_event_mouse_down (resp->event_port, |
238 |
|
button, x, y, rx, ry); |
239 |
} |
} |
240 |
pthread_mutex_unlock (&ri->lock); |
pthread_mutex_unlock (&ri->lock); |
241 |
} |
} |
242 |
|
|
243 |
/* Post a "mouse-up" event to all responders for OBJECT. */ |
/* Post a "mouse-up" event to all responders for OBJECT. */ |
244 |
void |
void |
245 |
responder_post_event_mouse_up (void *object, int button, int x, int y) |
responder_post_event_mouse_up (void *object, int button, int x, int y, |
246 |
|
int rx, int ry) |
247 |
{ |
{ |
248 |
struct responder_info *ri = (struct responder_info *) object; |
struct responder_info *ri = (struct responder_info *) object; |
249 |
struct responder *resp; |
struct responder *resp; |
253 |
{ |
{ |
254 |
if (resp->event_mask & CRUST_EVENT_MOUSE_UP |
if (resp->event_mask & CRUST_EVENT_MOUSE_UP |
255 |
&& resp->event_port) |
&& resp->event_port) |
256 |
window_server_event_mouse_up (resp->event_port, button, x, y); |
window_server_event_mouse_up (resp->event_port, |
257 |
|
button, x, y, rx, ry); |
258 |
} |
} |
259 |
pthread_mutex_unlock (&ri->lock); |
pthread_mutex_unlock (&ri->lock); |
260 |
} |
} |