Johannes Hofmann wrote:
On Tue, Oct 13, 2009 at 06:48:51PM +0200, Stefan wrote:
1) flicker at reload When doing a reload my screen flickers and I'd like to get rid of that. I first tried the dillorc option buffered_drawing=0/1/2 but that didn't make any difference. I then tried to find the source where the screen is cleared before redrawing the page. I followed the source of redraw() until layout.cc where topLevel->draw() is executed but I cannot find its implementation.
I'm not sure. It might just be that the freshly loaded page is rendered while it is not 100% loaded, which would blank the screen. Then it is drawn again after loading has completed. I would suggest to put printf()s in FltkViewBase::draw() (the actual draw) and Layout::queueResize() (which requests a complete redraw) to see what is going on. You can also use gdb an breakpoints of course.
Thanks for the feedback to all of you. I'll try to find the origin of the flickering.
2) externally trigger reload I'd like to trigger a page reload externally by another application. I searched a bit about IPC mechanisms of fltk but didn't find any. So I'm thinking about using a UNIX fifo or the system signal SIGUSR2. Do you think this is a good approach?
If you just need to trigger a reload, SIGUSR2 might be ok. For a more general remote control fifo's or maybe stdin might be an option. You can check what other browsers do.
Please see below the patch on how I've done it. Two issues: a) The signal() function is ambiguous because there's a namespace lout::signal in lout/signal.hh. I don't know how to tell the compiler to use the correct signal(). I tried std::signal() but that didn't work. If I temporarily rename the lout::signal to something else the patch seems to work. b) Using SIGUSR, do I have to worry about interrupting the main flow of dillo at a bad moment, or is it safe the way I've done it? I think other browsers use IPC mechanisms of the toolkit for things like this, but I think fltk2 doesn't provide some such thing. Many thanks Stefan. ----- diff -r 7cdd8e4f8076 src/uicmd.cc --- a/src/uicmd.cc Sat Oct 10 03:04:12 2009 +0000 +++ b/src/uicmd.cc Wed Oct 14 13:20:04 2009 +0200 @@ -15,6 +15,7 @@ #include <stdio.h> #include <stdarg.h> #include <math.h> /* for rint */ +#include <signal.h> #include <fltk/draw.h> #include <fltk/damage.h> @@ -44,6 +45,21 @@ // Handy macro #define BW2UI(bw) ((UI*)((bw)->ui)) + +/* + * sig_usr() + */ +static void sig_usr(int signo) +{ + int i; + if (signo == SIGUSR1) { + for (i=0; i<a_Bw_num(); i++) + a_UIcmd_reload(a_Bw_get(i)); +// a_Nav_reload(a_Bw_get(i)); + } + else + MSG_WARN("received signal %d\n", signo); +} // Platform idependent part using namespace dw::core; @@ -472,6 +488,10 @@ BrowserWindow *a_UIcmd_browser_window_ne win->callback(win_cb, new_bw); + /* setup SIGUSR1 for external triggering of reload */ + if (signal(SIGUSR1, sig_usr) == SIG_ERR) + MSG_WARN("can't catch SIGUSR1\n"); + return new_bw; }