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

fix for julia v1.5; jl_function_ptr was removed #512

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 3 additions & 13 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::Function
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(p, eventp, closure.closure)
else
ret = Int32(false)
end
Expand All @@ -70,14 +66,8 @@ function on_signal_motion(move_cb::Function, widget::GtkWidget,
mask |= GdkEventMask.BUTTON_MOTION
end
add_events(widget, mask)
@assert Base.isstructtype(T)
if isbitstype(T)
cb = cfunction_(move_cb, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, T))
else
cb = cfunction_(move_cb, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, Ref{T}))
end
closure = Gtk_signal_motion{T}(
closure, cb,
closure, move_cb,
UInt32(include),
UInt32(exclude)
)
Expand Down