Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable Extra-Keys #19

Closed
wants to merge 14 commits into from
Closed

Customizable Extra-Keys #19

wants to merge 14 commits into from

Conversation

creepy-pasta101
Copy link
Collaborator

No description provided.

@creepy-pasta101
Copy link
Collaborator Author

@agnostic-apollo here we go again....
Also... We have a problem... Termux-Wayland uses an event-listener... Not a terminal-client... Not sure if replacing them would work🤔🤔

@agnostic-apollo
Copy link
Member

From a quick look, you need to pass the listener created by LorieService here to your TerminalExtraKeys class constructor with extraKeysView.setExtraKeysViewClient(new TerminalExtraKeys(LorieService.getOnKeyListener()));. Assign it the private variables ServiceEventListener eventListener or View.OnKeyListener eventListener, instead of TerminalView. Then you can call eventListener.onKey(). Check AdditionalKeyboardView. You necessarily don't need to extend your custom TerminalExtraKeys class like done with TermuxTerminalExtraKeys, you can handle, keyboard stuff in same class.

Note that event listener expects events and key codes, so you will need to convert the code point sent with mTerminalView.inputCodePoint(codePoint, ctrlDown, altDown); in TerminalExtraKeys to events, like done here. I am assuming macros or strings didn't work before...

Also note that the view passed to TerminalExtraKeys.onExtraKeyButtonClick() is for the extra key button, you can't refer to lorie stuff from it. You also need to use surfaceView.

@RalfWerner
Copy link

RalfWerner commented Aug 27, 2021

