detached ebc2d33

examples/window: replace deprecated functions (#269)

commit
ebc2d334b58f411935d085ae392018935f7a78bb
author
Hajime Hoshi · · 2024-08-22 11:35 UTC
committer
GitHub · · 2024-08-22 11:35 UTC
parent
a969731
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
1 file · +9 -2
M examples/window/main_windows.go +9 -2
@@ -96,7 +96,10 @@ func init() {
9696 }
9797
9898 func main() {
99- className := windows.StringToUTF16Ptr("Sample Window Class")
99+ className, err := windows.UTF16PtrFromString("Sample Window Class")
100+ if err != nil {
101+ panic(err)
102+ }
100103 inst := GetModuleHandle(className)
101104
102105 wc := WNDCLASSEX{
@@ -114,10 +117,14 @@ func main() {
114117 Right: 320,
115118 Bottom: 240,
116119 }
120+ title, err := windows.UTF16PtrFromString("My Title")
121+ if err != nil {
122+ panic(err)
123+ }
117124 AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false)
118125 hwnd := CreateWindowEx(
119126 0, className,
120- windows.StringToUTF16Ptr("My Title"),
127+ title,
121128 WS_OVERLAPPEDWINDOW,
122129 CW_USEDEFAULT, CW_USEDEFAULT, int(wr.Right-wr.Left), int(wr.Bottom-wr.Top),
123130 0, 0, inst, nil,
@@ -96,7 +96,10 @@ func init() {
96 }96 }
97 97
98 func main() {98 func main() {
99- className := windows.StringToUTF16Ptr("Sample Window Class")99+ className, err := windows.UTF16PtrFromString("Sample Window Class")
100+ if err != nil {
101+ panic(err)
102+ }
100 inst := GetModuleHandle(className)103 inst := GetModuleHandle(className)
101 104
102 wc := WNDCLASSEX{105 wc := WNDCLASSEX{
@@ -114,10 +117,14 @@ func main() {
114 Right: 320,117 Right: 320,
115 Bottom: 240,118 Bottom: 240,
116 }119 }
120+ title, err := windows.UTF16PtrFromString("My Title")
121+ if err != nil {
122+ panic(err)
123+ }
117 AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false)124 AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false)
118 hwnd := CreateWindowEx(125 hwnd := CreateWindowEx(
119 0, className,126 0, className,
120- windows.StringToUTF16Ptr("My Title"),127+ title,
121 WS_OVERLAPPEDWINDOW,128 WS_OVERLAPPEDWINDOW,
122 CW_USEDEFAULT, CW_USEDEFAULT, int(wr.Right-wr.Left), int(wr.Bottom-wr.Top),129 CW_USEDEFAULT, CW_USEDEFAULT, int(wr.Right-wr.Left), int(wr.Bottom-wr.Top),
123 0, 0, inst, nil,130 0, 0, inst, nil,

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close