From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sungbin Jo Newsgroups: gmane.emacs.bugs Subject: bug#58271: 29.0.50; [PATCH] Handle sharing Cocoa xwidgets more gracefully Date: Tue, 4 Oct 2022 11:03:28 +0900 Message-ID: References: <3B2D7E85-0137-4460-B182-F7F5F39A192E@daum.net> <87czb86b4g.fsf@gnus.org> <87r0zo1l5e.fsf@yahoo.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.92\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_E88D47C8-CBFC-4A6A-B4B7-AA2E835F3386" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36784"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58271@debbugs.gnu.org, Lars Ingebrigtsen To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 04 04:05:30 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 1ofXJJ-0009Nr-QU for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 04:05:29 +0200 Original-Received: from localhost ([::1]:50474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofXJI-00007U-Kb for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Oct 2022 22:05:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofXHv-0007MI-6L for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 22:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofXHu-000210-6H for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 22:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofXHt-0002du-OB for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2022 22:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sungbin Jo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Oct 2022 02:04: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.166484903010138 (code B ref 58271); Tue, 04 Oct 2022 02:04:01 +0000 Original-Received: (at 58271) by debbugs.gnu.org; 4 Oct 2022 02:03:50 +0000 Original-Received: from localhost ([127.0.0.1]:52022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofXHh-0002dS-Um for submit@debbugs.gnu.org; Mon, 03 Oct 2022 22:03:50 -0400 Original-Received: from mail-smail-vm103.daum.net ([211.231.106.178]:3346 helo=mail-smail-vm103.hanmail.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofXHf-0002dD-8R for 58271@debbugs.gnu.org; Mon, 03 Oct 2022 22:03:48 -0400 Original-Received: from dmail-hmailsmtp-ayvm01 ([10.93.105.31]) by mail-smail-vm103.hanmail.net (8.13.8/8.9.1) with SMTP id 29423dme005130; Tue, 4 Oct 2022 11:03:39 +0900 X-Kakaomail-MID: Cl1pHwAAK+QAAAGDoLv/1QADo+M= X-Hermes-Message-Id: q94B3cpXv801673404 X-Originating-IP: 147.46.174.125 Original-Received: from mail-qpsmtp-vm13 ([10.61.241.143]) by hermes of dmail-hmailsmtp-ayvm01 (10.93.105.31) with ESMTP id q94B3cpXv801673404; Tue, 04 Oct 2022 11:03:38 +0900 (KST) Original-Received: from [147.46.174.125] (HELO smtpclient.apple) (147.46.174.125) by (8.12.9/8.9.1) with ESMTPA; Tue, 04 Oct 2022 11:03:38 +0900 Authentication-Results: mail-qpsmtp-vm13; auth=pass (plain) smtp.auth=goranmoomin@daum.net In-Reply-To: <87r0zo1l5e.fsf@yahoo.com> X-Mailer: Apple Mail (2.3731.200.92) X-HM-UT: FhzuMO7fDyYQlIw+JNz/4TOPNRA+bHyTw3HQj6tM3jc= 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:244352 Archived-At: --Apple-Mail=_E88D47C8-CBFC-4A6A-B4B7-AA2E835F3386 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 2022. 10. 4. =EC=98=A4=EC=A0=84 9:34, Po Lu =EC=9E=91= =EC=84=B1: > 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? I=E2=80=99ve continued on this (with some questions) on emacs-devel. > Some minor formatting comments on the patch below: Updated patch attached. >> From: VirtualBuddy >=20 > Is this a real email? No, it was a mistake. Updated. >> * etc/NEWS: Mention fix. >=20 > 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". I did place it under the =E2=80=9CNon-Free Operating Systems=E2=80=9D = part, but I removed them. >> * src/nsxwidget.h: Remove now-unused NSView subclasses and functions. >> * src/nsxwidget.m: >> ([XwWebView mouseDown:], [XwWebView mouseUp:], [XwWebView keyDown:]) >> ([XwWebView userContentController:didReceiveScriptMessage:]): Rename = field of >> xwidget_view from emacswindow to emacsFrame to better match emacs = terminology. >> (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 = views. >> * src/xwidget.c (xwidget_init_view): Update formatting. >> (x_draw_xwidget_glyph_string): Handle displaying non-primary xwidget = views and >> remove previous message warning. >> (Fxwidget_resize): Remove useless call to nsxwidget_resize, as the = subsequent >> redisplay handles them via nsxwidget_resize_view. >> * src/xwidget.h (struct xwidget): Remove field xwWindow and update = comments >> to be more accurate. >> (struct xwidget_view): Add field xvWidget and rename field = emacswindow to >> emacsFrame to better match emacs terminology. >=20 > Please make sure that each line of the commit message is no longer = than > 64 characters in length. Done. >> { >> - [self.xw->xv->emacswindow mouseDown:event]; >> + [self.xw->xv->emacsFrame mouseDown:event]; >> [super mouseDown:event]; >> } >>=20 >> - (void)mouseUp:(NSEvent *)event >> { >> - [self.xw->xv->emacswindow mouseUp:event]; >> + [self.xw->xv->emacsFrame mouseUp:event]; >> [super mouseUp:event]; >> } >=20 > The "emacswindow" field should actually be named "frame", IMHO. I=E2=80=99m not sure I follow; that=E2=80=99s exactly the rename I=E2=80=99= ve done. Or are you suggesting that I should use =E2=80=98frame=E2=80=99 instead of = =E2=80=98emacsFrame=E2=80=99? In any case, I=E2=80=99m fine with either. >> + { >> + NSTextField *warningLabel =3D [NSTextField = labelWithString:@"Cocoa Xwidgets do not support sharing widgets."]; >=20 > This line is too long. Please find a way to make it fit in 80 = columns. Done. >> + if (xw->xv =3D=3D xv) >> + { >> + xw->xv =3D NULL; /* Now model has no view. */ >> + } >=20 > Please remove the unnecessary braces here. Done. --Apple-Mail=_E88D47C8-CBFC-4A6A-B4B7-AA2E835F3386 Content-Disposition: attachment; filename=0001-Handle-sharing-Cocoa-xwidgets-more-gracefully.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Handle-sharing-Cocoa-xwidgets-more-gracefully.patch" Content-Transfer-Encoding: quoted-printable =46rom=202f90ceb0d2e556cad2802cdca5ef8324a8dc5523=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Sungbin=20Jo=20=0ADate:=20= Tue,=204=20Oct=202022=2008:51:33=20+0900=0ASubject:=20[PATCH]=20Handle=20= sharing=20Cocoa=20xwidgets=20more=20gracefully=0A=0A*=20src/nsxwidget.h=20= (nsxwidget_resize,=20XwWindow,=20XvWindow):=20Remove=0Aunused=20= subclasses=20and=20functions.=0A*=20src/nsxwidget.m:=0A([XwWebView=20= mouseDown:],=20[XwWebView=20mouseUp:])=0A([XwWebView=20keyDown:])=0A= ([XwWebView=20userContentController:didReceiveScriptMessage:]):=0ARename=20= field=20of=20xwidget_view=20from=20emacswindow=20to=20emacsFrame=20to=0A= better=20match=20emacs=20terminology.=0A(nsxwidget_init,=20= nsxwidget_resize_view)=0A(nsxwidget_move_widget_in_view):=20Simplify=20= logic=20by=20removing=0Afield=20xwWindow=20and=20using=20the=20xvWindow=20= as=20the=20container.=0A(nsxwidget_resize,=20XwWindow,=20XvWindow):=20= Remove=20unused=20subclasses=0Aand=20functions.=0A(nsxwidget_init_view,=20= nsxwidget_delete_view):=20Handle=20creating=0Anon-primary=20xwidget=20= views.=0A(nsxwidget_show_view,=20nsxwidget_hide_view):=20Remove=20hack=20= to=20hide=0Aviews.=0A*=20src/xwidget.c=20(xwidget_init_view):=20Update=20= formatting.=0A(x_draw_xwidget_glyph_string):=20Handle=20displaying=20= non-primary=0Axwidget=20views=20and=20remove=20previous=20message=20= warning.=0A(Fxwidget_resize):=20Remove=20useless=20call=20to=20= nsxwidget_resize,=20as=0Athe=20subsequent=20redisplay=20handles=20them=20= via=20nsxwidget_resize_view.=0A*=20src/xwidget.h=20(struct=20xwidget):=20= Remove=20field=20xwWindow=20and=0Aupdate=20comments=20to=20be=20more=20= accurate.=0A(struct=20xwidget_view):=20Add=20field=20xvWidget=20and=20= rename=20field=0Aemacswindow=20to=20emacsFrame=20to=20better=20match=20= emacs=20terminology.=0A---=0A=20src/nsxwidget.h=20|=2014=20--------=0A=20= src/nsxwidget.m=20|=2086=20= ++++++++++++++++++++-----------------------------=0A=20src/xwidget.c=20=20= =20|=2011=20++-----=0A=20src/xwidget.h=20=20=20|=2015=20++++-----=0A=204=20= files=20changed,=2044=20insertions(+),=2082=20deletions(-)=0A=0Adiff=20= --git=20a/src/nsxwidget.h=20b/src/nsxwidget.h=0Aindex=20= 666509744a..f7c744d405=20100644=0A---=20a/src/nsxwidget.h=0A+++=20= b/src/nsxwidget.h=0A@@=20-42,26=20+42,12=20@@=20#define=20= NSXWIDGET_H_INCLUDED=0A=20=0A=20/*=20Functions=20for=20xwidget=20model.=20= =20*/=0A=20=0A-#ifdef=20__OBJC__=0A-@interface=20XwWindow=20:=20NSView=0A= -@property=20struct=20xwidget=20*xw;=0A-@end=0A-#endif=0A-=0A=20void=20= nsxwidget_init=20(struct=20xwidget=20*xw);=0A=20void=20nsxwidget_kill=20= (struct=20xwidget=20*xw);=0A-void=20nsxwidget_resize=20(struct=20xwidget=20= *xw);=0A=20Lisp_Object=20nsxwidget_get_size=20(struct=20xwidget=20*xw);=0A= =20=0A=20/*=20Functions=20for=20xwidget=20view.=20=20*/=0A=20=0A-#ifdef=20= __OBJC__=0A-@interface=20XvWindow=20:=20NSView=0A-@property=20struct=20= xwidget=20*xw;=0A-@property=20struct=20xwidget_view=20*xv;=0A-@end=0A= -#endif=0A-=0A=20void=20nsxwidget_init_view=20(struct=20xwidget_view=20= *xv,=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20struct=20xwidget=20*xww,=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20struct=20glyph_string=20= *s,=0Adiff=20--git=20a/src/nsxwidget.m=20b/src/nsxwidget.m=0Aindex=20= be0eba0bcb..2a6d5cdb54=20100644=0A---=20a/src/nsxwidget.m=0A+++=20= b/src/nsxwidget.m=0A@@=20-199,13=20+199,13=20@@=20-=20= (void)webView:(WKWebView=20*)webView=0A=20=0A=20-=20= (void)mouseDown:(NSEvent=20*)event=0A=20{=0A-=20=20= [self.xw->xv->emacswindow=20mouseDown:event];=0A+=20=20= [self.xw->xv->emacsFrame=20mouseDown:event];=0A=20=20=20[super=20= mouseDown:event];=0A=20}=0A=20=0A=20-=20(void)mouseUp:(NSEvent=20*)event=0A= =20{=0A-=20=20[self.xw->xv->emacswindow=20mouseUp:event];=0A+=20=20= [self.xw->xv->emacsFrame=20mouseUp:event];=0A=20=20=20[super=20= mouseUp:event];=0A=20}=0A=20=0A@@=20-220,15=20+220,15=20@@=20-=20= (void)keyDown:(NSEvent=20*)event=0A=20=20=20Lisp_Object=20val=20=3D=20= buffer_local_value=20(var,=20Fcurrent_buffer=20());=0A=20=20=20if=20(!EQ=20= (val,=20Qunbound)=20&&=20!EQ=20(val,=20Qnil))=0A=20=20=20=20=20{=0A-=20=20= =20=20=20=20[self.window=20makeFirstResponder:self.xw->xv->emacswindow];=0A= -=20=20=20=20=20=20[self.xw->xv->emacswindow=20keyDown:event];=0A+=20=20=20= =20=20=20[self.window=20makeFirstResponder:self.xw->xv->emacsFrame];=0A+=20= =20=20=20=20=20[self.xw->xv->emacsFrame=20keyDown:event];=0A=20=20=20=20=20= =20=20return;=0A=20=20=20=20=20}=0A=20=0A=20=20=20/*=20Emacs=20handles=20= keyboard=20events=20when=20javascript=20is=20blocked.=20=20*/=0A=20=20=20= if=20([self.urlScriptBlocked[self.URL]=20boolValue])=0A=20=20=20=20=20{=0A= -=20=20=20=20=20=20[self.xw->xv->emacswindow=20keyDown:event];=0A+=20=20=20= =20=20=20[self.xw->xv->emacsFrame=20keyDown:event];=0A=20=20=20=20=20=20=20= return;=0A=20=20=20=20=20}=0A=20=0A@@=20-237,13=20+237,13=20@@=20-=20= (void)keyDown:(NSEvent=20*)event=0A=20=20=20=20=20=20=20if=20(error)=0A=20= =20=20=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20=20=20=20NSLog=20= (@"xwHasFocus:=20%@",=20error);=0A-=20=20=20=20=20=20=20=20=20=20= [self.xw->xv->emacswindow=20keyDown:event];=0A+=20=20=20=20=20=20=20=20=20= =20[self.xw->xv->emacsFrame=20keyDown:event];=0A=20=20=20=20=20=20=20=20=20= }=0A=20=20=20=20=20=20=20else=20if=20(result)=0A=20=20=20=20=20=20=20=20=20= {=0A=20=20=20=20=20=20=20=20=20=20=20NSNumber=20*hasFocus=20=3D=20= result;=20/*=20__NSCFBoolean=20*/=0A=20=20=20=20=20=20=20=20=20=20=20if=20= (!hasFocus.boolValue)=0A-=20=20=20=20=20=20=20=20=20=20=20=20= [self.xw->xv->emacswindow=20keyDown:event];=0A+=20=20=20=20=20=20=20=20=20= =20=20=20[self.xw->xv->emacsFrame=20keyDown:event];=0A=20=20=20=20=20=20=20= =20=20=20=20else=0A=20=20=20=20=20=20=20=20=20=20=20=20=20[super=20= keyDown:event];=0A=20=20=20=20=20=20=20=20=20}=0A@@=20-291,7=20+291,7=20= @@=20-=20(void)userContentController:(WKUserContentController=20= *)userContentController=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20/*=20= Just=20give=20up=20focus,=20no=20relay=20"C-g"=20to=20emacs,=20another=20= "C-g"=0A=20=20=20=20=20=20=20=20=20=20follows=20will=20be=20handled=20by=20= emacs.=20=20*/=0A-=20=20=20=20=20=20[self.window=20= makeFirstResponder:self.xw->xv->emacswindow];=0A+=20=20=20=20=20=20= [self.window=20makeFirstResponder:self.xw->xv->emacsFrame];=0A=20=20=20=20= =20}=0A=20}=0A=20=0A@@=20-437,16=20+437,10=20@@=20-=20= (void)userContentController:(WKUserContentController=20= *)userContentController=0A=20=20=20=20=20}];=0A=20}=0A=20=0A-/*=20Window=20= containing=20an=20xwidget.=20=20*/=0A-=0A-@implementation=20XwWindow=0A= --=20(BOOL)isFlipped=20{=20return=20YES;=20}=0A-@end=0A-=0A=20/*=20= Xwidget=20model,=20macOS=20Cocoa=20part.=20=20*/=0A=20=0A=20void=0A= -nsxwidget_init(struct=20xwidget=20*xw)=0A+nsxwidget_init=20(struct=20= xwidget=20*xw)=0A=20{=0A=20=20=20block_input=20();=0A=20=20=20NSRect=20= rect=20=3D=20NSMakeRect=20(0,=200,=20xw->width,=20xw->height);=0A@@=20= -454,9=20+448,6=20@@=20-=20(BOOL)isFlipped=20{=20return=20YES;=20}=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20initWithFrame:rect=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= configuration:[[WKWebViewConfiguration=20alloc]=20init]=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= xwidget:xw];=0A-=20=20xw->xwWindow=20=3D=20[[XwWindow=20alloc]=0A-=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20initWithFrame:rect];=0A-=20= =20[xw->xwWindow=20addSubview:xw->xwWidget];=0A=20=20=20xw->xv=20=3D=20= NULL;=20/*=20for=201=20to=201=20relationship=20of=20webkit2.=20=20*/=0A=20= =20=20unblock_input=20();=0A=20}=0A@@=20-481,22=20+472,10=20@@=20-=20= (BOOL)isFlipped=20{=20return=20YES;=20}=0A=20=20=20=20=20=20=20= [((XwWebView=20*)=20xw->xwWidget).urlScriptBlocked=20release];=0A=20=20=20= =20=20=20=20[xw->xwWidget=20removeFromSuperviewWithoutNeedingDisplay];=0A= =20=20=20=20=20=20=20[xw->xwWidget=20release];=0A-=20=20=20=20=20=20= [xw->xwWindow=20removeFromSuperviewWithoutNeedingDisplay];=0A-=20=20=20=20= =20=20[xw->xwWindow=20release];=0A=20=20=20=20=20=20=20xw->xwWidget=20=3D=20= nil;=0A=20=20=20=20=20}=0A=20}=0A=20=0A-void=0A-nsxwidget_resize=20= (struct=20xwidget=20*xw)=0A-{=0A-=20=20if=20(xw->xwWidget)=0A-=20=20=20=20= {=0A-=20=20=20=20=20=20[xw->xwWindow=20= setFrameSize:NSMakeSize(xw->width,=20xw->height)];=0A-=20=20=20=20=20=20= [xw->xwWidget=20setFrameSize:NSMakeSize(xw->width,=20xw->height)];=0A-=20= =20=20=20}=0A-}=0A-=0A=20Lisp_Object=0A=20nsxwidget_get_size=20(struct=20= xwidget=20*xw)=0A=20{=0A@@=20-504,12=20+483,6=20@@=20-=20(BOOL)isFlipped=20= {=20return=20YES;=20}=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20xw->xwWidget.frame.size.height);=0A=20}=0A=20=0A-/*=20Xwidget=20view,=20= macOS=20Cocoa=20part.=20=20*/=0A-=0A-@implementation=20XvWindow=20:=20= NSView=0A--=20(BOOL)isFlipped=20{=20return=20YES;=20}=0A-@end=0A-=0A=20= void=0A=20nsxwidget_init_view=20(struct=20xwidget_view=20*xv,=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20struct=20= xwidget=20*xw,=0A@@=20-526,16=20+499,28=20@@=20-=20(BOOL)isFlipped=20{=20= return=20YES;=20}=0A=20=20=20xv->clip_top=20=3D=200;=0A=20=20=20= xv->clip_bottom=20=3D=20xw->height;=0A=20=0A-=20=20xv->xvWindow=20=3D=20= [[XvWindow=20alloc]=0A+=20=20xv->xvWindow=20=3D=20[[NSView=20alloc]=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= initWithFrame:NSMakeRect=20(x,=20y,=20xw->width,=20xw->height)];=0A-=20=20= xv->xvWindow.xw=20=3D=20xw;=0A-=20=20xv->xvWindow.xv=20=3D=20xv;=0A=20=0A= -=20=20xw->xv=20=3D=20xv;=20/*=20For=201=20to=201=20relationship=20of=20= webkit2.=20=20*/=0A-=20=20[xv->xvWindow=20addSubview:xw->xwWindow];=0A+=20= =20if=20(!xw->xv)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20xw->xv=20=3D=20= xv;=20/*=20For=201=20to=201=20relationship=20of=20webkit2.=20=20*/=0A+=20= =20=20=20=20=20/*=20This=20seems=20like=20it=20should=20be=20retained,=20= but=20tests=20show=20otherwise.=20=20*/=0A+=20=20=20=20=20=20= xv->xvWidget=20=3D=20xw->xwWidget;=0A+=20=20=20=20}=0A+=20=20else=0A+=20=20= =20=20{=0A+=20=20=20=20=20=20NSString=20*warningString=20=3D=20@"Cocoa=20= Xwidgets=20do=20not=20support=20sharing=20widgets.";=0A+=20=20=20=20=20=20= NSTextField=20*warningLabel=20=3D=20[NSTextField=20= labelWithString:warningString];=0A+=20=20=20=20=20=20[warningLabel=20= setFrameSize:NSMakeSize=20(xw->width,=20xw->height)];=0A+=20=20=20=20=20=20= warningLabel.drawsBackground=20=3D=20YES;=0A+=20=20=20=20=20=20= warningLabel.backgroundColor=20=3D=20[NSColor=20textBackgroundColor];=0A= +=20=20=20=20=20=20xv->xvWidget=20=3D=20warningLabel;=0A+=20=20=20=20}=0A= =20=0A-=20=20xv->emacswindow=20=3D=20FRAME_NS_VIEW=20(s->f);=0A-=20=20= [xv->emacswindow=20addSubview:xv->xvWindow];=0A+=20=20[xv->xvWindow=20= addSubview:xv->xvWidget];=0A+=20=20xv->emacsFrame=20=3D=20FRAME_NS_VIEW=20= (s->f);=0A+=20=20[xv->emacsFrame=20addSubview:xv->xvWindow];=0A=20}=0A=20= =0A=20void=0A@@=20-544,8=20+529,8=20@@=20-=20(BOOL)isFlipped=20{=20= return=20YES;=20}=0A=20=20=20if=20(!EQ=20(xv->model,=20Qnil))=0A=20=20=20= =20=20{=0A=20=20=20=20=20=20=20struct=20xwidget=20*xw=20=3D=20XXWIDGET=20= (xv->model);=0A-=20=20=20=20=20=20[xw->xwWindow=20= removeFromSuperviewWithoutNeedingDisplay];=0A-=20=20=20=20=20=20xw->xv=20= =3D=20NULL;=20/*=20Now=20model=20has=20no=20view.=20=20*/=0A+=20=20=20=20= =20=20if=20(xw->xv=20=3D=3D=20xv)=0A+=20=20=20=20=20=20=20=20xw->xv=20=3D=20= NULL;=20/*=20Now=20model=20has=20no=20view.=20=20*/=0A=20=20=20=20=20}=0A= =20=20=20[xv->xvWindow=20removeFromSuperviewWithoutNeedingDisplay];=0A=20= =20=20[xv->xvWindow=20release];=0A@@=20-555,21=20+540,21=20@@=20-=20= (BOOL)isFlipped=20{=20return=20YES;=20}=0A=20nsxwidget_show_view=20= (struct=20xwidget_view=20*xv)=0A=20{=0A=20=20=20xv->hidden=20=3D=20NO;=0A= -=20=20[xv->xvWindow=20setFrameOrigin:NSMakePoint(xv->x=20+=20= xv->clip_left,=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= xv->y=20+=20xv->clip_top)];=0A+=20=20[xv->xvWindow=20setHidden:NO];=0A=20= }=0A=20=0A=20void=0A=20nsxwidget_hide_view=20(struct=20xwidget_view=20= *xv)=0A=20{=0A=20=20=20xv->hidden=20=3D=20YES;=0A-=20=20[xv->xvWindow=20= setFrameOrigin:NSMakePoint(10000,=2010000)];=0A+=20=20[xv->xvWindow=20= setHidden:YES];=0A=20}=0A=20=0A=20void=0A=20nsxwidget_resize_view=20= (struct=20xwidget_view=20*xv,=20int=20width,=20int=20height)=0A=20{=0A-=20= =20[xv->xvWindow=20setFrameSize:NSMakeSize(width,=20height)];=0A+=20=20= [xv->xvWindow=20setFrameSize:NSMakeSize=20(width,=20height)];=0A+=20=20= [xv->xvWidget=20setFrameSize:NSMakeSize=20(width,=20height)];=0A=20}=0A=20= =0A=20void=0A@@=20-582,8=20+567,7=20@@=20-=20(BOOL)isFlipped=20{=20= return=20YES;=20}=0A=20void=0A=20nsxwidget_move_widget_in_view=20(struct=20= xwidget_view=20*xv,=20int=20x,=20int=20y)=0A=20{=0A-=20=20struct=20= xwidget=20*xww=20=3D=20xv->xvWindow.xw;=0A-=20=20[xww->xwWindow=20= setFrameOrigin:NSMakePoint=20(x,=20y)];=0A+=20=20[xv->xvWidget=20= setFrameOrigin:NSMakePoint=20(x,=20y)];=0A=20}=0A=20=0A=20void=0Adiff=20= --git=20a/src/xwidget.c=20b/src/xwidget.c=0Aindex=20= 8bdfab02fd..013b773a90=20100644=0A---=20a/src/xwidget.c=0A+++=20= b/src/xwidget.c=0A@@=20-2762,7=20+2762,7=20@@=20xwidget_init_view=20= (struct=20xwidget=20*xww,=0A=20=20=20xv->just_resized=20=3D=20false;=0A=20= #elif=20defined=20NS_IMPL_COCOA=0A=20=20=20nsxwidget_init_view=20(xv,=20= xww,=20s,=20x,=20y);=0A-=20=20nsxwidget_resize_view(xv,=20xww->width,=20= xww->height);=0A+=20=20nsxwidget_resize_view=20(xv,=20xww->width,=20= xww->height);=0A=20#endif=0A=20=0A=20=20=20return=20xv;=0A@@=20-2794,7=20= +2794,7=20@@=20x_draw_xwidget_glyph_string=20(struct=20glyph_string=20= *s)=0A=20=0A=20=20=20xv->just_resized=20=3D=20false;=0A=20#elif=20= defined=20NS_IMPL_COCOA=0A-=20=20if=20(!xv)=0A+=20=20if=20(!xv=20||=20= xww->xv=20!=3D=20xv)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20/*=20= Enforce=201=20to=201,=20model=20and=20view=20for=20macOS=20Cocoa=20= webkit2.=20=20*/=0A=20=20=20=20=20=20=20if=20(xww->xv)=0A@@=20-2805,11=20= +2805,6=20@@=20x_draw_xwidget_glyph_string=20(struct=20glyph_string=20= *s)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20XSETXWIDGET_VIEW=20= (xvl,=20xww->xv);=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= Fdelete_xwidget_view=20(xvl);=0A=20=20=20=20=20=20=20=20=20=20=20=20=20}=0A= -=20=20=20=20=20=20=20=20=20=20else=0A-=20=20=20=20=20=20=20=20=20=20=20=20= {=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20message=20("You=20can't=20= share=20an=20xwidget=20(webkit2)=20among=20windows.");=0A-=20=20=20=20=20= =20=20=20=20=20=20=20=20=20return;=0A-=20=20=20=20=20=20=20=20=20=20=20=20= }=0A=20=20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20=20xv=20=3D=20= xwidget_init_view=20(xww,=20s,=20x,=20y);=0A=20=20=20=20=20}=0A@@=20= -3243,8=20+3238,6=20@@=20DEFUN=20("xwidget-resize",=20Fxwidget_resize,=20= Sxwidget_resize,=203,=203,=200,=0A=20=0A=20=20=20=20=20=20=20= gtk_widget_queue_allocate=20(GTK_WIDGET=20(xw->widget_osr));=0A=20=20=20=20= =20}=0A-#elif=20defined=20NS_IMPL_COCOA=0A-=20=20nsxwidget_resize=20= (xw);=0A=20#endif=0A=20=20=20unblock_input=20();=0A=20=0Adiff=20--git=20= a/src/xwidget.h=20b/src/xwidget.h=0Aindex=20502beb6765..3943148e3f=20= 100644=0A---=20a/src/xwidget.h=0A+++=20b/src/xwidget.h=0A@@=20-81,16=20= +81,13=20@@=20#define=20XWIDGET_H_INCLUDED=0A=20=20=20guint=20= hit_result;=0A=20#elif=20defined=20(NS_IMPL_COCOA)=0A=20#=20ifdef=20= __OBJC__=0A-=20=20/*=20For=20offscreen=20widgets,=20unused=20if=20not=20= osr.=20=20*/=0A+=20=20/*=20The=20primary=20widget.=20=20*/=0A=20=20=20= NSView=20*xwWidget;=0A-=20=20XwWindow=20*xwWindow;=0A=20=0A-=20=20/*=20= Used=20only=20for=20xwidget=20types=20(such=20as=20webkit2)=20enforcing=20= 1=20to=201=0A-=20=20=20=20=20relationship=20between=20model=20and=20= view.=20=20*/=0A+=20=20/*=20The=20current=20view=20that=20displays=20the=20= primary=20widget,=20if=20exists.=20=20*/=0A=20=20=20struct=20= xwidget_view=20*xv;=0A=20#=20else=0A=20=20=20void=20*xwWidget;=0A-=20=20= void=20*xwWindow;=0A=20=20=20struct=20xwidget_view=20*xv;=0A=20#=20endif=0A= =20#endif=0A@@=20-136,11=20+133,13=20@@=20#define=20XWIDGET_H_INCLUDED=0A= =20=20=20int=20just_resized;=0A=20#elif=20defined=20(NS_IMPL_COCOA)=0A=20= #=20ifdef=20__OBJC__=0A-=20=20XvWindow=20*xvWindow;=0A-=20=20NSView=20= *emacswindow;=0A+=20=20NSView=20*xvWindow;=0A+=20=20NSView=20*xvWidget;=0A= +=20=20NSView=20*emacsFrame;=0A=20#=20else=0A=20=20=20void=20*xvWindow;=0A= -=20=20void=20*emacswindow;=0A+=20=20void=20*xvWidget;=0A+=20=20void=20= *emacsFrame;=0A=20#=20endif=0A=20#endif=0A=20=0A--=20=0A2.37.0=20(Apple=20= Git-136)=0A=0A= --Apple-Mail=_E88D47C8-CBFC-4A6A-B4B7-AA2E835F3386--