Bug#280977: gtk2-engines-lighthouseblue: [PATCH] LighthouseBlue theme lacks visible resize grip widget

Dave Ahlswede Dave Ahlswede <mightyquinn@letterboxes.org>, 280977@bugs.debian.org
Fri, 12 Nov 2004 16:44:27 -0500


This is a multi-part MIME message sent by reportbug.

--===============1905817049==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: gtk2-engines-lighthouseblue
Version: 2.8.1-1
Severity: wishlist
Tags: patch

Resize Grip widgets are invisible with the LighthouseBlue engine. This isn't a major usability problem, 
but it frustrating on occasion to try and click a grip when it doesn't exist. Enclosed is a patch that
draws a low-profile, angled rectangle shaped grip that seems to blend in fairly well with the
rest of the theme.


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-ck3
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)

Versions of packages gtk2-engines-lighthouseblue depends on:
ii  libatk1.0-0                 1.8.0-2      The ATK accessibility toolkit
ii  libc6                       2.3.2.ds1-18 GNU C Library: Shared libraries an
ii  libglib2.0-0                2.4.7-1      The GLib library of C routines
ii  libgtk2.0-0                 2.4.13-1da2  The GTK+ graphical user interface 
ii  libpango1.0-0               1.6.0-1      Layout and rendering of internatio

-- no debconf information

--===============1905817049==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="lighthouseblue_resizegrip.patch"

diff -ur gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.c ../gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.c
--- gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.c	2004-08-18 11:15:04 -0400
+++ ../gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.c	2004-11-06 01:57:35 -0500
@@ -1751,9 +1752,24 @@
   parent_class->draw_layout (style, window, state_type, use_text, area, widget, detail, x, y, layout);
 	
 }
