sidorares / node-x11

X11 node.js network protocol client
MIT License
518 stars 72 forks source link

X11 Server #152

Open RossComputerGuy opened 7 years ago

RossComputerGuy commented 7 years ago

I'm trying to build my own x11 server and I've built upon the existing code, but I'm stuck at pack_stream.pack("CxSSSa",[1,11,0,hello.length/4,hello]); and I don't know what hello is suppose to be set to.

sidorares commented 7 years ago

What type of server you building? I can't remember how complete server side of this library is, and it does not attempt to implement any functionality/semantics at all, just protocol. Intended use case is various types of proxy servers talking to "Real" x11 server

sidorares commented 7 years ago

looks like you are talking about this line: https://github.com/sidorares/node-x11/blob/f040f8bbba7b5be7f1ef1223dde495f92ade3284/lib/xserver.js#L153

( wow, there is hard coded fs.readFile there )

I'm pretty sure this is server side of what happens here: https://github.com/sidorares/node-x11/blob/97a582be5c135c884342035e9967b2480d9e93ea/lib/handshake.js#L111

Have a look at what readServerHello does on client, from there you can figure out how to serialize that on server

RossComputerGuy commented 7 years ago

I've not been able to figure it out, I've spent the last few hours looking and couldn't figure it out.

sidorares commented 7 years ago

I might be able to help later today but no promices

RossComputerGuy commented 7 years ago

Here is a chunk of my working code

this.pack_stream.pack("C",[1]);
        this.pack_stream.flush();

        this.pack_stream.pack("xSSSLLLLSSCCCCCCCCxxxxp",[
            this.protocolMajor, // major
            this.protocolMinor, // minor
            (32+this.server.formats.getByteLength()+stringPad(this.vendor)+this.server.screens.getByteLength())/4, // xlen
            0, // release
            this.resource_id_base, // resource_base
            this.resource_id_mask, // resource_mask
            255, // motion_buffer_size
            this.vendor.length, // vlen
            0xffff, // max_request_length
            this.server.screens.arr.length, // screen_num
            this.server.formats.arr.length, // format_num
            0, // image_byte_order
            0, // bitmap_bit_order
            32, // bitmap_scanline_unit
            32, // bitmap_scanline_pad
            8, // min_keycode
            255, // max_keycode

            this.vendor // vendor
        ]);
        this.pack_stream.flush();
        for(var format of this.server.formats.arr) {
            this.pack_stream = format.pack(this.pack_stream);
            this.pack_stream.flush();
        }
        for(var screen of this.server.screens.arr) {
            this.pack_stream = screen.pack(this.pack_stream);
            this.pack_stream.flush();
        }
RossComputerGuy commented 5 years ago

X11 Server

sidorares commented 5 years ago

not much there yet @SpaceboyRoss01 :) What are you plans re server implementation?

RossComputerGuy commented 5 years ago

I plan to write a basic server that people use event listeners to know what happens.14.11.2018, 14:26, "Andrey Sidorov" notifications@github.com:not much there yet @SpaceboyRoss01 :) What are you plans re server implementation?

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

sidorares commented 5 years ago

Would it actually implement some x server functionality or act as a proxy to "real" server?

RossComputerGuy commented 5 years ago

An actual X Server14.11.2018, 14:33, "Andrey Sidorov" notifications@github.com:Would it actually implement some x server functionality or act as a proxy to "real" server?

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

sidorares commented 5 years ago

What would it use for display? Offscreen pixmap / browser / etc?

these two use browser:

https://github.com/GothAck/javascript-x-server https://github.com/ttaubert/x-server-js

RossComputerGuy commented 5 years ago

Actually, there's an event that will be emitted when the display is updated.

RossComputerGuy commented 5 years ago

I might need some help with writing the code to get it to work.