rpms/control-center/devel keyboard-drawing-corner.patch, NONE, 1.1 keyboard-drawing-focus.patch, NONE, 1.1 keyboard-drawing-label-color.patch, NONE, 1.1 keyboard-drawing-primary.patch, NONE, 1.1 keyboard-drawing-rotated-text.patch, NONE, 1.1 control-center.spec, 1.176, 1.177

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Aug 25 02:17:33 UTC 2006


Author: mclasen

Update of /cvs/dist/rpms/control-center/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv27297

Modified Files:
	control-center.spec 
Added Files:
	keyboard-drawing-corner.patch keyboard-drawing-focus.patch 
	keyboard-drawing-label-color.patch 
	keyboard-drawing-primary.patch 
	keyboard-drawing-rotated-text.patch 
Log Message:
improve the keyboard capplet


keyboard-drawing-corner.patch:
 keyboard-drawing.c |   85 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 69 insertions(+), 16 deletions(-)

--- NEW FILE keyboard-drawing-corner.patch ---
--- control-center-2.15.92/libkbdraw/keyboard-drawing.c.corner	2006-08-24 22:08:59.000000000 -0400
+++ control-center-2.15.92/libkbdraw/keyboard-drawing.c	2006-08-24 22:13:07.000000000 -0400
@@ -121,6 +121,61 @@
     g_object_unref (gc);
 }
 
+static void
+curve_rectangle (cairo_t *cr,
+		 gdouble  x0,
+		 gdouble  y0,
+		 gdouble  width,
+		 gdouble  height,
+		 gdouble  radius)
+{
+  gdouble x1, y1;
+  
+  if (!width || !height)
+    return;
+
+  x1 = x0 + width;
+  y1 = y0 + height;
+
+  radius = MIN(radius, MIN(width / 2, height / 2));
+
+  cairo_move_to (cr, x0, y0 + radius);
+  cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, 3*M_PI/2);  
+  cairo_line_to (cr, x1 - radius, y0);
+  cairo_arc (cr, x1 - radius, y0 + radius, radius, 3*M_PI/2, 2*M_PI);  
+  cairo_line_to (cr, x1, y1 - radius);
+  cairo_arc (cr, x1 - radius, y1 - radius, radius, 0, M_PI/2);  
+  cairo_line_to (cr, x0 + radius, y1);
+  cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI/2, M_PI);  
+
+  cairo_close_path (cr);  
+}
+
+static void
+draw_curve_rectangle (GdkPixmap *pixmap,
+		      gboolean   filled,
+		      GdkColor  *fill_color,
+		      gint       x,
+		      gint       y,
+		      gint       width,
+		      gint       height,
+		      gint       radius)
+{
+  cairo_t *cr;
+
+  cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
+  curve_rectangle (cr, x, y, width, height, radius);
+
+  gdk_cairo_set_source_color (cr, fill_color);
+  
+  if (filled)
+    cairo_fill (cr);
+  else
+    cairo_stroke (cr);
+  
+  cairo_destroy (cr);
+}
+
 /* x, y, width, height are in the xkb coordinate system */
 static void
 draw_rectangle (
@@ -130,7 +185,8 @@
   gint xkb_x,
   gint xkb_y,
   gint xkb_width,
-  gint xkb_height)
+  gint xkb_height,
+  gint radius)
 {
   if (drawing->pixmap == NULL)
     return;
@@ -140,17 +196,12 @@
       GtkStateType state = GTK_WIDGET_STATE (GTK_WIDGET (drawing));
       gint x, y, width, height;
       gboolean filled;
-      GdkGC *gc;
 
       if (fill_color)
-        {
-          gc = gdk_gc_new (GTK_WIDGET (drawing)->window);
-          gdk_gc_set_rgb_fg_color (gc, fill_color);
-          filled = TRUE;
-        }
+	filled = TRUE;
       else
         {
-          gc = GTK_WIDGET (drawing)->style->dark_gc[state];
+          fill_color = &GTK_WIDGET (drawing)->style->dark[state];
           filled = FALSE;
         }
 
@@ -159,10 +210,8 @@
       width = xkb_to_pixmap_coord (drawing, xkb_x + xkb_width) - x;
       height = xkb_to_pixmap_coord (drawing, xkb_y + xkb_height) - y;
 
-      gdk_draw_rectangle (drawing->pixmap, gc, filled, x, y, width, height);
-
-      if (fill_color)
-        g_object_unref (gc);
+      draw_curve_rectangle (drawing->pixmap, filled, fill_color, 
+			    x, y, width, height, radius);
     }
   else
     {
@@ -203,7 +252,8 @@
     {
       if (color)
         draw_rectangle (drawing, color, angle, origin_x, origin_y,
-                        outline->points[0].x, outline->points[0].y);
+                        outline->points[0].x, outline->points[0].y,
+			outline->corner_radius);
 
 #ifdef KBDRAW_DEBUG
       printf("points:%p\n", outline->points);
@@ -211,7 +261,8 @@
 #endif
 
       draw_rectangle (drawing, NULL, angle, origin_x, origin_y,
-                      outline->points[0].x, outline->points[0].y);
+                      outline->points[0].x, outline->points[0].y,
+		      outline->corner_radius);
     }
   else if (outline->num_points == 2)
     {
@@ -223,10 +274,12 @@
                          angle, &rotated_x0, &rotated_y0);
       if (color)
         draw_rectangle (drawing, color, angle, rotated_x0, rotated_y0,
-                        outline->points[1].x, outline->points[1].y);
+                        outline->points[1].x, outline->points[1].y,
+			outline->corner_radius);
 
       draw_rectangle (drawing, NULL, angle, rotated_x0, rotated_y0,
-                      outline->points[1].x, outline->points[1].y);
+                      outline->points[1].x, outline->points[1].y,
+		      outline->corner_radius);
     }
   else
     {

keyboard-drawing-focus.patch:
 keyboard-drawing.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

--- NEW FILE keyboard-drawing-focus.patch ---
--- control-center-2.15.92/libkbdraw/keyboard-drawing.c.old	2006-08-24 21:47:21.000000000 -0400
+++ control-center-2.15.92/libkbdraw/keyboard-drawing.c	2006-08-24 21:47:24.000000000 -0400
@@ -1073,12 +1153,12 @@
     {
       g_signal_emit (drawing, keyboard_drawing_signals[BAD_KEYCODE], 0,
                      event->hardware_keycode);
-      return FALSE;
+      return TRUE;
     }
 
   if ((event->type == GDK_KEY_PRESS && key->pressed) ||
       (event->type == GDK_KEY_RELEASE && !key->pressed))
-    return FALSE;
+    return TRUE;
   /* otherwise this event changes the state we believed we had before */
 
   key->pressed = (event->type == GDK_KEY_PRESS);
@@ -1087,7 +1167,7 @@
 
   invalidate_key_region (drawing, key);
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint

keyboard-drawing-label-color.patch:
 keyboard-drawing.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

--- NEW FILE keyboard-drawing-label-color.patch ---
--- control-center-2.15.92/libkbdraw/keyboard-drawing.c.label-color	2006-08-24 22:01:50.000000000 -0400
+++ control-center-2.15.92/libkbdraw/keyboard-drawing.c	2006-08-24 22:02:40.000000000 -0400
@@ -541,6 +541,9 @@
   PangoLayout * layout)
 {
   GtkStateType state = GTK_WIDGET_STATE (GTK_WIDGET (drawing));
+  GdkColor *color;
+  
+  color = drawing->colors + (drawing->xkb->geom->label_color - drawing->xkb->geom->colors);
 
   if (drawing->pixmap == NULL)
     return;
@@ -554,9 +557,9 @@
       drawing->angle = angle;
     }
 
