I do not see the problem with a 360 lines long input processing function.

OK, more seriously, yes a lot of things have gone wrong with clanGUI and most of the standard components were there along for the entire ride. Originally, clanGUI did not use CSSLayout and had its own simplified property system for styling. It also did not have any official way to position components beyond set_geometry(box). GUILayout was introduced as the way to do automatic layouts, but Harry was the only one to ever implement something using this interface (the top,left,right,bottom scaling layout algorithm). Then later on CSSLayout was introduced as an attempt to layout and style the way HTML does it. The standard components never really got properly ported and still use some nasty mixture of manual layout and hardcoded spacing rules.

I would caution against trying to rewrite all the components from scratch though. Especially the line/text edit controls and the listview are a lot of work. It is a lot easier to simply clean up a function like the one you linked by creating the helpers you mention and move the code over. This is easier than a rewrite because the amount of small things an input control must support adds up. A rewrite would most certainly result in forgetting half of the features in the initially rewritten version.

Anyway, to move clanGUI into a more repaired state, you'd have to figure out which of the following things you want to do:

  1. Remove all styling code. Remove all layout code. Remove all XML/CSS code. Remove all standard components. clanGUI is now a simple component tree with event and focus handling. It is repaired and sane, but still lacks especially a proper automatic layout strategy.
  2. Create a new styling strategy that doesn't rely on CSS. Create new layout method. Port the standard components. Still remove XML/CSS stuff as it won't port.
  3. Rewrite the entire thing.

Personally I'm working on a sort of mix between a rewrite and porting. It is still very much in its earliest stages and currently doesn't rely on ClanLib at all. It is called UICore and its github project can be found here: https://github.com/dpjudas/uicore. The main difference between this version and current clanGUI is that I'm trying to describe the style in a way more useful from code and without CSS selectors. If my experiments in that project turn out successful I may create a ClanLib backend for its Canvas for my ClanLib UI needs.