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

Commit

Permalink
fix for julia v1.5; jl_function_ptr was removed
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 3, 2020
1 parent 8a04aab commit dfa02b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/GLib/GLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ export @sigatom, cfunction_


cfunction_(f, r, a::Tuple) = cfunction_(f, r, Tuple{a...})
@noinline function cfunction_(f, r, a)
@nospecialize(f, r, a)
return ccall((:jl_function_ptr,:libjulia), Ptr{Cvoid}, (Any, Any, Any), f, r, a)

@generated function cfunction_(f, R::Type{rt}, A::Type{at}) where {rt, at<:Tuple}
quote
@cfunction($(Expr(:$,:f)), $rt, ($(at.parameters...),))
end
end

# local function, handles Symbol and makes UTF8-strings easier
Expand Down
8 changes: 2 additions & 6 deletions src/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,15 @@ end

mutable struct Gtk_signal_motion{T}
closure::T
callback::Ptr{Nothing}
callback::Base.CFunction
include::UInt32
exclude::UInt32
end
function notify_motion(p::Ptr{GObject}, eventp::Ptr{GdkEventMotion}, closure::Gtk_signal_motion{T}) where T
event = unsafe_load(eventp)
if event.state & closure.include == closure.include &&
event.state & closure.exclude == 0
if isbitstype(T)
ret = ccall(closure.callback, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, T), p, eventp, closure.closure)
else
ret = ccall(closure.callback, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, Any), p, eventp, closure.closure)
end
ret = closure.callback.f(p, eventp, closure.closure)
else
ret = Int32(false)
end
Expand Down

0 comments on commit dfa02b1

Please sign in to comment.