emacs-devel
[Top][All Lists]
Advanced

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

Can we use FRAME_RIF to return a Lisp_Object result?


From: Keith David Bershatsky
Subject: Can we use FRAME_RIF to return a Lisp_Object result?
Date: Tue, 31 Oct 2017 11:44:02 -0700

As part of the multiple fake cursors (22873) and crosshairs (17684) features 
that I am working on, I am obtaining the red / green / blue values for the 
buffer default background face by using platform specific functions within 
nsterm.m, xterm.c, and w32term.c.

I would like `FRAME_RIF (f)->calc_lsl_default_bg (w)` to return a Lisp_Object 
in the form of a vector consisting of 3 doubles.

All of the examples in redisplay_interface are void, which makes me think that 
a Lisp_Object result may not be supported.

I have been using window pointers to store the values for red, green and blue.  
However, I would like to eliminate the need to use those window pointers in 
favor of FRAME_RIF returning a Lisp_Object result.  Is this okay to do, or is 
there a more appropriate way to get the result of those platform specific 
functions?


/* window.h */
/* Suffixes for the `mc` window pointer prefix. */
struct multiple_cursors
{
  * * *

  /* Values for the background color that are used to erase a glyphless cursor. 
*/
  double bg_red, bg_green, bg_blue;

  * * *
};


/* nsterm.m */
static void
ns_calc_lsl_default_bg (struct window *w)
{
  struct frame *f = XFRAME (WINDOW_FRAME (w));
  /* The default face, possibly remapped. */
  struct face *default_face = FACE_FROM_ID (f, lookup_basic_face (f, 
DEFAULT_FACE_ID));
  NSColor *background_color = ns_lookup_indexed_color 
(default_face->background, f);
  EmacsCGFloat red, green, blue;
  * * *
  w->mc.bg_red = red;
  w->mc.bg_green = green;
  w->mc.bg_blue = blue;
  * * *
}


/* dispextern.h */

struct redisplay_interface
{
  /* Handlers for setting frame parameters.  */
  frame_parm_handler *frame_parm_handlers;

  * * * 

  void (*calc_lsl_default_bg) (struct window *w);

  * * *
};

Thanks,

Keith



reply via email to

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