ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] [PATCH] Fix: draw the license text centered on multi-screen setup


From: Antoine Busque
Subject: [RP] [PATCH] Fix: draw the license text centered on multi-screen setup
Date: Thu, 21 Sep 2017 20:21:24 -0400

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]