Skip to content

Commit 803eed8

Browse files
committed
fix: Use 32-bit integers in puregotk to match with actual C int types, which are always 32-bit on LLP64 systems, drop manual newTypeQuery hack in favour of the puregotk gobject.TypeQuery
Signed-off-by: Felicitas Pojtinger <[email protected]>
1 parent d0c6d0f commit 803eed8

24 files changed

+57
-277
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,5 @@ require (
127127
modernc.org/sqlite v1.40.0 // indirect
128128
zombiezen.com/go/sqlite v1.4.2 // indirect
129129
)
130+
131+
replace github.com/jwijenbergh/puregotk v0.0.0-20251201161753-28ec1479c381 => ../puregotk

go.mod.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
"type": "archive",
1212
"url": "https://proxy.golang.org/github.com/anacrolix/torrent/@v/v1.59.1.zip"
1313
},
14-
{
15-
"dest": "vendor/github.com/jwijenbergh/puregotk",
16-
"sha256": "2f386c11285dba4ba7bd57f22ba1ac16e93d0fb5a7cc6c4aaae5f6d957867af4",
17-
"strip-components": 3,
18-
"type": "archive",
19-
"url": "https://proxy.golang.org/github.com/jwijenbergh/puregotk/@v/v0.0.0-20251201161753-28ec1479c381.zip"
20-
},
2114
{
2215
"dest": "vendor/github.com/mitchellh/mapstructure",
2316
"sha256": "118d5b2cb65c50dba967fb6d708f450a9caf93f321f8fc99080675b2ee374199",

internal/components/audiotracks_dialog.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func init() {
100100
}
101101
parent.ConnectCloseRequest(&onCloseRequest)
102102

103-
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
103+
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
104104
if keycode == keycodeEscape {
105105
parent.Close()
106106
parent.SetVisible(false)
@@ -134,14 +134,15 @@ func init() {
134134

135135
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
136136

137-
parentQuery := newTypeQuery(adw.WindowGLibType())
137+
var parentQuery gobject.TypeQuery
138+
gobject.NewTypeQuery(adw.WindowGLibType(), &parentQuery)
138139

139140
gTypeAudioTracksDialog = gobject.TypeRegisterStaticSimple(
140141
parentQuery.Type,
141142
"MultiplexAudioTracksDialog",
142-
uint(parentQuery.ClassSize),
143+
parentQuery.ClassSize,
143144
&classInit,
144-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(AudioTracksDialog{}))+uint(unsafe.Sizeof(&AudioTracksDialog{})),
145+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(AudioTracksDialog{})),
145146
&instanceInit,
146147
0,
147148
)

internal/components/controls_window.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (c *ControlsWindow) setup() error {
385385
}
386386
descriptionWindow.ConnectCloseRequest(&onDescCloseRequest)
387387

388-
onDescKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
388+
onDescKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
389389
if keycode == keycodeEscape {
390390
descriptionWindow.Close()
391391
descriptionWindow.SetVisible(false)
@@ -1271,8 +1271,8 @@ func (c *ControlsWindow) setupSubtitleHandlers(subtracks []mediaWithPriorityAndI
12711271
"",
12721272
"")
12731273
filePicker.SetModal(true)
1274-
onFilePickerResponse := func(dialog gtk.NativeDialog, responseId int) {
1275-
if responseId == int(gtk.ResponseAcceptValue) {
1274+
onFilePickerResponse := func(dialog gtk.NativeDialog, responseId int32) {
1275+
if responseId == int32(gtk.ResponseAcceptValue) {
12761276
log.Info().
12771277
Str("path", filePicker.GetFile().GetPath()).
12781278
Msg("Setting subtitles")
@@ -1654,7 +1654,7 @@ func (c *ControlsWindow) setupMediaControls(subtitlesDialog SubtitlesDialog, aud
16541654
dialog.AddController(&escCtrl.EventController)
16551655
dialog.SetTransientFor(&controlsW.ApplicationWindow.Window)
16561656

1657-
onEscKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
1657+
onEscKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
16581658
if keycode == keycodeEscape {
16591659
dialog.Close()
16601660
dialog.SetVisible(false)
@@ -1865,14 +1865,15 @@ func init() {
18651865

18661866
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
18671867

1868-
parentQuery := newTypeQuery(adw.ApplicationWindowGLibType())
1868+
var parentQuery gobject.TypeQuery
1869+
gobject.NewTypeQuery(adw.ApplicationWindowGLibType(), &parentQuery)
18691870

18701871
gTypeControlsWindow = gobject.TypeRegisterStaticSimple(
18711872
parentQuery.Type,
18721873
"MultiplexControlsWindow",
1873-
uint(parentQuery.ClassSize),
1874+
parentQuery.ClassSize,
18741875
&classInit,
1875-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(ControlsWindow{}))+uint(unsafe.Sizeof(&ControlsWindow{})),
1876+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(ControlsWindow{}))+uint32(unsafe.Sizeof(&ControlsWindow{})),
18761877
&instanceInit,
18771878
0,
18781879
)

internal/components/description_window.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func init() {
107107
}
108108
parent.ConnectCloseRequest(&onCloseRequest)
109109

110-
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
110+
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
111111
if keycode == keycodeEscape {
112112
parent.Close()
113113
parent.SetVisible(false)
@@ -127,14 +127,15 @@ func init() {
127127

128128
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
129129

130-
parentQuery := newTypeQuery(adw.WindowGLibType())
130+
var parentQuery gobject.TypeQuery
131+
gobject.NewTypeQuery(adw.WindowGLibType(), &parentQuery)
131132

132133
gTypeDescriptionWindow = gobject.TypeRegisterStaticSimple(
133134
parentQuery.Type,
134135
"MultiplexDescriptionWindow",
135-
uint(parentQuery.ClassSize),
136+
parentQuery.ClassSize,
136137
&classInit,
137-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(DescriptionWindow{}))+uint(unsafe.Sizeof(&DescriptionWindow{})),
138+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(DescriptionWindow{}))+uint32(unsafe.Sizeof(&DescriptionWindow{})),
138139
&instanceInit,
139140
0,
140141
)

internal/components/error_dialog.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ func init() {
117117

118118
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
119119

120-
parentQuery := newTypeQuery(adw.AlertDialogGLibType())
120+
var parentQuery gobject.TypeQuery
121+
gobject.NewTypeQuery(adw.AlertDialogGLibType(), &parentQuery)
121122

122123
gTypeErrorDialog = gobject.TypeRegisterStaticSimple(
123124
parentQuery.Type,
124125
"MultiplexErrorDialog",
125-
uint(parentQuery.ClassSize),
126+
parentQuery.ClassSize,
126127
&classInit,
127-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(ErrorDialog{}))+uint(unsafe.Sizeof(&ErrorDialog{}))+uint(unsafe.Sizeof(adw.AlertDialog{})), // TODO: Figure out why we need the extra `adw.AlertDialog` here
128+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(ErrorDialog{}))+uint32(unsafe.Sizeof(&ErrorDialog{}))+uint32(unsafe.Sizeof(adw.AlertDialog{})), // TODO: Figure out why we need the extra `adw.AlertDialog` here
128129
&instanceInit,
129130
0,
130131
)

internal/components/main_window.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,14 +915,15 @@ func init() {
915915

916916
var windowInstanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
917917

918-
windowParentQuery := newTypeQuery(adw.ApplicationWindowGLibType())
918+
var windowParentQuery gobject.TypeQuery
919+
gobject.NewTypeQuery(adw.ApplicationWindowGLibType(), &windowParentQuery)
919920

920921
gTypeMainWindow = gobject.TypeRegisterStaticSimple(
921922
windowParentQuery.Type,
922923
"MultiplexMainWindow",
923-
uint(windowParentQuery.ClassSize),
924+
windowParentQuery.ClassSize,
924925
&windowClassInit,
925-
uint(windowParentQuery.InstanceSize)+uint(unsafe.Sizeof(MainWindow{}))+uint(unsafe.Sizeof(&MainWindow{})),
926+
windowParentQuery.InstanceSize+uint32(unsafe.Sizeof(MainWindow{}))+uint32(unsafe.Sizeof(&MainWindow{})),
926927
&windowInstanceInit,
927928
0,
928929
)

internal/components/preferences_dialog.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func (p *PreferencesDialog) setupCallbacks() {
163163
"",
164164
"")
165165
filePicker.SetModal(true)
166-
onFilePickerResponse := func(dialog gtk.NativeDialog, responseId int) {
167-
if responseId == int(gtk.ResponseAcceptValue) {
166+
onFilePickerResponse := func(dialog gtk.NativeDialog, responseId int32) {
167+
if responseId == int32(gtk.ResponseAcceptValue) {
168168
p.settings.SetString(resources.SchemaStorageKey, filePicker.GetFile().GetPath())
169169

170170
p.markPreferencesChanged()
@@ -286,14 +286,15 @@ func init() {
286286

287287
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
288288

289-
parentQuery := newTypeQuery(adw.PreferencesWindowGLibType())
289+
var parentQuery gobject.TypeQuery
290+
gobject.NewTypeQuery(adw.PreferencesWindowGLibType(), &parentQuery)
290291

291292
gTypePreferencesDialog = gobject.TypeRegisterStaticSimple(
292293
parentQuery.Type,
293294
"MultiplexPreferencesDialog",
294-
uint(parentQuery.ClassSize),
295+
parentQuery.ClassSize,
295296
&classInit,
296-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(PreferencesDialog{}))+uint(unsafe.Sizeof(&PreferencesDialog{})),
297+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(PreferencesDialog{}))+uint32(unsafe.Sizeof(&PreferencesDialog{})),
297298
&instanceInit,
298299
0,
299300
)

internal/components/preparing_window.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func init() {
9898
}
9999
parent.ConnectCloseRequest(&onCloseRequest)
100100

101-
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
101+
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
102102
if keycode == keycodeEscape {
103103
if p.closeRequestCallback != nil {
104104
if p.closeRequestCallback() {
@@ -130,14 +130,15 @@ func init() {
130130

131131
var instanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
132132

133-
parentQuery := newTypeQuery(adw.WindowGLibType())
133+
var parentQuery gobject.TypeQuery
134+
gobject.NewTypeQuery(adw.WindowGLibType(), &parentQuery)
134135

135136
gTypePreparingWindow = gobject.TypeRegisterStaticSimple(
136137
parentQuery.Type,
137138
"MultiplexPreparingWindow",
138-
uint(parentQuery.ClassSize),
139+
parentQuery.ClassSize,
139140
&classInit,
140-
uint(parentQuery.InstanceSize)+uint(unsafe.Sizeof(PreparingWindow{}))+uint(unsafe.Sizeof(&PreparingWindow{})),
141+
parentQuery.InstanceSize+uint32(unsafe.Sizeof(PreparingWindow{}))+uint32(unsafe.Sizeof(&PreparingWindow{})),
141142
&instanceInit,
142143
0,
143144
)

internal/components/shortcuts_window.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func init() {
164164
}
165165
parent.ConnectCloseRequest(&onCloseRequest)
166166

167-
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint, state gdk.ModifierType) {
167+
onKeyReleased := func(ctrl gtk.EventControllerKey, keyval, keycode uint32, state gdk.ModifierType) {
168168
if keycode == keycodeEscape {
169169
parent.Close()
170170
parent.SetVisible(false)
@@ -184,14 +184,15 @@ func init() {
184184

185185
var shortcutsInstanceInit gobject.InstanceInitFunc = func(ti *gobject.TypeInstance, tc *gobject.TypeClass) {}
186186

187-
shortcutsParentQuery := newTypeQuery(adw.WindowGLibType())
187+
var shortcutsParentQuery gobject.TypeQuery
188+
gobject.NewTypeQuery(adw.WindowGLibType(), &shortcutsParentQuery)
188189

189190
gTypeShortcutsWindow = gobject.TypeRegisterStaticSimple(
190191
shortcutsParentQuery.Type,
191192
"MultiplexShortcutsWindow",
192-
uint(shortcutsParentQuery.ClassSize),
193+
shortcutsParentQuery.ClassSize,
193194
&shortcutsClassInit,
194-
uint(shortcutsParentQuery.InstanceSize)+uint(unsafe.Sizeof(ShortcutsWindow{}))+uint(unsafe.Sizeof(&ShortcutsWindow{})),
195+
shortcutsParentQuery.InstanceSize+uint32(unsafe.Sizeof(ShortcutsWindow{}))+uint32(unsafe.Sizeof(&ShortcutsWindow{})),
195196
&shortcutsInstanceInit,
196197
0,
197198
)

0 commit comments

Comments
 (0)