]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktextlayout.c
GtkBubbleWindow: Use style border color to stroke the bubble shape
[~andy/gtk] / gtk / gtktextlayout.c
index d3baf1944ffe11b8450502858933564b9a29f42d..73be6b417c94260929d831b5883ece633c28fae4 100644 (file)
@@ -23,8 +23,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.Free
  *
  * Original Tk license:
  *
@@ -257,6 +256,8 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
                   G_TYPE_INT,
                   G_TYPE_INT,
                   G_TYPE_INT);
+  g_signal_set_va_marshaller (signals[CHANGED], G_TYPE_FROM_CLASS (klass),
+                              _gtk_marshal_VOID__INT_INT_INTv);
 
   signals[ALLOCATE_CHILD] =
     g_signal_new (I_("allocate-child"),
@@ -1845,12 +1846,13 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
 }
 
 static void
-convert_color (GdkColor       *result,
+convert_color (GdkRGBA        *result,
               PangoAttrColor *attr)
 {
-  result->red = attr->color.red;
-  result->blue = attr->color.blue;
-  result->green = attr->color.green;
+  result->red = attr->color.red / 65535.;
+  result->blue = attr->color.blue / 65535.;
+  result->green = attr->color.green / 65535.;
+  result->alpha = 1;
 }
 
 /* This function is used to convert the preedit string attributes, which are
@@ -1890,14 +1892,21 @@ add_preedit_attrs (GtkTextLayout     *layout,
       while (tmp_list)
        {
          PangoAttribute *attr = tmp_list->data;
+         GdkRGBA rgba;
          
          switch (attr->klass->type)
            {
            case PANGO_ATTR_FOREGROUND:
-             convert_color (&appearance.fg_color, (PangoAttrColor *)attr);
+             convert_color (&rgba, (PangoAttrColor *)attr);
+             if (appearance.rgba[1])
+               gdk_rgba_free (appearance.rgba[1]);
+             appearance.rgba[1] = gdk_rgba_copy (&rgba);
              break;
            case PANGO_ATTR_BACKGROUND:
-             convert_color (&appearance.bg_color, (PangoAttrColor *)attr);
+             convert_color (&rgba, (PangoAttrColor *)attr);
+             if (appearance.rgba[0])
+               gdk_rgba_free (appearance.rgba[0]);
+             appearance.rgba[0] = gdk_rgba_copy (&rgba);
              appearance.draw_bg = TRUE;
              break;
            case PANGO_ATTR_UNDERLINE:
@@ -2143,7 +2152,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
 
   DV (g_print ("creating one line display cache (%s)\n", G_STRLOC));
 
-  display = g_new0 (GtkTextLineDisplay, 1);
+  display = g_slice_new0 (GtkTextLineDisplay);
 
   display->size_only = size_only;
   display->line = line;
@@ -2486,7 +2495,7 @@ gtk_text_layout_free_line_display (GtkTextLayout      *layout,
       if (display->pg_bg_rgba)
         gdk_rgba_free (display->pg_bg_rgba);
 
-      g_free (display);
+      g_slice_free (GtkTextLineDisplay, display);
     }
 }