Ideas for a brand new widget toolkit

Joakim joakim at airpost.net
Tue Aug 13 13:00:26 PDT 2013


On Tuesday, 13 August 2013 at 13:23:07 UTC, Paul Z. Barsan wrote:
> Think of this topic as writing letters to Santa, so: what say 
> you ?
I'll take this opportunity to put forward a GUI idea I plan on 
implementing in D at some point.

The concept is to build a client-server GUI runtime that is as 
simple as possible on the client side.  That means the client's 
graphics are a small wrapper around OpenGL, simply slapping 
rectangles composed of pngs and text on screen and handling mouse 
and keyboard events.  The client sends event data back to the 
server in a highly optimized binary protocol, which then does all 
layout and GUI calculations.  Finally, the server sends simple 
commands back to the server saying what text/pngs/rectangles it 
wants moved or updated.  The client simply handles absolutely 
positioned rectangles with a z-index, all relative layout and 
higher-level state is calculated on the server.

The idea is to keep the GUI client as lean as possible, moving as 
much calculation as possible to the server, ie when you resize 
your window, the server has to recalculate layout, not the 
client.  It would be incredibly easy to port this client to new 
platforms, such a lean client would be ideal for mobile 
platforms, efficient and low power.  I think of it as the web, ie 
HTML/CSS/javascript, done right.  There would be no javascript or 
other general purpose language on the client, far too complicated 
and insecure.

Obviously this runtime wouldn't suffice for everything: you're 
not going to write real-time physics-based games in such a GUI 
runtime, which you could do in javascript in a web browser.  The 
network lag would kill you, since all layout and GUI calculations 
are done on the server.  But such a lean GUI runtime would handle 
most light and medium-strength GUI applications, most apps south 
of Photoshop. ;)

This is a unique, innovative approach I'd like to see taken, 
planning to do it myself if nobody gets around to it first.  But 
I thought I'd throw it out there as a possible approach for a D 
GUI to take, see what others think.


More information about the Digitalmars-d mailing list