gdk3 2.2.5 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -3
- data/lib/gdk3.rb +3 -0
- data/lib/gdk3/cursor.rb +31 -0
- data/lib/gdk3/deprecated.rb +41 -11
- data/lib/gdk3/loader.rb +39 -9
- data/lib/gdk3/rectangle.rb +17 -1
- data/lib/gdk3/rgba.rb +26 -5
- data/lib/gdk3/screen.rb +40 -0
- data/test/fixture/ruby-gnome2-logo.png +0 -0
- data/test/gdk-test-utils.rb +13 -0
- data/test/test-gdk-atom.rb +24 -0
- data/test/test-gdk-cursor.rb +44 -0
- data/test/test-gdk-event-mask.rb +21 -0
- data/test/test-gdk-keyval.rb +8 -4
- data/test/test-gdk-rectangle.rb +20 -1
- data/test/test-gdk-rgba.rb +65 -0
- data/test/test-gdk-selection.rb +29 -0
- metadata +17 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e637fb4de621dbbcf765d42bc33d0432ca4c4223
|
4
|
+
data.tar.gz: f0bde85fcbcf41c97723228bf2f2f078b38475a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96600db4fe2b6b16909f578b00266a985496839b239595c6b17e040b4d2b826e1102c302e13b1f9d055cb05cd5c8745eae2a4fdb178897bfe256d30b9994aada
|
7
|
+
data.tar.gz: 9011966501e20081e4be7dc9a48df120a85a50e22deb2f5ef0b79f6229c541c306f50bb07150d66d3abc2b709fb3918a52bd4fe5634d193dbb770df797e14da0
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2011-
|
3
|
+
# Copyright (C) 2011-2015 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
|
@@ -43,17 +43,32 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
43
43
|
"gdk_pixbuf2",
|
44
44
|
]
|
45
45
|
package.external_packages = [
|
46
|
+
{
|
47
|
+
:name => "libepoxy",
|
48
|
+
:download_base_url => "https://github.com/anholt/libepoxy/releases/download/v1.3.1",
|
49
|
+
:label => "Epoxy",
|
50
|
+
:version => "1.3.1",
|
51
|
+
:compression_method => "bz2",
|
52
|
+
:windows => {
|
53
|
+
:configure_args => [
|
54
|
+
],
|
55
|
+
:built_file => "bin/libepoxy-0.dll",
|
56
|
+
},
|
57
|
+
},
|
46
58
|
{
|
47
59
|
:name => "gtk+",
|
48
60
|
:download_site => :gnome,
|
49
61
|
:label => "GTK+",
|
50
|
-
:version => "3.
|
62
|
+
:version => "3.16.6",
|
51
63
|
:compression_method => "xz",
|
52
64
|
:windows => {
|
53
65
|
:configure_args => [
|
54
66
|
"--enable-introspection",
|
55
67
|
"--with-included-immodules",
|
56
68
|
],
|
69
|
+
:patches => [
|
70
|
+
"gtk+-3.16.6-add-missing-exeext.diff",
|
71
|
+
],
|
57
72
|
:need_autoreconf => true,
|
58
73
|
:build_concurrently => false,
|
59
74
|
:built_file => "bin/libgdk-3-0.dll",
|
@@ -63,7 +78,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
63
78
|
:name => "adwaita-icon-theme",
|
64
79
|
:download_site => :gnome,
|
65
80
|
:label => "adwaita-icon-theme",
|
66
|
-
:version => "3.
|
81
|
+
:version => "3.16.2",
|
67
82
|
:compression_method => "xz",
|
68
83
|
:windows => {
|
69
84
|
:configure_args => [],
|
data/lib/gdk3.rb
CHANGED
data/lib/gdk3/cursor.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Copyright (C) 2015 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module Gdk
|
18
|
+
class Cursor
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
def initialize(*args)
|
21
|
+
if args.last.is_a?(Hash)
|
22
|
+
options = args.pop
|
23
|
+
else
|
24
|
+
options = {}
|
25
|
+
end
|
26
|
+
display = options[:display] || Display.default
|
27
|
+
|
28
|
+
initialize_raw(display, *args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/gdk3/deprecated.rb
CHANGED
@@ -9,7 +9,7 @@ module Gdk
|
|
9
9
|
|
10
10
|
class Cursor
|
11
11
|
extend GLib::Deprecatable
|
12
|
-
define_deprecated_enums :
|
12
|
+
define_deprecated_enums :CursorType
|
13
13
|
define_deprecated_method :pixmap?, :warn => "Don't use this method." do |_self|
|
14
14
|
false
|
15
15
|
end
|
@@ -21,7 +21,14 @@ module Gdk
|
|
21
21
|
class Device
|
22
22
|
extend GLib::Deprecatable
|
23
23
|
define_deprecated_enums :AxisUse, 'AXIS'
|
24
|
-
|
24
|
+
define_deprecated_const "EXTENSION_EVENTS_NONE",
|
25
|
+
:raise => "No longer available in GDK3."
|
26
|
+
define_deprecated_const "EXTENSION_EVENTS_ALL",
|
27
|
+
:raise => "No longer available in GDK3."
|
28
|
+
define_deprecated_const "EXTENSION_EVENTS_CURSOR",
|
29
|
+
:raise => "No longer available in GDK3."
|
30
|
+
define_deprecated_const "ExtensionMode",
|
31
|
+
:raise => "No longer available in GDK3."
|
25
32
|
define_deprecated_enums :InputMode, 'MODE'
|
26
33
|
define_deprecated_enums :InputSource, 'SOURCE'
|
27
34
|
end
|
@@ -39,8 +46,10 @@ module Gdk
|
|
39
46
|
|
40
47
|
class DragContext
|
41
48
|
extend GLib::Deprecatable
|
42
|
-
define_deprecated_flags :
|
43
|
-
|
49
|
+
define_deprecated_flags :DragAction, 'ACTION'
|
50
|
+
define_deprecated_const :Action, "Gdk::DragAction"
|
51
|
+
define_deprecated_enums :DragProtocol, 'PROTO'
|
52
|
+
define_deprecated_const :Protocol, "Gdk::DragProtocol"
|
44
53
|
define_deprecated_singleton_method :drag_begin, :warn => "Use 'Gdk::Window#drag_begin'." do |_self, window, targets|
|
45
54
|
window.drag_begin(targets)
|
46
55
|
end
|
@@ -53,13 +62,19 @@ module Gdk
|
|
53
62
|
|
54
63
|
class Event
|
55
64
|
extend GLib::Deprecatable
|
65
|
+
|
66
|
+
define_deprecated_const :CURRENT_TIME, "Gdk::CURRENT_TIME"
|
67
|
+
|
56
68
|
define_deprecated_const :Mask, "Gdk::EventMask"
|
69
|
+
define_deprecated_enums "Gdk::EventMask"
|
70
|
+
|
57
71
|
define_deprecated_const :Type, "Gdk::EventType"
|
72
|
+
define_deprecated_enums "Gdk::EventType"
|
58
73
|
end
|
59
74
|
|
60
75
|
class EventCrossing
|
61
76
|
extend GLib::Deprecatable
|
62
|
-
define_deprecated_enums :
|
77
|
+
define_deprecated_enums :CrossingMode
|
63
78
|
define_deprecated_enums :NotifyType, 'NOTIFY'
|
64
79
|
end
|
65
80
|
|
@@ -70,22 +85,23 @@ module Gdk
|
|
70
85
|
|
71
86
|
class EventProperty
|
72
87
|
extend GLib::Deprecatable
|
73
|
-
define_deprecated_enums :
|
88
|
+
define_deprecated_enums :PropertyState, 'PROPERTY'
|
74
89
|
end
|
75
90
|
|
76
91
|
class EventScroll
|
77
92
|
extend GLib::Deprecatable
|
78
|
-
define_deprecated_enums :
|
93
|
+
define_deprecated_enums :ScrollDirection
|
79
94
|
end
|
80
95
|
|
81
96
|
class EventSetting
|
82
97
|
extend GLib::Deprecatable
|
83
|
-
define_deprecated_enums :
|
98
|
+
define_deprecated_enums :SettingAction, 'ACTION'
|
84
99
|
end
|
85
100
|
|
86
101
|
class EventVisibility
|
87
102
|
extend GLib::Deprecatable
|
88
|
-
define_deprecated_enums :
|
103
|
+
define_deprecated_enums :VisibilityState
|
104
|
+
define_deprecated_const :State, "Gdk::VisibilityState"
|
89
105
|
end
|
90
106
|
|
91
107
|
class EventWindowState
|
@@ -126,24 +142,35 @@ module Gdk
|
|
126
142
|
class Visual
|
127
143
|
extend GLib::Deprecatable
|
128
144
|
define_deprecated_enums :ByteOrder
|
129
|
-
define_deprecated_enums :
|
145
|
+
define_deprecated_enums :VisualType
|
146
|
+
define_deprecated_const :Type, "Gdk::VisualType"
|
130
147
|
end
|
131
148
|
|
132
149
|
class Window
|
133
150
|
extend GLib::Deprecatable
|
134
151
|
|
135
152
|
define_deprecated_const :Gravity, "Gdk::Gravity"
|
153
|
+
define_deprecated_enums "Gdk::Gravity"
|
136
154
|
define_deprecated_const :AttributesType, "Gdk::WindowAttributesType"
|
155
|
+
define_deprecated_enums "Gdk::WindowAttributesType"
|
137
156
|
define_deprecated_const :Edge, "Gdk::WindowEdge"
|
157
|
+
define_deprecated_enums "Gdk::WindowEdge"
|
138
158
|
define_deprecated_const :FilterReturn, "Gdk::FilterReturn"
|
159
|
+
define_deprecated_enums "Gdk::FilterReturn"
|
139
160
|
define_deprecated_const :Hints, "Gdk::WindowHints"
|
161
|
+
define_deprecated_enums "Gdk::WindowHints"
|
140
162
|
define_deprecated_const :ModifierType, "Gdk::ModifierType"
|
163
|
+
define_deprecated_enums "Gdk::ModifierType"
|
141
164
|
define_deprecated_const :Type, "Gdk::WindowType"
|
165
|
+
define_deprecated_enums "Gdk::WindowType"
|
142
166
|
define_deprecated_const :TypeHint, "Gdk::WindowTypeHint"
|
143
|
-
|
167
|
+
define_deprecated_enums "Gdk::WindowTypeHint"
|
144
168
|
define_deprecated_const :Class, "Gdk::WindowWindowClass"
|
169
|
+
define_deprecated_enums "Gdk::WindowWindowClass"
|
145
170
|
define_deprecated_const :WMDecoration, "Gdk::WMDecoration"
|
171
|
+
define_deprecated_enums "Gdk::WMDecoration"
|
146
172
|
define_deprecated_const :WMFunction, "Gdk::WMFunction"
|
173
|
+
define_deprecated_enums "Gdk::WMFunction"
|
147
174
|
define_deprecated_const :PARENT_RELATIVE, "Gdk::PARENT_RELATIVE"
|
148
175
|
define_deprecated_method :clear, :warn => "Don't use this method."
|
149
176
|
define_deprecated_method :clear_area, :warn => "Don't use this method."
|
@@ -151,6 +178,9 @@ module Gdk
|
|
151
178
|
define_deprecated_method :shape_combine_mask, :warn => "Don't use this method."
|
152
179
|
define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method."
|
153
180
|
define_deprecated_method :set_back_pixmap, :warn => "Don't use this method."
|
181
|
+
define_deprecated_method :size, :warn => "Use #width and #height instead." do |_self|
|
182
|
+
[_self.width, _self.height]
|
183
|
+
end
|
154
184
|
end
|
155
185
|
|
156
186
|
class WindowAttr
|
data/lib/gdk3/loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2015 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
|
@@ -29,12 +29,9 @@ module Gdk
|
|
29
29
|
@event_motion_class ||= @base_module.const_get(:EventMotion)
|
30
30
|
end
|
31
31
|
|
32
|
-
def rectangle_class
|
33
|
-
@rectangle_class ||= @base_module.const_get(:Rectangle)
|
34
|
-
end
|
35
|
-
|
36
32
|
def pre_load(repository, namespace)
|
37
33
|
setup_pending_constants
|
34
|
+
setup_pending_rectangle_functions
|
38
35
|
define_keyval_module
|
39
36
|
define_selection_module
|
40
37
|
load_cairo_rectangle_int
|
@@ -56,6 +53,7 @@ module Gdk
|
|
56
53
|
"Rectangle",
|
57
54
|
@base_module,
|
58
55
|
:size => info.size)
|
56
|
+
@rectangle_class = klass
|
59
57
|
load_fields(info, klass)
|
60
58
|
load_methods(info, klass)
|
61
59
|
end
|
@@ -72,11 +70,18 @@ module Gdk
|
|
72
70
|
|
73
71
|
def post_load(repository, namespace)
|
74
72
|
apply_pending_constants
|
73
|
+
apply_pending_rectangle_functions
|
75
74
|
require_libraries
|
76
75
|
convert_event_classes
|
77
76
|
define_selection_constants
|
78
77
|
end
|
79
78
|
|
79
|
+
def initialize_post(object)
|
80
|
+
super
|
81
|
+
return unless object.is_a?(GLib::Object)
|
82
|
+
self.class.reference_gobject(object, :sink => true)
|
83
|
+
end
|
84
|
+
|
80
85
|
def setup_pending_constants
|
81
86
|
@pending_constants = []
|
82
87
|
end
|
@@ -90,12 +95,32 @@ module Gdk
|
|
90
95
|
end
|
91
96
|
end
|
92
97
|
|
98
|
+
def setup_pending_rectangle_functions
|
99
|
+
@pending_rectangle_get_type_function = nil
|
100
|
+
@pending_rectangle_functions = []
|
101
|
+
end
|
102
|
+
|
103
|
+
def apply_pending_rectangle_functions
|
104
|
+
get_type_info = @pending_rectangle_get_type_function
|
105
|
+
gtype = get_type_info.invoke({:arguments => []})
|
106
|
+
self.class.register_boxed_class_converter(gtype) do |rectangle|
|
107
|
+
@rectangle_class
|
108
|
+
end
|
109
|
+
|
110
|
+
@pending_rectangle_functions.each do |info|
|
111
|
+
name = info.name
|
112
|
+
define_method(info, @rectangle_class, name.gsub(/\Arectangle_/, ""))
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
93
116
|
def require_libraries
|
94
117
|
require "gdk3/atom"
|
95
118
|
require "gdk3/color"
|
119
|
+
require "gdk3/cursor"
|
96
120
|
require "gdk3/event"
|
97
121
|
require "gdk3/rectangle"
|
98
122
|
require "gdk3/rgba"
|
123
|
+
require "gdk3/screen"
|
99
124
|
require "gdk3/window"
|
100
125
|
require "gdk3/window-attr"
|
101
126
|
|
@@ -167,18 +192,19 @@ module Gdk
|
|
167
192
|
"TYPE_STRING" => "STRING",
|
168
193
|
}
|
169
194
|
selections.each do |key, value|
|
170
|
-
|
171
|
-
#@selection_module.const_set(key, Gdk::Atom.intern(value))
|
195
|
+
@selection_module.const_set(key, Gdk::Atom.intern(value))
|
172
196
|
end
|
173
197
|
end
|
174
198
|
|
175
199
|
def load_function_info(info)
|
176
200
|
name = info.name
|
177
201
|
case name
|
202
|
+
when "rectangle_get_type"
|
203
|
+
@pending_rectangle_get_type_function = info
|
204
|
+
when /\Arectangle_/
|
205
|
+
@pending_rectangle_functions << info
|
178
206
|
when "init", /_get_type\z/
|
179
207
|
# ignore
|
180
|
-
when /\Arectangle_/
|
181
|
-
define_method(info, rectangle_class, $POSTMATCH)
|
182
208
|
when /\Apixbuf_/
|
183
209
|
target_class = nil
|
184
210
|
case $POSTMATCH
|
@@ -220,6 +246,10 @@ module Gdk
|
|
220
246
|
end
|
221
247
|
when /\Akeyval_/
|
222
248
|
name = rubyish_method_name(info, :prefix => "keyval_")
|
249
|
+
case name
|
250
|
+
when "name"
|
251
|
+
name = "to_name"
|
252
|
+
end
|
223
253
|
define_module_function(@keyval_module, name, info)
|
224
254
|
else
|
225
255
|
super
|
data/lib/gdk3/rectangle.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2014-2015 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
|
@@ -34,5 +34,21 @@ module Gdk
|
|
34
34
|
nil
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def inspect
|
39
|
+
super.gsub(/>\z/) do
|
40
|
+
" x=#{x.inspect} y=#{y.inspect} " +
|
41
|
+
"width=#{width.inspect} height=#{height.inspect}>"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_a
|
46
|
+
[x, y, width, height]
|
47
|
+
end
|
48
|
+
|
49
|
+
def ==(other)
|
50
|
+
other.is_a?(self.class) and
|
51
|
+
self.to_a == other.to_a
|
52
|
+
end
|
37
53
|
end
|
38
54
|
end
|
data/lib/gdk3/rgba.rb
CHANGED
@@ -16,13 +16,34 @@
|
|
16
16
|
|
17
17
|
module Gdk
|
18
18
|
class RGBA
|
19
|
+
class << self
|
20
|
+
def parse(spec)
|
21
|
+
rgba = new
|
22
|
+
unless rgba.parse(spec)
|
23
|
+
available_formats = [
|
24
|
+
"COLOR_NAME",
|
25
|
+
"\#RGB",
|
26
|
+
"\#RRGGBB",
|
27
|
+
"\#RRRGGGBBB",
|
28
|
+
"\#RRRRGGGGBBBB",
|
29
|
+
"rgb(R, G, B)",
|
30
|
+
"rgba(R, G, B, A)",
|
31
|
+
]
|
32
|
+
message = "invalid RGBA format: #{spec.inspect} "
|
33
|
+
message << "(available formats: #{available_formats.join(', ')})"
|
34
|
+
raise ArgumentError, message
|
35
|
+
end
|
36
|
+
rgba
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
19
40
|
alias_method :initialize_raw, :initialize
|
20
|
-
def initialize(red, green, blue, alpha)
|
41
|
+
def initialize(red=nil, green=nil, blue=nil, alpha=nil)
|
21
42
|
initialize_raw
|
22
|
-
self.red = red
|
23
|
-
self.green = green
|
24
|
-
self.blue = blue
|
25
|
-
self.alpha = alpha
|
43
|
+
self.red = red if red
|
44
|
+
self.green = green if green
|
45
|
+
self.blue = blue if blue
|
46
|
+
self.alpha = alpha || 1.0
|
26
47
|
end
|
27
48
|
|
28
49
|
def to_a
|
data/lib/gdk3/screen.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (C) 2015 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module Gdk
|
18
|
+
class Screen
|
19
|
+
alias_method :get_setting_raw, :get_setting
|
20
|
+
def get_setting(key, type=nil)
|
21
|
+
value = GLib::Value.new(type || GLib::Type::STRING)
|
22
|
+
found = get_setting_raw(key, value)
|
23
|
+
if found
|
24
|
+
value
|
25
|
+
else
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_monitor(window_or_x, y=nil)
|
31
|
+
if window_or_x.is_a?(Window)
|
32
|
+
window = window_or_x
|
33
|
+
get_monitor_at_window(window)
|
34
|
+
else
|
35
|
+
x = window_or_x
|
36
|
+
get_monitor_at_point(x, y)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
Binary file
|
data/test/gdk-test-utils.rb
CHANGED
@@ -18,4 +18,17 @@ require "test-unit"
|
|
18
18
|
require "test/unit/notify"
|
19
19
|
|
20
20
|
module GdkTestUtils
|
21
|
+
private
|
22
|
+
def only_gdk_version(major, minor, micro=nil)
|
23
|
+
micro ||= 0
|
24
|
+
gdk_version_raw = `pkg-config --modversion gdk-3.0`.chomp
|
25
|
+
gdk_version = gdk_version_raw.split(".").collect(&:to_i)
|
26
|
+
unless (gdk_version <=> [major, minor, micro]) >= 0
|
27
|
+
omit("Require GDK >= #{major}.#{minor}.#{micro}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def fixture_path(*components)
|
32
|
+
File.join(File.dirname(__FILE__), "fixture", *components)
|
33
|
+
end
|
21
34
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkAtom < Test::Unit::TestCase
|
18
|
+
sub_test_case ".intern" do
|
19
|
+
def test_only_name
|
20
|
+
atom = Gdk::Atom.intern("CLIPBOARD")
|
21
|
+
assert_equal("CLIPBOARD", atom.name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2015 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkCursor < Test::Unit::TestCase
|
18
|
+
include GdkTestUtils
|
19
|
+
|
20
|
+
sub_test_case ".new" do
|
21
|
+
test "type" do
|
22
|
+
cursor = Gdk::Cursor.new(:arrow)
|
23
|
+
assert_equal(Gdk::CursorType::ARROW, cursor.cursor_type)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "pixbuf" do
|
27
|
+
pixbuf = Gdk::Pixbuf.new(:file => fixture_path("ruby-gnome2-logo.png"))
|
28
|
+
cursor = Gdk::Cursor.new(pixbuf, 0, 0)
|
29
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
30
|
+
end
|
31
|
+
|
32
|
+
test "surface" do
|
33
|
+
only_gdk_version(3, 10, 0)
|
34
|
+
surface = Cairo::ImageSurface.new(100, 100)
|
35
|
+
cursor = Gdk::Cursor.new(surface, 0, 0)
|
36
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
37
|
+
end
|
38
|
+
|
39
|
+
test "name" do
|
40
|
+
cursor = Gdk::Cursor.new("cross")
|
41
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2015 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkEventMask < Test::Unit::TestCase
|
18
|
+
def test_button_press_mask
|
19
|
+
assert_equal("button-press-mask", Gdk::EventMask::BUTTON_PRESS_MASK.nick)
|
20
|
+
end
|
21
|
+
end
|
data/test/test-gdk-keyval.rb
CHANGED
@@ -19,6 +19,14 @@ class TestGdkKeyval < Test::Unit::TestCase
|
|
19
19
|
assert_equal("a".unpack("c")[0], Gdk::Keyval::KEY_a)
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_to_name
|
23
|
+
assert_equal("A", Gdk::Keyval.to_name(Gdk::Keyval::KEY_A))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_from_name
|
27
|
+
assert_equal("A".unpack("c")[0], Gdk::Keyval.from_name("A"))
|
28
|
+
end
|
29
|
+
|
22
30
|
sub_test_case "#lower?" do
|
23
31
|
def test_lower
|
24
32
|
assert_true(Gdk::Keyval.lower?(Gdk::Keyval::KEY_a))
|
@@ -39,10 +47,6 @@ class TestGdkKeyval < Test::Unit::TestCase
|
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
42
|
-
def test_name
|
43
|
-
assert_equal("A", Gdk::Keyval.name(Gdk::Keyval::KEY_A))
|
44
|
-
end
|
45
|
-
|
46
50
|
sub_test_case "#to_lower" do
|
47
51
|
def test_lower
|
48
52
|
assert_equal(Gdk::Keyval::KEY_a,
|
data/test/test-gdk-rectangle.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013-
|
3
|
+
# Copyright (C) 2013-2015 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
|
@@ -52,4 +52,23 @@ class TestGdkRectangle < Test::Unit::TestCase
|
|
52
52
|
unioned_rectangle.height,
|
53
53
|
])
|
54
54
|
end
|
55
|
+
|
56
|
+
def test_to_a
|
57
|
+
rectangle = Gdk::Rectangle.new(0, 10, 20, 30)
|
58
|
+
assert_equal([
|
59
|
+
0,
|
60
|
+
10,
|
61
|
+
20,
|
62
|
+
30,
|
63
|
+
],
|
64
|
+
rectangle.to_a)
|
65
|
+
end
|
66
|
+
|
67
|
+
test "#==" do
|
68
|
+
rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30)
|
69
|
+
rectangle2 = Gdk::Rectangle.new(0, 10, 20, 30)
|
70
|
+
assert do
|
71
|
+
rectangle1 == rectangle2
|
72
|
+
end
|
73
|
+
end
|
55
74
|
end
|
data/test/test-gdk-rgba.rb
CHANGED
@@ -26,4 +26,69 @@ class TestGdkRGBA < Test::Unit::TestCase
|
|
26
26
|
rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5)
|
27
27
|
assert_equal([0.2, 0.4, 0.6, 0.5], rgba.to_a)
|
28
28
|
end
|
29
|
+
|
30
|
+
sub_test_case("new") do
|
31
|
+
def test_empty
|
32
|
+
rgba = Gdk::RGBA.new
|
33
|
+
assert_equal([0.0, 0.0, 0.0, 1.0], rgba.to_a)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_rgb
|
37
|
+
rgba = Gdk::RGBA.new(0.2, 0.4, 0.6)
|
38
|
+
assert_equal([0.2, 0.4, 0.6, 1.0], rgba.to_a)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
sub_test_case("parse") do
|
43
|
+
def test_name
|
44
|
+
rgba = Gdk::RGBA.parse("red")
|
45
|
+
assert_equal([1.0, 0.0, 0.0, 1.0], rgba.to_a)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_hash_rgb
|
49
|
+
rgba = Gdk::RGBA.parse("#f0f")
|
50
|
+
assert_equal([1.0, 0.0, 1.0, 1.0], rgba.to_a)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_hash_rrggbb
|
54
|
+
rgba = Gdk::RGBA.parse("#ff00ff")
|
55
|
+
assert_equal([1.0, 0.0, 1.0, 1.0], rgba.to_a)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_hash_rrrgggbbb
|
59
|
+
rgba = Gdk::RGBA.parse("#fff000fff")
|
60
|
+
assert_equal([1.0, 0.0, 1.0, 1.0], rgba.to_a)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_hash_rrrrggggbbbb
|
64
|
+
rgba = Gdk::RGBA.parse("#ffff0000ffff")
|
65
|
+
assert_equal([1.0, 0.0, 1.0, 1.0], rgba.to_a)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_rgb
|
69
|
+
rgba = Gdk::RGBA.parse("rgb(255, 0, 255)")
|
70
|
+
assert_equal([1.0, 0.0, 1.0, 1.0], rgba.to_a)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_rgba
|
74
|
+
rgba = Gdk::RGBA.parse("rgba(255, 0, 255, 0.5)")
|
75
|
+
assert_equal([1.0, 0.0, 1.0, 0.5], rgba.to_a)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_invalid
|
79
|
+
message = "invalid RGBA format: \"invalid\" "
|
80
|
+
message << "(available formats: "
|
81
|
+
message << "COLOR_NAME, "
|
82
|
+
message << "\#RGB, "
|
83
|
+
message << "\#RRGGBB, "
|
84
|
+
message << "\#RRRGGGBBB, "
|
85
|
+
message << "\#RRRRGGGGBBBB, "
|
86
|
+
message << "rgb(R, G, B), "
|
87
|
+
message << "rgba(R, G, B, A)"
|
88
|
+
message << ")"
|
89
|
+
assert_raise(ArgumentError.new(message)) do
|
90
|
+
Gdk::RGBA.parse("invalid")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
29
94
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkSelection < Test::Unit::TestCase
|
18
|
+
class TestConstant < self
|
19
|
+
def test_primary
|
20
|
+
atom = Gdk::Selection::PRIMARY
|
21
|
+
assert_equal("PRIMARY", atom.name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_clipboard
|
25
|
+
atom = Gdk::Selection::CLIPBOARD
|
26
|
+
assert_equal("CLIPBOARD", atom.name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdk3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
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: 2015-
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pango
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.1
|
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:
|
26
|
+
version: 3.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gdk_pixbuf2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.0.1
|
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:
|
40
|
+
version: 3.0.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cairo-gobject
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.0.1
|
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:
|
54
|
+
version: 3.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gobject-introspection
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.1
|
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:
|
68
|
+
version: 3.0.1
|
69
69
|
description: Ruby/GDK3 is a Ruby binding of GDK-3.x.
|
70
70
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
71
71
|
executables: []
|
@@ -77,17 +77,23 @@ files:
|
|
77
77
|
- lib/gdk3/atom.rb
|
78
78
|
- lib/gdk3/cairo.rb
|
79
79
|
- lib/gdk3/color.rb
|
80
|
+
- lib/gdk3/cursor.rb
|
80
81
|
- lib/gdk3/deprecated.rb
|
81
82
|
- lib/gdk3/event.rb
|
82
83
|
- lib/gdk3/loader.rb
|
83
84
|
- lib/gdk3/rectangle.rb
|
84
85
|
- lib/gdk3/rgba.rb
|
86
|
+
- lib/gdk3/screen.rb
|
85
87
|
- lib/gdk3/window-attr.rb
|
86
88
|
- lib/gdk3/window.rb
|
89
|
+
- test/fixture/ruby-gnome2-logo.png
|
87
90
|
- test/gdk-test-utils.rb
|
88
91
|
- test/run-test.rb
|
92
|
+
- test/test-gdk-atom.rb
|
89
93
|
- test/test-gdk-cairo.rb
|
90
94
|
- test/test-gdk-color.rb
|
95
|
+
- test/test-gdk-cursor.rb
|
96
|
+
- test/test-gdk-event-mask.rb
|
91
97
|
- test/test-gdk-event-type.rb
|
92
98
|
- test/test-gdk-event.rb
|
93
99
|
- test/test-gdk-geometry.rb
|
@@ -95,6 +101,7 @@ files:
|
|
95
101
|
- test/test-gdk-pixbuf.rb
|
96
102
|
- test/test-gdk-rectangle.rb
|
97
103
|
- test/test-gdk-rgba.rb
|
104
|
+
- test/test-gdk-selection.rb
|
98
105
|
- test/test-gdk-window-attr.rb
|
99
106
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
100
107
|
licenses:
|