-  gdk_draw_layout (drawing->pixmap,
-                   GTK_WIDGET (drawing)->style->text_gc[state], x, y,
-                   drawing->layout);
+  gdk_draw_layout_with_colors (drawing->pixmap,
+			       GTK_WIDGET (drawing)->style->text_gc[state], x, y,
+			       drawing->layout, color, NULL);
 }
 
 static void

keyboard-drawing-primary.patch:
 keyboard-drawing.c |   37 +++++++++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 6 deletions(-)

--- NEW FILE keyboard-drawing-primary.patch ---
--- control-center-2.15.92/libkbdraw/keyboard-drawing.c.primary	2006-08-24 22:04:09.000000000 -0400
+++ control-center-2.15.92/libkbdraw/keyboard-drawing.c	2006-08-24 22:07:38.000000000 -0400
@@ -719,9 +719,22 @@
   printf ("outlines: %p(%d)\n", shape->outlines, shape->num_outlines);
 #endif
 
-  for (i = 0; i < 1 /* shape->num_outlines */ ; i++)
-    draw_outline (drawing, shape->outlines + i, color, key->angle,
-                  key->origin_x, key->origin_y);
+  /* draw the primary outline */
+  draw_outline (drawing, shape->primary ? shape->primary : shape->outlines, 
+		color, key->angle, key->origin_x, key->origin_y);
+#if 0
+  /* don't draw other outlines for now, since
+   * the text placement does not take them into account 
+   */
+  for (i = 0; i < shape->num_outlines; i++)
+    {
+      if (shape->outlines + i == shape->approx ||
+	  shape->outlines + i == shape->primary)
+	continue;
+      draw_outline (drawing, shape->outlines + i, NULL, 
+		    key->angle, key->origin_x, key->origin_y);
+    }
+#endif
 
   draw_key_label (drawing, key->keycode, key->angle, key->origin_x,
                   key->origin_y, shape->bounds.x2, shape->bounds.y2);
@@ -850,10 +863,22 @@
   shape = drawing->xkb->geom->shapes + shape_doodad->shape_ndx;
   color = drawing->colors + shape_doodad->color_ndx;
 
