[gnome-themes-standard] grip: turn resize grip rendering into a SVG asset



commit ae0c665fd81a799331e7f19484f92aed1d1e3a00
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jan 24 10:11:30 2012 -0500

    grip: turn resize grip rendering into a SVG asset
    
    Instead of drawing it ourselves manually with cairo.

 src/adwaita_engine.c                          |   71 +--------------
 themes/Adwaita/gtk-3.0/assets/Makefile.am     |    1 +
 themes/Adwaita/gtk-3.0/assets/resize-grip.svg |  117 +++++++++++++++++++++++++
 themes/Adwaita/gtk-3.0/gtk-widgets-assets.css |    9 ++
 themes/Adwaita/gtk-3.0/gtk-widgets.css        |    4 -
 5 files changed, 131 insertions(+), 71 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index cd3d5f6..b75453a 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -615,73 +615,10 @@ adwaita_engine_render_handle (GtkThemingEngine *engine,
 {
   if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_GRIP))
     {
-      GdkRGBA bg;
-      GtkJunctionSides sides;
-      GtkStateFlags state;
-      int lx, ly;
-      int x_down;
-      int y_down;
-      int dots;
-
-      state = gtk_theming_engine_get_state (engine);
-      gtk_theming_engine_get_background_color (engine, state, &bg);
-
-      /* The number of dots fitting into the area. Just hardcoded to 3 right now. */
-      /* dots = MIN (width - 2, height - 2) / 3; */
-      dots = 3;
-
-      cairo_save (cr);
-
-      sides = gtk_theming_engine_get_junction_sides (engine);
-
-      switch (sides)
-        {
-        case GTK_JUNCTION_CORNER_TOPRIGHT:
-          x_down = 0;
-          y_down = 0;
-          cairo_translate (cr, x + width - 4*dots, y + 1);
-          break;
-        case GTK_JUNCTION_CORNER_BOTTOMRIGHT:
-          x_down = 0;
-          y_down = 1;
-          cairo_translate (cr, x + width - 4*dots, y + height + 1 - 4*dots);
-          break;
-        case GTK_JUNCTION_CORNER_BOTTOMLEFT:
-          x_down = 1;
-          y_down = 1;
-          cairo_translate (cr, x + 2, y + height + 1 - 4*dots);
-          break;
-        case GTK_JUNCTION_CORNER_TOPLEFT:
-          x_down = 1;
-          y_down = 0;
-          cairo_translate (cr, x + 2, y + 1);
-          break;
-        default:
-          /* Not implemented. */
-          cairo_restore (cr);
-          return;
-        }
-
-      for (lx = 0; lx < dots; lx++) /* horizontally */
-        {
-          for (ly = 0; ly <= lx; ly++) /* vertically */
-            {
-              int mx, my;
-              mx = x_down * dots + (1 - x_down * 2) * lx - x_down;
-              my = y_down * dots + (1 - y_down * 2) * ly - y_down;
-
-              gdk_cairo_set_source_rgba (cr, &bg);
-              cairo_arc (cr,
-                         mx * 4 - 1 + 1.5,
-                         my * 4 - 1 + 1.5,
-                         1.5,
-                         0, G_PI * 2.0);
-
-              cairo_fill (cr);
-            }
-        }
-
-      cairo_restore (cr);
+      GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_background
+        (engine, cr, x, y, width, height);
+      GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_frame
+        (engine, cr, x, y, width, height);
     }
   else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PANE_SEPARATOR))
     {
diff --git a/themes/Adwaita/gtk-3.0/assets/Makefile.am b/themes/Adwaita/gtk-3.0/assets/Makefile.am
index e571bb4..36ce464 100644
--- a/themes/Adwaita/gtk-3.0/assets/Makefile.am
+++ b/themes/Adwaita/gtk-3.0/assets/Makefile.am
@@ -52,6 +52,7 @@ assets_DATA = 		\
 	radio-menuitem-checked-selected.svg \
 	radio-menuitem-mixed.svg \
 	radio-menuitem-mixed-insensitive.svg \
+	resize-grip.svg \
 	scale-slider-horizontal.svg \
 	scale-slider-horizontal-unfocused.svg \
 	scale-slider-horizontal-dark.svg \
diff --git a/themes/Adwaita/gtk-3.0/assets/resize-grip.svg b/themes/Adwaita/gtk-3.0/assets/resize-grip.svg
new file mode 100644
index 0000000..fa1f587
--- /dev/null
+++ b/themes/Adwaita/gtk-3.0/assets/resize-grip.svg
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="13"
+   height="13"
+   id="svg17653"
+   version="1.1"
+   inkscape:version="0.48.2 r9819"
+   sodipodi:docname="resize-grip.svg">
+  <defs
+     id="defs17655" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="21.311078"
+     inkscape:cx="-8.2186936"
+     inkscape:cy="8.0008486"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:grid-bbox="true"
+     inkscape:document-units="px"
+     inkscape:window-width="1920"
+     inkscape:window-height="1022"
+     inkscape:window-x="0"
+     inkscape:window-y="26"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata17658">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     transform="translate(0,-3)">
+    <path
+       transform="matrix(0.65777374,0,0,0.65777374,-560.57081,-392.19484)"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       sodipodi:ry="1.9003495"
+       sodipodi:rx="1.9003495"
+       sodipodi:cy="617.14966"
+       sodipodi:cx="868.63647"
+       id="path5513"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       sodipodi:type="arc" />
+    <path
+       sodipodi:type="arc"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       id="path5515"
+       sodipodi:cx="868.63647"
+       sodipodi:cy="617.14966"
+       sodipodi:rx="1.9003495"
+       sodipodi:ry="1.9003495"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       transform="matrix(0.65777374,0,0,0.65777374,-563.84354,-392.19484)" />
+    <path
+       sodipodi:type="arc"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       id="path5517"
+       sodipodi:cx="868.63647"
+       sodipodi:cy="617.14966"
+       sodipodi:rx="1.9003495"
+       sodipodi:ry="1.9003495"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       transform="matrix(0.65777374,0,0,0.65777374,-560.57081,-395.46756)" />
+    <path
+       transform="matrix(0.65777374,0,0,0.65777374,-560.57081,-398.74029)"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       sodipodi:ry="1.9003495"
+       sodipodi:rx="1.9003495"
+       sodipodi:cy="617.14966"
+       sodipodi:cx="868.63647"
+       id="path5519"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       sodipodi:type="arc" />
+    <path
+       transform="matrix(0.65777374,0,0,0.65777374,-567.11626,-392.19484)"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       sodipodi:ry="1.9003495"
+       sodipodi:rx="1.9003495"
+       sodipodi:cy="617.14966"
+       sodipodi:cx="868.63647"
+       id="path5521"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       sodipodi:type="arc" />
+    <path
+       transform="matrix(0.65777374,0,0,0.65777374,-563.84354,-395.46756)"
+       d="m 870.53682,617.14966 a 1.9003495,1.9003495 0 1 1 -3.80069,0 1.9003495,1.9003495 0 1 1 3.80069,0 z"
+       sodipodi:ry="1.9003495"
+       sodipodi:rx="1.9003495"
+       sodipodi:cy="617.14966"
+       sodipodi:cx="868.63647"
+       id="path5523"
+       style="fill:#b9beb3;fill-opacity:1;stroke:none;display:inline;enable-background:new"
+       sodipodi:type="arc" />
+  </g>
+</svg>
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets-assets.css b/themes/Adwaita/gtk-3.0/gtk-widgets-assets.css
index 0551d0f..d7b4a62 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets-assets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets-assets.css
@@ -1,3 +1,12 @@
+/***************
+ * Resize grip *
+ ***************/
+
+.grip {
+    background-color: transparent;
+    background-image: url("assets/resize-grip.svg");
+}
+
 /*************************
  * Check and Radio items *
  *************************/
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets.css b/themes/Adwaita/gtk-3.0/gtk-widgets.css
index 5e75456..698e90e 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets.css
@@ -121,10 +121,6 @@ GtkWindow:backdrop {
 /*****************
  * Miscellaneous *
  *****************/
-.grip {
-    background-color: shade (@inactive_frame_color, 0.93);
-}
-
 .view.rubberband,
 .rubberband {
     background-color: alpha (@theme_selected_bg_color, 0.35);



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