Class wl_proxy

Every object you will encounter is actually a wl_proxy object with a different given set of methods (depending on its interface).

Thus it inherits all the wl_proxy methods - most notable the add_listener method. The different/variable set of methods available to an object is defined by the wl_interface that the object has. The "to string" behavior of a proxy follows the wayland convention (for example similar to wl_registry@2)

Usage:

    local wau = require("wau")
    local display = wau.wl_display.connect(nil)
    local registry = display:get_registry()
    print(display:get_id(), display:get_class(), display) -- the ID of the dipslay is always 1
    print(registry:get_id(), registry:get_class(), registry)
    

Methods

wl_proxy:get_class () Get the class of the proxy
wl_proxy:get_id () Get the ID of the proxy
wl_proxy:add_listener (listener) Add event listeners to the proxy.


Methods

wl_proxy:get_class ()
Get the class of the proxy

Returns:

    string The class name
wl_proxy:get_id ()
Get the ID of the proxy

Returns:

    int The ID of the proxy
wl_proxy:add_listener (listener)
Add event listeners to the proxy.

Parameters:

  • listener A table of event listener functions whose key is the event name. The first parameter to the function is self (the object that received the event) followed by the parameters as specified in the protocol. For in action see wl_interface - test - huch

Usage:

    my_proxy:add_listener {
       ["event_name"] = function(self, b) print(b) end,
       ["another_event"] = function(self) error("hey") end
    }
generated by LDoc 1.5.0 Last updated 2023-07-28 15:31:50