pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/chat/coyim chat/coyim: Applies the correct fix for got...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/519d48abf35f
branches:  trunk
changeset: 449909:519d48abf35f
user:      fox <fox%pkgsrc.org@localhost>
date:      Wed Apr 07 19:04:22 2021 +0000

description:
chat/coyim: Applies the correct fix for gotk3 from upstream.

As of Golang 1.16, the cgo tool will no longer try to translate C struct
bitfields into Go struct fields, even if their size can be represented
in Go. The order in which C bitfields appear in memory is implementation
dependent, so in some cases the cgo tool produced results that were
silently incorrect.

In this case "accel_flags" is the bitwise field in question. A new
declaration for GtkAccelKey structure that does not explicitly access
to 'accel_flags' has been addressed in the patch.

https://github.com/gotk3/gotk3/pull/730

Patch will be removed when vendor library will be updated.

diffstat:

 chat/coyim/distinfo                                                 |    4 +-
 chat/coyim/patches/patch-vendor_github.com_gotk3_gotk3_gtk_accel.go |  138 ++++++++-
 2 files changed, 125 insertions(+), 17 deletions(-)

diffs (164 lines):

diff -r 871d8f060685 -r 519d48abf35f chat/coyim/distinfo
--- a/chat/coyim/distinfo       Wed Apr 07 16:22:28 2021 +0000
+++ b/chat/coyim/distinfo       Wed Apr 07 19:04:22 2021 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.2 2021/04/07 13:11:14 fox Exp $
+$NetBSD: distinfo,v 1.3 2021/04/07 19:04:22 fox Exp $
 
 SHA1 (coyim-0.3.11.tar.gz) = 3928e9954f516a7725982390fdb7ceef0659ec0a
 RMD160 (coyim-0.3.11.tar.gz) = 32b3e81e808951faacc63efaa19ba0d0d5318a93
 SHA512 (coyim-0.3.11.tar.gz) = a9d3b9900e78f736617969d4c2ebcb88abbb427dccc0396ed5a655f8ae0d22c3ddba44bdd4e0b4370af97972e883e9ee52b425cbfa226945c6aad7a2a473accb
 Size (coyim-0.3.11.tar.gz) = 3803018 bytes
-SHA1 (patch-vendor_github.com_gotk3_gotk3_gtk_accel.go) = 7be97c79ed53a517c1bb57010f2e4e9a59e623ad
+SHA1 (patch-vendor_github.com_gotk3_gotk3_gtk_accel.go) = 0be66c744d2492f414a69da6d104d5facacf8519
diff -r 871d8f060685 -r 519d48abf35f chat/coyim/patches/patch-vendor_github.com_gotk3_gotk3_gtk_accel.go
--- a/chat/coyim/patches/patch-vendor_github.com_gotk3_gotk3_gtk_accel.go       Wed Apr 07 16:22:28 2021 +0000
+++ b/chat/coyim/patches/patch-vendor_github.com_gotk3_gotk3_gtk_accel.go       Wed Apr 07 19:04:22 2021 +0000
@@ -1,24 +1,132 @@
-$NetBSD: patch-vendor_github.com_gotk3_gotk3_gtk_accel.go,v 1.1 2021/04/07 13:11:14 fox Exp $
+$NetBSD: patch-vendor_github.com_gotk3_gotk3_gtk_accel.go,v 1.2 2021/04/07 19:04:22 fox Exp $
 
-Remove the missing accel_flags field to prevent build failure.
+Solve GtkAccelKey issue with golang 1.16.
 
-XXX: Investigate this further.
+https://github.com/gotk3/gotk3/pull/730
 
---- vendor/github.com/gotk3/gotk3/gtk/accel.go.orig    2021-04-07 12:06:33.563048146 +0000
+--- vendor/github.com/gotk3/gotk3/gtk/accel.go.orig    2021-04-07 18:37:25.213428101 +0000
 +++ vendor/github.com/gotk3/gotk3/gtk/accel.go
