membrane 2021-10-19

I tried running the membrane.example.todo/-main example and got the following error

Syntax error (UnsatisfiedLinkError) compiling at (membrane/skia.clj:582:5).
Error looking up function 'skia_font_metrics': /home/parallels/.cache/JNA/temp/jna502396494449745697.tmp: undefined symbol: skia_font_metrics
This was on branch 0.9.29.0-beta. The same code runs on branch 0.9.27.5-betabut the focus area for labels with :mouse-down event is extremely narrow and misaligned for rows below the first. Any suggestions for which version to use?

👀 1

Let me take a look. one sec.

🙏 1

what skialib dependency are you using?

How can I observe the position of the focus point from repl? Is this in skia or somewhere else?

what do you mean by focus point? Is that the component that is accepting key presses or something else?

where the mouse arrow is pointing [x, y]

It kinda depends on what you're trying to do. You can wrap your component in a :mouse-move event handler. For example:

(defn wrap-mouse-move [elem]
  ;; wrap to pass mouse-move events on to child components
  (ui/wrap-on
   :mouse-move
   (fn [handler pos]
     (prn "move: " pos)
     (handler pos))
   [;; mouse move only fires when on top of component
    ;; artifically make the component bigger
    (ui/spacer 600 600)
    elem]))
;; usage
(backend/run
  (constantly
   (wrap-mouse-move (ui/label "hi"))))

Thanks! I'll try this out and see what it says.

error in process sentinel: Could not start nREPL server: Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) This could be due to a typo in :dependencies, file system permissions, or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable.

did you pull the latest? It should be referring to 0.9.30.0