+static void make_square(gint * value1, gint * value2) 
+{ 
+  if (*value1 < *value2) 
+    *value2 = *value1;
+}
+
+static void make_square_offset(gint * value1, gint * value2, gint * value3) 
+{ 
+  if (*value1 < *value2) 
+  {
+    *value3 += (*value1 - *value2);
+    *value2 = *value1;
+  }
+}
+   
 
 static void draw_resize_grip (GtkStyle *style,
-							  GdkWindow * indow,
+							  GdkWindow * window,
 							  GtkStateType state_type,
 							  GdkRectangle *area,
 							  GtkWidget *widget,
@@ -1761,7 +1777,233 @@
 							  GdkWindowEdge edge,
 							  gint x, gint y, gint width, gint height)
 {
-	return; /* no resize grip in this theme */
+  g_return_if_fail (GTK_IS_STYLE (style));
+  g_return_if_fail (window != NULL);
+  
+/*  if (widget && GTK_IS_STATUSBAR(widget) && !RESIZE_GRIP(style)) {
+    gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(widget), FALSE);
+    return;
+  }*/
+    
+  if (area)
+    {
+      gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
+      gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
+    }
+  
+  switch (edge)
+    {
+    case GDK_WINDOW_EDGE_WEST:
+    case GDK_WINDOW_EDGE_EAST:
+      {
+	gint xi;
+
+        if (edge==GDK_WINDOW_EDGE_WEST) 
+          make_square(&height, &width); 
+        else 
+          make_square_offset(&height, &width, &x);
+	
+	xi = x;
+
+	while (xi < x + width)
+	  {
+	    gdk_draw_line (window,
+			   style->light_gc[state_type],
+			   xi, y,
+			   xi, y + height -1);
+
+	    xi++;
+	    gdk_draw_line (window,
+			   style->dark_gc[state_type],
+			   xi, y+1,
+			   xi, y + height);
+
+	    xi += 2;
+	  }
+      }
+      break;
+    case GDK_WINDOW_EDGE_NORTH:
+    case GDK_WINDOW_EDGE_SOUTH:
+      {
+	gint yi;
+
+        if (edge==GDK_WINDOW_EDGE_NORTH) 
+          make_square(&width, &height); 
+        else 
+          make_square_offset(&width, &height, &y);
+
+	yi = y;
+
+	while (yi < y + height)
+	  {
+	    gdk_draw_line (window,
+			   style->light_gc[state_type],
+			   x, yi,
+			   x + width-1, yi);
+
+	    yi++;
+	    gdk_draw_line (window,
+			   style->dark_gc[state_type],
+			   x+1, yi,
+			   x + width, yi);
+
+	    yi+= 2;
+	  }
+      }
+      break;
+    case GDK_WINDOW_EDGE_NORTH_WEST:
+      {
+        gint xi, yi, heighti, widthi;
+
+        make_square_offset(&width, &height, &y);
+        make_square_offset(&height, &width, &x);
+				
+					
+				heighti = height / 3;
+				widthi = width / 3;
+
+        xi = x + width;
+        yi = y + height - heighti;
+				
+        while (xi < (x + width - widthi - 3))
+          {
+            gdk_draw_line (window,
+                           style->dark_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti);                           
+
+            --xi;
+            --yi;
+            
+            gdk_draw_line (window,
+                           style->light_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti );
+
+            --xi;
+            --yi;
+          }
+
+	    
+	  
+      }
+      break;
+    case GDK_WINDOW_EDGE_NORTH_EAST:
+      {
+        gint xi, yi, heighti, widthi;
+
+        make_square_offset(&width, &height, &y);
+        make_square_offset(&height, &width, &x);
+				
+					
+				heighti = height / 3;
+				widthi = width / 3;
+
+        xi = x;
+        yi = y + height - heighti;
+				
+        while (xi < (x + width - widthi - 3))
+          {
+            gdk_draw_line (window,
+                           style->dark_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti);                           
+
+            ++xi;
+            --yi;
+            
+            gdk_draw_line (window,
+                           style->light_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti );
+
+            ++xi;
+            --yi;
+          }
+
+      }
+      break;
+    case GDK_WINDOW_EDGE_SOUTH_WEST:
+      {
+        gint xi, yi, heighti, widthi;
+
+        make_square_offset(&width, &height, &y);
+        make_square_offset(&height, &width, &x);
+				
+					
+				heighti = height / 3;
+				widthi = width / 3;
+
+        xi = x + width;
+        yi = y + heighti;
+				
+        while (xi < (x + width - widthi - 3))
+          {
+            gdk_draw_line (window,
+                           style->dark_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti);                           
+
+            --xi;
+            ++yi;
+            
+            gdk_draw_line (window,
+                           style->light_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti );
+
+            --xi;
+            ++yi;
+          }
+
+      }
+      break;
+    case GDK_WINDOW_EDGE_SOUTH_EAST:
+      {
+        gint xi, yi, heighti, widthi;
+
+        make_square_offset(&width, &height, &y);
+        make_square_offset(&height, &width, &x);
+				
+					
+				heighti = height / 3;
+				widthi = width / 3;
+
+        xi = x;
+        yi = y + heighti;
+				
+        while (xi < (x + width - widthi - 3))
+          {
+            gdk_draw_line (window,
+                           style->dark_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti);                           
+
+            ++xi;
+            ++yi;
+            
+            gdk_draw_line (window,
+                           style->light_gc[state_type],
+                           xi, yi,
+                           xi + widthi , yi - heighti );
+
+            ++xi;
+						++yi;
+          }
+      }
+      break;
+    default:
+      return;
+      break;
+    }
+  
+  if (area)
+    {
+      gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
+      gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
+    }
 }
 					
 
diff -ur gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.h ../gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.h
--- gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.h	2003-01-16 22:32:01 -0500
+++ ../gnome-themes-2.8.1/gtk-themes/LightHouseBlue/src/lighthouseblue_style.h	2004-11-05 22:26:45 -0500
@@ -16,6 +16,8 @@
 #define LIGHTHOUSEBLUE_IS_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), LIGHTHOUSEBLUE_TYPE_STYLE))
 #define LIGHTHOUSEBLUE_IS_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTHOUSEBLUE_TYPE_STYLE))
 #define LIGHTHOUSEBLUE_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTHOUSEBLUE_TYPE_STYLE, LighthouseBlueStyleClass))
+#define THEME_DATA(style)                 (LIGHTHOUSEBLUE_STYLE (style->rc_style))
+#define RESIZE_GRIP(style)(THEME_DATA(style)->resize_grip)
 
 struct _LighthouseBlueStyle
 {

--===============1905817049==--