Class: RBGL::GUI::Wayland::ShmBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/rbgl/gui/wayland/protocol_objects/shm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, pool, wl_buffer) ⇒ ShmBuffer

Returns a new instance of ShmBuffer.



93
94
95
96
97
98
99
100
101
102
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 93

def initialize(file, pool, wl_buffer)
  @file = file
  @pool = pool
  @wl_buffer = wl_buffer
  @destroy_requested = false
  @destroyed = false
  @file.binmode
  @file.seek(0)
  @wl_buffer.on_release { handle_release }
end

Instance Attribute Details

#wl_bufferObject (readonly)

Returns the value of attribute wl_buffer.



91
92
93
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 91

def wl_buffer
  @wl_buffer
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 110

def available?
  @wl_buffer.available?
end

#destroyObject



122
123
124
125
126
127
128
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 122

def destroy
  return if @destroyed

  @destroy_requested = true
  @wl_buffer.destroy
  finalize_destroy unless @wl_buffer.busy?
end

#idObject



118
119
120
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 118

def id
  @wl_buffer.id
end

#mark_in_useObject



114
115
116
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 114

def mark_in_use
  @wl_buffer.mark_in_use
end

#write(data) ⇒ Object



104
105
106
107
108
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 104

def write(data)
  @file.seek(0)
  @file.write(data)
  @file.flush
end