lib/rabbit/gesture/handler.rb in rabbit-2.2.1 vs lib/rabbit/gesture/handler.rb in rabbit-3.0.0
- old
+ new
@@ -1,5 +1,21 @@
+# Copyright (C) 2006-2017 Kouhei Sutou <kou@cozmixng.org>
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
require 'rabbit/gtk'
require 'rabbit/rabbit'
require 'rabbit/renderer/engine'
require 'rabbit/gesture/processor'
@@ -77,11 +93,12 @@
end
def draw(renderer)
if @back_color.alpha == 1.0 or
(@back_color.alpha < 1.0 and renderer.alpha_available?)
- args = [true, 0, 0, renderer.width, renderer.height]
+ size = renderer.size
+ args = [true, 0, 0, size.real_width, size.real_height]
args << @back_color
renderer.draw_rectangle(*args)
end
draw_available_marks(renderer, next_available_motions)
@@ -158,10 +175,12 @@
def draw_action_image(renderer, act, x, y)
icon = nil
icon = act.create_icon(Gtk::IconSize::DIALOG) if act
if icon
- pixbuf = icon.render_icon(icon.stock, icon.icon_size, act.name)
+ stock, = icon.stock
+ icon_size = icon.icon_size
+ pixbuf = icon.render_icon_pixbuf(stock, icon_size)
x -= pixbuf.width / 2.0
y -= pixbuf.height / 2.0
renderer.draw_pixbuf(pixbuf, x, y)
elsif block_given?
yield