+  /* draw the primary outline filled */
+  draw_outline (drawing, shape->primary ? shape->primary : shape->outlines, 
+		color, doodad->angle,
+		doodad->origin_x + shape_doodad->left,
+		doodad->origin_y + shape_doodad->top);
+
+  /* stroke the other outlines */
   for (i = 0; i < shape->num_outlines; i++)
-    draw_outline (drawing, shape->outlines + i, color, doodad->angle,
-                  doodad->origin_x + shape_doodad->left,
-                  doodad->origin_y + shape_doodad->top);
+    {
+      if (shape->outlines + i == shape->approx ||
+	  shape->outlines + i == shape->primary) 
+	continue;
+      draw_outline (drawing, shape->outlines + i, NULL, doodad->angle,
+		    doodad->origin_x + shape_doodad->left,
+		    doodad->origin_y + shape_doodad->top);
+    }
 }
 
 static void

keyboard-drawing-rotated-text.patch:
 keyboard-drawing.c |   38 --------------------------------------
 1 files changed, 38 deletions(-)

--- NEW FILE keyboard-drawing-rotated-text.patch ---
--- control-center-2.15.92/libkbdraw/keyboard-drawing.c.rotated-text	2006-08-24 21:59:45.000000000 -0400
+++ control-center-2.15.92/libkbdraw/keyboard-drawing.c	2006-08-24 22:01:21.000000000 -0400
@@ -541,9 +541,6 @@
   PangoLayout * layout)
 {
   GtkStateType state = GTK_WIDGET_STATE (GTK_WIDGET (drawing));
-  PangoLayoutLine *line;
-  gint x_off, y_off;
-  gint i;
 
   if (drawing->pixmap == NULL)
     return;
@@ -557,41 +554,6 @@
       drawing->angle = angle;
     }
 
-  i = 0;
-  y_off = 0;
-  for (line = pango_layout_get_line (drawing->layout, i);
-       line != NULL; line = pango_layout_get_line (drawing->layout, ++i))
-    {
-      GSList *runp;
-      PangoRectangle line_extents;
-
-      x_off = 0;
-
-      for (runp = line->runs; runp != NULL; runp = runp->next)
-        {
-          PangoGlyphItem *run = runp->data;
-          gint j;
-
-          for (j = 0; j < run->glyphs->num_glyphs; j++)
-            {
-              PangoGlyphGeometry *geometry;
-              gint xx, yy;
-
-              geometry = &run->glyphs->glyphs[j].geometry;
-
-              rotate_coordinate (0, 0, x_off, y_off, angle, &xx, &yy);
-              geometry->x_offset -= x_off - xx;
-              geometry->y_offset -= y_off - yy;
-
-              x_off += geometry->width;
-            }
-        }
-
-      pango_layout_line_get_extents (line, NULL, &line_extents);
-      y_off +=
-        line_extents.height + pango_layout_get_spacing (drawing->layout);
-    }
-
   gdk_draw_layout (drawing->pixmap,
                    GTK_WIDGET (drawing)->style->text_gc[state], x, y,
                    drawing->layout);


Index: control-center.spec
===================================================================
RCS file: /cvs/dist/rpms/control-center/devel/control-center.spec,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- control-center.spec	25 Aug 2006 00:42:16 -0000	1.176
+++ control-center.spec	25 Aug 2006 02:17:30 -0000	1.177
@@ -21,7 +21,7 @@
 Summary: GNOME Control Center
 Name: control-center
 Version: 2.15.92
-Release: 2%{?dist}
+Release: 3%{?dist}
 Epoch: 1
 License: GPL/LGPL
 Group: User Interface/Desktops
@@ -42,6 +42,12 @@
 Patch13: control-center-2.15.91-compiz-support.patch
 Patch14: control-center-2.15.92-fix-media-keys.patch
 
+Patch14: keyboard-drawing-focus.patch
+Patch15: keyboard-drawing-rotated-text.patch
+Patch16: keyboard-drawing-label-color.patch
+Patch17: keyboard-drawing-primary.patch
+Patch18: keyboard-drawing-corner.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 URL: http://www.gnome.org
 
@@ -140,6 +146,12 @@
 %patch13 -p1 -b .compiz-support
 %patch14 -p1 -b .fix-media-keys
 
+%patch14 -p1 -b .focus
+%patch15 -p1 -b .rotated-text
+%patch16 -p1 -b .label-color
+%patch17 -p1 -b .primary
+%patch18 -p1 -b .corner
+
 %build
 
 autoreconf
@@ -276,6 +288,9 @@
 %{_libdir}/pkgconfig/*
 
 %changelog
+* Thu Aug 24 2006 Matthias Clasen <mclasen at redhat.com> - 2.15.92-3.fc6
+- Various improvements for the keyboard capplet
+
 * Thu Aug 24 2006 Ray Strode <rstrode at redhat.com> - 2.15.92-2.fc6
 - don't try to map user defined key shortcuts to keysyms
   (bug 201176)




More information about the fedora-cvs-commits mailing list