nwrkbiz / android-xserver Goto Github PK
View Code? Open in Web Editor NEWThis project forked from mattkwan-zz/android-xserver
Maintaining the original project to make it work again with new Android versions.
License: MIT License
This project forked from mattkwan-zz/android-xserver
Maintaining the original project to make it work again with new Android versions.
License: MIT License
Refer to https://www.x.org/releases/current/doc/xproto/x11protocol.html#requests:CreateGC .
With function
and plane-mask
on CreateGC
, client can tell server to draw with bitwise operations:
((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask))
Function | Operation |
---|---|
Clear | 0 |
And | src AND dst |
AndReverse | src AND (NOT dst) |
Copy | src |
AndInverted | (NOT src) AND dst |
NoOp | dst |
Xor | src XOR dst |
Or | src OR dst |
Nor | (NOT src) AND (NOT dst) |
Equiv | (NOT src) XOR dst |
Invert | NOT dst |
OrReverse | src OR (NOT dst) |
CopyInverted | NOT src |
OrInverted | (NOT src) OR dst |
Nand | (NOT src) OR (NOT dst) |
Set | 1 |
I failed to find an efficient way to implement these bitwise operation after spending many hours. I think it might be difficult to implement a paint with bitwise Xfermode. As a result, it is hard to draw via methods of canvas.
TL;DR:
Android doesn't have bitwise Xfermode
now. PixelXorXfermode
has been removed, and Xfermode
has only one subclass PorterDuffXfermode
now, which has no bitwise operation, and PorterDuff.Mode.XOR
is xor operation for area but not for color, which is misused in
I tried to write our own Xfermode
subclass, so that we can still use methods of canvas to draw. But finally found that Paint
uses native code and hardcodes PorterDuffXfermode
, even if Paint.setXfermode
accepts Xfermode
.
ColorMatrixColorFilter
can be used to implement bitwise NOT
on src
but not dst
.
In some configuration, the phone hides the navigation bar in unlocking GUI, and shows the navigation again after unlocked.
If XServer is in foreground, it will trigger the ScreenView.onSizeChanged
event twice. (My device is OnePlus 6 with LineageOS 19.1, in which unlocking by fingerprint triggers it, but unlocking by pattern doesn't trigger it because the navigation bar recovers in the pattern interface. Unlocking by swiping may also trigger the event.)
The first one is triggered by hiding the navigation (size is expanded), and the second one is triggered by the recovering the navigation (size is reduced). There are all triggered after the phone was unlocked, and the second is triggered a very short time after the first one is triggered.
It causes the XServer to "restart".
One possible workaround is to delay the "restart", and stop the "restart" after the size recovers the original value in a short time:
diff --git a/library/src/main/java/au/com/darkside/xserver/ScreenView.java b/library/src/main/java/au/com/darkside/xserver/ScreenView.java
index 423462a..af2de29 100644
--- a/library/src/main/java/au/com/darkside/xserver/ScreenView.java
+++ b/library/src/main/java/au/com/darkside/xserver/ScreenView.java
@@ -642,6 +642,11 @@ public class ScreenView extends View {
}
}
+ protected Handler resizeDelayer = new Handler();
+ protected boolean waitingForResize = false;
+ protected int widthBeforeResize;
+ protected int heightBeforeResize;
+
/**
* Called when the size changes.
* Create the root window.
@@ -655,6 +660,29 @@ public class ScreenView extends View {
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
super.onSizeChanged(width, height, oldWidth, oldHeight);
+ if (!_xServer.isStarted()) {
+ onRealSizeChanged(width, height, oldWidth, oldHeight);
+ return;
+ }
+
+ if (!waitingForResize) {
+ widthBeforeResize = oldWidth;
+ heightBeforeResize = oldHeight;
+ }
+ waitingForResize = true;
+ resizeDelayer.removeCallbacksAndMessages(null);
+ resizeDelayer.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ waitingForResize = false;
+ if (width != widthBeforeResize || height != heightBeforeResize) {
+ onRealSizeChanged(width, height, widthBeforeResize, heightBeforeResize);
+ }
+ }
+ }, 500); // threshold in ms
+ }
+
+ protected void onRealSizeChanged(int width, int height, int oldWidth, int oldHeight){
_rootWindow = new Window(_rootId, _xServer, null, this, null, 0, 0, width, height, 0, false, true);
_sharedClipboardWindow = new Window(_xServer.nextFreeResourceId()+1, _xServer, null, this, _rootWindow, -1, -1, 1, 1, 0, true, false); // hidden window managing android <-> xServer clipboard
_sharedClipboardWindow.setIsServerWindow(true); // flag as functional server only window (there is a urgent need to introduce interfaces..)
@@ -711,6 +739,7 @@ public class ScreenView extends View {
_xServer.start();
}
+
/**
* Move the pointer on the screen.
*
diff --git a/library/src/main/java/au/com/darkside/xserver/XServer.java b/library/src/main/java/au/com/darkside/xserver/XServer.java
index 046c8f8..6aa3dcf 100644
--- a/library/src/main/java/au/com/darkside/xserver/XServer.java
+++ b/library/src/main/java/au/com/darkside/xserver/XServer.java
@@ -132,6 +132,10 @@ public class XServer {
_onStartListener = l;
}
+ public boolean isStarted(){
+ return _acceptThread != null;
+ }
+
/**
* Start the thread that listens on the socket.
* Also start the window manager if one is specified.
Also related to #26.
chromium-browser
wps
vscode
and so on...
without MIT SHM, SYNC, GLX extensions support xserver is useless.
clipRect (r, Region.Op.UNION) is deprecated and leads to crash on Android 8+.
Currently landscape mode is hardcoded. The mode should be automatically adjusted to match the screen orientation.
FLTK Programs cause APP to crash when buttons are clicked.
Implement touch gestures for mouseclicks.
The current version on F-Droid is 1.24. I know you added mouse clicks via touchscreen in 1.25 which is really useful.
Could you update the version on F-Droid, please?
If I get it right, fastlane is related to 'demo' project only, so it is better to move it there.
Is it possible to do so?
Wrong KeyCodes are sent by the XServer.
This has to be done with the help of an "invisible" server only window.
The X selection identified by the "CLIPBOARD" atom has then to be transferred to a property on this "invisible" window.
The selection identified by the "CLIPBOARD" atom has to hold the data and needs to be owned by the "invisible" window. A client can then request the content via ConvertSelection.
Return/Enter does not work on the Softkeyboard.
When enabling the keyboard only the first row of keys are working.
Show message in status bar when running in background.
Volume Keys are not captured on android 10.
(This happens because the view is not focused after start)
The SYNC extension which was merged from an old google code repository was completely broken (#15). Thats why it is disabled for now. A first partially working implementation can now be found in the xext-sync branch. When the implementation is fully done and merged, this can be closed.
Add a simple window manager which can be started optionally via a menu entry.
SYNC extension which was merged from an old google code repository is broken and needs to be reworked.
(https://www.x.org/releases/X11R7.7/doc/xextproto/sync.html#ftn.id2587121)
Some opcodes are wrong (SYNC_DESTROY) and others are missing.
Backspace on softkeyboard seems to produce a wrong keycode wich is interpreted wrong by some programs.
Leads to failing execution of FLWM. There are also problems with notifications. Maybe because of the split between xserver and xdemo.
Open up keyboard when clicking on elements that allow text input.
Hello, thank you so much for the application, it works great and really helped me out. But I accidentally discovered a problem during everyday work. I open the x server in split screen view, and as a second application - Termux, so that each time do not switch from application to application, and when I resize one of the windows, the connection is lost and the applications fall. I recorded a video demo:
Ref: https://f-droid.org/wiki/index.php?title=au.com.darkside.xdemo/lastbuild_31&oldid=285715
Ref: 5301503
All those binaries come from where? Can we build them? Hope they are open source...
Hello!
Thanks for this app! Opens interesting possibilities about cross platform GNU/Linux and Android/Linux apps!
Here is the log:
Unsupported screen format: depth: 32, bits_per_pixel: 24, red_mask: ff0000, blue_mask: ff
Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.
The application is rfcat and it's spectrum analyzer (d.specan(freq)
command)
Regards
Because I have found out, that new developer want to recode Java X11 server for Android, I would like to kindly ask you, if it would be possible to create fully functional XKB extension for this app. Or if it would require too much work from you. Pluma work, but Orca screen reader, which is very complex app and require reliable XKB extension support fails with error message, that XKB extension not present on DISPLAY 0. I Am aware, that it would require many hours to code many lines in Java to implement XKB fully. I have only kind question, if do you plan it or it is too heavy task for you for now.
X11 app work very reliably and it even contain fully accessible menu and all dialogs are fully accessible with screen reader. It is advantage of code approach, which do not use native C library with Android Native activity class. If XKB extension is presented, if you would have some time and A good will, I can help you debugging to make it work even with Orca. But what should I do to give you as detailed log as possible.
I Am advanced and ready to test and help you debugging.
Thank you very much for yours time and for yours debate.
Make at least hackers keyboard (https://f-droid.org/en/packages/org.pocketworkstation.pckeyboard/) fully functional.
Currently only the default SoftKeyboard is fully supported. (But misses special keys like ESC, Arrows, etc.)
This is mainly about these codes:
Bitwise operators only work correctly if done on the same datatypes. A cast is needed.
Hey friends!
I have some problems
When I connected to the wine gui,there were vertical lines and it seemed to be blurry. But it's clear when I connected to firefox(browse a colorful page) and xterm ,it worked well. Dose it have anything to do with static colourmaps or resolution ?could you help me ?
here are some pictures
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.