gtk4 4.2.4 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/gtk4.gemspec +11 -1
- data/lib/gtk4/gesture-stylus.rb +29 -0
- data/lib/gtk4/loader.rb +2 -1
- data/lib/gtk4/text-buffer.rb +4 -4
- data/sample/demos/gtk-demo/demo.rb +14 -3
- data/sample/demos/gtk-demo/glarea.rb +8 -3
- data/sample/demos/gtk-demo/main.rb +14 -1
- data/sample/demos/gtk-demo/shortcut-triggers.rb +78 -0
- metadata +16 -9
- data/sample/demos/gtk-demo/demo.gresource +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31fe92bf36d22026445ef5d3293920205d0aa0d5ca5fc98a648d54e0b6f99066
|
4
|
+
data.tar.gz: 5f6883ca74076c77d31899aecd8af05160eb25191e633d6703da356c3cd4bdc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d0e7a5464403f05a523e6b6341874ac41ec251d0547610df5ac61e604843c43ff9e0b51d430b55865cdc2dcb76d52ce13f836a06cf4b4b1b964a92b7fca380c
|
7
|
+
data.tar.gz: bb29b6eb5553f04a4d59e0eac30587ee09883fab58c9f1eb3d534be488fd2f97604afe0cfbdfef63fc061fe5f76811191b267eaa705f7eb1005938559ed6416a
|
data/Rakefile
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
$LOAD_PATH.unshift("./../glib2/lib")
|
20
|
-
require "
|
20
|
+
require "gnome/rake/package-task"
|
21
21
|
|
22
22
|
package_name = File.basename(__dir__)
|
23
23
|
spec = Gem::Specification.load("#{package_name}.gemspec")
|
24
24
|
|
25
|
-
|
25
|
+
GNOME::Rake::PackageTask.define(spec, __dir__) do |package|
|
26
26
|
end
|
data/gtk4.gemspec
CHANGED
@@ -21,7 +21,17 @@ require_relative "../glib2/version"
|
|
21
21
|
Gem::Specification.new do |s|
|
22
22
|
s.name = "gtk4"
|
23
23
|
s.summary = "Ruby/GTK4 is a Ruby binding of GTK+-4.x."
|
24
|
-
s.description
|
24
|
+
s.description = "Ruby/GTK4 is a Ruby binding of GTK 4.x. It allows Ruby " +
|
25
|
+
"programmers to use the GTK graphics toolkit to make " +
|
26
|
+
"graphical user interfaces for their Ruby scripts. " +
|
27
|
+
"Many of the programs you use like file explorers, " +
|
28
|
+
"browsers, graphics programs etc. use GTK to make their " +
|
29
|
+
"GUI. In fact, there's a good chance that you're looking at " +
|
30
|
+
"a GTK window right now. All the GTK commands and widgets " +
|
31
|
+
"have been translated into Ruby, so Ruby programmers can " +
|
32
|
+
"write scripts that create windows instead of only " +
|
33
|
+
"using the command line. Visit our homepage for install " +
|
34
|
+
"instructions and tutorials."
|
25
35
|
s.author = "The Ruby-GNOME Project Team"
|
26
36
|
s.email = "ruby-gnome2-devel-en@lists.sourceforge.net"
|
27
37
|
s.homepage = "https://ruby-gnome.github.io/"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (C) 2024 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 Gtk
|
18
|
+
class GestureStylus
|
19
|
+
alias_method :backlog_raw, :backlog
|
20
|
+
def backlog
|
21
|
+
have_backlog, backlog = backlog_raw
|
22
|
+
if have_backlog
|
23
|
+
backlog
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/gtk4/loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2024 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
|
@@ -95,6 +95,7 @@ module Gtk
|
|
95
95
|
require_relative "file-chooser-dialog"
|
96
96
|
require_relative "font-chooser-dialog"
|
97
97
|
require_relative "gesture-multi-press"
|
98
|
+
require_relative "gesture-stylus"
|
98
99
|
require_relative "icon-theme"
|
99
100
|
require_relative "icon-view"
|
100
101
|
require_relative "image"
|
data/lib/gtk4/text-buffer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2025 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
|
@@ -75,11 +75,11 @@ module Gtk
|
|
75
75
|
anchor = arguments[:anchor]
|
76
76
|
if line
|
77
77
|
if offset
|
78
|
-
get_iter_at_line_offset_raw(line, offset)
|
78
|
+
get_iter_at_line_offset_raw(line, offset)[1]
|
79
79
|
elsif index
|
80
|
-
get_iter_at_line_index_raw(line, index)
|
80
|
+
get_iter_at_line_index_raw(line, index)[1]
|
81
81
|
else
|
82
|
-
get_iter_at_line_raw(line)
|
82
|
+
get_iter_at_line_raw(line)[1]
|
83
83
|
end
|
84
84
|
elsif offset
|
85
85
|
get_iter_at_offset_raw(offset)
|
@@ -54,6 +54,8 @@ class GtkDemo < GLib::Object
|
|
54
54
|
install_property(GLib::Param::String.new("name", nil, nil, nil, :readable))
|
55
55
|
attr_reader :name
|
56
56
|
|
57
|
+
attr_reader :group
|
58
|
+
|
57
59
|
install_property(GLib::Param::String.new("title", nil, nil, nil, :readable))
|
58
60
|
attr_reader :title
|
59
61
|
|
@@ -66,9 +68,14 @@ class GtkDemo < GLib::Object
|
|
66
68
|
attr_reader :description
|
67
69
|
attr_accessor :children_model
|
68
70
|
|
69
|
-
def initialize(filename, title, description, keywords)
|
71
|
+
def initialize(filename, group, title, description, keywords)
|
70
72
|
super()
|
71
|
-
|
73
|
+
if filename.nil?
|
74
|
+
@name = nil
|
75
|
+
else
|
76
|
+
@name = File.basename(filename, ".rb")
|
77
|
+
end
|
78
|
+
@group = group
|
72
79
|
@title = title
|
73
80
|
@description = description
|
74
81
|
@keywords = keywords
|
@@ -76,7 +83,11 @@ class GtkDemo < GLib::Object
|
|
76
83
|
@children_model = nil
|
77
84
|
end
|
78
85
|
|
86
|
+
def group?
|
87
|
+
@name.nil?
|
88
|
+
end
|
89
|
+
|
79
90
|
def run(parent)
|
80
|
-
raise
|
91
|
+
raise NotImplementedError
|
81
92
|
end
|
82
93
|
end
|
@@ -21,7 +21,11 @@
|
|
21
21
|
# * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/AUTHORS
|
22
22
|
# * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/COPYING
|
23
23
|
|
24
|
-
|
24
|
+
begin
|
25
|
+
require "opengl"
|
26
|
+
rescue LoadError
|
27
|
+
$stderr.puts("opengl gem can't be loaded")
|
28
|
+
end
|
25
29
|
|
26
30
|
class GtkGLAreaDemo < GtkDemo
|
27
31
|
X_AXIS = 0
|
@@ -31,7 +35,8 @@ class GtkGLAreaDemo < GtkDemo
|
|
31
35
|
|
32
36
|
def initialize
|
33
37
|
super(__FILE__,
|
34
|
-
"OpenGL
|
38
|
+
"OpenGL",
|
39
|
+
"OpenGL Area",
|
35
40
|
"Gtk::GLArea is a widget that allows custom drawing using OpenGL calls.",
|
36
41
|
[])
|
37
42
|
end
|
@@ -319,5 +324,5 @@ class GtkGLAreaDemo < GtkDemo
|
|
319
324
|
box
|
320
325
|
end
|
321
326
|
|
322
|
-
GtkDemo.register(new)
|
327
|
+
GtkDemo.register(new) if defined?(GL)
|
323
328
|
end
|
@@ -55,6 +55,7 @@ end
|
|
55
55
|
|
56
56
|
|
57
57
|
def run_demo(demo, window)
|
58
|
+
return if demo.group?
|
58
59
|
demo_window = demo.run(window)
|
59
60
|
demo_window.transient_for = window
|
60
61
|
demo_window.modal = true
|
@@ -63,8 +64,19 @@ end
|
|
63
64
|
|
64
65
|
def create_demo_model(window)
|
65
66
|
store = Gio::ListStore.new(GtkDemo)
|
67
|
+
groups = {}
|
66
68
|
GtkDemo.all.each do |demo|
|
67
|
-
|
69
|
+
if demo.group
|
70
|
+
group = groups[demo.group]
|
71
|
+
if group.nil?
|
72
|
+
group = GtkDemo.new(nil, nil, demo.group, nil, [])
|
73
|
+
group.children_model = Gio::ListStore.new(GtkDemo)
|
74
|
+
end
|
75
|
+
group.children_model.append(demo)
|
76
|
+
store.append(group)
|
77
|
+
else
|
78
|
+
store.append(demo)
|
79
|
+
end
|
68
80
|
end
|
69
81
|
store
|
70
82
|
end
|
@@ -92,6 +104,7 @@ def select_item(selection, window, notebook, info_view)
|
|
92
104
|
notebook.sensitive = !!row
|
93
105
|
if row
|
94
106
|
demo = row.item
|
107
|
+
return if demo.group?
|
95
108
|
load_file(demo, notebook, info_view)
|
96
109
|
run_action = window.lookup_action("run")
|
97
110
|
run_action.enabled = true
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright (C) 2024 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
|
+
# Original:
|
18
|
+
# https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/gtk-demo/shortcut_triggers.c
|
19
|
+
#
|
20
|
+
# See the following for license information:
|
21
|
+
# * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/AUTHORS
|
22
|
+
# * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/COPYING
|
23
|
+
|
24
|
+
class ShortcutTriggersDemo < GtkDemo
|
25
|
+
def initialize
|
26
|
+
super(__FILE__,
|
27
|
+
nil,
|
28
|
+
"Shortcuts",
|
29
|
+
<<-DESCRIPTION,
|
30
|
+
Gtk::Shortcut is the abstraction used by GTK to handle shortcuts from
|
31
|
+
keyboard or other input devices.
|
32
|
+
|
33
|
+
Shortcut triggers can be used to weave complex sequences of key
|
34
|
+
presses into sophisticated mechanisms to activate shortcuts.
|
35
|
+
|
36
|
+
This demo code shows creative ways to do that.
|
37
|
+
DESCRIPTION
|
38
|
+
["Gtk::ShortcutController"])
|
39
|
+
end
|
40
|
+
|
41
|
+
def run(parent)
|
42
|
+
window = Gtk::Window.new
|
43
|
+
window.display = parent.display
|
44
|
+
window.title = "Shortcuts"
|
45
|
+
window.set_default_size(200, -1)
|
46
|
+
window.resizable = false
|
47
|
+
|
48
|
+
list = Gtk::ListBox.new
|
49
|
+
list.margin_top = 6
|
50
|
+
list.margin_bottom = 6
|
51
|
+
list.margin_start = 6
|
52
|
+
list.margin_end = 6
|
53
|
+
window.child = list
|
54
|
+
|
55
|
+
[
|
56
|
+
["Press Ctrl-g", Gtk::KeyvalTrigger.new(Gdk::Keyval::KEY_g, :control_mask)],
|
57
|
+
["Press x", Gtk::KeyvalTrigger.new(Gdk::Keyval::KEY_x, 0)],
|
58
|
+
].each do |label, trigger|
|
59
|
+
row = Gtk::Label.new(label)
|
60
|
+
list.append(row)
|
61
|
+
controller = Gtk::ShortcutController.new
|
62
|
+
controller.scope = :global
|
63
|
+
row.add_controller(controller)
|
64
|
+
|
65
|
+
action = Gtk::CallbackAction.new do
|
66
|
+
puts("activated: #{row.label}\n")
|
67
|
+
end
|
68
|
+
shortcut = Gtk::Shortcut.new(trigger, action)
|
69
|
+
controller.add_shortcut(shortcut)
|
70
|
+
end
|
71
|
+
|
72
|
+
window.present
|
73
|
+
|
74
|
+
window
|
75
|
+
end
|
76
|
+
|
77
|
+
GtkDemo.register(new)
|
78
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-01-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: atk
|
@@ -15,29 +15,35 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - '='
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 4.2.
|
18
|
+
version: 4.2.6
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - '='
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 4.2.
|
25
|
+
version: 4.2.6
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: gdk4
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - '='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 4.2.
|
32
|
+
version: 4.2.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - '='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 4.2.
|
40
|
-
description: Ruby/GTK4 is a Ruby binding of GTK
|
39
|
+
version: 4.2.6
|
40
|
+
description: Ruby/GTK4 is a Ruby binding of GTK 4.x. It allows Ruby programmers to
|
41
|
+
use the GTK graphics toolkit to make graphical user interfaces for their Ruby scripts.
|
42
|
+
Many of the programs you use like file explorers, browsers, graphics programs etc.
|
43
|
+
use GTK to make their GUI. In fact, there's a good chance that you're looking at
|
44
|
+
a GTK window right now. All the GTK commands and widgets have been translated into
|
45
|
+
Ruby, so Ruby programmers can write scripts that create windows instead of only
|
46
|
+
using the command line. Visit our homepage for install instructions and tutorials.
|
41
47
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
42
48
|
executables: []
|
43
49
|
extensions:
|
@@ -82,6 +88,7 @@ files:
|
|
82
88
|
- lib/gtk4/font-chooser-dialog.rb
|
83
89
|
- lib/gtk4/gdk-display.rb
|
84
90
|
- lib/gtk4/gesture-multi-press.rb
|
91
|
+
- lib/gtk4/gesture-stylus.rb
|
85
92
|
- lib/gtk4/icon-theme.rb
|
86
93
|
- lib/gtk4/icon-view.rb
|
87
94
|
- lib/gtk4/image.rb
|
@@ -122,7 +129,6 @@ files:
|
|
122
129
|
- sample/demos/gtk-demo/README.md
|
123
130
|
- sample/demos/gtk-demo/data/scalable/apps/org.gtk.Demo4.svg
|
124
131
|
- sample/demos/gtk-demo/data/symbolic/apps/org.gtk.Demo4-symbolic.svg
|
125
|
-
- sample/demos/gtk-demo/demo.gresource
|
126
132
|
- sample/demos/gtk-demo/demo.gresource.xml
|
127
133
|
- sample/demos/gtk-demo/demo.rb
|
128
134
|
- sample/demos/gtk-demo/glarea-gl.fs.glsl
|
@@ -133,6 +139,7 @@ files:
|
|
133
139
|
- sample/demos/gtk-demo/main-listitem.ui
|
134
140
|
- sample/demos/gtk-demo/main.rb
|
135
141
|
- sample/demos/gtk-demo/main.ui
|
142
|
+
- sample/demos/gtk-demo/shortcut-triggers.rb
|
136
143
|
- sample/examples/README.md
|
137
144
|
- sample/examples/action-namespace.rb
|
138
145
|
- sample/examples/application1/README.md
|
@@ -196,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
203
|
- !ruby/object:Gem::Version
|
197
204
|
version: '0'
|
198
205
|
requirements: []
|
199
|
-
rubygems_version: 3.6.
|
206
|
+
rubygems_version: 3.6.2
|
200
207
|
specification_version: 4
|
201
208
|
summary: Ruby/GTK4 is a Ruby binding of GTK+-4.x.
|
202
209
|
test_files: []
|
Binary file
|