comparison dynamin/gui/window.d @ 73:68be24186634

Remove warning when Application.run is not called, since I can't use a static ~this (circular dep error)
author Jordan Miner <jminer7@gmail.com>
date Wed, 12 Aug 2009 05:14:04 -0500
parents b5460ba7c93e
children 7adc733aca2d
comparison
equal deleted inserted replaced
72:8dac206ea523 73:68be24186634
44 static: 44 static:
45 mixin ApplicationBackend; 45 mixin ApplicationBackend;
46 package Thread eventThread; 46 package Thread eventThread;
47 /// Starts event processing. Must be called from main(). 47 /// Starts event processing. Must be called from main().
48 void run(Window w = null) { 48 void run(Window w = null) {
49 Window.hasProcessedEvents = true;
50
51 auto thread = Thread.getThis(); 49 auto thread = Thread.getThis();
52 assert(eventThread is null || eventThread is thread, 50 assert(eventThread is null || eventThread is thread,
53 "Application.run called from two different threads"); 51 "Application.run called from two different threads");
54 eventThread = thread; 52 eventThread = thread;
55 53
162 * The appearance of a window with Windows Classic: 160 * The appearance of a window with Windows Classic:
163 * 161 *
164 * $(IMAGE ../web/example_window.png) 162 * $(IMAGE ../web/example_window.png)
165 */ 163 */
166 class Window : Container { 164 class Window : Container {
167 private static hasProcessedEvents = false;
168 ~this() { // this should be a static ~this, but I get a circular dep error
169 if(!hasProcessedEvents) {
170 Stdout("Warning: a window was created, but Application.run");
171 Stdout(" was not called to process events").newline;
172 }
173 }
174 protected: 165 protected:
175 mixin WindowBackend; 166 mixin WindowBackend;
176 bool _visible; 167 bool _visible;
177 BorderSize _borderSize; 168 BorderSize _borderSize;
178 Window _owner; 169 Window _owner;