@suhan-paradkar, @wmcb-tech have I understood correctly that you renamed T:X11 in T:Wayland and the PR from your private repos were made up there? As long as com.termux.x11 is unchangen, it's never a problem for me.
Discussions and some Issues e.g. This was not transferred. Will that be done? I could find your changes, but not satisfied with it:

  • The fullscreen mode you have removed from the prereference (good). But Default is now without the upper edge (bad)! The flicker problem occurred only with AVD. My real devices, partly with a small screen, could use it well - not anymore now.
  • The EK on/off in the preference is now without coupling to the OS KB (good but only in the text) The usable screen is not enlarged as I hoped (doesn't worked previously too).

Both together reduces the screen in landscape by about 10-15%. The covering of the EK is not solved (was better in Twaik's version) and the again-switching-on (1st prereference) is not possible retrospectively (only exit+restart of XClients) can you repeat this?

Yes.. an android 9 device - to: Do you have a device with which you can repeat PiP/Split video?

That's good! _Device name? Have you ever tried in addition to Termux and T:X11/Wayland also to use VNC?
This works only in the background but not in Picture/Split like the other two apps. Without Configure Event only the floating KB is useful for T:X11 and all three Apps are on one screen (tap to change) use the same OS-KB! What are your experience with it?

@RalfWerner RalfWerner mentioned this pull request Aug 27, 2021
@creepy-pasta101
Copy link
Collaborator Author

_Device name?

Oppo A12 not rooted

Have you ever tried in addition to Termux and T:X11/Wayland also to use VNC?

Yes.. ofcourse.. I started to continue development here as I felt that VNC is very clunky......

Without Configure Event only the floating KB is useful for T:X11

Well.. that is what is being implemented here... Although the goal is to use the same set of Extra-keys as defined in .termux/termux.properties by the user

@creepy-pasta101 creepy-pasta101 force-pushed the ekeys branch 3 times, most recently from d460b26 to c6511a4 Compare August 28, 2021 09:35
@RalfWerner
Copy link

I got lost for your device and was surprised that you can use Pop View (PiP see second 10 to 18 in the Video). In this mode, the Picture/Pop-View with EK-X (T:X11) can be moved up from the lower overlap area (at least Nav bar - see shot below) and remains visible with OS-KB. The Move Events of the first 3 seconds and KB events (if one of the two windows is selected) also works in this case, as well as any change of the T:X11 size - not in your PiP.
If I turn on your PiP (Wayland) Choice, nothing happens on this device (Android 11) and on my Huawei (Android 8) only your PIP (no events) is possible. Both see here. Except for the effect in the addendum I found no advantages - Split is much better. But there are also a few bad side effects (possibly only on my device).

Do you possibly have an additional app, which allow you repeat the PiP behavior from the Video (should be possible with all Android-11 devices)?

On my Gigaset (Android 9) neither Split nor PiP works, but floating OS-KB and AVD works like my Huawei.
At the same time VNC and the two T:-apps on one screen, I could reach only on the SM-P610 (shot here with three EK)
grafik

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Aug 28, 2021

You can use Taskbar app on android 7+ to launch freeform mode to make apps into resizable windows, like on desktop, its similar to PiP.

@creepy-pasta101 creepy-pasta101 force-pushed the ekeys branch 2 times, most recently from 52b0ead to 0988ad7 Compare August 30, 2021 03:36
@agnostic-apollo
Copy link
Member

Use act.findViewById() and act.getContext(). Those functions are inherited from the Activity class and will work directly in MainActivity but you need to use an Activity object if calling them in a different class.

And no need for temporary variable here and can just create a function that converts char[] to events and calls mEventListener.onKey(), you are using 2 loops. This is just a code improvement though.

@creepy-pasta101
Copy link
Collaborator Author

Thanks👍👍

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Aug 30, 2021

Sorry, getContext() is from View, Just use act instead of act.getContext() or view.getContext().

@creepy-pasta101
Copy link
Collaborator Author

Well.. we have a new problem.... The Extra-keys are now not being displayed at all....

@RalfWerner
Copy link

Thanks @agnostic-apollo for the Taskbar hint and back naming in T:X11. I've the Taskbar-App checked and can confirm that for some apps Floating Pictures are possible. T:X11 and VNC (expected) are not part of it and Termux is very limited. A behavior as in the Video is therefore not available. The task bar is displaceable to the four corners, but almost always covers important control areas -

see Shot1. This is my Gigaset with the smallest screen, without Split/PiP from Android. With tap on T:X11 all other apps and OS-KB disappear, EK-X is covered by task bar and the Fluxbox task bar is covered by EK-X. I tried to work on an AVD pad with Taskbar-App, but this completely failed. Although T:X11 is floating in Shot2, but only because I have ceased the short moment in which the flickering screen indicated it.
The upper bar of Termux and T:X11 Picture (to move) disappears after the first touch and occures only after App restart. The Taskbar app is very instable, often crashes and sometimes can only be remedied only by device restart.
grafik

Conclusion: This PiP function is unsuitable on all devices. On small devices is Split (if possible) is a good alternative but Toggle-EK in any case. PiP on my SM-P610 is a brilliant and very stable Android function.

So again @suhan-paradkar:How did you repeat the video behavior on your Oppo A12 (only "three fingers split" according to Google)?

Ps last artifact ist increased from 7Mb to 10 Mb but not suitable for further EK-X-checks?

@creepy-pasta101
Copy link
Collaborator Author

How did you repeat the video behavior on your Oppo A12 (only "three fingers split" according to Google)?

Well.. pressing the home button or recents will put the app in PIP mode amd I had no trouble with that.. Note that you can't perform any " screen clicks" at this moment...
This mode has been added for those users who would like to view YouTube or any video inside Termux's environment...

Ps last artifact ist increased from 7Mb to 10 Mb but not suitable for further EK-X-checks?

That's because termux-shared library is added.

@RalfWerner
Copy link

Note that you can't perform any " screen clicks" at this moment...

With Taskbar App it is already possible - but with the restrictions described above and of course on my Samsung device.

That's because termux-shared library is added.

I did not understand. Screen Size for T:X11 and presentation of the EK-Line initially have nothing to do with the (shared) symbols in it! The show EK-X Choice is now missing in the Preferences and the top range (formerly fullscreen choice) is still unavailable.

@creepy-pasta101
Copy link
Collaborator Author

creepy-pasta101 commented Aug 30, 2021

I did not understand. Screen Size for T:X11 and presentation of the EK-Line initially have nothing to do with the (shared) symbols in it!

I am not speaking on C++ Shared libraries.. I mentioned termux-shared jitpack library

@RalfWerner
Copy link

RalfWerner commented Aug 30, 2021

I'm aware! I meant the missing EK-X Line, which is initially a graphic area between Nav-Bar or non-floating KB and X11.
A positive check is the height reduction of X11 when non-floating-KB is turned on. In between should be EK, as well as in Termux.

EK-X11.mp4

For illustration, a small video of my SM-P610 in which both Apps in Picture can be seen and the OS-KB is turned on twice.
At the end, I move the BT mouse from X11 to Termux and to the KB. It is well recognizable (finger cursor) where the EK-T is arranged and how the picture/screen size changes with the OS-KB. If EK-X is positioned as well as EK-T, there are no more coverage problems.

@twaik
Copy link
Member

twaik commented Aug 30, 2021

About PIP mode: I think it is not applicable in all cases. Maybe we can implement mode like this one:

Screen_Recording_20210830-224616_Nova.Launcher.mp4

I do not think it will require a lot of work.

@agnostic-apollo
Copy link
Member

That's because termux-shared library is added.

'tis not!

x11-usage1
x11-usage2

@creepy-pasta101
Copy link
Collaborator Author

@twaik

About PIP mode: I think it is not applicable in all cases. Maybe we can implement mode like this one:

I'll consider that... Will try once this Pull Request is merged...

@agnostic-apollo

'tis not!

How?? Your Image clearly shows it... com/termux/shared

@agnostic-apollo
Copy link
Member

Your Image clearly shows it... com/termux/shared

It is, but its only using 713KB after decompilation, not 3MB in-APK.

@creepy-pasta101
Copy link
Collaborator Author

Yes.. the rest are other depenencies...

@creepy-pasta101
Copy link
Collaborator Author

I think I will be adding ViewPager here itself instead of messing up the view layouts

@creepy-pasta101 creepy-pasta101 force-pushed the ekeys branch 2 times, most recently from be9c418 to 7960cd7 Compare August 31, 2021 06:16
@RalfWerner
Copy link

@suhan-paradkar I had asked you above a few questions. Can you please give a short (yes/no/in progress) answer?

One more: OTS=OneTouchStart with VNC is more stable than with X11 because PID2 start can be retrofitted (also different Viewer Apps simultaneously), without repeating the PID3=Xvnc + PID4 start. Could the behavior (do not kill PID3=Xwayland with PID2) at X11 are also achieved?

@creepy-pasta101
Copy link
Collaborator Author

The Key state (Shift, Ctrl, ALT) are still not set. What do I have to do so that EK is taken over?

Its still a work in progress

In addition, termux-startx11 processes (is superfluous for PID3) are started/closed several times (quite complicated).

Yes.. I've noticed.. the init process is quite buggy

Can X11 only be stopped with the notification?

As of now.. yes...

Do you use X11 with other Apps as Termux?

Actually.. right now, we can't... The goal is to support 3rd party apps to support x11 output through this app...

Could the behavior (do not kill PID3=Xwayland with PID2) at X11 are also achieved?

I guess we can....

@agnostic-apollo
Copy link
Member

@agnostic-apollo can you please make onAnyExtraButtonClick function public, instead of private ?

For now, use implementation 'com.github.agnostic-apollo.termux-app:termux-shared:temp-extrakeys-SNAPSHOT'

https://github.com/agnostic-apollo/termux-app/tree/temp-extrakeys

Will push it to master later.

@RalfWerner
Copy link

Its still a work in progress ... I guess we can....

These are good news :) I hope the next version for check contains again the lost functions: RS (02.04), Key-State (master/basic) and FullScreen (basic). In addition to touch and check I also use multi, which often crashes or remains as a zombie process. This is a C source of the XInput2 developer and uses exclusively Direct mode for fingers and S-Pen events.

@agnostic-apollo
Copy link
Member

@suhan-paradkar What is your end goal here?

The TerminalExtraKeys does not extend from ExtraKeysView so its not a child class, it only implements its interface IExtraKeysView. If you want to call a function of ExtraKeysView, pass its object to TerminalExtraKeys constructor and then call it via the object, it "should" work. For onAnyExtraKeyButtonClick(), you can just pass ExtraKeyButton, the View and Button can be null, as long as you don't use them in interface implementation of onExtraKeyButtonClick().

https://github.com/termux/termux-x11/pull/19/files#diff-611e4439e114c1564ad8ad5fde76e48586f3f5bf2cec31fb5ff86552aa7fd2bbR48

@creepy-pasta101
Copy link
Collaborator Author

The TerminalExtraKeys does not extend from ExtraKeysView so its not a child class, it only implements its interface IExtraKeysView. If you want to call a function of ExtraKeysView, pass its object to TerminalExtraKeys constructor and then call it via the object, it "should" work

@agnostic-apollo You mean something like this?

public TerminalExtraKeys(@NonNull View.OnKeyListener eventlistener, MainActivity mact, ExtrakeysView extrakeysview) {
        mEventListener = eventlistener;
        act = mact;
        extrakeysview = mextrakeysview;
    }

@agnostic-apollo
Copy link
Member

extrakeysview = mextrakeysview;

Typo

mExtraKeysView = extraKeysView

You should also use camel case convention. And non-public class instance variables should ideally start with m.

https://source.android.com/setup/contribute/code-style#follow-field-naming-conventions

@creepy-pasta101
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants