mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-06 01:20:41 +00:00
fix(gui): prevent background apps from stealing focus (#1491)
* fix(gui): prevent background apps from stealing focus * remove the `background` option as it's not really needed or used in other parts --------- Co-authored-by: Nariman Jelveh <nj@puter.com>
This commit is contained in:
committed by
GitHub
parent
d324814e06
commit
cddfa0ca11
@@ -601,7 +601,7 @@ async function UIWindow(options) {
|
||||
}
|
||||
// focus on this window and deactivate other windows
|
||||
if ( options.is_visible ) {
|
||||
$(el_window).focusWindow();
|
||||
$(el_window).focusWindow()
|
||||
}
|
||||
|
||||
if (window.animate_window_opening) {
|
||||
@@ -1523,7 +1523,9 @@ async function UIWindow(options) {
|
||||
el_window_app_iframe.contentWindow.postMessage({msg: "drop", x: (window.mouseX - rect.left), y: (window.mouseY - rect.top), items: items}, '*');
|
||||
|
||||
// bring focus to this window
|
||||
$(el_window).focusWindow();
|
||||
if (options.is_visible) {
|
||||
$(el_window).focusWindow()
|
||||
}
|
||||
}
|
||||
|
||||
// if this window is not a directory, cancel drop.
|
||||
@@ -1666,8 +1668,9 @@ async function UIWindow(options) {
|
||||
clearTimeout(drag_enter_timeout);
|
||||
// If items are dragged over this window long enough, bring it to front
|
||||
drag_enter_timeout = setTimeout(function(){
|
||||
// focus window
|
||||
$(el_window).focusWindow();
|
||||
if (options.is_visible) {
|
||||
$(el_window).focusWindow()
|
||||
}
|
||||
}, 1400);
|
||||
},
|
||||
leave: function (dragsterEvent, event) {
|
||||
|
||||
@@ -422,7 +422,7 @@ const launch_app = async (options)=>{
|
||||
// Send any saved broadcasts to the new app
|
||||
globalThis.services.get('broadcast').sendSavedBroadcastsTo(uuid);
|
||||
|
||||
// If `window-active` is set (meanign the window is focused), focus the window one more time
|
||||
// If `window-active` is set (meaning the window is focused), focus the window one more time
|
||||
// this is to ensure that the iframe is `definitely` focused and can receive keyboard events (e.g. keydown)
|
||||
if($(process.references.el_win).hasClass('window-active')){
|
||||
$(process.references.el_win).focusWindow();
|
||||
|
||||
Reference in New Issue
Block a user