From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Support for background transparency Date: Sun, 28 Nov 2021 09:41:59 +0200 Message-ID: <83h7bwybeg.fsf@gnu.org> References: <87wnlnptf2.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1749"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org To: =?utf-8?Q?H=C3=A5kon?= Flatval Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 28 08:42:48 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mrEpi-0000KO-V4 for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 08:42:47 +0100 Original-Received: from localhost ([::1]:48762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrEph-0006kc-I9 for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 02:42:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrEoq-00064N-3f for emacs-devel@gnu.org; Sun, 28 Nov 2021 02:41:52 -0500 Original-Received: from [2001:470:142:3::e] (port=54774 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrEop-0004sP-NA; Sun, 28 Nov 2021 02:41:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=row73isyBAqu/SVl7INTZK1vq0ayCORT4pqD+luw+Ks=; b=IiCGpyypzYWItcyRo5+L /5BDWfObP94rrGxfWB0tG+fuSIvcjLmwTSx9ejbCLO5/mRyBSVmPrDIlRDbGUWe6gJcClvHZxkRJS jdVTfR3a11iFkbSHUF2crXBtT8H9wo2df8u0FbShP0oyuRHA2iYIlHfjEfo5N59kvBAPkfmA7u5+c N/i6wW9D279xYbcIJXgS5ZdK6TNZs1ezyv12zrAsN33uhrsQ7DHbQeqoGIcycK/mNk0Q5dvmUUHgI Fv0Rphoe6cpRRmHu1l95ZGMneXb/j4Dn7f0jeBmCA+w6og09msXgYzrJj/yN5qCoKiBndrKx/jgbf A760Dyz7W02Y4w==; Original-Received: from [87.69.77.57] (port=4964 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrEoo-0003dd-NV; Sun, 28 Nov 2021 02:41:51 -0500 In-Reply-To: (message from =?utf-8?Q?H=C3=A5kon?= Flatval on Sat, 27 Nov 2021 23:01:39 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280376 Archived-At: > From: Håkon Flatval > Date: Sat, 27 Nov 2021 23:01:39 +0000 > Cc: "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); > > - /* Image hooks */ > + /* Window hooks */ I'm not sure this comment replacement is for the better.