unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Alan Third <alan@idiocy.org>
Cc: emacs-devel@gnu.org
Subject: Re: Whether a struct window *w is a live/valid window.
Date: Fri, 22 Mar 2019 23:30:26 -0700	[thread overview]
Message-ID: <m21s2yumpp.wl%esq@lawlist.com> (raw)

Thank you, Allen, for reading and responding to this particular thread.

I could be wrong, but it appears to me that removal of the vertical scroll bars does not remove the glyphs that are underneath.  As such, the glyphs that are underneath are not redrawn.  However, removal of the vertical scroll bar has the side effect of removing the fake cursors.  My workaround has been to remove the scroll bars graciously so as not to cause removal of the fake cursors.  That way, the fake cursors do not need to be redrawn.  On the NS port, I use removeFromSuperviewWithoutNeedingDisplay.  On the w32 port, I use SendMessage (hwnd, WM_SETREDRAW, false, 0) before destroying a window (DestroyWindow); and, I set the bRepaint argument of MoveWindow to false when the window just needs to be moved.

In the current draft of multiple fake cursors, they are laid immediately following the calls to draw_glyphs.

FACT PATTERNS:  Two (2) adjacent windows (left/right) within a single frame.  Either the user deletes the left window; or, the user deletes the right window.  When the user deletes the left window, its scroll bar (center of screen) is no longer associated with a live/valid window.  When a user deletes the right window, the scroll bar (center of screen) remains associated with the left window but needs to be moved.

When either the left or right window is deleted, update_window redraws all of the screen lines and effectively erases the scroll bar (center of screen).  In a related thread, Eli Z. was kind enough to provide an outline of the relevant events:

  . `redisplay_internal' calls the `condemn_scroll_bars_hook', which marks all scroll bars as candidates for deletion.

  . Then `redisplay_internal' calls `redisplay_windows', which walks the window-tree and examines each window, whereby each window that is still alive in the window-tree "redeems" its scroll bars by marking them not to be deleted.

  . Then `redisplay_internal' calls `judge_scroll_bars_hook', which removes all the scroll bars that were not "redeemed".

  . And only after that `redisplay_internal' calls `update_frame', which calls `update_window' for each live window, and that ends up calling `draw_glyphs' to deliver the updated contents to the glass.

When I stepped through the code, I observed that removal of the scroll bars is delayed on the NS and W32 platforms.  update_window runs _before_ scroll bars are actually removed.  Scroll bar removal occurs during read_char at approximately the location of read_decoded_event_from_main_queue.

http://www.lawlist.com/images/after_03_10_2019.png

The w32 port uses a Lisp_Object for the WINDOW component of the scroll bar structure.  Calling WINDOW_LIVE_P seems to be working well on that platform.

The NS port uses `struct window *window`, and Emacs occasionally crashes when I have attempted to use XSETWINDOW (as described in the initial post of this thread).  My workaround is to tentatively use:

   if (w != NULL
       && NILP (w->contents))

instead of trying to create a Lisp_Object with XSETWINDOW so that I can then use WINDOW_LIVE_P.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [03-22-2019 08:01:48] <22 Mar 2019 15:01:48 +0000>
> From: Alan Third <alan@idiocy.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: Emacs Devel <emacs-devel@gnu.org>
> Subject: Re: Whether a struct window *w is a live/valid window.
> 
> On Wed, Mar 20, 2019 at 01:14:13PM -0700, Keith David Bershatsky wrote:
> > I am working on feature requests #22873 (multiple fake cursors) and
> > crosshairs #17684 (crosshairs that track the cursor position).
> >
> > In trying to resolve an issue where removal of vertical scroll bars
> > erased fake cursors that were laid during update_window
> 
> Sorry if this has already been covered, but after the scrollbar is
> removed the toolkit should mark the area under the toolkit as needing
> redrawn. That will then cause [EmacsView drawRect:], and subsequently
> expose_frame, to be called on that rectangle. Why aren't the cursors
> being redrawn at that time?
> 
> Is everything else ‘under' the scrollbars being drawn correctly?
> --
> Alan Third



             reply	other threads:[~2019-03-23  6:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23  6:30 Keith David Bershatsky [this message]
2019-03-23 10:49 ` Whether a struct window *w is a live/valid window Alan Third
  -- strict thread matches above, loose matches on Subject: below --
2019-03-23 17:03 Keith David Bershatsky
2019-03-20 20:14 Keith David Bershatsky
2019-03-22 15:01 ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21s2yumpp.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).