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
dab40b58
Commit
dab40b58
authored
Mar 26, 2010
by
Firmansyah Adiputra
Committed by
Russ Cox
Mar 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xgb: fix request length and request size.
R=nigeltao_golang, rsc CC=golang-dev
https://golang.org/cl/759041
parent
5bb29fb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
src/pkg/xgb/go_client.py
src/pkg/xgb/go_client.py
+10
-7
src/pkg/xgb/xproto.go
src/pkg/xgb/xproto.go
+8
-8
No files found.
src/pkg/xgb/go_client.py
View file @
dab40b58
...
...
@@ -8,6 +8,7 @@ from os.path import basename, exists
import
getopt
import
sys
import
re
import
math
_ns
=
None
...
...
@@ -345,20 +346,22 @@ def go_complex_writer(self, name, void):
go
(
'func (c *Conn) %sRequest('
,
func_name
)
go_complex_writer_arguments
(
param_fields
,
"Cookie {"
)
fixedtotal
=
structsize
(
self
.
fields
)
if
fixedtotal
<=
32
:
go
(
' b := c.scratch[0:%d]'
,
fixedtotal
)
fixedlength
=
math
.
ceil
(
float
(
structsize
(
self
.
fields
))
/
float
(
4
))
fixedsize
=
fixedlength
*
4
if
fixedsize
<=
32
:
go
(
' b := c.scratch[0:%d]'
,
fixedsize
)
else
:
go
(
' b := make([]byte, %d)'
,
fixed
total
)
go
(
' b := make([]byte, %d)'
,
fixed
size
)
firstvar
=
0
for
field
in
wire_fields
:
if
not
field
.
type
.
fixed_size
():
if
not
firstvar
:
firstvar
=
1
go
(
' n := %d'
,
fixed
total
)
go
(
' n := %d'
,
fixed
size
)
go
(
' n += pad(%s * %d)'
,
go_accessor_expr
(
field
.
type
.
expr
,
''
,
True
),
field
.
type
.
size
)
if
not
firstvar
:
go
(
' put16(b[2:], %d)'
,
fixed
total
/
4
)
go
(
' put16(b[2:], %d)'
,
fixed
length
)
else
:
go
(
' put16(b[2:], uint16(n / 4))'
)
go
(
' b[0] = %s'
,
self
.
opcode
)
...
...
@@ -662,7 +665,7 @@ output = {'open' : go_open,
'enum'
:
go_enum
,
'struct'
:
go_struct
,
'union'
:
go_union
,
'request'
:
go_request
,
'request'
:
go_request
,
'event'
:
go_event
,
'error'
:
go_error
}
...
...
src/pkg/xgb/xproto.go
View file @
dab40b58
...
...
@@ -2427,8 +2427,8 @@ func (c *Conn) ListFontsWithInfoReply(cookie Cookie) (*ListFontsWithInfoReply, o
}
func
(
c
*
Conn
)
SetFontPath
(
FontQty
uint16
,
Path
[]
byte
)
{
b
:=
c
.
scratch
[
0
:
6
]
n
:=
6
b
:=
c
.
scratch
[
0
:
8
]
n
:=
8
n
+=
pad
(
len
(
Path
)
*
1
)
put16
(
b
[
2
:
],
uint16
(
n
/
4
))
b
[
0
]
=
51
...
...
@@ -3553,8 +3553,8 @@ func (c *Conn) ListExtensionsReply(cookie Cookie) (*ListExtensionsReply, os.Erro
}
func
(
c
*
Conn
)
ChangeKeyboardMapping
(
KeycodeCount
byte
,
FirstKeycode
byte
,
KeysymsPerKeycode
byte
,
Keysyms
[]
Keysym
)
{
b
:=
c
.
scratch
[
0
:
6
]
n
:=
6
b
:=
c
.
scratch
[
0
:
8
]
n
:=
8
n
+=
pad
((
int
(
KeycodeCount
)
*
int
(
KeysymsPerKeycode
))
*
4
)
put16
(
b
[
2
:
],
uint16
(
n
/
4
))
b
[
0
]
=
100
...
...
@@ -3566,8 +3566,8 @@ func (c *Conn) ChangeKeyboardMapping(KeycodeCount byte, FirstKeycode byte, Keysy
}
func
(
c
*
Conn
)
GetKeyboardMappingRequest
(
FirstKeycode
byte
,
Count
byte
)
Cookie
{
b
:=
c
.
scratch
[
0
:
6
]
put16
(
b
[
2
:
],
1
)
b
:=
c
.
scratch
[
0
:
8
]
put16
(
b
[
2
:
],
2
)
b
[
0
]
=
101
b
[
4
]
=
FirstKeycode
b
[
5
]
=
Count
...
...
@@ -3733,8 +3733,8 @@ const (
)
func
(
c
*
Conn
)
SetScreenSaver
(
Timeout
int16
,
Interval
int16
,
PreferBlanking
byte
,
AllowExposures
byte
)
{
b
:=
c
.
scratch
[
0
:
1
0
]
put16
(
b
[
2
:
],
2
)
b
:=
c
.
scratch
[
0
:
1
2
]
put16
(
b
[
2
:
],
3
)
b
[
0
]
=
107
put16
(
b
[
4
:
],
uint16
(
Timeout
))
put16
(
b
[
6
:
],
uint16
(
Interval
))
...
...
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