From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere) Date: Sun, 24 Mar 2019 18:27:27 +0200 Message-ID: <83imw8nspc.fsf@gnu.org> References: <87wokp4okn.fsf@gmail.com> <83ef6xpo6b.fsf@gnu.org> <0f4be9a6-6e09-f55d-9f58-2a15aef264cd@cs.ucla.edu> <837ecpplw8.fsf@gnu.org> <871s2w510a.fsf@gmail.com> <922F9B91-2E9E-45F6-BB96-66CAE5E9FB81@gnu.org> <87k1goqpnn.fsf@gmail.com> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="202016"; mail-complaints-to="usenet@blaine.gmane.org" Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Alex Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 24 17:27:35 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 1h85yB-000qQL-Hf for ged-emacs-devel@m.gmane.org; Sun, 24 Mar 2019 17:27:35 +0100 Original-Received: from localhost ([127.0.0.1]:58179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h85yA-0006Zq-II for ged-emacs-devel@m.gmane.org; Sun, 24 Mar 2019 12:27:34 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h85y4-0006ZV-6D for emacs-devel@gnu.org; Sun, 24 Mar 2019 12:27:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h85y3-00060F-JH; Sun, 24 Mar 2019 12:27:27 -0400 Original-Received: from [176.228.60.248] (port=4981 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h85y2-0002Ec-Ot; Sun, 24 Mar 2019 12:27:27 -0400 In-reply-to: <87k1goqpnn.fsf@gmail.com> (message from Alex on Sun, 24 Mar 2019 09:05:00 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:234685 Archived-At: > From: Alex > Cc: Paul Eggert , emacs-devel@gnu.org > Date: Sun, 24 Mar 2019 09:05:00 -0600 > > Eli Zaretskii writes: > > > Where would something like that be needed? Can you point out a couple > > of places in the code where we should use this? > > This would be used wherever some generic procedure needed to call a > windowing system-specific procedure. Currently this is done by all > backends defining the same x_* procedure that the generic procedure > uses. This is a method to avoid this name clash (and also getting a step > closer to the goal of using multiple backends simultaneously). > > For example, in frame.c (keep_ratio), replace the x_set_offset call > with: > > CALL_FOR_WS (f, set_offset, f, pos_x, pos_y, -1) > > In frame.c (adjust_frame_size), replace x_set_window_size with: > > CALL_FOR_WS (f, set_window_size, f, 0, new_text_width, new_text_height, 1) OK, thanks. AFAICS, the vast majority of x_* functions defined in w32*.c and ns*.m are either static or used from other w32*.c/ns*.m files, i.e. by the same window-system back-end. Those can be simply renamed into w32_* and ns_*, and that's it. The remaining small minority should probably simply be added to redisplay_interface, and used as we do with the other functions there. Some of those are not literally "for redisplay", but I don't think it matters too much. In order for a function to be able to call through FRAME_RIF, it must have access to the appropriate 'struct frame' pointer. So my suggestion is to audit all the 'extern' x_* functions which have such multiple implementations, and see which ones have callers that don't have access to the corresponding frame. We then need to see how to solve that (hopefully, in each such case we will find a way to get at the frame somehow). The only remaining problem that I could spot is that there's a small number of Lisp primitives named x-SOMETHING, which are implemented by each GUI backend. Example: x-display-pixel-width. I think for now we should leave those primitives alone without renaming, and only change their implementation to call the x_*, w32_*, or ns_* functions for each back-end. Renaming of these primitives can be done as a separate step, and we will have to decide on the name pattern (something like "xw-SOMETHING, perhaps?), and add obsolete aliases for backward compatibility. Are there any other issues related to this that I missed? Thanks for working on this.