aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-10-12 12:20:15 +0200
committerEli Zaretskii2012-10-12 12:20:15 +0200
commit4f0800ec2ffdfee7b56062aeac263e5071cf8868 (patch)
treee4e197cbc6c43a205bd04672d529cd317d228423 /src/w32term.c
parent977c647927a5ac5916f4c737e32885f15a1a5b00 (diff)
downloademacs-4f0800ec2ffdfee7b56062aeac263e5071cf8868.tar.gz
emacs-4f0800ec2ffdfee7b56062aeac263e5071cf8868.zip
Some cleanups:
1. If fill_queue returns -1, but there were file notifications, return 0. 2. Move invariant code out of the loop in queue_notifications and handle_file_notifications.
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/w32term.c b/src/w32term.c
index e1a2fbbf824..6d19d9a93ce 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3281,13 +3281,18 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f,
3281 if (notification_buffer_in_use) 3281 if (notification_buffer_in_use)
3282 { 3282 {
3283 DWORD info_size = notifications_size; 3283 DWORD info_size = notifications_size;
3284 Lisp_Object cs = intern ("utf-16le");
3285 Lisp_Object obj = get_watch_object (make_number (notifications_desc));
3284 3286
3285 /* notifications_size could be zero when the buffer of 3287 /* notifications_size could be zero when the buffer of
3286 notifications overflowed on the OS level, or when the 3288 notifications overflowed on the OS level, or when the
3287 directory being watched was itself deleted. Do nothing in 3289 directory being watched was itself deleted. Do nothing in
3288 that case. */ 3290 that case. */
3289 if (info_size) 3291 if (info_size
3292 && !NILP (obj) && CONSP (obj))
3290 { 3293 {
3294 Lisp_Object callback = XCDR (obj);
3295
3291 while (info_size >= min_size) 3296 while (info_size >= min_size)
3292 { 3297 {
3293 Lisp_Object utf_16_fn 3298 Lisp_Object utf_16_fn
@@ -3296,23 +3301,17 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f,
3296 /* Note: mule-conf is preloaded, so utf-16le must 3301 /* Note: mule-conf is preloaded, so utf-16le must
3297 already be defined at this point. */ 3302 already be defined at this point. */
3298 Lisp_Object fname 3303 Lisp_Object fname
3299 = code_convert_string_norecord (utf_16_fn, 3304 = code_convert_string_norecord (utf_16_fn, cs, 0);
3300 intern ("utf-16le"), 0);
3301 Lisp_Object action = lispy_file_action (fni->Action); 3305 Lisp_Object action = lispy_file_action (fni->Action);
3302 Lisp_Object obj;
3303 3306
3304 obj = get_watch_object (make_number (notifications_desc)); 3307 event->kind = FILE_NOTIFY_EVENT;
3305 if (!NILP (obj) && CONSP (obj)) 3308 event->code = (ptrdiff_t)notifications_desc;
3306 { 3309 event->timestamp = msg->msg.time;
3307 event->kind = FILE_NOTIFY_EVENT; 3310 event->modifiers = 0;
3308 event->code = (ptrdiff_t)notifications_desc; 3311 event->frame_or_window = callback;
3309 event->timestamp = msg->msg.time; 3312 event->arg = Fcons (action, fname);
3310 event->modifiers = 0; 3313 kbd_buffer_store_event (event);
3311 event->frame_or_window = XCDR (obj); 3314 (*evcount)++;
3312 event->arg = Fcons (action, fname);
3313 kbd_buffer_store_event (event);
3314 (*evcount)++;
3315 }
3316 3315
3317 if (!fni->NextEntryOffset) 3316 if (!fni->NextEntryOffset)
3318 break; 3317 break;