I'm trying to make a simple window that closes. It wont close. It wont trigger any slots I bind.
I've spent hours looking at this with a banana but we cant figure out why.

I based this code on the sample. The steps were:
  1. Call the 3 setups
  2. Create the DisplayWindow(desc)
  3. Connect the window.sig_window_close()

I believe thats all for the setup. KeepAlive::process(0) is suppose to raise the events right?



Code:
#include <Windows.h>
#include "clanlib.h"

using namespace clan;


enum EngineState{
	ES_notready,
	ES_ready,
	ES_exitrequest,
	ES_exitforced,
};


class Engine{
public: // Constructors

	Engine(){
		state=ES_notready;
	}


public: // Public methods

	void initengine(){
		DisplayWindowDescription desc;
		desc.set_title("thing");
		desc.set_size(Size(640, 480), true);
		desc.set_allow_resize(false);
		window=DisplayWindow(desc);

		canvas=Canvas(window);
		// Because we are using the alpha channel on fonts, we must disable subpixel rendering
		FontDescription font_desc;
		font_desc.set_typeface_name("tahoma");
		font_desc.set_height(16);
		font_desc.set_subpixel(false);
		Font fall_font(canvas, font_desc);
		fall_font=Font(canvas, font_desc);

		// sf::Image icon;
		// bool good=icon.loadFromFile("Media/Icons/Play 32.png");
		// if(good) sfwindow->setIcon(32, 32, icon.getPixelsPtr());

		// Connect the Window close event
		Slot slot_quit = window.sig_window_close().connect(this, &Engine::onexit);

		// Connect a keyboard handler to on_key_up()
		Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &Engine::onkeyup);


		state=ES_ready;
	}

	// Return the state of the engine
	EngineState getstate(){
		return state;
	}

	// Public call to render.
	void draw(){
		window.flip();
	}



private: // Private methods

	// Application close request
	void onexit(){
		state=ES_exitrequest;
	}


	// What to do when a key is pressed
	void onkeyup(const InputEvent &key){
		switch(key.id){
		case keycode_escape:
			state=ES_exitrequest;
			break;
		}
	}

private:

	DisplayWindow window;
	Canvas canvas;

	EngineState state;
};


int main(const std::vector<std::string> &args){
	Engine engine;

	// Initialize ClanLib base components
	SetupCore setup_core;

	// Initialize the ClanLib display component
	SetupDisplay setup_display;

	// Setup display devices
	SetupD3D setup_d3d;
	SetupGL setup_gl;


	engine.initengine();

	while(engine.getstate()!=ES_exitrequest && engine.getstate()!=ES_exitforced){
		KeepAlive::process(0);
		engine.draw();
	}

	return 0;
}

Application app(&main);