emacs-devel
[Top][All Lists]
Advanced

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

Help writing a patch to allow transparent backgrounds?


From: Clément Pit--Claudel
Subject: Help writing a patch to allow transparent backgrounds?
Date: Tue, 9 Feb 2016 10:22:38 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

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: signature.asc
Description: OpenPGP digital signature


reply via email to

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