summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gtkui/ddbequalizer.c40
-rw-r--r--plugins/gtkui/ddbequalizer.h4
-rw-r--r--plugins/gtkui/ddbequalizer.vala90
-rw-r--r--plugins/gtkui/eq.c8
-rw-r--r--plugins/gtkui/eq.h3
-rw-r--r--plugins/gtkui/gdkdrawing.c1
-rw-r--r--plugins/gtkui/prefwin.c4
7 files changed, 76 insertions, 74 deletions
diff --git a/plugins/gtkui/ddbequalizer.c b/plugins/gtkui/ddbequalizer.c
index fac3a1f0..43ee05de 100644
--- a/plugins/gtkui/ddbequalizer.c
+++ b/plugins/gtkui/ddbequalizer.c
@@ -44,18 +44,17 @@ typedef struct _DdbEqualizer DdbEqualizer;
typedef struct _DdbEqualizerClass DdbEqualizerClass;
typedef struct _DdbEqualizerPrivate DdbEqualizerPrivate;
#define _gdk_cursor_unref0(var) ((var == NULL) ? NULL : (var = (gdk_cursor_unref (var), NULL)))
-#define _gdk_event_free0(var) ((var == NULL) ? NULL : (var = (gdk_event_free (var), NULL)))
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _pango_font_description_free0(var) ((var == NULL) ? NULL : (var = (pango_font_description_free (var), NULL)))
struct _DdbEqualizer {
- GtkWidget parent_instance;
+ GtkDrawingArea parent_instance;
DdbEqualizerPrivate * priv;
};
struct _DdbEqualizerClass {
- GtkWidgetClass parent_class;
+ GtkDrawingAreaClass parent_class;
};
struct _DdbEqualizerPrivate {
@@ -82,7 +81,6 @@ enum {
#define DDB_EQUALIZER_bands 18
#define DDB_EQUALIZER_spot_size 3
static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventConfigure* event);
-static void ddb_equalizer_send_configure (DdbEqualizer* self);
static void ddb_equalizer_real_realize (GtkWidget* base);
static inline double ddb_equalizer_scale (DdbEqualizer* self, double val);
static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose* event);
@@ -114,36 +112,11 @@ static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventCon
}
-static void ddb_equalizer_send_configure (DdbEqualizer* self) {
- GdkEvent* event;
- g_return_if_fail (self != NULL);
- event = gdk_event_new (GDK_CONFIGURE);
- event->configure.window = GDK_WINDOW (g_object_ref ((GObject*) ((GtkWidget*) self)->window));
- event->configure.send_event = (gchar) 1;
- event->configure.x = ((GtkWidget*) self)->allocation.x;
- event->configure.y = ((GtkWidget*) self)->allocation.y;
- event->configure.width = ((GtkWidget*) self)->allocation.width;
- event->configure.height = ((GtkWidget*) self)->allocation.height;
- gtk_widget_event ((GtkWidget*) self, event);
- _gdk_event_free0 (event);
-}
-
-
static void ddb_equalizer_real_realize (GtkWidget* base) {
DdbEqualizer * self;
- GdkWindowAttr _tmp0_ = {0};
- GdkWindowAttr attrs;
- GdkWindow* _tmp1_;
self = (DdbEqualizer*) base;
- GTK_WIDGET_SET_FLAGS ((GtkWidget*) self, GTK_REALIZED);
- attrs = (memset (&_tmp0_, 0, sizeof (GdkWindowAttr)), _tmp0_.window_type = GDK_WINDOW_CHILD, _tmp0_.wclass = GDK_INPUT_OUTPUT, _tmp0_.event_mask = gtk_widget_get_events ((GtkWidget*) self) | GDK_EXPOSURE_MASK, _tmp0_);
- ((GtkWidget*) self)->window = (_tmp1_ = gdk_window_new (gtk_widget_get_parent_window ((GtkWidget*) self), &attrs, 0), _g_object_unref0 (((GtkWidget*) self)->window), _tmp1_);
- gdk_window_move_resize (((GtkWidget*) self)->window, ((GtkWidget*) self)->allocation.x, ((GtkWidget*) self)->allocation.y, ((GtkWidget*) self)->allocation.width, ((GtkWidget*) self)->allocation.height);
- gdk_window_set_user_data (((GtkWidget*) self)->window, self);
- gtk_widget_set_style ((GtkWidget*) self, gtk_style_attach (gtk_widget_get_style ((GtkWidget*) self), ((GtkWidget*) self)->window));
- gtk_style_set_background (gtk_widget_get_style ((GtkWidget*) self), ((GtkWidget*) self)->window, GTK_STATE_NORMAL);
- gtk_widget_add_events ((GtkWidget*) self, (gint) (((GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK) | GDK_LEAVE_NOTIFY_MASK) | GDK_POINTER_MOTION_MASK));
- ddb_equalizer_send_configure (self);
+ GTK_WIDGET_CLASS (ddb_equalizer_parent_class)->realize ((GtkWidget*) GTK_DRAWING_AREA (self));
+ gtk_widget_add_events ((GtkWidget*) self, (gint) ((((GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_LEAVE_NOTIFY_MASK) | GDK_POINTER_MOTION_MASK));
}
@@ -619,7 +592,6 @@ static GObject * ddb_equalizer_constructor (GType type, guint n_construct_proper
{
self->priv->margin_bottom = (gint) (((pango_units_to_double (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72) + 4);
self->priv->margin_left = self->priv->margin_bottom * 4;
- gtk_widget_set_app_paintable ((GtkWidget*) self, TRUE);
}
return obj;
}
@@ -669,7 +641,7 @@ GType ddb_equalizer_get_type (void) {
if (g_once_init_enter (&ddb_equalizer_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (DdbEqualizerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ddb_equalizer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DdbEqualizer), 0, (GInstanceInitFunc) ddb_equalizer_instance_init, NULL };
GType ddb_equalizer_type_id;
- ddb_equalizer_type_id = g_type_register_static (GTK_TYPE_WIDGET, "DdbEqualizer", &g_define_type_info, 0);
+ ddb_equalizer_type_id = g_type_register_static (GTK_TYPE_DRAWING_AREA, "DdbEqualizer", &g_define_type_info, 0);
g_once_init_leave (&ddb_equalizer_type_id__volatile, ddb_equalizer_type_id);
}
return ddb_equalizer_type_id__volatile;
diff --git a/plugins/gtkui/ddbequalizer.h b/plugins/gtkui/ddbequalizer.h
index 1b843208..b0493d52 100644
--- a/plugins/gtkui/ddbequalizer.h
+++ b/plugins/gtkui/ddbequalizer.h
@@ -24,12 +24,12 @@ typedef struct _DdbEqualizerClass DdbEqualizerClass;
typedef struct _DdbEqualizerPrivate DdbEqualizerPrivate;
struct _DdbEqualizer {
- GtkWidget parent_instance;
+ GtkDrawingArea parent_instance;
DdbEqualizerPrivate * priv;
};
struct _DdbEqualizerClass {
- GtkWidgetClass parent_class;
+ GtkDrawingAreaClass parent_class;
};
diff --git a/plugins/gtkui/ddbequalizer.vala b/plugins/gtkui/ddbequalizer.vala
index a0be8aee..8edfe470 100644
--- a/plugins/gtkui/ddbequalizer.vala
+++ b/plugins/gtkui/ddbequalizer.vala
@@ -24,7 +24,7 @@ const string[] freqs = {
};
namespace Ddb {
- public class Equalizer : Gtk.Widget
+ public class Equalizer : Gtk.DrawingArea
{
public signal void on_changed ();
@@ -49,51 +49,65 @@ namespace Ddb {
{
margin_bottom = (int)(Pango.units_to_double (get_style ().font_desc.get_size ()) * Gdk.Screen.get_default ().get_resolution () / 72 + 4);
margin_left = margin_bottom * 4;
- set_app_paintable (true);
//color_changed ();
}
public override bool configure_event (Gdk.EventConfigure event) {
-// stdout.printf ("eq configure\n");
Gtkui.init_theme_colors ();
return false;
}
- private void send_configure () {
- Gdk.Event event = new Gdk.Event (Gdk.EventType.CONFIGURE);
-
- event.configure.window = (Gdk.Window)this.window.ref ();
- event.configure.send_event = 1;
- event.configure.x = allocation.x;
- event.configure.y = allocation.y;
- event.configure.width = allocation.width;
- event.configure.height = allocation.height;
-
- this.event (event);
- }
-
- public override void realize () {
- set_flags (Gtk.WidgetFlags.REALIZED);
- var attrs = Gdk.WindowAttr () {
- window_type = Gdk.WindowType.CHILD,
- wclass = Gdk.WindowClass.INPUT_OUTPUT,
- event_mask = get_events () | Gdk.EventMask.EXPOSURE_MASK
- };
- this.window = new Gdk.Window (get_parent_window (), attrs, 0);
- this.window.move_resize (this.allocation.x, this.allocation.y,
- this.allocation.width, this.allocation.height);
-
- this.window.set_user_data (this);
- this.style = this.style.attach (this.window);
- this.style.set_background (this.window, Gtk.StateType.NORMAL);
- add_events (Gdk.EventMask.BUTTON_PRESS_MASK
- | Gdk.EventMask.BUTTON_RELEASE_MASK
- | Gdk.EventMask.LEAVE_NOTIFY_MASK
- | Gdk.EventMask.POINTER_MOTION_MASK);
-
- send_configure ();
- }
+// private void send_configure () {
+// Gdk.Event event = new Gdk.Event (Gdk.EventType.CONFIGURE);
+//
+// event.configure.window = (Gdk.Window)this.window.ref ();
+// event.configure.send_event = 1;
+// event.configure.x = allocation.x;
+// event.configure.y = allocation.y;
+// event.configure.width = allocation.width;
+// event.configure.height = allocation.height;
+//
+// this.event (event);
+// }
+
+// public override void realize () {
+// set_flags (Gtk.WidgetFlags.REALIZED);
+// var attrs = Gdk.WindowAttr () {
+// window_type = Gdk.WindowType.CHILD,
+// x = allocation.x,
+// y = allocation.y,
+// width = allocation.width,
+// height = allocation.height,
+// wclass = Gdk.WindowClass.INPUT_OUTPUT,
+// visual = get_visual (),
+// colormap = get_colormap (),
+// event_mask = get_events () | Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.POINTER_MOTION_MASK
+// };
+// int attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.VISUAL | Gdk.WindowAttributesType.COLORMAP;
+// this.window = new Gdk.Window (get_parent_window (), attrs, attributes_mask);
+//
+// this.window.set_user_data (this);
+// this.style = this.style.attach (this.window);
+// this.style.set_background (this.window, Gtk.StateType.NORMAL);
+//
+// send_configure ();
+// }
+ public override void realize () {
+ base.realize ();
+ add_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.POINTER_MOTION_MASK);
+ }
+
+// public override void size_allocate (Gdk.Rectangle allocation) {
+// this.allocation.x = allocation.x;
+// this.allocation.y = allocation.y;
+// this.allocation.width = allocation.width;
+// this.allocation.height = allocation.height;
+// if (is_realized ()) {
+// window.move_resize (allocation.x, allocation.y, allocation.width, allocation.height);
+// send_configure ();
+// }
+// }
public override bool
expose_event (Gdk.EventExpose event)
@@ -112,6 +126,8 @@ namespace Ddb {
Gdk.Drawable d = get_window();
var gc = d.create_gc (Gdk.GCValues(), 0);
+ //Gdk.Rectangle rc = {0, 0, allocation.width, allocation.height};
+ //gc.set_clip_rectangle (rc);
gc.set_rgb_fg_color (c2);
diff --git a/plugins/gtkui/eq.c b/plugins/gtkui/eq.c
index fef3bda3..01b5195d 100644
--- a/plugins/gtkui/eq.c
+++ b/plugins/gtkui/eq.c
@@ -372,3 +372,11 @@ eq_window_destroy (void) {
eqwin = NULL;
}
}
+
+void
+eq_redraw (void) {
+ if (eqwin) {
+ gtk_widget_queue_draw (eqwin);
+ }
+}
+
diff --git a/plugins/gtkui/eq.h b/plugins/gtkui/eq.h
index efd4ac69..9e54916e 100644
--- a/plugins/gtkui/eq.h
+++ b/plugins/gtkui/eq.h
@@ -32,4 +32,7 @@ eq_window_destroy (void);
struct DB_supereq_dsp_s *
get_supereq_plugin (void);
+void
+eq_redraw (void);
+
#endif
diff --git a/plugins/gtkui/gdkdrawing.c b/plugins/gtkui/gdkdrawing.c
index 6e31ff5d..2e60c090 100644
--- a/plugins/gtkui/gdkdrawing.c
+++ b/plugins/gtkui/gdkdrawing.c
@@ -192,7 +192,6 @@ gtkui_override_tabstrip_colors (void) {
void
gtkui_init_theme_colors (void) {
- printf ("init theme colors\n");
override_listview_colors= deadbeef->conf_get_int ("gtkui.override_listview_colors", 0);
override_bar_colors = deadbeef->conf_get_int ("gtkui.override_bar_colors", 0);
override_tabstrip_colors = deadbeef->conf_get_int ("gtkui.override_tabstrip_colors", 0);
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 22d44768..a0018680 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -26,6 +26,7 @@
#include "drawing.h"
#include "../hotkeys/hotkeys.h"
#include "support.h"
+#include "eq.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
@@ -792,6 +793,7 @@ on_bar_foreground_color_set (GtkColorButton *colorbutton,
gtkui_init_theme_colors ();
seekbar_redraw ();
volumebar_redraw ();
+ eq_redraw ();
}
@@ -808,6 +810,7 @@ on_bar_background_color_set (GtkColorButton *colorbutton,
gtkui_init_theme_colors ();
seekbar_redraw ();
volumebar_redraw ();
+ eq_redraw ();
}
void
@@ -921,6 +924,7 @@ on_override_bar_colors_toggled (GtkToggleButton *togglebutton,
prefwin_init_theme_colors ();
seekbar_redraw ();
volumebar_redraw ();
+ eq_redraw ();
}