Created
August 10, 2010 07:36
-
-
Save thwarted/516859 to your computer and use it in GitHub Desktop.
simplistic screen swap-x patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur screen-4.0.3/display.c screen-4.0.3-swap-x/display.c | |
--- screen-4.0.3/display.c 2003-12-05 05:45:41.000000000 -0800 | |
+++ screen-4.0.3-swap-x/display.c 2010-08-09 23:59:07.465303854 -0700 | |
@@ -33,6 +33,8 @@ | |
#include "extern.h" | |
#include "braille.h" | |
+int swap_x = 1; | |
+ | |
static int CountChars __P((int)); | |
static int DoAddChar __P((int)); | |
static int BlankResize __P((int, int)); | |
@@ -1197,7 +1199,7 @@ | |
void | |
-GotoPos(x2, y2) | |
+RealGotoPos(x2, y2) | |
int x2, y2; | |
{ | |
register int dy, dx, x1, y1; | |
@@ -1396,6 +1398,16 @@ | |
} | |
void | |
+GotoPos(x2, y2) | |
+int x2, y2; | |
+{ | |
+ if (swap_x) | |
+ x2 = D_width - x2 - 1; | |
+ return RealGotoPos(x2, y2); | |
+} | |
+ | |
+ | |
+void | |
ClearAll() | |
{ | |
ASSERT(display); | |
@@ -1452,14 +1464,14 @@ | |
*/ | |
if (D_CD && (y1 < y2 || !D_CE)) | |
{ | |
- GotoPos(x1, y1); | |
+ RealGotoPos(x1, y1); | |
AddCStr(D_CD); | |
return; | |
} | |
} | |
if (x1 == 0 && xs == 0 && (xe == D_width - 1 || y1 == y2) && y1 == 0 && D_CCD && (!bce || D_BE)) | |
{ | |
- GotoPos(x1, y1); | |
+ RealGotoPos(x1, y1); | |
AddCStr(D_CCD); | |
return; | |
} | |
@@ -1470,13 +1482,13 @@ | |
xxe = x2; | |
if (x1 == 0 && D_CB && (xxe != D_width - 1 || (D_x == xxe && D_y == y)) && (!bce || D_BE)) | |
{ | |
- GotoPos(xxe, y); | |
+ RealGotoPos(xxe, y); | |
AddCStr(D_CB); | |
continue; | |
} | |
if (xxe == D_width - 1 && D_CE && (!bce || D_BE)) | |
{ | |
- GotoPos(x1, y); | |
+ RealGotoPos(x1, y); | |
AddCStr(D_CE); | |
continue; | |
} | |
@@ -2278,7 +2290,7 @@ | |
{ | |
D_status = STATUS_ON_WIN; | |
debug1("using STATLINE %d\n", STATLINE); | |
- GotoPos(0, STATLINE); | |
+ RealGotoPos(0, STATLINE); | |
SetRendition(&mchar_so); | |
InsertMode(0); | |
AddStr(msg); | |
@@ -2420,7 +2432,7 @@ | |
l = strlen(str); | |
if (l > D_width) | |
l = D_width; | |
- GotoPos(0, D_height - 1); | |
+ RealGotoPos(0, D_height - 1); | |
SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? &mchar_null: &mchar_so); | |
if (!PutWinMsg(str, 0, l)) | |
for (i = 0; i < l; i++) | |
@@ -2431,7 +2443,7 @@ | |
if (l < D_width) | |
ClearArea(l, D_height - 1, l, D_width - 1, D_width - 1, D_height - 1, 0, 0); | |
if (ox != -1 && oy != -1) | |
- GotoPos(ox, oy); | |
+ RealGotoPos(ox, oy); | |
D_hstatus = *str ? 1 : 0; | |
SetRendition(&mchar_null); | |
} | |
diff -ur screen-4.0.3/display.h screen-4.0.3-swap-x/display.h | |
--- screen-4.0.3/display.h 2003-07-01 07:01:42.000000000 -0700 | |
+++ screen-4.0.3-swap-x/display.h 2010-08-09 23:12:39.664303465 -0700 | |
@@ -343,3 +343,5 @@ | |
#define HSTATUS_MESSAGE 2 | |
#define HSTATUS_HS 3 | |
#define HSTATUS_ALWAYS (1<<2) | |
+ | |
+extern int swap_x; | |
diff -ur screen-4.0.3/pty.c screen-4.0.3-swap-x/pty.c | |
--- screen-4.0.3/pty.c 2003-09-08 07:26:18.000000000 -0700 | |
+++ screen-4.0.3-swap-x/pty.c 2010-08-09 21:46:45.970972000 -0700 | |
@@ -35,7 +35,7 @@ | |
/* for solaris 2.1, Unixware (SVR4.2) and possibly others */ | |
#ifdef HAVE_SVR4_PTYS | |
-# include <sys/stropts.h> | |
+/* # include <sys/stropts.h> */ | |
#endif | |
#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) | |
diff -ur screen-4.0.3/screen.c screen-4.0.3-swap-x/screen.c | |
--- screen-4.0.3/screen.c 2003-09-08 07:26:41.000000000 -0700 | |
+++ screen-4.0.3-swap-x/screen.c 2010-08-09 23:28:35.402303972 -0700 | |
@@ -135,6 +135,7 @@ | |
static struct passwd *getpwbyname __P((char *, struct passwd *)); | |
static void SigChldHandler __P((void)); | |
static sigret_t SigChld __P(SIGPROTOARG); | |
+static sigret_t SigPwr __P(SIGPROTOARG); | |
static sigret_t SigInt __P(SIGPROTOARG); | |
static sigret_t CoreDump __P(SIGPROTOARG); | |
static sigret_t FinitHandler __P(SIGPROTOARG); | |
@@ -1291,6 +1292,7 @@ | |
MakeNewEnv(); | |
signal(SIGHUP, SigHup); | |
signal(SIGINT, FinitHandler); | |
+ signal(SIGPWR, SigPwr); | |
signal(SIGQUIT, FinitHandler); | |
signal(SIGTERM, FinitHandler); | |
#ifdef BSDJOBS | |
@@ -1450,6 +1452,14 @@ | |
SIGRETURN; | |
} | |
+static sigret_t | |
+SigPwr SIGDEFARG | |
+{ | |
+ swap_x = !swap_x; | |
+ signal(SIGPWR, SigPwr); | |
+ SIGRETURN; | |
+} | |
+ | |
/* | |
* the backend's Interrupt handler | |
* we cannot insert the intrc directly, as we never know |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment