termux / termux-gui

A plugin for Termux to use native Android GUI components from CLI applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to make soft keyboard work with SurfaceView?

mumumusuc opened this issue · comments

I'm wondering how to toggle on the soft keyboard and receive key event from it so that I can draw texts to the SurfaceView?

I have created a SurfaceView with keyboard=true and sent RequestFocusRequest with forcesoft=true, what else should I do?

Does the keyboard show then? And do you receive key events from the SurfaceView?
Drawing into the HardwareBuffer has to be done using OpenGL, and font rasterization is a beast on its own.
You'll have to search for a font rasterization library in you language yourself.

Does the keyboard show then? And do you receive key events from the SurfaceView?

No and no, the keyboard doesn't appear.

I'm porting flutter to termux and using termux-gui as display, it works except the keyboard. Is there any example about receiving keyevent from SurfaceView?

I can't get EGL working in the emulator at the moment, I'll look into it another time.

I got it working now (had to uninstall libglvnd, so the compiler doesn't pick it instead of the system EGL, still haven't figured out how to prevent that), the new GitHub Actions build for the Termux:GUI app should be finished soon, and I updated the buffer_gc.c example to show key and touch events.

I got it working now (had to uninstall libglvnd, so the compiler doesn't pick it instead of the system EGL, still haven't figured out how to prevent that), the new GitHub Actions build for the Termux:GUI app should be finished soon, and I updated the buffer_gc.c example to show key and touch events.

I tried buffer_gl.c in termux-gui-c-bindings and the soft keyboard still not working.

  • Termux:GUI
    from github Actions, version 1.0.0

  • termux-info

    termux-tools version:
    1.40.6
    Android version:
    12
    Kernel build information:
    Linux localhost 5.10.43 #1 SMP PREEMPT 
    Mon Jan 9 15:57:42 CST 2023 aarch64  Android
    Device manufacturer:
    HUAWEI
    Device model:
    JEF-TN00
    LD Variables:
    LD_LIBRARY_PATH= 
    LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
    Installed termux plugins:
    com.termux.gui versionCode:8
    com.termux.x11 versionCode:14
    com.termux.styling versionCode:30
    
SVID_20240212_132300_1.mp4

Do you have to apk from this GitHub Actions run and pulled the termux-gui-c repo again?

Do you have to apk from this GitHub Actions run and pulled the termux-gui-c repo again?

yes, the new apk is version 1.0.0, and the example shows move event correctly

yes, the new apk is version 1.0.0

That doesn't mean anything, I increment the version after each release, so the GitHub Actions builds of the commits after that all get the new version number. You have to install the latest GitHub Actions build specifically.

yes, the new apk is version 1.0.0

That doesn't mean anything, I increment the version after each release, so the GitHub Actions builds of the commits after that all get the new version number. You have to install the latest GitHub Actions build specifically.

I'm sure about that I installed the file you linked.

I modified the example again to open the keyboard on every touch and modified the app again.

I modified the example again to open the keyboard on every touch and modified the app again.

It works, soft keyboard shows and I received it's keyevents.🎉