canvas.gui: Window input focus handling.
This commit is contained in:
parent
e6edd424c3
commit
804b42cfa4
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue