* Set focus to the most recent dialog but ONLY if they are of type Meta.WindowType.DIALOG or Meta.WindowType.MODAL_DIALOG. Other dialogs are not necessarily in front of the main window and do not necessarily require the users attention.
()
| 1126 | * Set focus to the most recent dialog but ONLY if they are of type Meta.WindowType.DIALOG or Meta.WindowType.MODAL_DIALOG. Other dialogs are not necessarily in front of the main window and do not necessarily require the users attention. |
| 1127 | */ |
| 1128 | focusDialogs(): boolean { |
| 1129 | let focused = false; |
| 1130 | if ( |
| 1131 | this.lifecycleState.type === 'window' && |
| 1132 | this.lifecycleState.dialogs |
| 1133 | ) { |
| 1134 | [ |
| 1135 | ...this.lifecycleState.dialogs.filter((dialog) => |
| 1136 | // Filter out Meta.WindowType.UTILITY Windows |
| 1137 | [ |
| 1138 | Meta.WindowType.DIALOG, |
| 1139 | Meta.WindowType.MODAL_DIALOG, |
| 1140 | ].includes(dialog.metaWindow.window_type) |
| 1141 | ), |
| 1142 | ] |
| 1143 | .sort((firstDialog, secondDialog) => { |
| 1144 | return ( |
| 1145 | firstDialog.metaWindow.user_time - |
| 1146 | secondDialog.metaWindow.user_time |
| 1147 | ); |
| 1148 | }) |
| 1149 | .forEach((dialog, index, array) => { |
| 1150 | this.set_child_above_sibling(dialog.clone, null); |
| 1151 | if (index === array.length - 1) { |
| 1152 | dialog.metaWindow.activate(global.get_current_time()); |
| 1153 | focused = true; |
| 1154 | } |
| 1155 | }); |
| 1156 | } |
| 1157 | return focused; |
| 1158 | } |
| 1159 | |
| 1160 | /** |
| 1161 | * When a MetaWindow associated to this MsWindow is unManaged we remove it from the dialogs if it's a dialog or the MainMetaWindow then we kill the MsWindow only if it was the last one. |
no test coverage detected