diff options
author | Matthias Clasen <mclasen@fedoraproject.org> | 2006-08-25 02:51:35 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@fedoraproject.org> | 2006-08-25 02:51:35 +0000 |
commit | fa969513774fbea0d1cc79590084235ac1ed1db7 (patch) | |
tree | 0c20836202015fab32409227962ce512631e1e30 | |
parent | cf6b16d61a18392dbd129b335599277744fccaf8 (diff) | |
download | gnome-applets-fa969513774fbea0d1cc79590084235ac1ed1db7.tar.gz gnome-applets-fa969513774fbea0d1cc79590084235ac1ed1db7.tar.xz gnome-applets-fa969513774fbea0d1cc79590084235ac1ed1db7.zip |
improve keyboard drawing
-rw-r--r-- | gnome-applets.spec | 18 | ||||
-rw-r--r-- | keyboard-drawing-corner.patch | 142 | ||||
-rw-r--r-- | keyboard-drawing-label-color.patch | 25 | ||||
-rw-r--r-- | keyboard-drawing-primary.patch | 54 | ||||
-rw-r--r-- | keyboard-drawing-rotated-text.patch | 54 |
5 files changed, 292 insertions, 1 deletions
diff --git a/gnome-applets.spec b/gnome-applets.spec index 86c086e..a8d9414 100644 --- a/gnome-applets.spec +++ b/gnome-applets.spec @@ -32,7 +32,7 @@ Summary: Small applications for the GNOME panel Name: gnome-applets Version: 2.15.90 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 License: GPL Group: User Interface/Desktops @@ -44,6 +44,12 @@ Patch3: gnome-applets-2.3.6-ppp-command.patch Patch4: gnome-applets-2.15.1.1-cpufreq.patch Patch11: gnome-applets-2.15.1.1-dont-require-display.patch +Patch15: keyboard-drawing-focus.patch +Patch16: keyboard-drawing-rotated-text.patch +Patch17: keyboard-drawing-label-color.patch +Patch18: keyboard-drawing-primary.patch +Patch19: keyboard-drawing-corner.patch + URL: http://www.gnome.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -122,6 +128,13 @@ small utilities for the GNOME panel. %patch4 -p1 -b .cpufreq %patch11 -p1 -b .dont-require-display +%patch15 -p1 -b .focus +%patch16 -p1 -b .rotated-text +%patch17 -p1 -b .label-color +%patch18 -p1 -b .primary +%patch19 -p1 -b .corner + + cp gswitchit/gswitchit-applet.png gswitchit/gswitchit-properties-capplet.png # We don't ship gnome-system-tools @@ -288,6 +301,9 @@ fi %{_libdir}/pkgconfig/gweather.pc %changelog +* Thu Aug 24 2006 Matthias Clasen <mclasen@redhat.com> - 1:2.15.90-2.fc6 +- Various improvements for the keyboard applet + * Tue Aug 22 2006 Matthias Clasen <mclasen@redhat.com> - 1:2.15.90-1.fc6 - Update to 2.15.90 - Drop upstreamed patches diff --git a/keyboard-drawing-corner.patch b/keyboard-drawing-corner.patch new file mode 100644 index 0000000..9dde14d --- /dev/null +++ b/keyboard-drawing-corner.patch @@ -0,0 +1,142 @@ +--- 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 = >K_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 + { diff --git a/keyboard-drawing-label-color.patch b/keyboard-drawing-label-color.patch new file mode 100644 index 0000000..0eabfee --- /dev/null +++ b/keyboard-drawing-label-color.patch @@ -0,0 +1,25 @@ +--- 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 diff --git a/keyboard-drawing-primary.patch b/keyboard-drawing-primary.patch new file mode 100644 index 0000000..ecec1c8 --- /dev/null +++ b/keyboard-drawing-primary.patch @@ -0,0 +1,54 @@ +--- 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 diff --git a/keyboard-drawing-rotated-text.patch b/keyboard-drawing-rotated-text.patch new file mode 100644 index 0000000..0676458 --- /dev/null +++ b/keyboard-drawing-rotated-text.patch @@ -0,0 +1,54 @@ +--- 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); |