Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
afbee9d8
Commit
afbee9d8
authored
Sep 20, 2010
by
Nigel Tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp/draw/x11: mouse location is a signed integer.
R=r CC=golang-dev
https://golang.org/cl/2192043
parent
1e4b1f93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
src/pkg/exp/draw/x11/conn.go
src/pkg/exp/draw/x11/conn.go
+5
-6
No files found.
src/pkg/exp/draw/x11/conn.go
View file @
afbee9d8
...
...
@@ -218,19 +218,18 @@ func (c *conn) readSocket() {
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
]
)
c
.
mouseState
.
Loc
.
X
=
int
(
int16
(
c
.
buf
[
25
])
<<
8
|
int16
(
c
.
buf
[
24
])
)
c
.
mouseState
.
Loc
.
Y
=
int
(
int16
(
c
.
buf
[
27
])
<<
8
|
int16
(
c
.
buf
[
26
])
)
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
// window with XShape'd rounded corners over our window). In that case, the X server
//
will send a
count (in bytes 16-17) of the number of additional expose events coming.
// window with XShape'd rounded corners over our window). In that case, the X server
will
//
send a uint16
count (in bytes 16-17) of the number of additional expose events coming.
// We could parse each event for the (x, y, width, height) and maintain a minimal dirty
// rectangle, but for now, the simplest approach is to paint the entire window, when
// receiving the final event in the series.
count
:=
int
(
c
.
buf
[
17
])
<<
8
|
int
(
c
.
buf
[
16
])
if
count
==
0
{
if
c
.
buf
[
17
]
==
0
&&
c
.
buf
[
16
]
==
0
{
// TODO(nigeltao): Should we ignore the very first expose event? A freshly mapped window
// will trigger expose, but until the first c.FlushImage call, there's probably nothing to
// paint but black. For an 800x600 window, at 4 bytes per pixel, each repaint writes about
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment