[SCM] calf/master: + LineGraph, GUI: LineGraph refresh is done up to 60 times per second via timeouts, and not at all if window is minimized (which it can't be for now anyway)

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:36:52 UTC 2013


The following commit has been merged in the master branch:
commit 0e0c304d2c87200b0ca7acbf7d531bcaf7289957
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sun Dec 30 16:46:00 2007 +0000

    + LineGraph, GUI: LineGraph refresh is done up to 60 times per second via timeouts, and not at all if window is minimized (which it can't be for now anyway)
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@61 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/gui.h b/src/calf/gui.h
index 16bff73..b690b57 100644
--- a/src/calf/gui.h
+++ b/src/calf/gui.h
@@ -177,6 +177,7 @@ struct combo_box_param_control: public param_control
 struct line_graph_param_control: public param_control
 {
     CalfLineGraph *graph;
+    int source_id;
 
     virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
     virtual void get() {}
diff --git a/src/gui.cpp b/src/gui.cpp
index 37a8c56..3bd438a 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -269,7 +269,7 @@ GtkWidget *knob_param_control::create(plugin_gui *_gui, int _param_no)
 {
     gui = _gui;
     param_no = _param_no;
-    const parameter_properties &props = get_props();
+    // const parameter_properties &props = get_props();
     
     //widget = calf_knob_new_with_range (props.to_01 (gui->plugin->get_param_value(param_no)), 0, 1, 0.01);
     widget = calf_knob_new();
@@ -325,7 +325,7 @@ GtkWidget *line_graph_param_control::create(plugin_gui *_gui, int _param_no)
 {
     gui = _gui;
     param_no = _param_no;
-    const parameter_properties &props = get_props();
+    // const parameter_properties &props = get_props();
     
     widget = calf_line_graph_new ();
     CalfLineGraph *clg = CALF_LINE_GRAPH(widget);
@@ -335,20 +335,27 @@ GtkWidget *line_graph_param_control::create(plugin_gui *_gui, int _param_no)
     clg->source_id = param_no;
     
     if (get_int("refresh", 0))
-        g_idle_add(update, this);
+        source_id = g_timeout_add_full(G_PRIORITY_LOW, 1000/30, update, this, NULL); // 30 fps should be enough for everybody
     
     return widget;
 }
 
 void line_graph_param_control::set()
 {
-    gtk_widget_queue_draw(widget);
+    GtkWidget *tw = gtk_widget_get_toplevel(widget);
+    if (tw && GTK_WIDGET_TOPLEVEL(tw))
+    {
+        int ws = gdk_window_get_state(widget->window);
+        if (ws & (GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_ICONIFIED))
+            return;
+        gtk_widget_queue_draw(widget);
+    }
 }
 
 line_graph_param_control::~line_graph_param_control()
 {
     if (get_int("refresh", 0))
-        g_idle_remove_by_data(this);
+        g_source_remove(source_id);
 }
 
 /******************************** GUI proper ********************************/

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list