comparison src/event-msw.c @ 534:a0266879cecf

[xemacs-hg @ 2001-05-14 04:16:17 by mta] * event-msw.c (mswindows_need_event_in_modal_loop): (mswindows_need_event): Fix indentation.
author mta
date Mon, 14 May 2001 04:16:19 +0000
parents 0493e9f3c27f
children c69610198c35
comparison
equal deleted inserted replaced
533:f38950946dcf 534:a0266879cecf
1367 if (mswindows_pending_timers_count == 0) 1367 if (mswindows_pending_timers_count == 0)
1368 error ("Deadlock due to an attempt to call next-event in a wrong context"); 1368 error ("Deadlock due to an attempt to call next-event in a wrong context");
1369 1369
1370 /* Fetch and dispatch any pending timers */ 1370 /* Fetch and dispatch any pending timers */
1371 if (GetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0) 1371 if (GetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0)
1372 DispatchMessage (&msg); 1372 DispatchMessage (&msg);
1373 } 1373 }
1374 } 1374 }
1375 1375
1376 /* 1376 /*
1377 * This drains the event queue and fills up two internal queues until 1377 * This drains the event queue and fills up two internal queues until
1399 else 1399 else
1400 { 1400 {
1401 EMACS_SET_SECS_USECS (sometime, 0, 0); 1401 EMACS_SET_SECS_USECS (sometime, 0, 0);
1402 EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block); 1402 EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block);
1403 pointer_to_this = &select_time_to_block; 1403 pointer_to_this = &select_time_to_block;
1404 if (mswindows_in_modal_loop) 1404 if (mswindows_in_modal_loop)
1405 /* In modal loop with badly_p false, don't care about 1405 /* In modal loop with badly_p false, don't care about
1406 Windows events. */ 1406 Windows events. */
1407 FD_CLR (windows_fd, &temp_mask); 1407 FD_CLR (windows_fd, &temp_mask);
1408 } 1408 }
1409 1409
1410 active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this); 1410 active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);
1411 1411
1412 if (active == 0) 1412 if (active == 0)
1416 } 1416 }
1417 else if (active > 0) 1417 else if (active > 0)
1418 { 1418 {
1419 if (FD_ISSET (windows_fd, &temp_mask)) 1419 if (FD_ISSET (windows_fd, &temp_mask))
1420 { 1420 {
1421 if (mswindows_in_modal_loop) 1421 if (mswindows_in_modal_loop)
1422 mswindows_need_event_in_modal_loop (badly_p); 1422 mswindows_need_event_in_modal_loop (badly_p);
1423 else 1423 else
1424 mswindows_drain_windows_queue (); 1424 mswindows_drain_windows_queue ();
1425 } 1425 }
1426 else 1426 else
1427 { 1427 {
1428 #ifdef HAVE_TTY 1428 #ifdef HAVE_TTY
1429 /* Look for a TTY event */ 1429 /* Look for a TTY event */
1486 } 1486 }
1487 #else 1487 #else
1488 /* Now try getting a message or process event */ 1488 /* Now try getting a message or process event */
1489 DWORD what_events; 1489 DWORD what_events;
1490 if (mswindows_in_modal_loop) 1490 if (mswindows_in_modal_loop)
1491 /* In a modal loop, only look for timer events, and only if 1491 /* In a modal loop, only look for timer events, and only if
1492 we really need one. */ 1492 we really need one. */
1493 { 1493 {
1494 if (badly_p) 1494 if (badly_p)
1495 what_events = QS_TIMER; 1495 what_events = QS_TIMER;
1496 else 1496 else
1497 what_events = 0; 1497 what_events = 0;
1498 } 1498 }
1499 else 1499 else
1500 /* Look for any event */ 1500 /* Look for any event */
1501 what_events = QS_ALLINPUT; 1501 what_events = QS_ALLINPUT;
1502 1502
1503 active = MsgWaitForMultipleObjects (mswindows_waitable_count, 1503 active = MsgWaitForMultipleObjects (mswindows_waitable_count,
1504 mswindows_waitable_handles, 1504 mswindows_waitable_handles,
1505 FALSE, badly_p ? INFINITE : 0, 1505 FALSE, badly_p ? INFINITE : 0,
1506 what_events); 1506 what_events);
1507 1507
1508 /* This will assert if handle being waited for becomes abandoned. 1508 /* This will assert if handle being waited for becomes abandoned.
1509 Not the case currently tho */ 1509 Not the case currently tho */
1510 assert ((!badly_p && active == WAIT_TIMEOUT) || 1510 assert ((!badly_p && active == WAIT_TIMEOUT) ||
1511 (active >= WAIT_OBJECT_0 && 1511 (active >= WAIT_OBJECT_0 &&
1517 return; 1517 return;
1518 } 1518 }
1519 else if (active == WAIT_OBJECT_0 + mswindows_waitable_count) 1519 else if (active == WAIT_OBJECT_0 + mswindows_waitable_count)
1520 { 1520 {
1521 /* Got your message, thanks */ 1521 /* Got your message, thanks */
1522 if (mswindows_in_modal_loop) 1522 if (mswindows_in_modal_loop)
1523 mswindows_need_event_in_modal_loop (badly_p); 1523 mswindows_need_event_in_modal_loop (badly_p);
1524 else 1524 else
1525 mswindows_drain_windows_queue (); 1525 mswindows_drain_windows_queue ();
1526 } 1526 }
1527 else 1527 else
1528 { 1528 {
1529 int ix = active - WAIT_OBJECT_0; 1529 int ix = active - WAIT_OBJECT_0;
1530 /* First, try to find which process' output has signaled */ 1530 /* First, try to find which process' output has signaled */
1537 } 1537 }
1538 else 1538 else
1539 { 1539 {
1540 /* None. This means that the process handle itself has signaled. 1540 /* None. This means that the process handle itself has signaled.
1541 Remove the handle from the wait vector, and make status_notify 1541 Remove the handle from the wait vector, and make status_notify
1542 note the exited process. First find the process object if 1542 note the exited process. First find the process object if
1543 possible. */ 1543 possible. */
1544 LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail) 1544 LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail)
1545 if (get_nt_process_handle (XPROCESS (vaffanculo)) == 1545 if (get_nt_process_handle (XPROCESS (vaffanculo)) ==
1546 mswindows_waitable_handles [ix]) 1546 mswindows_waitable_handles [ix])
1547 break; 1547 break;
1548 mswindows_waitable_handles [ix] = 1548 mswindows_waitable_handles [ix] =
1549 mswindows_waitable_handles [--mswindows_waitable_count]; 1549 mswindows_waitable_handles [--mswindows_waitable_count];
1550 kick_status_notify (); 1550 kick_status_notify ();
1551 /* We need to return a process event here so that 1551 /* We need to return a process event here so that
1552 (1) accept-process-output will return when called on this 1552 (1) accept-process-output will return when called on this
1553 process, and (2) status notifications will happen in 1553 process, and (2) status notifications will happen in
1554 accept-process-output, sleep-for, and sit-for. */ 1554 accept-process-output, sleep-for, and sit-for. */
1555 /* #### horrible kludge till my real process fixes go in. 1555 /* #### horrible kludge till my real process fixes go in.
1556 #### Replaced with a slightly less horrible kluge that 1556 #### Replaced with a slightly less horrible kluge that
1557 at least finds the right process instead of axing the 1557 at least finds the right process instead of axing the
1558 first one on the list. 1558 first one on the list.
1559 */ 1559 */
1560 if (!NILP (vproctail)) 1560 if (!NILP (vproctail))
1561 { 1561 {
1562 mswindows_enqueue_process_event (XPROCESS (vaffanculo)); 1562 mswindows_enqueue_process_event (XPROCESS (vaffanculo));
1563 } 1563 }
1564 else /* trash me soon. */ 1564 else /* trash me soon. */
1565 /* Have to return something: there may be no accompanying 1565 /* Have to return something: there may be no accompanying