Class: RBGL::GUI::Wayland::WlBuffer

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

Instance Attribute Summary

Attributes inherited from WaylandObject

#connection, #id

Instance Method Summary collapse

Methods inherited from WaylandObject

#send_request

Constructor Details

#initialize(connection, id) ⇒ WlBuffer

Returns a new instance of WlBuffer.



40
41
42
43
44
45
46
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 40

def initialize(connection, id)
  super
  @busy = false
  @destroy_requested = false
  @destroyed = false
  @release_callbacks = []
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 56

def available?
  !@busy && !@destroy_requested && !@destroyed
end

#busy?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 60

def busy?
  @busy
end

#destroyObject



70
71
72
73
74
75
76
77
78
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 70

def destroy
  return if @destroyed || @destroy_requested

  if @busy
    @destroy_requested = true
  else
    finalize_destroy
  end
end

#handle_releaseObject



64
65
66
67
68
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 64

def handle_release
  @busy = false
  @release_callbacks.each(&:call)
  finalize_destroy if @destroy_requested
end

#mark_in_useObject



52
53
54
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 52

def mark_in_use
  @busy = true
end

#on_release(&block) ⇒ Object



48
49
50
# File 'lib/rbgl/gui/wayland/protocol_objects/shm.rb', line 48

def on_release(&block)
  @release_callbacks << block if block
end