emacs-devel
[Top][All Lists]
Advanced

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

Re: new frame-parameter "alpha"


From: Seiji Zenitani
Subject: Re: new frame-parameter "alpha"
Date: Sat, 15 Mar 2008 15:54:43 -0400

Hi,

Thank you for your comments.
I have attached an revised code to this email.

On 2008/03/14, at 14:28, Stefan Monnier wrote:
The attached patch adds the window (frame) opacity feature to GNU Emacs. The user can control the frame opacity via a frame parameter 'alpha'.
If you like the code, I'll start to contact major  contributors.

I do not personally care for transparency, and I'm wondering if it's not
better handled by the (compositing) window-manager, but if some people
like this feature, I'm not opposed to it.

I would like to mention that we can potentially use this frame parameter on various platforms. I have another code for emacs 22, which works both on X11 and on Mac/Carbon. As soon as the Mac/Carbon port or other mac port comes back in emacs 23, it will be easy to port the code to the mac port. In addition, some people use the frame opacity code on the win32 platform.

A few comments on the code:

+  (defun set-alpha (alpha &optional frame)
(snip)

Is this necessary/important?

I have removed it.

+#ifdef HAVE_X_WINDOWS
+/* Lower limit value of frame transparency.  */
+
+Lisp_Object Vframe_alpha_lower_limit;
+#endif
+
 #endif

Only use #ifdef conditional compilation if either it's necessary to get the code to compile, or for code which is inherently only meaningful for a particular configuration. Since Vframe_alpha_lower_limit makes sense
with other GUIs than X11, it should not be protected with #ifdef
HAVE_X_WINDOWS.

+#ifdef HAVE_X_WINDOWS
+Lisp_Object Qalpha;
+#endif

Same here and various other places.

I have reduced #ifdef ... #endif.

+#ifdef HAVE_X_WINDOWS
+void
+x_set_alpha (f, arg, oldval)
+     struct frame *f;
+     Lisp_Object arg, oldval;
+{
(snip)
+}
+#endif

Explain why you do things twice.

This is because two kinds of frame opacity are set: one for an active frame (the frontmost frame), the other for inactive frames (background frames).

Also, note the coding conventions we use and try to reproduce them.
E.g. we place a space before open parentheses but no space after (and
no space before the close parenthesis either).

I have modified the coding style.

+#ifdef HAVE_X_WINDOWS
+  /* Opacity of the Frame  */
+  double alpha[2];
+#endif

The comment should describe what the field holds, so in this case it
should describe *both* entries of the table.

Done.

Also in the docstring, don't just use "alpha" but "alpha transparency"
or something like that, for people who don't know what you mean by "alpha".

        Stefan


At present I call the parameters/variables "alpha" ('alpha, frame- alpha-lower-limit, x_set_frame_alpha, etc.) similar to Meadow. If "alpha" is ambiguous, we can rename them to "opacity" etc.

Attachment: transparency4-x23.patch
Description: Binary data



P.S.
Meadow has four settings for the frame opacity: (1) active frame, (2) inactive frames, (3) moving frame, and (4) resizing frame. e.g. (set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive> [<moving> [sizing]]]))


Seiji Zenitani
address@hidden


reply via email to

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