Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #288 from Cody-G/cjg/mousebuttons_drag
Browse files Browse the repository at this point in the history
Allow click-and-drag using mouse buttons 2 or 3
  • Loading branch information
tknopp authored Mar 3, 2017
2 parents c8cb239 + af7eae2 commit 5f9f3b2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@ type MouseHandler
button3release::Function
motion::Function
button1motion::Function
button2motion::Function
button3motion::Function
scroll::Function
stack::MHStack
widget::GtkWidget

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

Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 5f9f3b2

Please sign in to comment.