aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2011-06-18 10:07:29 -0400
committerJorge Arellano Cid <jcid@dillo.org>2011-06-18 10:07:29 -0400
commit2c2857f923c99ea38c63289702496feb46f9e7ca (patch)
tree18c7f69ae18ea8c9e35fbc9e10cf1b96ab21ab88 /dw
parent3fbfa30696de499dbc08635fee1188e0e488bf6d (diff)
Made dillorc's middle_click_drags_page=NO operative again
* Added setDragScroll(bool) to the viewport to enable/disable it * Made middle-click paste URL upon FL_RELEASE
Diffstat (limited to 'dw')
-rw-r--r--dw/fltkviewport.cc23
-rw-r--r--dw/fltkviewport.hh3
2 files changed, 17 insertions, 9 deletions
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc
index 75c4e569..992df22b 100644
--- a/dw/fltkviewport.cc
+++ b/dw/fltkviewport.cc
@@ -23,6 +23,7 @@
#include <FL/Fl.H>
#include <FL/fl_draw.H>
+#include <FL/names.h>
#include <stdio.h>
#include "../lout/msg.h"
@@ -64,6 +65,7 @@ FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
vscrollbar->hide();
add (vscrollbar);
+ hasDragScroll = 1;
scrollX = scrollY = scrollDX = scrollDY = 0;
horScrolling = verScrolling = dragScrolling = 0;
@@ -223,7 +225,7 @@ void FltkViewport::draw ()
int FltkViewport::handle (int event)
{
- _MSG("FltkViewport::handle %d\n", event);
+ _MSG("FltkViewport::handle %s\n", fl_eventnames[event]);
switch(event) {
case FL_KEYBOARD:
@@ -249,13 +251,18 @@ int FltkViewport::handle (int event)
} else if (hscrollbar->visible() && Fl::event_inside(hscrollbar)) {
if (hscrollbar->handle(event))
horScrolling = 1;
- } else if (FltkWidgetView::handle (event) == 0 &&
- Fl::event_button() == FL_MIDDLE_MOUSE) {
- /* pass event so that middle click can open link in new window */
- dragScrolling = 1;
- dragX = Fl::event_x();
- dragY = Fl::event_y();
- setCursor (core::style::CURSOR_MOVE);
+ } else if (FltkWidgetView::handle(event) == 0 &&
+ Fl::event_button() == FL_MIDDLE_MOUSE) {
+ if (!hasDragScroll) {
+ /* let the parent widget handle it... */
+ return 0;
+ } else {
+ /* receive FL_DRAG and FL_RELEASE */
+ dragScrolling = 1;
+ dragX = Fl::event_x();
+ dragY = Fl::event_y();
+ setCursor (core::style::CURSOR_MOVE);
+ }
}
return 1;
break;
diff --git a/dw/fltkviewport.hh b/dw/fltkviewport.hh
index 080d0f59..3df1dccb 100644
--- a/dw/fltkviewport.hh
+++ b/dw/fltkviewport.hh
@@ -21,7 +21,7 @@ private:
int scrollX, scrollY;
int scrollDX, scrollDY;
- int dragScrolling, dragX, dragY;
+ int hasDragScroll, dragScrolling, dragX, dragY;
int horScrolling, verScrolling;
Fl_Scrollbar *vscrollbar, *hscrollbar;
@@ -70,6 +70,7 @@ public:
void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
GadgetOrientation gadgetOrientation);
+ void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
void addGadget (Fl_Widget *gadget);
};