mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Prevent flicker on resize and fix race condition on clicks to max/norm
This commit is contained in:
parent
b305779e22
commit
5766fe8d2a
1 changed files with 41 additions and 41 deletions
|
|
@ -386,7 +386,6 @@ in on-resize, on-full-screen-change and on-orientation-change events."))
|
||||||
(maphash (lambda (key value)
|
(maphash (lambda (key value)
|
||||||
(declare (ignore key))
|
(declare (ignore key))
|
||||||
(cond ((window-maximized-p value)
|
(cond ((window-maximized-p value)
|
||||||
(window-normalize value :focus nil)
|
|
||||||
(window-maximize value :focus nil))
|
(window-maximize value :focus nil))
|
||||||
(t
|
(t
|
||||||
(make-in-bounds value mbh bh bw))))
|
(make-in-bounds value mbh bh bw))))
|
||||||
|
|
@ -784,6 +783,14 @@ The on-window-change clog-obj received is the new window"))
|
||||||
(set-on-pointer-move obj nil)
|
(set-on-pointer-move obj nil)
|
||||||
(set-on-pointer-cancel obj nil)
|
(set-on-pointer-cancel obj nil)
|
||||||
(set-on-pointer-up obj nil)
|
(set-on-pointer-up obj nil)
|
||||||
|
(cond ((window-maximized-p (drag-obj app))
|
||||||
|
(window-maximize (drag-obj app) :focus nil))
|
||||||
|
(t
|
||||||
|
(let* ((body (connection-data-item (drag-obj app) "clog-body"))
|
||||||
|
(mbh (menu-bar-height (drag-obj app)))
|
||||||
|
(bh (height (html-document body)))
|
||||||
|
(bw (width (html-document body))))
|
||||||
|
(make-in-bounds (drag-obj app) mbh bh bw))))
|
||||||
(cond ((equalp (in-drag app) "m")
|
(cond ((equalp (in-drag app) "m")
|
||||||
(fire-on-window-move-done (drag-obj app)))
|
(fire-on-window-move-done (drag-obj app)))
|
||||||
((equalp (in-drag app) "s")
|
((equalp (in-drag app) "s")
|
||||||
|
|
@ -1053,26 +1060,27 @@ the browser."))
|
||||||
:focus (default t)."))
|
:focus (default t)."))
|
||||||
|
|
||||||
(defmethod window-maximize ((obj clog-gui-window) &key (focus t))
|
(defmethod window-maximize ((obj clog-gui-window) &key (focus t))
|
||||||
(let ((app (connection-data-item obj "clog-gui")))
|
(with-sync-event (obj) ; prevent race condition of maximize/normalize
|
||||||
(when focus
|
(let ((app (connection-data-item obj "clog-gui")))
|
||||||
(unless (keep-on-top obj)
|
(when focus
|
||||||
(window-focus obj)))
|
(unless (keep-on-top obj)
|
||||||
(when (fire-on-window-can-maximize obj)
|
(window-focus obj)))
|
||||||
(unless (window-maximized-p obj)
|
(when (fire-on-window-can-maximize obj)
|
||||||
(setf (last-x obj) (left obj))
|
(unless (window-maximized-p obj)
|
||||||
(setf (last-y obj) (top obj))
|
(setf (last-x obj) (left obj))
|
||||||
(setf (last-height obj) (height obj))
|
(setf (last-y obj) (top obj))
|
||||||
(setf (last-width obj) (width obj)))
|
(setf (last-height obj) (height obj))
|
||||||
(setf (top obj) (unit :px (menu-bar-height obj)))
|
(setf (last-width obj) (width obj)))
|
||||||
(setf (left obj) (unit :px 0))
|
(setf (top obj) (unit :px (menu-bar-height obj)))
|
||||||
(setf (width obj) (unit :vw 100))
|
(setf (left obj) (unit :px 0))
|
||||||
(setf (left obj) (unit :px (body-left-offset app)))
|
(setf (width obj) (unit :vw 100))
|
||||||
(setf (width obj) (- (width obj)
|
(setf (left obj) (unit :px (body-left-offset app)))
|
||||||
(body-left-offset app)
|
(setf (width obj) (- (width obj)
|
||||||
(body-right-offset app)))
|
(body-left-offset app)
|
||||||
(setf (height obj)
|
(body-right-offset app)))
|
||||||
(- (inner-height (window (body app))) (menu-bar-height obj)))
|
(setf (height obj)
|
||||||
(fire-on-window-size-done obj))))
|
(- (inner-height (window (body app))) (menu-bar-height obj)))
|
||||||
|
(fire-on-window-size-done obj)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; window-normalize ;;
|
;; window-normalize ;;
|
||||||
|
|
@ -1083,17 +1091,18 @@ the browser."))
|
||||||
:focus (default t)."))
|
:focus (default t)."))
|
||||||
|
|
||||||
(defmethod window-normalize ((obj clog-gui-window) &key (focus t))
|
(defmethod window-normalize ((obj clog-gui-window) &key (focus t))
|
||||||
(when focus
|
(with-sync-event (obj) ; prevent race condition of maximize/normalize
|
||||||
(unless (keep-on-top obj)
|
(when focus
|
||||||
(window-focus obj)))
|
(unless (keep-on-top obj)
|
||||||
(when (fire-on-window-can-normalize obj)
|
(window-focus obj)))
|
||||||
(when (window-maximized-p obj)
|
(when (fire-on-window-can-normalize obj)
|
||||||
(setf (width obj) (last-width obj))
|
(when (window-maximized-p obj)
|
||||||
(setf (height obj) (last-height obj))
|
(setf (width obj) (last-width obj))
|
||||||
(setf (top obj) (last-y obj))
|
(setf (height obj) (last-height obj))
|
||||||
(setf (left obj) (last-x obj))
|
(setf (top obj) (last-y obj))
|
||||||
(setf (last-width obj) nil)
|
(setf (left obj) (last-x obj))
|
||||||
(fire-on-window-size-done obj))))
|
(setf (last-width obj) nil)
|
||||||
|
(fire-on-window-size-done obj)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; window-toggle-maximize ;;
|
;; window-toggle-maximize ;;
|
||||||
|
|
@ -1399,15 +1408,6 @@ interactions. Use window-end-modal to undo."))
|
||||||
(setf (on-window-move-done obj) handler))
|
(setf (on-window-move-done obj) handler))
|
||||||
|
|
||||||
(defmethod fire-on-window-move-done ((obj clog-gui-window))
|
(defmethod fire-on-window-move-done ((obj clog-gui-window))
|
||||||
(cond ((window-maximized-p obj)
|
|
||||||
(window-normalize obj :focus nil)
|
|
||||||
(window-maximize obj :focus nil))
|
|
||||||
(t
|
|
||||||
(let* ((body (connection-data-item obj "clog-body"))
|
|
||||||
(mbh (menu-bar-height obj))
|
|
||||||
(bh (height (html-document body)))
|
|
||||||
(bw (width (html-document body))))
|
|
||||||
(make-in-bounds obj mbh bh bw))))
|
|
||||||
(when (on-window-move-done obj)
|
(when (on-window-move-done obj)
|
||||||
(funcall (on-window-move-done obj) obj)))
|
(funcall (on-window-move-done obj) obj)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue