Mercurial > hg > xemacs-beta
comparison src/event-msw.c @ 487:54fa1a5c2d12
[xemacs-hg @ 2001-04-28 07:48:36 by ben]
misc changes, some for 21.4
remove bogus lines setting zmacs_region_stays to 0.
remove debug lines.
Correct general info about init file.
Fix up Cygwin section.
More contributions.
Fix spurious setting of zmacs-region-stays to t after a non-shift
motion command.
Sync up with FSF 20.7, to fix bugs handling some etags line formats.
Move non-window-system specific code that was duplicated in
all window systems into the generic code.
* gutter.el (init-gutter): Removed. (unused)
Clean up the rectangle code w.r.t. selections. You'll now get
the right text copied into the primary selection (but not the
clipboard yet, unfortunately -- that really requires defining
our own rectangle type).
author | ben |
---|---|
date | Sat, 28 Apr 2001 07:48:46 +0000 |
parents | 5aa1854ad537 |
children | 7039e6323819 |
comparison
equal
deleted
inserted
replaced
486:a83afd50994d | 487:54fa1a5c2d12 |
---|---|
1338 * | 1338 * |
1339 * To detect this, we use a counter of active timers, and allow | 1339 * To detect this, we use a counter of active timers, and allow |
1340 * fetching WM_TIMER messages. Instead of trying to fetch a WM_TIMER | 1340 * fetching WM_TIMER messages. Instead of trying to fetch a WM_TIMER |
1341 * which will never come when there are no pending timers, which leads | 1341 * which will never come when there are no pending timers, which leads |
1342 * to deadlock, we simply signal an error. | 1342 * to deadlock, we simply signal an error. |
1343 * | |
1344 * It might be possible to combine this with mswindows_drain_windows_queue | |
1345 * which fetches events when not in a modal loop. It's not clear | |
1346 * whether the result would be more complex than is justified. | |
1343 */ | 1347 */ |
1344 static void | 1348 static void |
1345 mswindows_need_event_in_modal_loop (int badly_p) | 1349 mswindows_need_event_in_modal_loop (int badly_p) |
1346 { | 1350 { |
1347 MSG msg; | 1351 MSG msg; |
1361 /* We'll deadlock if go waiting */ | 1365 /* We'll deadlock if go waiting */ |
1362 if (mswindows_pending_timers_count == 0) | 1366 if (mswindows_pending_timers_count == 0) |
1363 error ("Deadlock due to an attempt to call next-event in a wrong context"); | 1367 error ("Deadlock due to an attempt to call next-event in a wrong context"); |
1364 | 1368 |
1365 /* Fetch and dispatch any pending timers */ | 1369 /* Fetch and dispatch any pending timers */ |
1366 GetMessage (&msg, NULL, WM_TIMER, WM_TIMER); | 1370 if (GetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0) |
1367 DispatchMessage (&msg); | 1371 DispatchMessage (&msg); |
1368 } | 1372 } |
1369 } | 1373 } |
1370 | 1374 |
1371 /* | 1375 /* |
1372 * This drains the event queue and fills up two internal queues until | 1376 * This drains the event queue and fills up two internal queues until |
1378 static void | 1382 static void |
1379 mswindows_need_event (int badly_p) | 1383 mswindows_need_event (int badly_p) |
1380 { | 1384 { |
1381 int active; | 1385 int active; |
1382 | 1386 |
1383 if (mswindows_in_modal_loop) | |
1384 { | |
1385 mswindows_need_event_in_modal_loop (badly_p); | |
1386 return; | |
1387 } | |
1388 | |
1389 while (NILP (mswindows_u_dispatch_event_queue) | 1387 while (NILP (mswindows_u_dispatch_event_queue) |
1390 && NILP (mswindows_s_dispatch_event_queue)) | 1388 && NILP (mswindows_s_dispatch_event_queue)) |
1391 { | 1389 { |
1392 #ifdef HAVE_MSG_SELECT | 1390 #ifdef HAVE_MSG_SELECT |
1393 int i; | 1391 int i; |
1400 else | 1398 else |
1401 { | 1399 { |
1402 EMACS_SET_SECS_USECS (sometime, 0, 0); | 1400 EMACS_SET_SECS_USECS (sometime, 0, 0); |
1403 EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block); | 1401 EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block); |
1404 pointer_to_this = &select_time_to_block; | 1402 pointer_to_this = &select_time_to_block; |
1403 if (mswindows_in_modal_loop) | |
1404 /* In modal loop with badly_p false, don't care about | |
1405 Windows events. */ | |
1406 FD_CLR (windows_fd, &temp_mask); | |
1405 } | 1407 } |
1406 | 1408 |
1407 active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this); | 1409 active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this); |
1408 | 1410 |
1409 if (active == 0) | 1411 if (active == 0) |
1413 } | 1415 } |
1414 else if (active > 0) | 1416 else if (active > 0) |
1415 { | 1417 { |
1416 if (FD_ISSET (windows_fd, &temp_mask)) | 1418 if (FD_ISSET (windows_fd, &temp_mask)) |
1417 { | 1419 { |
1418 mswindows_drain_windows_queue (); | 1420 if (mswindows_in_modal_loop) |
1421 mswindows_need_event_in_modal_loop (badly_p); | |
1422 else | |
1423 mswindows_drain_windows_queue (); | |
1419 } | 1424 } |
1420 else | 1425 else |
1421 { | 1426 { |
1422 #ifdef HAVE_TTY | 1427 #ifdef HAVE_TTY |
1423 /* Look for a TTY event */ | 1428 /* Look for a TTY event */ |
1478 { | 1483 { |
1479 assert(0); | 1484 assert(0); |
1480 } | 1485 } |
1481 #else | 1486 #else |
1482 /* Now try getting a message or process event */ | 1487 /* Now try getting a message or process event */ |
1488 DWORD what_events; | |
1489 if (mswindows_in_modal_loop) | |
1490 /* In a modal loop, only look for timer events, and only if | |
1491 we really need one. */ | |
1492 { | |
1493 if (badly_p) | |
1494 what_events = QS_TIMER; | |
1495 else | |
1496 what_events = 0; | |
1497 } | |
1498 else | |
1499 /* Look for any event */ | |
1500 what_events = QS_ALLINPUT; | |
1501 | |
1483 active = MsgWaitForMultipleObjects (mswindows_waitable_count, | 1502 active = MsgWaitForMultipleObjects (mswindows_waitable_count, |
1484 mswindows_waitable_handles, | 1503 mswindows_waitable_handles, |
1485 FALSE, badly_p ? INFINITE : 0, | 1504 FALSE, badly_p ? INFINITE : 0, |
1486 QS_ALLINPUT); | 1505 what_events); |
1487 | 1506 |
1488 /* This will assert if handle being waited for becomes abandoned. | 1507 /* This will assert if handle being waited for becomes abandoned. |
1489 Not the case currently tho */ | 1508 Not the case currently tho */ |
1490 assert ((!badly_p && active == WAIT_TIMEOUT) || | 1509 assert ((!badly_p && active == WAIT_TIMEOUT) || |
1491 (active >= WAIT_OBJECT_0 && | 1510 (active >= WAIT_OBJECT_0 && |
1497 return; | 1516 return; |
1498 } | 1517 } |
1499 else if (active == WAIT_OBJECT_0 + mswindows_waitable_count) | 1518 else if (active == WAIT_OBJECT_0 + mswindows_waitable_count) |
1500 { | 1519 { |
1501 /* Got your message, thanks */ | 1520 /* Got your message, thanks */ |
1502 mswindows_drain_windows_queue (); | 1521 if (mswindows_in_modal_loop) |
1522 mswindows_need_event_in_modal_loop (badly_p); | |
1523 else | |
1524 mswindows_drain_windows_queue (); | |
1503 } | 1525 } |
1504 else | 1526 else |
1505 { | 1527 { |
1506 int ix = active - WAIT_OBJECT_0; | 1528 int ix = active - WAIT_OBJECT_0; |
1507 /* First, try to find which process' output has signaled */ | 1529 /* First, try to find which process' output has signaled */ |
1514 } | 1536 } |
1515 else | 1537 else |
1516 { | 1538 { |
1517 /* None. This means that the process handle itself has signaled. | 1539 /* None. This means that the process handle itself has signaled. |
1518 Remove the handle from the wait vector, and make status_notify | 1540 Remove the handle from the wait vector, and make status_notify |
1519 note the exited process */ | 1541 note the exited process. First find the process object if |
1542 possible. */ | |
1543 LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail) | |
1544 if (get_nt_process_handle (XPROCESS (vaffanculo)) == | |
1545 mswindows_waitable_handles [ix]) | |
1546 break; | |
1520 mswindows_waitable_handles [ix] = | 1547 mswindows_waitable_handles [ix] = |
1521 mswindows_waitable_handles [--mswindows_waitable_count]; | 1548 mswindows_waitable_handles [--mswindows_waitable_count]; |
1522 kick_status_notify (); | 1549 kick_status_notify (); |
1523 /* We need to return a process event here so that | 1550 /* We need to return a process event here so that |
1524 (1) accept-process-output will return when called on this | 1551 (1) accept-process-output will return when called on this |
1525 process, and (2) status notifications will happen in | 1552 process, and (2) status notifications will happen in |
1526 accept-process-output, sleep-for, and sit-for. */ | 1553 accept-process-output, sleep-for, and sit-for. */ |
1527 /* #### horrible kludge till my real process fixes go in. | 1554 /* #### horrible kludge till my real process fixes go in. |
1555 #### Replaced with a slightly less horrible kluge that | |
1556 at least finds the right process instead of axing the | |
1557 first one on the list. | |
1528 */ | 1558 */ |
1529 if (!NILP (Vprocess_list)) | 1559 if (!NILP (vproctail)) |
1530 { | 1560 { |
1531 Lisp_Object vaffanculo = XCAR (Vprocess_list); | |
1532 mswindows_enqueue_process_event (XPROCESS (vaffanculo)); | 1561 mswindows_enqueue_process_event (XPROCESS (vaffanculo)); |
1533 } | 1562 } |
1534 else /* trash me soon. */ | 1563 else /* trash me soon. */ |
1535 /* Have to return something: there may be no accompanying | 1564 /* Have to return something: there may be no accompanying |
1536 process event */ | 1565 process event */ |