comparison src/event-Xt.c @ 294:4b85ae5eabfb r21-0b45

Import from CVS: tag r21-0b45
author cvs
date Mon, 13 Aug 2007 10:38:01 +0200
parents 558f606b08ae
children 9ea74add5d37
comparison
equal deleted inserted replaced
293:403535bfea94 294:4b85ae5eabfb
1683 static void 1683 static void
1684 emacs_Xt_remove_timeout (int id) 1684 emacs_Xt_remove_timeout (int id)
1685 { 1685 {
1686 struct Xt_timeout *timeout, *t2; 1686 struct Xt_timeout *timeout, *t2;
1687 1687
1688 timeout = NULL;
1689
1688 /* Find the timeout on the list of pending ones, if it's still there. */ 1690 /* Find the timeout on the list of pending ones, if it's still there. */
1689 if (!pending_timeouts) return; 1691 if (pending_timeouts)
1690 if (id == pending_timeouts->id) 1692 {
1691 { 1693 if (id == pending_timeouts->id)
1692 timeout = pending_timeouts; 1694 {
1693 pending_timeouts = pending_timeouts->next; 1695 timeout = pending_timeouts;
1694 } 1696 pending_timeouts = pending_timeouts->next;
1695 else 1697 }
1696 { 1698 else
1697 t2 = pending_timeouts; 1699 {
1698 while (t2->next && t2->next->id != id) t2 = t2->next; 1700 t2 = pending_timeouts;
1699 if (! t2->next) return; 1701 while (t2->next && t2->next->id != id) t2 = t2->next;
1700 timeout = t2->next; 1702 if ( t2->next) /*found it */
1701 t2->next = t2->next->next; 1703 {
1702 } 1704 timeout = t2->next;
1703 1705 t2->next = t2->next->next;
1704 /* At this point, we've found the thing on the list of pending timeouts, 1706 }
1705 and removed it. 1707 }
1706 */ 1708 /* if it was pending, we have removed it from the list */
1707 1709 if (timeout)
1708 XtRemoveTimeOut (timeout->interval_id); 1710 XtRemoveTimeOut (timeout->interval_id);
1709 Blocktype_free (the_Xt_timeout_blocktype, timeout); 1711 }
1712
1713 /* It could be that the Xt call back was already called but we didn't convert
1714 into an Emacs event yet */
1715 if (!timeout && completed_timeouts)
1716 {
1717 /* Code duplication! */
1718 if (id == completed_timeouts->id)
1719 {
1720 timeout = completed_timeouts;
1721 completed_timeouts = completed_timeouts->next;
1722 }
1723 else
1724 {
1725 t2 = completed_timeouts;
1726 while (t2->next && t2->next->id != id) t2 = t2->next;
1727 if ( t2->next) /*found it */
1728 {
1729 timeout = t2->next;
1730 t2->next = t2->next->next;
1731 }
1732 }
1733 }
1734
1735 /* If we found the thing on the lists of timeouts,
1736 and removed it, deallocate
1737 */
1738 if (timeout)
1739 Blocktype_free (the_Xt_timeout_blocktype, timeout);
1710 } 1740 }
1711 1741
1712 static void 1742 static void
1713 Xt_timeout_to_emacs_event (struct Lisp_Event *emacs_event) 1743 Xt_timeout_to_emacs_event (struct Lisp_Event *emacs_event)
1714 { 1744 {