[st] Include the latest upstream features (XDBE)
Petr Šabata
psabata at fedoraproject.org
Mon Aug 6 13:44:00 UTC 2012
commit ff2eb118c9abf0a6527bc1a1da5dbf48a704a27b
Author: Petr Šabata <contyk at redhat.com>
Date: Mon Aug 6 15:42:13 2012 +0200
Include the latest upstream features (XDBE)
st-0.2.1-shell.patch | 21 +++++++
st-0.2.1-xdbe-border.patch | 63 ++++++++++++++++++++
st-0.2.1-xdbe.patch | 140 ++++++++++++++++++++++++++++++++++++++++++++
st.spec | 14 ++++-
4 files changed, 237 insertions(+), 1 deletions(-)
---
diff --git a/st-0.2.1-shell.patch b/st-0.2.1-shell.patch
new file mode 100644
index 0000000..3aabbae
--- /dev/null
+++ b/st-0.2.1-shell.patch
@@ -0,0 +1,21 @@
+
+# HG changeset patch
+# User Aurélien Aptel <aurelien.aptel at gmail.com>
+# Date 1329416686 -3600
+# Node ID 9692c9452e2c29d19c6cf68b2cdcabe11c20b58b
+# Parent ad255bf6ccf2d31c6d447d52f4da9181642a6fe7
+use SHELL as default shell.
+
+diff -r ad255bf6ccf2 -r 9692c9452e2c st.c
+--- a/st.c Thu Feb 16 01:06:45 2012 +0100
++++ b/st.c Thu Feb 16 19:24:46 2012 +0100
+@@ -709,7 +709,7 @@
+ char **args;
+ char *envshell = getenv("SHELL");
+
+- DEFAULT(envshell, "sh");
++ DEFAULT(envshell, SHELL);
+ putenv("TERM="TNAME);
+ args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL};
+ execvp(args[0], args);
+
diff --git a/st-0.2.1-xdbe-border.patch b/st-0.2.1-xdbe-border.patch
new file mode 100644
index 0000000..e4fb853
--- /dev/null
+++ b/st-0.2.1-xdbe-border.patch
@@ -0,0 +1,63 @@
+
+# HG changeset patch
+# User Brandon Invergo <brandon at invergo.net>
+# Date 1343998000 -7200
+# Node ID 9ff727a4b890713396b8dcdcf6c1e0905c5d4115
+# Parent dcba87365e02f4a5b81445e2ae99b29bf68bb9ba
+apply post-XDBE patch BORDER fix
+
+diff -r dcba87365e02 -r 9ff727a4b890 st.c
+--- a/st.c Sat Jul 28 14:27:26 2012 +0200
++++ b/st.c Fri Aug 03 14:46:40 2012 +0200
+@@ -186,8 +186,6 @@
+ int scr;
+ int w; /* window width */
+ int h; /* window height */
+- int bufw; /* pixmap width */
+- int bufh; /* pixmap height */
+ int ch; /* char height */
+ int cw; /* char width */
+ char state; /* focus, redraw, visible */
+@@ -1621,8 +1619,8 @@
+
+ void
+ xresize(int col, int row) {
+- xw.bufw = MAX(1, col * xw.cw);
+- xw.bufh = MAX(1, row * xw.ch);
++ xw.w = MAX(1, 2*BORDER + col * xw.cw);
++ xw.h = MAX(1, 2*BORDER + row * xw.ch);
+ }
+
+ void
+@@ -1671,7 +1669,7 @@
+ xclear(int x1, int y1, int x2, int y2) {
+ XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE) ? DefaultFG : DefaultBG]);
+ XFillRectangle(xw.dpy, xw.buf, dc.gc,
+- x1 * xw.cw, y1 * xw.ch,
++ BORDER + x1 * xw.cw, BORDER + y1 * xw.ch,
+ (x2-x1+1) * xw.cw, (y2-y1+1) * xw.ch);
+ }
+
+@@ -1757,10 +1755,8 @@
+ xloadcols();
+
+ /* window - default size */
+- xw.bufh = term.row * xw.ch;
+- xw.bufw = term.col * xw.cw;
+- xw.h = xw.bufh + 2*BORDER;
+- xw.w = xw.bufw + 2*BORDER;
++ xw.h = 2*BORDER + term.row * xw.ch;
++ xw.w = 2*BORDER + term.col * xw.cw;
+
+ attrs.background_pixel = dc.col[DefaultBG];
+ attrs.border_pixel = dc.col[DefaultBG];
+@@ -1807,7 +1803,7 @@
+ void
+ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
+ int fg = base.fg, bg = base.bg, temp;
+- int winx = x*xw.cw, winy = y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
++ int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
+ XFontSet fontset = dc.font.set;
+ int i;
+
+
diff --git a/st-0.2.1-xdbe.patch b/st-0.2.1-xdbe.patch
new file mode 100644
index 0000000..cc0caf2
--- /dev/null
+++ b/st-0.2.1-xdbe.patch
@@ -0,0 +1,140 @@
+
+# HG changeset patch
+# User Brandon Invergo <brandon at invergo.net>
+# Date 1343478446 -7200
+# Node ID dcba87365e02f4a5b81445e2ae99b29bf68bb9ba
+# Parent e1414acbe5471ce59723cffa3688a3010832fd75
+Implement Xdbe-based double-buffering
+
+diff -r e1414acbe547 -r dcba87365e02 config.mk
+--- a/config.mk Mon Feb 27 12:48:13 2012 +0100
++++ b/config.mk Sat Jul 28 14:27:26 2012 +0200
+@@ -12,7 +12,7 @@
+
+ # includes and libs
+ INCS = -I. -I/usr/include -I${X11INC}
+-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil
++LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil -lXext
+
+ # flags
+ CPPFLAGS = -DVERSION=\"${VERSION}\"
+diff -r e1414acbe547 -r dcba87365e02 st.c
+--- a/st.c Mon Feb 27 12:48:13 2012 +0100
++++ b/st.c Sat Jul 28 14:27:26 2012 +0200
+@@ -24,6 +24,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/cursorfont.h>
+ #include <X11/keysym.h>
++#include <X11/extensions/Xdbe.h>
+
+ #if defined(__linux)
+ #include <pty.h>
+@@ -178,7 +179,7 @@
+ Display* dpy;
+ Colormap cmap;
+ Window win;
+- Pixmap buf;
++ XdbeBackBuffer buf;
+ Atom xembed;
+ XIM xim;
+ XIC xic;
+@@ -270,7 +271,7 @@
+ static void xdraws(char *, Glyph, int, int, int, int);
+ static void xhints(void);
+ static void xclear(int, int, int, int);
+-static void xcopy(int, int, int, int);
++static void xcopy();
+ static void xdrawcursor(void);
+ static void xinit(void);
+ static void xloadcols(void);
+@@ -1620,32 +1621,8 @@
+
+ void
+ xresize(int col, int row) {
+- Pixmap newbuf;
+- int oldw, oldh;
+-
+- oldw = xw.bufw;
+- oldh = xw.bufh;
+ xw.bufw = MAX(1, col * xw.cw);
+ xw.bufh = MAX(1, row * xw.ch);
+- newbuf = XCreatePixmap(xw.dpy, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dpy, xw.scr));
+- XCopyArea(xw.dpy, xw.buf, newbuf, dc.gc, 0, 0, xw.bufw, xw.bufh, 0, 0);
+- XFreePixmap(xw.dpy, xw.buf);
+- XSetForeground(xw.dpy, dc.gc, dc.col[DefaultBG]);
+- if(xw.bufw > oldw)
+- XFillRectangle(xw.dpy, newbuf, dc.gc, oldw, 0,
+- xw.bufw-oldw, MIN(xw.bufh, oldh));
+- else if(xw.bufw < oldw && (BORDER > 0 || xw.w > xw.bufw))
+- XClearArea(xw.dpy, xw.win, BORDER+xw.bufw, BORDER,
+- xw.w-xw.bufh-BORDER, BORDER+MIN(xw.bufh, oldh),
+- False);
+- if(xw.bufh > oldh)
+- XFillRectangle(xw.dpy, newbuf, dc.gc, 0, oldh,
+- xw.bufw, xw.bufh-oldh);
+- else if(xw.bufh < oldh && (BORDER > 0 || xw.h > xw.bufh))
+- XClearArea(xw.dpy, xw.win, BORDER, BORDER+xw.bufh,
+- xw.w-2*BORDER, xw.h-xw.bufh-BORDER,
+- False);
+- xw.buf = newbuf;
+ }
+
+ void
+@@ -1801,7 +1778,7 @@
+ CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
+ | CWColormap,
+ &attrs);
+- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dpy, xw.scr));
++ xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied);
+
+
+ /* input methods */
+@@ -1871,10 +1848,10 @@
+
+ /* copy buffer pixmap to screen pixmap */
+ void
+-xcopy(int x, int y, int cols, int rows) {
+- int src_x = x*xw.cw, src_y = y*xw.ch, src_w = cols*xw.cw, src_h = rows*xw.ch;
+- int dst_x = BORDER+src_x, dst_y = BORDER+src_y;
+- XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, src_x, src_y, src_w, src_h, dst_x, dst_y);
++xcopy() {
++ XdbeSwapInfo swpinfo[1] = {{xw.win, XdbeCopied}};
++ XdbeSwapBuffers(xw.dpy, swpinfo, 1);
++
+ }
+
+ void
+@@ -1918,6 +1895,7 @@
+ void
+ draw() {
+ drawregion(0, 0, term.col, term.row);
++ xcopy();
+ gettimeofday(&xw.lastdraw, NULL);
+ }
+
+@@ -1959,7 +1937,6 @@
+ }
+ if(ib > 0)
+ xdraws(buf, base, ox, y, ic, ib);
+- xcopy(0, y, term.col, 1);
+ }
+ xdrawcursor();
+ }
+@@ -1968,13 +1945,10 @@
+ expose(XEvent *ev) {
+ XExposeEvent *e = &ev->xexpose;
+ if(xw.state & WIN_REDRAW) {
+- if(!e->count) {
++ if(!e->count)
+ xw.state &= ~WIN_REDRAW;
+- xcopy(0, 0, term.col, term.row);
+- }
+- } else
+- XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, e->x-BORDER, e->y-BORDER,
+- e->width, e->height, e->x, e->y);
++ }
++ xcopy();
+ }
+
+ void
+
diff --git a/st.spec b/st.spec
index 43d3fc7..dcafb68 100644
--- a/st.spec
+++ b/st.spec
@@ -1,6 +1,6 @@
Name: st
Version: 0.2.1
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: A simple terminal implementation for X
Group: User Interface/X
License: BSD
@@ -11,7 +11,13 @@ Source1: %{name}.desktop
Patch0: st-0.1.1-debug.patch
# Make sure we use an unicode capable font
Patch1: st-0.2.1-terminus.patch
+# Utilize SHELL
+Patch2: st-0.2.1-shell.patch
+# XDBE
+Patch3: st-0.2.1-xdbe.patch
+Patch4: st-0.2.1-xdbe-border.patch
BuildRequires: libX11-devel
+BuildRequires: libXext-devel
BuildRequires: ncurses
BuildRequires: desktop-file-utils
Requires: terminus-fonts
@@ -26,6 +32,9 @@ A simple virtual terminal emulator for X which sucks less.
%setup -q
%patch0 -p1 -b .debug
%patch1 -p1 -b .terminus
+%patch2 -p1 -b .shell
+%patch3 -p1 -b .xdbe
+%patch4 -p1 -b .xdbe-border
# Do not install terminfo
sed -i '/@tic -s st.info/d' Makefile
@@ -44,6 +53,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%{_datadir}/applications
%changelog
+* Mon Aug 06 2012 Petr Šabata <contyk at redhat.com> - 0.2.1-5
+- Include the latest upstream features
+
* Fri Jul 27 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
More information about the scm-commits
mailing list