Giter Club home page Giter Club logo

xplain's Introduction

xplain

A set of articles and custom demos to explain how the X Window System works.

Demo framework / xserver.js

It's not just a set of jury-rigged DOM nodes and custom JavaScript. It's actually an accurate implementation of how the X server works, by implementing most of the same requests that the X server normally takes, and sending the same sorts of events back to clients. The clients written here actually look mostly like clients that use raw Xlib to do a lot of their work.

It's not 100% complete, of course. Instead of emulating a state-of-the-80s graphics API, I simply give clients the full power of <canvas> by giving them a context that's already clipped to the area of the front buffer they need to paint.

Some other optimizations or simplifications have been made either so that it seems "more JavaScript-y" or for the sake of my sanity. For instance, SelectInput is an actual request rather than being the only per-client window attribute, and the request takes a list of event strings rather than a mask. Instead of a "changed" mask like ConfigureWindow usually has, clients just leave the property out of the property bag when they send the request over.

I also commonly add custom requests and events simply to make my life easier. For instance, for the inspector, I added a X-CursorWindowChanged event so that it can track the cursor window, rather than have to have to select for Enter/ Leave events on every window through CreateNotify.

Grab semantics are slightly different (they're more like XI2 in that you can overwite an existing grab instead of having to use ChangeActivePointerGrab).

I could go on.

Since this is a mostly from-scratch implementation of a 40 year old codebase, there's probably plenty of bugs to be found. Please don't think this anything but a learning project and a demo framework. If you send me a pull request because you're basing your new VNC clone on this, I reserve rights to laugh at you and close it.

Getting around

Most of the server code is in src/server/server.js

All the demo code is in src/article-demos/

Credits

This has taken me the better part of a year, off-and-on, to write. I've found browser bugs, X server bugs, gotten my name in the HTML5 specification, and lots more.

As I say in the article, I didn't do this alone. There's a lot of people who helped me tremendously with this work. A big thanks goes to Keith Packard, Alan Coopersmith, Adam Jackson, Peter Hutterer, and Owen Taylor who all helped me figure a lot of the hairier parts of X11.

xplain's People

Contributors

davidshepherd7 avatar johshoff avatar lilyball avatar magcius avatar mazayus avatar mynamewastaken avatar ryantm avatar

Watchers

 avatar

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.