emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)


From: Eli Zaretskii
Subject: Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)
Date: Sun, 24 Mar 2019 18:27:27 +0200

> From: Alex <address@hidden>
> Cc: Paul Eggert <address@hidden>, address@hidden
> Date: Sun, 24 Mar 2019 09:05:00 -0600
> 
> Eli Zaretskii <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]