The current implementation of the license command uses the `s->top`
and `s->left` values, combined with the screen's height and width to
compute the center of the screen to draw on. This is erroneous since
the x and y values of the text being drawn are already relative to the
current screen, causing the text to be rendered off-screen.

Simply removing the top and left values from the computation fixes
this issue and allows the license text to be drawn centered on the
current screen, even in multi-screen setups with differently sized
screens.

Signed-off-by: Antoine Busque <antoinebus...@gmail.com>
---
 src/actions.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index e65ca0c..9279b54 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -3598,8 +3598,8 @@ cmd_license (int interactive UNUSED, struct cmdarg **args 
UNUSED)
     }
 
   /* Offset the text so its in the center. */
-  x = s->left + (s->width - max_width) / 2;
-  y = s->top + (s->height - i * FONT_HEIGHT (s)) / 2;
+  x = (s->width - max_width) / 2;
+  y = (s->height - i * FONT_HEIGHT (s)) / 2;
   if (x < 0) x = 0;
   if (y < 0) y = 0;
 
-- 
2.14.1


_______________________________________________
Ratpoison-devel mailing list
Ratpoison-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel

Reply via email to