-@@ -244,7 +244,6 @@ func (v *AccelKey) native() *C.struct__G
-       var val C.struct__GtkAccelKey
-       val.accel_key = C.guint(v.key)
-       val.accel_mods = C.GdkModifierType(v.mods)
--      val.accel_flags = v.flags
-       return &val
+@@ -69,6 +69,20 @@ func AcceleratorSetDefaultModMask(mods g
+ }
+ 
+ /*
++ * GtkAccelLabel
++ */
++
++// TODO:
++// gtk_accel_label_new().
++// gtk_accel_label_set_accel_closure().
++// gtk_accel_label_get_accel_widget().
++// gtk_accel_label_set_accel_widget().
++// gtk_accel_label_get_accel_width().
++// gtk_accel_label_set_accel(). since GTK 3.6
++// gtk_accel_label_get_accel(). since GTK 3.12
++// gtk_accel_label_refetch().
++
++/*
+  * GtkAccelGroup
+  */
+ 
+@@ -93,6 +107,10 @@ func marshalAccelGroup(p uintptr) (inter
+ }
+ 
+ func wrapAccelGroup(obj *glib.Object) *AccelGroup {
++      if obj == nil {
++              return nil
++      }
++
+       return &AccelGroup{obj}
+ }
+ 
+@@ -191,6 +209,9 @@ func AccelGroupsFromObject(obj *glib.Obj
+       if res == nil {
+               return nil
+       }
++
++      // TODO: call DataWrapper on SList and wrap them to gtk.AccelGroup
++
+       return (*glib.SList)(unsafe.Pointer(res))
+ }
+ 
+@@ -219,6 +240,10 @@ func marshalAccelMap(p uintptr) (interfa
+ }
+ 
+ func wrapAccelMap(obj *glib.Object) *AccelMap {
++      if obj == nil {
++              return nil
++      }
++
+       return &AccelMap{obj}
+ }
+ 
+@@ -230,32 +255,13 @@ func AccelMapAddEntry(path string, key u
+       C.gtk_accel_map_add_entry((*C.gchar)(cstr), C.guint(key), C.GdkModifierType(mods))
  }
  
-@@ -253,7 +252,6 @@ func wrapAccelKey(obj *C.struct__GtkAcce
+-type AccelKey struct {
+-      key   uint
+-      mods  gdk.ModifierType
+-      flags uint16
+-}
++type AccelKey C.GtkAccelKey
+ 
+-func (v *AccelKey) native() *C.struct__GtkAccelKey {
++func (v *AccelKey) native() *C.GtkAccelKey {
+       if v == nil {
+               return nil
+       }
+-
+-      var val C.struct__GtkAccelKey
+-      val.accel_key = C.guint(v.key)
+-      val.accel_mods = C.GdkModifierType(v.mods)
+-      val.accel_flags = v.flags
+-      return &val
+-}
+-
+-func wrapAccelKey(obj *C.struct__GtkAccelKey) *AccelKey {
+-      var v AccelKey
+-
+-      v.key = uint(obj.accel_key)
+-      v.mods = gdk.ModifierType(obj.accel_mods)
+-      v.flags = uint16(obj.accel_flags)
+-
+-      return &v
++      return (*C.GtkAccelKey)(v)
+ }
  
-       v.key = uint(obj.accel_key)
-       v.mods = gdk.ModifierType(obj.accel_mods)
--      v.flags = uint16(obj.accel_flags)
+ // AccelMapLookupEntry is a wrapper around gtk_accel_map_lookup_entry().
+@@ -263,10 +269,10 @@ func AccelMapLookupEntry(path string) *A
+       cstr := C.CString(path)
+       defer C.free(unsafe.Pointer(cstr))
+ 
+-      var v *C.struct__GtkAccelKey
++      var v = new(AccelKey)
+ 
+-      C.gtk_accel_map_lookup_entry((*C.gchar)(cstr), v)
+-      return wrapAccelKey(v)
++      C.gtk_accel_map_lookup_entry((*C.gchar)(cstr), v.native())
++      return v
+ }
  
-       return &v
+ // AccelMapChangeEntry is a wrapper around gtk_accel_map_change_entry().
+@@ -417,7 +423,7 @@ func (v *Window) AddAccelGroup(accelGrou
+       C.gtk_window_add_accel_group(v.native(), accelGroup.native())
+ }
+ 
+-// RemoveAccelGroup() is a wrapper around gtk_window_add_accel_group().
++// RemoveAccelGroup() is a wrapper around gtk_window_remove_accel_group().
+ func (v *Window) RemoveAccelGroup(accelGroup *AccelGroup) {
+       C.gtk_window_remove_accel_group(v.native(), accelGroup.native())
  }
+@@ -432,4 +438,10 @@ func (v *Window) RemoveAccelGroup(accelG
+ // TODO: gtk_accel_map_foreach  - can't be done without a function type
+ 
+ // TODO: gtk_accel_map_load_scanner
+-// TODO: gtk_widget_list_accel_closures
++
++/*
++ * GtkWidget
++ */
++
++// TODO:
++// gtk_widget_list_accel_closures



Home | Main Index | Thread Index | Old Index