File: win-man-compatible.patch

package info (click to toggle)
efte 1.1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,904 kB
  • sloc: cpp: 43,587; ansic: 1,228; makefile: 271; objc: 92; sh: 40
file content (27 lines) | stat: -rw-r--r-- 862 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Ismael Luceno <ismael@iodev.co.uk>
Date: Fri, 29 Jul 2022 22:15:12 +0200
Subject: [PATCH] con_x11: Make compatible with tiling window managers

Tiling window managers can force the window size to be larger than
supported, causing either an early abort at ConSetSize, or if compiled
with NDEBUG, a segmentation fault down the road.

Instead, just cap X and Y to their maximums. The only consequence is that
the window is not fully utilised.
---
 src/con_x11.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/src/con_x11.cpp
+++ b/src/con_x11.cpp
@@ -897,8 +897,8 @@
     int i;
     int MX, MY;
 
-    assert(X <= ConMaxCols);
-    assert(Y <= ConMaxRows);
+    if (X > ConMaxCols) X = ConMaxCols;
+    if (Y > ConMaxRows) Y = ConMaxRows;
 
     p = NewBuffer = (unsigned char *) malloc(X * Y * 2);
     if (NewBuffer == NULL) return -1;