marlin r1284 - in trunk/src: . other
- From: iain svn gnome org
- To: svn-commits-list gnome org
- Subject: marlin r1284 - in trunk/src: . other
- Date: Wed, 1 Oct 2008 23:30:28 +0000 (UTC)
Author: iain
Date: Wed Oct 1 23:30:27 2008
New Revision: 1284
URL: http://svn.gnome.org/viewvc/marlin?rev=1284&view=rev
Log:
Make GtkVUMeter NO-WINDOW
Modified:
trunk/src/ChangeLog
trunk/src/other/gtkvumeter.c
Modified: trunk/src/other/gtkvumeter.c
==============================================================================
--- trunk/src/other/gtkvumeter.c (original)
+++ trunk/src/other/gtkvumeter.c Wed Oct 1 23:30:27 2008
@@ -76,6 +76,8 @@
static void
gtk_vumeter_init (GtkVUMeter *vumeter)
{
+ GTK_WIDGET_SET_FLAGS (vumeter, GTK_NO_WINDOW);
+
vumeter->peaks_falloff = GTK_VUMETER_PEAKS_FALLOFF_MEDIUM;
vumeter->fg_gc = NULL;
@@ -167,29 +169,9 @@
static void
gtk_vumeter_realize (GtkWidget *widget)
{
- GtkVUMeter *vumeter;
- GdkWindowAttr attributes;
- int attributes_mask;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- vumeter = GTK_VUMETER (widget);
+ GtkVUMeter *vumeter = (GtkVUMeter *) widget;
- 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.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_user_data (widget->window, widget);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
/* colors */
vumeter->colormap = gdk_colormap_get_system ();
@@ -205,9 +187,7 @@
static void
gtk_vumeter_unrealize (GtkWidget *widget)
{
- GtkVUMeter *vumeter;
-
- vumeter = GTK_VUMETER (widget);
+ GtkVUMeter *vumeter = (GtkVUMeter *) widget;
gtk_vumeter_free_colors (vumeter);
g_object_unref (G_OBJECT (vumeter->fg_gc));
@@ -253,23 +233,6 @@
return;
}
- switch (vumeter->orientation) {
- case GTK_VUMETER_VERTICAL:
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- VERTICAL_VUMETER_WIDTH, allocation->height);
- break;
-
- case GTK_VUMETER_HORIZONTAL:
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, HORIZONTAL_VUMETER_HEIGHT);
- break;
-
- default:
- break;
- }
-
gtk_vumeter_setup_colors (vumeter);
}
@@ -279,6 +242,7 @@
{
GtkVUMeter *vumeter;
int index, rms_level, peak_level;
+ int x, y;
int width, height;
if (event->count > 0) {
@@ -290,36 +254,36 @@
vumeter->rms_level);
peak_level = gtk_vumeter_sound_level_to_draw_level (vumeter,
vumeter->peak_level);
+ x = widget->allocation.x;
+ y = widget->allocation.y;
+ width = widget->allocation.width;
+ height = widget->allocation.height;
+
switch (vumeter->orientation) {
case GTK_VUMETER_VERTICAL:
- width = widget->allocation.width - 2;
- height = widget->allocation.height;
-
- /* draw border */
- gtk_paint_box (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, widget, "", 0, 0,
- widget->allocation.width, height);
- /* Reduce height by three to draw bars inside the trough */
height -= 3;
for (index = rms_level; index < peak_level; index++) {
gdk_gc_set_foreground (vumeter->bg_gc,
&vumeter->b_colors[index]);
gdk_draw_line (widget->window, vumeter->bg_gc,
- 1, height - index,
- width, height - index);
+ x + 1, (y + height) - index,
+ x + (width - 3), (y + height) - index);
}
for (index = 0; index < rms_level; index++) {
gdk_gc_set_foreground (vumeter->fg_gc,
&vumeter->f_colors[index]);
gdk_draw_line (widget->window, vumeter->fg_gc,
- 1, height - index,
- width, height - index);
+ x + 1, (y + height) - index,
+ x + (width - 3), (y + height) - index);
}
+ height += 3;
+ gtk_paint_shadow (widget->style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ NULL, widget, "", x, y, width, height);
break;
case GTK_VUMETER_HORIZONTAL:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]