Mercurial > emacs
comparison src/xterm.c @ 732:a8d94735277e
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 30 Jun 1992 13:54:21 +0000 |
parents | 540b047ece4d |
children | 4714ad36583c |
comparison
equal
deleted
inserted
replaced
731:5c6db33a9ef6 | 732:a8d94735277e |
---|---|
1520 the server for pointer motion hints. This means that we get only | 1520 the server for pointer motion hints. This means that we get only |
1521 one event per group of mouse movements. "Groups" are delimited by | 1521 one event per group of mouse movements. "Groups" are delimited by |
1522 other kinds of events (focus changes and button clicks, for | 1522 other kinds of events (focus changes and button clicks, for |
1523 example), or by XQueryPointer calls; when one of these happens, we | 1523 example), or by XQueryPointer calls; when one of these happens, we |
1524 get another MotionNotify event the next time the mouse moves. This | 1524 get another MotionNotify event the next time the mouse moves. This |
1525 is at least as efficient than getting motion events when mouse | 1525 is at least as efficient as getting motion events when mouse |
1526 tracking is on, and I suspect only negligibly worse when tracking | 1526 tracking is on, and I suspect only negligibly worse when tracking |
1527 is off. | 1527 is off. |
1528 | 1528 |
1529 The silly O'Reilly & Associates Nutshell guides barely document | 1529 The silly O'Reilly & Associates Nutshell guides barely document |
1530 pointer motion hints at all (I think you have to infer how they | 1530 pointer motion hints at all (I think you have to infer how they |
1533 the server, which is very important. */ | 1533 the server, which is very important. */ |
1534 | 1534 |
1535 /* Where the mouse was last time we reported a mouse event. */ | 1535 /* Where the mouse was last time we reported a mouse event. */ |
1536 static SCREEN_PTR last_mouse_screen; | 1536 static SCREEN_PTR last_mouse_screen; |
1537 static XRectangle last_mouse_glyph; | 1537 static XRectangle last_mouse_glyph; |
1538 | |
1539 /* This is a hack. We would really prefer that XTmouse_position would | |
1540 return the time associated with the position it returns, but there | |
1541 doesn't seem to be any way to wrest the timestamp from the server | |
1542 along with the position query. So, we just keep track of the time | |
1543 of the last movement we received, and return that in hopes that | |
1544 it's somewhat accurate. */ | |
1545 static Time last_mouse_movement_time; | |
1538 | 1546 |
1539 /* Function to report a mouse movement to the mainstream Emacs code. | 1547 /* Function to report a mouse movement to the mainstream Emacs code. |
1540 The input handler calls this. | 1548 The input handler calls this. |
1541 | 1549 |
1542 We have received a mouse movement event, which is given in *event. | 1550 We have received a mouse movement event, which is given in *event. |
1547 note_mouse_position (screen, event) | 1555 note_mouse_position (screen, event) |
1548 SCREEN_PTR screen; | 1556 SCREEN_PTR screen; |
1549 XMotionEvent *event; | 1557 XMotionEvent *event; |
1550 | 1558 |
1551 { | 1559 { |
1560 last_mouse_movement_time = event->time; | |
1561 | |
1552 /* Has the mouse moved off the glyph it was on at the last sighting? */ | 1562 /* Has the mouse moved off the glyph it was on at the last sighting? */ |
1553 if (event->x < last_mouse_glyph.x | 1563 if (event->x < last_mouse_glyph.x |
1554 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width | 1564 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width |
1555 || event->y < last_mouse_glyph.y | 1565 || event->y < last_mouse_glyph.y |
1556 || event->y >= last_mouse_glyph.y + last_mouse_glyph.height) | 1566 || event->y >= last_mouse_glyph.y + last_mouse_glyph.height) |
1578 | 1588 |
1579 static void | 1589 static void |
1580 XTmouse_position (s, x, y, time) | 1590 XTmouse_position (s, x, y, time) |
1581 SCREEN_PTR *s; | 1591 SCREEN_PTR *s; |
1582 Lisp_Object *x, *y; | 1592 Lisp_Object *x, *y; |
1583 Lisp_Object *time; | 1593 unsigned long *time; |
1584 { | 1594 { |
1585 int ix, iy, dummy; | 1595 int ix, iy, dummy; |
1586 Display *d = x_current_display; | 1596 Display *d = x_current_display; |
1587 Window guess, root, child; | 1597 Window guess, root, child; |
1588 | 1598 |
1633 } | 1643 } |
1634 | 1644 |
1635 mouse_moved = 0; | 1645 mouse_moved = 0; |
1636 | 1646 |
1637 /* I don't know how to find the time for the last movement; it seems | 1647 /* I don't know how to find the time for the last movement; it seems |
1638 like XQueryPointer ought to return it, but it doesn't. */ | 1648 like XQueryPointer ought to return it, but it doesn't. So, we'll |
1639 *time = Qnil; | 1649 return the time of the last MotionNotify event we received. Note |
1650 that the use of motion hints means that this isn't guaranteed to | |
1651 be accurate at all. */ | |
1652 *time = last_mouse_movement_time; | |
1640 | 1653 |
1641 UNBLOCK_INPUT; | 1654 UNBLOCK_INPUT; |
1642 } | 1655 } |
1643 | 1656 |
1644 | 1657 |