Commit 34555574 authored by Bernhard Landauer's avatar Bernhard Landauer
Browse files

add

parents
From eea280b1f1d9d66c903014fd6703f401eb119a87 Mon Sep 17 00:00:00 2001
Message-Id: <eea280b1f1d9d66c903014fd6703f401eb119a87.1504913100.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Sat, 9 Sep 2017 00:22:13 +0200
Subject: [PATCH] Use OVER operator for drawing text
For opaque text, SOURCE is not any different from OVER. However, when
drawing color glyphs (which consist of RGBA pixels instead of strokes)
SOURCE's handling of alpha is not what we want.
I stumbled across this because cairo 1.15.8 seems to clear the surface
before drawing color emoji if the operator is SOURCE, deleting every-
thing drawn before. Arguably, the area outside the glyph bounds should
not be touched, but even if this is a cairo bug the problem of alpha
within the glyph remains.
---
libi3/font.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libi3/font.c b/libi3/font.c
index 81091ea74a31da11..aef8427b5396c3d8 100644
--- a/libi3/font.c
+++ b/libi3/font.c
@@ -105,7 +105,7 @@ static void draw_text_pango(const char *text, size_t text_len,
pango_layout_set_text(layout, text, text_len);
/* Do the drawing */
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
cairo_set_source_rgb(cr, pango_font_red, pango_font_green, pango_font_blue);
pango_cairo_update_layout(cr, layout);
pango_layout_get_pixel_size(layout, NULL, &height);
# Maintainer: Bernhard Landauer <oberon@manjaro.org>
# Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de>
pkgname=i3-wm
pkgver=4.15
pkgrel=1.1
pkgdesc="An improved dynamic tiling window manager"
url="https://i3wm.org/"
arch=(x86_64)
license=(BSD)
depends=(xcb-util-cursor xcb-util-keysyms xcb-util-wm xcb-util-xrm libev yajl startup-notification
pango libxkbcommon-x11)
makedepends=(bison flex asciidoc xmlto)
optdepends=('dmenu: As menu.'
'i3lock: For locking your screen.'
'i3status: To display systeminformation with a bar.'
'perl: i3-save-tree and i3-dmenu-desktop'
'perl-anyevent-i3: Features like saving the layout.'
'perl-json-xs: Features like saving the layout.')
backup=(etc/i3/config)
groups=(i3)
replaces=(i3 i3bar)
source=("https://i3wm.org/downloads/i3-$pkgver.tar.bz2"{,.asc}
'0001-Use-OVER-operator-for-drawing-text.patch'
'reframe_swallowed_windows.patch::https://github.com/i3/i3/pull/3301/commits/7ac37d8ae463d749c9f5aeb9428ed3523a5a53fb.patch')
sha256sums=('217d524d1fbc85ae346b25f6848d1b7bcd2c23184ec88d29114bf5a621385326'
'SKIP'
'0fb308a0a3e0d592567fd81d3856277dd0670dd0545dadf1e2f3d01e8a335763'
'a57aab196c422b5a4f98f087adf4c911956d8706cfe90431f0457a145d32d358')
validpgpkeys=('424E14D703E7C6D43D9D6F364E7160ED4AC8EE1D') # Michael Stapelberg
prepare() {
mkdir build
cd i3-$pkgver
# https://github.com/i3/i3/pull/2925
patch -Np1 -i ../0001-Use-OVER-operator-for-drawing-text.patch
patch -Np1 -i ../reframe_swallowed_windows.patch
autoreconf -fvi
}
build() {
cd build
../i3-$pkgver/configure --prefix=/usr --sysconfdir=/etc
make
}
package() {
cd build
make DESTDIR="$pkgdir" install
install -Dt "$pkgdir/usr/share/man/man1" -m644 man/*.1
install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 ../i3-$pkgver/LICENSE
}
From 7ac37d8ae463d749c9f5aeb9428ed3523a5a53fb Mon Sep 17 00:00:00 2001
From: Dan Elkouby <streetwalkermc@gmail.com>
Date: Fri, 1 Jun 2018 18:55:35 +0300
Subject: [PATCH] Reframe swallowed windows if depth doesn't match
X will not allow a window with ParentRelative background to be created
or reparented under a window with mismatching color depth.
Deal with this by destroying the container frame and creating a new one
with the right depth upon swallowing.
Defer destruction of the frame window until after the updated tree has
been rendered to avoid some distracting flickering.
Fixes #3297
---
include/x.h | 6 ++++++
src/manage.c | 14 ++++++++++++++
src/x.c | 25 +++++++++++++++++++------
3 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/include/x.h b/include/x.h
index 3e81bc364..8b7664f26 100644
--- a/include/x.h
+++ b/include/x.h
@@ -49,6 +49,12 @@ void x_reinit(Con *con);
*/
void x_con_kill(Con *con);
+/*
+ * Completely reinitializes the container's frame, without destroying the old window.
+ *
+ */
+void x_con_reframe(Con *con);
+
/**
* Returns true if the client supports the given protocol atom (like WM_DELETE_WINDOW)
*
diff --git a/src/manage.c b/src/manage.c
index d591df154..b4d0af959 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -355,8 +355,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
}
}
}
+ xcb_window_t old_frame = XCB_NONE;
if (nc->window != cwindow && nc->window != NULL) {
window_free(nc->window);
+ /* Match frame and window depth. This is needed because X will refuse to reparent a
+ * window whose background is ParentRelative under a window with a different depth. */
+ if (nc->depth != cwindow->depth) {
+ old_frame = nc->frame.id;
+ nc->depth = cwindow->depth;
+ x_con_reframe(nc);
+ }
}
nc->window = cwindow;
x_reinit(nc);
@@ -647,6 +655,12 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
tree_render();
+ /* Destroy the old frame if we had to reframe the container. This needs to be done
+ * after rendering in order to prevent the background from flickering in its place. */
+ if (old_frame != XCB_NONE) {
+ xcb_destroy_window(conn, old_frame);
+ }
+
/* Windows might get managed with the urgency hint already set (Pidgin is
* known to do that), so check for that and handle the hint accordingly.
* This code needs to be in this part of manage_window() because the window
diff --git a/src/x.c b/src/x.c
index 629520d4e..25f341b6e 100644
--- a/src/x.c
+++ b/src/x.c
@@ -249,11 +249,7 @@ void x_move_win(Con *src, Con *dest) {
}
}
-/*
- * Kills the window decoration associated with the given container.
- *
- */
-void x_con_kill(Con *con) {
+static void _x_con_kill(Con *con) {
con_state *state;
if (con->colormap != XCB_NONE) {
@@ -262,7 +258,6 @@ void x_con_kill(Con *con) {
draw_util_surface_free(conn, &(con->frame));
draw_util_surface_free(conn, &(con->frame_buffer));
- xcb_destroy_window(conn, con->frame.id);
xcb_free_pixmap(conn, con->frame_buffer.id);
state = state_for_frame(con->frame.id);
CIRCLEQ_REMOVE(&state_head, state, state);
@@ -275,6 +270,24 @@ void x_con_kill(Con *con) {
focused_id = last_focused = XCB_NONE;
}
+/*
+ * Kills the window decoration associated with the given container.
+ *
+ */
+void x_con_kill(Con *con) {
+ _x_con_kill(con);
+ xcb_destroy_window(conn, con->frame.id);
+}
+
+/*
+ * Completely reinitializes the container's frame, without destroying the old window.
+ *
+ */
+void x_con_reframe(Con *con) {
+ _x_con_kill(con);
+ x_con_init(con);
+}
+
/*
* Returns true if the client supports the given protocol atom (like WM_DELETE_WINDOW)
*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment