diff options
-rw-r--r-- | src/spiceqxl_main_loop.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/spiceqxl_main_loop.c b/src/spiceqxl_main_loop.c index 86dcad3..0213693 100644 --- a/src/spiceqxl_main_loop.c +++ b/src/spiceqxl_main_loop.c @@ -338,6 +338,7 @@ static void xspice_wakeup_handler(pointer data, int nfds, pointer readmask) struct SpiceWatch { int fd; + int event_mask; SpiceWatchFunc func; void *opaque; }; @@ -346,11 +347,11 @@ static void watch_fd_notified(int fd, int xevents, void *data) { SpiceWatch *watch = (SpiceWatch *)data; - if (xevents & X_NOTIFY_READ) { + if ((watch->event_mask & SPICE_WATCH_EVENT_READ) && (xevents & X_NOTIFY_READ)) { watch->func(watch->fd, SPICE_WATCH_EVENT_READ, watch->opaque); } - if (xevents & X_NOTIFY_WRITE) { + if ((watch->event_mask & SPICE_WATCH_EVENT_WRITE) && (xevents & X_NOTIFY_WRITE)) { watch->func(watch->fd, SPICE_WATCH_EVENT_WRITE, watch->opaque); } } @@ -360,6 +361,7 @@ static int watch_update_mask_internal(SpiceWatch *watch, int event_mask) int x_event_mask = 0; SetNotifyFd(watch->fd, NULL, X_NOTIFY_NONE, NULL); + watch->event_mask = 0; if (event_mask & SPICE_WATCH_EVENT_READ) { x_event_mask |= X_NOTIFY_READ; @@ -372,6 +374,7 @@ static int watch_update_mask_internal(SpiceWatch *watch, int event_mask) return -1; } SetNotifyFd(watch->fd, watch_fd_notified, x_event_mask, watch); + watch->event_mask = event_mask; return 0; } |