summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-05 06:01:39 +0000
committerDavid Robillard <d@drobilla.net>2007-10-05 06:01:39 +0000
commit54e981f0d3599fc7413a30c00562b3ea789e2fe7 (patch)
treefb62ca7d068dbe29c3228136fbd2bf155b247cf8 /src/libs/gui
parentc7ebab1bda68e184ef9f7063b48fe2a65113b961 (diff)
downloadingen-54e981f0d3599fc7413a30c00562b3ea789e2fe7.tar.gz
ingen-54e981f0d3599fc7413a30c00562b3ea789e2fe7.tar.bz2
ingen-54e981f0d3599fc7413a30c00562b3ea789e2fe7.zip
Fix ridiculous CPU chewing on embedded LV2 GUIs.
For some reason the GUI widget's size request signal fires continuously... this needs fixing. git-svn-id: http://svn.drobilla.net/lad/ingen@824 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/NodeModule.cpp11
-rw-r--r--src/libs/gui/NodeModule.hpp2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index ed05c859..fef7b648 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -41,6 +41,8 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
, _slv2_ui(NULL)
, _gui(NULL)
, _gui_item(NULL)
+ , _last_gui_request_width(0)
+ , _last_gui_request_height(0)
{
assert(_node);
@@ -207,6 +209,12 @@ NodeModule::embed_gui(bool embed)
void
NodeModule::gui_size_request(Gtk::Requisition* r)
{
+ // For some reason this is called continuously (probably every redraw)
+ // This shouldn't be happening (FIXME)...
+
+ if (_last_gui_request_width == r->width && _last_gui_request_height == r->height)
+ return;
+
if (r->width + 4 > _width)
set_minimum_width(r->width + 4);
@@ -215,6 +223,9 @@ NodeModule::gui_size_request(Gtk::Requisition* r)
_ports_y_offset = r->height + 2;
resize();
+
+ _last_gui_request_width = r->width;
+ _last_gui_request_height = r->height;
}
diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp
index ce4d88c4..14be9dee 100644
--- a/src/libs/gui/NodeModule.hpp
+++ b/src/libs/gui/NodeModule.hpp
@@ -90,6 +90,8 @@ protected:
SLV2UIInstance _slv2_ui;
Gtk::Widget* _gui;
Gnome::Canvas::Widget* _gui_item;
+ int _last_gui_request_width;
+ int _last_gui_request_height;
};