bug-g-golf
[Top][All Lists]
Advanced

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

Handling 'activate of <gtk-entry> does not work


From: d4ryus
Subject: Handling 'activate of <gtk-entry> does not work
Date: Mon, 31 May 2021 08:33:07 +0200

Hi,

i tried to write a small g-golf program with a <gtk-entry> widget that
prints a message when the Enter-Key is pressed:

  #! /bin/sh
  # -*- mode: scheme; coding: utf-8 -*-
  exec guile -e main -s "$0" "$@"
  !#
  ;; Opens a window with a single <gtk-entry> widget and prints "Hi" to
  ;; stdout when the Enter key is pressed (signals 'activate).
  (eval-when (expand load eval)
    (use-modules (oop goops))
    (default-duplicate-binding-handler
      '(merge-generics replace warn-override-core warn last))
    (use-modules (g-golf)
                 (ice-9 format))
    (for-each (lambda (name)
                (gi-import-by-name "Gtk" name))
              '("Application"
                "ApplicationWindow"
                "Entry")))
  
  (define (activate app)
    (let ((window (make <gtk-application-window>
                    #:title "Hi"
                    #:application app))
          (entry (make <gtk-entry>)))
      ;; Signaled on "Enter"
      (connect entry 'activate
               (lambda (entry)
                 (format #t "Hi!~%")))
      (add window entry)
      (show-all window)))
  
  (define (main . args)
    (let ((app (make <gtk-application>
                 #:application-id "org.test.GtkApplication")))
      (connect app 'activate activate)
      (run app 0 '())))


Running it spawns the gtk-window and pressing the Enter key does print
the "Hi" message. But then it tries to evalute the return (i think), but
there is none and throws a scm-error:

  $ ./pre-inst-env ./reproducer.scm
  Hi!
  Backtrace:
             6 (apply-smob/1 #<catch-closure 7fa05b9d22c0>)
  In ice-9/boot-9.scm:
      705:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
  In ice-9/eval.scm:
      619:8  4 (_ #(#(#<directory (guile-user) 7fa05b650140>)))
  In g-golf/hl-api/function.scm:
     142:19  3 (_ . _)
  In unknown file:
             2 (_ #<pointer 0x55831d5a58f0> #<pointer 0x7fa0588d51e0> 3 …)
  In g-golf/hl-api/closure.scm:
      258:8  1 (g-closure-marshal _ _ _ _ _ _)
  In unknown file:
             0 (scm-error misc-error #f "~A ~S" ("Not implemented:" #) #)
  
  ERROR: In procedure scm-error:
  Not implemented: invalid


Versions I used:

  g-golf master (ed3bace8249)
  guile 2.2.7
  gtk3 1:3.24.29-1
  gobject-introspection 1.68.0-1
  gobject-introspection-runtime 1.68.0-1
  glib2 2.68.2-1
  guile-lib 0.2.7-2


I found the following workaround (its really just a hack to ignore the
return if the type is 'invalid), but maybe it helps fixing the problem:

  diff --git a/g-golf/hl-api/closure.scm b/g-golf/hl-api/closure.scm
  index 5e9e173..33e8adf 100644
  --- a/g-golf/hl-api/closure.scm
  +++ b/g-golf/hl-api/closure.scm
  @@ -250,7 +250,8 @@
                                                             param-vals
                                                             param-args)
                              results)))))))
  -  (if (null-pointer? return-val)
  +  (if (or (null-pointer? return-val)
  +          (eq? (g-value-type-tag return-val) 'invalid))
         (begin
           (apply function args)
           (values))


Let me know if you need more information or if i can help in any other
way.


- d4ryus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]