On 13 Feb 2008, at 21:58, [EMAIL PROTECTED] wrote:
If someone wants to me point me in the right direction in the Carbon Emacs source, I'd be willing to tackle this, as it's a feature that I've wanted for quite a long time.
Cool. The code base is not straightforward, thanks to files with 12,000 lines of source code, C-- code, lots of macros and the mix of Carbon interfaces and an architecture that assumes an X API.
Have a look at mac.c. I find it easiest to work with the GNU Emacs source code directly when doing C level changes. the "make-package" script is okay for your initial build, but use --build-in-place as option so it wont' re-build the whole thing every time you compile.
To define a function that is accessible from Elisp (i.e. for the user), you have to use the DEFUN macros. They take some arguments that indicate the C-level name of the function and the numbers of mandatory and optional arguments. The C-level names need to be declared with "defsubr". For instance:
DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, doc: /* Get the creator code of FILENAME as a four character string. */)
(filename)
Lisp_Object filename;
{
...
}
towards the end of the source file:
defsubr (&Smac_get_file_creator);
So that's not really complicated.
There are further macros to know that block garbage collection and
user input, and there are some intricate rules that I don't fully
understand: GCPRO1 (or GCPRO2 or GCPRO3) and BLOCK_INPUT. Let's
ignore this for now - I think it is not relevant for what you want to
do.
You'll have to look at how to do full-screen mode in carbon, and how to get a Carbon reference for a specific frame (that is presumably passed to your function on the ELisp level). calling MacHideMenuBar() is probably one of the things necessary, just like "mac-hide-menu-bar" does (macfns.c i think).
Once that works, you'll have to look at how to "de-full-screen" a frame sensibly and if or when that needs to be triggered. Check what happens when other frames are raised on top of the current one. Check what happens when the tool-bar changes, or the frame's font. And how to deal with the fact that Emacs doesn't do arbitrary frame heights. These may turn out to be the real issues here...
Good luck, and I hope you can share a patch with everyone here soon! - D
smime.p7s
Description: S/MIME cryptographic signature
