@@ -424,6 +424,19 @@ void html_widget::size_allocate_vfunc(int width, int height, int /* baseline */)
424
424
425
425
void html_widget::allocate_scrollbars (int width, int height)
426
426
{
427
+ m_do_force_redraw_on_adjustment = false ;
428
+ m_hadjustment->set_page_size (width);
429
+ m_vadjustment->set_page_size (height);
430
+ if (m_vadjustment->get_value () > m_vadjustment->get_upper () - m_vadjustment->get_page_size ())
431
+ {
432
+ m_vadjustment->set_value (m_vadjustment->get_upper () - m_vadjustment->get_page_size ());
433
+ }
434
+ if (m_hadjustment->get_value () > m_hadjustment->get_upper () - m_hadjustment->get_page_size ())
435
+ {
436
+ m_hadjustment->set_value (m_hadjustment->get_upper () - m_hadjustment->get_page_size ());
437
+ }
438
+ m_do_force_redraw_on_adjustment = true ;
439
+
427
440
int minimum = 0 , natural = 0 , m_baseline = 0 , n_baseline = 0 ;
428
441
429
442
m_vscrollbar->measure (Gtk::Orientation::HORIZONTAL, -1 , minimum, natural, m_baseline, n_baseline);
@@ -434,25 +447,35 @@ void html_widget::allocate_scrollbars(int width, int height)
434
447
m_hscrollbar->measure (Gtk::Orientation::VERTICAL, -1 , minimum, natural, m_baseline, n_baseline);
435
448
Gtk::Allocation hscrollbar_allocation (0 , height - natural, width, natural);
436
449
m_hscrollbar->size_allocate (hscrollbar_allocation, -1 );
437
-
438
- m_hadjustment->set_page_size (width);
439
- m_vadjustment->set_page_size (height);
440
450
}
441
451
442
452
void html_widget::on_vadjustment_changed ()
443
453
{
444
454
m_draw_buffer.on_scroll ( current_page (),
445
455
(int ) m_hadjustment->get_value (),
446
456
(int ) m_vadjustment->get_value ());
447
- force_redraw ();
457
+
458
+ if (m_do_force_redraw_on_adjustment)
459
+ {
460
+ force_redraw ();
461
+ } else
462
+ {
463
+ queue_draw ();
464
+ }
448
465
}
449
466
450
467
void html_widget::on_hadjustment_changed ()
451
468
{
452
469
m_draw_buffer.on_scroll ( current_page (),
453
470
(int ) m_hadjustment->get_value (),
454
471
(int ) m_vadjustment->get_value ());
455
- force_redraw ();
472
+ if (m_do_force_redraw_on_adjustment)
473
+ {
474
+ force_redraw ();
475
+ } else
476
+ {
477
+ queue_draw ();
478
+ }
456
479
}
457
480
458
481
void html_widget::on_adjustments_changed ()
0 commit comments