Dillo-dev
By thread
dillo-dev@mailman3.com
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
April 2008
- 7 participants
- 206 messages
patch: motionNotify when scrolling (Re: patch: Re: [Dillo-dev] start on image maps (dw-part))
by Johannes.Hofmann@gmx.de
On Wed, Apr 23, 2008 at 06:08:27AM +0000, corvid wrote:
> Johannes wrote:
> > On Tue, Apr 22, 2008 at 02:05:43PM +0000, corvid wrote:
> > > Speaking of motionNotify, the other day I was looking into getting the
> > > link in the status bar to change when scrolling. I'd gotten as far as
> > > figuring out that maybe *checks notes* Layout::scrollPosChanged could call
> > > Layout::motionNotify, but then I got stuck because I didn't know where to
> > > get current cursor coordinates from.
> >
> > In fltk one can call get_mouse(int &x, int &y). But I'm not sure
> > how to wrap this properly. Perhaps adding a similar method to
> > Platform? What about different views, can they all have separate
> > pointer devices?
> > Just checked dillo1. It handles at least the scrolling case
> > properly.
>
> Ah, indeed. It turns out that old dillo sets viewport->mouse_[xy] in
> Dw_gtk_viewport_motion_notify()
> and then has a
> static void Dw_gtk_viewport_adj_changed (GtkAdjustment *adj,
> GtkDwViewport *viewport)
> {
> Dw_gtk_viewport_mouse_event (GTK_WIDGET (viewport),
> viewport->mouse_x, viewport->mouse_y, NULL);
> }
>
> Attached is a patch similar to this.
>
> It works for scrolling and when I close a window that had been
> obscuring the viewport (it gets ENTER and FOCUS. I chose ENTER).
> It does not work when I page around with my window manager because the only
> event the viewport handler sees is KEYUP, and I didn't like the idea
> of using KEYUP for this.
Nice! But there is still other cases, like going back with
<Backspace> such that the cursor ends up over a link.
Or incremental rendering such that the cursor ends up over a link (
(to reproduce go to a slow page, move the cursor over a link and
press <Ctrl>-r to reload).
I'm not sure how to handle these cases where the movement is
initiated by the layout rather than the view.
I'd like to have a general mechanism like
Layout::canvasMousePosChanged () that can be called in all these
cases.
Johannes
April 23, 2008
dillo-fltk exits on SIGPIPE
by Johannes.Hofmann@gmx.de
Hi,
do you also see exits on SIGPIPE e.g. on:
http://daily.daemonnews.org
dillo 1 had signal(SIGPIPE, SIG_IGN);
which dillo-fltk is missing.
Cheers,
Johannes
April 23, 2008
patch: motionNotify when scrolling (Re: patch: Re: [Dillo-dev] start on image maps (dw-part))
by corvid@lavabit.com
Johannes wrote:
> On Tue, Apr 22, 2008 at 02:05:43PM +0000, corvid wrote:
> > Speaking of motionNotify, the other day I was looking into getting the
> > link in the status bar to change when scrolling. I'd gotten as far as
> > figuring out that maybe *checks notes* Layout::scrollPosChanged could call
> > Layout::motionNotify, but then I got stuck because I didn't know where to
> > get current cursor coordinates from.
>
> In fltk one can call get_mouse(int &x, int &y). But I'm not sure
> how to wrap this properly. Perhaps adding a similar method to
> Platform? What about different views, can they all have separate
> pointer devices?
> Just checked dillo1. It handles at least the scrolling case
> properly.
Ah, indeed. It turns out that old dillo sets viewport->mouse_[xy] in
Dw_gtk_viewport_motion_notify()
and then has a
static void Dw_gtk_viewport_adj_changed (GtkAdjustment *adj,
GtkDwViewport *viewport)
{
Dw_gtk_viewport_mouse_event (GTK_WIDGET (viewport),
viewport->mouse_x, viewport->mouse_y, NULL);
}
Attached is a patch similar to this.
It works for scrolling and when I close a window that had been
obscuring the viewport (it gets ENTER and FOCUS. I chose ENTER).
It does not work when I page around with my window manager because the only
event the viewport handler sees is KEYUP, and I didn't like the idea
of using KEYUP for this.
April 23, 2008
dillo seems to close file descriptors twice
by Johannes.Hofmann@gmx.de
Hi,
I just noticed, that dillo seems to close file descriptors twice via
IO_close_fd, which causes problems when other threads run in parallel
for name server queries.
Here are the two call stacks via which IO_close_fd is called
for each fd:
(gdb) b IO_close_fd
Breakpoint 1 at 0x8070781: file IO.c, line 137.
(gdb) r dillo.org
Starting program:
/home/hofmann/projects/dillo/plain/dillo2-hg/src/dillo-fltk
dillo.org
dillo_dns_init: Here we go! (threaded)
Enabling cookies as from cookiesrc...
Nav_open_url: new url='http://dillo.org'
Dns_server [0]: dillo.org is 0x28559680
Connecting to 134.102.206.165
Nav_open_url: new url='http://www.dillo.org/'
Breakpoint 1, IO_close_fd (io=0x28550a00, CloseCode=2) at IO.c:137
137 fprintf(stderr,"====> begin IO close (%d)\n", io->FD);
Current language: auto; currently c
(gdb) bt
#0 IO_close_fd (io=0x28550a00, CloseCode=2) at IO.c:137
#1 0x0807094e in a_IO_ccc (Op=4, Branch=1, Dir=2, Info=0x285509e0, Data1=0x0, Data2=0x0) at IO.c:392
#2 0x0805633e in a_Chain_bcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:98
#3 0x0806ea14 in a_Http_ccc (Op=4, Branch=1, Dir=2, Info=0x2854df60, Data1=0x0, Data2=0x0) at http.c:522
#4 0x0805633e in a_Chain_bcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:98
#5 0x0805a514 in a_Capi_ccc (Op=4, Branch=1, Dir=2, Info=0x2854df40, Data1=0x0, Data2=0x0) at capi.c:491
#6 0x0805a39c in a_Capi_ccc (Op=4, Branch=2, Dir=1, Info=0x285509a0, Data1=0x0, Data2=0x0) at capi.c:601
#7 0x0805630a in a_Chain_fcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:86
#8 0x0806ffd1 in a_Dpi_ccc (Op=4, Branch=2, Dir=1, Info=0x28550bc0, Data1=0x0, Data2=0x0) at dpi.c:671
#9 0x0805630a in a_Chain_fcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:86
#10 0x08070891 in a_IO_ccc (Op=4, Branch=2, Dir=1, Info=0x28550c00, Data1=0x28550c20, Data2=0x0) at IO.c :410
#11 0x08070b64 in IO_callback (fd=<value optimized out>, io=0x28550c20) at IO.c:201
#12 0x08070beb in IO_fd_read_cb (fd=7, data=0x2) at IO.c:277
#13 0x080bcfe5 in fltk::wait ()
#14 0x080bd195 in fltk::run ()
#15 0x0804eadb in main (argc=0, argv=0x0) at dillo.cc:110
(gdb) c
Continuing.
====> begin IO close (7)
Breakpoint 1, IO_close_fd (io=0x28550c20, CloseCode=2) at IO.c:137
137 fprintf(stderr,"====> begin IO close (%d)\n", io->FD);
(gdb) bt
#0 IO_close_fd (io=0x28550c20, CloseCode=2) at IO.c:137
#1 0x0807089e in a_IO_ccc (Op=4, Branch=2, Dir=1, Info=0x28550c00, Data1=0x28550c20, Data2=0x0) at IO.c:411
#2 0x08070b64 in IO_callback (fd=<value optimized out>,
io=0x28550c20) at IO.c:201
#3 0x08070beb in IO_fd_read_cb (fd=7, data=0x2) at IO.c:277
#4 0x080bcfe5 in fltk::wait ()
#5 0x080bd195 in fltk::run ()
#6 0x0804eadb in main (argc=0, argv=0x0) at dillo.cc:110
(gdb) c
Continuing.
====> begin IO close (7)
A line like
fprintf(stderr,"====> begin IO close (%d)\n", io->FD);
at the beginning of IO_close_fd() also shows the problem.
Cheers,
Johannes
April 22, 2008
[patch] phrase search
by Johannes.Hofmann@gmx.de
Hi,
attached is a patch that make phrase search work. I'm not 100% sure
about the CharIterator::prev() change. CharIterator::next() returned
\0 between words, prev() didn't. So something was wrong.
I decided to go with current next() behaviour and made prev() return
\0 as word separator too.
Also the current implementation only works if one enters exactly one
blank between words in the search dialog. Should we collapse multiple
blanks into one automatically?
Cheers,
Johannes
April 22, 2008
patch: Re: [Dillo-dev] start on image maps (dw-part)
by Johannes.Hofmann@gmx.de
On Tue, Apr 22, 2008 at 02:05:43PM +0000, corvid wrote:
> Johannes wrote:
> > On Tue, Apr 22, 2008 at 04:50:32AM +0000, corvid wrote:
> > > dillo:
> > > - I imagine the setUseMap() in open_img() is probably supposed to be
> > > routed through DilloImage.
> > > - Html_read_coords() was borrowed from 0.8.6 and modified a fair amount.
> > > For one thing, the old code couldn't handle whitespace preceding a comma.
> > > - I didn't really like that dReturn_if_fail so far down in open_area()
> > > since coords is dynamically allocated now, but I left it there.
> >
> >
> > What about deleting coords earlier? I think they are no longer
> > needed once the shape has been constructed.
>
> That's true. I had just reached a point where the code was already tested
> and I didn't want to mess with anything for fear of introducing some error
> at the last moment ("this doesn't work at all! did you even compile it?" :))
>
> > Regarding your comment in Image::enterNotifyImpl(). I noticed that
> > too, but enterNotifyImpl() simply notifies about the enter
> > event, so no coordinates are needed.
> > Don't you think that implementing map aware Image::motionNotifyImpl()
> > is enough?
>
> You're probably right. I wasn't sure whether it would get a motionNotify
> when it first entered the image.
>
> Speaking of motionNotify, the other day I was looking into getting the
> link in the status bar to change when scrolling. I'd gotten as far as
> figuring out that maybe *checks notes* Layout::scrollPosChanged could call
> Layout::motionNotify, but then I got stuck because I didn't know where to
> get current cursor coordinates from.
>
In fltk one can call get_mouse(int &x, int &y). But I'm not sure
how to wrap this properly. Perhaps adding a similar method to
Platform? What about different views, can they all have separate
pointer devices?
Just checked dillo1. It handles at least the scrolling case
properly.
April 22, 2008
patch: Re: [Dillo-dev] start on image maps (dw-part)
by corvid@lavabit.com
Johannes wrote:
> On Tue, Apr 22, 2008 at 04:50:32AM +0000, corvid wrote:
> > dillo:
> > - I imagine the setUseMap() in open_img() is probably supposed to be
> > routed through DilloImage.
> > - Html_read_coords() was borrowed from 0.8.6 and modified a fair amount.
> > For one thing, the old code couldn't handle whitespace preceding a comma.
> > - I didn't really like that dReturn_if_fail so far down in open_area()
> > since coords is dynamically allocated now, but I left it there.
>
>
> What about deleting coords earlier? I think they are no longer
> needed once the shape has been constructed.
That's true. I had just reached a point where the code was already tested
and I didn't want to mess with anything for fear of introducing some error
at the last moment ("this doesn't work at all! did you even compile it?" :))
> Regarding your comment in Image::enterNotifyImpl(). I noticed that
> too, but enterNotifyImpl() simply notifies about the enter
> event, so no coordinates are needed.
> Don't you think that implementing map aware Image::motionNotifyImpl()
> is enough?
You're probably right. I wasn't sure whether it would get a motionNotify
when it first entered the image.
Speaking of motionNotify, the other day I was looking into getting the
link in the status bar to change when scrolling. I'd gotten as far as
figuring out that maybe *checks notes* Layout::scrollPosChanged could call
Layout::motionNotify, but then I got stuck because I didn't know where to
get current cursor coordinates from.
April 22, 2008
patch: Re: [Dillo-dev] start on image maps (dw-part)
by Johannes.Hofmann@gmx.de
On Tue, Apr 22, 2008 at 04:50:32AM +0000, corvid wrote:
> dw: I added motionNotifyImpl() and currLink
Wow, that was fast! Works fine so far :-)
>
> dillo:
> - I imagine the setUseMap() in open_img() is probably supposed to be
> routed through DilloImage.
> - Html_read_coords() was borrowed from 0.8.6 and modified a fair amount.
> For one thing, the old code couldn't handle whitespace preceding a comma.
> - I didn't really like that dReturn_if_fail so far down in open_area()
> since coords is dynamically allocated now, but I left it there.
What about deleting coords earlier? I think they are no longer
needed once the shape has been constructed.
Regarding your comment in Image::enterNotifyImpl(). I noticed that
too, but enterNotifyImpl() simply notifies about the enter
event, so no coordinates are needed.
Don't you think that implementing map aware Image::motionNotifyImpl()
is enough?
Cheers,
Johannes
>
> diff -pur dw2/dw/image.cc dw2-cur/dw/image.cc
> --- dw2/dw/image.cc 2008-03-13 14:56:16.000000000 +0000
> +++ dw2-cur/dw/image.cc 2008-04-22 04:16:21.000000000 +0000
> @@ -25,12 +25,49 @@
>
> namespace dw {
>
> +ImageMapsList::ImageMap::ImageMap ()
> +{
> + shapesAndLinks = new container::typed::List <ShapeAndLink> (true);
> +}
> +
> +ImageMapsList::ImageMap::~ImageMap ()
> +{
> + delete shapesAndLinks;
> +}
> +
> +void ImageMapsList::ImageMap::add (core::Shape *shape, int link) {
> + ShapeAndLink *shapeAndLink = new ShapeAndLink ();
> + shapeAndLink->shape = shape;
> + shapeAndLink->link = link;
> + shapesAndLinks->append (shapeAndLink);
> +}
> +
> +int ImageMapsList::ImageMap::link (int x, int y) {
> + container::typed::Iterator <ShapeAndLink> it;
> + int link = -1;
> +
> + for (it = shapesAndLinks->iterator (); it.hasNext (); ) {
> + ShapeAndLink *shapeAndLink = it.getNext ();
> +
> + if (shapeAndLink->shape->isPointWithin (x, y)) {
> + link = shapeAndLink->link;
> + break;
> + }
> + }
> +
> + return link;
> +}
> +
> ImageMapsList::ImageMapsList ()
> {
> + imageMaps = new container::typed::HashTable <object::Object, ImageMap>
> + (true, true);
> + currentMap = NULL;
> }
>
> ImageMapsList::~ImageMapsList ()
> {
> + delete imageMaps;
> }
>
> /**
> @@ -38,20 +75,34 @@ ImageMapsList::~ImageMapsList ()
> *
> * This has to be called before dw::ImageMapsList::addShapeToCurrentMap.
> * "key" is owned by the image map list, so a copy should be passed, when
> - * nessary.
> + * necessary.
> */
> void ImageMapsList::startNewMap (object::Object *key)
> {
> + currentMap = new ImageMap ();
> + imageMaps->put (key, currentMap);
> }
>
> /**
> * \brief Add a shape to the current map-
> *
> * "shape" is owned by the image map list, so a copy should be passed, when
> - * nessary.
> + * necessary.
> */
> void ImageMapsList::addShapeToCurrentMap (core::Shape *shape, int link)
> {
> + currentMap->add (shape, link);
> +}
> +
> +int ImageMapsList::link (object::Object *key, int x, int y)
> +{
> + int link = -1;
> + ImageMap *map = imageMaps->get (key);
> +
> + if (map)
> + link = map->link (x, y);
> +
> + return link;
> }
>
> // ----------------------------------------------------------------------
> @@ -65,6 +116,9 @@ Image::Image(const char *altText)
> altTextWidth = -1; // not yet calculated
> buffer = NULL;
> clicking = false;
> + currLink = -1;
> + mapList = NULL;
> + mapKey = NULL;
> }
>
> Image::~Image()
> @@ -139,10 +193,11 @@ void Image::sizeAllocateImpl (core::Allo
>
> void Image::enterNotifyImpl (core::EventCrossing *event)
> {
> - int link = getStyle()->x_link;
> + // BUG: this is wrong for image maps, but the cursor position is unknown.
> + currLink = getStyle()->x_link;
>
> - if (link != -1) {
> - (void) emitLinkEnter (link, -1, -1, -1);
> + if (currLink != -1) {
> + (void) emitLinkEnter (currLink, -1, -1, -1);
> }
> }
>
> @@ -150,18 +205,36 @@ void Image::leaveNotifyImpl (core::Event
> {
> clicking = false;
>
> - if (getStyle()->x_link != -1) {
> + if (currLink != -1) {
> + currLink = -1;
> (void) emitLinkEnter (-1, -1, -1, -1);
> }
> }
>
> +bool Image::motionNotifyImpl (core::EventMotion *event)
> +{
> + if (mapList) {
> + int newLink = mapList->link (mapKey, event->xWidget, event->yWidget);
> + if (newLink != currLink) {
> + currLink = newLink;
> + clicking = false;
> + setCursor(newLink == -1 ? core::style::CURSOR_DEFAULT :
> + core::style::CURSOR_POINTER);
> + (void) emitLinkEnter (newLink, -1, -1, -1);
> + }
> + }
> + return true;
> +}
> +
> bool Image::buttonPressImpl (core::EventButton *event)
> {
> bool ret = false;
> + currLink = mapList ? mapList->link (mapKey, event->xWidget, event->yWidget):
> + getStyle()->x_link;
> if (event->button == 3){
> - (void)emitLinkPress(getStyle()->x_link, getStyle()->x_img, -1,-1,event);
> + (void)emitLinkPress(currLink, getStyle()->x_img, -1,-1,event);
> ret = true;
> - } else if (event->button == 1 || getStyle()->x_link != -1){
> + } else if (event->button == 1 || currLink != -1){
> clicking = true;
> ret = true;
> }
> @@ -170,9 +243,11 @@ bool Image::buttonPressImpl (core::Event
>
> bool Image::buttonReleaseImpl (core::EventButton *event)
> {
> + currLink = mapList ? mapList->link (mapKey, event->xWidget, event->yWidget):
> + getStyle()->x_link;
> if (clicking) {
> clicking = false;
> - emitLinkClick (getStyle()->x_link, getStyle()->x_img, -1, -1, event);
> + emitLinkClick (currLink, getStyle()->x_img, -1, -1, event);
> return true;
> }
> return false;
> @@ -290,8 +365,10 @@ void Image::setIsMap ()
> * is owned by the image, if it is used by the caller afterwards, a copy
> * should be passed.
> */
> -void setUseMap (ImageMapsList *list, object::Object *key)
> +void Image::setUseMap (ImageMapsList *list, object::Object *key)
> {
> + mapList = list;
> + mapKey = key;
> }
>
> } // namespace dw
> diff -pur dw2/dw/image.hh dw2-cur/dw/image.hh
> --- dw2/dw/image.hh 2008-02-08 18:06:56.000000000 +0000
> +++ dw2-cur/dw/image.hh 2008-04-21 23:39:03.000000000 +0000
> @@ -22,12 +22,36 @@ namespace dw {
> */
> class ImageMapsList
> {
> +private:
> + class ImageMap: public object::Object {
> + private:
> + class ShapeAndLink: public object::Object {
> + public:
> + core::Shape *shape;
> + int link;
> +
> + ~ShapeAndLink () { if (shape) delete shape; };
> + };
> +
> + container::typed::List <ShapeAndLink> *shapesAndLinks;
> + public:
> + ImageMap ();
> + ~ImageMap ();
> +
> + void add (core::Shape *shape, int link);
> + int link (int x, int y);
> + };
> +
> + container::typed::HashTable <object::Object, ImageMap> *imageMaps;
> + ImageMap *currentMap;
> +
> public:
> ImageMapsList ();
> ~ImageMapsList ();
>
> void startNewMap (object::Object *key);
> void addShapeToCurrentMap (core::Shape *shape, int link);
> + int link (object::Object *key, int x, int y);
> };
>
> /**
> @@ -92,6 +116,9 @@ private:
> core::Imgbuf *buffer;
> int altTextWidth;
> bool clicking;
> + int currLink;
> + ImageMapsList *mapList;
> + Object *mapKey;
>
> protected:
> void sizeRequestImpl (core::Requisition *requisition);
> @@ -103,7 +130,7 @@ protected:
> bool buttonReleaseImpl (core::EventButton *event);
> void enterNotifyImpl (core::EventCrossing *event);
> void leaveNotifyImpl (core::EventCrossing *event);
> - //bool motionNotifyImpl (core::EventMotion *event);
> + bool motionNotifyImpl (core::EventMotion *event);
>
> //core::Iterator *iterator (Content::Type mask, bool atEnd);
>
> --- dillo2/src/html.cc 2008-04-17 22:18:33.000000000 +0000
> +++ dillo2-cur/src/html.cc 2008-04-22 04:39:08.000000000 +0000
> @@ -323,7 +323,7 @@ public: //BUG: for now everything is pu
> misc::SimpleVector<DilloHtmlForm> *forms;
> misc::SimpleVector<DilloUrl*> *links;
> misc::SimpleVector<DilloLinkImage*> *images;
> - //DwImageMapList maps;
> + ImageMapsList maps;
>
> int32_t link_color;
> int32_t visited_color;
> @@ -2905,7 +2905,6 @@ static void Html_tag_open_img(DilloHtml
> if (load_now)
> Html_load_image(html->bw, url, Image);
>
> -#if 0
> /* Image maps */
> if (Html_get_attr(html, tag, tagsize, "ismap")) {
> /* BUG: if several ISMAP images follow each other without
> @@ -2914,17 +2913,17 @@ static void Html_tag_open_img(DilloHtml
> // a_Dw_image_set_ismap (Image->dw);
> _MSG(" Html_tag_open_img: server-side map (ISMAP)\n");
> } else if (S_TOP(html)->style->x_link != -1 &&
> - usemap_url == NULL)
> + usemap_url == NULL) {
> /* For simple links, we have to suppress the "image_pressed" signal.
> * This is overridden for USEMAP images. */
> // a_Dw_widget_set_button_sensitive (IM2DW(Image->dw), FALSE);
> + }
>
> if (usemap_url) {
> -// a_Dw_image_set_usemap (Image->dw, &html->maps, usemap_url);
> + ((::dw::Image*)Image->dw)->setUseMap(&html->maps,
> + new ::object::String(usemap_url->url_string->str));
> a_Url_free (usemap_url);
> }
> -#endif
> -
> html->connectSignals((Widget*)Image->dw);
> }
>
> @@ -2943,7 +2942,7 @@ static void Html_tag_open_map(DilloHtml
> if ((attrbuf = Html_get_attr(html, tag, tagsize, "name"))) {
> hash_name = dStrconcat("#", attrbuf, NULL);
> url = Html_url_new(html, hash_name, NULL, 0, 0, 0, 0);
> - //a_Dw_image_map_list_add_map (&html->maps, url);
> + html->maps.startNewMap(new ::object::String(url->url_string->str));
> a_Url_free (url);
> dFree(hash_name);
> }
> @@ -2961,56 +2960,111 @@ static void Html_tag_close_map(DilloHtml
> }
>
> /*
> + * Read coords in a string, returning a vector of ints.
> + */
> +static
> +misc::SimpleVector<int> *Html_read_coords(DilloHtml *html, const char *str)
> +{
> + int i, coord;
> + const char *tail = str;
> + char *newtail = NULL;
> + misc::SimpleVector<int> *coords = new misc::SimpleVector<int> (4);
> +
> + i = 0;
> + while (1) {
> + coord = strtol(tail, &newtail, 10);
> + if (coord == 0 && newtail == tail)
> + break;
> + coords->increase();
> + coords->set(coords->size() - 1, coord);
> + while (isspace(*newtail))
> + newtail++;
> + if (!*newtail)
> + break;
> + if (*newtail != ',') {
> + MSG_HTML("usemap coords MUST be separated by commas.\n");
> + }
> + tail = newtail + 1;
> + }
> +
> + return coords;
> +}
> +
> +/*
> * <AREA>
> */
> static void Html_tag_open_area(DilloHtml *html, const char *tag, int tagsize)
> {
> -// // AL
> -// /* todo: point must be a dynamic array */
> -// GdkPoint point[1024];
> -// DilloUrl* url;
> -// const char *attrbuf;
> -// int type = DW_IMAGE_MAP_SHAPE_RECT;
> -// int nbpoints, link = -1;
> -//
> -// if ((attrbuf = Html_get_attr(html, tag, tagsize, "shape"))) {
> -// if (dStrcasecmp(attrbuf, "rect") == 0)
> -// type = DW_IMAGE_MAP_SHAPE_RECT;
> -// else if (dStrcasecmp(attrbuf, "circle") == 0)
> -// type = DW_IMAGE_MAP_SHAPE_CIRCLE;
> -// else if (dStrncasecmp(attrbuf, "poly", 4) == 0)
> -// type = DW_IMAGE_MAP_SHAPE_POLY;
> -// else
> -// type = DW_IMAGE_MAP_SHAPE_RECT;
> -// }
> -// /* todo: add support for coords in % */
> -// if ((attrbuf = Html_get_attr(html, tag, tagsize, "coords"))) {
> -// /* Is this a valid poly ?
> -// * rect = x0,y0,x1,y1 => 2
> -// * circle = x,y,r => 2
> -// * poly = x0,y0,x1,y1,x2,y2 minimum => 3 */
> -// nbpoints = Html_read_coords(html, attrbuf, point);
> -// } else
> -// return;
> -//
> -// if (Html_get_attr(html, tag, tagsize, "nohref")) {
> -// link = -1;
> -// _MSG("nohref");
> -// }
> -//
> -// if ((attrbuf = Html_get_attr(html, tag, tagsize, "href"))) {
> -// url = Html_url_new(html, attrbuf, NULL, 0, 0, 0, 0);
> -// dReturn_if_fail ( url != NULL );
> -// if ((attrbuf = Html_get_attr(html, tag, tagsize, "alt")))
> -// a_Url_set_alt(url, attrbuf);
> -//
> -// link = Html_set_new_link(html, &url);
> -// }
> -//
> -// a_Dw_image_map_list_add_shape(&html->maps, type, link,
> -// point, nbpoints);
> -}
> + misc::SimpleVector<int> *coords;
> + DilloUrl* url;
> + const char *attrbuf;
> + int link = -1;
> + Shape *shape = NULL;
> +
> + if (!(html->InFlags & IN_MAP)) {
> + MSG_HTML("<area> element not inside <map>\n");
> + return;
> + }
> +
> + /* todo: add support for coords in % */
> + if ((attrbuf = Html_get_attr(html, tag, tagsize, "coords"))) {
> + coords = Html_read_coords(html, attrbuf);
> + } else
> + return;
> +
> + attrbuf = Html_get_attr(html, tag, tagsize, "shape");
>
> + if (!attrbuf || !*attrbuf || !dStrcasecmp(attrbuf, "rect")) {
> + /* the default shape is a rectangle */
> + if (coords->size() != 4)
> + MSG_HTML("<area> rectangle must have four coordinate values\n");
> + if (coords->size() >= 4)
> + shape = new Rectangle(coords->get(0),
> + coords->get(1),
> + coords->get(2) - coords->get(0),
> + coords->get(3) - coords->get(1));
> + } else if (dStrcasecmp(attrbuf, "default") == 0) {
> + /* "Specifies the entire region." "default" is not the default shape. */
> + MSG("<area> shape=default not implemented.\n");
> + } else if (dStrcasecmp(attrbuf, "circle") == 0) {
> + if (coords->size() != 3)
> + MSG_HTML("<area> circle must have three coordinate values\n");
> + if (coords->size() >= 3)
> + shape = new Circle(coords->get(0), coords->get(1), coords->get(2));
> + } else if (dStrncasecmp(attrbuf, "poly", 4) == 0) {
> + Polygon *poly;
> + int i;
> + if (coords->size() % 2)
> + MSG_HTML("<area> polygon with odd number of coordinates\n");
> + shape = poly = new Polygon();
> + for (i = 0; i < (coords->size() / 2); i++)
> + poly->addPoint(coords->get(2*i), coords->get(2*i + 1));
> + if (i) {
> + /* be sure to close it */
> + poly->addPoint(coords->get(0), coords->get(1));
> + }
> + } else {
> + MSG_HTML("<area> unknown shape: \"%s\"\n", attrbuf);
> + }
> +
> + if (shape) {
> + if (Html_get_attr(html, tag, tagsize, "nohref")) {
> + link = -1;
> + _MSG("nohref");
> + }
> + if ((attrbuf = Html_get_attr(html, tag, tagsize, "href"))) {
> + url = Html_url_new(html, attrbuf, NULL, 0, 0, 0, 0);
> + dReturn_if_fail ( url != NULL );
> + if ((attrbuf = Html_get_attr(html, tag, tagsize, "alt")))
> + a_Url_set_alt(url, attrbuf);
> +
> + link = Html_set_new_link(html, &url);
> + }
> + html->maps.addShapeToCurrentMap(shape, link);
> + }
> + if (coords)
> + delete(coords);
> +}
>
> /*
> * Test and extract the link from a javascript instruction.
> @@ -3064,7 +3118,8 @@ static void Html_tag_open_a(DilloHtml *h
> const char *attrbuf;
>
> /* todo: add support for MAP with A HREF */
> - Html_tag_open_area(html, tag, tagsize);
> + if (html->InFlags & IN_MAP)
> + Html_tag_open_area(html, tag, tagsize);
>
> if ((attrbuf = Html_get_attr(html, tag, tagsize, "href"))) {
> /* if it's a javascript link, extract the reference. */
> _______________________________________________
> Dillo-dev mailing list
> Dillo-dev(a)dillo.org
> http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
April 22, 2008
patch: Re: [Dillo-dev] start on image maps (dw-part)
by corvid@lavabit.com
dw: I added motionNotifyImpl() and currLink
dillo:
- I imagine the setUseMap() in open_img() is probably supposed to be
routed through DilloImage.
- Html_read_coords() was borrowed from 0.8.6 and modified a fair amount.
For one thing, the old code couldn't handle whitespace preceding a comma.
- I didn't really like that dReturn_if_fail so far down in open_area()
since coords is dynamically allocated now, but I left it there.
April 22, 2008
start on image maps (dw-part)
by corvid@lavabit.com
Johannes wrote:
> Here comes the dw-part of client side image maps. I could need some
> help to hook this up in html.cc so I can start testing it.
> Also the linkEmitter stuff in image.cc needs to be looked at by
> someone who knows how this works :-)
Okay, I recognize my cue here :)
I now have the dillo side working with it in a look-my-one-testcase-works! sense,
but still have to go through and look at the spec more closely and
make it robust and all that...
April 22, 2008