all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Help writing a patch to allow transparent backgrounds?
Date: Tue, 9 Feb 2016 10:22:38 -0500	[thread overview]
Message-ID: <56BA043E.1050305@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2023 bytes --]

Hi all,

The only way to get transparency at the moment seems to be with the 'alpha frame parameter. Unfortunately this makes the whole frame transparent, instead of just the background. I'd like to make Emacs only draw text to the screen, without painting a background. I'm on Linux with Gtk3.

I expect that this would require changing the way the background is painted, and changing the way faces are drawn to not add a solid background.

There are examples online:
  * Two StackOverflow questions:
    * https://stackoverflow.com/questions/16832581/how-to-make-a-gtkwindow-background-transparent-on-linux
    * https://stackoverflow.com/questions/22940588/how-do-i-really-make-a-gtk-3-gtklayout-transparent-draw-theme-background
  * A patch to implement this feature in Nemo:
    * https://lists.fedoraproject.org/pipermail/scm-commits/Week-of-Mon-20131230/1165217.html
  * Another patch:
    * https://github.com/IgnorantGuru/spacefm/commit/5e4e148a2e1cf962fdf7dbc776d8d09ad110dbd7
    * https://github.com/IgnorantGuru/spacefm/issues/269

It's not clear to me how to apply the ideas from these pages. I tried two sets of modifications:

* In gtkutil.c (xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel)), changing
    bg.alpha = 1.0;
  to
    bg.alpha = 0.0;
* In xterm.c (x_set_cr_source_with_gc_background (struct frame *f, GC gc)), changing
    cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0,
                          color.green / 65535.0, color.blue / 65535.0);
  to
    cairo_set_source_rgba (FRAME_CR_CONTEXT (f), color.red / 65535.0,
                           color.green / 65535.0, color.blue / 65535.0, 0.0);
  and compiling with --with-cairo

Both of these changes had the same effect: the background isn't redrawn anymore. The contents of the desktop (behind the Emacs frame) are captured when the frame is created, but never updated after that; instead, whatever gets painted there remains there.

Thanks for the help!
Clément.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2016-02-09 15:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 15:22 Clément Pit--Claudel [this message]
2016-02-10 18:35 ` Help writing a patch to allow transparent backgrounds? Eli Zaretskii
2016-02-10 18:46   ` Clément Pit--Claudel
2016-02-10 19:23     ` Eli Zaretskii
2016-02-10 19:36       ` Clément Pit--Claudel
2016-02-13 13:51         ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=56BA043E.1050305@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=emacs-devel@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.