gdk3 2.2.0 → 2.2.1
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 +18 -4
- data/lib/gdk3/atom.rb +26 -0
- data/lib/gdk3/cairo.rb +60 -0
- data/lib/gdk3/color.rb +27 -0
- data/lib/gdk3/deprecated.rb +14 -16
- data/lib/gdk3/event.rb +38 -0
- data/lib/gdk3/loader.rb +266 -0
- data/lib/gdk3/rectangle.rb +38 -0
- data/lib/gdk3/rgba.rb +32 -0
- data/lib/gdk3/window-attr.rb +28 -0
- data/lib/gdk3/window.rb +21 -0
- data/lib/gdk3.rb +61 -2
- data/test/run-test.rb +15 -6
- data/test/test-gdk-cairo.rb +41 -0
- data/test/test-gdk-event-type.rb +25 -0
- data/test/test-gdk-event.rb +47 -49
- data/test/test-gdk-keyval.rb +21 -0
- data/test/test-gdk-pixbuf.rb +49 -0
- data/test/test-gdk-rectangle.rb +35 -4
- data/test/test-gdk-rgba.rb +6 -1
- data/test/test-gdk-window-attr.rb +1 -1
- metadata +23 -51
- data/ext/gdk3/depend +0 -11
- data/ext/gdk3/extconf.rb +0 -130
- data/ext/gdk3/gdk3.def +0 -12
- data/ext/gdk3/init.c +0 -35
- data/ext/gdk3/rbgdk.c +0 -491
- data/ext/gdk3/rbgdk3.h +0 -73
- data/ext/gdk3/rbgdk3conversions.h +0 -121
- data/ext/gdk3/rbgdk3private.h +0 -85
- data/ext/gdk3/rbgdkatom.c +0 -122
- data/ext/gdk3/rbgdkcairo.c +0 -91
- data/ext/gdk3/rbgdkcolor.c +0 -137
- data/ext/gdk3/rbgdkconst.c +0 -33
- data/ext/gdk3/rbgdkcursor.c +0 -92
- data/ext/gdk3/rbgdkdevice.c +0 -253
- data/ext/gdk3/rbgdkdevicemanager.c +0 -39
- data/ext/gdk3/rbgdkdisplay.c +0 -434
- data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
- data/ext/gdk3/rbgdkdragcontext.c +0 -191
- data/ext/gdk3/rbgdkevent.c +0 -1173
- data/ext/gdk3/rbgdkgeometry.c +0 -253
- data/ext/gdk3/rbgdkkeymap.c +0 -151
- data/ext/gdk3/rbgdkkeyval.c +0 -108
- data/ext/gdk3/rbgdkpango.c +0 -197
- data/ext/gdk3/rbgdkpangorenderer.c +0 -144
- data/ext/gdk3/rbgdkpixbuf.c +0 -176
- data/ext/gdk3/rbgdkproperty.c +0 -305
- data/ext/gdk3/rbgdkrectangle.c +0 -140
- data/ext/gdk3/rbgdkrgb.c +0 -199
- data/ext/gdk3/rbgdkrgba.c +0 -142
- data/ext/gdk3/rbgdkscreen.c +0 -443
- data/ext/gdk3/rbgdkselection.c +0 -146
- data/ext/gdk3/rbgdkthreads.c +0 -77
- data/ext/gdk3/rbgdktimecoord.c +0 -133
- data/ext/gdk3/rbgdkvisual.c +0 -251
- data/ext/gdk3/rbgdkwindow.c +0 -1069
- data/ext/gdk3/rbgdkwindowattr.c +0 -191
- data/ext/gdk3/rbgdkx11.c +0 -102
- data/ext/gdk3/rbgdkx11x11window.c +0 -66
- data/extconf.rb +0 -49
- data/lib/gdk3/base.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5112921765d2a9984668ee91a8fd957e24fb03f
|
4
|
+
data.tar.gz: c3afb838ad4b8135dcb90cd71521f0b551a62ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6297f1476e0d53ccfa28c2e649b50c86852dbfded984b56969dfd328684a648612eb579603fb3572ba15f0f782b5084b8cff81b38fa4beb155e15bd9857e46
|
7
|
+
data.tar.gz: c52e62902760295f63727301485be04b1e01b88287dc3b227d96b3ce49240f0aaaf88c537c323de3aad4ab6e3abb4c641f7c1cdbf74715c3661ca37bc8db9bb2
|
data/Rakefile
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2
18
|
|
3
19
|
$LOAD_PATH.unshift("./../glib2/lib")
|
4
20
|
require "gnome2/rake/package-task"
|
@@ -26,17 +42,15 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
26
42
|
:name => "gtk+",
|
27
43
|
:download_site => :gnome,
|
28
44
|
:label => "GTK+",
|
29
|
-
:version => "3.
|
45
|
+
:version => "3.14.1",
|
30
46
|
:compression_method => "xz",
|
31
47
|
:windows => {
|
32
48
|
:configure_args => [
|
33
49
|
"--enable-introspection",
|
34
50
|
"--with-included-immodules",
|
35
51
|
],
|
36
|
-
:patches => [
|
37
|
-
"gdk+-3.10.6-remove-def-use.diff",
|
38
|
-
],
|
39
52
|
:need_autoreconf => true,
|
53
|
+
:build_concurrently => false,
|
40
54
|
:built_file => "bin/libgdk-3-0.dll",
|
41
55
|
},
|
42
56
|
},
|
data/lib/gdk3/atom.rb
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
+
module Gdk
|
18
|
+
class Atom
|
19
|
+
class << self
|
20
|
+
alias_method :intern_raw, :intern
|
21
|
+
def intern(name, exist=true)
|
22
|
+
intern_raw(name, exist)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/gdk3/cairo.rb
ADDED
@@ -0,0 +1,60 @@
|
|
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
|
+
module Cairo
|
18
|
+
class Context
|
19
|
+
if method_defined?(:set_source_color)
|
20
|
+
alias_method :set_source_not_gdk_color, :set_source_color
|
21
|
+
def set_source_color(color)
|
22
|
+
if color.is_a?(Gdk::Color)
|
23
|
+
set_source_gdk_color(color)
|
24
|
+
else
|
25
|
+
set_source_not_gdk_color(color)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
alias_method :set_source_color, :set_source_gdk_color
|
30
|
+
end
|
31
|
+
|
32
|
+
def source_color=(color)
|
33
|
+
set_source_color(color)
|
34
|
+
color
|
35
|
+
end
|
36
|
+
|
37
|
+
if method_defined?(:set_source_rgba)
|
38
|
+
alias_method :set_source_not_gdk_rgba, :set_source_rgba
|
39
|
+
def set_source_rgba(rgba)
|
40
|
+
if rgba.is_a?(Gdk::RGBA)
|
41
|
+
set_source_gdk_rgba(rgba)
|
42
|
+
else
|
43
|
+
set_source_not_gdk_rgba(rgba)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
else
|
47
|
+
alias_method :set_source_rgba, :set_source_gdk_rgba
|
48
|
+
end
|
49
|
+
|
50
|
+
def source_rgba=(rgba)
|
51
|
+
set_source_rgba(rgba)
|
52
|
+
rgba
|
53
|
+
end
|
54
|
+
|
55
|
+
alias_method :set_source_pixbuf_raw, :set_source_pixbuf
|
56
|
+
def set_source_pixbuf(pixbuf, pixbuf_x=0, pixbuf_y=0)
|
57
|
+
set_source_pixbuf_raw(pixbuf, pixbuf_x, pixbuf_y)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/gdk3/color.rb
ADDED
@@ -0,0 +1,27 @@
|
|
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
|
+
module Gdk
|
18
|
+
class Color
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
def initialize(red, green, blue)
|
21
|
+
initialize_raw
|
22
|
+
self.red = red
|
23
|
+
self.green = green
|
24
|
+
self.blue = blue
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/gdk3/deprecated.rb
CHANGED
@@ -6,11 +6,6 @@ module Gdk
|
|
6
6
|
define_deprecated_const :Colormap, :raise => "Use 'Gdk::Visual' instead."
|
7
7
|
define_deprecated_const :Input, :raise => "Use 'GLib::IOChannel' instead."
|
8
8
|
define_deprecated_const :X11, 'GdkX11'
|
9
|
-
define_deprecated_singleton_method :pointer_grab, :raise => "Use 'Gdk::Device#grab'."
|
10
|
-
define_deprecated_singleton_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
|
11
|
-
define_deprecated_singleton_method :keyboard_grab, :raise => "Use 'Gdk::Device#grab'."
|
12
|
-
define_deprecated_singleton_method :keyboard_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
|
13
|
-
define_deprecated_singleton_method :pointer_is_grabbed?, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
|
14
9
|
|
15
10
|
class Cursor
|
16
11
|
extend GLib::Deprecatable
|
@@ -18,6 +13,9 @@ module Gdk
|
|
18
13
|
define_deprecated_method :pixmap?, :warn => "Don't use this method." do |_self|
|
19
14
|
false
|
20
15
|
end
|
16
|
+
Gdk::CursorType.constants.each do |cursor_type|
|
17
|
+
define_deprecated_const cursor_type, ['Gdk::CursorType', cursor_type].join('::')
|
18
|
+
end
|
21
19
|
end
|
22
20
|
|
23
21
|
class Device
|
@@ -26,7 +24,6 @@ module Gdk
|
|
26
24
|
define_deprecated_enums :ExtensionMode, 'EXTENSION_EVENTS'
|
27
25
|
define_deprecated_enums :InputMode, 'MODE'
|
28
26
|
define_deprecated_enums :InputSource, 'SOURCE'
|
29
|
-
define_deprecated_method :source, :input_source
|
30
27
|
end
|
31
28
|
|
32
29
|
class Display
|
@@ -38,12 +35,6 @@ module Gdk
|
|
38
35
|
define_deprecated_method :button_number, :raise => "Don't use this method."
|
39
36
|
define_deprecated_method :button_x, :raise => "Don't use this method."
|
40
37
|
define_deprecated_method :button_y, :raise => "Don't use this method."
|
41
|
-
define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_position'."
|
42
|
-
define_deprecated_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
|
43
|
-
define_deprecated_method :pointer_grabbed_p, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
|
44
|
-
define_deprecated_method :window_at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
|
45
|
-
define_deprecated_method :warp_pointer, :raise => "Use 'Gdk::Device#warp'."
|
46
|
-
define_deprecated_method :devices, :raise => "Use 'Gdk::DeviceManager#devices'."
|
47
38
|
end
|
48
39
|
|
49
40
|
class DragContext
|
@@ -64,6 +55,9 @@ module Gdk
|
|
64
55
|
extend GLib::Deprecatable
|
65
56
|
define_deprecated_flags :Mask
|
66
57
|
define_deprecated_enums :Type
|
58
|
+
Gdk::EventMask.constants.each do |event_mask|
|
59
|
+
define_deprecated_const event_mask, ['Gdk::EventMask', event_mask].join('::')
|
60
|
+
end
|
67
61
|
end
|
68
62
|
|
69
63
|
class EventCrossing
|
@@ -105,7 +99,12 @@ module Gdk
|
|
105
99
|
module Keyval
|
106
100
|
extend GLib::Deprecatable
|
107
101
|
constants.each do |key|
|
108
|
-
|
102
|
+
old_names = []
|
103
|
+
old_names << key.to_s.sub(/^KEY_/, 'GDK_KEY_')
|
104
|
+
old_names << key.to_s.sub(/^KEY_/, 'GDK_')
|
105
|
+
old_names.each do |old_name|
|
106
|
+
define_deprecated_const old_name, [self, key].join('::')
|
107
|
+
end
|
109
108
|
end
|
110
109
|
end
|
111
110
|
|
@@ -143,7 +142,7 @@ module Gdk
|
|
143
142
|
define_deprecated_flags :ModifierType
|
144
143
|
define_deprecated_enums :Type
|
145
144
|
define_deprecated_enums :TypeHint, 'TYPE_HINT'
|
146
|
-
|
145
|
+
define_deprecated_const :WindowClass, 'Gdk::Window::Class'
|
147
146
|
define_deprecated_flags :WMDecoration, 'DECOR'
|
148
147
|
define_deprecated_flags :WMFunction, 'FUNC'
|
149
148
|
define_deprecated_method :clear, :warn => "Don't use this method."
|
@@ -152,8 +151,6 @@ module Gdk
|
|
152
151
|
define_deprecated_method :shape_combine_mask, :warn => "Don't use this method."
|
153
152
|
define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method."
|
154
153
|
define_deprecated_method :set_back_pixmap, :warn => "Don't use this method."
|
155
|
-
define_deprecated_singleton_method :at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
|
156
|
-
define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_device_position'."
|
157
154
|
end
|
158
155
|
|
159
156
|
class WindowAttr
|
@@ -163,3 +160,4 @@ module Gdk
|
|
163
160
|
alias :colormap= :set_colormap
|
164
161
|
end
|
165
162
|
end
|
163
|
+
|
data/lib/gdk3/event.rb
ADDED
@@ -0,0 +1,38 @@
|
|
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
|
+
module Gdk
|
18
|
+
class Event
|
19
|
+
unless const_defined?(:PROPAGATE)
|
20
|
+
PROPAGATE = false
|
21
|
+
end
|
22
|
+
unless const_defined?(:STOP)
|
23
|
+
STOP = true
|
24
|
+
end
|
25
|
+
|
26
|
+
def send_event?
|
27
|
+
not send_event.zero?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class EventFocus
|
32
|
+
alias_method :in_raw, :in
|
33
|
+
remove_method :in
|
34
|
+
def in?
|
35
|
+
not in_raw.zero?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/gdk3/loader.rb
ADDED
@@ -0,0 +1,266 @@
|
|
1
|
+
# Copyright (C) 2013-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
|
+
module Gdk
|
18
|
+
class Loader < GObjectIntrospection::Loader
|
19
|
+
private
|
20
|
+
def window_class
|
21
|
+
@window_class ||= @base_module.const_get(:Window)
|
22
|
+
end
|
23
|
+
|
24
|
+
def event_class
|
25
|
+
@event_class ||= @base_module.const_get(:Event)
|
26
|
+
end
|
27
|
+
|
28
|
+
def event_motion_class
|
29
|
+
@event_motion_class ||= @base_module.const_get(:EventMotion)
|
30
|
+
end
|
31
|
+
|
32
|
+
def rectangle_class
|
33
|
+
@rectangle_class ||= @base_module.const_get(:Rectangle)
|
34
|
+
end
|
35
|
+
|
36
|
+
def pre_load(repository, namespace)
|
37
|
+
setup_pending_constants
|
38
|
+
define_keyval_module
|
39
|
+
define_selection_module
|
40
|
+
load_cairo_rectangle_int
|
41
|
+
end
|
42
|
+
|
43
|
+
def define_keyval_module
|
44
|
+
@keyval_module = Module.new
|
45
|
+
@base_module.const_set("Keyval", @keyval_module)
|
46
|
+
end
|
47
|
+
|
48
|
+
def define_selection_module
|
49
|
+
@selection_module = Module.new
|
50
|
+
@base_module.const_set("Selection", @selection_module)
|
51
|
+
end
|
52
|
+
|
53
|
+
def load_cairo_rectangle_int
|
54
|
+
info = find_cairo_rectangle_int_info
|
55
|
+
klass = self.class.define_class(info.gtype,
|
56
|
+
"Rectangle",
|
57
|
+
@base_module,
|
58
|
+
:size => info.size)
|
59
|
+
load_fields(info, klass)
|
60
|
+
load_methods(info, klass)
|
61
|
+
end
|
62
|
+
|
63
|
+
def find_cairo_rectangle_int_info
|
64
|
+
repository = GObjectIntrospection::Repository.default
|
65
|
+
repository.each("cairo") do |info|
|
66
|
+
if info.name == "RectangleInt"
|
67
|
+
return info
|
68
|
+
end
|
69
|
+
end
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def post_load(repository, namespace)
|
74
|
+
apply_pending_constants
|
75
|
+
require_libraries
|
76
|
+
convert_event_classes
|
77
|
+
define_selection_constants
|
78
|
+
end
|
79
|
+
|
80
|
+
def setup_pending_constants
|
81
|
+
@pending_constants = []
|
82
|
+
end
|
83
|
+
|
84
|
+
def apply_pending_constants
|
85
|
+
@pending_constants.each do |info|
|
86
|
+
case info.name
|
87
|
+
when /\AEVENT_/
|
88
|
+
event_class.const_set($POSTMATCH, info.value)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def require_libraries
|
94
|
+
require "gdk3/atom"
|
95
|
+
require "gdk3/color"
|
96
|
+
require "gdk3/event"
|
97
|
+
require "gdk3/rectangle"
|
98
|
+
require "gdk3/rgba"
|
99
|
+
require "gdk3/window"
|
100
|
+
require "gdk3/window-attr"
|
101
|
+
|
102
|
+
require "gdk3/cairo"
|
103
|
+
|
104
|
+
require "gdk3/deprecated"
|
105
|
+
end
|
106
|
+
|
107
|
+
def convert_event_classes
|
108
|
+
event_map = {
|
109
|
+
EventType::EXPOSE => EventExpose,
|
110
|
+
EventType::MOTION_NOTIFY => EventMotion,
|
111
|
+
EventType::BUTTON_PRESS => EventButton,
|
112
|
+
EventType::BUTTON2_PRESS => EventButton,
|
113
|
+
EventType::BUTTON3_PRESS => EventButton,
|
114
|
+
EventType::BUTTON_RELEASE => EventButton,
|
115
|
+
EventType::KEY_PRESS => EventKey,
|
116
|
+
EventType::KEY_RELEASE => EventKey,
|
117
|
+
EventType::ENTER_NOTIFY => EventCrossing,
|
118
|
+
EventType::LEAVE_NOTIFY => EventCrossing,
|
119
|
+
EventType::FOCUS_CHANGE => EventFocus,
|
120
|
+
EventType::CONFIGURE => EventConfigure,
|
121
|
+
EventType::PROPERTY_NOTIFY => EventProperty,
|
122
|
+
EventType::SELECTION_CLEAR => EventSelection,
|
123
|
+
EventType::SELECTION_REQUEST => EventSelection,
|
124
|
+
EventType::SELECTION_NOTIFY => EventSelection,
|
125
|
+
EventType::PROXIMITY_IN => EventProximity,
|
126
|
+
EventType::PROXIMITY_OUT => EventProximity,
|
127
|
+
EventType::DRAG_ENTER => EventDND,
|
128
|
+
EventType::DRAG_LEAVE => EventDND,
|
129
|
+
EventType::DRAG_MOTION => EventDND,
|
130
|
+
EventType::DRAG_STATUS => EventDND,
|
131
|
+
EventType::DROP_START => EventDND,
|
132
|
+
EventType::DROP_FINISHED => EventDND,
|
133
|
+
EventType::VISIBILITY_NOTIFY => EventVisibility,
|
134
|
+
EventType::SCROLL => EventScroll,
|
135
|
+
EventType::WINDOW_STATE => EventWindowState,
|
136
|
+
EventType::SETTING => EventSetting,
|
137
|
+
EventType::OWNER_CHANGE => EventOwnerChange,
|
138
|
+
EventType::GRAB_BROKEN => EventGrabBroken,
|
139
|
+
EventType::DAMAGE => EventExpose,
|
140
|
+
EventType::TOUCH_BEGIN => EventTouch,
|
141
|
+
EventType::TOUCH_UPDATE => EventTouch,
|
142
|
+
EventType::TOUCH_END => EventTouch,
|
143
|
+
EventType::TOUCH_CANCEL => EventTouch,
|
144
|
+
}
|
145
|
+
self.class.register_boxed_class_converter(Event.gtype) do |event|
|
146
|
+
event_map[event.type] || Event
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def define_selection_constants
|
151
|
+
selections = {
|
152
|
+
"PRIMARY" => "PRIMARY",
|
153
|
+
"SECONDARY" => "SECONDARY",
|
154
|
+
"CLIPBOARD" => "CLIPBOARD",
|
155
|
+
"TARGET_BITMAP" => "BITMAP",
|
156
|
+
"TARGET_COLORMAP" => "COLORMAP",
|
157
|
+
"TARGET_DRAWABLE" => "DRAWABLE",
|
158
|
+
"TARGET_PIXMAP" => "PIXMAP",
|
159
|
+
"TARGET_STRING" => "STRING",
|
160
|
+
"TYPE_ATOM" => "ATOM",
|
161
|
+
"TYPE_BITMAP" => "BITMAP",
|
162
|
+
"TYPE_COLORMAP" => "COLORMAP",
|
163
|
+
"TYPE_DRAWABLE" => "DRAWABLE",
|
164
|
+
"TYPE_INTEGER" => "INTEGER",
|
165
|
+
"TYPE_PIXMAP" => "PIXMAP",
|
166
|
+
"TYPE_WINDOW" => "WINDOW",
|
167
|
+
"TYPE_STRING" => "STRING",
|
168
|
+
}
|
169
|
+
selections.each do |key, value|
|
170
|
+
# TODO: Gdk::Atom.intern is not working yet.
|
171
|
+
#@selection_module.const_set(key, Gdk::Atom.intern(value))
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def load_function_info(info)
|
176
|
+
name = info.name
|
177
|
+
case name
|
178
|
+
when "init", /_get_type\z/
|
179
|
+
# ignore
|
180
|
+
when /\Arectangle_/
|
181
|
+
define_method(info, rectangle_class, $POSTMATCH)
|
182
|
+
when /\Apixbuf_/
|
183
|
+
target_class = nil
|
184
|
+
case $POSTMATCH
|
185
|
+
when "get_from_window"
|
186
|
+
target_class = window_class
|
187
|
+
when "get_from_surface"
|
188
|
+
target_class = Cairo::Surface
|
189
|
+
end
|
190
|
+
if target_class
|
191
|
+
define_method(info, target_class, "to_pixbuf")
|
192
|
+
else
|
193
|
+
super
|
194
|
+
end
|
195
|
+
when /\Aevent_/
|
196
|
+
name = $POSTMATCH
|
197
|
+
case name
|
198
|
+
when "request_motions"
|
199
|
+
define_method(info, event_motion_class, "request")
|
200
|
+
else
|
201
|
+
super # TODO
|
202
|
+
end
|
203
|
+
when /\Acairo_/
|
204
|
+
name = $POSTMATCH
|
205
|
+
case name
|
206
|
+
when "create"
|
207
|
+
define_method(info, window_class, "create_cairo_context")
|
208
|
+
when "set_source_color"
|
209
|
+
define_method(info, Cairo::Context, "set_source_gdk_color")
|
210
|
+
when "set_source_rgba"
|
211
|
+
define_method(info, Cairo::Context, "set_source_gdk_rgba")
|
212
|
+
when "rectangle"
|
213
|
+
define_method(info, Cairo::Context, "gdk_rectangle")
|
214
|
+
when "region_create_from_surface"
|
215
|
+
# TODO
|
216
|
+
when "surface_create_from_pixbuf"
|
217
|
+
# TODO
|
218
|
+
else
|
219
|
+
define_method(info, Cairo::Context, name)
|
220
|
+
end
|
221
|
+
else
|
222
|
+
super
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def load_struct_info(info)
|
227
|
+
return if info.gtype_struct?
|
228
|
+
|
229
|
+
options = {}
|
230
|
+
case info.name
|
231
|
+
when /\AEvent/
|
232
|
+
options[:parent] = event_class
|
233
|
+
end
|
234
|
+
|
235
|
+
define_struct(info, options)
|
236
|
+
end
|
237
|
+
|
238
|
+
def define_enum(info)
|
239
|
+
case info.name
|
240
|
+
when /\AWindowWindow/
|
241
|
+
self.class.define_class(info.gtype, $POSTMATCH, window_class)
|
242
|
+
when /\AWindow/
|
243
|
+
self.class.define_class(info.gtype, $POSTMATCH, window_class)
|
244
|
+
when "EventType"
|
245
|
+
self.class.register_constant_rename_map("2BUTTON_PRESS",
|
246
|
+
"BUTTON2_PRESS")
|
247
|
+
self.class.register_constant_rename_map("3BUTTON_PRESS",
|
248
|
+
"BUTTON3_PRESS")
|
249
|
+
super
|
250
|
+
else
|
251
|
+
super
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def load_constant_info(info)
|
256
|
+
case info.name
|
257
|
+
when /\AEVENT_/
|
258
|
+
@pending_constants << info
|
259
|
+
when /\AKEY_/
|
260
|
+
@keyval_module.const_set(info.name, info.value)
|
261
|
+
else
|
262
|
+
super
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
module Gdk
|
18
|
+
class Rectangle
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
def initialize(x, y, width, height)
|
21
|
+
initialize_raw
|
22
|
+
self.x = x
|
23
|
+
self.y = y
|
24
|
+
self.width = width
|
25
|
+
self.height = height
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :intersect_raw, :intersect
|
29
|
+
def intersect(other)
|
30
|
+
intersected, dest = intersect_raw(other)
|
31
|
+
if intersected
|
32
|
+
dest
|
33
|
+
else
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/gdk3/rgba.rb
ADDED
@@ -0,0 +1,32 @@
|
|
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
|
+
module Gdk
|
18
|
+
class RGBA
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
def initialize(red, green, blue, alpha)
|
21
|
+
initialize_raw
|
22
|
+
self.red = red
|
23
|
+
self.green = green
|
24
|
+
self.blue = blue
|
25
|
+
self.alpha = alpha
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_a
|
29
|
+
[red, green, blue, alpha]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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
|
+
module Gdk
|
18
|
+
class WindowAttr
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
def initialize(width, height, window_class, window_type)
|
21
|
+
initialize_raw
|
22
|
+
self.width = width
|
23
|
+
self.height = height
|
24
|
+
self.wclass = window_class
|
25
|
+
self.window_type = window_type
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/gdk3/window.rb
ADDED
@@ -0,0 +1,21 @@
|
|
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
|
+
module Gdk
|
18
|
+
class Window
|
19
|
+
alias_method :invalidate, :invalidate_rect
|
20
|
+
end
|
21
|
+
end
|