Skip to content

Commit

Permalink
gtk4 drawing-area: use #set_draw_func
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 14, 2024
1 parent f95f38b commit 884f81e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/rabbit/renderer/display/drawing-area-primitive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,21 @@ def mapped(widget)
end

def set_draw
@area.signal_connect("draw") do |widget, context|
init_context(context)
draw(widget)
finish_renderer
Gdk::Event::PROPAGATE
if @area.respond_to?(:set_draw_func)
@area.set_draw_func do |area, context|
surface = area.native.surface
update_size(surface.width, surface.height)
init_context(context)
draw(area)
finish_renderer
end
else
@area.signal_connect("draw") do |widget, context|
init_context(context)
draw(widget)
finish_renderer
Gdk::Event::PROPAGATE
end
end
end

Expand Down

0 comments on commit 884f81e

Please sign in to comment.