xlib-objects 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56a42360acde3da1a1964f66fead72e947210c0d
4
- data.tar.gz: 2cff63e644daa7e3eab089aa1406bfbec4e0807d
3
+ metadata.gz: 2210c140114c61c7e2e9705e9eb946a0b8b3bd3f
4
+ data.tar.gz: d7b9f2d7ccb8b7d7c496a4e5d93c0fda56be5b3c
5
5
  SHA512:
6
- metadata.gz: 6a8b5f717a7315da150db54a3370745071cca338cce2fc35371c3bcebd38eaf182c32e6e15481c624e5cf1d8fb93528e90acf295e6a9cd7c24f433b1a28baf9d
7
- data.tar.gz: b17e3b57f492f137a83d34a05a32f109ca222faf946b793bdcf0dc77fee93bcb800d39ce6f6129dcf70370798ebc02e3bbea5487b510605ff6dd71289363783e
6
+ metadata.gz: f57f8cf65dc95ca8bb356cb46e594e4c15f5d38f652f887bc2705548f77a74e61f6a50071da2e2f111046545cedccbbb3c5f026ac2d8ee21ac3f7b392dadb79e
7
+ data.tar.gz: 755135daafc0ea42c2830d88dac81f59ec4eb1f50be8e12df6c180943e3c93f15286a658ca39e018380b7a8fbc8f3caa74f029b9295988d93ebaabeff2eb715c
@@ -10,13 +10,15 @@ module XlibObj
10
10
  class Screen
11
11
  class Crtc
12
12
  class Output
13
+ class << self
14
+ def finalize(attributes)
15
+ proc{ Xlib.XRRFreeOutputInfo(attributes.pointer) }
16
+ end
17
+ end
18
+
13
19
  def initialize(crtc, id)
14
20
  @crtc = crtc
15
21
  @id = id
16
-
17
- ObjectSpace.define_finalizer(self) do
18
- Xlib.XRRFreeOutputInfo(@attributes.pointer) if @attributes
19
- end
20
22
  end
21
23
 
22
24
  attr_reader :crtc, :id
@@ -38,6 +40,7 @@ module XlibObj
38
40
  output_info_ptr = Xlib.XRRGetOutputInfo(@crtc.screen.display.
39
41
  to_native, screen_resources_ptr, @id)
40
42
  @attributes = Xlib::XRROutputInfo.new(output_info_ptr)
43
+ ObjectSpace.define_finalizer(self, self.class.finalize(@attributes))
41
44
  Xlib.XRRFreeScreenResources(screen_resources_ptr)
42
45
  end
43
46
 
data/lib/screen/crtc.rb CHANGED
@@ -9,13 +9,15 @@
9
9
  module XlibObj
10
10
  class Screen
11
11
  class Crtc
12
+ class << self
13
+ def finalize(attributes)
14
+ proc{ Xlib.XRRFreeCrtcInfo(attributes.pointer) }
15
+ end
16
+ end
17
+
12
18
  def initialize(screen, id)
13
19
  @screen = screen
14
20
  @id = id
15
-
16
- ObjectSpace.define_finalizer(self) do
17
- Xlib.XRRFreeCrtcInfo(@attributes.pointer) if @attributes
18
- end
19
21
  end
20
22
 
21
23
  attr_reader :screen, :id
@@ -45,6 +47,7 @@ module XlibObj
45
47
  crtc_info_ptr = Xlib.XRRGetCrtcInfo(@screen.display.to_native,
46
48
  screen_resources_ptr, @id)
47
49
  @attributes = Xlib::XRRCrtcInfo.new(crtc_info_ptr)
50
+ ObjectSpace.define_finalizer(self, self.class.finalize(@attributes))
48
51
  Xlib.XRRFreeScreenResources(screen_resources_ptr)
49
52
  end
50
53
 
data/lib/screen.rb CHANGED
@@ -8,13 +8,15 @@
8
8
 
9
9
  module XlibObj
10
10
  class Screen
11
+ class << self
12
+ def finalize(resources)
13
+ proc{ Xlib.XRRFreeScreenResources(resources.pointer) }
14
+ end
15
+ end
16
+
11
17
  def initialize(display, screen_pointer)
12
18
  @display = display
13
19
  @struct = Xlib::Screen.new(screen_pointer)
14
-
15
- ObjectSpace.define_finalizer(self) do
16
- Xlib.XRRFreeScreenResources(@resources.pointer) if @resources
17
- end
18
20
  end
19
21
 
20
22
  attr_reader :display
@@ -70,6 +72,7 @@ module XlibObj
70
72
  resources_ptr = Xlib.XRRGetScreenResources(@display.to_native,
71
73
  root_window.to_native)
72
74
  @resources = Xlib::XRRScreenResources.new(resources_ptr)
75
+ ObjectSpace.define_finalizer(self, self.class.finalize(@resources))
73
76
  end
74
77
 
75
78
  @resources
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlib-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Aue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xlib