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: frame transparency for Cocoa Date: Sun, 23 Nov 2008 23:11:07 -0500 Message-ID: <8CDB11CB-0E68-4055-973B-2410AA5410EC@mac.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_Q6f0BYCYgmcZI3ribG0jCg)" X-Trace: ger.gmane.org 1227500450 31784 80.91.229.12 (24 Nov 2008 04:20:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Nov 2008 04:20:50 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 24 05:21:54 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 1L4SxO-0007AL-CE for ged-emacs-devel@m.gmane.org; Mon, 24 Nov 2008 05:21:54 +0100 Original-Received: from localhost ([127.0.0.1]:56189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4SwE-00060h-RT for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 23:20:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L4SwA-00060O-9Y for emacs-devel@gnu.org; Sun, 23 Nov 2008 23:20:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L4Sw7-0005zp-Pt for emacs-devel@gnu.org; Sun, 23 Nov 2008 23:20:37 -0500 Original-Received: from [199.232.76.173] (port=52598 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4Sw7-0005zm-Gf for emacs-devel@gnu.org; Sun, 23 Nov 2008 23:20:35 -0500 Original-Received: from asmtpout014.mac.com ([17.148.16.89]:52382) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L4Sn2-00009i-2X for emacs-devel@gnu.org; Sun, 23 Nov 2008 23:11:12 -0500 Original-Received: from [10.0.1.200] (c-98-218-112-131.hsd1.md.comcast.net [98.218.112.131]) by asmtp014.mac.com (Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug 7 2008; 32bit)) with ESMTPA id <0KAT006HXKYJD970@asmtp014.mac.com> for emacs-devel@gnu.org; Sun, 23 Nov 2008 20:11:09 -0800 (PST) X-Mailer: Apple Mail (2.929.2) X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) 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:106059 Archived-At: --Boundary_(ID_Q6f0BYCYgmcZI3ribG0jCg) Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 7BIT Hi, Here is a frame-wide transparency code for Cocoa port. The syntax is the same as X port and w32 port. As far as I tested, this one seamlessly coexists with NS port's face-transparency (e.g. ns-set-background-alpha) on OSX 10.5. Could anyone test the compatibility with GNUstep? (It should do nothing on GNUstep.) best wishes, Seiji --Boundary_(ID_Q6f0BYCYgmcZI3ribG0jCg) Content-type: application/octet-stream; x-unix-mode=0644; name=transparency.patch Content-transfer-encoding: 7bit Content-disposition: attachment; filename=transparency.patch Index: src/frame.c =================================================================== RCS file: /sources/emacs/emacs/src/frame.c,v retrieving revision 1.398 diff -u -r1.398 frame.c --- src/frame.c 12 Nov 2008 15:52:12 -0000 1.398 +++ src/frame.c 23 Nov 2008 22:17:00 -0000 @@ -3678,7 +3678,7 @@ for (i = 0; i < 2; i++) f->alpha[i] = newval[i]; -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) +#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) BLOCK_INPUT; x_set_frame_alpha (f); UNBLOCK_INPUT; Index: src/nsfns.m =================================================================== RCS file: /sources/emacs/emacs/src/nsfns.m,v retrieving revision 1.26 diff -u -r1.26 nsfns.m --- src/nsfns.m 22 Oct 2008 12:51:30 -0000 1.26 +++ src/nsfns.m 23 Nov 2008 22:17:00 -0000 @@ -1037,7 +1037,7 @@ 0, /* x_set_wait_for_wm, will ignore */ 0, /* x_set_fullscreen will ignore */ x_set_font_backend, /* generic OK */ - 0 + x_set_alpha }; Index: src/nsterm.m =================================================================== RCS file: /sources/emacs/emacs/src/nsterm.m,v retrieving revision 1.35 diff -u -r1.35 nsterm.m --- src/nsterm.m 15 Nov 2008 05:20:49 -0000 1.35 +++ src/nsterm.m 23 Nov 2008 22:17:01 -0000 @@ -957,9 +957,15 @@ dpyinfo->x_highlight_frame != old_highlight) { if (old_highlight) + { x_update_cursor (old_highlight, 1); + x_set_frame_alpha (old_highlight); + } if (dpyinfo->x_highlight_frame) + { x_update_cursor (dpyinfo->x_highlight_frame, 1); + x_set_frame_alpha (dpyinfo->x_highlight_frame); + } } } @@ -1603,6 +1609,39 @@ } +void +x_set_frame_alpha (struct frame *f) +/* -------------------------------------------------------------------------- + Experimental: + -------------------------------------------------------------------------- */ +{ + struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + EmacsView *view = FRAME_NS_VIEW (f); + double alpha = 1.0; + double alpha_min = 1.0; + + if (dpyinfo->x_highlight_frame == f) + alpha = f->alpha[0]; + else + alpha = f->alpha[1]; + + if (FLOATP (Vframe_alpha_lower_limit)) + alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit); + else if (INTEGERP (Vframe_alpha_lower_limit)) + alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0; + + if (alpha < 0.0) + return; + else if (1.0 < alpha) + alpha = 1.0; + else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0) + alpha = alpha_min; + +#ifdef NS_IMPL_COCOA + [[view window] setAlphaValue: alpha]; +#endif +} + /* ========================================================================== @@ -4957,7 +4996,10 @@ /* FIXME: for some reason needed on second and subsequent clicks away from sole-frame Emacs to get hollow box to show */ if (!windowClosing && [[self window] isVisible] == YES) - x_update_cursor (emacsframe, 1); + { + x_update_cursor (emacsframe, 1); + x_set_frame_alpha (emacsframe); + } if (emacs_event) { --Boundary_(ID_Q6f0BYCYgmcZI3ribG0jCg) Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 7BIT 2008-11-23 Seiji Zenitani * frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha. * nsfns.m (ns_frame_parm_handlers): Set alpha handler. * nsterm.m (x_set_frame_alpha): New function. --Boundary_(ID_Q6f0BYCYgmcZI3ribG0jCg)--