Skip to content

Commit

Permalink
info-window: set colors explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Dec 4, 2023
1 parent 13f32ae commit 7faf060
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/rabbit/info-window.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2006-2018 Kouhei Sutou <[email protected]>
# Copyright (C) 2006-2023 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -230,7 +230,12 @@ def init_canvas_widgets
def init_timer_area
@timer_area = Gtk::DrawingArea.new
@timer_area.signal_connect("draw") do |area, context|
context.set_source_rgb(1, 0, 0) if rest_time and rest_time < 0
draw_background(area, context)
if rest_time and rest_time < 0
context.set_source_rgb(1, 0, 0)
else
context.set_source_rgb(0, 0, 0)
end
draw_text_as_large_as_possible(area,
context,
timer_text,
Expand All @@ -242,6 +247,8 @@ def init_timer_area
def init_note_area
@note_area = Gtk::DrawingArea.new
@note_area.signal_connect("draw") do |area, context|
draw_background(area, context)
context.set_source_rgb(0, 0, 0)
draw_text_as_large_as_possible(area, context, note_text)
Gdk::Event::PROPAGATE
end
Expand All @@ -253,6 +260,13 @@ def update
adjust_slide
end

def draw_background(area, context)
context.save do
context.set_source_rgb(1, 1, 1)
context.paint
end
end

def note_text
note = @canvas.current_slide["note"]
return note if note.nil?
Expand Down

0 comments on commit 7faf060

Please sign in to comment.