Solving issue 1769: "Single Editor mode: unnecessary thumbnail refresh when switching from tab to tab"

This commit is contained in:
natureh 510 2013-03-11 23:15:41 +01:00
parent b038720e37
commit 744583f32b
3 changed files with 18 additions and 11 deletions

View File

@ -288,18 +288,20 @@ bool RTWindow::on_window_state_event(GdkEventWindowState* event) {
} }
void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) { void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) {
if (page_num > 1) { if (page_num > 1) {
if (isSingleTabMode()) MoveFileBrowserToEditor(); if (isSingleTabMode()) MoveFileBrowserToEditor();
EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num)); EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num));
ep->setAspect(); ep->setAspect();
} else { } else {
// in single tab mode with command line filename epanel does not exist yet // in single tab mode with command line filename epanel does not exist yet
if (isSingleTabMode() && epanel) { if (isSingleTabMode() && epanel) {
// Save profile on leaving the editor panel // Save profile on leaving the editor panel
epanel->saveProfile(); epanel->saveProfile();
MoveFileBrowserToMain(); // Moving the FileBrowser only if the user has switched to the FileBrowser tab
if (page_num==0)
MoveFileBrowserToMain();
} }
} }
} }

View File

@ -57,7 +57,12 @@ void ThumbBrowserEntryBase::updateBackBuffer () {
Gtk::Widget* w = parent->getDrawingArea (); Gtk::Widget* w = parent->getDrawingArea ();
backBuffer = Gdk::Pixmap::create (w->get_window(), exp_width, exp_height); Glib::RefPtr<Gdk::Window> win = w->get_window();
if (!win)
// Nothing to draw on, so we return
return;
backBuffer = Gdk::Pixmap::create (win, exp_width, exp_height);
// If thumbnail is hidden by a filter drawing to it will crash // If thumbnail is hidden by a filter drawing to it will crash
int backbuffer_w=0, backbuffer_h=0; int backbuffer_w=0, backbuffer_h=0;

View File

@ -26,7 +26,7 @@
#include <omp.h> #include <omp.h>
#endif #endif
#define DEBUG(format,args...) #define DEBUG(format,args...)
//#define DEBUG(format,args...) printf("ThumbImageUpdate::%s: " format "\n", __FUNCTION__, ## args) //#define DEBUG(format,args...) printf("ThumbImageUpdate::%s: " format "\n", __FUNCTION__, ## args)
class class
@ -138,7 +138,7 @@ public:
// remove so not run again // remove so not run again
jobs_.erase(i); jobs_.erase(i);
DEBUG("%d job(s) remaining",jobs_.size()); DEBUG("%d job(s) remaining", int(jobs_.size()) );
++active_; ++active_;
} }
@ -215,7 +215,7 @@ ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upgrade,
i->listener_ == l && i->listener_ == l &&
i->upgrade_ == upgrade ) i->upgrade_ == upgrade )
{ {
DEBUG("updating job %s",tbe->getFileName().c_str()); DEBUG("updating job %s",tbe->shortname.c_str());
// we have one, update queue entry, will be picked up by thread when processed // we have one, update queue entry, will be picked up by thread when processed
/*i->pparams_ = params; /*i->pparams_ = params;
i->height_ = height; */ i->height_ = height; */
@ -225,10 +225,10 @@ ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upgrade,
} }
// create a new job and append to queue // create a new job and append to queue
DEBUG("queing job %s",t->getFileName().c_str()); DEBUG("queing job %s",tbe->shortname.c_str());
impl_->jobs_.push_back(Impl::Job(tbe,priority,upgrade,l)); impl_->jobs_.push_back(Impl::Job(tbe,priority,upgrade,l));
DEBUG("adding run request %s",t->getFileName().c_str()); DEBUG("adding run request %s",tbe->shortname.c_str());
impl_->threadPool_->push(sigc::mem_fun(*impl_, &ThumbImageUpdater::Impl::processNextJob)); impl_->threadPool_->push(sigc::mem_fun(*impl_, &ThumbImageUpdater::Impl::processNextJob));
} }