]> Cypherpunks repositories - gostls13.git/commitdiff
exp/draw: reintroduce the MouseEvent.Nsec timestamp.
authorNigel Tao <nigeltao@golang.org>
Tue, 7 Sep 2010 13:42:01 +0000 (23:42 +1000)
committerNigel Tao <nigeltao@golang.org>
Tue, 7 Sep 2010 13:42:01 +0000 (23:42 +1000)
R=rsc
CC=golang-dev
https://golang.org/cl/2166042

src/pkg/exp/draw/event.go
src/pkg/exp/draw/x11/conn.go

index 05237c21780679f1d2d0e54b088ee244e1322006..c4ec43702ace5b01723fbfbb346b77c1a0b38e3e 100644 (file)
@@ -39,6 +39,8 @@ type MouseEvent struct {
        Buttons int
        // Loc is the location of the cursor.
        Loc image.Point
+       // Nsec is the event's timestamp.
+       Nsec int64
 }
 
 // A ConfigEvent is sent each time the window's color model or size changes.
index fd51aa2b8be16d42c08076dba9326f542f62d82b..7c9588326301cddc39d5339d9aea0686c42751ab 100644 (file)
@@ -19,6 +19,7 @@ import (
        "os"
        "strconv"
        "strings"
+       "time"
 )
 
 type resID uint32 // X resource IDs.
@@ -208,12 +209,12 @@ func (c *conn) pumper() {
                        } else {
                                c.mouseState.Buttons &^= mask
                        }
-                       // TODO(nigeltao): update mouseState's timestamp.
+                       c.mouseState.Nsec = time.Nanoseconds()
                        c.eventc <- c.mouseState
                case 0x06: // Motion notify.
                        c.mouseState.Loc.X = int(c.buf[25])<<8 | int(c.buf[24])
                        c.mouseState.Loc.Y = int(c.buf[27])<<8 | int(c.buf[26])
-                       // TODO(nigeltao): update mouseState's timestamp.
+                       c.mouseState.Nsec = time.Nanoseconds()
                        c.eventc <- c.mouseState
                case 0x0c: // Expose.
                        // A single user action could trigger multiple expose events (e.g. if moving another