Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Delta Between Two Patch Sets: src/pkg/exp/wingui/zwinapi.go

Issue 4058046: code review 4058046: windows: multiple improvements and cleanups (Closed)
Left Patch Set: Created 14 years, 1 month ago
Right Patch Set: code review 4058046: windows: multiple improvements and cleanups Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/exp/wingui/gui.go ('k') | src/pkg/runtime/cgocall.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // mksyscall_windows.sh winapi.go 1 // mksyscall_windows.sh winapi.go
2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT 2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
3 3
4 package main 4 package main
5 5
6 import "unsafe" 6 import "unsafe"
7 import "syscall" 7 import "syscall"
8 8
9 var ( 9 var (
10 modkernel32 = loadDll("kernel32.dll") 10 modkernel32 = loadDll("kernel32.dll")
(...skipping 11 matching lines...) Expand all
22 procTranslateMessage = getSysProcAddr(moduser32, "TranslateMessage") 22 procTranslateMessage = getSysProcAddr(moduser32, "TranslateMessage")
23 procDispatchMessageW = getSysProcAddr(moduser32, "DispatchMessageW") 23 procDispatchMessageW = getSysProcAddr(moduser32, "DispatchMessageW")
24 procLoadIconW = getSysProcAddr(moduser32, "LoadIconW") 24 procLoadIconW = getSysProcAddr(moduser32, "LoadIconW")
25 procLoadCursorW = getSysProcAddr(moduser32, "LoadCursorW") 25 procLoadCursorW = getSysProcAddr(moduser32, "LoadCursorW")
26 procSetCursor = getSysProcAddr(moduser32, "SetCursor") 26 procSetCursor = getSysProcAddr(moduser32, "SetCursor")
27 procSendMessageW = getSysProcAddr(moduser32, "SendMessageW") 27 procSendMessageW = getSysProcAddr(moduser32, "SendMessageW")
28 procPostMessageW = getSysProcAddr(moduser32, "PostMessageW") 28 procPostMessageW = getSysProcAddr(moduser32, "PostMessageW")
29 ) 29 )
30 30
31 func GetModuleHandle(modname *uint16) (handle uint32, errno int) { 31 func GetModuleHandle(modname *uint16) (handle uint32, errno int) {
32 » r0, _, e1 := syscall.Syscall(procGetModuleHandleW, uintptr(unsafe.Pointe r(modname))) 32 » r0, _, e1 := syscall.Syscall(procGetModuleHandleW, 1, uintptr(unsafe.Poi nter(modname)), 0, 0)
33 handle = uint32(r0) 33 handle = uint32(r0)
34 if handle == 0 { 34 if handle == 0 {
35 if e1 != 0 { 35 if e1 != 0 {
36 errno = int(e1) 36 errno = int(e1)
37 } else { 37 } else {
38 errno = syscall.EINVAL 38 errno = syscall.EINVAL
39 } 39 }
40 } else { 40 } else {
41 errno = 0 41 errno = 0
42 } 42 }
43 return 43 return
44 } 44 }
45 45
46 func RegisterClassEx(wndclass *Wndclassex) (atom uint16, errno int) { 46 func RegisterClassEx(wndclass *Wndclassex) (atom uint16, errno int) {
47 » r0, _, e1 := syscall.Syscall(procRegisterClassExW, uintptr(unsafe.Pointe r(wndclass))) 47 » r0, _, e1 := syscall.Syscall(procRegisterClassExW, 1, uintptr(unsafe.Poi nter(wndclass)), 0, 0)
48 atom = uint16(r0) 48 atom = uint16(r0)
49 if atom == 0 { 49 if atom == 0 {
50 if e1 != 0 { 50 if e1 != 0 {
51 errno = int(e1) 51 errno = int(e1)
52 } else { 52 } else {
53 errno = syscall.EINVAL 53 errno = syscall.EINVAL
54 } 54 }
55 } else { 55 } else {
56 errno = 0 56 errno = 0
57 } 57 }
58 return 58 return
59 } 59 }
60 60
61 func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style uint32, x int32, y int32, width int32, height int32, wndparent uint32, menu uin t32, instance uint32, param uintptr) (hwnd uint32, errno int) { 61 func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style uint32, x int32, y int32, width int32, height int32, wndparent uint32, menu uin t32, instance uint32, param uintptr) (hwnd uint32, errno int) {
62 » r0, _, e1 := syscall.Syscall(procCreateWindowExW, uintptr(exstyle), uint ptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname)), uintptr(sty le), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(wndparent) , uintptr(menu), uintptr(instance), uintptr(param)) 62 » r0, _, e1 := syscall.Syscall12(procCreateWindowExW, 12, uintptr(exstyle) , uintptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname)), uintp tr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(wndp arent), uintptr(menu), uintptr(instance), uintptr(param))
63 hwnd = uint32(r0) 63 hwnd = uint32(r0)
64 if hwnd == 0 { 64 if hwnd == 0 {
65 if e1 != 0 { 65 if e1 != 0 {
66 errno = int(e1) 66 errno = int(e1)
67 } else { 67 } else {
68 errno = syscall.EINVAL 68 errno = syscall.EINVAL
69 } 69 }
70 } else { 70 } else {
71 errno = 0 71 errno = 0
72 } 72 }
73 return 73 return
74 } 74 }
75 75
76 func DefWindowProc(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult int32) { 76 func DefWindowProc(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult int32) {
77 » r0, _, _ := syscall.Syscall(procDefWindowProcW, uintptr(hwnd), uintptr(m sg), uintptr(wparam), uintptr(lparam)) 77 » r0, _, _ := syscall.Syscall6(procDefWindowProcW, 4, uintptr(hwnd), uintp tr(msg), uintptr(wparam), uintptr(lparam), 0, 0)
78 lresult = int32(r0) 78 lresult = int32(r0)
79 return 79 return
80 } 80 }
81 81
82 func DestroyWindow(hwnd uint32) (ok bool, errno int) { 82 func DestroyWindow(hwnd uint32) (ok bool, errno int) {
83 » r0, _, e1 := syscall.Syscall(procDestroyWindow, uintptr(hwnd)) 83 » r0, _, e1 := syscall.Syscall(procDestroyWindow, 1, uintptr(hwnd), 0, 0)
84 ok = bool(r0 != 0) 84 ok = bool(r0 != 0)
85 if !ok { 85 if !ok {
86 if e1 != 0 { 86 if e1 != 0 {
87 errno = int(e1) 87 errno = int(e1)
88 } else { 88 } else {
89 errno = syscall.EINVAL 89 errno = syscall.EINVAL
90 } 90 }
91 } else { 91 } else {
92 errno = 0 92 errno = 0
93 } 93 }
94 return 94 return
95 } 95 }
96 96
97 func PostQuitMessage(exitcode int32) { 97 func PostQuitMessage(exitcode int32) {
98 » syscall.Syscall(procPostQuitMessage, uintptr(exitcode)) 98 » syscall.Syscall(procPostQuitMessage, 1, uintptr(exitcode), 0, 0)
99 return 99 return
100 } 100 }
101 101
102 func ShowWindow(hwnd uint32, cmdshow int32) (ok bool) { 102 func ShowWindow(hwnd uint32, cmdshow int32) (ok bool) {
103 » r0, _, _ := syscall.Syscall(procShowWindow, uintptr(hwnd), uintptr(cmdsh ow)) 103 » r0, _, _ := syscall.Syscall(procShowWindow, 2, uintptr(hwnd), uintptr(cm dshow), 0)
104 ok = bool(r0 != 0) 104 ok = bool(r0 != 0)
105 return 105 return
106 } 106 }
107 107
108 func UpdateWindow(hwnd uint32) (ok bool, errno int) { 108 func UpdateWindow(hwnd uint32) (ok bool, errno int) {
109 » r0, _, e1 := syscall.Syscall(procUpdateWindow, uintptr(hwnd)) 109 » r0, _, e1 := syscall.Syscall(procUpdateWindow, 1, uintptr(hwnd), 0, 0)
110 ok = bool(r0 != 0) 110 ok = bool(r0 != 0)
111 if !ok { 111 if !ok {
112 if e1 != 0 { 112 if e1 != 0 {
113 errno = int(e1) 113 errno = int(e1)
114 } else { 114 } else {
115 errno = syscall.EINVAL 115 errno = syscall.EINVAL
116 } 116 }
117 } else { 117 } else {
118 errno = 0 118 errno = 0
119 } 119 }
120 return 120 return
121 } 121 }
122 122
123 func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, errno int) { 123 func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, errno int) {
124 » r0, _, e1 := syscall.Syscall(procGetMessageW, uintptr(unsafe.Pointer(msg )), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax)) 124 » r0, _, e1 := syscall.Syscall6(procGetMessageW, 4, uintptr(unsafe.Pointer (msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax), 0, 0)
125 ret = int32(r0) 125 ret = int32(r0)
126 if ret == -1 { 126 if ret == -1 {
127 if e1 != 0 { 127 if e1 != 0 {
128 errno = int(e1) 128 errno = int(e1)
129 } else { 129 } else {
130 errno = syscall.EINVAL 130 errno = syscall.EINVAL
131 } 131 }
132 } else { 132 } else {
133 errno = 0 133 errno = 0
134 } 134 }
135 return 135 return
136 } 136 }
137 137
138 func TranslateMessage(msg *Msg) (ok bool) { 138 func TranslateMessage(msg *Msg) (ok bool) {
139 » r0, _, _ := syscall.Syscall(procTranslateMessage, uintptr(unsafe.Pointer (msg))) 139 » r0, _, _ := syscall.Syscall(procTranslateMessage, 1, uintptr(unsafe.Poin ter(msg)), 0, 0)
140 ok = bool(r0 != 0) 140 ok = bool(r0 != 0)
141 return 141 return
142 } 142 }
143 143
144 func DispatchMessage(msg *Msg) (ret int32) { 144 func DispatchMessage(msg *Msg) (ret int32) {
145 » r0, _, _ := syscall.Syscall(procDispatchMessageW, uintptr(unsafe.Pointer (msg))) 145 » r0, _, _ := syscall.Syscall(procDispatchMessageW, 1, uintptr(unsafe.Poin ter(msg)), 0, 0)
146 ret = int32(r0) 146 ret = int32(r0)
147 return 147 return
148 } 148 }
149 149
150 func LoadIcon(instance uint32, iconname *uint16) (icon uint32, errno int) { 150 func LoadIcon(instance uint32, iconname *uint16) (icon uint32, errno int) {
151 » r0, _, e1 := syscall.Syscall(procLoadIconW, uintptr(instance), uintptr(u nsafe.Pointer(iconname))) 151 » r0, _, e1 := syscall.Syscall(procLoadIconW, 2, uintptr(instance), uintpt r(unsafe.Pointer(iconname)), 0)
152 icon = uint32(r0) 152 icon = uint32(r0)
153 if icon == 0 { 153 if icon == 0 {
154 if e1 != 0 { 154 if e1 != 0 {
155 errno = int(e1) 155 errno = int(e1)
156 } else { 156 } else {
157 errno = syscall.EINVAL 157 errno = syscall.EINVAL
158 } 158 }
159 } else { 159 } else {
160 errno = 0 160 errno = 0
161 } 161 }
162 return 162 return
163 } 163 }
164 164
165 func LoadCursor(instance uint32, cursorname *uint16) (cursor uint32, errno int) { 165 func LoadCursor(instance uint32, cursorname *uint16) (cursor uint32, errno int) {
166 » r0, _, e1 := syscall.Syscall(procLoadCursorW, uintptr(instance), uintptr (unsafe.Pointer(cursorname))) 166 » r0, _, e1 := syscall.Syscall(procLoadCursorW, 2, uintptr(instance), uint ptr(unsafe.Pointer(cursorname)), 0)
167 cursor = uint32(r0) 167 cursor = uint32(r0)
168 if cursor == 0 { 168 if cursor == 0 {
169 if e1 != 0 { 169 if e1 != 0 {
170 errno = int(e1) 170 errno = int(e1)
171 } else { 171 } else {
172 errno = syscall.EINVAL 172 errno = syscall.EINVAL
173 } 173 }
174 } else { 174 } else {
175 errno = 0 175 errno = 0
176 } 176 }
177 return 177 return
178 } 178 }
179 179
180 func SetCursor(cursor uint32) (precursor uint32, errno int) { 180 func SetCursor(cursor uint32) (precursor uint32, errno int) {
181 » r0, _, e1 := syscall.Syscall(procSetCursor, uintptr(cursor)) 181 » r0, _, e1 := syscall.Syscall(procSetCursor, 1, uintptr(cursor), 0, 0)
182 precursor = uint32(r0) 182 precursor = uint32(r0)
183 if precursor == 0 { 183 if precursor == 0 {
184 if e1 != 0 { 184 if e1 != 0 {
185 errno = int(e1) 185 errno = int(e1)
186 } else { 186 } else {
187 errno = syscall.EINVAL 187 errno = syscall.EINVAL
188 } 188 }
189 } else { 189 } else {
190 errno = 0 190 errno = 0
191 } 191 }
192 return 192 return
193 } 193 }
194 194
195 func SendMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult i nt32) { 195 func SendMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult i nt32) {
196 » r0, _, _ := syscall.Syscall(procSendMessageW, uintptr(hwnd), uintptr(msg ), uintptr(wparam), uintptr(lparam)) 196 » r0, _, _ := syscall.Syscall6(procSendMessageW, 4, uintptr(hwnd), uintptr (msg), uintptr(wparam), uintptr(lparam), 0, 0)
197 lresult = int32(r0) 197 lresult = int32(r0)
198 return 198 return
199 } 199 }
200 200
201 func PostMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (ok bool, errno int) { 201 func PostMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (ok bool, errno int) {
202 » r0, _, e1 := syscall.Syscall(procPostMessageW, uintptr(hwnd), uintptr(ms g), uintptr(wparam), uintptr(lparam)) 202 » r0, _, e1 := syscall.Syscall6(procPostMessageW, 4, uintptr(hwnd), uintpt r(msg), uintptr(wparam), uintptr(lparam), 0, 0)
203 ok = bool(r0 != 0) 203 ok = bool(r0 != 0)
204 if !ok { 204 if !ok {
205 if e1 != 0 { 205 if e1 != 0 {
206 errno = int(e1) 206 errno = int(e1)
207 } else { 207 } else {
208 errno = syscall.EINVAL 208 errno = syscall.EINVAL
209 } 209 }
210 } else { 210 } else {
211 errno = 0 211 errno = 0
212 } 212 }
213 return 213 return
214 } 214 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b