From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?7KGw7ISx67mI?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v5] Enable xwidgets on macOS Date: Sat, 27 Jul 2019 21:35:07 +0900 Message-ID: References: <20190718192321.65684-1-pcr910303@icloud.com> <20190719041654.88561-1-pcr910303@icloud.com> <83pnm5t8ui.fsf@gnu.org> <831rybn4jm.fsf@gnu.org> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="54952"; mail-complaints-to="usenet@blaine.gmane.org" Cc: alan@idiocy.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 27 14:35:21 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hrLuz-000EAL-Hs for ged-emacs-devel@m.gmane.org; Sat, 27 Jul 2019 14:35:21 +0200 Original-Received: from localhost ([::1]:45640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrLux-0003gO-Rd for ged-emacs-devel@m.gmane.org; Sat, 27 Jul 2019 08:35:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49446) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrLuv-0003gF-5A for emacs-devel@gnu.org; Sat, 27 Jul 2019 08:35:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrLut-0007a5-5N for emacs-devel@gnu.org; Sat, 27 Jul 2019 08:35:17 -0400 Original-Received: from pv50p00im-ztdg10021201.me.com ([17.58.6.45]:48908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hrLus-0007WX-T5 for emacs-devel@gnu.org; Sat, 27 Jul 2019 08:35:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1564230911; bh=AsaQSxncv44N0xpfQG0SxzxVwATS+KqQ1UXH7GjM0bk=; h=Content-Type:Subject:From:Date:Message-Id:To; b=XXZTbc5iZ98OqTZj6rgCzAJ09SsxW5RK6MO7Yly3h7/S3PKmkBHYtEAwjbBj7nPHw D7hZ+kOsxUwDQAbW2+InGnFIfuzdiPkxE6Q+ADL8wCZvON53AyCGF/dGTgkP7NrTeg 6P3SHHKgyRjbmCiEbIOyse6SfwgFYiYRhCPG8QDV9Sko9x4Dv6MeJBjPa5BFQjZh+b PZ2XZMIbi8L6BlIsMxzuy6g3JPTwCnjJM4J2UFR4OAgDi7ymXaJQZ2bdZiLBKXHfE7 oGMCzyc7s1r1OViLpzGmbwQoBVP/qJ2ETWc3Ir0mvAeQdM4HlbFBfkiE4jJzuo4ojV xTz+N8lhnZHrQ== Original-Received: from [172.20.10.4] (unknown [106.102.1.203]) by pv50p00im-ztdg10021201.me.com (Postfix) with ESMTPSA id 58145A407A3; Sat, 27 Jul 2019 12:35:11 +0000 (UTC) X-Mailer: iPhone Mail (16F203) In-Reply-To: <831rybn4jm.fsf@gnu.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-27_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1812120000 definitions=main-1907270159 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.6.45 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:238948 Archived-At: 2019. 7. 27. =EC=98=A4=ED=9B=84 7:41, Eli Zaretskii =EC=9E=91= =EC=84=B1: >> From: =EC=A1=B0=EC=84=B1=EB=B9=88 >> Date: Fri, 26 Jul 2019 03:51:11 +0900 >> Cc: alan@idiocy.org, >> emacs-devel@gnu.org >> diff --git a/etc/NEWS b/etc/NEWS >> index 5313270411..52b49bab75 100644 >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -2440,6 +2440,18 @@ was able to 'set' modifiers without the knowledge o= f the user. >> ** On NS multicolor font display is enabled again since it is also >> implemented in Emacs on free operating systems via Cairo drawing. >>=20 >> +** On macOS, Xwidget is now supported. >> +If Emacs was built with xwidget support, you can access the embedded >> +webkit browser with 'M-x xwidget-webkit-browse-url'. Viewing two >> +instances of xwidget webkit is not supported. >> + >> +*** New functions for xwidget-webkit mode >> +'xwidget-webkit-clone-and-split-below', >> +'xwidget-webkit-clone-and-split-right'. >> + >> +*** New variable 'xwidget-webkit-enable-plugins'. >=20 > The last two entries are not specific to macOS, are they? If so, they > should be in the general sections of NEWS. Ok, will do. >> diff --git a/etc/TODO b/etc/TODO >> index a065763933..bda1cf8f9e 100644 >> --- a/etc/TODO >> +++ b/etc/TODO >> @@ -640,15 +640,6 @@ from the emacsclient process. >>=20 >> This sections contains features found in other official Emacs ports. >>=20 >> -**** Support for xwidgets >> - >> -Emacs 25 has support for xwidgets, a system to include operating >> -system components into an Emacs buffer. The components range from >> -simple buttons to webkit (effectively, a web browser). >> - >> -Currently, xwidgets works only for the gtk+ framework but it is >> -designed to be compatible with multiple Emacs ports. >=20 > The MS-Windows and non-GTK builds of Emacs on X still don't support > xwidgets, so I think this entry should not be deleted in its entirety, > it should still say that some configurations don't support xwidgets. (I=E2=80=99m currently on my phone so I can=E2=80=99t really check but) I re= call this part of the checklist was specific to the NS port?=20 >> +(defun xwidget-webkit-clone-and-split-below () >> + "Clone current URL into a new widget place in new window below. >> +Get the URL of current session, then browse to the URL >> +in `split-window-below' with a new xwidget webkit session." >=20 > The second sentence should be reworded: >=20 > Get the URL of current session, then browse that URL in another > window after splitting the selected window horizontally. Ok, will do. >> +(defun xwidget-webkit-clone-and-split-right () >> + "Clone current URL into a new widget place in new window right. >> +Get the URL of current session, then browse to the URL >> +in `split-window-right' with a new xwidget webkit session." >=20 > Same here (but use "vertically" instead of "horizontally"). Ok, will do. >> (defvar bookmark-make-record-function) >> +(when (memq window-system '(mac ns)) >> + (defvar xwidget-webkit-enable-plugins nil >> + "Enable plugins for xwidget webkit. >> +If non-nil, plugins are enabled. Otherwise, disabled.")) >=20 > It is better to have this defvar unconditionally, and tell in the doc > string that it only has effect on macOS. Ok, will do. >> @@ -228,13 +247,14 @@ offscreen_damage_event (GtkWidget *widget, GdkEvent= *event, >> if (GTK_IS_WIDGET (xv_widget)) >> gtk_widget_queue_draw (GTK_WIDGET (xv_widget)); >> else >> - printf ("Warning, offscreen_damage_event received invalid xv pointer= :%p\n", >> - xv_widget); >> + message ("Warning, offscreen_damage_event received invalid xv pointe= r:%p\n", >> + xv_widget); >=20 > Why replace printf by message? Well, there wasn=E2=80=99t a particular problem, but it looked like that mes= sage was more used for warnings or errors. Should I revert it?=20 >> +#elif defined NS_IMPL_COCOA >> + nsxwidget_resize_view(xv, xw->width, xw->height); > ^ > Space before the opening parenthesis is missing. Ok, will fix. >> +*** Functions 'xwidget-webkit-scroll-up', 'xwidget-webkit-scroll-down' >> +now supports scrolling arbitrary pixel values. It now treats the > ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ > "support" (plural) "by arbitrary pixel values". "They now treat" (plural)= . Ok, will fix. >> +(defun xwidget-webkit-scroll-up-line (&optional n) >> + "Scroll webkit up by N lines. >> +The height of line is calculated with `window-font-height'. >> +Stop if the bottom edge of the page is reached. >> +If N is omitted or nil, scroll up by one line." >> + (interactive "p") >> + (xwidget-webkit-scroll-up (* n (window-font-height)))) >> + >> +(defun xwidget-webkit-scroll-down-line (&optional n) >> + "Scroll webkit down by N lines. >> +The height of line is calculated with `window-font-height'. >> +Stop if the top edge of the page is reached. >> +If N is omitted or nil, scroll down by one line." >> + (interactive "p") >> + (xwidget-webkit-scroll-down (* n (window-font-height)))) >> + >> +(defun xwidget-webkit-scroll-forward (&optional n) >> + "Scroll webkit horizontally by N chars. >> +The width of char is calculated with `window-font-width'. >> +If N is ommited or nil, scroll forwards by one char." >> + (interactive "p") >> (xwidget-webkit-execute-script >> (xwidget-webkit-current-session) >> - "window.scrollBy(50, 0);")) >> - >> -(defun xwidget-webkit-scroll-backward () >> - "Scroll webkit backwards." >> - (interactive) >> + (format "window.scrollBy(%d, 0);" >> + (* n (window-font-width))))) >> + >> +(defun xwidget-webkit-scroll-backward (&optional n) >> + "Scroll webkit back by N chars. >> +The width of char is calculated with `window-font-width'. >> +If N is ommited or nil, scroll backwards by one char." >> + (interactive "p") >=20 > These commands should say in their doc strings that interactively N is > the prefix numeric argument. Ok, will do. >> diff --git a/etc/NEWS b/etc/NEWS >> index f9a42f73be..c7f980f212 100644 >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -2469,6 +2469,10 @@ instances of xwidget webkit is not supported. >>=20 >> *** New variable 'xwidget-webkit-enable-plugins'. >>=20 >> +** On macOS, downloading files from xwidget-webkit is supported. >> + >> +*** New variable 'xwidget-webkit-download-dir'. >=20 > The macOS-specific part of this should be in the non-free OS part of > NEWS. Ok, will fix. >> +(defun xwidget-webkit-save-as-file (url mime-type file-name) >> + "For XWIDGET webkit, save URL of MIME-TYPE to location specified by us= er. >> +FILE-NAME combined with `xwidget-webkit-download-dir' is the default fil= e name >> +of the prompt when reading. When the file name the user specified is a >> +directory, URL is saved at the specified directory as FILE-NAME." >=20 > The last sentence is unclear: what will be the directory where the URL > will be saved, and what will be the name of the saved file in that > directory? Well, it was meaning that the URL will be saved at the directory the user sp= ecified in the prompt with the name FILE-NAME. I=E2=80=99m not sure how I should reword it due to my poor English skills; c= an you give me some suggestions?=20=