Class: RBGL::GUI::Wayland::EventDispatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(connection, codec:) ⇒ EventDispatcher

Returns a new instance of EventDispatcher.



7
8
9
10
# File 'lib/rbgl/gui/wayland/event_dispatcher.rb', line 7

def initialize(connection, codec:)
  @connection = connection
  @codec = codec
end

Instance Method Details

#handle_event(object_id, opcode, payload) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rbgl/gui/wayland/event_dispatcher.rb', line 12

def handle_event(object_id, opcode, payload)
  object = @connection.object_for(object_id)

  case object
  when Registry
    handle_registry_event(opcode, payload)
  when Callback
    object.handle_done if opcode == 0
  when WlBuffer
    object.handle_release if opcode == 0
  when XdgWmBase
    handle_xdg_wm_base_event(object, opcode, payload)
  when XdgSurface
    handle_xdg_surface_event(object, opcode, payload)
  when XdgToplevel
    handle_xdg_toplevel_event(object_id, opcode, payload)
  end
end