another patch: allows clicking on images in links
Hello again, First, on the dw side: --- image.hh 2007-10-08 17:30:00.000000000 +0000 +++ image.hh.new 2007-10-08 17:36:38.000000000 +0000 @@ -91,6 +91,7 @@ char *altText; core::Imgbuf *buffer; int altTextWidth; + bool clicking; protected: void sizeRequestImpl (core::Requisition *requisition); @@ -98,8 +99,9 @@ void draw (core::View *view, core::Rectangle *area); - //bool buttonPressImpl (core::EventButton *event); - //bool buttonReleaseImpl (core::EventButton *event); + bool buttonPressImpl (core::EventButton *event); + bool buttonReleaseImpl (core::EventButton *event); + void leaveNotifyImpl (core::EventCrossing *event); //bool motionNotifyImpl (core::EventMotion *event); //core::Iterator *iterator (Content::Type mask, bool atEnd); --- image.cc 2007-10-08 16:50:47.000000000 +0000 +++ image.cc.new 2007-10-08 17:36:55.000000000 +0000 @@ -64,6 +64,7 @@ this->altText = altText ? strdup (altText) : NULL; altTextWidth = -1; // not yet calculated buffer = NULL; + clicking = false; } Image::~Image() @@ -125,6 +126,30 @@ } } +void Image::leaveNotifyImpl (core::EventCrossing *event) +{ + clicking = false; +} + +bool Image::buttonPressImpl (core::EventButton *event) +{ + clicking = true; + return true; +} + +bool Image::buttonReleaseImpl (core::EventButton *event) +{ + int idx; + if (clicking) { + clicking = false; + idx = getStyle()->x_link; + if (idx != -1) { + emitLinkClick (idx, -1, -1, event); + } + } + return true; +} + void Image::draw (core::View *view, core::Rectangle *area) { int dx, dy; And then on the dillo side: --- html.cc 2007-10-08 18:01:47.000000000 +0000 +++ html.cc.new 2007-10-08 18:04:00.000000000 +0000 @@ -2423,8 +2423,9 @@ /* Add a new image widget to this page */ Image = a_Image_new(0, 0, alt_ptr, S_TOP(html)->current_bg_color); if (add) { - Html_add_widget(html, (Widget*)Image->dw, - width_ptr, height_ptr, style_attrs); + Widget *w = (Widget*)Image->dw; + Html_add_widget(html, w, width_ptr, height_ptr, style_attrs); + Html_connect_signals(html, w); } dFree(width_ptr);
participants (1)
-
place