unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Håkon Flatval" <hkon20@hotmail.com>
Cc: larsi@gnus.org, emacs-devel@gnu.org
Subject: Re: Support for background transparency
Date: Sun, 28 Nov 2021 09:41:59 +0200	[thread overview]
Message-ID: <83h7bwybeg.fsf@gnu.org> (raw)
In-Reply-To: <PRAP251MB06884841D6DE6564DD518FD5CF649@PRAP251MB0688.EURP251.PROD.OUTLOOK.COM> (message from Håkon Flatval on Sat, 27 Nov 2021 23:01:39 +0000)

> From: Håkon Flatval <hkon20@hotmail.com>
> Date: Sat, 27 Nov 2021 23:01:39 +0000
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> I believe the gui_set_alpha_background​ function in frame.c​ should return some error message
> when the frame does not support 32 bits of depth, but am not sure how to do this best.

Why do we want an error message?  Why not simply do nothing and return
in that case?  Silently doing nothing when the display doesn't support
some feature is perfectly fine, IMO.

> Newbie question: I can't guarantee that this patch works perfectly with all build variations using GDK+Cairo,
> nor in all (desktop) environments where Emacs might be used. How, in general, is Emacs tested before
> release to ensure (most) such edge cases are caught?

We rely on people who track the development code to report any
problems they see.

> I'm currently working on implementing this feature for other XLib-based build configurations too, offline,
> planning to submit another patch for those in the not-so-distant future.

Thanks.

> +  else if (FLOATP (arg))
> +    {
> +      alpha = XFLOAT_DATA(arg);
> +      if (! (0 <= alpha && alpha <= 1.0))
> +	args_out_of_range (make_float(0.0), make_float(1.0));
> +    }
> +  else if (FIXNUMP (arg))
> +    {
> +      EMACS_INT ialpha = XFIXNUM (arg);
> +      if (! (0 <= ialpha && ialpha <= 100))
> +	args_out_of_range (make_fixnum (0), make_fixnum (100));
> +      alpha = ialpha / 100.0;
> +    }

We have XFLOATINT to do both of the above, so you could avoid
repetitions.

Also, instead of signaling an error, how about using clip_to_bounds to
limit the value to the correct range?  Once again, it is perfectly OK
to do that in display-related code, instead of signaling an error.
Moreover, signaling an error could potentially hang Emacs if this
function is called in some context where recovery is not possible.

> +  else
> +    wrong_type_argument (Qnumberp, arg);

IMO, the CHECK_NUMBER test should be up front.

> +  if (alpha != 1.0)
> +    {
> +      // Abort if frame does not support 32-bit color

I don't see any need to abort, see above.

Also, please use C-style comments, /* Like this.  */

> +      gtk_widget_set_visual(wtop, visual);
> +      gtk_widget_set_visual(wfixed, visual);
                             ^^
Our style is to leave one space between the function's name and the
opening parenthesis.

> --- a/src/termhooks.h
> +++ b/src/termhooks.h
> @@ -748,11 +748,13 @@ #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
>                                              const char *name,
>                                              const char *class);
>  \f
> -  /* Image hooks */
> +  /* Window hooks */

I'm not sure this comment replacement is for the better.



  parent reply	other threads:[~2021-11-28  7:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 19:45 Support for background transparency Håkon Flatval
2021-11-04 20:06 ` Eli Zaretskii
2021-11-04 20:17 ` Lars Ingebrigtsen
2021-11-27 23:01   ` Håkon Flatval
2021-11-28  0:35     ` Sv: " arthur miller
2021-11-28 13:32       ` Lars Ingebrigtsen
2021-11-28 16:04         ` Arthur Miller
2021-11-28 20:33           ` Håkon Flatval
2021-11-29  2:56             ` Arthur Miller
2021-11-28  7:41     ` Eli Zaretskii [this message]
2021-11-28  7:47       ` Po Lu
2021-11-28  8:27         ` Eli Zaretskii
2021-12-01 18:54       ` Sv: " Håkon Flatval
2021-12-09 17:13         ` Håkon Flatval
2021-12-10  0:40           ` Lars Ingebrigtsen
2022-01-19 17:26             ` Sv: " Håkon Flatval
2022-01-20  0:52               ` Po Lu
2022-01-20 19:52                 ` Sv: " Håkon Flatval
2022-01-21  0:59                   ` Po Lu
2022-01-23 13:48                     ` Håkon Flatval
2022-01-24  0:11                       ` Po Lu
2022-01-25 17:53                         ` Håkon Flatval
2022-01-26  1:00                           ` Po Lu
2022-01-24 10:22                       ` Po Lu
2022-01-25 19:47                         ` Håkon Flatval
2022-01-25 19:37                           ` Robert Pluim
2022-01-26 18:16                             ` Håkon Flatval
2022-01-26  1:05                           ` Po Lu
2022-01-26 11:11                             ` Robert Pluim
2022-01-26 18:34                             ` Håkon Flatval
2022-01-27  1:00                               ` Po Lu
2022-01-29  0:01                                 ` Håkon Flatval
2022-01-29  1:08                                   ` Po Lu
2022-01-20  9:12               ` Robert Pluim
2022-01-23 21:43                 ` Håkon Flatval
2022-01-24  9:14                   ` Robert Pluim
2022-01-25 20:00                     ` Håkon Flatval
2022-01-25 19:31                       ` Robert Pluim
2022-01-29 10:26                         ` Po Lu
2022-01-29 15:17                           ` Håkon Flatval
2022-01-30  0:53                             ` Po Lu
2021-11-28 13:41     ` Lars Ingebrigtsen
2021-11-28 15:05       ` Sv: " Håkon Flatval
2021-11-28 16:07         ` Gregor Zattler
2021-11-28 16:32         ` Lars Ingebrigtsen
2021-11-28 18:10     ` Jean Louis
2021-11-28 18:44       ` Sv: " Håkon Flatval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h7bwybeg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=hkon20@hotmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).