changeset 399:256c36a7e70f

- Added the double-buffer as preference patch.
author jcid
date Thu, 09 Oct 2008 15:26:45 +0200
parents 9009aed444ac
children 31b866fdde87
files configure.in dillo2rc dw/fltkviewbase.cc dw/fltkviewbase.hh src/prefs.c src/prefs.h src/uicmd.cc
diffstat 7 files changed, 31 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Thu Oct 09 00:00:33 2008 +0200
+++ b/configure.in	Thu Oct 09 15:26:45 2008 +0200
@@ -35,8 +35,6 @@
 AC_ARG_ENABLE(threaded-dns,[  --disable-threaded-dns  Disable the advantage of a reentrant resolver library],
               enable_threaded_dns=$enableval, enable_threaded_dns=yes)
 AC_ARG_ENABLE(rtfl,   [  --enable-rtfl           Build with rtfl messages])
-AC_ARG_ENABLE(doublebuffer,   [  --disable-doublebuffer           Disable double buffering for drawing], , enable_doublebuffer=yes)
-              
 AC_PROG_CC
 AC_PROG_CXX
 AM_PROG_CC_STDC
@@ -430,9 +428,6 @@
 if test "x$enable_rtfl" = "xyes" ; then
   CXXFLAGS="$CXXFLAGS -DDBG_RTFL"
 fi
-if test "x$enable_doublebuffer" = "xno" ; then
-  CXXFLAGS="$CXXFLAGS -DNO_DOUBLEBUFFER"
-fi
 
 dnl -----------------------
 dnl Checks for header files
--- a/dillo2rc	Thu Oct 09 00:00:33 2008 +0200
+++ b/dillo2rc	Thu Oct 09 15:26:45 2008 +0200
@@ -18,6 +18,13 @@
 # (there's a toggle button near the bug meter to change this on-the-fly)
 #load_images=YES
 
+
+# Change the buffering scheme for drawing
+# 0 no double buffering - useful for debugging
+# 1 light buffering using a single back buffer for all windows
+# 2 full fltk-based double buffering for all windows
+#buffered_drawing=1
+
 # Set your default directory for download/save operations
 #save_dir=/tmp
 
--- a/dw/fltkviewbase.cc	Thu Oct 09 00:00:33 2008 +0200
+++ b/dw/fltkviewbase.cc	Thu Oct 09 15:26:45 2008 +0200
@@ -50,11 +50,9 @@
    lastDraw = time(0);
    drawDelay = 2;      /* in seconds */
    mouse_x = mouse_y = 0;
-#ifndef NO_DOUBLEBUFFER
-   if (!backBuffer) {
+   if (backBuffer == NULL) {
       backBuffer = new Image ();
    }
-#endif
 }
 
 FltkViewBase::~FltkViewBase ()
@@ -62,6 +60,15 @@
    cancelQueueDraw ();
 }
 
+void FltkViewBase::setBufferedDrawing (bool b) {
+   if (b && backBuffer == NULL) {
+      backBuffer = new Image ();
+   } else if (!b && backBuffer != NULL) {
+      delete backBuffer;
+      backBuffer = NULL;
+   }
+}
+
 void FltkViewBase::draw ()
 {
    int d = damage ();
--- a/dw/fltkviewbase.hh	Thu Oct 09 00:00:33 2008 +0200
+++ b/dw/fltkviewbase.hh	Thu Oct 09 15:26:45 2008 +0200
@@ -75,6 +75,7 @@
 
    core::View *getClippingView (int x, int y, int width, int height);
    void mergeClippingView (core::View *clippingView);
+   void setBufferedDrawing (bool b);
 };
 
 
--- a/src/prefs.c	Thu Oct 09 00:00:33 2008 +0200
+++ b/src/prefs.c	Thu Oct 09 15:26:45 2008 +0200
@@ -76,6 +76,7 @@
    DRC_TOKEN_LIMIT_TEXT_WIDTH,
    DRC_TOKEN_LINK_COLOR,
    DRC_TOKEN_LOAD_IMAGES,
+   DRC_TOKEN_BUFFERED_DRAWING,
    DRC_TOKEN_MIDDLE_CLICK_OPENS_NEW_TAB,
    DRC_TOKEN_NOPROXY,
    DRC_TOKEN_PANEL_SIZE,
@@ -123,6 +124,7 @@
 static const SymNode_t symbols[] = {
    { "allow_white_bg", DRC_TOKEN_ALLOW_WHITE_BG },
    { "bg_color", DRC_TOKEN_BG_COLOR },
+   { "buffered_drawing", DRC_TOKEN_BUFFERED_DRAWING },
    { "contrast_visited_color", DRC_TOKEN_CONTRAST_VISITED_COLOR },
    { "enterpress_forces_submit", DRC_TOKEN_ENTERPRESS_FORCES_SUBMIT },
    { "focus_new_tab", DRC_TOKEN_FOCUS_NEW_TAB },
@@ -321,6 +323,9 @@
    case DRC_TOKEN_LOAD_IMAGES:
       prefs.load_images = (strcmp(value, "YES") == 0);
       break;
+   case DRC_TOKEN_BUFFERED_DRAWING:
+      prefs.buffered_drawing = atoi(value);
+      break;
    case DRC_TOKEN_FW_FONT:
       dFree(prefs.fw_fontname);
       prefs.fw_fontname = dStrdup(value);
@@ -444,6 +449,7 @@
    prefs.show_progress_box=TRUE;
    prefs.fullwindow_start=FALSE;
    prefs.load_images=TRUE;
+   prefs.buffered_drawing=1;
    prefs.vw_fontname = dStrdup(D_VW_FONTNAME);
    prefs.fw_fontname = dStrdup(D_FW_FONTNAME);
    prefs.generate_submit = FALSE;
--- a/src/prefs.h	Thu Oct 09 00:00:33 2008 +0200
+++ b/src/prefs.h	Thu Oct 09 15:26:45 2008 +0200
@@ -52,6 +52,7 @@
    bool_t show_progress_box;
    bool_t fullwindow_start;
    bool_t load_images;
+   int32_t buffered_drawing;
    char *vw_fontname;
    char *fw_fontname;
    bool_t generate_submit;
--- a/src/uicmd.cc	Thu Oct 09 00:00:33 2008 +0200
+++ b/src/uicmd.cc	Thu Oct 09 15:26:45 2008 +0200
@@ -168,7 +168,8 @@
 
    Window *win = new Window(ww, wh);
    win->shortcut(0); // Ignore Escape
-   win->clear_double_buffer();
+   if (prefs.buffered_drawing != 2)
+      win->clear_double_buffer();
    win->set_flag(RAW_LABEL);
    CustTabGroup *DilloTabs = new CustTabGroup(0, 0, ww, wh);
    DilloTabs->clear_tab_to_focus();
@@ -198,6 +199,10 @@
    Layout *layout = new Layout (platform);
 
    FltkViewport *viewport = new FltkViewport (0, 0, 1, 1);
+   if (prefs.buffered_drawing == 1)
+      viewport->setBufferedDrawing (true);
+   else
+      viewport->setBufferedDrawing (false);
    
    layout->attachView (viewport);
    new_ui->set_render_layout(*viewport);