From 99dbd92a3d13e68e82a5e7950ca32e2e19ae9c87 Mon Sep 17 00:00:00 2001 From: Lightning11wins Date: Mon, 22 Jun 2026 12:24:28 -0600 Subject: [PATCH 1/2] Fix bugs caused by the assumption that a modal is never draggable. --- centrallix-os/sys/js/htdrv_page.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/centrallix-os/sys/js/htdrv_page.js b/centrallix-os/sys/js/htdrv_page.js index 5f6a8a1e2..a57dc45c7 100755 --- a/centrallix-os/sys/js/htdrv_page.js +++ b/centrallix-os/sys/js/htdrv_page.js @@ -2735,6 +2735,8 @@ function pg_dotip_complete() // Is the DIV or LAYER "l" restricted due to a modal dialog? function pg_checkmodal(l) { + // Let events through while a window drag is in progress. + if (window.wn_current) return false; var restricted = pg_modallayer && !pg_isinlayer(pg_modallayer, l) && !(wgtrIsNode(l) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l)); if (restricted && l.kind == 'dt_pn' && ((l.ml && wgtrIsNode(l.ml) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l.ml)) || (l.parentElement && l.parentElement.ml && wgtrIsNode(l.parentElement.ml) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l.parentElement.ml)))) restricted = false; From 5618e3ae1d7bd99dd7c153782544a62b09502a77 Mon Sep 17 00:00:00 2001 From: Lightning11wins Date: Mon, 22 Jun 2026 12:43:53 -0600 Subject: [PATCH 2/2] Fix edge cases from the previous bug fix. --- centrallix-os/sys/js/htdrv_page.js | 8 ++++---- centrallix-os/sys/js/htdrv_window.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/centrallix-os/sys/js/htdrv_page.js b/centrallix-os/sys/js/htdrv_page.js index a57dc45c7..2f4005504 100755 --- a/centrallix-os/sys/js/htdrv_page.js +++ b/centrallix-os/sys/js/htdrv_page.js @@ -2735,8 +2735,6 @@ function pg_dotip_complete() // Is the DIV or LAYER "l" restricted due to a modal dialog? function pg_checkmodal(l) { - // Let events through while a window drag is in progress. - if (window.wn_current) return false; var restricted = pg_modallayer && !pg_isinlayer(pg_modallayer, l) && !(wgtrIsNode(l) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l)); if (restricted && l.kind == 'dt_pn' && ((l.ml && wgtrIsNode(l.ml) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l.ml)) || (l.parentElement && l.parentElement.ml && wgtrIsNode(l.parentElement.ml) && wgtrIsNode(pg_modallayer) && wgtrIsChild(pg_modallayer, l.parentElement.ml)))) restricted = false; @@ -2754,7 +2752,8 @@ function pg_mousemove(e) pg_tipinfo.x = e.pageX; pg_tipinfo.y = e.pageY; } - if (pg_checkmodal(ly)) return EVENT_HALT | EVENT_PREVENT_DEFAULT_ACTION; + // A window drag must keep tracking the cursor when it moves off the modal. + if (pg_checkmodal(ly) && !window.wn_current) return EVENT_HALT | EVENT_PREVENT_DEFAULT_ACTION; /*if (pg_modallayer) { if (!pg_isinlayer(pg_modallayer, ly)) return EVENT_HALT | EVENT_PREVENT_DEFAULT_ACTION; @@ -2882,7 +2881,8 @@ function pg_mouseup(e) { var ly = e.layer; if (ly.mainlayer) ly = ly.mainlayer; - if (pg_checkmodal(ly)) return EVENT_HALT | EVENT_PREVENT_DEFAULT_ACTION; + // A window drag must be able to terminate when released off the modal. + if (pg_checkmodal(ly) && !window.wn_current) return EVENT_HALT | EVENT_PREVENT_DEFAULT_ACTION; /*if (pg_modallayer) { if (!pg_isinlayer(pg_modallayer, ly)) return EVENT_HALT | EVENT_ALLOW_DEFAULT_ACTION; diff --git a/centrallix-os/sys/js/htdrv_window.js b/centrallix-os/sys/js/htdrv_window.js index 02bfc326c..3df42f803 100644 --- a/centrallix-os/sys/js/htdrv_window.js +++ b/centrallix-os/sys/js/htdrv_window.js @@ -749,8 +749,8 @@ function wn_mousedown(e) { if (e.target.name == 'close') pg_set(e.target,'src','/sys/images/02bigclose.gif'); - else if ((e.mainlayer.has_titlebar && cx__capabilities.Dom0NS && e.pageY < e.mainlayer.pageY + 24) || - (cx__capabilities.Dom1HTML && e.layer.subkind == 'titlebar' )) + else if (e.which == 1 && ((e.mainlayer.has_titlebar && cx__capabilities.Dom0NS && e.pageY < e.mainlayer.pageY + 24) || + (cx__capabilities.Dom1HTML && e.layer.subkind == 'titlebar' ))) { wn_current = e.mainlayer; wn_msx = e.pageX;