Screen saver tweaks

This commit is contained in:
Dustin Brett 2025-05-15 21:43:57 -07:00
parent 0d38b972a8
commit 1562f41770
3 changed files with 14 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import styled from "styled-components";
import { MAX_ZINDEX } from "utils/constants";
const StyledScreenSaver = styled.iframe`
background-color: #000;
background-color: transparent;
border: none;
height: 100%;
inset: 0;

View File

@ -4,6 +4,7 @@ import { type ComponentProcessProps } from "components/system/Apps/RenderCompone
import { useFileSystem } from "contexts/fileSystem";
import { useProcesses } from "contexts/process";
import { MILLISECONDS_IN_SECOND } from "utils/constants";
import { haltEvent } from "utils/functions";
const ONE_TIME_PASSIVE_CAPTURE_EVENT = {
capture: true,
@ -43,13 +44,18 @@ const ScreenSaver: FC<ComponentProcessProps> = ({ id }) => {
}),
[readFile, url]
);
const closeScreenSaver = useCallback(() => {
if (iframeRef.current) {
iframeRef.current.style.display = "none";
}
const closeScreenSaver = useCallback(
(event?: Event) => {
if (event) haltEvent(event);
close(id);
}, [close, id]);
if (iframeRef.current) {
iframeRef.current.style.display = "none";
}
close(id);
},
[close, id]
);
useEffect(() => {
if (url && !srcDoc[url]) loadScreenSaver();

View File

@ -880,7 +880,7 @@ export const haltEvent = (
| React.MouseEvent
): void => {
try {
if (event.cancelable) {
if (event?.cancelable) {
event.preventDefault();
event.stopPropagation();
}