Git Product home page Git Product logo

android-xserver's People

Contributors

aelmahmoudy avatar izzysoft avatar mattkwan avatar nwrkbiz avatar sumitomohiko avatar utzcoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-xserver's Issues

Bitwise operation on pixels

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

_paint.setXfermode(new PorterDuffXfermode(Mode.XOR));

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.

XServer in foreground may restart after the device was unlocked

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.)

protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {

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.

Update version on F-Droid

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?

Allow sharing clipboard between Android and X11 apps.

This has to be done with the help of an "invisible" server only window.

X11 to Android:

The X selection identified by the "CLIPBOARD" atom has then to be transferred to a property on this "invisible" window.

Android to X11:

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.

Implement proper SYNC extension.

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.

Connection is lost during window resizing in split screen mode

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:

20210403_134812.mp4

Not working with PySide2 app unsupported screen format

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

XKB extension not presented on DISPLAY 0

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.

The display of wine gui is unclear

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
Screenshot_20220514_181725

IMG_20220508_142956
Screenshot_20220514_204819

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.