[Top][All Lists]

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

Re: C equivalent for: (face-attribute 'region :background (selected-fram

From: Keith David Bershatsky
Subject: Re: C equivalent for: (face-attribute 'region :background (selected-frame) 'default)
Date: Thu, 05 Oct 2017 20:53:53 -0700

Thank you, YAMAMOTO Mitsuharu, for following this thread.

Emacs for all three platforms already uses (to some extent) LSL color vectors.  
nsterm.m does not need to convert the LSL values and it uses them liberally.  
xterm.c multiplies or divides them by 65535 depending upon which direction the 
conversion is needed.  w32term.c multiplies them by 255.

My current design erases fake cursors in the reverse method in which they were 
drawn.  A fake cursor with a glyph (e.g., text underneath) needs no special 
treatment -- i.e., erase_phys_cursor takes care of everything (given the proper 
configuration).  A floating glyphless cursor (with no text) can be used to 
create a floating horizontal or vertical line anywhere within the 
window-body-height/width -- it is erased by drawing it again with the 
background color.

Inasmuch as we can convert to/from any color format we desire, what happens 
internally is just a matter of personal preference.  The draft API for fake 
cursors already supports three formats:  "red", [1.0 0.0 0.0], and "#FF0000".  
The API can easily be extended to support a face, which only the background 
color would be relevant.  The user does not need to care about the fact that 
Emacs is converting from:  red-face => red => [1 0 0] => 
xterm.c/nsterm.m/w32term.c compatible implementations.

I successfully implemented a working draft of crosshairs in xterm.c today, and 
am now moving on to w32 in the coming days.

Extracting the coordinates for fake cursors when dealing with overlays and text 
properties will be last on my list of things to do, since that is the most 

Implementing functionality similar to Magnars multiple cursors library will be 
left to someone more advanced than myself.  For the past several months, I have 
been using built-in multiple fake cursors in conjunction with Magnars' library 
-- i.e., instead of a box overlay, I'm using a vertical bar fake cursor for 
each fake cursor.



DATE:  [10-05-2017 00:11:44] <05 Oct 2017 16:11:44 +0900>
FROM:  YAMAMOTO Mitsuharu <address@hidden>
>  * * *
> And as I already commented, creating LSL vector or something from a
> face in a platform-independent code is not a good design in the sense
> that it is inconsistent with the current code.  Each drawing backend
> can get color information (as GC, in all the platforms other than NS)
> from a given face as I showed in the code `mac_gc_for_face_id'.
> Also, erasing crosshairs or cursors could be done by imitating the
> code in `expose_area'.  I think you don't need to know which face is
> used in the erased area.
>          YAMAMOTO Mitsuharu
>     address@hidden

reply via email to

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