gtk3 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/extconf.rb +4 -3
- data/lib/gtk3/icon-theme.rb +4 -4
- data/lib/gtk3/loader.rb +7 -0
- data/lib/gtk3/text-view.rb +19 -8
- data/sample/gtk-demo/TODO +1 -1
- data/sample/gtk-demo/drawingarea.rb +1 -1
- data/sample/gtk-demo/event_axes.rb +375 -0
- data/test/run-test.rb +3 -3
- data/test/test-gtk-icon-theme.rb +5 -5
- data/test/test-gtk-search-bar.rb +0 -14
- data/test/test-gtk-text-view.rb +3 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e5cd9440f84cece863dc35eb2167b7ceeccbe02
|
4
|
+
data.tar.gz: dc92c2d5113062996d2a351125fa83a4ed1e5767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe10e2af8fcd94c75243c951943891ce2c41c80620a30ad1eccdca061843ffd5ed85c0a75e3b9696f3d7451721ce5a93a14404868c89572d1915f38186d0547d
|
7
|
+
data.tar.gz: 988378e6bf07346490017fb77204a3d48942edf87d4e9a60f47363c2e003914aa204c363a0253b3bb65c481e5e74e5aa07afcb4bc448e59856628c77635938ea
|
data/ext/gtk3/extconf.rb
CHANGED
@@ -46,7 +46,8 @@ depended_packages = [
|
|
46
46
|
"pango",
|
47
47
|
"gdk_pixbuf2",
|
48
48
|
"gdk3",
|
49
|
-
]
|
49
|
+
]
|
50
|
+
depended_packages.each do |package|
|
50
51
|
directory = "#{package}#{version_suffix}"
|
51
52
|
build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}"
|
52
53
|
package_library_name = package.gsub(/-/, "_")
|
@@ -64,10 +65,10 @@ end
|
|
64
65
|
setup_windows(module_name, base_dir)
|
65
66
|
|
66
67
|
unless required_pkg_config_package(package_id,
|
67
|
-
:
|
68
|
+
:alt_linux => "libgtk+3-devel",
|
68
69
|
:debian => "libgtk-3-dev",
|
69
70
|
:redhat => "gtk3-devel",
|
70
|
-
:
|
71
|
+
:arch_linux => "gtk3",
|
71
72
|
:homebrew => "gtk+3",
|
72
73
|
:macports => "gtk3")
|
73
74
|
exit(false)
|
data/lib/gtk3/icon-theme.rb
CHANGED
@@ -19,18 +19,18 @@ module Gtk
|
|
19
19
|
alias_method :choose_icon_raw, :choose_icon
|
20
20
|
def choose_icon(icon_names, size, flags=nil)
|
21
21
|
icon_names = [icon_names] unless icon_names.is_a?(Array)
|
22
|
-
|
23
|
-
flags = :generic_fallback
|
24
|
-
end
|
22
|
+
flags ||= 0
|
25
23
|
choose_icon_raw(icon_names, size, flags)
|
26
24
|
end
|
27
25
|
|
28
26
|
alias_method :lookup_icon_raw, :lookup_icon
|
29
|
-
def lookup_icon(icon, size, flags)
|
27
|
+
def lookup_icon(icon, size, flags=nil)
|
30
28
|
case icon
|
31
29
|
when String, Symbol
|
30
|
+
flags ||= :generic_fallback
|
32
31
|
lookup_icon_raw(icon.to_s, size, flags)
|
33
32
|
else
|
33
|
+
flags ||= 0
|
34
34
|
lookup_by_gicon(icon, size, flags)
|
35
35
|
end
|
36
36
|
end
|
data/lib/gtk3/loader.rb
CHANGED
@@ -181,6 +181,13 @@ module Gtk
|
|
181
181
|
icon_size_class = @base_module.const_get(:IconSize)
|
182
182
|
method_name = rubyish_method_name(info, :prefix => "icon_size_")
|
183
183
|
define_singleton_method(icon_size_class, method_name, info)
|
184
|
+
when /\Atest_widget_/
|
185
|
+
name = $POSTMATCH
|
186
|
+
define_method(info, Gtk::Widget, name)
|
187
|
+
when /\Aaccel_groups_/
|
188
|
+
accel_group_class = @base_module.const_get(:AccelGroup)
|
189
|
+
method_name = rubyish_method_name(info, :prefix => "accel_groups_")
|
190
|
+
define_singleton_method(accel_group_class, method_name, info)
|
184
191
|
else
|
185
192
|
super
|
186
193
|
end
|
data/lib/gtk3/text-view.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -32,21 +32,32 @@ module Gtk
|
|
32
32
|
|
33
33
|
alias_method :get_iter_at_location_raw, :get_iter_at_location
|
34
34
|
def get_iter_at_location(x, y)
|
35
|
-
|
36
|
-
if
|
35
|
+
result = get_iter_at_location_raw(x, y)
|
36
|
+
if result.is_a?(Gtk::TextIter) # For GTK+ < 3.20
|
37
|
+
iter = result
|
37
38
|
iter
|
38
39
|
else
|
39
|
-
|
40
|
+
found, iter = result
|
41
|
+
if found
|
42
|
+
iter
|
43
|
+
else
|
44
|
+
nil
|
45
|
+
end
|
40
46
|
end
|
41
47
|
end
|
42
48
|
|
43
49
|
alias_method :get_iter_at_position_raw, :get_iter_at_position
|
44
50
|
def get_iter_at_position(x, y)
|
45
|
-
|
46
|
-
if
|
47
|
-
|
51
|
+
result = get_iter_at_position_raw(x, y)
|
52
|
+
if result.size == 2 # For GTK+ < 3.20
|
53
|
+
result
|
48
54
|
else
|
49
|
-
|
55
|
+
found, iter, trailing = result
|
56
|
+
if found
|
57
|
+
[iter, trailing]
|
58
|
+
else
|
59
|
+
nil
|
60
|
+
end
|
50
61
|
end
|
51
62
|
end
|
52
63
|
end
|
data/sample/gtk-demo/TODO
CHANGED
@@ -54,6 +54,7 @@ theming_style_classes.c ok ok
|
|
54
54
|
transparent.c ok ok
|
55
55
|
images.c ok ok
|
56
56
|
textview.c ok ok
|
57
|
+
event_axes.c ok ok
|
57
58
|
|
58
59
|
Remains :
|
59
60
|
|
@@ -61,7 +62,6 @@ application.c no no
|
|
61
62
|
changedisplay.c ok no
|
62
63
|
combobox.c no no
|
63
64
|
css_blendmodes.c no no
|
64
|
-
event_axes.c no no
|
65
65
|
fishbowl.c no no
|
66
66
|
flowbox.c no no
|
67
67
|
foreigndrawing no no
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
This demo has two drawing areas. The checkerboard area shows
|
11
11
|
how you can just draw something; all you have to do is write
|
12
|
-
a signal handler for
|
12
|
+
a signal handler for "draw", as shown here.
|
13
13
|
|
14
14
|
The "scribble" area is a bit more advanced, and shows how to handle
|
15
15
|
events such as button presses and mouse motion. Click the mouse
|
@@ -0,0 +1,375 @@
|
|
1
|
+
# Copyright (c) 2017 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= Touch and Drawing Tablets
|
6
|
+
|
7
|
+
Demonstrates advanced handling of event information from exotic
|
8
|
+
input devices.
|
9
|
+
|
10
|
+
On one hand, this snippet demonstrates management of drawing tablets,
|
11
|
+
those contain additional information for the pointer other than
|
12
|
+
X/Y coordinates. Tablet pads events are mapped to actions, which
|
13
|
+
are both defined and interpreted by the application.
|
14
|
+
|
15
|
+
Input axes are dependent on hardware devices, on linux/unix you
|
16
|
+
can see the device axes through xinput list <device>. Each time
|
17
|
+
a different hardware device is used to move the pointer, the
|
18
|
+
master device will be updated to match the axes it provides,
|
19
|
+
these changes can be tracked through GdkDevice::changed, or
|
20
|
+
checking gdk_event_get_source_device().
|
21
|
+
|
22
|
+
On the other hand, this demo handles basic multitouch events,
|
23
|
+
each event coming from an specific touchpoint will contain a
|
24
|
+
GdkEventSequence that's unique for its lifetime, so multiple
|
25
|
+
touchpoints can be tracked.
|
26
|
+
=end
|
27
|
+
class EventAxesDemo
|
28
|
+
AXES_INFO = Struct.new(:last_source,
|
29
|
+
:last_tool,
|
30
|
+
:axes,
|
31
|
+
:color,
|
32
|
+
:x,
|
33
|
+
:y)
|
34
|
+
|
35
|
+
EVENT_DATA = Struct.new(:pointer_info, :touch_info)
|
36
|
+
|
37
|
+
COLORS = %w(black orchid fuchsia indigo thistle sienna azure plum
|
38
|
+
lime navy maroon burlywood).freeze
|
39
|
+
PAD_ACTION_RESULTS = %w(☢ ♨ ☼ ☄ ⚡ 💫 ◑ ⚛).freeze
|
40
|
+
# type index mode label action_name
|
41
|
+
PAD_ACTIONS =
|
42
|
+
[
|
43
|
+
[:button, 1, -1, "Nuclear strike", "pad.nuke"],
|
44
|
+
[:button, 2, -1, "Release siberian methane reserves", "pad.heat"],
|
45
|
+
[:button, 3, -1, "Release solar flare", "pad.fry"],
|
46
|
+
[:button, 4, -1, "De-stabilize Oort cloud", "pad.fall"],
|
47
|
+
[:button, 5, -1, "Ignite WR-104", "pad.burst"],
|
48
|
+
[:button, 6, -1, "Lart whoever asks about this button", "pad.lart"],
|
49
|
+
[:ring, -1, -1, "Earth axial tilt", "pad.tilt"],
|
50
|
+
[:strip, -1, -1, "Extent of weak nuclear force", "pad.dissolve"]
|
51
|
+
].freeze
|
52
|
+
|
53
|
+
def initialize(main_window)
|
54
|
+
@cur_color = 0
|
55
|
+
@window = Gtk::Window.new(:toplevel)
|
56
|
+
@window.screen = main_window.screen
|
57
|
+
@window.title = "Event Axes"
|
58
|
+
@window.set_default_size(400, 400)
|
59
|
+
|
60
|
+
box = Gtk::EventBox.new
|
61
|
+
@window.add(box)
|
62
|
+
box.support_multidevice = true
|
63
|
+
box.add_events([:pointer_motion_mask, :button_press_mask,
|
64
|
+
:button_release_mask, :smooth_scroll_mask,
|
65
|
+
:enter_notify_mask, :leave_notify_mask,
|
66
|
+
:touch_mask])
|
67
|
+
|
68
|
+
@event_data = EVENT_DATA.new({}, {})
|
69
|
+
|
70
|
+
box.signal_connect "event" do |widget, event|
|
71
|
+
update_axes_from_event(event)
|
72
|
+
widget.queue_draw
|
73
|
+
false
|
74
|
+
end
|
75
|
+
|
76
|
+
box.signal_connect "draw" do |widget, cr|
|
77
|
+
y = 0
|
78
|
+
allocation = widget.allocation
|
79
|
+
|
80
|
+
# Draw Abs info
|
81
|
+
@event_data.pointer_info.each do |_key, value|
|
82
|
+
draw_axes_info(cr, value, allocation)
|
83
|
+
end
|
84
|
+
|
85
|
+
@event_data.touch_info.each do |_key, value|
|
86
|
+
draw_axes_info(cr, value, allocation)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Draw name, color legend and misc data
|
90
|
+
@event_data.pointer_info.each do |_key, value|
|
91
|
+
y = draw_device_info(widget, cr, nil, y, value)
|
92
|
+
end
|
93
|
+
|
94
|
+
@event_data.touch_info.each do |key, value|
|
95
|
+
y = draw_device_info(widget, cr, key, y, value)
|
96
|
+
end
|
97
|
+
|
98
|
+
false
|
99
|
+
end
|
100
|
+
|
101
|
+
@label = Gtk::Label.new("")
|
102
|
+
@label.use_markup = true
|
103
|
+
box.add(@label)
|
104
|
+
init_pad_controller
|
105
|
+
end
|
106
|
+
|
107
|
+
def run
|
108
|
+
if !@window.visible?
|
109
|
+
@window.show_all
|
110
|
+
else
|
111
|
+
@window.destroy
|
112
|
+
end
|
113
|
+
@window
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
def init_pad_controller
|
119
|
+
action_group = Gio::SimpleActionGroup.new
|
120
|
+
@pad_controller = Gtk::PadController.new(@window, action_group, nil)
|
121
|
+
|
122
|
+
PAD_ACTIONS.each_with_index do |pad_action, i|
|
123
|
+
action = if pad_action[0] == :button
|
124
|
+
Gio::SimpleAction.new(pad_action[4])
|
125
|
+
else
|
126
|
+
Gio::SimpleAction.new(pad_action[4], "d")
|
127
|
+
end
|
128
|
+
action.signal_connect "activate" do |_action, param|
|
129
|
+
if param
|
130
|
+
update_label_and_timeout("#{PAD_ACTION_RESULTS[i]} #{param}")
|
131
|
+
else
|
132
|
+
update_label_and_timeout(PAD_ACTION_RESULTS[i])
|
133
|
+
end
|
134
|
+
end
|
135
|
+
action_group.add_action(action)
|
136
|
+
@pad_controller.set_action(*pad_action)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def draw_axes_info(cr, info, allocation)
|
141
|
+
axes = info.last_source.axes
|
142
|
+
cr.save
|
143
|
+
cr.set_line_width(1)
|
144
|
+
cr.set_source_rgba(info.color)
|
145
|
+
cr.move_to(0, info.y)
|
146
|
+
cr.line_to(allocation.width, info.y)
|
147
|
+
cr.move_to(info.x, 0)
|
148
|
+
cr.line_to(info.x, allocation.height)
|
149
|
+
cr.stroke
|
150
|
+
|
151
|
+
cr.translate(info.x, info.y)
|
152
|
+
|
153
|
+
if info.axes.nil?
|
154
|
+
cr.restore
|
155
|
+
return
|
156
|
+
end
|
157
|
+
|
158
|
+
if axes.include?(Gdk::AxisFlags::XTILT) && axes.include?(Gdk::AxisFlags::YTILT)
|
159
|
+
tiltx = info.last_source.get_axis(info.axes, :axis_xtilt)
|
160
|
+
tilty = info.last_source.get_axis(info.axes, :axis_ytilt)
|
161
|
+
|
162
|
+
render_arrow(cr, tiltx * 100, tilty * 100, "Tilt")
|
163
|
+
end
|
164
|
+
|
165
|
+
if axes.include?(Gdk::AxisFlags::DISTANCE)
|
166
|
+
distance = info.last_source.get_axis(info.axes, :axis_distance)
|
167
|
+
|
168
|
+
cr.save
|
169
|
+
cr.move_to(distance * 100, 0)
|
170
|
+
cr.set_source_rgb(0.0, 0.0, 0.0)
|
171
|
+
cr.set_dash([5.0, 5.0], 2, 0.0)
|
172
|
+
cr.arc(0, 0, distance * 100, 0, 2 * Math::PI)
|
173
|
+
cr.stroke
|
174
|
+
|
175
|
+
cr.move_to(0, -distance * 100)
|
176
|
+
extents = cr.text_extents("Distance")
|
177
|
+
cr.rel_move_to(-extents.width / 2, 0)
|
178
|
+
cr.show_text("Distance")
|
179
|
+
|
180
|
+
cr.move_to(cr, 0, 0)
|
181
|
+
|
182
|
+
cr.restore
|
183
|
+
end
|
184
|
+
|
185
|
+
if axes.include?(Gdk::AxisFlags::WHEEL)
|
186
|
+
wheel = info.last_source.get_axis(info.axes, :axis_wheel)
|
187
|
+
cr.save
|
188
|
+
cr.set_line_width(10)
|
189
|
+
cr.set_source_rgba(0, 0, 0, 0.5)
|
190
|
+
|
191
|
+
cr.new_sub_path
|
192
|
+
cr.arc(0, 0, 100, 0, wheel * 2 * Math::PI)
|
193
|
+
cr.stroke
|
194
|
+
cr.restore
|
195
|
+
end
|
196
|
+
|
197
|
+
if axes.include?(Gdk::AxisFlags::ROTATION)
|
198
|
+
rotation = info.last_source.get_axis(info.axes, :axis_rotation)
|
199
|
+
rotation *= (2 * Math::PI)
|
200
|
+
|
201
|
+
cr.save
|
202
|
+
cr.rotate(-1 * (Math::PI / 2))
|
203
|
+
cr.set_line_cap(Cairo::LINE_CAP_ROUND)
|
204
|
+
cr.set_line_width(5)
|
205
|
+
|
206
|
+
cr.new_sub_path
|
207
|
+
cr.arc(0, 0, 100, 0, rotation)
|
208
|
+
cr.stroke
|
209
|
+
cr.restore
|
210
|
+
end
|
211
|
+
|
212
|
+
if axes.include?(Gdk::AxisFlags::SLIDER)
|
213
|
+
slider = info.last_source.get_axis(info.axes, :axis_slider)
|
214
|
+
|
215
|
+
cr.save
|
216
|
+
cr.movet_to(0, -10)
|
217
|
+
cr.rel_line_to(0, -50)
|
218
|
+
cr.rel_line_to(10, 0)
|
219
|
+
cr.rel_line_to(-5, 50)
|
220
|
+
cr.close_path
|
221
|
+
|
222
|
+
cr.clip_preserve
|
223
|
+
|
224
|
+
pattern = Cairo::LinearPattern.new(0, -10, 0, -60)
|
225
|
+
pattern.add_color_stop_rgb(0, 0, 1, 0)
|
226
|
+
pattern.add_color_stop_rgb(1, 1, 0, 0)
|
227
|
+
cr.set_source(pattern)
|
228
|
+
|
229
|
+
mask = Cairo::LinearPattern.new(0, -10, 0, -60)
|
230
|
+
mask.add_color_stop_rgba(0, 0, 0, 0, 1)
|
231
|
+
mask.add_color_stop_rgba(slider, 0, 0, 0, 1)
|
232
|
+
mask.add_color_stop_rgba(slider, 0, 0, 0, 0)
|
233
|
+
mask.add_color_stop_rgba(1, 0, 0, 0, 0)
|
234
|
+
cr.mask = mask
|
235
|
+
|
236
|
+
cr.set_source_rgb(0, 0, 0)
|
237
|
+
cr.stroke
|
238
|
+
|
239
|
+
cr.restore
|
240
|
+
end
|
241
|
+
|
242
|
+
cr.restore
|
243
|
+
end
|
244
|
+
|
245
|
+
def draw_device_info(widget, cr, sequence, y, info)
|
246
|
+
cr.save
|
247
|
+
str = "Source: #{info.last_source.name}"
|
248
|
+
if sequence && sequence.class.name
|
249
|
+
str += "\nSequence: #{sequence.class.name}"
|
250
|
+
end
|
251
|
+
|
252
|
+
if info.last_tool
|
253
|
+
tool_type = tool_type_to_string(info.last_tool.tool_type)
|
254
|
+
serial = info.last_tool.serial
|
255
|
+
str += "\Tool: #{tool_type}"
|
256
|
+
str += ", Serial: #{serial.to_s(16)}" if serial != 0
|
257
|
+
end
|
258
|
+
|
259
|
+
cr.move_to(10, y)
|
260
|
+
layout = widget.create_pango_layout(str)
|
261
|
+
cr.show_pango_layout(layout)
|
262
|
+
cr.stroke
|
263
|
+
|
264
|
+
_, h = layout.pixel_size
|
265
|
+
cr.set_source_rgba(info.color)
|
266
|
+
cr.set_line_width(10)
|
267
|
+
cr.move_to(0, y)
|
268
|
+
y += h
|
269
|
+
cr.line_to(0, y)
|
270
|
+
cr.stroke
|
271
|
+
cr.restore
|
272
|
+
|
273
|
+
y
|
274
|
+
end
|
275
|
+
|
276
|
+
def update_axes_from_event(event)
|
277
|
+
device = event.device
|
278
|
+
source_device = event.source_device
|
279
|
+
sequence = event.event_sequence
|
280
|
+
tool = event.device_tool
|
281
|
+
|
282
|
+
if event.type == :touch_end || event.type == :touch_cancel
|
283
|
+
@event_data.touch_info.delete(sequence)
|
284
|
+
return
|
285
|
+
elsif event.type == :leave_notify
|
286
|
+
@event_data.pointer_info.delete(device)
|
287
|
+
return
|
288
|
+
end
|
289
|
+
|
290
|
+
info = nil
|
291
|
+
|
292
|
+
if sequence.nil?
|
293
|
+
info = @event_data.pointer_info[device]
|
294
|
+
|
295
|
+
unless info
|
296
|
+
info = AXES_INFO.new
|
297
|
+
info.color = Gdk::RGBA.parse(COLORS[@cur_color])
|
298
|
+
@cur_color = (@cur_color + 1) % COLORS.size
|
299
|
+
|
300
|
+
@event_data.pointer_info[device] = info
|
301
|
+
end
|
302
|
+
else
|
303
|
+
info = @event_data.touch_info[sequence]
|
304
|
+
|
305
|
+
unless info
|
306
|
+
info = AXES_INFO.new
|
307
|
+
info.color = Gdk::RGBA.parse(COLORS[@cur_color])
|
308
|
+
@cur_color = (@cur_color + 1) % COLORS.size
|
309
|
+
@event_data.touch_info[sequence] = info
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
info.last_source = source_device if info.last_source != source_device
|
314
|
+
info.last_tool = tool if info.last_tool != tool
|
315
|
+
|
316
|
+
if event.type == :touch_begin || event.type == :touch_update
|
317
|
+
@event_data.pointer_info.delete(device) if (sequence && event.touch.emulating_pointer)
|
318
|
+
end
|
319
|
+
|
320
|
+
if event.type == :motion_notify
|
321
|
+
info.axes = source_device.axes
|
322
|
+
elsif event.type == :button_press || event.type == :button_release
|
323
|
+
info.axes = source_device.axes
|
324
|
+
end
|
325
|
+
x, y = event.coords
|
326
|
+
info.x = x
|
327
|
+
info.y = y
|
328
|
+
end
|
329
|
+
|
330
|
+
def tool_type_to_string(tool_type)
|
331
|
+
case tool_type
|
332
|
+
when Gdk::DeviceToolType::PEN
|
333
|
+
"Pen"
|
334
|
+
when Gdk::DeviceToolType::ERASER
|
335
|
+
"Eraser"
|
336
|
+
when Gdk::DeviceToolType::BRUSH
|
337
|
+
"Brush"
|
338
|
+
when Gdk::DeviceToolType::PENCIL
|
339
|
+
"Pencil"
|
340
|
+
when Gdk::DeviceToolType::AIRBRUSH
|
341
|
+
"Airbrush"
|
342
|
+
when Gdk::DeviceToolType::MOUSE
|
343
|
+
"Mouse"
|
344
|
+
when Gdk::DeviceToolType::LENS
|
345
|
+
"Lens cursor"
|
346
|
+
else
|
347
|
+
"Unknown"
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
def render_arrow(cr, x_diff, y_diff, label)
|
352
|
+
cr.save
|
353
|
+
cr.set_source_rgb(0, 0, 0)
|
354
|
+
cr.new_path
|
355
|
+
cr.move_to(0, 0)
|
356
|
+
cr.line_to(x_diff, y_diff)
|
357
|
+
cr.stroke
|
358
|
+
cr.move_to(x_diff, y_diff)
|
359
|
+
cr.show_text(label)
|
360
|
+
|
361
|
+
cr.restore
|
362
|
+
end
|
363
|
+
|
364
|
+
def update_label_and_timeout(text)
|
365
|
+
GLib::Source.remove(@pad_action_timeout_id) if @pad_action_timeout_id
|
366
|
+
|
367
|
+
@label.markup = "<span font='48.0'>#{text}</span>"
|
368
|
+
|
369
|
+
@pad_action_timeout_id = GLib::Timeout.add(200) do
|
370
|
+
@label.markup = "<span font='48.0'>#{text}</span>"
|
371
|
+
@pad_action_timeout_id = 0
|
372
|
+
GLib::Source::REMOVE
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013-
|
3
|
+
# Copyright (C) 2013-2017 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -20,22 +20,22 @@ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
|
|
20
20
|
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
|
21
21
|
|
22
22
|
glib_base = File.join(ruby_gnome2_base, "glib2")
|
23
|
+
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
|
23
24
|
atk_base = File.join(ruby_gnome2_base, "atk")
|
24
25
|
cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
|
25
26
|
pango_base = File.join(ruby_gnome2_base, "pango")
|
26
27
|
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
|
27
|
-
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
|
28
28
|
gio2_base = File.join(ruby_gnome2_base, "gio2")
|
29
29
|
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
|
30
30
|
gtk3_base = File.join(ruby_gnome2_base, "gtk3")
|
31
31
|
|
32
32
|
[
|
33
33
|
[glib_base, "glib2"],
|
34
|
+
[gobject_introspection_base, "gobject-introspection"],
|
34
35
|
[atk_base, "atk"],
|
35
36
|
[cairo_gobject_base, "cairo-gobject"],
|
36
37
|
[pango_base, "pango"],
|
37
38
|
[gdk_pixbuf_base, "gdk_pixbuf2"],
|
38
|
-
[gobject_introspection_base, "gobject-introspection"],
|
39
39
|
[gio2_base, "gio2"],
|
40
40
|
[gdk3_base, "gdk3"],
|
41
41
|
[gtk3_base, "gtk3"]
|
data/test/test-gtk-icon-theme.rb
CHANGED
@@ -25,25 +25,25 @@ class TestGtkIconTheme < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_context
|
28
|
-
assert_operator(@theme.icons("Actions"), :include?, "find")
|
28
|
+
assert_operator(@theme.icons("Actions"), :include?, "edit-find")
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
sub_test_case "#lookup_icon" do
|
33
33
|
sub_test_case "icon" do
|
34
34
|
test "String" do
|
35
|
-
assert_not_nil(@theme.lookup_icon("
|
35
|
+
assert_not_nil(@theme.lookup_icon("edit-find",
|
36
36
|
16, :generic_fallback))
|
37
37
|
end
|
38
38
|
|
39
39
|
test "Symbol" do
|
40
|
-
assert_not_nil(@theme.lookup_icon("
|
40
|
+
assert_not_nil(@theme.lookup_icon("edit-find",
|
41
41
|
16, :generic_fallback))
|
42
42
|
end
|
43
43
|
|
44
44
|
test "Gio::Icon" do
|
45
|
-
icon = Gio::ThemedIcon.new("
|
46
|
-
assert_not_nil(@theme.lookup_icon(icon, 16
|
45
|
+
icon = Gio::ThemedIcon.new("edit-find")
|
46
|
+
assert_not_nil(@theme.lookup_icon(icon, 16))
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/test/test-gtk-search-bar.rb
CHANGED
@@ -38,18 +38,4 @@ class TestGtkSearchBar < Test::Unit::TestCase
|
|
38
38
|
@search_bar.show_close_button = true
|
39
39
|
assert_true(@search_bar.show_close_button?)
|
40
40
|
end
|
41
|
-
|
42
|
-
def test_handle_event
|
43
|
-
window = Gtk::Window.new
|
44
|
-
key_press_event = Gdk::EventKey.new(:key_press)
|
45
|
-
key_press_event.keyval = Gdk::Keyval::KEY_a
|
46
|
-
entry = Gtk::SearchEntry.new
|
47
|
-
@search_bar.add(entry)
|
48
|
-
@search_bar.connect_entry(entry)
|
49
|
-
window.add(@search_bar)
|
50
|
-
window.show_all
|
51
|
-
key_press_event.window = window.window
|
52
|
-
assert_equal(Gdk::Event::STOP,
|
53
|
-
@search_bar.handle_event(key_press_event))
|
54
|
-
end
|
55
41
|
end
|
data/test/test-gtk-text-view.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -45,6 +45,7 @@ class TestGtkTextView < Test::Unit::TestCase
|
|
45
45
|
end
|
46
46
|
|
47
47
|
test "not found" do
|
48
|
+
only_gtk_version(3, 20)
|
48
49
|
assert_nil(@text_view.get_iter_at_location(100, 0))
|
49
50
|
end
|
50
51
|
end
|
@@ -57,6 +58,7 @@ class TestGtkTextView < Test::Unit::TestCase
|
|
57
58
|
end
|
58
59
|
|
59
60
|
test "not found" do
|
61
|
+
only_gtk_version(3, 20)
|
60
62
|
assert_nil(@text_view.get_iter_at_position(100, 0))
|
61
63
|
end
|
62
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glib2
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.1.
|
19
|
+
version: 3.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.
|
26
|
+
version: 3.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gio2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.1.
|
33
|
+
version: 3.1.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.1.
|
40
|
+
version: 3.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: atk
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.1.
|
47
|
+
version: 3.1.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.1.
|
54
|
+
version: 3.1.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pango
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.1.
|
61
|
+
version: 3.1.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.1.
|
68
|
+
version: 3.1.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gdk_pixbuf2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.1.
|
75
|
+
version: 3.1.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.1.
|
82
|
+
version: 3.1.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: gdk3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.1.
|
89
|
+
version: 3.1.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.1.
|
96
|
+
version: 3.1.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: gobject-introspection
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.1.
|
103
|
+
version: 3.1.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.1.
|
110
|
+
version: 3.1.2
|
111
111
|
description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
|
112
112
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
113
113
|
executables: []
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- sample/gtk-demo/editable_cells.rb
|
267
267
|
- sample/gtk-demo/entry_buffer.rb
|
268
268
|
- sample/gtk-demo/entry_completion.rb
|
269
|
+
- sample/gtk-demo/event_axes.rb
|
269
270
|
- sample/gtk-demo/ew_resize_cursor.png
|
270
271
|
- sample/gtk-demo/expander.rb
|
271
272
|
- sample/gtk-demo/filtermodel.rb
|
@@ -643,7 +644,7 @@ files:
|
|
643
644
|
- test/test-pango-context.rb
|
644
645
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
645
646
|
licenses:
|
646
|
-
-
|
647
|
+
- LGPL-2.1+
|
647
648
|
metadata: {}
|
648
649
|
post_install_message:
|
649
650
|
rdoc_options: []
|