--- trunk/webthumb 2008/02/06 23:45:58 64 +++ trunk/webthumb 2008/02/06 23:59:09 65 @@ -29,13 +29,18 @@ # It will create snapshot of following size W=1024 H=768 +D=24 # and then resize it to (comment out to disable) #RESIZE=200x # turn locally visible server to watch progress DEBUG=0 -test ! -z "$3" && DEBUG=1 +if [ ! -z "$3" ] ; then + echo "DEBUG turned on" + DEBUG=1 + D=8 +fi # wait for $WAIT seconds for page to load WAIT=30 @@ -93,10 +98,10 @@ if [ "$DEBUG" == 1 ] ; then echo "using locally visible debug server on $LOCAL_DISPLAY" - DISPLAY=$LOCAL_DISPLAY Xephyr -ac -screen ${W}x${H}x24 $DISPLAY 2>/dev/null & + DISPLAY=$LOCAL_DISPLAY Xephyr -ac -screen ${W}x${H}x${D} $DISPLAY 2>/dev/null & else echo "starting $XSERVER" - $XSERVER -ac -screen 0 ${W}x${H}x24 $DISPLAY 2>/dev/null & + $XSERVER -ac -screen 0 ${W}x${H}x${D} $DISPLAY 2>/dev/null & fi if [ -z "$!" ] ; then @@ -170,15 +175,6 @@ ping_browser -$BROWSER -remote "openURL($FRAMESET)" 2>/dev/null - -echo "waiting for on_load event from browser $BROWSER_PID for ${WAIT}s" - -# there is hard-coded limit here: -# we will wait $WAIT sec for page to load and render - -echo -e "HTTP/1.0 304 Not modified\r\n\r\n" | nc -l -w $WAIT -p $PORT >/dev/null || echo "Timeout after $WAIT sec!" - # get Mozilla Firefox window id (for resize) WINDOW_ID=`xwininfo -display $DISPLAY -root -tree | grep gecko | cut -d\" -f1 | sort -n | head -1` @@ -196,6 +192,15 @@ ping_browser +$BROWSER -remote "openURL($FRAMESET)" 2>/dev/null + +echo "waiting for on_load event from browser $BROWSER_PID for ${WAIT}s" + +# there is hard-coded limit here: +# we will wait $WAIT sec for page to load and render + +echo -e "HTTP/1.0 304 Not modified\r\n\r\n" | nc -l -w $WAIT -p $PORT >/dev/null || echo "Timeout after $WAIT sec!" + # try to deduce inside area of window DUMP_ID=`xwininfo -display $DISPLAY -id $WINDOW_ID -tree | grep 0x | grep -v ${W}x${H} | grep ${W}x | head -1 | sed 's/^ *//' | cut -d' ' -f1`