From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58271: 29.0.50; [PATCH] Handle sharing Cocoa xwidgets more gracefully Date: Tue, 04 Oct 2022 08:34:53 +0800 Message-ID: <87r0zo1l5e.fsf@yahoo.com> References: <3B2D7E85-0137-4460-B182-F7F5F39A192E@daum.net> <87czb86b4g.fsf@gnus.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8553"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: =?UTF-8?Q?=EC=A1=B0=EC=84=B1=EB=B9=88?= , 58271@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 04 02:40:37 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ofVzB-00025P-F6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 02:40:37 +0200 Original-Received: from localhost ([::1]:48850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofVzA-0004qE-DH for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Oct 2022 20:40:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofVuk-0008BM-7q for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 20:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofVuj-0000pq-V9 for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 20:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofVuj-0000Ru-Js for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 20:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Oct 2022 00:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58271 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58271-submit@debbugs.gnu.org id=B58271.16648437201676 (code B ref 58271); Tue, 04 Oct 2022 00:36:01 +0000 Original-Received: (at 58271) by debbugs.gnu.org; 4 Oct 2022 00:35:20 +0000 Original-Received: from localhost ([127.0.0.1]:51961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofVu0-0000Qs-9l for submit@debbugs.gnu.org; Mon, 03 Oct 2022 20:35:19 -0400 Original-Received: from sonic314-21.consmr.mail.ne1.yahoo.com ([66.163.189.147]:36007) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofVtu-0000QY-Op for 58271@debbugs.gnu.org; Mon, 03 Oct 2022 20:35:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1664843703; bh=zFKdBcBvp5Qr/Quldd8qu3F2oJJkmwLrd+E9CEf+POs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=kV/MgJOvR7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iPvOoiusYFtXFOJ_uTFlnZERukKzVlfQl8UgupW59Rt7z9FHVn4.12qcmLq CwBk2VGFHz7MVjVm770NG3kUWnEGEFN_lIGmCcsJxF288jyrFHQvjStjSjqMp.wUpjddYHrQFW1m vxrgqVzhuH7LDlCnMNFiGUrhJu.d6sxLyAbr.Shju4.oEgQM_kI0ovBRj.7f3WOBeUISOI_c9rjY v.xYzcqcx4WdOybGXQ96ekLLni70D1muFlh8t5DDysnkZf1OuVhAd8uFoTDEVAw9ATMJne493EsD 8AfyuzLVsOz0KvTOA97TKXF0aIUOb0Pz_2X.84H0JZn1BMh0LC.SxutaLBfgQX.FtedXEZlWRush Iz27kyk_FBBDlHY5MvZpjw7Oh0LH5HdkaPadca2tapUJCd8vMql2coFYk7uJJwO24qpCMtt3j40N 8W1GwgDbrViofatHSsfmmBZtXJJ1n05OGe_KNLXHFWUF_cQ2hYyhrjSqpb0nTqSzYNpA_xh8Ji_9 vMc8VxAV5nt_oKy041pkkSmPfQpg3zIeUiYkrPCjzSUbCYfSBHu4xF3G7V7XxrVrXuNl3sEyijap YE5LGxfmT2ttRgMNGAHz6ES1PDnbcg.4U7wSP0Ai7q X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Tue, 4 Oct 2022 00:35:03 +0000 Original-Received: by hermes--production-sg3-cf9dc7f8d-5h5f2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9875b3fd5ea93d732bae7a41156decd4; Tue, 04 Oct 2022 00:34:58 +0000 (UTC) In-Reply-To: <87czb86b4g.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 03 Oct 2022 20:00:15 +0200") X-Mailer: WebService/1.1.20702 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244347 Archived-At: Lars Ingebrigtsen writes: > =EC=A1=B0=EC=84=B1=EB=B9=88 writes: > >> The attached patch fixes this issue by showing a warning label in the pl= ace of >> the xwidget view. > > Makes sense to me -- perhaps Po Lu has some comments; added to the CCs. > > In any case, it looks like this patch is too large to apply without > getting a copyright assignment for the FSF first. Would you be willing > to sign such paperwork? Thanks. I saw the post to emacs-devel first, and replied without checking the bug tracker. These were my comments: =EC=A1=B0=EC=84=B1=EB=B9=88 writes: > Hello,=20 > > Attached is a patch that improves the handling of sharing Cocoa xwidgets.= =20 > > The previous implementation of Cocoa xwidgets poorly handled cases where = the > user tried to share xwidgets between multiple views (by spamming messages= to > *Messages* on every redisplay, and not drawing anything on the second xwi= dget). > The attached patch fixes this issue by showing a warning label in the pla= ce of > the xwidget view.=20 > > I originally tried to create a bug report with the patch by mailing to > bug-gnu-emacs@gnu.org, but it seems that the report wasn=E2=80=99t create= d. As such, > I=E2=80=99m sending the patch to the emacs-devel list. How should I proce= ed with this? > > Thanks. Thanks; since you seem to be the original author of the xwidget code on Mac OS, could you please fix the crash there when an xwidget is deleted but remains on-screen? Some minor formatting comments on the patch below: > From: VirtualBuddy Is this a real email? > * etc/NEWS: Mention fix. Since this is a bug fix, I see no reason to mention it in NEWS. In addition, even if it warranted a mention, it ought to be placed under "Changes in Emacs 29.1 on Non-Free Operating Systems". > * src/nsxwidget.h: Remove now-unused NSView subclasses and functions. > * src/nsxwidget.m: > ([XwWebView mouseDown:], [XwWebView mouseUp:], [XwWebView keyDown:]) > ([XwWebView userContentController:didReceiveScriptMessage:]): Rename fiel= d of > xwidget_view from emacswindow to emacsFrame to better match emacs termino= logy. > (nsxwidget_init, nsxwidget_resize_view, nsxwidget_move_widget_in_view): > Simplify logic by removing field xwWindow and using the xvWindow as the > container. > (nsxwidget_resize, XwWindow, XvWindow): Remove now-unused code. > (nsxwidget_init_view, nsxwidget_delete_view): Handle creating non-primary > xwidget views. > (nsxwidget_show_view, nsxwidget_hide_view): Remove poor hack to hide view= s. > * src/xwidget.c (xwidget_init_view): Update formatting. > (x_draw_xwidget_glyph_string): Handle displaying non-primary xwidget view= s and > remove previous message warning. > (Fxwidget_resize): Remove useless call to nsxwidget_resize, as the subseq= uent > redisplay handles them via nsxwidget_resize_view. > * src/xwidget.h (struct xwidget): Remove field xwWindow and update commen= ts > to be more accurate. > (struct xwidget_view): Add field xvWidget and rename field emacswindow to > emacsFrame to better match emacs terminology. Please make sure that each line of the commit message is no longer than 64 characters in length. > { > - [self.xw->xv->emacswindow mouseDown:event]; > + [self.xw->xv->emacsFrame mouseDown:event]; > [super mouseDown:event]; > } >=20=20 > - (void)mouseUp:(NSEvent *)event > { > - [self.xw->xv->emacswindow mouseUp:event]; > + [self.xw->xv->emacsFrame mouseUp:event]; > [super mouseUp:event]; > } The "emacswindow" field should actually be named "frame", IMHO. > + { > + NSTextField *warningLabel =3D [NSTextField labelWithString:@"Cocoa= Xwidgets do not support sharing widgets."]; This line is too long. Please find a way to make it fit in 80 columns. > + if (xw->xv =3D=3D xv) > + { > + xw->xv =3D NULL; /* Now model has no view. */ > + } Please remove the unnecessary braces here.