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/alpha-modifier/alpha-modifier-v1.xml
  //
  // alpha_modifier_v1 Protocol Copyright: 
  /// 
  /// Copyright © 2024 Xaver Hugl
  /// 
  /// 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';
  
  
  /// surface alpha modifier manager
  /// 
  /// This interface allows a client to set a factor for the alpha values on a
  /// surface, which can be used to offload such operations to the compositor,
  /// which can in turn for example offload them to KMS.
  /// 
  /// Warning! The protocol described in this file is currently in the testing
  /// phase. Backward compatible changes may be added together with the
  /// corresponding interface version bump. Backward incompatible changes can
  /// only be done by creating a new major version of the extension.
  /// 
  class WpAlphaModifierV1 extends Proxy{
    final Context innerContext;
    final version = 1;
  
    WpAlphaModifierV1(this.innerContext) : super(innerContext.allocateClientId()){
      innerContext.register(this);
    }
  
  
  @override
  toString(){
  return "WpAlphaModifierV1 {name: 'wp_alpha_modifier_v1', id: '$objectId', version: '1',}";
  }
  
  /// destroy the alpha modifier manager object
  /// 
  /// Destroy the alpha modifier manager. This doesn't destroy objects
  /// created with the manager.
  /// 
    Result<void,Object> destroy() {
  innerContext.unRegister(this);
      logLn("WpAlphaModifierV1::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 WpAlphaModifierV1::destroy: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  /// create a new toplevel decoration object
  /// 
  /// Create a new alpha modifier surface object associated with the
  /// given wl_surface. If there is already such an object associated with
  /// the wl_surface, the already_constructed error will be raised.
  /// 
  /// [id]:
  /// [surface]:
    Result<WpAlphaModifierSurfaceV1,Object> getSurface(Surface surface) {
    var id =  WpAlphaModifierSurfaceV1(innerContext);
      logLn("WpAlphaModifierV1::getSurface  id: $id surface: $surface");
  var arguments = [id, surface];var argTypes = <WaylandType>[WaylandType.newId, WaylandType.object];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 1]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([id.objectId]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([surface.objectId]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in WpAlphaModifierV1::getSurface: $e");
     return Failure(e);
      }
      return Success(id);
    }
  
  }
  
  /// 
  /// 
  
  enum WpAlphaModifierV1Error {
  /// wl_surface already has a alpha modifier object
    alreadyConstructed("already_constructed", 0);
  const WpAlphaModifierV1Error(this.enumName, this.enumValue);
  final int enumValue;
  final String enumName;
  @override
  toString(){
  return "WpAlphaModifierV1Error {name: $enumName, value: $enumValue}";
  }
  }
  
  
  
  /// alpha modifier object for a surface
  /// 
  /// This interface allows the client to set a factor for the alpha values on
  /// a surface, which can be used to offload such operations to the compositor.
  /// The default factor is UINT32_MAX.
  /// 
  /// This object has to be destroyed before the associated wl_surface. Once the
  /// wl_surface is destroyed, all request on this object will raise the
  /// no_surface error.
  /// 
  class WpAlphaModifierSurfaceV1 extends Proxy{
    final Context innerContext;
    final version = 1;
  
    WpAlphaModifierSurfaceV1(this.innerContext) : super(innerContext.allocateClientId()){
      innerContext.register(this);
    }
  
  
  @override
  toString(){
  return "WpAlphaModifierSurfaceV1 {name: 'wp_alpha_modifier_surface_v1', id: '$objectId', version: '1',}";
  }
  
  /// destroy the alpha modifier object
  /// 
  /// This destroys the object, and is equivalent to set_multiplier with
  /// a value of UINT32_MAX, with the same double-buffered semantics as
  /// set_multiplier.
  /// 
    Result<void,Object> destroy() {
  innerContext.unRegister(this);
      logLn("WpAlphaModifierSurfaceV1::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 WpAlphaModifierSurfaceV1::destroy: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  /// specify the alpha multiplier
  /// 
  /// Sets the alpha multiplier for the surface. The alpha multiplier is
  /// double-buffered state, see wl_surface.commit for details.
  /// 
  /// This factor is applied in the compositor's blending space, as an
  /// additional step after the processing of per-pixel alpha values for the
  /// wl_surface. The exact meaning of the factor is thus undefined, unless
  /// the blending space is specified in a different extension.
  /// 
  /// This multiplier is applied even if the buffer attached to the
  /// wl_surface doesn't have an alpha channel; in that case an alpha value
  /// of one is used instead.
  /// 
  /// Zero means completely transparent, UINT32_MAX means completely opaque.
  /// 
  /// [factor]:
    Result<void,Object> setMultiplier(int factor) {
      logLn("WpAlphaModifierSurfaceV1::setMultiplier  factor: $factor");
  var arguments = [factor];var argTypes = <WaylandType>[WaylandType.uint];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 1]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([factor]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in WpAlphaModifierSurfaceV1::setMultiplier: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  }
  
  /// 
  /// 
  
  enum WpAlphaModifierSurfaceV1Error {
  /// wl_surface was destroyed
    noSurface("no_surface", 0);
  const WpAlphaModifierSurfaceV1Error(this.enumName, this.enumValue);
  final int enumValue;
  final String enumName;
  @override
  toString(){
  return "WpAlphaModifierSurfaceV1Error {name: $enumName, value: $enumValue}";
  }
  }
  
  