From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: scroll-bars Date: Tue, 07 May 2024 15:56:00 +0300 Message-ID: <86wmo5aihr.fsf@gnu.org> References: <875xvvp3fo.fsf@gmail.com> <87r0eicht1.fsf_-_@gmail.com> <87plu29lcc.fsf@yahoo.com> <87fruyccs8.fsf@gmail.com> <878r0q9dzd.fsf@yahoo.com> <87a5l4r8xu.fsf@gmail.com> <86jzk8cipc.fsf@gnu.org> <87jzk8p26y.fsf@gmail.com> <86bk5kceq6.fsf@gnu.org> <86jzk7aslr.fsf@gnu.org> <86edaebxvs.fsf@gnu.org> <87r0eeyx2v.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28931"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 14:56:45 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s4KNB-0007KK-3Z for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 14:56:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4KMy-0001Iq-O4; Tue, 07 May 2024 08:56:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4KMp-00018c-Qf for emacs-devel@gnu.org; Tue, 07 May 2024 08:56:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4KMp-0004NN-AQ; Tue, 07 May 2024 08:56:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Xn7AhP8iBLAvweLzlKNO22qNjrXW6mt2JHgT+pw+QtQ=; b=FyxOXCyQqzZN757IKp2e beHpBqYZpe5Ld/KTq6LAHji3+gia5m2opNTlZN1bdb0059+FMOn5eMS64NcMgL1Jq9NGgDkkpDdQR +TTVwxxHhBbwbadYPiTmE/R44tF9n6QNeYtgcBS11e67yps9VWDercJO2I4fcQr6ZcK1qM7F3fuXx 3YenpM+wUDM2kGOYBcF+lJuqXABK/icEDG8Zuxxsf2HfA+fmLB27GUcrcr3Xk2Bolyjk4URweV548 lh/bjKjKMsPXKMQVO1h4b8FiILtuiUeWkHVFo8vSCLLnhsCKDDElmKzX1SiQD5KKKuGkoEJG76myq rKS7x37fwJTZ/w==; In-Reply-To: <87r0eeyx2v.fsf@gmail.com> (message from Helmut Eller on Tue, 07 May 2024 08:07:04 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318941 Archived-At: > From: Helmut Eller > Cc: Gerd Möllmann , > emacs-devel@gnu.org > Date: Tue, 07 May 2024 08:07:04 +0200 > > On Mon, May 06 2024, Eli Zaretskii wrote: > > >> > Btw, did we decide what to do with these chains: > >> > > >> > struct frame > >> > { > >> > [...] > >> > /* List of scroll bars on this frame. > >> > Actually, we don't specify exactly what is stored here at all; the > >> > scroll bar implementation code can use it to store anything it likes. > >> > This field is marked by the garbage collector. It is here > >> > instead of in the `device' structure so that the garbage > >> > collector doesn't need to look inside the window-system-dependent > >> > structure. */ > >> > Lisp_Object scroll_bars; > >> > Lisp_Object condemned_scroll_bars; > >> > > >> > They are doubly-linked lists via the ->next and ->prev fields in the C > >> > 'struct scroll_bar', in X as well as w32, see XSCROLL_BAR. The > >> > Lisp_Object's above are the last scroll bar on the frame's windows, > >> > and the rest are reachable via the ->next and ->prev pointers. Do we > >> > need to do anything about those ->next and ->prev pointers? > [...] > > Helmut, WDYT about the scroll bars on X (and by extension on w32)? > > On X, the struct scroll_bar is allocated as a PVEC_OTHER pseudovector. Likewise on w32. > And I think the next/prev links are traced because of that. > xterm.c:mark_xterm doesn't do anything special for scrollbars, so I > think it's all covered. So any C pointers within a Lisp object allocated via MPS are automatically traced and fixed when the object is moved? > The only complication so far was that a struct > scroll_bar* was handed to GTK that was not traced; after I turned that > into a root with a pointer to the scroll_bar* it is traced. Is this the only/best way of making a structure pinned? If there are others, what are they? I wonder if there's a more elegant technique than to use indirection. E.g., can't I tell MPS somehow that a Lisp object allocated as PVEC_OTHER pseudovector is pinned? See, on w32 the pointer to 'struct scroll_bar' is handed to the UI thread (via a message with parameters), which uses it to tell the MS-Windows GUI system how to create the scroll bar (which is just a special kind of window, as far as MS-Windows is concerned). So I think the 'struct scroll_bar' must not be allowed to be moved on w32, because if it does, the UI thread will dereference invalid pointers.