From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Seiji Zenitani Newsgroups: gmane.emacs.devel Subject: Re: new frame-parameter "alpha" Date: Thu, 20 Mar 2008 18:47:10 -0400 Message-ID: <9D043B74-4054-4798-8EBA-FF18632CFDA7@mac.com> References: <4AC96E26-98BE-4142-9211-ADFEA164957B@mac.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v753) Content-Type: multipart/mixed; boundary=Apple-Mail-50-112763555 X-Trace: ger.gmane.org 1206053354 949 80.91.229.12 (20 Mar 2008 22:49:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Mar 2008 22:49:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 20 23:49:43 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JcTZt-0001eQ-9C for ged-emacs-devel@m.gmane.org; Thu, 20 Mar 2008 23:49:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JcTZJ-00032S-3E for ged-emacs-devel@m.gmane.org; Thu, 20 Mar 2008 18:49:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JcTY7-0002eD-Qw for emacs-devel@gnu.org; Thu, 20 Mar 2008 18:47:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JcTY4-0002cQ-8D for emacs-devel@gnu.org; Thu, 20 Mar 2008 18:47:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JcTY3-0002cI-T7 for emacs-devel@gnu.org; Thu, 20 Mar 2008 18:47:47 -0400 Original-Received: from smtpoutm.mac.com ([17.148.16.73]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JcTY3-000692-7X for emacs-devel@gnu.org; Thu, 20 Mar 2008 18:47:47 -0400 Original-Received: from mac.com (asmtp009-s [10.150.69.72]) by smtpoutm.mac.com (Xserve/smtpout010/MantshX 4.0) with ESMTP id m2KMli8N004307; Thu, 20 Mar 2008 15:47:45 -0700 (PDT) Original-Received: from [10.0.1.200] (c-98-204-109-185.hsd1.md.comcast.net [98.204.109.185]) (authenticated bits=0) by mac.com (Xserve/asmtp009/MantshX 4.0) with ESMTP id m2KMlgBJ015204; Thu, 20 Mar 2008 15:47:43 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.753) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:93078 Archived-At: --Apple-Mail-50-112763555 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi, On 2008/03/19, at 12:16, Stefan Monnier wrote: >>> Looks good. Tho maybe I'd put the call to x_set_frame_alpha >>> directly >>> inside x_update_cursor (and rename it to >>> x_update_cursor_and_opacity). >>> >>> I don't mind the use of "alpha" rather than "opacity", as long as >>> the >>> docstrings are clear. The patch needs to also update the manual. >>> And could you describe the copyright status? > >> The frame parameter code and the x_set_frame_alpha function >> were written by Ryo Yoshitake. He is ready to sign. > > Could you send him the appended form (and Cc me along the way)? > Done. >> The lower_limit variable and the x_set_alpha function originally >> come from >> mw32fns.c (e.g. mw32_set_frame_alpha in l.1019-1078) in Meadow, >> although they look differently because of my extensive modification. >> http://www.meadowy.org/meadow/browser/trunk/src/mw32fns.c (slow >> connection) >> I am contacting Mr. Horiguchi, the author of the relevant part. > > Copyright only applies to actual code, not ideas, so if the code was > rewritten, copyright does not apply any more. > In order to make sure, I extracted the relevant lines which I ported from Meadow to GNU Emacs. Let me know if there are any problems. Attached 1 - the original lines from mw32fns.c --Apple-Mail-50-112763555 Content-Transfer-Encoding: quoted-printable Content-Type: application/octet-stream; x-unix-mode=0644; name=mw32fns.c Content-Disposition: attachment; filename=mw32fns.c /*=20Lower=20limit=20of=20alpha=20value=20of=20frame.=20*/=0Aint=20= mw32_frame_alpha_lower_limit;=0A=0A#define=20CHECK_ALPHA_RANGE(alpha)=20= if=20(alpha=20<=200=20||=20alpha=20>=20100)=09\=0A=20=20=20=20= args_out_of_range=20(make_number=20(0),=20make_number=20(100));=0A=0A= static=20void=0Amw32_set_frame_alpha=20(FRAME_PTR=20f,=20Lisp_Object=20= arg,=20Lisp_Object=20oldval)=0A{=0A=20=20int=20newalpha[NUM_OF_ALPHAS];=0A= =20=20int=20i,=20tmp;=0A=20=20Lisp_Object=20obj;=0A=0A=20=20if=20= (SetLayeredWindowAttributes=20=3D=3D=20NULL)=0A=20=20=20=20return;=0A=0A=20= =20if=20(NILP=20(arg)=0A=20=20=20=20=20=20||=20(CONSP=20(arg)=20&&=20= NILP=20(CAR=20(arg))))=0A=20=20=20=20tmp=20=3D=20-1;=0A=20=20else=20if=20= (NUMBERP=20(arg))=0A=20=20=20=20{=0A=20=20=20=20=20=20tmp=20=3D=20XINT=20= (arg);=0A=20=20=20=20=20=20CHECK_ALPHA_RANGE=20(tmp);=0A=20=20=20=20}=0A=20= =20else=20if=20(CONSP=20(arg)=20&&=20NUMBERP=20(CAR=20(arg)))=0A=20=20=20= =20{=0A=20=20=20=20=20=20tmp=20=3D=20XINT=20(CAR=20(arg));=0A=20=20=20=20= =20=20CHECK_ALPHA_RANGE=20(tmp);=0A=20=20=20=20}=0A=20=20else=0A=20=20=20= =20wrong_type_argument=20(Qnumberp,=20(arg));=0A=0A=20=20for=20(i=20=3D=20= 0=20;=20i=20<=20NUM_OF_ALPHAS=20;=20i++)=0A=20=20=20=20newalpha[i]=20=3D=20= tmp;=0A=0A=20=20if=20(CONSP=20(arg))=0A=20=20=20=20{=0A=20=20=20=20=20=20= obj=20=3D=20CDR=20(arg);=0A=20=20=20=20=20=20for=20(i=20=3D=20= ALPHA_INACTIVE=20;=0A=09=20=20=20i=20<=20NUM_OF_ALPHAS=20&&=20CONSP=20= (obj)=20;=0A=09=20=20=20i++,=20obj=20=3D=20CDR=20(obj))=0A=09{=0A=09=20=20= if=20(NILP=20(CAR=20(obj)))=0A=09=20=20=20=20tmp=20=3D=20-1;=0A=09=20=20= else=20if=20(NUMBERP=20(CAR=20(obj)))=0A=09=20=20=20=20{=0A=09=20=20=20=20= =20=20tmp=20=3D=20XINT=20(CAR=20(obj));=0A=09=20=20=20=20=20=20= CHECK_ALPHA_RANGE=20(tmp);=0A=09=20=20=20=20}=0A=09=20=20else=0A=09=20=20= =20=20wrong_type_argument=20(Qnumberp,=20(CAR=20(obj)));=0A=0A=09=20=20= newalpha[i]=20=3D=20tmp;=0A=09}=0A=20=20=20=20}=0A=0A=20=20for=20(i=20=3D=20= 0=20;=20i=20<=20NUM_OF_ALPHAS=20;=20i++)=0A=20=20=20=20{=0A=20=20=20=20=20= =20/*=20Apply=20lower=20limit=20silently=20*/=0A=20=20=20=20=20=20if=20= (newalpha[i]=20!=3D=20-1=20&&=20newalpha[i]=20<=20= mw32_frame_alpha_lower_limit)=0A=09newalpha[i]=20=3D=20= mw32_frame_alpha_lower_limit;=0A=0A=20=20=20=20=20=20= f->output_data.mw32->alpha[i]=20=3D=20newalpha[i];=0A=20=20=20=20}=0A=0A=20= =20mw32_update_frame_alpha=20(f);=0A}=0A=0A=0C=0A=0A=20=20DEFVAR_INT=20= ("mw32-frame-alpha-lower-limit",=20&mw32_frame_alpha_lower_limit,=0A=09=20= =20=20=20=20=20doc:=20/*=20Lower=20limit=20of=20alpha=20value=20of=20= frame.=20*/);=0A=20=20mw32_frame_alpha_lower_limit=20=3D=2020;=0A=0A= --Apple-Mail-50-112763555 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Attached 2 - the relevant part of our patch (in frame.c) --Apple-Mail-50-112763555 Content-Transfer-Encoding: quoted-printable Content-Type: application/octet-stream; x-unix-mode=0644; name=transparency4-x23-test.patch Content-Disposition: attachment; filename=transparency4-x23-test.patch diff=20-Naur=20emacs.orig/src/frame.c=20emacs/src/frame.c=0A---=20= emacs.orig/src/frame.c=092008-02-11=2023:03:16.000000000=20-0500=0A+++=20= emacs/src/frame.c=092008-03-14=2022:53:51.000000000=20-0400=0A@@=20-67,6=20= +67,10=20@@=0A=20=0A=20Lisp_Object=20Vx_resource_class;=0A=20=0A+/*=20= Lower=20limit=20value=20of=20the=20frame=20opacity=20(alpha=20= transparency).=20=20*/=0A+=0A+Lisp_Object=20Vframe_alpha_lower_limit;=0A= +=0A=20#endif=0A=20=0A=20Lisp_Object=20Qframep,=20Qframe_live_p;=0A@@=20= -3699,6=20+3705,61=20@@=0A=20=20=20=20=20return=20Qnil;=0A=20}=0A=20=0A= +void=0A+x_set_alpha=20(f,=20arg,=20oldval)=0A+=20=20=20=20=20struct=20= frame=20*f;=0A+=20=20=20=20=20Lisp_Object=20arg,=20oldval;=0A+{=0A+=20=20= double=20alpha=20=3D=201.0;=0A+=20=20double=20newval[2];=0A+=20=20int=20= i,=20ialpha;=0A+=20=20Lisp_Object=20item;=0A+=0A+=20=20for=20= (i=3D0;i<2;i++)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20newval[i]=20=3D=20= 1.0;=0A+=20=20=20=20=20=20if=20(CONSP=20(arg))=0A+=20=20=20=20=20=20=20=20= {=0A+=20=20=20=20=20=20=20=20=20=20item=20=3D=20CAR=20(arg);=0A+=20=20=20= =20=20=20=20=20=20=20arg=20=20=3D=20CDR=20(arg);=0A+=20=20=20=20=20=20=20= =20}=0A+=20=20=20=20=20=20else=0A+=20=20=20=20=20=20=20=20item=3Darg;=0A= +=0A+=20=20=20=20=20=20if=20(!NILP=20(item))=0A+=20=20=20=20=20=20=20=20= {=0A+=20=20=20=20=20=20=20=20=20=20if=20(FLOATP=20(item))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20{=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= alpha=20=3D=20XFLOAT_DATA=20(item);=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20if=20(alpha=20<=200.0=20||=201.0=20<=20alpha)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20args_out_of_range=20(make_float=20(0.0),=20= make_float=20(1.0));=0A+=20=20=20=20=20=20=20=20=20=20=20=20}=0A+=20=20=20= =20=20=20=20=20=20=20else=20if=20(INTEGERP=20(item))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20{=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20ialpha=20= =3D=20XINT=20(item);=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20if=20= (ialpha=20<=200=20||=20100=20<=20ialpha)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20args_out_of_range=20(make_number=20(0),=20make_number=20= (100));=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20else=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20alpha=20=3D=20ialpha=20/=20100.0;=0A= +=20=20=20=20=20=20=20=20=20=20=20=20}=0A+=20=20=20=20=20=20=20=20=20=20= else=0A+=20=20=20=20=20=20=20=20=20=20=20=20wrong_type_argument=20= (Qnumberp,=20item);=0A+=20=20=20=20=20=20=20=20}=0A+=20=20=20=20=20=20= newval[i]=20=3D=20alpha;=0A+=20=20=20=20}=0A+=0A+=20=20for=20= (i=3D0;i<2;i++)=0A+=20=20=20=20f->alpha[i]=20=3D=20newval[i];=0A+=0A= +#ifdef=20HAVE_X_WINDOWS=0A+=20=20BLOCK_INPUT;=0A+=20=20= x_set_frame_alpha=20(f);=0A+=20=20UNBLOCK_INPUT;=0A+#endif=0A+=0A+=20=20= return;=0A+}=0A+=0A=20=0C=0A=20/*=20Subroutines=20of=20creating=20an=20X=20= frame.=20=20*/=0A=20=0A@@=20-4468,6=20+4527,13=20@@=0A=20but=20binding=20= this=20variable=20locally=20around=20a=20call=20to=20`x-get-resource'=0A=20= is=20a=20reasonable=20practice.=20=20See=20also=20the=20variable=20= `x-resource-name'.=20=20*/);=0A=20=20=20Vx_resource_class=20=3D=20= build_string=20(EMACS_CLASS);=0A+=0A+=20=20DEFVAR_LISP=20= ("frame-alpha-lower-limit",=20&Vframe_alpha_lower_limit,=0A+=20=20=20=20= doc:=20/*=20The=20lower=20limit=20of=20the=20frame=20opacity=20(alpha=20= transparency).=0A+The=20value=20should=20range=20from=200=20(invisible)=20= to=20100=20(completely=20opaque).=0A+The=20user=20can=20also=20use=20a=20= floating=20number=20between=200.0=20and=201.0.=0A+The=20default=20is=20= 20.=20=20*/);=0A+=20=20Vframe_alpha_lower_limit=20=3D=20make_number=20= (20);=0A=20#endif=0A=20=0A=20=20=20DEFVAR_LISP=20("default-frame-alist",=20= &Vdefault_frame_alist,=0Adiff=20-Naur=20emacs.orig/src/frame.h=20= emacs/src/frame.h=0A= --Apple-Mail-50-112763555 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Seiji Zenitani zenitani@mac.com --Apple-Mail-50-112763555--