[libslab/gnome-3] more work trying to unwind selection rendering



commit dc39ce253e1e6f8abfaee801bdfa92e366e44b1a
Author: Michael Meeks <michael meeks suse com>
Date:   Wed Oct 5 11:06:53 2011 +0100

    more work trying to unwind selection rendering

 libslab/app-resizer.c  |   13 +++++++++++--
 libslab/slab-section.c |   24 +++++++++++++-----------
 2 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index 4451387..1a28b2b 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -250,10 +250,9 @@ app_resizer_draw (GtkWidget * widget, cairo_t *cr)
 	printf("Allocation:%d, %d, %d, %d\n\n", widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height);
 	*/
 
-	GTK_WIDGET_CLASS (app_resizer_parent_class)->draw (widget, cr);
-
 	g_warning ("TESTME: do I render the selected group nicely !?");
 
+#if 0
 	if (app_data->selected_group)
 	{
 		GdkRGBA rgba;
@@ -267,11 +266,21 @@ app_resizer_draw (GtkWidget * widget, cairo_t *cr)
 		/* set the correct source color */
 		context = gtk_widget_get_style_context (widget);
 		gtk_style_context_get_color (context, GTK_STATE_SELECTED, &rgba);
+		rgba.alpha = 0.2;
 		gdk_cairo_set_source_rgba (cr, &rgba);
 
+		cairo_save (cr);
+
+//		gtk_cairo_transform_to_window (cr, widget, gtk_widget_get_window (widget));
 		cairo_rectangle (cr, selected_allocation.x, selected_allocation.y,
 				 allocation.width, selected_allocation.height);
+		cairo_fill (cr);
+
+		cairo_restore (cr);
 	}
+#endif
+
+	GTK_WIDGET_CLASS (app_resizer_parent_class)->draw (widget, cr);
 
 	return FALSE;
 }
diff --git a/libslab/slab-section.c b/libslab/slab-section.c
index a3b4e98..5e44ed5 100644
--- a/libslab/slab-section.c
+++ b/libslab/slab-section.c
@@ -28,11 +28,7 @@ slab_section_set_selected (SlabSection * section, gboolean selected)
 	if (selected == section->selected)
 		return;
 	section->selected = selected;
-	gtk_widget_queue_draw (GTK_WIDGET (section));
-
-	g_warning ("TESTME: side-bar / section title_color %d", selected);
-	gtk_widget_set_state (section->title,
-			      selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL);
+	gtk_widget_set_sensitive (section->title, selected);
 }
 
 GtkWidget *
@@ -71,6 +67,7 @@ slab_section_new_with_markup (const gchar * title_markup, SlabStyle style)
 	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (section->childbox));
 
 	section->title = gtk_label_new (title_markup);
+	gtk_widget_set_sensitive (section->title, FALSE);
 	gtk_label_set_use_markup (GTK_LABEL (section->title), TRUE);
 	gtk_misc_set_alignment (GTK_MISC (section->title), 0.0, 0.5);
 
@@ -118,27 +115,32 @@ slab_section_draw (GtkWidget *widget, cairo_t *cr)
 {
 	SlabSection *section = SLAB_SECTION (widget);
 
-	GTK_WIDGET_CLASS (slab_section_parent_class)->draw (widget, cr);
-
-	g_warning ("TESTME: slab section draw - not so hot !");
+#if 1
 	if (section->selected)
 	{
 		GdkRGBA rgba;
 		GtkAllocation allocation;
 		GtkStyleContext *context;
 
-		g_warning ("TESTME: render slab section selected");
-
 		gtk_widget_get_allocation (widget, &allocation);
 
 		/* set the correct source color */
 		context = gtk_widget_get_style_context (widget);
 		gtk_style_context_get_color (context, GTK_STATE_SELECTED, &rgba);
+		rgba.alpha = 0.2;
 		gdk_cairo_set_source_rgba (cr, &rgba);
 
+		g_warning ("TESTME: render slab section selected %d %d %d %d",
+			   allocation.x, allocation.y,
+			   allocation.width * 2, allocation.height);
+
 		cairo_rectangle (cr, allocation.x, allocation.y,
-				 allocation.width, allocation.height);
+				 allocation.width * 2, allocation.height);
+		cairo_fill (cr);
 	}
+#endif
+
+	GTK_WIDGET_CLASS (slab_section_parent_class)->draw (widget, cr);
 
 	return FALSE;
 }



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