content: // Generated by dart-wayland-scanner
  // https://github.com/your-repo/dart-wayland-scanner
  // XML file : https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/main/staging/ext-transient-seat/ext-transient-seat-v1.xml
  //
  // ext_transient_seat_v1 Protocol Copyright: 
  /// 
  /// Copyright © 2020 - 2023 Andri Yngvason
  /// 
  /// Permission is hereby granted, free of charge, to any person obtaining a
  /// copy of this software and associated documentation files (the "Software"),
  /// to deal in the Software without restriction, including without limitation
  /// the rights to use, copy, modify, merge, publish, distribute, sublicense,
  /// and/or sell copies of the Software, and to permit persons to whom the
  /// Software is furnished to do so, subject to the following conditions:
  /// 
  /// The above copyright notice and this permission notice (including the next
  /// paragraph) shall be included in all copies or substantial portions of the
  /// Software.
  /// 
  /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  /// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  /// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  /// DEALINGS IN THE SOFTWARE.
  /// 
  
  library client;
  
  import 'package:wayland/wayland.dart';
  import 'package:wayland/protocols/wayland.dart';
  import 'dart:async';
  import 'dart:convert';
  import 'dart:typed_data';
  import 'package:result_dart/result_dart.dart';
  
  
  /// transient seat manager
  /// 
  /// The transient seat manager creates short-lived seats.
  /// 
  class ExtTransientSeatManagerV1 extends Proxy{
    final Context innerContext;
    final version = 1;
  
    ExtTransientSeatManagerV1(this.innerContext) : super(innerContext.allocateClientId()){
      innerContext.register(this);
    }
  
  
  @override
  toString(){
  return "ExtTransientSeatManagerV1 {name: 'ext_transient_seat_manager_v1', id: '$objectId', version: '1',}";
  }
  
  /// create a transient seat
  /// 
  /// Create a new seat that is removed when the client side transient seat
  /// object is destroyed.
  /// 
  /// The actual seat may be removed sooner, in which case the transient seat
  /// object shall become inert.
  /// 
  /// [seat]:
    Result<ExtTransientSeatV1,Object> create() {
    var seat =  ExtTransientSeatV1(innerContext);
      logLn("ExtTransientSeatManagerV1::create  seat: $seat");
  var arguments = [seat];var argTypes = <WaylandType>[WaylandType.newId];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 0]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([seat.objectId]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in ExtTransientSeatManagerV1::create: $e");
     return Failure(e);
      }
      return Success(seat);
    }
  
  /// destroy the manager
  /// 
  /// Destroy the manager.
  /// 
  /// All objects created by the manager will remain valid until they are
  /// destroyed themselves.
  /// 
    Result<void,Object> destroy() {
  innerContext.unRegister(this);
      logLn("ExtTransientSeatManagerV1::destroy ");
  var arguments = [];var argTypes = <WaylandType>[];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 1]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in ExtTransientSeatManagerV1::destroy: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  }
  
  
  /// transient seat is ready
  /// 
  /// This event advertises the global name for the wl_seat to be used with
  /// wl_registry_bind.
  /// 
  /// It is sent exactly once, immediately after the transient seat is created
  /// and the new "wl_seat" global is advertised, if and only if the creation
  /// of the transient seat was allowed.
  /// 
  class ExtTransientSeatV1ReadyEvent {
  /// 
    final int globalName;
  
    ExtTransientSeatV1ReadyEvent(
  this.globalName,
  
  );
  
  @override
  toString(){
  return "ExtTransientSeatV1ReadyEvent (globalName: $globalName)";
  }
  }
  
  typedef ExtTransientSeatV1ReadyEventHandler = void Function(ExtTransientSeatV1ReadyEvent);
  
  /// transient seat creation denied
  /// 
  /// The event informs the client that the compositor denied its request to
  /// create a transient seat.
  /// 
  /// It is sent exactly once, immediately after the transient seat object is
  /// created, if and only if the creation of the transient seat was denied.
  /// 
  /// After receiving this event, the client should destroy the object.
  /// 
  class ExtTransientSeatV1DeniedEvent {
    ExtTransientSeatV1DeniedEvent(
  );
  
  @override
  toString(){
  return "ExtTransientSeatV1DeniedEvent ()";
  }
  }
  
  typedef ExtTransientSeatV1DeniedEventHandler = void Function(ExtTransientSeatV1DeniedEvent);
  
  
  /// transient seat handle
  /// 
  /// When the transient seat handle is destroyed, the seat itself will also be
  /// destroyed.
  /// 
  class ExtTransientSeatV1 extends Proxy implements Dispatcher{
    final Context innerContext;
    final version = 1;
  
    ExtTransientSeatV1(this.innerContext) : super(innerContext.allocateClientId()){
      innerContext.register(this);
    }
  
  
  @override
  toString(){
  return "ExtTransientSeatV1 {name: 'ext_transient_seat_v1', id: '$objectId', version: '1',}";
  }
  
  /// destroy transient seat
  /// 
  /// When the transient seat object is destroyed by the client, the
  /// associated seat created by the compositor is also destroyed.
  /// 
    Result<void,Object> destroy() {
  innerContext.unRegister(this);
      logLn("ExtTransientSeatV1::destroy ");
  var arguments = [];var argTypes = <WaylandType>[];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 0]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in ExtTransientSeatV1::destroy: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  /// transient seat is ready
  /// 
  /// This event advertises the global name for the wl_seat to be used with
  /// wl_registry_bind.
  /// 
  /// It is sent exactly once, immediately after the transient seat is created
  /// and the new "wl_seat" global is advertised, if and only if the creation
  /// of the transient seat was allowed.
  /// 
  /// Event handler for Ready
  /// - [global_name]:
   void onReady(ExtTransientSeatV1ReadyEventHandler handler) {
     _readyHandler = handler;
   }
  
   ExtTransientSeatV1ReadyEventHandler? _readyHandler;
  
  /// transient seat creation denied
  /// 
  /// The event informs the client that the compositor denied its request to
  /// create a transient seat.
  /// 
  /// It is sent exactly once, immediately after the transient seat object is
  /// created, if and only if the creation of the transient seat was denied.
  /// 
  /// After receiving this event, the client should destroy the object.
  /// 
  /// Event handler for Denied
   void onDenied(ExtTransientSeatV1DeniedEventHandler handler) {
     _deniedHandler = handler;
   }
  
   ExtTransientSeatV1DeniedEventHandler? _deniedHandler;
  
   @override
   void dispatch(int opcode, int fd, Uint8List data) {
  logLn("ExtTransientSeatV1.dispatch($opcode, $fd, $data)");
     switch (opcode) {     case 0:
  
         if (_readyHandler != null) {
  var offset = 0;
  final globalName = ByteData.view(data.buffer).getUint32(offset, Endian.little);
  offset += 4;
  var event = ExtTransientSeatV1ReadyEvent(
  globalName,
          );
           _readyHandler!(event);
         }
         break;
       case 1:
  
         if (_deniedHandler != null) {
           _deniedHandler!(ExtTransientSeatV1DeniedEvent());
         }
         break;
     }
   }
  }
  
  