(defproject com.phronemophobic/membrane "0.9.30.0-beta"

are you on git commit 7ece0c6717ad1e535804e94bd1b13c5320dd3f5a?

:repositories {"sonatype-oss-public" ""
                  "space-maven" ""}

not sure. This is what magit is showing for history:

7adcc2a * v0.9.30.0 release-1357578724 v0.9.30.0 Bumping version.
3c3087e * updating lein deps.
00bafb6 * adding glfw libs to skialib projects.
e33a678 * Bump version.
cd53c6b * fix images on java2d.

yea, that's one commit behind

7ece0c6 * master membrane/master Updating lein skialib dependency version.

Ok. Now I can get examples.todo/-main to display the window but I'm still seeing that the focus point is not congruent with the element (e.g., need to :mouse-down well above the checkbox).

do you have a screenshot?

I'm struggling to come up with a theory for why that might happen

need to :mouse-down at exactly where the arrow-head points to change the checkbox for first

are all the hitboxes messed up or just the checkboxes?

All boxes. the first row button and textbox seem to work fine. It's as if all of the elements are starting from [0,n] instead of their top-left corner. I can try some of the other examples and see if I find a difference.

👍 1

Test Results

# lein run -m membrane.example.kitchen-sink |& tee -a output.txt

## Common for all tests
*FAIL cursor focus geometry is off for all elements.
 The y-position is about 10 points too short (appears above area of interest).
 The x-position seems correct.
!no exception failures on any of the tests.
*anomaly in font size change

## textarea
ok
## button
ok
## scrollview
!ok
## textarea-light
ok
## checkbox
ok
## image
!ok
## label-using-default-font
ok
## label-using-specified-font
!ok
## label-using-specified-font-color
ok
## label-using-default-font-change-size
ok? font size didn't change
## layout-vertical
!ok (works as expected)
## rectangle-stroked
ok
## rectangle-specified-color
ok
## rectangle
ok
## rectangle-rounded-stroke
ok
## rectangle-rounded-specified-color
ok
## scissor-view
!ok
## with-image-scaling
!ok
## with-stroke
!ok

Not sure how to isolate the focus point mis-alignment issue. Any suggestions? Build VM with minimal config? Other tests? Observe state with REPL?

It's asking me to request access.

👍 . Ok cool. I see the problem now

🙏 Thanks!

😁 1

ok, just pushed a new commit, 5475620, that shouldn't crash on any of the image related examples: • scissor-view • with-image-scaling • image • scrollview I'm still not sure why with-stroke would crash and I couldn't find the stack trace for that one. The label-with-specified-font still won't work. I have some general label fixes planned and I'll fix that at the same time. You can still pass the path to a font file to use a different font, but Menlo.ttc won't exist on linux. I'm still not sure why checkboxes would have nonsensical hitboxes.

Thanks for the update!! I'll give it a spin later tonight.

I am able to get example.todo to work but am seeing this error when I try other examples. Requires restart of the REPL to get todo to work again. I built a fresh Linux VM to try this test (ubuntu 20.04 + emacs + lein) and membrane master branch.

  Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (13 frames hidden)

1. Unhandled java.lang.IllegalArgumentException
   No implementation of method: :put! of protocol:
   #'clojure.core.async.impl.protocols/WritePort found for class:
   clojure.core.async.impl.channels.ManyToManyChannel

          core_deftype.clj:  583  clojure.core/-cache-protocol-fn
          core_deftype.clj:  575  clojure.core/-cache-protocol-fn
             protocols.clj:   18  clojure.core.async.impl.protocols/eval24227/fn/G
                 async.clj:  143  clojure.core.async/>!!
                 async.clj:  138  clojure.core.async/>!!
                  skia.clj: 1749  membrane.skia/run-sync
                  skia.clj: 1706  membrane.skia/run-sync
                  skia.clj: 1740  membrane.skia/run-sync
                  skia.clj: 1706  membrane.skia/run-sync
          kitchen_sink.clj:  348  membrane.example.kitchen-sink/-main
          kitchen_sink.clj:  347  membrane.example.kitchen-sink/-main
               RestFn.java:  397  clojure.lang.RestFn/invoke
                      REPL:   53  membrane.example.kitchen-sink/eval51126
                      REPL:   53  membrane.example.kitchen-sink/eval51126
             Compiler.java: 7177  clojure.lang.Compiler/eval
             Compiler.java: 7132  clojure.lang.Compiler/eval
                  core.clj: 3216  clojure.core/eval
                  core.clj: 3212  clojure.core/eval
    interruptible_eval.clj:   82  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  665  clojure.core/apply
                  core.clj: 1975  clojure.core/with-bindings*
                  core.clj: 1975  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   82  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   79  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  145  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  202  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  201  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  829  java.lang.Thread/run

Also, when I load an example into REPL, there is a long delay (15 seconds) with spinning busy wheel cursor.

that error seems pretty bizarre. how are you running the example?

The kitchen sink example uses the same function ( membrane.skia/run-sync) to start the UI as the todo example

for example, lein run -m membrane.example.kitchen-sink

my results from running this command

lein run -m membrane.example.kitchen-sink |& tee -a stack-trace
## textarea ok ## button ok ## scrollview FAIL {crash on select} - stack-trace: testing/scrollview-fail-1
Oct 20, 2021 10:09:54 AM com.sun.jna.Native$1 uncaughtException
   WARNING: JNA: Callback membrane.skia.MouseButtonCallback@62e2fc61 threw the following exception
   java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## textarea-light ok ## checkbox ok ## image FAIL {crash on select} - stack-trace: testing/image-fail-1
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## label-using-default-font ok ## label-using-specified-font FAIL {font Menlo.tcc missing} ## label-using-specified-font-color ok ## label-using-default-font-change-size ok ## layout-vertical FAIL {checkbox does not respond to :mouse-down} ## rectangle-stroked ok ## rectangle-specified-color ok ## rectangle ok ## rectangle-rounded-stroke ok ## rectangle-rounded-specified-color ok ## scissor-view FAIL {crash on select} - stack-trace: testing/scissor-view-fail-1
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## with-image-scaling FAIL {crash on select}
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## with-stroke
## with-stroke FAIL {crash on select}
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

interesting

> layout-vertical That example isn't supposed to respond to events

✅ 1

it seems weird that it would attempt to load libawt_xawt.so

is there more to the stack trace?

sometimes it creates a log that looks like hs_err_pid36675.log

I saved the stacktrace. Didn't want to clog the slack channel with it. I will post a link to it shortly.

Thanks!

Yea, the best way to debug would be to observe the state with repl. If you I could reproduce it locally, it wouldn't be too hard to figure out the issue with a few simple tests. It's a little more difficult trying to isolate the issue from afar

I'm running with lein

I look in the project.clj file for membrane 0.9.29.0-beta and it has

;; skia
[com.phronemophobic.membrane/skialib-macosx "0.9.27-beta"]
[com.phronemophobic.membrane/skialib-linux "0.9.27-beta"]

or is somewhere else?

those would need to be updated

got it. let me try it.

I switched over to the clojure cli at some point and haven't been keeping lein up to date

the dependency name has also changed to include the architecture (eg. aarch64, x86-64)

;; one of
[com.phronemophobic.membrane/skialib-macosx-x86-64 "0.9.29.0-beta"]
[com.phronemophobic.membrane/skialib-linux-x86-64 "0.9.29.0-beta"]
[com.phronemophobic.membrane/skialib-macosx-aarch64 "0.9.29.0-beta"]

you can just include all 3 and nothing bad will happen

👍 1

> the focus area for labels with :mouse-down event is extremely narrow and misaligned for rows below the first. I'm not sure what is causing that. Do you have a screenshot? Which OS are you running?

got this error
Execution error (AssertionError) at membrane.skia/run-sync (skia.clj:1746).
Assert failed: Could not run because glfw could not be loaded.

## java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
## lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename: focal ## uname -a
Linux parallels 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
## Parallels
17.0.1 Pro Edition

project.clj has

[org.lwjgl/lwjgl "3.2.3"]
[org.lwjgl/lwjgl "3.2.3" :classifier "natives-macos"]
[org.lwjgl/lwjgl-glfw "3.2.3"]
[org.lwjgl/lwjgl-glfw "3.2.3"  :classifier "natives-macos"]
[org.lwjgl/lwjgl-opengl "3.2.3"]
[org.lwjgl/lwjgl-opengl "3.2.3"  :classifier "natives-macos"]]}}

yea, I'm seeing the same error when I run with lein as well

hmm, it might actually be particular skialib version. It's the first version I uploaded via github CI 😳

I've got to crash for the night, but I'm happy to run more tests tomorrow if that would be of help.

ah. I see the issue. I forgot to include glfw

😋 1

Sorry about that. I'll fix that tonight. Have a good night. Thanks for giving it a shot.

I really want to use your library, so willing to put in some extra to get it to work. --later.

🙏 1

I think it should work now.

I split up the dependency on skia+glfw since not everyone will want to use the skia backend, but I haven't updated the docs yet to reflect that dependency change

you'll need one of: • com.phronemophobic.membrane/skialib-linux-x86-64 {:mvn/version "0.9.29.0-beta"} • com.phronemophobic.membrane/skialib-macosx-aarch64 {:mvn/version "0.9.29.0-beta"} • com.phronemophobic.membrane/skialib-macosx-x86-64 {:mvn/version "0.9.29.0-beta"}

are you running the code via the clojure cli or lein?