From af7eae28be8acffcda9babbc153d6a3b9a7ff22a Mon Sep 17 00:00:00 2001 From: Cody Date: Fri, 3 Mar 2017 11:01:41 -0600 Subject: [PATCH] Allow click-and-drag using mouse buttons 2 or 3 (mimics existing implementation for mouse button 1) --- src/events.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/events.jl b/src/events.jl index 32c38b62..b59c2ac7 100644 --- a/src/events.jl +++ b/src/events.jl @@ -132,6 +132,8 @@ type MouseHandler button3release::Function motion::Function button1motion::Function + button2motion::Function + button3motion::Function scroll::Function stack::MHStack widget::GtkWidget @@ -139,6 +141,7 @@ type MouseHandler MouseHandler() = new(default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, default_mouse_cb, + default_mouse_cb, default_mouse_cb, Array(Tuple{Symbol, Function}, 0)) end @@ -157,11 +160,11 @@ end function mousedown_cb(ptr::Ptr, eventp::Ptr, this::MouseHandler) event = unsafe_load(eventp) - if event.button == 1 + if event.button == 1 this.button1press(this.widget, event) - elseif event.button == 2 + elseif event.button == 2 this.button2press(this.widget, event) - elseif event.button == 3 + elseif event.button == 3 this.button3press(this.widget, event) end Int32(false) @@ -184,6 +187,10 @@ function mousemove_cb(ptr::Ptr, eventp::Ptr, this::MouseHandler) this.motion(this.widget, event) if event.state & GdkModifierType.BUTTON1 != 0 this.button1motion(this.widget, event) + elseif event.state & GdkModifierType.BUTTON2 != 0 + this.button2motion(this.widget, event) + elseif event.state & GdkModifierType.BUTTON3 != 0 + this.button3motion(this.widget, event) end Int32(false) end