pelya / xserver-xsdl

XSDL - X.Org server ported to Android using SDL.
https://play.google.com/store/apps/details?id=x.org.server
Other
311 stars 55 forks source link

Does XSDL support RandR? #168

Closed foryoung2018 closed 11 months ago

foryoung2018 commented 1 year ago

I want to adjust the size of a SurfaceView in an Android application, but currently, it results in an image scaling effect. What should I do? (Right now, I'm changing the screen size and then sending a ConfigureNotify, but it seems that the changes are not taking effect on the client side)

pelya commented 1 year ago

RandR support is broken, I've never got my hands on fixing it

On Wed, 25 Oct 2023, 10:43 foryoung2018, @.***> wrote:

I want to adjust the size of a SurfaceView in an Android application, but currently, it results in an image scaling effect. What should I do? (Right now, I'm changing the screen size and then sending a ConfigureNotify, but it seems that the changes are not taking effect on the client side)

— Reply to this email directly, view it on GitHub https://github.com/pelya/xserver-xsdl/issues/168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABF5QH45UOGTFC2ZBEX35LYBC7KJAVCNFSM6AAAAAA6O43BDKVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3DANZWGAYDMMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

foryoung2018 commented 1 year ago

Can I using ResizeWindow, or X11_ResizeWindow()?

NO RESIZEWINDOW IN: jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c

VideoBootStrap ANDROID_bootstrap = {
    "android", "SDL android video driver",
    ANDROID_Available, ANDROID_CreateDevice
};

RESIZEWINDOW IN: jni/sdl-1.2/src/video/x11/SDL_x11video.c

VideoBootStrap X11_bootstrap = {
    "x11", "X Window System",
    X11_Available, X11_CreateDevice
};
static int X11_ResizeWindow(_THIS,
            SDL_Surface *screen, int w, int h, Uint32 flags){
    if ( ! SDL_windowid ) {
        /* Resize the window manager window */
        X11_SetSizeHints(this, w, h, flags);
        window_w = w;
        window_h = h;
        XResizeWindow(SDL_Display, WMwindow, w, h);
        if ( flags & SDL_FULLSCREEN ) {
            if ( screen->flags & SDL_FULLSCREEN ) {
                X11_ResizeFullScreen(this);
            } else {
                screen->flags |= SDL_FULLSCREEN;
                X11_EnterFullScreen(this);
            }
        } else {
            if ( screen->flags & SDL_FULLSCREEN ) {
                screen->flags &= ~SDL_FULLSCREEN;
                X11_LeaveFullScreen(this);
            }
        }
        XResizeWindow(SDL_Display, SDL_Window, w, h);
    }
    return(0);
}
foryoung2018 commented 1 year ago

I have completed the work of implementing the RandR protocol on the Android platform. The implementation is as follows: first, I implemented the RRMonitor function, then the RandR functions to ensure that the client can obtain monitor information. Next, I kept the screen size unchanged and, through the ConfigureNotify event, updated the monitor size. This way, the client can dynamically adapt its size.