Skip to content

Commit 182deb7

Browse files
committed
fix build
1 parent 292a531 commit 182deb7

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

gdk/gdk.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ type Font struct {
224224
GFont *C.GdkFont
225225
}
226226

227+
func FontFromUnsafe(window unsafe.Pointer) *Font {
228+
return &Font{C.toGdkFont(window)}
229+
}
230+
227231
func FontLoad(name string) *Font {
228232
ptr := C.CString(name)
229233
defer cfree(ptr)

gdk/gdk.go.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ static void freeCstr(char* s) { free(s); }
1414

1515
static GdkWindow* toGdkWindow(void* w) { return GDK_WINDOW(w); }
1616
static GdkDragContext* toGdkDragContext(void* l) { return (GdkDragContext*)l; }
17+
static GdkFont* toGdkFont(void* l) { return (GdkFont*)l; }
1718

1819
static void* _gdk_display_get_default() {
1920
return (void*) gdk_display_get_default();

gtk/gtk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8240,7 +8240,7 @@ func NewFontSelection() *FontSelection {
82408240
}
82418241

82428242
func (v *FontSelection) GetFont() *gdk.Font {
8243-
return &gdk.Font{C.gtk_font_selection_get_font(FONT_SELECTION(v))}
8243+
return gdk.FontFromUnsafe(unsafe.Pointer(C.gtk_font_selection_get_font(FONT_SELECTION(v))))
82448244
}
82458245

82468246
func (v *FontSelection) GetFontName() string {

gtk/gtk.go.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ static inline GtkDialog* toGDialog(GtkWidget* w) { return GTK_DIALOG(w); }
773773
static inline GtkAboutDialog* toGAboutDialog(GtkWidget* w) { return GTK_ABOUT_DIALOG(w); }
774774
static inline GtkContainer* toGContainer(GtkWidget* w) { return GTK_CONTAINER(w); }
775775
static inline GtkFileChooser* toGFileChooser(GtkWidget* w) { return GTK_FILE_CHOOSER(w); }
776+
static inline GtkFontSelection* toGFontSelection(GtkWidget* w) { return GTK_FONT_SELECTION(w); }
776777
static inline GtkFontSelectionDialog* toGFontSelectionDialog(GtkWidget* w) { return GTK_FONT_SELECTION_DIALOG(w); }
777778
static inline GtkMisc* toGMisc(GtkWidget* w) { return GTK_MISC(w); }
778779
static inline GtkLabel* toGLabel(GtkWidget* w) { return GTK_LABEL(w); }

0 commit comments

Comments
 (0)