29 |
# It will create snapshot of following size |
# It will create snapshot of following size |
30 |
W=1024 |
W=1024 |
31 |
H=768 |
H=768 |
32 |
|
D=24 |
33 |
|
|
34 |
# and then resize it to (comment out to disable) |
# and then resize it to (comment out to disable) |
35 |
#RESIZE=200x |
#RESIZE=200x |
36 |
|
|
37 |
# turn locally visible server to watch progress |
# turn locally visible server to watch progress |
38 |
DEBUG=0 |
DEBUG=0 |
39 |
test ! -z "$3" && DEBUG=1 |
if [ ! -z "$3" ] ; then |
40 |
|
echo "DEBUG turned on" |
41 |
|
DEBUG=1 |
42 |
|
D=8 |
43 |
|
fi |
44 |
|
|
45 |
# wait for $WAIT seconds for page to load |
# wait for $WAIT seconds for page to load |
46 |
WAIT=30 |
WAIT=30 |
98 |
|
|
99 |
if [ "$DEBUG" == 1 ] ; then |
if [ "$DEBUG" == 1 ] ; then |
100 |
echo "using locally visible debug server on $LOCAL_DISPLAY" |
echo "using locally visible debug server on $LOCAL_DISPLAY" |
101 |
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 & |
102 |
else |
else |
103 |
echo "starting $XSERVER" |
echo "starting $XSERVER" |
104 |
$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 & |
105 |
fi |
fi |
106 |
|
|
107 |
if [ -z "$!" ] ; then |
if [ -z "$!" ] ; then |
175 |
|
|
176 |
ping_browser |
ping_browser |
177 |
|
|
|
$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!" |
|
|
|
|
178 |
# get Mozilla Firefox window id (for resize) |
# get Mozilla Firefox window id (for resize) |
179 |
WINDOW_ID=`xwininfo -display $DISPLAY -root -tree | grep gecko | cut -d\" -f1 | sort -n | head -1` |
WINDOW_ID=`xwininfo -display $DISPLAY -root -tree | grep gecko | cut -d\" -f1 | sort -n | head -1` |
180 |
|
|
192 |
|
|
193 |
ping_browser |
ping_browser |
194 |
|
|
195 |
|
$BROWSER -remote "openURL($FRAMESET)" 2>/dev/null |
196 |
|
|
197 |
|
echo "waiting for on_load event from browser $BROWSER_PID for ${WAIT}s" |
198 |
|
|
199 |
|
# there is hard-coded limit here: |
200 |
|
# we will wait $WAIT sec for page to load and render |
201 |
|
|
202 |
|
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!" |
203 |
|
|
204 |
# try to deduce inside area of window |
# try to deduce inside area of window |
205 |
|
|
206 |
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` |
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` |