Improve page-up/down scrolling in File Browser

Patch by Ingo
This commit is contained in:
Morgan Hardwood 2019-07-25 14:11:40 +02:00
parent 4cbc2a9091
commit a9edbcf47b

View File

@ -534,28 +534,33 @@ void ThumbBrowserBase::configScrollBars ()
GThreadLock tLock; // Acquire the GUI GThreadLock tLock; // Acquire the GUI
if (inW > 0 && inH > 0) { if (inW > 0 && inH > 0) {
int ih = internal.get_height();
int iw = internal.get_width (); if (arrangement == TB_Horizontal) {
int ih = internal.get_height (); auto ha = hscroll.get_adjustment();
int iw = internal.get_width();
hscroll.get_adjustment()->set_upper (inW); ha->set_upper(inW);
vscroll.get_adjustment()->set_upper (inH); ha->set_lower(0);
hscroll.get_adjustment()->set_lower (0); ha->set_step_increment(!fd.empty() ? fd[0]->getEffectiveWidth() : 0);
vscroll.get_adjustment()->set_lower (0); ha->set_page_increment(iw);
hscroll.get_adjustment()->set_step_increment (!fd.empty() ? fd[0]->getEffectiveWidth() : 0); ha->set_page_size(iw);
vscroll.get_adjustment()->set_step_increment (!fd.empty() ? fd[0]->getEffectiveHeight() : 0); if (iw >= inW) {
hscroll.get_adjustment()->set_page_increment (iw); hscroll.hide();
vscroll.get_adjustment()->set_page_increment (ih); } else {
hscroll.get_adjustment()->set_page_size (iw); hscroll.show();
vscroll.get_adjustment()->set_page_size (ih); }
if(iw >= inW) {
hscroll.hide();
} else { } else {
hscroll.show(); hscroll.hide();
} }
if(ih >= inH) { auto va = vscroll.get_adjustment();
va->set_upper(inH);
va->set_lower(0);
const auto height = !fd.empty() ? fd[0]->getEffectiveHeight() : 0;
va->set_step_increment(height);
va->set_page_increment(height == 0 ? ih : (ih / height) * height);
va->set_page_size(ih);
if (ih >= inH) {
vscroll.hide(); vscroll.hide();
} else { } else {
vscroll.show(); vscroll.show();