all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Code cleanup -- inconsistent "width" and "height" etc.
@ 2003-04-10  1:51 Kim F. Storm
  2003-04-10  0:11 ` Kenichi Handa
  2003-04-10  1:32 ` Miles Bader
  0 siblings, 2 replies; 11+ messages in thread
From: Kim F. Storm @ 2003-04-10  1:51 UTC (permalink / raw)



Looking through the C code, the words width and height are not used
consistently.  Sometimes they are in columns/lines (canonical units),
and sometimes they are in pixels.

Similar for top/left specs (they are in pixels for a frame and
in canonical units for a window).

Some variables/macros like FRAME_SCROLL_BAR_COLS and
FRAME_SCROLL_BAR_WIDTH are pretty confusing, as they are both measured
in columns, but the first gives the "configured width" unconditionally
while the second may return zero if scroll bars are not shown, and
otherwise equals FRAME_SCROLL_BAR_COLS...

And things like FRAME_WIDTH and FRAME_WINDOW_WIDTH are also confusing.
Both are measured in columns, but the former does not include the
width of scroll bars and fringes.

Compare this to "WINDOW_DISPLAY_PIXEL_WIDTH" which is another way of
naming a macro which does not include scroll bars or fringes (thus
implicating that a macro named WINDOW_PIXEL_WIDTH would return the
total width of the window).


I would like to fix such discrepancies as follows:

Things measured in columns/lines are named as _CANON_WIDTH and
_CANON_HEIGHT resp., while things measured in pixels are named as
_PIXEL_WIDTH and _PIXEL_HEIGHT resp.

To differentiate between macros which return a value unconditionally,
and macros which return the value only if some condition, I propose
to name them as e.g. FRAME_CONFIG_SCROLL_BAR_CANON_WIDTH and
FRAME_ACTUAL_SCROLL_BAR_CANON_WIDTH.

For things which differs by including or not including e.g. scroll
bars and fringes I propose using e.g. FRAME_TEXT_CANON_WIDTH (or
FRAME_DISPLAY_CANON_WIDTH) and FRAME_TOTAL_CANON_WIDTH.


It is a tedious work to clean this up, but the current state of the
source code is pretty messy, and cleaning it up would make an
important step (I think) towards lifting some of the restrictions we
currently have on measuring everything in columns and lines (since it
makes the code clearer to read, and thus easier to change correctly).

DWYT?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-04-12  2:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-10  1:51 Code cleanup -- inconsistent "width" and "height" etc Kim F. Storm
2003-04-10  0:11 ` Kenichi Handa
2003-04-10  1:32 ` Miles Bader
2003-04-10 13:50   ` Kim F. Storm
2003-04-10 12:10     ` Kenichi Handa
2003-04-11  0:08       ` Kim F. Storm
2003-04-10 23:27         ` Miles Bader
2003-04-11  0:34         ` Kenichi Handa
2003-04-11 23:45           ` Richard Stallman
2003-04-12  2:19             ` Kenichi Handa
2003-04-11  8:51     ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.