From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Whether a struct window *w is a live/valid window. Date: Sat, 23 Mar 2019 10:49:55 +0000 Message-ID: <20190323104955.GA48472@breton.holly.idiocy.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="30997"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.11.3 (2019-02-01) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 23 12:04:59 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h7eSP-0007tP-K5 for ged-emacs-devel@m.gmane.org; Sat, 23 Mar 2019 12:04:57 +0100 Original-Received: from localhost ([127.0.0.1]:41753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7eSO-0001Dz-MO for ged-emacs-devel@m.gmane.org; Sat, 23 Mar 2019 07:04:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7eRc-0001CL-Ie for emacs-devel@gnu.org; Sat, 23 Mar 2019 07:04:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7eDy-0001gw-Dh for emacs-devel@gnu.org; Sat, 23 Mar 2019 06:50:04 -0400 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:52912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7eDw-0001fg-O8 for emacs-devel@gnu.org; Sat, 23 Mar 2019 06:50:01 -0400 Original-Received: by mail-wm1-x335.google.com with SMTP id a184so4387052wma.2 for ; Sat, 23 Mar 2019 03:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=4CsIo4Is96EH0rw8A5ynAAvL+clz0qXAYbax/bwMVwI=; b=WSO9LOiDcbQ4W2SszlCdyyMKbEclS4zhI0mKa6+AEQsWR6BClHDOVrU+zYRnl71/Vh 3Z1o/SUhyqVi/y8Y3ewi0K95Wyz4If9Iox7hWfqBsSPV6iX/UfEK12UFoW8VTbJu9fL3 CajPFBcIzrMaOq7+WdF9o+gHomO+urQqYHn711x8XRFCVAU0nXmgSpZ051bB5Rqv1aIQ 5Arp8zZx7GXfPmKHDfkUCuG2a14cDBIomDgcZAe9P/6yayf/irK1MJdeeFTwwV0GHcTY QlSXuvGTrTIdLSrKNNvrCPvb+rUiVX/RW4a3nWanZ0fGwOsQ3VQ5s4Y2lq4DNfivSb1B nyrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=4CsIo4Is96EH0rw8A5ynAAvL+clz0qXAYbax/bwMVwI=; b=PSqoXE2FoPgOCgOSlS2daBIsa2zRM3VHyYnQR2KdAGIhMtJ/c+HVNr/dIlDpwgH7MM FsHD5e7eXuSfYREweCaGyX/exaVA6DKhm3hYIr1bvpkBrCzcLhJNU01I7eMVgjMNQXWp OMFfSymAOCjWFTNxx90IJlc820zJAN+6wGYyh5EmpXuR0yseopGT+Itc4mcSZD20DZFg MjJSqmr8xreyHBgtngu4UQZiwJCA2KOOnQOD6ELK5mXqXBVvtbKB3UJV/Ohd9h7dfjiW Gz42lj32Iavxr6MntIf9vMocME+Mkx24j71ENaJl1JhvStjl06qcE8Hk+Gscf5XUbo7a if+g== X-Gm-Message-State: APjAAAVwTD9nVhrtnS0i1t3sF3fhjIYld1Yo9PHS+lsN3KI/tjLLI0Md Q4cpcapWuU/9NknxalES5JnV/F+D X-Google-Smtp-Source: APXvYqzO+v+C/O6gxgV53U8AOX+1ZNukN7q2tlzJiiw/gCQMSf0NWG/7REmzARrFiLxcDbIt8Bt+pg== X-Received: by 2002:a1c:d04a:: with SMTP id h71mr337221wmg.120.1553338199081; Sat, 23 Mar 2019 03:49:59 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-f0b1-3581-cbe5-87b0.holly.idiocy.org. [2001:8b0:3f8:8129:f0b1:3581:cbe5:87b0]) by smtp.gmail.com with ESMTPSA id 93sm21832259wrh.15.2019.03.23.03.49.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 03:49:57 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234641 Archived-At: On Fri, Mar 22, 2019 at 11:30:26PM -0700, Keith David Bershatsky wrote: > > 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. OK, I think you have a slight misunderstanding of what ‘removing the scrollbars’ does, on NS at lease. When a scrollbar is removed it doesn’t ‘undraw’ the scrollbar from the screen, it marks the area it was as needing to be redrawn, and that is done from scratch. So the fact that the glyphs don’t appear to be deleted means that they are *redrawn*. The multiple cursors appear to be deleted, so that means that they are *not* redrawn. The redrawing doesn’t happen synchronously either. It occurs when we call [NSApp run], which is generally done when we’re handling input. If you look in nsterm.m you’ll see a call in ns_read_socket and ns_select. That’s where the screen will be redrawn. You could try redrawing the cursors in [EmacsView drawRect:], but it has no concept of Emacs windows, so you would have to step through them and make sure you only updated the windows in the current frame, and that they’re live. It would be better if they were redrawn in expose_window, perhaps. One thing to bear in mind is that drawRect: sets up clipping areas so you can’t draw outside areas that have been marked for update. So the usual drawing routine goes like redisplay: mark area as dirty (setNeedsDisplayInRect:) check for input: run the NS event loop ([NSApp run]) drawRect: expose_frame expose_window do actual drawing somewhere in here > 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)) That looks reasonable to me. -- Alan Third