bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#1328: 23.0.60; Alpha handling messes with window manager's work [pat


From: Michal Nazarewicz
Subject: bug#1328: 23.0.60; Alpha handling messes with window manager's work [patch]
Date: Tue, 11 Nov 2008 16:31:20 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0 (Slckware Linux)

Window manager I'm using has an option of setting window's opacity
depending on focus.  The recent addition of 'alpha' frame parameter
seems to mess with what window manager is trying to do (ie. I'm ending
up with emacs frame fully opaque even though window manager tried to
set the opacity to (say) 50%).

Instead of setting matching options in Emacs and my window manager
I've decided to disable Emacs' alpha handling altogether, however, was
unable to find appropriate option, which made me do the patch included
at the end of the message.

It consist of two changes: (i) x_set_alpha changes frame's alpha to -1
if frame's parameter is nil and (ii) x_set_frame_alpha does nothing if
alpha is negative.  This way, by default Emacs does not change frame's
opacity but only does so if explicitly told to do so.

The patch was tested on Linux.

-----<cut here>---------------------------------------------------------
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7105
diff -c -F '^[_a-zA-Z0-9$]+ *(' -r1.7105 ChangeLog
*** src/ChangeLog       11 Nov 2008 08:41:18 -0000      1.7105
--- src/ChangeLog       11 Nov 2008 15:10:34 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2008-11-11  Michal Nazarewicz  <mina86@tlen.pl>
+
+       * frame.c (x_set_alpha): Set alpha to -1 if nil given.
+       * frame.h: Negative alpha means "don't touch".
+       * w32term.c (x_set_frame_alpha): Do nothing if alpha is negative
+       * xterm.c (x_set_frame_alpha): Do nothing if alpha is negative
+
  2008-11-10  Kenichi Handa  <handa@m17n.org>

        * character.c (Fget_byte): Fix and make it faster for unibyte
Index: src/frame.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/frame.c,v
retrieving revision 1.397
diff -c -F '^[_a-zA-Z0-9$]+ *(' -r1.397 frame.c
*** src/frame.c 2 Nov 2008 10:38:42 -0000       1.397
--- src/frame.c 11 Nov 2008 15:10:39 -0000
*************** x_set_alpha (f, arg, oldval)
*** 3673,3678 ****
--- 3673,3680 ----
            else
              wrong_type_argument (Qnumberp, item);
          }
+       else
+         alpha = -1.0;
        newval[i] = alpha;
      }

Index: src/frame.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/frame.h,v
retrieving revision 1.144
diff -c -F '^[_a-zA-Z0-9$]+ *(' -r1.144 frame.h
*** src/frame.h 19 Sep 2008 00:35:43 -0000      1.144
--- src/frame.h 11 Nov 2008 15:10:44 -0000
***************
*** 482,488 ****

    /* frame opacity
       alpha[0]: alpha transparency of the active frame
!      alpha[1]: alpha transparency of inactive frames   */
    double alpha[2];

    /* Exponent for gamma correction of colors.  1/(VIEWING_GAMMA *
--- 482,489 ----

    /* frame opacity
       alpha[0]: alpha transparency of the active frame
!      alpha[1]: alpha transparency of inactive frames
!      negative value means not to set alpha */
    double alpha[2];

    /* Exponent for gamma correction of colors.  1/(VIEWING_GAMMA *
Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.308
diff -c -F '^[_a-zA-Z0-9$]+ *(' -r1.308 w32term.c
*** src/w32term.c       27 Oct 2008 22:20:27 -0000      1.308
--- src/w32term.c       11 Nov 2008 15:10:48 -0000
*************** x_set_frame_alpha (f)
*** 439,445 ****
    else if (INTEGERP (Vframe_alpha_lower_limit))
      alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;

!   if (alpha < 0.0 || 1.0 < alpha)
      alpha = 1.0;
    else if (alpha < alpha_min && alpha_min <= 1.0)
      alpha = alpha_min;
--- 439,447 ----
    else if (INTEGERP (Vframe_alpha_lower_limit))
      alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;

!   if (alpha < 0.0)
!     return;
!   if (1.0 < alpha)
      alpha = 1.0;
    else if (alpha < alpha_min && alpha_min <= 1.0)
      alpha = alpha_min;
Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.1011
diff -c -F '^[_a-zA-Z0-9$]+ *(' -r1.1011 xterm.c
*** src/xterm.c 6 Nov 2008 03:49:17 -0000       1.1011
--- src/xterm.c 11 Nov 2008 15:10:58 -0000
*************** x_set_frame_alpha (f)
*** 487,493 ****
    else if (INTEGERP (Vframe_alpha_lower_limit))
      alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;

!   if (alpha < 0.0 || 1.0 < alpha)
      alpha = 1.0;
    else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
      alpha = alpha_min;
--- 487,495 ----
    else if (INTEGERP (Vframe_alpha_lower_limit))
      alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;

!   if (alpha < 0.0)
!     return;
!   if (1.0 < alpha)
      alpha = 1.0;
    else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
      alpha = alpha_min;
-----<cut here>---------------------------------------------------------

--
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--






reply via email to

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