Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Commit

Permalink
fixes for GLFW 2.0 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Jun 13, 2018
1 parent 7e00292 commit 4aa52ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ returns `Signal{NTuple{4, Int}}`
"""
function keyboard_buttons(window, s::Signal{NTuple{4, Int}}=Signal((0,0,0,0)))
keydict = Dict{Int, Bool}()
GLFW.SetKeyCallback(window, (window, button::Cint, scancode::Cint, action::Cint, mods::Cint) -> begin
GLFW.SetKeyCallback(window, (window, button, scancode, action, mods) -> begin
push!(s, (Int(button), Int(scancode), Int(action), Int(mods)))
end)
s
Expand All @@ -62,7 +62,7 @@ containing the pressed button the action and modifiers.
[GLFW Docs](http://www.glfw.org/docs/latest/group__input.html#ga1e008c7a8751cea648c8f42cc91104cf)
"""
function mouse_buttons(window, s::Signal{NTuple{3, Int}}=Signal((0,0,0)))
GLFW.SetMouseButtonCallback(window, (window, button::Cint, action::Cint, mods::Cint) -> begin
GLFW.SetMouseButtonCallback(window, (window, button, action, mods) -> begin
push!(s, (Int(button), Int(action), Int(mods)))
end)
s
Expand Down
10 changes: 5 additions & 5 deletions src/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

function add_complex_signals!(screen)
@materialize keyboard_buttons, mouse_buttons = screen.inputs

no_scancode = map(remove_scancode, keyboard_buttons)

button_s = merge(
Expand Down Expand Up @@ -47,12 +47,12 @@ Builds a Set of keys, accounting for released and pressed keys
"""
function currently_pressed_keys(v0::Set{Int}, button_action_mods)
button, action, mods = button_action_mods
if button != GLFW.KEY_UNKNOWN
if action == GLFW.PRESS
if button != Int(GLFW.KEY_UNKNOWN)
if action == Int(GLFW.PRESS)
push!(v0, button)
elseif action == GLFW.RELEASE
elseif action == Int(GLFW.RELEASE)
delete!(v0, button)
elseif action == GLFW.REPEAT
elseif action == Int(GLFW.REPEAT)
# nothing needs to be done, besides returning the same set of keys
else
error("Unrecognized enum value for GLFW button press action: $action")
Expand Down
2 changes: 1 addition & 1 deletion src/screen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ function destroy!(screen::Screen)
end
if nw.handle != C_NULL
GLFW.DestroyWindow(nw)
nw.handle = C_NULL
# nw.handle = C_NULL
end
else # delete from parent
filter!(s-> !(s===screen), screen.parent.children) # remove from parent
Expand Down

0 comments on commit 4aa52ec

Please sign in to comment.