gdk4 3.5.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependency-check/Rakefile +1 -0
- data/lib/gdk4/cairo.rb +15 -11
- data/{test/test-gdk-event-type.rb → lib/gdk4/cursor.rb} +15 -8
- data/lib/gdk4/deprecated.rb +156 -0
- data/lib/gdk4/loader.rb +179 -21
- data/{test/test-gdk-geometry.rb → lib/gdk4/paintable.rb} +13 -7
- data/lib/gdk4/rgba.rb +12 -1
- data/{test/test-gdk-event-mask.rb → lib/gdk4/texture.rb} +13 -4
- data/lib/gdk4/x11-loader.rb +17 -3
- data/lib/gdk4.rb +3 -11
- data/test/gdk-test-utils.rb +10 -2
- data/test/run-test.rb +2 -4
- data/test/test-gdk-cursor.rb +14 -17
- data/test/test-gdk-event.rb +1 -672
- data/test/test-gdk-pixbuf.rb +1 -18
- data/test/test-gdk-rgba.rb +33 -13
- metadata +15 -16
- data/test/test-gdk-selection.rb +0 -29
- data/test/test-gdk-window-attr.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df4c73995ff99de3a9e7cb197fd85a3054e98f690b772fc71cb0b127b93c3e4d
|
4
|
+
data.tar.gz: f9dc155e83b4a054c991701394b45433a34e2257fedb29237919c4de27a32af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e2795e7e3830e3a3b3a60f0b2f2da53ae9abd484129435fc72d54e95ec2b2d6d05fd6c1c711565f0a0164b55e3948c210a03e67ae26503ce0e8a6663bdd4856
|
7
|
+
data.tar.gz: ffb0f5a0fa906dd56206f71bc58f9d52a0990d4c67c41ec31c7d39aee85c1a59f17ed39ceebc01afaf0fa8ca556e02bcf4b530abd690006beb49ab6c4aeb3134
|
data/dependency-check/Rakefile
CHANGED
@@ -32,6 +32,7 @@ namespace :dependency do
|
|
32
32
|
package_id = "gtk4"
|
33
33
|
unless PKGConfig.check_version?(package_id)
|
34
34
|
unless NativePackageInstaller.install(:alt_linux => "libgtk+4-devel",
|
35
|
+
:arch_linux => "gtk4",
|
35
36
|
:debian => "libgtk-4-dev",
|
36
37
|
:redhat => "pkgconfig(#{package_id})",
|
37
38
|
:homebrew => "gtk+4",
|
data/lib/gdk4/cairo.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2022 Ruby-GNOME 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
|
@@ -16,17 +16,21 @@
|
|
16
16
|
|
17
17
|
module Cairo
|
18
18
|
class Context
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
if method_defined?(:set_source_rgba)
|
20
|
+
alias_method :set_source_rgba_raw, :set_source_rgba
|
21
|
+
def set_source_rgba(rgba, g=nil, b=nil, a=nil)
|
22
|
+
case rgba
|
23
|
+
when Gdk::RGBA
|
24
|
+
set_source_gdk_rgba(rgba)
|
25
|
+
when Array
|
26
|
+
set_source_rgba_raw(rgba)
|
27
|
+
else
|
28
|
+
r = rgba
|
29
|
+
set_source_rgba_raw([r, g, b, a || 1.0])
|
30
|
+
end
|
29
31
|
end
|
32
|
+
else
|
33
|
+
alias_method :set_source_rgba, :set_source_gdk_rgba
|
30
34
|
end
|
31
35
|
|
32
36
|
def source_rgba=(rgba)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2015-2022 Ruby-GNOME 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
|
@@ -14,12 +14,19 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
module Gdk
|
18
|
+
class Cursor
|
19
|
+
@caches = {}
|
20
|
+
class << self
|
21
|
+
def new(*args)
|
22
|
+
first_arg = args.first
|
23
|
+
case first_arg
|
24
|
+
when String, Symbol
|
25
|
+
@caches[first_arg] ||= super
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
24
31
|
end
|
25
32
|
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# Copyright (C) 2011-2022 Ruby-GNOME 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
|
+
extend GLib::Deprecatable
|
19
|
+
define_deprecated_const :Atom, raise: "No longer available in GDK 4."
|
20
|
+
define_deprecated_const :Color, raise: "No longer available in GDK 4."
|
21
|
+
define_deprecated_const :Colormap, raise: "Use 'Gdk::Visual' instead."
|
22
|
+
define_deprecated_const :Color, raise: "No longer available in GDK 4."
|
23
|
+
define_deprecated_const :DragContext, raise: "No longer available in GDK 4."
|
24
|
+
define_deprecated_const :EventCrossing, "Gdk::CrossingEvent"
|
25
|
+
define_deprecated_const :EventMask, raise: "No longer available in GDK 4."
|
26
|
+
define_deprecated_const :EventOwnerChange, raise: "No longer available in GDK 4."
|
27
|
+
define_deprecated_const :EventProperty, raise: "No longer available in GDK 4."
|
28
|
+
define_deprecated_const :EventScroll, "Gdk::ScrollEvent"
|
29
|
+
define_deprecated_const :EventSetting, raise: "No longer available in GDK 4."
|
30
|
+
define_deprecated_const :EventVisibility, raise: "No longer available in GDK 4."
|
31
|
+
define_deprecated_const :EventWindowState, raise: "No longer available in GDK 4."
|
32
|
+
define_deprecated_const :FilterReturn, raise: "No longer available in GDK 4."
|
33
|
+
define_deprecated_const :GrabStatus, raise: "No longer available in GDK 4."
|
34
|
+
define_deprecated_const :Image,
|
35
|
+
raise: "Use 'GdkPixbuf::Pixbuf' or 'Cairo::Surface' instead."
|
36
|
+
define_deprecated_const :Input, raise: "Use 'GLib::IOChannel' instead."
|
37
|
+
define_deprecated_const :Property, raise: "No longer available in GDK 4."
|
38
|
+
define_deprecated_const :Screen, raise: "No longer available in GDK 4."
|
39
|
+
define_deprecated_const :Selection, raise: "No longer available in GDK 4."
|
40
|
+
define_deprecated_const :Status, raise: "No longer available in GDK 4."
|
41
|
+
define_deprecated_const :Visual, raise: "No longer available in GDK 4."
|
42
|
+
define_deprecated_const :Window, raise: "Use 'Gdk::Surface' instead."
|
43
|
+
define_deprecated_const :WindowAttr, raise: "No longer available in GDK 4."
|
44
|
+
define_deprecated_const :WindowAttributesType,
|
45
|
+
raise: "No longer available in GDK 4."
|
46
|
+
define_deprecated_const :WindowHints, raise: "No longer available in GDK 4."
|
47
|
+
define_deprecated_const :WindowType, raise: "No longer available in GDK 4."
|
48
|
+
define_deprecated_const :WindowTypeHint, raise: "No longer available in GDK 4."
|
49
|
+
define_deprecated_const :WindowWindowClass,
|
50
|
+
raise: "No longer available in GDK 4."
|
51
|
+
define_deprecated_const :WMDecoration, raise: "No longer available in GDK 4."
|
52
|
+
define_deprecated_const :WMFunction, raise: "No longer available in GDK 4."
|
53
|
+
define_deprecated_const :X11, 'GdkX11'
|
54
|
+
|
55
|
+
class Cursor
|
56
|
+
extend GLib::Deprecatable
|
57
|
+
define_deprecated_const :CursorType, raise: "No longer available in GDK 4."
|
58
|
+
define_deprecated_method :pixmap?, :warn => "Don't use this method." do |_self|
|
59
|
+
false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Device
|
64
|
+
extend GLib::Deprecatable
|
65
|
+
define_deprecated_enums :AxisUse, 'AXIS'
|
66
|
+
define_deprecated_const :EXTENSION_EVENTS_NONE,
|
67
|
+
raise: "No longer available in GDK 4."
|
68
|
+
define_deprecated_const :EXTENSION_EVENTS_ALL,
|
69
|
+
raise: "No longer available in GDK 4."
|
70
|
+
define_deprecated_const :EXTENSION_EVENTS_CURSOR,
|
71
|
+
raise: "No longer available in GDK 4."
|
72
|
+
define_deprecated_const :ExtensionMode,
|
73
|
+
raise: "No longer available in GDK 4."
|
74
|
+
define_deprecated_const :InputMode, raise: "No longer available in GDK 4."
|
75
|
+
define_deprecated_enums :InputSource, 'SOURCE'
|
76
|
+
end
|
77
|
+
|
78
|
+
class Display
|
79
|
+
extend GLib::Deprecatable
|
80
|
+
define_deprecated_method :double_click_time, :raise => "Don't use this method."
|
81
|
+
define_deprecated_method :double_click_distance, :raise => "Don't use this method."
|
82
|
+
define_deprecated_method :button_click_time, :raise => "Don't use this method."
|
83
|
+
define_deprecated_method :button_window, :raise => "Don't use this method."
|
84
|
+
define_deprecated_method :button_number, :raise => "Don't use this method."
|
85
|
+
define_deprecated_method :button_x, :raise => "Don't use this method."
|
86
|
+
define_deprecated_method :button_y, :raise => "Don't use this method."
|
87
|
+
end
|
88
|
+
|
89
|
+
class Event
|
90
|
+
extend GLib::Deprecatable
|
91
|
+
|
92
|
+
define_deprecated_const :CURRENT_TIME, "Gdk::CURRENT_TIME"
|
93
|
+
|
94
|
+
define_deprecated_const :Mask, raise: "No longer available in GDK 4."
|
95
|
+
|
96
|
+
define_deprecated_const :Type, "Gdk::EventType"
|
97
|
+
define_deprecated_enums "Gdk::EventType"
|
98
|
+
end
|
99
|
+
|
100
|
+
module Keyval
|
101
|
+
extend GLib::Deprecatable
|
102
|
+
constants.each do |key|
|
103
|
+
old_names = []
|
104
|
+
old_names << key.to_s.sub(/^KEY_/, 'GDK_KEY_')
|
105
|
+
old_names << key.to_s.sub(/^KEY_/, 'GDK_')
|
106
|
+
old_names.each do |old_name|
|
107
|
+
define_deprecated_const old_name, [self, key].join('::')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class Pixmap
|
113
|
+
extend GLib::Deprecatable
|
114
|
+
define_deprecated_method :initialize, :raise => "Use 'Gdk::Window#create_similar_surface'."
|
115
|
+
define_deprecated_singleton_method :create_from_data, :raise => "Use 'Cairo::ImageSurface.new'."
|
116
|
+
define_deprecated_singleton_method :create_from_xbm, :raise => "Use 'Cairo::ImageSurface.new'."
|
117
|
+
define_deprecated_singleton_method :create_from_xpm, :raise => "Use 'GdkPixbuf::Pixbuf.new'."
|
118
|
+
define_deprecated_singleton_method :create_from_xpm_d, :raise => "Use 'GdkPixbuf::Pixbuf.new'."
|
119
|
+
define_deprecated_singleton_method :colormap_create_from_xpm, :raise => "Use 'GdkPixbuf::Pixbuf.new'."
|
120
|
+
define_deprecated_singleton_method :colormap_create_from_xpm_d, :raise => "Use 'GdkPixbuf::Pixbuf.new'."
|
121
|
+
define_deprecated_singleton_method :foreign_new, :raise => "Don't use this method."
|
122
|
+
define_deprecated_singleton_method :lookup, :raise => "Don't use this method."
|
123
|
+
end
|
124
|
+
|
125
|
+
class Surface
|
126
|
+
extend GLib::Deprecatable
|
127
|
+
|
128
|
+
define_deprecated_const :Gravity, "Gdk::Gravity"
|
129
|
+
define_deprecated_enums "Gdk::Gravity"
|
130
|
+
define_deprecated_const :AttributesType,
|
131
|
+
raise: "No longer available in GDK 4."
|
132
|
+
define_deprecated_const :Edge, "Gdk::SurfaceEdge"
|
133
|
+
define_deprecated_enums "Gdk::SurfaceEdge"
|
134
|
+
define_deprecated_const :FilterReturn,
|
135
|
+
raise: "No longer available in GDK 4."
|
136
|
+
define_deprecated_const :Hints, raise: "No longer available in GDK 4."
|
137
|
+
define_deprecated_const :ModifierType, "Gdk::ModifierType"
|
138
|
+
define_deprecated_enums "Gdk::ModifierType"
|
139
|
+
define_deprecated_const :Type, raise: "No longer available in GDK 4."
|
140
|
+
define_deprecated_const :TypeHint, raise: "No longer available in GDK 4."
|
141
|
+
define_deprecated_const :Class, raise: "No longer available in GDK 4."
|
142
|
+
define_deprecated_const :WMDecoration, raise: "No longer available in GDK 4."
|
143
|
+
define_deprecated_const :WMFunction, raise: "No longer available in GDK 4."
|
144
|
+
define_deprecated_const :PARENT_RELATIVE, "Gdk::PARENT_RELATIVE"
|
145
|
+
define_deprecated_method :clear, :warn => "Don't use this method."
|
146
|
+
define_deprecated_method :clear_area, :warn => "Don't use this method."
|
147
|
+
define_deprecated_method :internal_paint_info, :raise => "Don't use this method."
|
148
|
+
define_deprecated_method :shape_combine_mask, :warn => "Don't use this method."
|
149
|
+
define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method."
|
150
|
+
define_deprecated_method :set_back_pixmap, :warn => "Don't use this method."
|
151
|
+
define_deprecated_method :size, :warn => "Use #width and #height instead." do |_self|
|
152
|
+
[_self.width, _self.height]
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
data/lib/gdk4/loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2022 Ruby-GNOME 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
|
@@ -22,59 +22,217 @@ module Gdk
|
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
|
+
def event_class
|
26
|
+
@event_class ||= @base_module.const_get(:Event)
|
27
|
+
end
|
28
|
+
|
25
29
|
def pre_load(repository, namespace)
|
26
|
-
|
30
|
+
setup_pending_constants
|
31
|
+
setup_pending_rectangle_functions
|
32
|
+
define_keyval_module
|
33
|
+
define_event_methods_module
|
34
|
+
define_cairo_context_methods_module
|
35
|
+
define_cairo_surface_methods_module
|
36
|
+
require_pre_libraries
|
27
37
|
end
|
28
38
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
def define_keyval_module
|
40
|
+
@keyval_module = define_methods_module(:Keyval)
|
41
|
+
end
|
42
|
+
|
43
|
+
def post_keyval_module
|
44
|
+
post_methods_module(@keyval_module)
|
45
|
+
end
|
46
|
+
|
47
|
+
def define_event_methods_module
|
48
|
+
@event_methods_module =
|
49
|
+
define_methods_module(:EventMethods)
|
50
|
+
end
|
51
|
+
|
52
|
+
def apply_event_methods
|
53
|
+
apply_methods_module(@event_methods_module,
|
54
|
+
event_class)
|
55
|
+
end
|
56
|
+
|
57
|
+
def define_cairo_context_methods_module
|
58
|
+
@cairo_context_methods_module =
|
59
|
+
define_methods_module(:CairoContextMethods)
|
60
|
+
end
|
61
|
+
|
62
|
+
def apply_cairo_context_methods
|
63
|
+
apply_methods_module(@cairo_context_methods_module, Cairo::Context)
|
64
|
+
end
|
65
|
+
|
66
|
+
def define_cairo_surface_methods_module
|
67
|
+
@cairo_surface_methods_module =
|
68
|
+
define_methods_module(:CairoSurfaceMethods)
|
69
|
+
end
|
70
|
+
|
71
|
+
def apply_cairo_surface_methods
|
72
|
+
apply_methods_module(@cairo_surface_methods_module, Cairo::Surface)
|
73
|
+
end
|
74
|
+
|
75
|
+
def require_pre_libraries
|
38
76
|
end
|
39
77
|
|
40
78
|
def post_load(repository, namespace)
|
41
|
-
|
79
|
+
apply_pending_constants
|
80
|
+
apply_pending_rectangle_functions
|
81
|
+
post_keyval_module
|
82
|
+
apply_event_methods
|
83
|
+
apply_cairo_context_methods
|
84
|
+
apply_cairo_surface_methods
|
85
|
+
require_post_libraries
|
86
|
+
end
|
87
|
+
|
88
|
+
def setup_pending_constants
|
89
|
+
@pending_constants = []
|
42
90
|
end
|
43
91
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
92
|
+
def apply_pending_constants
|
93
|
+
@pending_constants.each do |info|
|
94
|
+
case info.name
|
95
|
+
when /\AEVENT_/
|
96
|
+
event_class.const_set($POSTMATCH, info.value)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def setup_pending_rectangle_functions
|
102
|
+
@pending_rectangle_get_type_function = nil
|
103
|
+
@pending_rectangle_functions = []
|
104
|
+
end
|
105
|
+
|
106
|
+
def apply_pending_rectangle_functions
|
107
|
+
get_type_info = @pending_rectangle_get_type_function
|
108
|
+
if get_type_info
|
109
|
+
rectangle_class = load_cairo_rectangle_int
|
110
|
+
gtype = get_type_info.invoke([])
|
111
|
+
self.class.register_boxed_class_converter(gtype) do |rectangle|
|
112
|
+
rectangle_class
|
113
|
+
end
|
114
|
+
else
|
115
|
+
rectangle_class = @base_module.const_get(:Rectangle)
|
116
|
+
end
|
117
|
+
|
118
|
+
@pending_rectangle_functions.each do |info|
|
119
|
+
name = rubyish_method_name(info, :prefix => "rectangle_")
|
120
|
+
define_method(info, rectangle_class, name)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def load_cairo_rectangle_int
|
125
|
+
info = find_cairo_rectangle_int_info
|
126
|
+
klass = self.class.define_class(info.gtype,
|
127
|
+
"Rectangle",
|
128
|
+
@base_module,
|
129
|
+
:size => info.size)
|
130
|
+
load_fields(info, klass)
|
131
|
+
load_methods(info, klass)
|
132
|
+
klass
|
133
|
+
end
|
134
|
+
|
135
|
+
def find_cairo_rectangle_int_info
|
136
|
+
repository = GObjectIntrospection::Repository.default
|
137
|
+
repository.each("cairo") do |info|
|
138
|
+
if info.name == "RectangleInt"
|
139
|
+
return info
|
140
|
+
end
|
141
|
+
end
|
142
|
+
nil
|
143
|
+
end
|
144
|
+
|
145
|
+
def require_post_libraries
|
146
|
+
require_relative "cursor"
|
147
|
+
require_relative "paintable"
|
148
|
+
require_relative "rectangle"
|
149
|
+
require_relative "rgba"
|
150
|
+
require_relative "texture"
|
151
|
+
|
152
|
+
require_relative "cairo"
|
153
|
+
|
154
|
+
require_relative "deprecated"
|
49
155
|
end
|
50
156
|
|
51
157
|
def load_function_info(info)
|
52
158
|
name = info.name
|
53
159
|
case name
|
160
|
+
when "rectangle_get_type"
|
161
|
+
@pending_rectangle_get_type_function = info
|
162
|
+
when /\Arectangle_/
|
163
|
+
@pending_rectangle_functions << info
|
164
|
+
when "init", /_get_type\z/
|
165
|
+
# ignore
|
54
166
|
when /\Apixbuf_/
|
55
167
|
target_class = nil
|
56
168
|
case $POSTMATCH
|
57
169
|
when "get_from_surface"
|
58
|
-
target_class =
|
170
|
+
target_class = @cairo_surface_methods_module
|
59
171
|
end
|
60
172
|
if target_class
|
61
173
|
define_method(info, target_class, "to_pixbuf")
|
62
174
|
else
|
63
175
|
super
|
64
176
|
end
|
177
|
+
when /\Aevents_/
|
178
|
+
method_name = rubyish_method_name(info, :prefix => "events_")
|
179
|
+
define_method(info, @event_methods_module, method_name)
|
65
180
|
when /\Acairo_/
|
66
181
|
name = $POSTMATCH
|
67
182
|
case name
|
183
|
+
when "set_source_color"
|
184
|
+
define_method(info,
|
185
|
+
@cairo_context_methods_module,
|
186
|
+
"set_source_gdk_color")
|
68
187
|
when "set_source_rgba"
|
69
|
-
define_method(info,
|
188
|
+
define_method(info,
|
189
|
+
@cairo_context_methods_module,
|
190
|
+
"set_source_gdk_rgba")
|
70
191
|
when "rectangle"
|
71
|
-
define_method(info,
|
192
|
+
define_method(info,
|
193
|
+
@cairo_context_methods_module,
|
194
|
+
"gdk_rectangle")
|
195
|
+
when "region_create_from_surface"
|
196
|
+
# TODO
|
72
197
|
else
|
73
|
-
define_method(info,
|
198
|
+
define_method(info, @cairo_context_methods_module, name)
|
74
199
|
end
|
200
|
+
when /\Akeyval_/
|
201
|
+
name = rubyish_method_name(info, :prefix => "keyval_")
|
202
|
+
case name
|
203
|
+
when "name"
|
204
|
+
name = "to_name"
|
205
|
+
end
|
206
|
+
define_module_function(@keyval_module, name, info)
|
207
|
+
else
|
208
|
+
super
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def load_constant_info(info)
|
213
|
+
case info.name
|
214
|
+
when /\AEVENT_/
|
215
|
+
@pending_constants << info
|
216
|
+
when /\AKEY_/
|
217
|
+
@keyval_module.const_set(info.name, info.value)
|
75
218
|
else
|
76
219
|
super
|
77
220
|
end
|
78
221
|
end
|
222
|
+
|
223
|
+
def may_be_cached?(constructor_info, klass)
|
224
|
+
case klass.name
|
225
|
+
when "Gdk::Cursor"
|
226
|
+
case constructor_info.name
|
227
|
+
when "new_from_name", "new_for_display"
|
228
|
+
true
|
229
|
+
# false
|
230
|
+
else
|
231
|
+
false
|
232
|
+
end
|
233
|
+
else
|
234
|
+
false
|
235
|
+
end
|
236
|
+
end
|
79
237
|
end
|
80
238
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2022 Ruby-GNOME Project Team
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,9 +14,17 @@
|
|
16
14
|
# License along with this library; if not, write to the Free Software
|
17
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
module Gdk
|
18
|
+
module Paintable
|
19
|
+
class << self
|
20
|
+
def try_convert(value)
|
21
|
+
case value
|
22
|
+
when GdkPixbuf::Pixbuf
|
23
|
+
Texture.new(value)
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
23
29
|
end
|
24
30
|
end
|
data/lib/gdk4/rgba.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-
|
1
|
+
# Copyright (C) 2014-2022 Ruby-GNOME 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
|
@@ -35,6 +35,17 @@ module Gdk
|
|
35
35
|
end
|
36
36
|
rgba
|
37
37
|
end
|
38
|
+
|
39
|
+
def try_convert(value)
|
40
|
+
case value
|
41
|
+
when String
|
42
|
+
parse(value)
|
43
|
+
when Symbol
|
44
|
+
parse(value.to_s)
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
38
49
|
end
|
39
50
|
|
40
51
|
alias_method :initialize_raw, :initialize
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2022 Ruby-GNOME 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
|
@@ -14,8 +14,17 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
module Gdk
|
18
|
+
class Texture
|
19
|
+
class << self
|
20
|
+
def try_convert(value)
|
21
|
+
case value
|
22
|
+
when GdkPixbuf::Pixbuf
|
23
|
+
new(value)
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
data/lib/gdk4/x11-loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017-
|
1
|
+
# Copyright (C) 2017-2022 Ruby-GNOME 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
|
@@ -14,8 +14,8 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
-
module
|
18
|
-
class
|
17
|
+
module GdkX11
|
18
|
+
class Loader < GObjectIntrospection::Loader
|
19
19
|
def load
|
20
20
|
self.version = "4.0"
|
21
21
|
begin
|
@@ -24,5 +24,19 @@ module Gdk
|
|
24
24
|
# Ignore. Some environments such as Windows don't have it.
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def post_load(repository, namespace)
|
30
|
+
@base_module.constants.each do |constant|
|
31
|
+
case constant
|
32
|
+
when :INVOKERS,
|
33
|
+
:Loader
|
34
|
+
next
|
35
|
+
else
|
36
|
+
value = @base_module.const_get(constant)
|
37
|
+
Gdk.const_set(constant, value)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
27
41
|
end
|
28
42
|
end
|
data/lib/gdk4.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2022 Ruby-GNOME 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
|
@@ -14,11 +14,9 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
-
require "gobject-introspection"
|
18
17
|
require "cairo-gobject"
|
19
|
-
require "atk"
|
20
|
-
require "pango"
|
21
18
|
require "gdk_pixbuf2"
|
19
|
+
require "pango"
|
22
20
|
|
23
21
|
require "gdk4/loader"
|
24
22
|
require "gdk4/x11-loader"
|
@@ -32,12 +30,6 @@ module Gdk
|
|
32
30
|
|
33
31
|
loader = Loader.new(self)
|
34
32
|
loader.load
|
35
|
-
x11_loader =
|
33
|
+
x11_loader = GdkX11::Loader.new(GdkX11)
|
36
34
|
x11_loader.load
|
37
|
-
|
38
|
-
class << self
|
39
|
-
def cairo_available?
|
40
|
-
true
|
41
|
-
end
|
42
|
-
end
|
43
35
|
end
|
data/test/gdk-test-utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2022 Ruby-GNOME 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
|
@@ -14,10 +14,18 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
+
require "pkg-config"
|
18
|
+
require "test-unit"
|
19
|
+
|
20
|
+
require "gdk4"
|
21
|
+
|
17
22
|
module GdkTestUtils
|
18
23
|
private
|
19
24
|
def only_gdk_version(major, minor, micro=nil)
|
20
|
-
|
25
|
+
micro ||= 0
|
26
|
+
gdk_version_raw = PKGConfig.modversion("gdk-4.0")
|
27
|
+
gdk_version = gdk_version_raw.split(".").collect(&:to_i)
|
28
|
+
unless (gdk_version <=> [major, minor, micro]) >= 0
|
21
29
|
omit("Require GDK >= #{major}.#{minor}.#{micro}")
|
22
30
|
end
|
23
31
|
end
|