aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/frame.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/frame.c b/src/frame.c
index c83caf460de..20812878c10 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -62,6 +62,10 @@ Lisp_Object Vx_resource_name;
62 62
63Lisp_Object Vx_resource_class; 63Lisp_Object Vx_resource_class;
64 64
65/* Lower limit value of the frame opacity (alpha transparency). */
66
67Lisp_Object Vframe_alpha_lower_limit;
68
65#endif 69#endif
66 70
67Lisp_Object Qframep, Qframe_live_p; 71Lisp_Object Qframep, Qframe_live_p;
@@ -113,6 +117,7 @@ Lisp_Object Qtty, Qtty_type;
113 117
114Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; 118Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
115Lisp_Object Qfont_backend; 119Lisp_Object Qfont_backend;
120Lisp_Object Qalpha;
116 121
117Lisp_Object Qinhibit_face_set_after_frame_default; 122Lisp_Object Qinhibit_face_set_after_frame_default;
118Lisp_Object Qface_set_after_frame_default; 123Lisp_Object Qface_set_after_frame_default;
@@ -2826,7 +2831,8 @@ static struct frame_parm_table frame_parms[] =
2826 {"right-fringe", &Qright_fringe}, 2831 {"right-fringe", &Qright_fringe},
2827 {"wait-for-wm", &Qwait_for_wm}, 2832 {"wait-for-wm", &Qwait_for_wm},
2828 {"fullscreen", &Qfullscreen}, 2833 {"fullscreen", &Qfullscreen},
2829 {"font-backend", &Qfont_backend} 2834 {"font-backend", &Qfont_backend},
2835 {"alpha", &Qalpha}
2830}; 2836};
2831 2837
2832#ifdef HAVE_WINDOW_SYSTEM 2838#ifdef HAVE_WINDOW_SYSTEM
@@ -3636,6 +3642,61 @@ x_icon_type (f)
3636 return Qnil; 3642 return Qnil;
3637} 3643}
3638 3644
3645void
3646x_set_alpha (f, arg, oldval)
3647 struct frame *f;
3648 Lisp_Object arg, oldval;
3649{
3650 double alpha = 1.0;
3651 double newval[2];
3652 int i, ialpha;
3653 Lisp_Object item;
3654
3655 for (i = 0; i < 2; i++)
3656 {
3657 newval[i] = 1.0;
3658 if (CONSP (arg))
3659 {
3660 item = CAR (arg);
3661 arg = CDR (arg);
3662 }
3663 else
3664 item=arg;
3665
3666 if (! NILP (item))
3667 {
3668 if (FLOATP (item))
3669 {
3670 alpha = XFLOAT_DATA (item);
3671 if (alpha < 0.0 || 1.0 < alpha)
3672 args_out_of_range (make_float (0.0), make_float (1.0));
3673 }
3674 else if (INTEGERP (item))
3675 {
3676 ialpha = XINT (item);
3677 if (ialpha < 0 || 100 < ialpha)
3678 args_out_of_range (make_number (0), make_number (100));
3679 else
3680 alpha = ialpha / 100.0;
3681 }
3682 else
3683 wrong_type_argument (Qnumberp, item);
3684 }
3685 newval[i] = alpha;
3686 }
3687
3688 for (i = 0; i < 2; i++)
3689 f->alpha[i] = newval[i];
3690
3691#ifdef HAVE_X_WINDOWS
3692 BLOCK_INPUT;
3693 x_set_frame_alpha (f);
3694 UNBLOCK_INPUT;
3695#endif
3696
3697 return;
3698}
3699
3639 3700
3640/* Subroutines of creating an X frame. */ 3701/* Subroutines of creating an X frame. */
3641 3702
@@ -4405,6 +4466,13 @@ Setting this variable permanently is not a reasonable thing to do,
4405but binding this variable locally around a call to `x-get-resource' 4466but binding this variable locally around a call to `x-get-resource'
4406is a reasonable practice. See also the variable `x-resource-name'. */); 4467is a reasonable practice. See also the variable `x-resource-name'. */);
4407 Vx_resource_class = build_string (EMACS_CLASS); 4468 Vx_resource_class = build_string (EMACS_CLASS);
4469
4470 DEFVAR_LISP ("frame-alpha-lower-limit", &Vframe_alpha_lower_limit,
4471 doc: /* The lower limit of the frame opacity (alpha transparency).
4472The value should range from 0 (invisible) to 100 (completely opaque).
4473You can also use a floating number between 0.0 and 1.0.
4474The default is 20. */);
4475 Vframe_alpha_lower_limit = make_number (20);
4408#endif 4476#endif
4409 4477
4410 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist, 4478 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,