1
0
Fork 0

canvas.gui: Window input focus handling.

This commit is contained in:
Thomas Geymayer 2014-08-04 23:48:29 +02:00
parent e6edd424c3
commit 804b42cfa4

View file

@ -195,6 +195,7 @@ var Window = {
# me.onFocusIn();
me._onStateChange();
gui.focused_window = me;
setInputFocus(me);
return me;
},
#
@ -207,6 +208,7 @@ var Window = {
# me.onFocusOut();
me._onStateChange();
gui.focused_window = nil;
setInputFocus(nil);
return me;
},
setPosition: func
@ -475,6 +477,12 @@ var Window = {
}
};
# Clear focus on click outside any window
getDesktop().addEventListener("mousedown", func {
if( gui.focused_window != nil )
gui.focused_window.clearFocus();
});
# Provide old 'Dialog' for backwards compatiblity (should be removed for 3.0)
var Dialog = {
new: func(size, type = nil, id = nil)