]> git.eshelyaron.com Git - emacs.git/commitdiff
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
authorSeiji Zenitani <zenitani@mac.com>
Fri, 28 Nov 2008 05:40:36 +0000 (05:40 +0000)
committerSeiji Zenitani <zenitani@mac.com>
Fri, 28 Nov 2008 05:40:36 +0000 (05:40 +0000)
* nsfns.m (ns_frame_parm_handlers): Set alpha handler.
* nsterm.m (x_set_frame_alpha): New function.

src/ChangeLog
src/frame.c
src/nsfns.m
src/nsterm.m

index c8c1c7636afddccb57ce5f63e9725deb37c66e73..df1fcc6dacb75fcb341fff1785a108a1c509c8b2 100644 (file)
@@ -1,3 +1,11 @@
+2008-11-28  Seiji Zenitani  <zenitani@mac.com>
+
+       * 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.
+
 2008-11-27  Eli Zaretskii  <eliz@gnu.org>
 
        * xfaces.c (Fx_font_family_list, syms_of_xfaces): Fix last change.
index 722cf2f96a9395a8f0f0e1b23d611af095f33671..611dd1e2f55d23acf063ae01ee39de120dcb13e7 100644 (file)
@@ -3678,7 +3678,7 @@ x_set_alpha (f, arg, oldval)
   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 2e2d6a77b75fc32ff7d64c8bece7492cfec07bad..df5c7e13daf41bc92992f60aafdec6bb514ca73e 100644 (file)
@@ -1040,7 +1040,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
   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 83cc18184bad4b0ccdd1b3737aa0adf31c0ef885..fbb6e91612ea8d82929c2b6e40337d0983e0bc65 100644 (file)
@@ -964,9 +964,15 @@ ns_frame_rehighlight (struct frame *frame)
          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);
+       }
     }
 }
 
@@ -1634,6 +1640,39 @@ ns_get_rgb_color (struct frame *f, float r, float g, float b, float a)
 }
 
 
+void
+x_set_frame_alpha (struct frame *f)
+/* --------------------------------------------------------------------------
+     change the entire-frame transparency
+   -------------------------------------------------------------------------- */
+{
+  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
+}
+
 
 /* ==========================================================================
 
@@ -5009,7 +5048,10 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request");
   /* 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)
     {