marlin r1316 - trunk/marlin



Author: iain
Date: Sat Oct 18 14:05:01 2008
New Revision: 1316
URL: http://svn.gnome.org/viewvc/marlin?rev=1316&view=rev

Log:
Revert NO-WINDOW changes


Modified:
   trunk/marlin/marlin-level-ruler.c

Modified: trunk/marlin/marlin-level-ruler.c
==============================================================================
--- trunk/marlin/marlin-level-ruler.c	(original)
+++ trunk/marlin/marlin-level-ruler.c	Sat Oct 18 14:05:01 2008
@@ -208,6 +208,37 @@
   	req->width = widget->style->xthickness * 2 + PANGO_PIXELS (width) + 7;
 }
 
+static void
+realize (GtkWidget *widget)
+{
+	GdkWindowAttr attributes;
+	int attributes_mask;
+
+	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+	attributes.window_type = GDK_WINDOW_CHILD;
+	attributes.x = widget->allocation.x;
+	attributes.y = widget->allocation.y;
+	attributes.width = widget->allocation.width;
+	attributes.height = widget->allocation.height;
+	attributes.wclass = GDK_INPUT_OUTPUT;
+	attributes.visual = gtk_widget_get_visual (widget);
+	attributes.colormap = gtk_widget_get_colormap (widget);
+	attributes.event_mask = gtk_widget_get_events (widget);
+	attributes.event_mask |= (GDK_EXPOSURE_MASK |
+				  GDK_BUTTON_PRESS_MASK |
+				  GDK_BUTTON_RELEASE_MASK |
+				  GDK_POINTER_MOTION_MASK);
+
+	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+	widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+					 &attributes, attributes_mask);
+	gdk_window_set_user_data (widget->window, widget);
+
+	widget->style = gtk_style_attach (widget->style, widget->window);
+	gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
+}
+
 #define YPOS(v) chan_area.y + chan_height - ((((v) - ruler->priv->vmin) * chan_height) / (ruler->priv->vmax - ruler->priv->vmin))
 
 static void
@@ -227,15 +258,13 @@
 	quart = (int) (chan_height / 4);
 	half = quart * 2;
 
-	chan_area.x = widget->allocation.x;
-	chan_area.y = widget->allocation.y + (chan_height * channel_num) + channel_num;
+	chan_area.x = 0;
+	chan_area.y = (chan_height * channel_num) + channel_num;
 	chan_area.width = widget->allocation.width;
 	chan_area.height = chan_height;
 
-	gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type],
-				   &chan_area);
-	gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type],
-				   &chan_area);
+	gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], &chan_area);
+	gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type], &chan_area);
 
 	yv = YPOS (0.0) + priv->base_offset;
 	gdk_draw_line (widget->window,
@@ -259,8 +288,8 @@
 	yv = YPOS (0.5) + priv->base_offset;
 	gdk_draw_line (widget->window,
 		       widget->style->dark_gc[state_type],
-		       area->x + (area->width - 5), area->y + yv,
-		       area->x + area->width, area->y + yv);
+		       area->x + (area->width - 5), yv,
+		       area->x + area->width, yv);
 
 	if (priv->level_display == MARLIN_SCALE_LINEAR) {
 		pango_layout_set_markup (priv->layout, "<small><small>50</small></small>", -1);
@@ -284,8 +313,8 @@
 	yv = YPOS (-0.5) + priv->base_offset;
 	gdk_draw_line (widget->window,
 		       widget->style->dark_gc[state_type],
-		       area->x + (area->width - 5), area->y + yv,
-		       area->x + area->width, area->y + yv);
+		       area->x + (area->width - 5), yv,
+		       area->x + area->width, yv);
 
 	if (priv->level_display == MARLIN_SCALE_LINEAR) {
 		pango_layout_set_markup (priv->layout, "<small><small>-50</small></small>", -1);
@@ -322,7 +351,7 @@
 	gtk_paint_box (widget->style, widget->window,
 		       GTK_STATE_NORMAL, GTK_SHADOW_OUT,
 		       NULL, widget, "marlin-db-ruler",
-		       widget->allocation.x, widget->allocation.y,
+		       0, 0,
 		       widget->allocation.width,
 		       widget->allocation.height);
 
@@ -331,8 +360,8 @@
 	for (i = 0; i < ruler->priv->channels; i++) {
 		GdkRectangle chan_area, inter;
 
-		chan_area.x = widget->allocation.x;
-		chan_area.y = widget->allocation.y + (chan_height * i) + i;
+		chan_area.x = 0;
+		chan_area.y = (chan_height * i) + i;
 		chan_area.width = widget->allocation.width;
 		chan_area.height = chan_height;
 
@@ -344,9 +373,9 @@
 			gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], area);
 			gdk_draw_line (widget->window,
 				       widget->style->text_gc[state_type],
-				       area->x, area->y + chan_height * i,
+				       area->x, chan_height * i,
 				       area->x + widget->allocation.width,
-				       area->y + chan_height * i);
+				       chan_height * i);
 			gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], NULL);
 		}
 	}
@@ -530,7 +559,7 @@
 
 	w_class->size_allocate = size_allocate;
  	w_class->size_request = size_request;
-	/* w_class->realize = realize; */
+	w_class->realize = realize;
 	w_class->expose_event = expose_event;
 	w_class->button_press_event = button_press_event;
 	w_class->button_release_event = button_release_event;
@@ -567,8 +596,6 @@
 {
 	MarlinLevelRulerPrivate *priv;
 
-	GTK_WIDGET_SET_FLAGS ((GtkWidget *) ruler, GTK_NO_WINDOW);
-
 	priv = ruler->priv = GET_PRIVATE (ruler);
 	priv->channels = DEFAULT_CHANNELS;
 	priv->vmin = DEFAULT_VMIN;



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