From b4b3a43917e0110bfd7f41ca971c91f84f7a9161 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Sun, 7 Jul 2002 07:38:41 +0000
Subject: [PATCH] Fix a bug when window title was < 0

(Old svn revision: 10432)
---
 src/frame.c  | 11 ++++++++++-
 src/pixmap.c |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/frame.c b/src/frame.c
index 02eed147a..b1ffe8893 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -170,6 +170,15 @@ static void frameCreateTitlePixmap(Client * c, int state, int left, int right, M
     }
 
     width = frameWidth(c) - corners[CORNER_TOP_LEFT][ACTIVE].width - corners[CORNER_TOP_RIGHT][ACTIVE].width;
+    if (width < 1)
+    {
+        pm->pixmap = None;
+	pm->mask = None;
+	pm->width = 0;
+	pm->height = 0;
+        return;
+    }
+    
     if(left < corners[CORNER_TOP_LEFT][ACTIVE].width)
     {
         left = corners[CORNER_TOP_LEFT][ACTIVE].width;
@@ -251,7 +260,7 @@ static void frameCreateTitlePixmap(Client * c, int state, int left, int right, M
     gc = gdk_gc_new(gpixmap);
     gdk_gc_get_values(title_colors[state].gc, &values);
     gdk_gc_set_values(gc, &values, GDK_GC_FOREGROUND);
-
+    
     if(w1 > 0)
     {
         fillRectangle(dpy, pm->pixmap, title[TITLE_1][state].pixmap, 0, 0, w1, frameTop(c));
diff --git a/src/pixmap.c b/src/pixmap.c
index bd64559b7..4a44708cc 100644
--- a/src/pixmap.c
+++ b/src/pixmap.c
@@ -65,8 +65,10 @@ gboolean loadPixmap(Display * dpy, MyPixmap * pm, gchar * dir, gchar * file, Xpm
 
 void createPixmap(Display * dpy, MyPixmap * pm, gint width, gint height)
 {
+    DBG("entering createPixmap, width=%i, height=%i\n", width, height);
     if ((width < 1) || (height < 1))
     {
+        DBG("Pixmap size invalid\n");
 	pm->pixmap = None;
 	pm->mask = None;
         pm->width = 0;
-- 
GitLab