├── README.md ├── examples ├── client_02_globalobjects.lpi ├── client_02_globalobjects.lpr ├── client_03_xdg.lpi ├── client_03_xdg.lpr ├── client_04_framecallback.lpi ├── client_04_framecallback.lpr ├── client_05_settingseat.lpi └── client_05_settingseat.lpr ├── fpcwaylandbindings.lpi ├── fpcwaylandbindings.lpr ├── protocol_generator.pas ├── supportpkg ├── libharfbuzz.pas ├── libxkbcommon-keys.inc ├── libxkbcommon.pas ├── waylandsupportpkg.lpk ├── waylandsupportpkg.pas └── xkb_classes.pas ├── wayland_xml.pas ├── waylandpkg ├── wayland_client.pas ├── wayland_client_core.pas ├── wayland_cursor.pas ├── wayland_egl.pas ├── wayland_protocol.pas ├── wayland_shared_buffer.pas ├── wayland_util.pas ├── waylandpkg.lpk └── waylandpkg.pas ├── waylandstablepkg ├── presentation_time_protocol.pas ├── viewporter_protocol.pas ├── waylandstablepkg.lpk ├── waylandstablepkg.pas └── xdg_shell_protocol.pas └── waylandunstablepkg ├── fullscreen_shell_unstable_v1_protocol.pas ├── idle_inhibit_unstable_v1_protocol.pas ├── input_method_unstable_v1_protocol.pas ├── input_timestamps_unstable_v1_protocol.pas ├── keyboard_shortcuts_inhibit_unstable_v1_protocol.pas ├── linux_dmabuf_unstable_v1_protocol.pas ├── linux_explicit_synchronization_unstable_v1_protocol.pas ├── pointer_constraints_unstable_v1_protocol.pas ├── pointer_gestures_unstable_v1_protocol.pas ├── primary_selection_unstable_v1_protocol.pas ├── relative_pointer_unstable_v1_protocol.pas ├── tablet_unstable_v1_protocol.pas ├── tablet_unstable_v2_protocol.pas ├── text_input_unstable_v1_protocol.pas ├── text_input_unstable_v3_protocol.pas ├── waylandunstablepkg.lpk ├── waylandunstablepkg.pas ├── xdg_decoration_unstable_v1_protocol.pas ├── xdg_foreign_unstable_v1_protocol.pas ├── xdg_foreign_unstable_v2_protocol.pas ├── xdg_output_unstable_v1_protocol.pas ├── xdg_shell_unstable_v5_protocol.pas ├── xdg_shell_unstable_v6_protocol.pas └── xwayland_keyboard_grab_unstable_v1_protocol.pas /README.md: -------------------------------------------------------------------------------- 1 | # fpc-wayland 2 | 3 | Bindings generator for freepascal that creates units from the various protocol.xml files including wayland.xml. 4 | 5 | There are four packages: 6 | 7 | 1. WaylandPkg which has the hardcoded libwayland headers 8 | 2. WaylandStablePkg which has the "stable" protocols used with Wayland and Weston etc. 9 | 3. WaylandUnstablePkg which has the unstable protocols. 10 | 4. WaylandSupportPkg which has bindings for libxbcommon and libharfbuzz 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/client_02_globalobjects.lpi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <UseAppBundle Value="False"/> 14 | <ResourceType Value="res"/> 15 | </General> 16 | <BuildModes> 17 | <Item Name="Default" Default="True"/> 18 | </BuildModes> 19 | <PublishOptions> 20 | <Version Value="2"/> 21 | <UseFileFilters Value="True"/> 22 | </PublishOptions> 23 | <RunParams> 24 | <FormatVersion Value="2"/> 25 | </RunParams> 26 | <RequiredPackages> 27 | <Item> 28 | <PackageName Value="WaylandPkg"/> 29 | </Item> 30 | <Item> 31 | <PackageName Value="WaylandSupportPkg"/> 32 | </Item> 33 | <Item> 34 | <PackageName Value="WaylandStablePkg"/> 35 | </Item> 36 | </RequiredPackages> 37 | <Units> 38 | <Unit> 39 | <Filename Value="client_02_globalobjects.lpr"/> 40 | <IsPartOfProject Value="True"/> 41 | </Unit> 42 | </Units> 43 | </ProjectOptions> 44 | <CompilerOptions> 45 | <Version Value="11"/> 46 | <Target> 47 | <Filename Value="client_02_globalobjects"/> 48 | </Target> 49 | <SearchPaths> 50 | <IncludeFiles Value="$(ProjOutDir)"/> 51 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 52 | </SearchPaths> 53 | <Linking> 54 | <Debugging> 55 | <DebugInfoType Value="dsDwarf3"/> 56 | </Debugging> 57 | </Linking> 58 | <Other> 59 | <ConfigFile> 60 | <WriteConfigFilePath Value=""/> 61 | </ConfigFile> 62 | </Other> 63 | </CompilerOptions> 64 | <Debugging> 65 | <Exceptions> 66 | <Item> 67 | <Name Value="EAbort"/> 68 | </Item> 69 | <Item> 70 | <Name Value="ECodetoolError"/> 71 | </Item> 72 | <Item> 73 | <Name Value="EFOpenError"/> 74 | </Item> 75 | </Exceptions> 76 | </Debugging> 77 | </CONFIG> 78 | -------------------------------------------------------------------------------- /examples/client_02_globalobjects.lpr: -------------------------------------------------------------------------------- 1 | program client_02_globalobjects; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cthreads, 8 | {$ENDIF} 9 | Classes, sysutils, 10 | wayland_protocol, wayland_client_core, xdg_shell_protocol 11 | { you can add units after this }; 12 | 13 | type 14 | 15 | { TWaylandClient } 16 | 17 | TWaylandClient = class(IWlRegistryListener) 18 | private 19 | FDisplay: TWLDisplay; 20 | FRegistry: TWlRegistry; 21 | procedure wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 22 | procedure wl_registry_global_remove(AWlRegistry: TWlRegistry; AName: DWord); 23 | public 24 | constructor Create; 25 | destructor Destroy; override; 26 | end; 27 | 28 | { TMyApp } 29 | 30 | procedure TWaylandClient.wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 31 | begin 32 | WriteLn(Format('Register interface "%s" id(%d) version: %d', [AInterface, AName, AVersion])); 33 | end; 34 | 35 | procedure TWaylandClient.wl_registry_global_remove(AWlRegistry: TWlRegistry; 36 | AName: DWord); 37 | begin 38 | WriteLn(Format('UN-register interface id(%d) version: %d', [AName])); 39 | end; 40 | 41 | constructor TWaylandClient.Create; 42 | begin 43 | FDisplay := TWlDisplay.Connect('') as TWLDisplay; 44 | if not Assigned(FDisplay) then 45 | begin 46 | WriteLn('Failed to open display'); 47 | Exit; 48 | end; 49 | 50 | FRegistry := FDisplay.GetRegistry(); 51 | FRegistry.AddListener(Self); 52 | FDisplay.Roundtrip; 53 | end; 54 | 55 | destructor TWaylandClient.Destroy; 56 | begin 57 | FreeAndNil(FRegistry); 58 | FreeAndNil(FDisplay); 59 | inherited; 60 | end; 61 | 62 | begin 63 | with TWaylandClient.Create do 64 | Free; 65 | end. 66 | 67 | -------------------------------------------------------------------------------- /examples/client_03_xdg.lpi: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <ProjectOptions> 4 | <Version Value="12"/> 5 | <General> 6 | <Flags> 7 | <MainUnitHasCreateFormStatements Value="False"/> 8 | <MainUnitHasTitleStatement Value="False"/> 9 | <MainUnitHasScaledStatement Value="False"/> 10 | </Flags> 11 | <SessionStorage Value="InProjectDir"/> 12 | <Title Value="client_03_xdg"/> 13 | <UseAppBundle Value="False"/> 14 | <ResourceType Value="res"/> 15 | </General> 16 | <BuildModes> 17 | <Item Name="Default" Default="True"/> 18 | </BuildModes> 19 | <PublishOptions> 20 | <Version Value="2"/> 21 | <UseFileFilters Value="True"/> 22 | </PublishOptions> 23 | <RunParams> 24 | <FormatVersion Value="2"/> 25 | </RunParams> 26 | <RequiredPackages> 27 | <Item> 28 | <PackageName Value="WaylandPkg"/> 29 | </Item> 30 | <Item> 31 | <PackageName Value="WaylandSupportPkg"/> 32 | </Item> 33 | <Item> 34 | <PackageName Value="WaylandStablePkg"/> 35 | </Item> 36 | </RequiredPackages> 37 | <Units> 38 | <Unit> 39 | <Filename Value="client_03_xdg.lpr"/> 40 | <IsPartOfProject Value="True"/> 41 | </Unit> 42 | </Units> 43 | </ProjectOptions> 44 | <CompilerOptions> 45 | <Version Value="11"/> 46 | <Target> 47 | <Filename Value="client_03_xdg"/> 48 | </Target> 49 | <SearchPaths> 50 | <IncludeFiles Value="$(ProjOutDir)"/> 51 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 52 | </SearchPaths> 53 | <Linking> 54 | <Debugging> 55 | <DebugInfoType Value="dsDwarf3"/> 56 | </Debugging> 57 | </Linking> 58 | <Other> 59 | <ConfigFile> 60 | <WriteConfigFilePath Value=""/> 61 | </ConfigFile> 62 | </Other> 63 | </CompilerOptions> 64 | <Debugging> 65 | <Exceptions> 66 | <Item> 67 | <Name Value="EAbort"/> 68 | </Item> 69 | <Item> 70 | <Name Value="ECodetoolError"/> 71 | </Item> 72 | <Item> 73 | <Name Value="EFOpenError"/> 74 | </Item> 75 | </Exceptions> 76 | </Debugging> 77 | </CONFIG> 78 | -------------------------------------------------------------------------------- /examples/client_03_xdg.lpr: -------------------------------------------------------------------------------- 1 | program client_03_xdg; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cmem, cthreads, // cmem must be first or not used 8 | {$ENDIF} 9 | Classes, sysutils, 10 | wayland_protocol, wayland_client_core, xdg_shell_protocol, wayland_util, 11 | BaseUnix 12 | { you can add units after this }; 13 | 14 | type 15 | 16 | { TWaylandClient } 17 | 18 | TWaylandClient = class(IWlRegistryListener, IXdgWmBaseListener, IXdgToplevelListener, 19 | IXdgSurfaceListener) 20 | private 21 | FDisplay: TWLDisplay; 22 | FRegistry: TWlRegistry; 23 | FCompositor: TWlCompositor; 24 | FxdgWM: TXdgWmBase; 25 | FShm: TWlShm; 26 | FSurface: TWlSurface; 27 | FxdgSurface: TXdgSurface; 28 | FxdgToplevel: TXdgToplevel; 29 | FPingCount: Integer; 30 | // IWlRegistryListener 31 | procedure wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 32 | procedure wl_registry_global_remove(AWlRegistry: TWlRegistry; AName: DWord); 33 | // IXdgWmBaseListener 34 | procedure xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 35 | // IXdgToplevelListener 36 | procedure xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 37 | procedure xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 38 | procedure xdg_toplevel_configure_bounds(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 39 | // IXdgSurfaceListener 40 | procedure xdg_surface_configure(AXdgSurface: TXdgSurface; ASerial: DWord); 41 | 42 | function DrawFrame: TWlBuffer; 43 | public 44 | constructor Create; 45 | procedure Run; 46 | destructor Destroy; override; 47 | end; 48 | 49 | { TMyApp } 50 | 51 | procedure TWaylandClient.wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 52 | begin 53 | WriteLn(Format('Register interface "%s" id(%d) version: %d', [AInterface, AName, AVersion])); 54 | 55 | // SHM interface 56 | if AInterface = wl_shm_interface.name then 57 | FShm := TWlShm.Create(AWlRegistry.Bind(AName, @wl_shm_interface, wl_shm_interface.version), True) 58 | // Compositor 59 | else if AInterface = wl_compositor_interface.name then 60 | FCompositor := TWlCompositor.Create(AWlRegistry.Bind(AName, @wl_compositor_interface, wl_compositor_interface.version), True) 61 | // xgd_wm_base 62 | else if AInterface = xdg_wm_base_interface.name then 63 | begin 64 | FxdgWM := TXdgWmBase.Create(AWlRegistry.Bind(AName, @xdg_wm_base_interface, xdg_wm_base_interface.version), True); 65 | FxdgWM.AddListener(Self); 66 | end; 67 | 68 | 69 | 70 | end; 71 | 72 | procedure TWaylandClient.wl_registry_global_remove(AWlRegistry: TWlRegistry; 73 | AName: DWord); 74 | begin 75 | WriteLn(Format('UN-register interface id(%d)', [AName])); 76 | end; 77 | 78 | procedure TWaylandClient.xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 79 | begin 80 | AXdgWmBase.Pong(ASerial); 81 | Inc(FPingCount); 82 | WriteLn('Ping: ', FPingCount); 83 | end; 84 | 85 | procedure TWaylandClient.xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; 86 | AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 87 | begin 88 | 89 | end; 90 | 91 | procedure TWaylandClient.xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 92 | begin 93 | 94 | end; 95 | 96 | procedure TWaylandClient.xdg_toplevel_configure_bounds( 97 | AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 98 | begin 99 | 100 | end; 101 | 102 | procedure TWaylandClient.xdg_surface_configure(AXdgSurface: TXdgSurface; 103 | ASerial: DWord); 104 | var 105 | lBuffer: TWlBuffer; 106 | begin 107 | AXdgSurface.AckConfigure(Aserial); 108 | lBuffer := DrawFrame; 109 | if Assigned(lBuffer) then 110 | begin 111 | FSurface.Attach(lBuffer, 0, 0); 112 | FSurface.Commit; 113 | lBuffer.Free; 114 | end; 115 | end; 116 | 117 | function TWaylandClient.DrawFrame: TWlBuffer; 118 | var 119 | lWidth, lHeight, lStride, lSize, lFd, y, x: Integer; 120 | lShmPool: TWLShmPool; 121 | lData: PLongWord; 122 | begin 123 | lWidth := 400; 124 | lHeight := 400; 125 | 126 | lStride := lWidth * 4; 127 | lSize := lStride * lHeight; 128 | 129 | lShmPool := TWLSHMBase(FShm).CreatePool(lSize) as TWlShmPool; 130 | Result := lShmPool.CreateBuffer(0, lWidth, lHeight, lStride, WL_SHM_FORMAT_XRGB8888); 131 | 132 | lData := PLongWord(lShmPool.Data(0)); 133 | 134 | for y := 0 to lHeight -1 do { 2d loop } for x := 0 to lWidth -1 do 135 | begin 136 | if (x div 50 + y div 50) mod 2 = 0 then 137 | lData[y * lWidth + x] := $FF834555 // Set pixel color 138 | else 139 | lData[y * lWidth + x] := $FFEEEEEE; 140 | end; 141 | 142 | lData := nil; 143 | 144 | lShmPool.Free; 145 | end; 146 | 147 | constructor TWaylandClient.Create; 148 | begin 149 | FDisplay := TWlDisplay.Connect('') as TWLDisplay; 150 | if not Assigned(FDisplay) then 151 | begin 152 | WriteLn('Failed to open display'); 153 | Exit; 154 | end; 155 | 156 | FRegistry := FDisplay.GetRegistry(); 157 | FRegistry.AddListener(Self); 158 | FDisplay.Roundtrip; 159 | if Assigned(FCompositor) then 160 | begin 161 | FSurface := FCompositor.CreateSurface(); 162 | WriteLn('Surface creation successful = ', Assigned(FSurface)); 163 | end; 164 | 165 | if Assigned(FSurface) and Assigned(FxdgWM) then 166 | begin 167 | FxdgSurface := FxdgWM.GetXdgSurface(FSurface); 168 | WriteLn('XDG_Surface creation successful = ', Assigned(FxdgSurface)); 169 | end; 170 | 171 | if Assigned(FxdgSurface) then 172 | begin 173 | FxdgSurface.AddListener(Self); 174 | FxdgToplevel := FxdgSurface.GetToplevel(); 175 | WriteLn('XDG_Toplevel creation successful = ', Assigned(FxdgToplevel)); 176 | end; 177 | 178 | if Assigned(FxdgToplevel) then 179 | begin 180 | FxdgToplevel.SetTitle('Example Client'); 181 | FSurface.Commit; 182 | WriteLn('Commit'); 183 | end; 184 | end; 185 | 186 | procedure TWaylandClient.Run; 187 | begin 188 | while Assigned(FDisplay) and (FDisplay.Dispatch <> -1) do 189 | begin 190 | if FPingCount >= 100 then 191 | Break; 192 | end; 193 | end; 194 | 195 | destructor TWaylandClient.Destroy; 196 | begin 197 | FreeAndNil(FxdgToplevel); 198 | FreeAndNil(FxdgSurface); 199 | FreeAndNil(FSurface); 200 | FreeAndNil(FCompositor); 201 | FreeAndNil(FShm); 202 | FreeAndNil(FRegistry); 203 | FreeAndNil(FDisplay); 204 | inherited; 205 | end; 206 | 207 | begin 208 | with TWaylandClient.Create do 209 | begin 210 | Run; 211 | Free; 212 | end; 213 | end. 214 | 215 | -------------------------------------------------------------------------------- /examples/client_04_framecallback.lpi: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <ProjectOptions> 4 | <Version Value="12"/> 5 | <General> 6 | <Flags> 7 | <MainUnitHasCreateFormStatements Value="False"/> 8 | <MainUnitHasTitleStatement Value="False"/> 9 | <MainUnitHasScaledStatement Value="False"/> 10 | </Flags> 11 | <SessionStorage Value="InProjectDir"/> 12 | <Title Value="client_04_framecallback"/> 13 | <UseAppBundle Value="False"/> 14 | <ResourceType Value="res"/> 15 | </General> 16 | <BuildModes> 17 | <Item Name="Default" Default="True"/> 18 | </BuildModes> 19 | <PublishOptions> 20 | <Version Value="2"/> 21 | <UseFileFilters Value="True"/> 22 | </PublishOptions> 23 | <RunParams> 24 | <FormatVersion Value="2"/> 25 | </RunParams> 26 | <RequiredPackages> 27 | <Item> 28 | <PackageName Value="WaylandPkg"/> 29 | </Item> 30 | <Item> 31 | <PackageName Value="WaylandSupportPkg"/> 32 | </Item> 33 | <Item> 34 | <PackageName Value="WaylandStablePkg"/> 35 | </Item> 36 | </RequiredPackages> 37 | <Units> 38 | <Unit> 39 | <Filename Value="client_04_framecallback.lpr"/> 40 | <IsPartOfProject Value="True"/> 41 | </Unit> 42 | </Units> 43 | </ProjectOptions> 44 | <CompilerOptions> 45 | <Version Value="11"/> 46 | <Target> 47 | <Filename Value="client_04_framecallback"/> 48 | </Target> 49 | <SearchPaths> 50 | <IncludeFiles Value="$(ProjOutDir)"/> 51 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 52 | </SearchPaths> 53 | <Linking> 54 | <Debugging> 55 | <DebugInfoType Value="dsDwarf3"/> 56 | </Debugging> 57 | </Linking> 58 | <Other> 59 | <ConfigFile> 60 | <WriteConfigFilePath Value=""/> 61 | </ConfigFile> 62 | </Other> 63 | </CompilerOptions> 64 | <Debugging> 65 | <Exceptions> 66 | <Item> 67 | <Name Value="EAbort"/> 68 | </Item> 69 | <Item> 70 | <Name Value="ECodetoolError"/> 71 | </Item> 72 | <Item> 73 | <Name Value="EFOpenError"/> 74 | </Item> 75 | </Exceptions> 76 | </Debugging> 77 | </CONFIG> 78 | -------------------------------------------------------------------------------- /examples/client_04_framecallback.lpr: -------------------------------------------------------------------------------- 1 | program client_04_framecallback; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cmem, cthreads, // cmem must be first or not used 8 | {$ENDIF} 9 | Classes, sysutils, 10 | wayland_protocol, wayland_client_core, xdg_shell_protocol, wayland_util, 11 | BaseUnix 12 | { you can add units after this }; 13 | 14 | type 15 | 16 | { TWaylandClient } 17 | 18 | TWaylandClient = class(IWlRegistryListener, IXdgWmBaseListener, IXdgToplevelListener, 19 | IXdgSurfaceListener, IWlCallbackListener) 20 | private 21 | FDisplay: TWLDisplay; 22 | FRegistry: TWlRegistry; 23 | FCompositor: TWlCompositor; 24 | FxdgWM: TXdgWmBase; 25 | FShm: TWlShm; 26 | FSurface: TWlSurface; 27 | FxdgSurface: TXdgSurface; 28 | FxdgToplevel: TXdgToplevel; 29 | FPingCount: Integer; 30 | FLastFrame: Integer; 31 | FOffset: Double; 32 | // IWlRegistryListener 33 | procedure wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 34 | procedure wl_registry_global_remove(AWlRegistry: TWlRegistry; AName: DWord); 35 | // IXdgWmBaseListener 36 | procedure xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 37 | // IXdgToplevelListener 38 | procedure xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 39 | procedure xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 40 | procedure xdg_toplevel_configure_bounds(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 41 | // IXdgSurfaceListener 42 | procedure xdg_surface_configure(AXdgSurface: TXdgSurface; ASerial: DWord); 43 | //IWlCallbackListener 44 | procedure wl_callback_done(AWlCallback: TWlCallback; ACallbackData: DWord); 45 | 46 | function DrawFrame: TWlBuffer; 47 | public 48 | constructor Create; 49 | procedure Run; 50 | destructor Destroy; override; 51 | end; 52 | 53 | { TMyApp } 54 | 55 | procedure TWaylandClient.wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 56 | begin 57 | WriteLn(Format('Register interface "%s" id(%d) version: %d', [AInterface, AName, AVersion])); 58 | 59 | // SHM interface 60 | if AInterface = wl_shm_interface.name then 61 | FShm := TWlShm.Create(AWlRegistry.Bind(AName, @wl_shm_interface, wl_shm_interface.version), True) 62 | // Compositor 63 | else if AInterface = wl_compositor_interface.name then 64 | FCompositor := TWlCompositor.Create(AWlRegistry.Bind(AName, @wl_compositor_interface, wl_compositor_interface.version), True) 65 | // xgd_wm_base 66 | else if AInterface = xdg_wm_base_interface.name then 67 | begin 68 | FxdgWM := TXdgWmBase.Create(AWlRegistry.Bind(AName, @xdg_wm_base_interface, xdg_wm_base_interface.version), True); 69 | FxdgWM.AddListener(Self); 70 | end; 71 | 72 | 73 | 74 | end; 75 | 76 | procedure TWaylandClient.wl_registry_global_remove(AWlRegistry: TWlRegistry; 77 | AName: DWord); 78 | begin 79 | WriteLn(Format('UN-register interface id(%d)', [AName])); 80 | end; 81 | 82 | procedure TWaylandClient.xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 83 | begin 84 | AXdgWmBase.Pong(ASerial); 85 | Inc(FPingCount); 86 | WriteLn('Ping: ', FPingCount); 87 | end; 88 | 89 | procedure TWaylandClient.xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; 90 | AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 91 | begin 92 | 93 | end; 94 | 95 | procedure TWaylandClient.xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 96 | begin 97 | 98 | end; 99 | 100 | procedure TWaylandClient.xdg_toplevel_configure_bounds( 101 | AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 102 | begin 103 | 104 | end; 105 | 106 | procedure TWaylandClient.xdg_surface_configure(AXdgSurface: TXdgSurface; 107 | ASerial: DWord); 108 | var 109 | lBuffer: TWlBuffer; 110 | begin 111 | AXdgSurface.AckConfigure(Aserial); 112 | lBuffer := DrawFrame; 113 | if Assigned(lBuffer) then 114 | begin 115 | FSurface.Attach(lBuffer, 0, 0); 116 | FSurface.Commit; 117 | lBuffer.Free; 118 | end; 119 | end; 120 | 121 | procedure TWaylandClient.wl_callback_done(AWlCallback: TWlCallback; ACallbackData: DWord); 122 | var 123 | lTime: DWord absolute ACallbackData; 124 | lElapsed: Integer; 125 | lBuffer: TWlBuffer; 126 | begin 127 | AWlCallback.Destroy; 128 | with FSurface.Frame() do 129 | AddListener(Self); 130 | 131 | if FLastFrame <> 0 then 132 | begin 133 | lElapsed := lTime - FLastFrame; 134 | FOffset := FOffset + lElapsed / 1000 * 24; 135 | end; 136 | 137 | lBuffer := DrawFrame; 138 | if Assigned(lBuffer) then 139 | begin 140 | FSurface.Attach(lBuffer, 0, 0); 141 | FSurface.DamageBuffer(0,0, MaxInt, MaxInt); 142 | FSurface.Commit; 143 | lBuffer.Free; 144 | end; 145 | 146 | FLastFrame:=lTime; 147 | 148 | end; 149 | 150 | function TWaylandClient.DrawFrame: TWlBuffer; 151 | var 152 | lWidth, lHeight, lStride, lSize, lFd, y, x: Integer; 153 | lShmPool: TWLShmPool; 154 | lData: PLongWord; 155 | lOffset: Int64; 156 | begin 157 | lWidth := 400; 158 | lHeight := 400; 159 | 160 | lStride := lWidth * 4; 161 | lSize := lStride * lHeight; 162 | 163 | lShmPool := TWLSHMBase(FShm).CreatePool(lSize) as TWlShmPool; 164 | Result := lShmPool.CreateBuffer(0, lWidth, lHeight, lStride, WL_SHM_FORMAT_XRGB8888); 165 | 166 | lData := PLongWord(lShmPool.Data(0)); 167 | 168 | lOffset := Trunc(FOffset); 169 | 170 | for y := 0 to lHeight -1 do { 2d loop } for x := 0 to lWidth -1 do 171 | begin 172 | if ((x + loffset) div 50 + (y + loffset) div 50) mod 2 = 0 then 173 | 174 | lData[y * lWidth + x] := $FF834555 // Set pixel color 175 | else 176 | lData[y * lWidth + x] := $FFEEEEEE; 177 | end; 178 | 179 | lData := nil; 180 | 181 | lShmPool.Free; 182 | end; 183 | 184 | constructor TWaylandClient.Create; 185 | var 186 | FFrameCallback: TWlCallback; 187 | begin 188 | FDisplay := TWlDisplay.Connect('') as TWLDisplay; 189 | if not Assigned(FDisplay) then 190 | begin 191 | WriteLn('Failed to open display'); 192 | Exit; 193 | end; 194 | 195 | FRegistry := FDisplay.GetRegistry(); 196 | FRegistry.AddListener(Self); 197 | FDisplay.Roundtrip; 198 | if Assigned(FCompositor) then 199 | begin 200 | FSurface := FCompositor.CreateSurface(); 201 | WriteLn('Surface creation successful = ', Assigned(FSurface)); 202 | end; 203 | 204 | if Assigned(FSurface) and Assigned(FxdgWM) then 205 | begin 206 | FxdgSurface := FxdgWM.GetXdgSurface(FSurface); 207 | WriteLn('XDG_Surface creation successful = ', Assigned(FxdgSurface)); 208 | end; 209 | 210 | if Assigned(FxdgSurface) then 211 | begin 212 | FxdgSurface.AddListener(Self); 213 | FxdgToplevel := FxdgSurface.GetToplevel(); 214 | WriteLn('XDG_Toplevel creation successful = ', Assigned(FxdgToplevel)); 215 | end; 216 | 217 | if Assigned(FxdgToplevel) then 218 | begin 219 | FxdgToplevel.SetTitle('Example Client'); 220 | FSurface.Commit; 221 | WriteLn('Commit'); 222 | 223 | FFrameCallback := FSurface.Frame(); 224 | FFrameCallback.AddListener(Self); 225 | end; 226 | end; 227 | 228 | procedure TWaylandClient.Run; 229 | begin 230 | while Assigned(FDisplay) and (FDisplay.Dispatch <> -1) do 231 | begin 232 | if FPingCount >= 100 then 233 | Break; 234 | end; 235 | end; 236 | 237 | destructor TWaylandClient.Destroy; 238 | begin 239 | FreeAndNil(FxdgToplevel); 240 | FreeAndNil(FxdgSurface); 241 | FreeAndNil(FSurface); 242 | FreeAndNil(FCompositor); 243 | FreeAndNil(FShm); 244 | FreeAndNil(FRegistry); 245 | FreeAndNil(FDisplay); 246 | inherited; 247 | end; 248 | 249 | begin 250 | with TWaylandClient.Create do 251 | begin 252 | Run; 253 | Free; 254 | end; 255 | end. 256 | 257 | -------------------------------------------------------------------------------- /examples/client_05_settingseat.lpi: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <ProjectOptions> 4 | <Version Value="12"/> 5 | <General> 6 | <Flags> 7 | <MainUnitHasCreateFormStatements Value="False"/> 8 | <MainUnitHasTitleStatement Value="False"/> 9 | <MainUnitHasScaledStatement Value="False"/> 10 | </Flags> 11 | <SessionStorage Value="InProjectDir"/> 12 | <Title Value="client_05_settingseat"/> 13 | <UseAppBundle Value="False"/> 14 | <ResourceType Value="res"/> 15 | </General> 16 | <BuildModes> 17 | <Item Name="Default" Default="True"/> 18 | </BuildModes> 19 | <PublishOptions> 20 | <Version Value="2"/> 21 | <UseFileFilters Value="True"/> 22 | </PublishOptions> 23 | <RunParams> 24 | <FormatVersion Value="2"/> 25 | </RunParams> 26 | <RequiredPackages> 27 | <Item> 28 | <PackageName Value="WaylandPkg"/> 29 | </Item> 30 | <Item> 31 | <PackageName Value="WaylandSupportPkg"/> 32 | </Item> 33 | <Item> 34 | <PackageName Value="WaylandStablePkg"/> 35 | </Item> 36 | </RequiredPackages> 37 | <Units> 38 | <Unit> 39 | <Filename Value="client_05_settingseat.lpr"/> 40 | <IsPartOfProject Value="True"/> 41 | </Unit> 42 | </Units> 43 | </ProjectOptions> 44 | <CompilerOptions> 45 | <Version Value="11"/> 46 | <Target> 47 | <Filename Value="client_05_settingseat"/> 48 | </Target> 49 | <SearchPaths> 50 | <IncludeFiles Value="$(ProjOutDir)"/> 51 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 52 | </SearchPaths> 53 | <Linking> 54 | <Debugging> 55 | <DebugInfoType Value="dsDwarf3"/> 56 | </Debugging> 57 | </Linking> 58 | <Other> 59 | <ConfigFile> 60 | <WriteConfigFilePath Value=""/> 61 | </ConfigFile> 62 | </Other> 63 | </CompilerOptions> 64 | <Debugging> 65 | <Exceptions> 66 | <Item> 67 | <Name Value="EAbort"/> 68 | </Item> 69 | <Item> 70 | <Name Value="ECodetoolError"/> 71 | </Item> 72 | <Item> 73 | <Name Value="EFOpenError"/> 74 | </Item> 75 | </Exceptions> 76 | </Debugging> 77 | </CONFIG> 78 | -------------------------------------------------------------------------------- /examples/client_05_settingseat.lpr: -------------------------------------------------------------------------------- 1 | program client_05_settingseat; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cmem, cthreads, // cmem must be first or not used 8 | {$ENDIF} 9 | Classes, sysutils, 10 | wayland_protocol, wayland_client_core, xdg_shell_protocol, wayland_util 11 | { you can add units after this }; 12 | 13 | type 14 | 15 | { TWaylandClient } 16 | 17 | TWaylandClient = class(IWlRegistryListener, IXdgWmBaseListener, IXdgToplevelListener, 18 | IXdgSurfaceListener, IWlCallbackListener, 19 | IWlSeatListener, IWlPointerListener) 20 | private 21 | FDisplay: TWLDisplay; 22 | FRegistry: TWlRegistry; 23 | FCompositor: TWlCompositor; 24 | FxdgWM: TXdgWmBase; 25 | FShm: TWlShm; 26 | FSurface: TWlSurface; 27 | FxdgSurface: TXdgSurface; 28 | FxdgToplevel: TXdgToplevel; 29 | FPingCount: Integer; 30 | FLastFrame: Integer; 31 | FOffset: Double; 32 | FSeat: TWlSeat; 33 | FMouse: TWlPointer; 34 | // IWlRegistryListener 35 | procedure wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 36 | procedure wl_registry_global_remove(AWlRegistry: TWlRegistry; AName: DWord); 37 | // IXdgWmBaseListener 38 | procedure xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 39 | // IXdgToplevelListener 40 | procedure xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 41 | procedure xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 42 | procedure xdg_toplevel_configure_bounds(AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 43 | // IXdgSurfaceListener 44 | procedure xdg_surface_configure(AXdgSurface: TXdgSurface; ASerial: DWord); 45 | //IWlCallbackListener 46 | procedure wl_callback_done(AWlCallback: TWlCallback; ACallbackData: DWord); 47 | //IWlSeatListener 48 | procedure wl_seat_capabilities(AWlSeat: TWlSeat; ACapabilities: DWord); 49 | procedure wl_seat_name(AWlSeat: TWlSeat; AName: String); 50 | //IWlPointerListener 51 | procedure wl_pointer_enter(AWlPointer: TWlPointer; ASerial: DWord; ASurface: TWlSurface; ASurfaceX: Twl_fixed{24.8}; ASurfaceY: Twl_fixed{24.8}); 52 | procedure wl_pointer_leave(AWlPointer: TWlPointer; ASerial: DWord; ASurface: TWlSurface); 53 | procedure wl_pointer_motion(AWlPointer: TWlPointer; ATime: DWord; ASurfaceX: Twl_fixed{24.8}; ASurfaceY: Twl_fixed{24.8}); 54 | procedure wl_pointer_button(AWlPointer: TWlPointer; ASerial: DWord; ATime: DWord; AButton: DWord; AState: DWord); 55 | procedure wl_pointer_axis(AWlPointer: TWlPointer; ATime: DWord; AAxis: DWord; AValue: Twl_fixed{24.8}); 56 | procedure wl_pointer_frame(AWlPointer: TWlPointer); {since: 5} 57 | procedure wl_pointer_axis_source(AWlPointer: TWlPointer; AAxisSource: DWord); {since: 5} 58 | procedure wl_pointer_axis_stop(AWlPointer: TWlPointer; ATime: DWord; AAxis: DWord); {since: 5} 59 | procedure wl_pointer_axis_discrete(AWlPointer: TWlPointer; AAxis: DWord; ADiscrete: LongInt); {since: 5} 60 | 61 | function DrawFrame: TWlBuffer; 62 | public 63 | constructor Create; 64 | procedure Run; 65 | destructor Destroy; override; 66 | end; 67 | 68 | { TMyApp } 69 | 70 | procedure TWaylandClient.wl_registry_global(AWlRegistry: TWlRegistry; AName: DWord; AInterface: String; AVersion: DWord); 71 | begin 72 | WriteLn(Format('Register interface "%s" id(%d) version: %d', [AInterface, AName, AVersion])); 73 | 74 | // SHM interface 75 | if AInterface = wl_shm_interface.name then 76 | FShm := TWlShm.Create(AWlRegistry.Bind(AName, @wl_shm_interface, wl_shm_interface.version), True) 77 | // Compositor 78 | else if AInterface = wl_compositor_interface.name then 79 | FCompositor := TWlCompositor.Create(AWlRegistry.Bind(AName, @wl_compositor_interface, wl_compositor_interface.version), True) 80 | // xgd_wm_base 81 | else if AInterface = xdg_wm_base_interface.name then 82 | begin 83 | FxdgWM := TXdgWmBase.Create(AWlRegistry.Bind(AName, @xdg_wm_base_interface, xdg_wm_base_interface.version), True); 84 | FxdgWM.AddListener(Self); 85 | end 86 | // wl_seat 87 | else if AInterface = wl_seat_interface.name then 88 | begin 89 | FSeat := TWlSeat.Create(AWlRegistry.Bind(AName, @wl_seat_interface, Aversion), True); 90 | FSeat.AddListener(Self); 91 | end; 92 | 93 | 94 | 95 | end; 96 | 97 | procedure TWaylandClient.wl_registry_global_remove(AWlRegistry: TWlRegistry; 98 | AName: DWord); 99 | begin 100 | WriteLn(Format('UN-register interface id(%d)', [AName])); 101 | end; 102 | 103 | procedure TWaylandClient.xdg_wm_base_ping(AXdgWmBase: TXdgWmBase; ASerial: DWord); 104 | begin 105 | AXdgWmBase.Pong(ASerial); 106 | Inc(FPingCount); 107 | WriteLn('Ping: ', FPingCount); 108 | end; 109 | 110 | procedure TWaylandClient.xdg_toplevel_configure(AXdgToplevel: TXdgToplevel; 111 | AWidth: LongInt; AHeight: LongInt; AStates: Pwl_array); 112 | begin 113 | 114 | end; 115 | 116 | procedure TWaylandClient.xdg_toplevel_close(AXdgToplevel: TXdgToplevel); 117 | begin 118 | Writeln('Toplevel Close'); 119 | end; 120 | 121 | procedure TWaylandClient.xdg_toplevel_configure_bounds( 122 | AXdgToplevel: TXdgToplevel; AWidth: LongInt; AHeight: LongInt); 123 | begin 124 | WriteLn(Format('Configured toplevel size: %d:%d', [AWidth, AHeight])); 125 | end; 126 | 127 | procedure TWaylandClient.xdg_surface_configure(AXdgSurface: TXdgSurface; 128 | ASerial: DWord); 129 | var 130 | lBuffer: TWlBuffer; 131 | begin 132 | AXdgSurface.AckConfigure(Aserial); 133 | lBuffer := DrawFrame; 134 | if Assigned(lBuffer) then 135 | begin 136 | FSurface.Attach(lBuffer, 0, 0); 137 | FSurface.Commit; 138 | lBuffer.Free; 139 | end; 140 | end; 141 | 142 | procedure TWaylandClient.wl_callback_done(AWlCallback: TWlCallback; ACallbackData: DWord); 143 | var 144 | lTime: DWord absolute ACallbackData; 145 | lElapsed: Integer; 146 | lBuffer: TWlBuffer; 147 | begin 148 | AWlCallback.Destroy; 149 | with FSurface.Frame() do 150 | AddListener(Self); 151 | 152 | if FLastFrame <> 0 then 153 | begin 154 | lElapsed := lTime - FLastFrame; 155 | FOffset := FOffset + lElapsed / 1000 * 24; 156 | end; 157 | 158 | lBuffer := DrawFrame; 159 | if Assigned(lBuffer) then 160 | begin 161 | FSurface.Attach(lBuffer, 0, 0); 162 | FSurface.DamageBuffer(0,0, MaxInt, MaxInt); 163 | FSurface.Commit; 164 | lBuffer.Free; 165 | end; 166 | 167 | FLastFrame:=lTime; 168 | 169 | end; 170 | 171 | procedure TWaylandClient.wl_seat_capabilities(AWlSeat: TWlSeat; 172 | ACapabilities: DWord); 173 | begin 174 | WriteLn(Format('Seat caps called. Caps := : %s', [BinStr(ACapabilities, 8{32 possible})] )); 175 | WriteLn('WL_SEAT_CAPABILITY_POINTER = ', WL_SEAT_CAPABILITY_POINTER and ACapabilities <> 0); 176 | WriteLn('WL_SEAT_CAPABILITY_KEYBOARD = ', WL_SEAT_CAPABILITY_KEYBOARD and ACapabilities <> 0); 177 | WriteLn('WL_SEAT_CAPABILITY_TOUCH = ', WL_SEAT_CAPABILITY_TOUCH and ACapabilities <> 0); 178 | 179 | if WL_SEAT_CAPABILITY_POINTER and ACapabilities <> 0 then 180 | begin 181 | FMouse:= AWlSeat.GetPointer(); 182 | FMouse.AddListener(Self); 183 | end; 184 | 185 | 186 | end; 187 | 188 | procedure TWaylandClient.wl_seat_name(AWlSeat: TWlSeat; AName: String); 189 | begin 190 | WriteLn(Format('Seat called. Name: %s', [AName] )); 191 | //AWlSeat.; 192 | end; 193 | 194 | procedure TWaylandClient.wl_pointer_enter(AWlPointer: TWlPointer; 195 | ASerial: DWord; ASurface: TWlSurface; ASurfaceX: Twl_fixed; 196 | ASurfaceY: Twl_fixed); 197 | begin 198 | WriteLn(Format('Pointer Enter %d:%d', [ASurfaceX.AsInteger, ASurfaceY.AsInteger])); 199 | end; 200 | 201 | procedure TWaylandClient.wl_pointer_leave(AWlPointer: TWlPointer; 202 | ASerial: DWord; ASurface: TWlSurface); 203 | begin 204 | WriteLn(Format('Pointer Leave', [])); 205 | 206 | end; 207 | 208 | procedure TWaylandClient.wl_pointer_motion(AWlPointer: TWlPointer; 209 | ATime: DWord; ASurfaceX: Twl_fixed; ASurfaceY: Twl_fixed); 210 | begin 211 | WriteLn(Format('Pointer motion %d:%d', [ASurfaceX.AsInteger, ASurfaceY.AsInteger])); 212 | end; 213 | 214 | procedure TWaylandClient.wl_pointer_button(AWlPointer: TWlPointer; 215 | ASerial: DWord; ATime: DWord; AButton: DWord; AState: DWord); 216 | begin 217 | WriteLn(Format('Pointer Button: %d, State: %d', [AButton, AState])); 218 | end; 219 | 220 | procedure TWaylandClient.wl_pointer_axis(AWlPointer: TWlPointer; ATime: DWord; 221 | AAxis: DWord; AValue: Twl_fixed); 222 | begin 223 | WriteLn(Format('Pointer Axis: %d, Value: %d, Time: %d ', [AAxis, AValue.AsInteger, ATime])); 224 | end; 225 | 226 | procedure TWaylandClient.wl_pointer_frame(AWlPointer: TWlPointer); 227 | begin 228 | WriteLn(Format('Pointer Frame', [])); 229 | end; 230 | 231 | procedure TWaylandClient.wl_pointer_axis_source(AWlPointer: TWlPointer; 232 | AAxisSource: DWord); 233 | begin 234 | WriteLn(Format('Pointer Axis Source %d', [AAxisSource])); 235 | end; 236 | 237 | procedure TWaylandClient.wl_pointer_axis_stop(AWlPointer: TWlPointer; 238 | ATime: DWord; AAxis: DWord); 239 | begin 240 | WriteLn(Format('Pointer Axis Stop %d, Time: %d', [AAxis, ATime])); 241 | end; 242 | 243 | procedure TWaylandClient.wl_pointer_axis_discrete(AWlPointer: TWlPointer; 244 | AAxis: DWord; ADiscrete: LongInt); 245 | begin 246 | WriteLn(Format('Pointer Axis discrete %d, Discrete: %d', [AAxis, ADiscrete])); 247 | end; 248 | 249 | function TWaylandClient.DrawFrame: TWlBuffer; 250 | var 251 | lWidth, lHeight, lStride, lSize, y, x: Integer; 252 | lShmPool: TWLShmPool; 253 | lData: PLongWord; 254 | lOffset: Int64; 255 | begin 256 | lWidth := 400; 257 | lHeight := 400; 258 | 259 | lStride := lWidth * 4; 260 | lSize := lStride * lHeight; 261 | 262 | lShmPool := TWLSHMBase(FShm).CreatePool(lSize) as TWlShmPool; 263 | Result := lShmPool.CreateBuffer(0, lWidth, lHeight, lStride, WL_SHM_FORMAT_XRGB8888); 264 | 265 | lData := PLongWord(lShmPool.Data(0)); 266 | 267 | lOffset := Trunc(FOffset); 268 | 269 | for y := 0 to lHeight -1 do { 2d loop } for x := 0 to lWidth -1 do 270 | begin 271 | if ((x + loffset) div 50 + (y + loffset) div 50) mod 2 = 0 then 272 | 273 | lData[y * lWidth + x] := $FF834555 // Set pixel color 274 | else 275 | lData[y * lWidth + x] := $FFEEEEEE; 276 | end; 277 | 278 | lData := nil; 279 | 280 | lShmPool.Free; 281 | end; 282 | 283 | constructor TWaylandClient.Create; 284 | var 285 | FFrameCallback: TWlCallback; 286 | begin 287 | FDisplay := TWlDisplay.Connect('') as TWLDisplay; 288 | if not Assigned(FDisplay) then 289 | begin 290 | WriteLn('Failed to open display'); 291 | Exit; 292 | end; 293 | 294 | FRegistry := FDisplay.GetRegistry(); 295 | FRegistry.AddListener(Self); 296 | FDisplay.Roundtrip; 297 | if Assigned(FCompositor) then 298 | begin 299 | FSurface := FCompositor.CreateSurface(); 300 | WriteLn('Surface creation successful = ', Assigned(FSurface)); 301 | end; 302 | 303 | if Assigned(FSurface) and Assigned(FxdgWM) then 304 | begin 305 | FxdgSurface := FxdgWM.GetXdgSurface(FSurface); 306 | WriteLn('XDG_Surface creation successful = ', Assigned(FxdgSurface)); 307 | end; 308 | 309 | if Assigned(FxdgSurface) then 310 | begin 311 | FxdgSurface.AddListener(Self); 312 | FxdgToplevel := FxdgSurface.GetToplevel(); 313 | WriteLn('XDG_Toplevel creation successful = ', Assigned(FxdgToplevel)); 314 | end; 315 | 316 | if Assigned(FxdgToplevel) then 317 | begin 318 | FxdgToplevel.SetTitle('Example Client'); 319 | FSurface.Commit; 320 | WriteLn('Commit'); 321 | 322 | FFrameCallback := FSurface.Frame(); 323 | FFrameCallback.AddListener(Self); 324 | end; 325 | end; 326 | 327 | procedure TWaylandClient.Run; 328 | begin 329 | while Assigned(FDisplay) and (FDisplay.Dispatch <> -1) do 330 | begin 331 | if FPingCount >= 1000 then 332 | Break; 333 | end; 334 | end; 335 | 336 | destructor TWaylandClient.Destroy; 337 | begin 338 | FreeAndNil(FMouse); 339 | FreeAndNil(FSeat); 340 | FreeAndNil(FxdgToplevel); 341 | FreeAndNil(FxdgSurface); 342 | FreeAndNil(FSurface); 343 | FreeAndNil(FCompositor); 344 | FreeAndNil(FShm); 345 | FreeAndNil(FRegistry); 346 | FreeAndNil(FDisplay); 347 | inherited; 348 | end; 349 | 350 | begin 351 | with TWaylandClient.Create do 352 | begin 353 | Run; 354 | Free; 355 | end; 356 | WriteLn('Quitting'); 357 | end. 358 | 359 | -------------------------------------------------------------------------------- /fpcwaylandbindings.lpi: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <ProjectOptions> 4 | <Version Value="12"/> 5 | <General> 6 | <Flags> 7 | <MainUnitHasCreateFormStatements Value="False"/> 8 | <MainUnitHasTitleStatement Value="False"/> 9 | <MainUnitHasScaledStatement Value="False"/> 10 | <CompatibilityMode Value="True"/> 11 | </Flags> 12 | <SessionStorage Value="InProjectDir"/> 13 | <Title Value="fpcwaylandbindings"/> 14 | <UseAppBundle Value="False"/> 15 | <ResourceType Value="res"/> 16 | </General> 17 | <BuildModes Count="1"> 18 | <Item1 Name="Default" Default="True"/> 19 | </BuildModes> 20 | <PublishOptions> 21 | <Version Value="2"/> 22 | </PublishOptions> 23 | <RunParams> 24 | <FormatVersion Value="2"/> 25 | <Modes Count="1"> 26 | <Mode0 Name="default"/> 27 | </Modes> 28 | </RunParams> 29 | <Units Count="3"> 30 | <Unit0> 31 | <Filename Value="fpcwaylandbindings.lpr"/> 32 | <IsPartOfProject Value="True"/> 33 | </Unit0> 34 | <Unit1> 35 | <Filename Value="wayland_xml.pas"/> 36 | <IsPartOfProject Value="True"/> 37 | </Unit1> 38 | <Unit2> 39 | <Filename Value="protocol_generator.pas"/> 40 | <IsPartOfProject Value="True"/> 41 | </Unit2> 42 | </Units> 43 | </ProjectOptions> 44 | <CompilerOptions> 45 | <Version Value="11"/> 46 | <Target> 47 | <Filename Value="fpcwaylandbindings"/> 48 | </Target> 49 | <SearchPaths> 50 | <IncludeFiles Value="$(ProjOutDir)"/> 51 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 52 | </SearchPaths> 53 | <Linking> 54 | <Debugging> 55 | <DebugInfoType Value="dsDwarf3"/> 56 | </Debugging> 57 | </Linking> 58 | </CompilerOptions> 59 | <Debugging> 60 | <Exceptions Count="3"> 61 | <Item1> 62 | <Name Value="EAbort"/> 63 | </Item1> 64 | <Item2> 65 | <Name Value="ECodetoolError"/> 66 | </Item2> 67 | <Item3> 68 | <Name Value="EFOpenError"/> 69 | </Item3> 70 | </Exceptions> 71 | </Debugging> 72 | </CONFIG> 73 | -------------------------------------------------------------------------------- /fpcwaylandbindings.lpr: -------------------------------------------------------------------------------- 1 | { <fpcwaylandbindings.lpr> 2 | 3 | Copyright (C) <2018> <Andrew Haines> <andrewd207@aol.com> 4 | 5 | This source is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free 7 | Software Foundation; either version 2 of the License, or (at your option) 8 | any later version. 9 | 10 | This code is distributed in the hope that it will be useful, but WITHOUT ANY 11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 | details. 14 | 15 | A copy of the GNU General Public License is available on the World Wide Web 16 | at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing 17 | to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 18 | Boston, MA 02110-1335, USA. 19 | } 20 | program fpcwaylandbindings; 21 | 22 | {$mode objfpc}{$H+} 23 | 24 | uses 25 | {$IFDEF UNIX}{$IFDEF UseCThreads} 26 | cthreads, 27 | {$ENDIF}{$ENDIF} 28 | Classes, Sysutils, wayland_xml, 29 | protocol_generator; 30 | 31 | var 32 | list: TStringList; 33 | Protocol: String; 34 | BaseDir: String; 35 | 36 | procedure GatherProtocols(ADir: String); 37 | var 38 | lDirs: TStringList; 39 | Rec: TRawByteSearchRec; 40 | Path: String; 41 | begin 42 | ADir := IncludeTrailingPathDelimiter(ADir); 43 | 44 | lDirs := TStringList.Create; 45 | // first find directories 46 | if FindFirst(ADir+'*', faDirectory, Rec) = 0 then 47 | repeat 48 | if Rec.Attr and faDirectory = faDirectory then 49 | lDirs.Add(ADir+Rec.Name+'/'); 50 | until FindNext(Rec) <> 0; 51 | FindClose(Rec); 52 | 53 | for Path in lDirs do 54 | begin 55 | if FindFirst(Path+'*.xml', faAnyFile, Rec) = 0 then 56 | repeat 57 | if Rec.Attr and faDirectory = faDirectory then 58 | continue; 59 | List.Add(Path+REc.Name); 60 | until FindNext(Rec) <> 0; 61 | FindClose(Rec); 62 | end; 63 | 64 | end; 65 | 66 | procedure createbinding(AFile: String; OutDir: String); 67 | var 68 | g: TGenerator; 69 | out_unit: TStrings; 70 | lName: String; 71 | begin 72 | lName := ExtractFileName(AFile); 73 | lName := ChangeFileExt(lName, '') +'_protocol'; 74 | lName := StringReplace(lName, '-', '_', [rfReplaceAll]); 75 | out_unit := TStringList.Create; 76 | g := TGenerator.Create(AFile); 77 | g.Generate(lname, out_unit, True); 78 | out_unit.SaveToFile(Outdir+lName+'.pas'); 79 | out_unit.Free; 80 | g.Free; 81 | end; 82 | 83 | begin 84 | BaseDir:=IncludeTrailingPathDelimiter(GetEnvironmentVariable('WAYLAND_BASE')); 85 | if BaseDir = PathDelim then 86 | BaseDir:='/usr/share/'; 87 | 88 | if not DirectoryExists(BaseDir) then 89 | begin 90 | WriteLn('Wayland path not found: ', BaseDir+'wayland/'); 91 | WriteLn('use "WAYLAND_BASE={path} ', ExtractFileName(ParamStr(0)),'" to set the base directory that contains:'); 92 | WriteLn(' wayland/'); 93 | WriteLn(' wayland-protocols/'); 94 | Halt(1); 95 | end; 96 | 97 | Createbinding(BaseDir+'wayland/wayland.xml', 'waylandpkg/'); 98 | 99 | List := TStringList.Create; 100 | GatherProtocols(BaseDir+'wayland-protocols/stable/'); 101 | for Protocol in list do 102 | Createbinding(Protocol, 'waylandstablepkg/'); 103 | list.Clear; 104 | GatherProtocols(BaseDir+'wayland-protocols/unstable/'); 105 | for Protocol in list do 106 | Createbinding(Protocol, 'waylandunstablepkg/'); 107 | List.free; 108 | 109 | 110 | end. 111 | 112 | -------------------------------------------------------------------------------- /supportpkg/waylandsupportpkg.lpk: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <Package Version="4"> 4 | <Name Value="WaylandSupportPkg"/> 5 | <Type Value="RunAndDesignTime"/> 6 | <CompilerOptions> 7 | <Version Value="11"/> 8 | <SearchPaths> 9 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 10 | </SearchPaths> 11 | </CompilerOptions> 12 | <Files Count="4"> 13 | <Item1> 14 | <Filename Value="libharfbuzz.pas"/> 15 | <UnitName Value="libharfbuzz"/> 16 | </Item1> 17 | <Item2> 18 | <Filename Value="libxkbcommon.pas"/> 19 | <UnitName Value="libxkbcommon"/> 20 | </Item2> 21 | <Item3> 22 | <Filename Value="libxkbcommon-keys.inc"/> 23 | <Type Value="Include"/> 24 | </Item3> 25 | <Item4> 26 | <Filename Value="xkb_classes.pas"/> 27 | <UnitName Value="xkb_classes"/> 28 | </Item4> 29 | </Files> 30 | <RequiredPkgs Count="1"> 31 | <Item1> 32 | <PackageName Value="FCL"/> 33 | </Item1> 34 | </RequiredPkgs> 35 | <UsageOptions> 36 | <UnitPath Value="$(PkgOutDir)"/> 37 | </UsageOptions> 38 | <PublishOptions> 39 | <Version Value="2"/> 40 | </PublishOptions> 41 | </Package> 42 | </CONFIG> 43 | -------------------------------------------------------------------------------- /supportpkg/waylandsupportpkg.pas: -------------------------------------------------------------------------------- 1 | { This file was automatically created by Lazarus. Do not edit! 2 | This source is only used to compile and install the package. 3 | } 4 | 5 | unit WaylandSupportPkg; 6 | 7 | {$warn 5023 off : no warning about unused units} 8 | interface 9 | 10 | uses 11 | libharfbuzz, libxkbcommon, xkb_classes, LazarusPackageIntf; 12 | 13 | implementation 14 | 15 | procedure Register; 16 | begin 17 | end; 18 | 19 | initialization 20 | RegisterPackage('WaylandSupportPkg', @Register); 21 | end. 22 | -------------------------------------------------------------------------------- /supportpkg/xkb_classes.pas: -------------------------------------------------------------------------------- 1 | unit xkb_classes; 2 | {$mode objfpc}{$h+} 3 | 4 | interface 5 | 6 | uses 7 | Classes, sysutils,libxkbcommon, BaseUnix; 8 | 9 | type 10 | 11 | { TXKBHelper } 12 | 13 | TXKBHelper = class 14 | public 15 | class var ShiftKeys: array[TShiftStateEnum] of DWord; 16 | private 17 | class var Inited: Boolean; 18 | private 19 | FContext: Pxkb_context; 20 | FKeymap: Pxkb_keymap; 21 | FLastSym: xkb_keysym_t; 22 | FState: Pxkb_state; 23 | FComposeTable: Pxkb_compose_table; 24 | FComposeState: Pxkb_compose_state; 25 | FShiftState: TShiftState; 26 | function GetLocale: String; 27 | public 28 | constructor Create(Afd: LongInt; ASize: Integer); 29 | procedure UpdateKeyState(AModsDepressed, AModsLatched, AModsLocked, AGroup: LongWord); 30 | function ModState: TShiftState; 31 | function Feed(AKeySym: xkb_keysym_t): xkb_compose_feed_result; 32 | procedure ResetCompose; 33 | function LookupSym: xkb_keysym_t; 34 | function LookupUtf8: UTF8String; 35 | function ComposeStatus: xkb_compose_status; 36 | function KeySymToUtf8(AKeySym: xkb_keysym_t): UTF8String; 37 | function KeyCodeName(AKeyCode: xkb_keycode_t): String; 38 | function KeyGetSyms(AKey: LongWord; ASyms: PPxkb_keysym_t): Integer; 39 | property LastSym: xkb_keysym_t read FLastSym; 40 | 41 | end; 42 | 43 | implementation 44 | 45 | 46 | { TXKBHelper } 47 | 48 | function TXKBHelper.GetLocale: String; 49 | begin 50 | Result := GetEnvironmentVariable('LC_ALL'); 51 | if Result = '' then 52 | Result := GetEnvironmentVariable('LC_CTYPE'); 53 | if Result = '' then 54 | Result := GetEnvironmentVariable('LANG'); 55 | if Result = '' then 56 | Result := 'C'; 57 | end; 58 | 59 | constructor TXKBHelper.Create(Afd: LongInt; ASize: Integer); 60 | var 61 | lMemMap: Pointer; 62 | r: DWord; 63 | begin 64 | lMemMap:= Fpmmap(nil, ASize, PROT_READ, MAP_SHARED, Afd, 0); // 65 | if lMemMap = MAP_FAILED then 66 | begin 67 | exit; 68 | end; 69 | FContext := xkb_context_new(XKB_CONTEXT_NO_FLAGS); 70 | FKeymap := xkb_keymap_new_from_string(FContext, lMemMap, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); 71 | Fpmunmap(lMemMap, ASize); 72 | FState:=xkb_state_new(FKeymap); 73 | FComposeTable := xkb_compose_table_new_from_locale(FContext, Pchar(GetLocale), XKB_COMPOSE_COMPILE_NO_FLAGS); 74 | FComposeState := xkb_compose_state_new(FComposeTable, XKB_COMPOSE_STATE_NO_FLAGS); 75 | 76 | if not Inited then 77 | begin 78 | r := xkb_keymap_mod_get_index(FKeymap, 'Shift'); 79 | ShiftKeys[ssShift] := 1 shl r; 80 | r := xkb_keymap_mod_get_index(FKeymap, 'Control'); 81 | ShiftKeys[ssCtrl] := 1 shl r; 82 | r := xkb_keymap_mod_get_index(FKeymap, 'Mod1'); 83 | ShiftKeys[ssAlt] := 1 shl r; 84 | r := xkb_keymap_mod_get_index(FKeymap, 'Mod4'); 85 | ShiftKeys[ssSuper] := 1 shl r; 86 | r := xkb_keymap_mod_get_index(FKeymap, 'Mod2'); 87 | ShiftKeys[ssNum] := 1 shl r; 88 | r := xkb_keymap_mod_get_index(FKeymap, 'Lock'); 89 | ShiftKeys[ssCaps] := 1 shl r; 90 | Inited:=True; 91 | end; 92 | end; 93 | 94 | procedure TXKBHelper.UpdateKeyState(AModsDepressed, AModsLatched, AModsLocked, 95 | AGroup: LongWord); 96 | var 97 | lMask: DWord; 98 | s: TShiftStateEnum; 99 | begin 100 | xkb_state_update_mask(FState, AModsDepressed, AModsLatched, AmodsLocked, 0,0, AGroup); 101 | lMask := xkb_state_serialize_mods(FState, xkb_state_component( 102 | DWORD(XKB_STATE_MODS_DEPRESSED) or DWORD(XKB_STATE_LAYOUT_DEPRESSED) or 103 | DWORD(XKB_STATE_MODS_LATCHED) or DWORD(XKB_STATE_LAYOUT_LATCHED) 104 | or DWORD(XKB_STATE_MODS_LOCKED) or DWORD(XKB_STATE_LAYOUT_LOCKED) 105 | )); 106 | 107 | for s in TShiftState do 108 | begin 109 | if ShiftKeys[s] = 0 then 110 | continue; 111 | if ShiftKeys[s] and lMask <> 0 then 112 | begin 113 | Include(FShiftState, s); 114 | //WriteLn('Added :', s); 115 | end 116 | else 117 | begin 118 | Exclude(FShiftState, s); 119 | 120 | //WriteLn('Removed :', s); 121 | end; 122 | end; 123 | 124 | end; 125 | 126 | function TXKBHelper.ModState: TShiftState; 127 | begin 128 | REsult := FShiftState; 129 | end; 130 | 131 | function TXKBHelper.Feed(AKeySym: xkb_keysym_t): xkb_compose_feed_result; 132 | begin 133 | Result := xkb_compose_state_feed(FComposeState, AKeySym); 134 | FLastSym := AKeySym; 135 | end; 136 | 137 | procedure TXKBHelper.ResetCompose; 138 | begin 139 | xkb_compose_state_reset(FComposeState); 140 | end; 141 | 142 | function TXKBHelper.LookupSym: xkb_keysym_t; 143 | begin 144 | // state is *not* XKB_COMPOSE_COMPOSED then it will return XKB_KEY_NoSymbol; 145 | Result := xkb_compose_state_get_one_sym(FComposeState); 146 | end; 147 | 148 | function TXKBHelper.LookupUtf8: UTF8String; 149 | var 150 | lSize: Integer; 151 | begin 152 | SetLength(Result, 128); 153 | lSize := xkb_compose_state_get_utf8(FComposeState, @Result[1], Length(Result)); 154 | SetLength(Result, lSize); 155 | end; 156 | 157 | function TXKBHelper.ComposeStatus: xkb_compose_status; 158 | begin 159 | Result := xkb_compose_state_get_status(FComposeState); 160 | end; 161 | 162 | function TXKBHelper.KeySymToUtf8(AKeySym: xkb_keysym_t): UTF8String; 163 | var 164 | lSize: Integer; 165 | begin 166 | repeat 167 | SetLength(Result, Length(Result)+4); 168 | lSize := xkb_keysym_to_utf8(AKeySym, @Result[1], Length(Result)); 169 | if lSize = 0 then 170 | Exit(''); // invalid string 171 | until lSize > 0; 172 | SetLength(Result, lSize); 173 | end; 174 | 175 | function TXKBHelper.KeyCodeName(AKeyCode: xkb_keycode_t): String; 176 | begin 177 | Result := xkb_keymap_key_get_name(FKeymap, AKeyCode); 178 | end; 179 | 180 | function TXKBHelper.KeyGetSyms(AKey: LongWord; ASyms: PPxkb_keysym_t): Integer; 181 | begin 182 | Result := xkb_state_key_get_syms(FState, AKey, ASyms); 183 | end; 184 | 185 | end. 186 | -------------------------------------------------------------------------------- /waylandpkg/wayland_client.pas: -------------------------------------------------------------------------------- 1 | {* 2 | * Copyright © 2008 Kristian Høgsberg 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | *} 25 | unit wayland_client; 26 | 27 | {$mode objfpc}{$H+} 28 | 29 | interface 30 | 31 | uses 32 | Classes, SysUtils, wayland_client_core, wayland_util, ctypes; 33 | 34 | type 35 | 36 | Pwl_display = ^Twl_display; 37 | Pwl_event_queue = ^Twl_event_queue; 38 | Pwl_proxy = ^Twl_proxy; 39 | Pwl_proxy_wrapper = ^Twl_proxy_wrapper; 40 | { Twl_proxy } 41 | 42 | Twl_proxy = object 43 | procedure MarshalArray(opcode: cint32; args: Pwl_argument); 44 | function Create(factory: Pwl_proxy; &interface: Pwl_interface): Pwl_proxy; static; 45 | function CreateWrapper: Pwl_proxy_wrapper; 46 | procedure Destroy; 47 | function MarshalArrayConstructor(opcode: cint32; args: Pwl_argument; &interface: Pwl_interface): Pwl_proxy; 48 | function MarshalArrayConstructorVersioned(opcode: cint32; args: Pwl_argument; &interface: Pwl_interface; version: cint32): Pwl_proxy; 49 | function AddListener(impl: PPointer; data: Pointer): cint; 50 | function GetListener: Pointer; 51 | function AddDispatcher(dispatcher: wl_dispatcher_func_t; dispatcher_data: pointer; data: pointer): cint; 52 | procedure SetUserData(Data: Pointer); 53 | function GetUserData: Pointer; 54 | function GetVersion: cuint32; 55 | function GetID: cuint32; 56 | function GetClass: PChar; 57 | procedure SetQueue(queue: Pwl_event_queue); 58 | end; 59 | Twl_event_queue = object 60 | procedure Destroy; 61 | end; 62 | 63 | { Twl_proxy_wrapper } 64 | 65 | Twl_proxy_wrapper = object(Twl_proxy) 66 | procedure WrapperDestroy; 67 | end; 68 | 69 | { Twl_display } 70 | 71 | Twl_display = object 72 | function Connect(Name: Pchar): Pwl_display; static; 73 | function ConnectTo(fd: cint): Pwl_display; static; 74 | procedure Disconnect; 75 | function GetFD: cint; 76 | function Dispatch: cint; 77 | function DispatchQueue(Queue: Pwl_event_queue): cint; 78 | function DispatchQueuePending: cint; 79 | function GetError: cint; 80 | function GetProtocolError(&interface: PPwl_interface; id: pcuint32): cuint32; 81 | function Flush: cint; 82 | function RoundtripQueue(Queue: Pwl_event_queue): cint; 83 | function Roundtrip: cint; 84 | function CreateQueue: Pwl_event_queue; 85 | function PrepareReadQueue(Queue: Pwl_event_queue): cint; 86 | function PrepareRead: cint; 87 | procedure CancelRead; 88 | function ReadEvents: cint; 89 | end; 90 | 91 | implementation 92 | 93 | { Twl_display } 94 | 95 | function Twl_display.Connect(Name: Pchar): Pwl_display; 96 | begin 97 | Result := wl_display_connect(Name); 98 | end; 99 | 100 | function Twl_display.ConnectTo(fd: cint): Pwl_display; 101 | begin 102 | Result := wl_display_connect_to_fd(fd); 103 | end; 104 | 105 | procedure Twl_display.Disconnect; 106 | begin 107 | wl_display_disconnect(@self); 108 | end; 109 | 110 | function Twl_display.GetFD: cint; 111 | begin 112 | Result := wl_display_get_fd(@self); 113 | end; 114 | 115 | function Twl_display.Dispatch: cint; 116 | begin 117 | Result := wl_display_dispatch(@self); 118 | end; 119 | 120 | function Twl_display.DispatchQueue(Queue: Pwl_event_queue): cint; 121 | begin 122 | Result := wl_display_dispatch_queue(@self, Queue); 123 | end; 124 | 125 | function Twl_display.DispatchQueuePending: cint; 126 | begin 127 | Result := wl_display_dispatch_pending(@self); 128 | end; 129 | 130 | function Twl_display.GetError: cint; 131 | begin 132 | Result := wl_display_get_error(@self); 133 | end; 134 | 135 | function Twl_display.GetProtocolError(&interface: PPwl_interface; id: pcuint32): cuint32; 136 | begin 137 | Result := wl_display_get_protocol_error(@self, &interface, id); 138 | end; 139 | 140 | function Twl_display.Flush: cint; 141 | begin 142 | Result := wl_display_flush(@self); 143 | end; 144 | 145 | function Twl_display.RoundtripQueue(Queue: Pwl_event_queue): cint; 146 | begin 147 | Result := wl_display_roundtrip_queue(@self, Queue); 148 | end; 149 | 150 | function Twl_display.Roundtrip: cint; 151 | begin 152 | Result := wl_display_roundtrip(@self); 153 | end; 154 | 155 | function Twl_display.CreateQueue: Pwl_event_queue; 156 | begin 157 | Result := wl_display_create_queue(@self); 158 | end; 159 | 160 | function Twl_display.PrepareReadQueue(Queue: Pwl_event_queue): cint; 161 | begin 162 | Result := wl_display_prepare_read_queue(@self, Queue); 163 | end; 164 | 165 | function Twl_display.PrepareRead: cint; 166 | begin 167 | Result := wl_display_prepare_read(@self); 168 | end; 169 | 170 | procedure Twl_display.CancelRead; 171 | begin 172 | wl_display_cancel_read(@self); 173 | end; 174 | 175 | function Twl_display.ReadEvents: cint; 176 | begin 177 | Result := wl_display_read_events(@self); 178 | end; 179 | 180 | { Twl_proxy_wrapper } 181 | 182 | procedure Twl_proxy_wrapper.WrapperDestroy; 183 | begin 184 | wl_proxy_wrapper_destroy(@Self); 185 | end; 186 | 187 | 188 | { Twl_proxy } 189 | 190 | procedure Twl_proxy.MarshalArray(opcode: cint32; args: Pwl_argument); 191 | begin 192 | wl_proxy_marshal_array(@Self, opcode, args); 193 | end; 194 | 195 | function Twl_proxy.Create(factory: Pwl_proxy; &interface: Pwl_interface): Pwl_proxy; 196 | begin 197 | Result := wl_proxy_create(factory, &interface); 198 | end; 199 | 200 | function Twl_proxy.CreateWrapper: Pwl_proxy_wrapper; 201 | begin 202 | Result := wl_proxy_create_wrapper(@Self); 203 | end; 204 | 205 | procedure Twl_proxy.Destroy; 206 | begin 207 | wl_proxy_destroy(@Self); 208 | end; 209 | 210 | function Twl_proxy.MarshalArrayConstructor(opcode: cint32; args: Pwl_argument; 211 | &interface: Pwl_interface): Pwl_proxy; 212 | begin 213 | Result := wl_proxy_marshal_array_constructor(@Self, opcode, args, &interface); 214 | end; 215 | 216 | function Twl_proxy.MarshalArrayConstructorVersioned(opcode: cint32; args: Pwl_argument; 217 | &interface: Pwl_interface; version: cint32): Pwl_proxy; 218 | begin 219 | Result := wl_proxy_marshal_array_constructor_versioned(@Self, opcode, args, &interface, version); 220 | end; 221 | 222 | function Twl_proxy.AddListener(impl: PPointer; data: Pointer): cint; 223 | begin 224 | Result := wl_proxy_add_listener(@Self, impl, data); 225 | end; 226 | 227 | function Twl_proxy.GetListener: Pointer; 228 | begin 229 | Result := wl_proxy_get_listener(@Self); 230 | end; 231 | 232 | function Twl_proxy.AddDispatcher(dispatcher: wl_dispatcher_func_t; 233 | dispatcher_data: pointer; data: pointer): cint; 234 | begin 235 | Result := wl_proxy_add_dispatcher(@Self, dispatcher,dispatcher_data, data); 236 | end; 237 | 238 | procedure Twl_proxy.SetUserData(Data: Pointer); 239 | begin 240 | wl_proxy_set_user_data(@Self, Data); 241 | end; 242 | 243 | function Twl_proxy.GetUserData: Pointer; 244 | begin 245 | Result := wl_proxy_get_user_data(@Self); 246 | end; 247 | 248 | function Twl_proxy.GetVersion: cuint32; 249 | begin 250 | Result := wl_proxy_get_version(@Self); 251 | end; 252 | 253 | function Twl_proxy.GetID: cuint32; 254 | begin 255 | Result := wl_proxy_get_id(@Self); 256 | end; 257 | 258 | function Twl_proxy.GetClass: PChar; 259 | begin 260 | Result := wl_proxy_get_class(@Self); 261 | end; 262 | 263 | procedure Twl_proxy.SetQueue(queue: Pwl_event_queue); 264 | begin 265 | wl_proxy_set_queue(@Self, queue); 266 | 267 | end; 268 | 269 | { Twl_event_queue } 270 | 271 | procedure Twl_event_queue.Destroy; 272 | begin 273 | wl_event_queue_destroy(@self); 274 | end; 275 | 276 | 277 | end. 278 | 279 | -------------------------------------------------------------------------------- /waylandpkg/wayland_cursor.pas: -------------------------------------------------------------------------------- 1 | {/* 2 | * Copyright © 2012 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | } 26 | unit wayland_cursor; 27 | 28 | {$mode objfpc}{$H+} 29 | {$packrecords c} 30 | {$linklib wayland-cursor} 31 | 32 | interface 33 | 34 | uses 35 | Classes, ctypes, wayland_util, wayland_protocol; 36 | 37 | type 38 | Pwl_cursor_theme = ^Twl_cursor_theme; 39 | Twl_cursor_theme = record end; 40 | 41 | PPwl_cursor_image = ^Pwl_cursor_image; 42 | Pwl_cursor_image = ^Twl_cursor_image; 43 | Twl_cursor_image = record 44 | width, 45 | height, 46 | hotspot_x, 47 | hotspot_y: cuint32; 48 | end; 49 | 50 | Pwl_cursor = ^Twl_cursor; 51 | Twl_cursor = record 52 | image_count: cuint; 53 | images: PPwl_cursor_image; 54 | name: pchar; 55 | end; 56 | 57 | 58 | function wl_cursor_theme_load(name: pchar; size: cint; shm: Pwl_shm): Pwl_cursor_theme; cdecl; external; 59 | procedure wl_cursor_theme_destroy(theme: Pwl_cursor_theme); cdecl; external; 60 | function wl_cursor_theme_get_cursor(theme: Pwl_cursor_theme; name: pchar): Pwl_cursor; cdecl; external; 61 | function wl_cursor_image_get_buffer(image: Pwl_cursor_image): Pwl_buffer; cdecl; external; 62 | function wl_cursor_frame(cursor: Pwl_cursor; time : cuint32): cint; cdecl; external; 63 | function wl_cursor_frame_and_duration(cursor: Pwl_cursor; time: cuint32; duration: pcuint32): cint; cdecl; external; 64 | 65 | implementation 66 | 67 | end. 68 | 69 | -------------------------------------------------------------------------------- /waylandpkg/wayland_egl.pas: -------------------------------------------------------------------------------- 1 | {* 2 | * Copyright © 2011 Kristian Høgsberg 3 | * Copyright © 2011 Benjamin Franzke 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial 15 | * portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *} 26 | 27 | 28 | unit wayland_egl; 29 | 30 | {$mode objfpc}{$H+} 31 | 32 | {$linklib wayland-egl} 33 | 34 | interface 35 | 36 | uses 37 | Classes, SysUtils, wayland_protocol, ctypes; 38 | 39 | type 40 | Pwl_egl_window = ^Twl_egl_window; 41 | Twl_egl_window = record end; 42 | 43 | function wl_egl_window_create(surface: Pwl_surface; width, height: cint) : Pwl_egl_window; cdecl; external; 44 | procedure wl_egl_window_destroy(egl_window: Pwl_egl_window); cdecl; external; 45 | procedure wl_egl_window_resize(egl_window: Pwl_egl_window; width, height, dx, dy: cint); cdecl; external; 46 | procedure wl_egl_window_get_attached_size(egl_window: Pwl_egl_window; width, height: Pcint); cdecl; external; 47 | 48 | 49 | 50 | 51 | implementation 52 | 53 | end. 54 | 55 | -------------------------------------------------------------------------------- /waylandpkg/wayland_shared_buffer.pas: -------------------------------------------------------------------------------- 1 | unit wayland_shared_buffer; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | interface 6 | 7 | uses 8 | Classes, SysUtils, BaseUnix, ctypes, wayland_protocol; 9 | 10 | type 11 | TFPWL_display = class 12 | Display: Pwl_display; 13 | Registry: Pwl_registry; 14 | Compositor: Pwl_compositor; 15 | Shell: Pwl_shell; 16 | Shm: Pwl_shm; 17 | end; 18 | 19 | function Create_shm_pool(shm: TWlShm; size: Integer; outdata: PPointer; outfd: Pcuint): TWlShmPool; 20 | function Create_shm_buffer(shm: TWlShm; AWidth, AHeight: Integer; AFormat: cuint32; out data: Pointer; out fd: cint): TWlBuffer; 21 | 22 | 23 | 24 | 25 | 26 | implementation 27 | 28 | const 29 | FD_CLOEXEC = 1; 30 | 31 | function mkstemp(filename: PChar):longint;cdecl;external 'libc' name 'mkstemp'; 32 | function mkostemp(filename: PChar; flags: cint):longint;cdecl;external 'libc' name 'mkostemp'; 33 | function CreateAnonymousFile(ASize: PtrUint): cint; {fd} forward; 34 | 35 | function Create_shm_pool(shm: TWlShm; size: Integer; outData: PPointer; outfd: Pcuint): TWlShmPool; 36 | var 37 | fd: cint; 38 | data: Pointer; 39 | begin 40 | Result := nil; 41 | fd := CreateAnonymousFile(size); 42 | if fd < 0 then 43 | Exit; 44 | 45 | data := Fpmmap(nil, size, PROT_READ or PROT_WRITE, MAP_SHARED, fd, 0); 46 | if Assigned(outData) then 47 | outData^ := data;; 48 | if data = MAP_FAILED then 49 | begin 50 | fpclose(fd); 51 | Exit; 52 | end; 53 | 54 | Result := shm.CreatePool(fd, size); 55 | if outfd = nil then 56 | FpClose(fd) 57 | else 58 | outfd^ := fd; 59 | end; 60 | 61 | function Create_shm_buffer(shm: TWlShm; AWidth, AHeight: Integer; AFormat: cuint32; out data: Pointer; out fd: cint): TWlBuffer; 62 | var 63 | pool: TWlShmPool; 64 | size, stride: cint; 65 | begin 66 | Result := nil; 67 | stride := AWidth *4; 68 | size := stride * Aheight; 69 | 70 | pool := Create_shm_pool(shm, size, @Data, @fd); 71 | Result := pool.CreateBuffer(0, AWidth, AHeight, stride, AFormat); 72 | pool.Free // proxy will be destroyed after the buffer is destroyed 73 | end; 74 | 75 | 76 | 77 | function CreateAnonymousFile(ASize: PtrUint): cint; {fd} 78 | const 79 | O_CLOEXEC = $80000; 80 | var 81 | lName: String; 82 | flags: cint; 83 | begin 84 | lName := GetEnvironmentVariable('XDG_RUNTIME_DIR') + '/weston-shared-XXXXXX'; 85 | 86 | Result := mkostemp(PChar(lName), O_CLOEXEC); 87 | FpUnlink(lName); 88 | 89 | if (FpFtruncate(Result, ASize) < 0) then 90 | begin 91 | FpClose(Result); 92 | Result := -1; 93 | end; 94 | end; 95 | 96 | 97 | 98 | end. 99 | 100 | -------------------------------------------------------------------------------- /waylandpkg/wayland_util.pas: -------------------------------------------------------------------------------- 1 | {* 2 | * Copyright © 2008 Kristian Høgsberg 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | *} 25 | 26 | {** \file wayland-util.pas 27 | * 28 | * \brief Utility classes, functions, and macros. 29 | *} 30 | unit wayland_util; 31 | 32 | {$mode objfpc}{$H+} 33 | {$packrecords c} 34 | {$linklib wayland-client} 35 | 36 | interface 37 | 38 | uses 39 | Classes, SysUtils, ctypes; 40 | 41 | type 42 | PPwl_interface = ^Pwl_interface; 43 | Pwl_interface = ^Twl_interface; 44 | Pwl_message = ^ Twl_message; 45 | Twl_message = record 46 | name: PChar; 47 | signature: PChar; 48 | types: PPwl_interface; 49 | end; 50 | 51 | 52 | Twl_interface = record 53 | name: PChar; 54 | version: cint; 55 | method_count: cint; 56 | methods: Pwl_message; 57 | event_count: cint; 58 | events: Pwl_message; 59 | end; 60 | 61 | Pwl_list = ^Twl_list; 62 | 63 | { Twl_list } 64 | 65 | Twl_list = object 66 | prev, 67 | next: Pwl_list; 68 | procedure Init; 69 | procedure Insert(element: Pwl_list); 70 | procedure Remove(element: Pwl_list); static; 71 | function Length: cint; 72 | function Empty: Boolean; 73 | procedure InsertList(other: Pwl_list); 74 | end; 75 | 76 | Pwl_argument = ^Twl_argument; 77 | Twl_argument = record 78 | case integer of 79 | 0: (i: cint32); 80 | 1: (u: cuint32); 81 | 2: (f: cint32); 82 | 3: (s: PChar); 83 | 4: (o : Pointer {wl_object}); 84 | 5: (n: cuint32); 85 | 6: (a: Pointer {wl_array}); 86 | 7: (h: cuint32); 87 | end; 88 | 89 | Pwl_array = ^Twl_array; 90 | Twl_array = object 91 | size: csize_t; 92 | alloc: csize_t; 93 | data: Pointer; 94 | function GetAsDWord(var AIndex: Integer; var AValue: DWord; AIncIndex: Boolean): Boolean; 95 | end; 96 | 97 | wl_dispatcher_func_t = function (arg0: Pointer; arg1: Pointer; arg2: cuint32; 98 | {const} message: Pwl_message; 99 | argument: Pwl_argument): cint; cdecl; 100 | 101 | 102 | wl_log_func_t = procedure (char :pchar; va_list: Pointer); cdecl; // not sure how to use va_list, it's a record type afaik. 103 | 104 | Twl_iterator_result = ( 105 | //** Stop the iteration */ 106 | WL_ITERATOR_STOP = 0, 107 | //** Continue the iteration */ 108 | WL_ITERATOR_CONTINUE = 1); 109 | 110 | { Twl_fixed } 111 | 112 | Twl_fixed = object 113 | AsFixed24_8: Longint; 114 | private 115 | function GetAsDouble: Double; 116 | function GetAsInteger: Integer; 117 | procedure SetAsDouble(AValue: Double); 118 | procedure SetAsInteger(AValue: Integer); 119 | public 120 | property AsDouble: Double read GetAsDouble write SetAsDouble; 121 | //property AsFixed24_8: Integer read Value write Value; 122 | property AsInteger: Integer read GetAsInteger write SetAsInteger; 123 | end; 124 | 125 | procedure wl_list_init(list: Pwl_list); cdecl; external; 126 | procedure wl_list_insert(list: Pwl_list; elm: Pwl_list); cdecl; external; 127 | procedure wl_list_remove(element: Pwl_list); cdecl; external; 128 | function wl_list_length(list: Pwl_list): cint; cdecl; external; 129 | function wl_list_empty(list: Pwl_list):cint; cdecl; external; 130 | procedure wl_list_insert_list(list: Pwl_list; other: Pwl_list); cdecl; external; 131 | 132 | procedure wl_array_init(&array: Pwl_array); cdecl; external; 133 | procedure wl_array_release(&array: Pwl_array); cdecl; external; 134 | function wl_array_add(&array: Pwl_array; size: csize_t): Pointer; cdecl; external; 135 | function wl_array_copy(&array: Pwl_array; source: Pwl_array): Integer; cdecl; external; 136 | 137 | 138 | operator:=(AFixed: Twl_fixed)Res: Integer; 139 | // internal functions 140 | 141 | implementation 142 | 143 | operator:=(AFixed: Twl_fixed)Res: Integer; 144 | begin 145 | Res := AFixed.AsFixed24_8; 146 | end; 147 | 148 | 149 | { Twl_array } 150 | 151 | function Twl_array.GetAsDWord(var AIndex: Integer; var AValue: DWord; 152 | AIncIndex: Boolean): Boolean; 153 | var 154 | lCount: csize_t; 155 | begin 156 | Result := False; 157 | lCount := size div sizeof(DWord); 158 | if AIndex>= lCount then 159 | Exit; 160 | Result := True; 161 | AValue := PDword(data)[AIndex]; 162 | 163 | if AIncIndex then 164 | Inc(AIndex); 165 | end; 166 | 167 | { Twl_fixed } 168 | 169 | function Twl_fixed.GetAsDouble: Double; 170 | var 171 | lInt64: Int64 absolute Result; 172 | begin 173 | lInt64:=(Int64(1023 + 44) shl 52) + (Int64(1) shl 51) + AsFixed24_8; 174 | Result:=Result - (Int64(3) shl 43); 175 | end; 176 | 177 | function Twl_fixed.GetAsInteger: Integer; 178 | begin 179 | Result := Trunc(AsDouble); 180 | end; 181 | 182 | procedure Twl_fixed.SetAsDouble(AValue: Double); 183 | var 184 | lDouble: Double; 185 | lInt64: Int64 absolute lDouble; 186 | begin 187 | lDouble := AValue + (Int64(3) shl (51 - 8)); 188 | AsFixed24_8:=lInt64; 189 | end; 190 | 191 | 192 | procedure Twl_fixed.SetAsInteger(AValue: Integer); 193 | begin 194 | AsDouble := AValue; 195 | end; 196 | 197 | 198 | { Twl_list } 199 | 200 | procedure Twl_list.Init; 201 | begin 202 | wl_list_init(@Self); 203 | end; 204 | 205 | procedure Twl_list.Insert(element: Pwl_list); 206 | begin 207 | wl_list_insert(@Self, element); 208 | 209 | end; 210 | 211 | procedure Twl_list.Remove(element: Pwl_list); 212 | begin 213 | wl_list_remove(element); 214 | end; 215 | 216 | function Twl_list.Length: cint; 217 | begin 218 | Result := wl_list_length(@Self); 219 | end; 220 | 221 | function Twl_list.Empty: Boolean; 222 | begin 223 | Result := wl_list_empty(@Self) <> 0; 224 | end; 225 | 226 | procedure Twl_list.InsertList(other: Pwl_list); 227 | begin 228 | wl_list_insert_list(@Self, other); 229 | 230 | end; 231 | 232 | end. 233 | 234 | -------------------------------------------------------------------------------- /waylandpkg/waylandpkg.lpk: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <Package Version="5"> 4 | <Name Value="WaylandPkg"/> 5 | <Type Value="RunAndDesignTime"/> 6 | <CompilerOptions> 7 | <Version Value="11"/> 8 | <SearchPaths> 9 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 10 | </SearchPaths> 11 | </CompilerOptions> 12 | <Files Count="7"> 13 | <Item1> 14 | <Filename Value="wayland_cursor.pas"/> 15 | <UnitName Value="wayland_cursor"/> 16 | </Item1> 17 | <Item2> 18 | <Filename Value="wayland_protocol.pas"/> 19 | <UnitName Value="wayland_protocol"/> 20 | </Item2> 21 | <Item3> 22 | <Filename Value="wayland_shared_buffer.pas"/> 23 | <UnitName Value="wayland_shared_buffer"/> 24 | </Item3> 25 | <Item4> 26 | <Filename Value="wayland_util.pas"/> 27 | <UnitName Value="wayland_util"/> 28 | </Item4> 29 | <Item5> 30 | <Filename Value="wayland_client.pas"/> 31 | <UnitName Value="wayland_client"/> 32 | </Item5> 33 | <Item6> 34 | <Filename Value="wayland_client_core.pas"/> 35 | <UnitName Value="wayland_client_core"/> 36 | </Item6> 37 | <Item7> 38 | <Filename Value="wayland_egl.pas"/> 39 | <UnitName Value="wayland_egl"/> 40 | </Item7> 41 | </Files> 42 | <CompatibilityMode Value="True"/> 43 | <RequiredPkgs Count="1"> 44 | <Item1> 45 | <PackageName Value="FCL"/> 46 | </Item1> 47 | </RequiredPkgs> 48 | <UsageOptions> 49 | <UnitPath Value="$(PkgOutDir)"/> 50 | </UsageOptions> 51 | <PublishOptions> 52 | <Version Value="2"/> 53 | </PublishOptions> 54 | </Package> 55 | </CONFIG> 56 | -------------------------------------------------------------------------------- /waylandpkg/waylandpkg.pas: -------------------------------------------------------------------------------- 1 | { This file was automatically created by Lazarus. Do not edit! 2 | This source is only used to compile and install the package. 3 | } 4 | 5 | unit WaylandPkg; 6 | 7 | {$warn 5023 off : no warning about unused units} 8 | interface 9 | 10 | uses 11 | wayland_cursor, wayland_protocol, wayland_shared_buffer, wayland_util, 12 | wayland_client, wayland_client_core, wayland_egl, LazarusPackageIntf; 13 | 14 | implementation 15 | 16 | procedure Register; 17 | begin 18 | end; 19 | 20 | initialization 21 | RegisterPackage('WaylandPkg', @Register); 22 | end. 23 | -------------------------------------------------------------------------------- /waylandstablepkg/presentation_time_protocol.pas: -------------------------------------------------------------------------------- 1 | unit presentation_time_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pwp_presentation = Pointer; 14 | Pwp_presentation_feedback = Pointer; 15 | const 16 | WP_PRESENTATION_ERROR_INVALID_TIMESTAMP = 0; // invalid value in tv_nsec 17 | WP_PRESENTATION_ERROR_INVALID_FLAG = 1; // invalid flag 18 | 19 | type 20 | Pwp_presentation_listener = ^Twp_presentation_listener; 21 | Twp_presentation_listener = record 22 | clock_id : procedure(data: Pointer; AWpPresentation: Pwp_presentation; AClkId: DWord); cdecl; 23 | end; 24 | 25 | const 26 | WP_PRESENTATION_FEEDBACK_KIND_VSYNC = $1; // presentation was vsync'd 27 | WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK = $2; // hardware provided the presentation timestamp 28 | WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION = $4; // hardware signalled the start of the presentation 29 | WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY = $8; // presentation was done zero-copy 30 | 31 | type 32 | Pwp_presentation_feedback_listener = ^Twp_presentation_feedback_listener; 33 | Twp_presentation_feedback_listener = record 34 | sync_output : procedure(data: Pointer; AWpPresentationFeedback: Pwp_presentation_feedback; AOutput: Pwl_output); cdecl; 35 | presented : procedure(data: Pointer; AWpPresentationFeedback: Pwp_presentation_feedback; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord; ARefresh: DWord; ASeqHi: DWord; ASeqLo: DWord; AFlags: DWord); cdecl; 36 | discarded : procedure(data: Pointer; AWpPresentationFeedback: Pwp_presentation_feedback); cdecl; 37 | end; 38 | 39 | 40 | 41 | TWpPresentation = class; 42 | TWpPresentationFeedback = class; 43 | 44 | 45 | IWpPresentationListener = interface 46 | ['IWpPresentationListener'] 47 | procedure wp_presentation_clock_id(AWpPresentation: TWpPresentation; AClkId: DWord); 48 | end; 49 | 50 | IWpPresentationFeedbackListener = interface 51 | ['IWpPresentationFeedbackListener'] 52 | procedure wp_presentation_feedback_sync_output(AWpPresentationFeedback: TWpPresentationFeedback; AOutput: TWlOutput); 53 | procedure wp_presentation_feedback_presented(AWpPresentationFeedback: TWpPresentationFeedback; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord; ARefresh: DWord; ASeqHi: DWord; ASeqLo: DWord; AFlags: DWord); 54 | procedure wp_presentation_feedback_discarded(AWpPresentationFeedback: TWpPresentationFeedback); 55 | end; 56 | 57 | 58 | 59 | 60 | TWpPresentation = class(TWLProxyObject) 61 | private 62 | const _DESTROY = 0; 63 | const _FEEDBACK = 1; 64 | public 65 | destructor Destroy; override; 66 | function Feedback(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TWpPresentationFeedback}): TWpPresentationFeedback; 67 | function AddListener(AIntf: IWpPresentationListener): LongInt; 68 | end; 69 | 70 | TWpPresentationFeedback = class(TWLProxyObject) 71 | function AddListener(AIntf: IWpPresentationFeedbackListener): LongInt; 72 | end; 73 | 74 | 75 | 76 | 77 | 78 | 79 | var 80 | wp_presentation_interface: Twl_interface; 81 | wp_presentation_feedback_interface: Twl_interface; 82 | 83 | 84 | 85 | implementation 86 | 87 | var 88 | vIntf_wp_presentation_Listener: Twp_presentation_listener; 89 | vIntf_wp_presentation_feedback_Listener: Twp_presentation_feedback_listener; 90 | 91 | 92 | 93 | destructor TWpPresentation.Destroy; 94 | begin 95 | wl_proxy_marshal(FProxy, _DESTROY); 96 | inherited Destroy; 97 | end; 98 | 99 | function TWpPresentation.Feedback(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TWpPresentationFeedback}): TWpPresentationFeedback; 100 | var 101 | callback: Pwl_proxy; 102 | begin 103 | callback := wl_proxy_marshal_constructor(FProxy, 104 | _FEEDBACK, @wp_presentation_feedback_interface, nil, ASurface.Proxy); 105 | if AProxyClass = nil then 106 | AProxyClass := TWpPresentationFeedback; 107 | if not AProxyClass.InheritsFrom(TWpPresentationFeedback) then 108 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TWpPresentationFeedback]); 109 | Result := TWpPresentationFeedback(AProxyClass.Create(callback)); 110 | end; 111 | 112 | function TWpPresentation.AddListener(AIntf: IWpPresentationListener): LongInt; 113 | begin 114 | FUserDataRec.ListenerUserData := Pointer(AIntf); 115 | Result := wl_proxy_add_listener(FProxy, @vIntf_wp_presentation_Listener, @FUserDataRec); 116 | end; 117 | function TWpPresentationFeedback.AddListener(AIntf: IWpPresentationFeedbackListener): LongInt; 118 | begin 119 | FUserDataRec.ListenerUserData := Pointer(AIntf); 120 | Result := wl_proxy_add_listener(FProxy, @vIntf_wp_presentation_feedback_Listener, @FUserDataRec); 121 | end; 122 | 123 | 124 | 125 | 126 | procedure wp_presentation_clock_id_Intf(AData: PWLUserData; Awp_presentation: Pwp_presentation; AClkId: DWord); cdecl; 127 | var 128 | AIntf: IWpPresentationListener; 129 | begin 130 | if AData = nil then Exit; 131 | AIntf := IWpPresentationListener(AData^.ListenerUserData); 132 | AIntf.wp_presentation_clock_id(TWpPresentation(AData^.PascalObject), AClkId); 133 | end; 134 | 135 | procedure wp_presentation_feedback_sync_output_Intf(AData: PWLUserData; Awp_presentation_feedback: Pwp_presentation_feedback; AOutput: Pwl_output); cdecl; 136 | var 137 | AIntf: IWpPresentationFeedbackListener; 138 | begin 139 | if AData = nil then Exit; 140 | AIntf := IWpPresentationFeedbackListener(AData^.ListenerUserData); 141 | AIntf.wp_presentation_feedback_sync_output(TWpPresentationFeedback(AData^.PascalObject), TWlOutput(TWLProxyObject.WLToObj(AOutput))); 142 | end; 143 | 144 | procedure wp_presentation_feedback_presented_Intf(AData: PWLUserData; Awp_presentation_feedback: Pwp_presentation_feedback; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord; ARefresh: DWord; ASeqHi: DWord; ASeqLo: DWord; AFlags: DWord); cdecl; 145 | var 146 | AIntf: IWpPresentationFeedbackListener; 147 | begin 148 | if AData = nil then Exit; 149 | AIntf := IWpPresentationFeedbackListener(AData^.ListenerUserData); 150 | AIntf.wp_presentation_feedback_presented(TWpPresentationFeedback(AData^.PascalObject), ATvSecHi, ATvSecLo, ATvNsec, ARefresh, ASeqHi, ASeqLo, AFlags); 151 | end; 152 | 153 | procedure wp_presentation_feedback_discarded_Intf(AData: PWLUserData; Awp_presentation_feedback: Pwp_presentation_feedback); cdecl; 154 | var 155 | AIntf: IWpPresentationFeedbackListener; 156 | begin 157 | if AData = nil then Exit; 158 | AIntf := IWpPresentationFeedbackListener(AData^.ListenerUserData); 159 | AIntf.wp_presentation_feedback_discarded(TWpPresentationFeedback(AData^.PascalObject)); 160 | end; 161 | 162 | 163 | 164 | const 165 | pInterfaces: array[0..10] of Pwl_interface = ( 166 | (nil), 167 | (nil), 168 | (nil), 169 | (nil), 170 | (nil), 171 | (nil), 172 | (nil), 173 | (nil), 174 | (@wl_surface_interface), 175 | (@wp_presentation_feedback_interface), 176 | (@wl_output_interface) 177 | ); 178 | 179 | wp_presentation_requests: array[0..1] of Twl_message = ( 180 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 181 | (name: 'feedback'; signature: 'on'; types: @pInterfaces[8]) 182 | ); 183 | wp_presentation_events: array[0..0] of Twl_message = ( 184 | (name: 'clock_id'; signature: 'u'; types: @pInterfaces[0]) 185 | ); 186 | wp_presentation_feedback_events: array[0..2] of Twl_message = ( 187 | (name: 'sync_output'; signature: 'o'; types: @pInterfaces[10]), 188 | (name: 'presented'; signature: 'uuuuuuu'; types: @pInterfaces[0]), 189 | (name: 'discarded'; signature: ''; types: @pInterfaces[0]) 190 | ); 191 | 192 | initialization 193 | Pointer(vIntf_wp_presentation_Listener.clock_id) := @wp_presentation_clock_id_Intf; 194 | Pointer(vIntf_wp_presentation_feedback_Listener.sync_output) := @wp_presentation_feedback_sync_output_Intf; 195 | Pointer(vIntf_wp_presentation_feedback_Listener.presented) := @wp_presentation_feedback_presented_Intf; 196 | Pointer(vIntf_wp_presentation_feedback_Listener.discarded) := @wp_presentation_feedback_discarded_Intf; 197 | 198 | 199 | wp_presentation_interface.name := 'wp_presentation'; 200 | wp_presentation_interface.version := 1; 201 | wp_presentation_interface.method_count := 2; 202 | wp_presentation_interface.methods := @wp_presentation_requests; 203 | wp_presentation_interface.event_count := 1; 204 | wp_presentation_interface.events := @wp_presentation_events; 205 | 206 | wp_presentation_feedback_interface.name := 'wp_presentation_feedback'; 207 | wp_presentation_feedback_interface.version := 1; 208 | wp_presentation_feedback_interface.method_count := 0; 209 | wp_presentation_feedback_interface.methods := nil; 210 | wp_presentation_feedback_interface.event_count := 3; 211 | wp_presentation_feedback_interface.events := @wp_presentation_feedback_events; 212 | 213 | end. 214 | -------------------------------------------------------------------------------- /waylandstablepkg/viewporter_protocol.pas: -------------------------------------------------------------------------------- 1 | unit viewporter_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pwp_viewporter = Pointer; 14 | Pwp_viewport = Pointer; 15 | const 16 | WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0; // the surface already has a viewport object associated 17 | 18 | type 19 | Pwp_viewporter_listener = ^Twp_viewporter_listener; 20 | Twp_viewporter_listener = record 21 | end; 22 | 23 | const 24 | WP_VIEWPORT_ERROR_BAD_VALUE = 0; // negative or zero values in width or height 25 | WP_VIEWPORT_ERROR_BAD_SIZE = 1; // destination size is not integer 26 | WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2; // source rectangle extends outside of the content area 27 | WP_VIEWPORT_ERROR_NO_SURFACE = 3; // the wl_surface was destroyed 28 | 29 | type 30 | Pwp_viewport_listener = ^Twp_viewport_listener; 31 | Twp_viewport_listener = record 32 | end; 33 | 34 | 35 | 36 | TWpViewporter = class; 37 | TWpViewport = class; 38 | 39 | 40 | IWpViewporterListener = interface 41 | ['IWpViewporterListener'] 42 | end; 43 | 44 | IWpViewportListener = interface 45 | ['IWpViewportListener'] 46 | end; 47 | 48 | 49 | 50 | 51 | TWpViewporter = class(TWLProxyObject) 52 | private 53 | const _DESTROY = 0; 54 | const _GET_VIEWPORT = 1; 55 | public 56 | destructor Destroy; override; 57 | function GetViewport(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TWpViewport}): TWpViewport; 58 | function AddListener(AIntf: IWpViewporterListener): LongInt; 59 | end; 60 | 61 | TWpViewport = class(TWLProxyObject) 62 | private 63 | const _DESTROY = 0; 64 | const _SET_SOURCE = 1; 65 | const _SET_DESTINATION = 2; 66 | public 67 | destructor Destroy; override; 68 | procedure SetSource(AX: Twl_fixed; AY: Twl_fixed; AWidth: Twl_fixed; AHeight: Twl_fixed); 69 | procedure SetDestination(AWidth: LongInt; AHeight: LongInt); 70 | function AddListener(AIntf: IWpViewportListener): LongInt; 71 | end; 72 | 73 | 74 | 75 | 76 | 77 | 78 | var 79 | wp_viewporter_interface: Twl_interface; 80 | wp_viewport_interface: Twl_interface; 81 | 82 | 83 | 84 | implementation 85 | 86 | var 87 | vIntf_wp_viewporter_Listener: Twp_viewporter_listener; 88 | vIntf_wp_viewport_Listener: Twp_viewport_listener; 89 | 90 | 91 | 92 | destructor TWpViewporter.Destroy; 93 | begin 94 | wl_proxy_marshal(FProxy, _DESTROY); 95 | inherited Destroy; 96 | end; 97 | 98 | function TWpViewporter.GetViewport(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TWpViewport}): TWpViewport; 99 | var 100 | id: Pwl_proxy; 101 | begin 102 | id := wl_proxy_marshal_constructor(FProxy, 103 | _GET_VIEWPORT, @wp_viewport_interface, nil, ASurface.Proxy); 104 | if AProxyClass = nil then 105 | AProxyClass := TWpViewport; 106 | if not AProxyClass.InheritsFrom(TWpViewport) then 107 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TWpViewport]); 108 | Result := TWpViewport(AProxyClass.Create(id)); 109 | end; 110 | 111 | function TWpViewporter.AddListener(AIntf: IWpViewporterListener): LongInt; 112 | begin 113 | FUserDataRec.ListenerUserData := Pointer(AIntf); 114 | Result := wl_proxy_add_listener(FProxy, @vIntf_wp_viewporter_Listener, @FUserDataRec); 115 | end; 116 | destructor TWpViewport.Destroy; 117 | begin 118 | wl_proxy_marshal(FProxy, _DESTROY); 119 | inherited Destroy; 120 | end; 121 | 122 | procedure TWpViewport.SetSource(AX: Twl_fixed; AY: Twl_fixed; AWidth: Twl_fixed; AHeight: Twl_fixed); 123 | begin 124 | wl_proxy_marshal(FProxy, _SET_SOURCE, AX.AsFixed24_8, AY.AsFixed24_8, AWidth.AsFixed24_8, AHeight.AsFixed24_8); 125 | end; 126 | 127 | procedure TWpViewport.SetDestination(AWidth: LongInt; AHeight: LongInt); 128 | begin 129 | wl_proxy_marshal(FProxy, _SET_DESTINATION, AWidth, AHeight); 130 | end; 131 | 132 | function TWpViewport.AddListener(AIntf: IWpViewportListener): LongInt; 133 | begin 134 | FUserDataRec.ListenerUserData := Pointer(AIntf); 135 | Result := wl_proxy_add_listener(FProxy, @vIntf_wp_viewport_Listener, @FUserDataRec); 136 | end; 137 | 138 | 139 | 140 | 141 | 142 | 143 | const 144 | pInterfaces: array[0..9] of Pwl_interface = ( 145 | (nil), 146 | (nil), 147 | (nil), 148 | (nil), 149 | (nil), 150 | (nil), 151 | (nil), 152 | (nil), 153 | (@wp_viewport_interface), 154 | (@wl_surface_interface) 155 | ); 156 | 157 | wp_viewporter_requests: array[0..1] of Twl_message = ( 158 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 159 | (name: 'get_viewport'; signature: 'no'; types: @pInterfaces[8]) 160 | ); 161 | wp_viewport_requests: array[0..2] of Twl_message = ( 162 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 163 | (name: 'set_source'; signature: 'ffff'; types: @pInterfaces[0]), 164 | (name: 'set_destination'; signature: 'ii'; types: @pInterfaces[0]) 165 | ); 166 | 167 | initialization 168 | 169 | 170 | wp_viewporter_interface.name := 'wp_viewporter'; 171 | wp_viewporter_interface.version := 1; 172 | wp_viewporter_interface.method_count := 2; 173 | wp_viewporter_interface.methods := @wp_viewporter_requests; 174 | wp_viewporter_interface.event_count := 0; 175 | wp_viewporter_interface.events := nil; 176 | 177 | wp_viewport_interface.name := 'wp_viewport'; 178 | wp_viewport_interface.version := 1; 179 | wp_viewport_interface.method_count := 3; 180 | wp_viewport_interface.methods := @wp_viewport_requests; 181 | wp_viewport_interface.event_count := 0; 182 | wp_viewport_interface.events := nil; 183 | 184 | end. 185 | -------------------------------------------------------------------------------- /waylandstablepkg/waylandstablepkg.lpk: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <Package Version="4"> 4 | <Name Value="WaylandStablePkg"/> 5 | <Type Value="RunAndDesignTime"/> 6 | <CompilerOptions> 7 | <Version Value="11"/> 8 | <SearchPaths> 9 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/> 10 | </SearchPaths> 11 | </CompilerOptions> 12 | <Files Count="3"> 13 | <Item1> 14 | <Filename Value="presentation_time_protocol.pas"/> 15 | <UnitName Value="presentation_time_protocol"/> 16 | </Item1> 17 | <Item2> 18 | <Filename Value="viewporter_protocol.pas"/> 19 | <UnitName Value="viewporter_protocol"/> 20 | </Item2> 21 | <Item3> 22 | <Filename Value="xdg_shell_protocol.pas"/> 23 | <UnitName Value="xdg_shell_protocol"/> 24 | </Item3> 25 | </Files> 26 | <RequiredPkgs Count="2"> 27 | <Item1> 28 | <PackageName Value="WaylandPkg"/> 29 | </Item1> 30 | <Item2> 31 | <PackageName Value="FCL"/> 32 | </Item2> 33 | </RequiredPkgs> 34 | <UsageOptions> 35 | <UnitPath Value="$(PkgOutDir)"/> 36 | </UsageOptions> 37 | <PublishOptions> 38 | <Version Value="2"/> 39 | </PublishOptions> 40 | </Package> 41 | </CONFIG> 42 | -------------------------------------------------------------------------------- /waylandstablepkg/waylandstablepkg.pas: -------------------------------------------------------------------------------- 1 | { This file was automatically created by Lazarus. Do not edit! 2 | This source is only used to compile and install the package. 3 | } 4 | 5 | unit WaylandStablePkg; 6 | 7 | {$warn 5023 off : no warning about unused units} 8 | interface 9 | 10 | uses 11 | presentation_time_protocol, viewporter_protocol, xdg_shell_protocol, 12 | LazarusPackageIntf; 13 | 14 | implementation 15 | 16 | procedure Register; 17 | begin 18 | end; 19 | 20 | initialization 21 | RegisterPackage('WaylandStablePkg', @Register); 22 | end. 23 | -------------------------------------------------------------------------------- /waylandunstablepkg/fullscreen_shell_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit fullscreen_shell_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_fullscreen_shell_v1 = Pointer; 14 | Pzwp_fullscreen_shell_mode_feedback_v1 = Pointer; 15 | const 16 | ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_ARBITRARY_MODES = 1; // compositor is capable of almost any output mode 17 | ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_CURSOR_PLANE = 2; // compositor has a separate cursor plane 18 | ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT = 0; // no preference, apply default policy 19 | ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER = 1; // center the surface on the output 20 | ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM = 2; // scale the surface, preserving aspect ratio, to the largest size that will fit on the output 21 | ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM_CROP = 3; // scale the surface, preserving aspect ratio, to fully fill the output cropping if needed 22 | ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_STRETCH = 4; // scale the surface to the size of the output ignoring aspect ratio 23 | ZWP_FULLSCREEN_SHELL_V1_ERROR_INVALID_METHOD = 0; // present_method is not known 24 | ZWP_FULLSCREEN_SHELL_V1_ERROR_ROLE = 1; // given wl_surface has another role 25 | 26 | type 27 | Pzwp_fullscreen_shell_v1_listener = ^Tzwp_fullscreen_shell_v1_listener; 28 | Tzwp_fullscreen_shell_v1_listener = record 29 | capability : procedure(data: Pointer; AZwpFullscreenShellV1: Pzwp_fullscreen_shell_v1; ACapability: DWord); cdecl; 30 | end; 31 | 32 | Pzwp_fullscreen_shell_mode_feedback_v1_listener = ^Tzwp_fullscreen_shell_mode_feedback_v1_listener; 33 | Tzwp_fullscreen_shell_mode_feedback_v1_listener = record 34 | mode_successful : procedure(data: Pointer; AZwpFullscreenShellModeFeedbackV1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 35 | mode_failed : procedure(data: Pointer; AZwpFullscreenShellModeFeedbackV1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 36 | present_cancelled : procedure(data: Pointer; AZwpFullscreenShellModeFeedbackV1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 37 | end; 38 | 39 | 40 | 41 | TZwpFullscreenShellV1 = class; 42 | TZwpFullscreenShellModeFeedbackV1 = class; 43 | 44 | 45 | IZwpFullscreenShellV1Listener = interface 46 | ['IZwpFullscreenShellV1Listener'] 47 | procedure zwp_fullscreen_shell_v1_capability(AZwpFullscreenShellV1: TZwpFullscreenShellV1; ACapability: DWord); 48 | end; 49 | 50 | IZwpFullscreenShellModeFeedbackV1Listener = interface 51 | ['IZwpFullscreenShellModeFeedbackV1Listener'] 52 | procedure zwp_fullscreen_shell_mode_feedback_v1_mode_successful(AZwpFullscreenShellModeFeedbackV1: TZwpFullscreenShellModeFeedbackV1); 53 | procedure zwp_fullscreen_shell_mode_feedback_v1_mode_failed(AZwpFullscreenShellModeFeedbackV1: TZwpFullscreenShellModeFeedbackV1); 54 | procedure zwp_fullscreen_shell_mode_feedback_v1_present_cancelled(AZwpFullscreenShellModeFeedbackV1: TZwpFullscreenShellModeFeedbackV1); 55 | end; 56 | 57 | 58 | 59 | 60 | TZwpFullscreenShellV1 = class(TWLProxyObject) 61 | private 62 | const _RELEASE = 0; 63 | const _PRESENT_SURFACE = 1; 64 | const _PRESENT_SURFACE_FOR_MODE = 2; 65 | public 66 | destructor Destroy; override; 67 | procedure PresentSurface(ASurface: TWlSurface; AMethod: DWord; AOutput: TWlOutput); 68 | function PresentSurfaceForMode(ASurface: TWlSurface; AOutput: TWlOutput; AFramerate: LongInt; AProxyClass: TWLProxyObjectClass = nil {TZwpFullscreenShellModeFeedbackV1}): TZwpFullscreenShellModeFeedbackV1; 69 | function AddListener(AIntf: IZwpFullscreenShellV1Listener): LongInt; 70 | end; 71 | 72 | TZwpFullscreenShellModeFeedbackV1 = class(TWLProxyObject) 73 | function AddListener(AIntf: IZwpFullscreenShellModeFeedbackV1Listener): LongInt; 74 | end; 75 | 76 | 77 | 78 | 79 | 80 | 81 | var 82 | zwp_fullscreen_shell_v1_interface: Twl_interface; 83 | zwp_fullscreen_shell_mode_feedback_v1_interface: Twl_interface; 84 | 85 | 86 | 87 | implementation 88 | 89 | var 90 | vIntf_zwp_fullscreen_shell_v1_Listener: Tzwp_fullscreen_shell_v1_listener; 91 | vIntf_zwp_fullscreen_shell_mode_feedback_v1_Listener: Tzwp_fullscreen_shell_mode_feedback_v1_listener; 92 | 93 | 94 | 95 | destructor TZwpFullscreenShellV1.Destroy; 96 | begin 97 | wl_proxy_marshal(FProxy, _RELEASE); 98 | inherited Destroy; 99 | end; 100 | 101 | procedure TZwpFullscreenShellV1.PresentSurface(ASurface: TWlSurface; AMethod: DWord; AOutput: TWlOutput); 102 | begin 103 | wl_proxy_marshal(FProxy, _PRESENT_SURFACE, ASurface.Proxy, AMethod, AOutput.Proxy); 104 | end; 105 | 106 | function TZwpFullscreenShellV1.PresentSurfaceForMode(ASurface: TWlSurface; AOutput: TWlOutput; AFramerate: LongInt; AProxyClass: TWLProxyObjectClass = nil {TZwpFullscreenShellModeFeedbackV1}): TZwpFullscreenShellModeFeedbackV1; 107 | var 108 | feedback: Pwl_proxy; 109 | begin 110 | feedback := wl_proxy_marshal_constructor(FProxy, 111 | _PRESENT_SURFACE_FOR_MODE, @zwp_fullscreen_shell_mode_feedback_v1_interface, nil, ASurface.Proxy, AOutput.Proxy, AFramerate); 112 | if AProxyClass = nil then 113 | AProxyClass := TZwpFullscreenShellModeFeedbackV1; 114 | if not AProxyClass.InheritsFrom(TZwpFullscreenShellModeFeedbackV1) then 115 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpFullscreenShellModeFeedbackV1]); 116 | Result := TZwpFullscreenShellModeFeedbackV1(AProxyClass.Create(feedback)); 117 | end; 118 | 119 | function TZwpFullscreenShellV1.AddListener(AIntf: IZwpFullscreenShellV1Listener): LongInt; 120 | begin 121 | FUserDataRec.ListenerUserData := Pointer(AIntf); 122 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_fullscreen_shell_v1_Listener, @FUserDataRec); 123 | end; 124 | function TZwpFullscreenShellModeFeedbackV1.AddListener(AIntf: IZwpFullscreenShellModeFeedbackV1Listener): LongInt; 125 | begin 126 | FUserDataRec.ListenerUserData := Pointer(AIntf); 127 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_fullscreen_shell_mode_feedback_v1_Listener, @FUserDataRec); 128 | end; 129 | 130 | 131 | 132 | 133 | procedure zwp_fullscreen_shell_v1_capability_Intf(AData: PWLUserData; Azwp_fullscreen_shell_v1: Pzwp_fullscreen_shell_v1; ACapability: DWord); cdecl; 134 | var 135 | AIntf: IZwpFullscreenShellV1Listener; 136 | begin 137 | if AData = nil then Exit; 138 | AIntf := IZwpFullscreenShellV1Listener(AData^.ListenerUserData); 139 | AIntf.zwp_fullscreen_shell_v1_capability(TZwpFullscreenShellV1(AData^.PascalObject), ACapability); 140 | end; 141 | 142 | procedure zwp_fullscreen_shell_mode_feedback_v1_mode_successful_Intf(AData: PWLUserData; Azwp_fullscreen_shell_mode_feedback_v1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 143 | var 144 | AIntf: IZwpFullscreenShellModeFeedbackV1Listener; 145 | begin 146 | if AData = nil then Exit; 147 | AIntf := IZwpFullscreenShellModeFeedbackV1Listener(AData^.ListenerUserData); 148 | AIntf.zwp_fullscreen_shell_mode_feedback_v1_mode_successful(TZwpFullscreenShellModeFeedbackV1(AData^.PascalObject)); 149 | end; 150 | 151 | procedure zwp_fullscreen_shell_mode_feedback_v1_mode_failed_Intf(AData: PWLUserData; Azwp_fullscreen_shell_mode_feedback_v1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 152 | var 153 | AIntf: IZwpFullscreenShellModeFeedbackV1Listener; 154 | begin 155 | if AData = nil then Exit; 156 | AIntf := IZwpFullscreenShellModeFeedbackV1Listener(AData^.ListenerUserData); 157 | AIntf.zwp_fullscreen_shell_mode_feedback_v1_mode_failed(TZwpFullscreenShellModeFeedbackV1(AData^.PascalObject)); 158 | end; 159 | 160 | procedure zwp_fullscreen_shell_mode_feedback_v1_present_cancelled_Intf(AData: PWLUserData; Azwp_fullscreen_shell_mode_feedback_v1: Pzwp_fullscreen_shell_mode_feedback_v1); cdecl; 161 | var 162 | AIntf: IZwpFullscreenShellModeFeedbackV1Listener; 163 | begin 164 | if AData = nil then Exit; 165 | AIntf := IZwpFullscreenShellModeFeedbackV1Listener(AData^.ListenerUserData); 166 | AIntf.zwp_fullscreen_shell_mode_feedback_v1_present_cancelled(TZwpFullscreenShellModeFeedbackV1(AData^.PascalObject)); 167 | end; 168 | 169 | 170 | 171 | const 172 | pInterfaces: array[0..14] of Pwl_interface = ( 173 | (nil), 174 | (nil), 175 | (nil), 176 | (nil), 177 | (nil), 178 | (nil), 179 | (nil), 180 | (nil), 181 | (@wl_surface_interface), 182 | (nil), 183 | (@wl_output_interface), 184 | (@wl_surface_interface), 185 | (@wl_output_interface), 186 | (nil), 187 | (@zwp_fullscreen_shell_mode_feedback_v1_interface) 188 | ); 189 | 190 | zwp_fullscreen_shell_v1_requests: array[0..2] of Twl_message = ( 191 | (name: 'release'; signature: ''; types: @pInterfaces[0]), 192 | (name: 'present_surface'; signature: '?ou?o'; types: @pInterfaces[8]), 193 | (name: 'present_surface_for_mode'; signature: 'ooin'; types: @pInterfaces[11]) 194 | ); 195 | zwp_fullscreen_shell_v1_events: array[0..0] of Twl_message = ( 196 | (name: 'capability'; signature: 'u'; types: @pInterfaces[0]) 197 | ); 198 | zwp_fullscreen_shell_mode_feedback_v1_events: array[0..2] of Twl_message = ( 199 | (name: 'mode_successful'; signature: ''; types: @pInterfaces[0]), 200 | (name: 'mode_failed'; signature: ''; types: @pInterfaces[0]), 201 | (name: 'present_cancelled'; signature: ''; types: @pInterfaces[0]) 202 | ); 203 | 204 | initialization 205 | Pointer(vIntf_zwp_fullscreen_shell_v1_Listener.capability) := @zwp_fullscreen_shell_v1_capability_Intf; 206 | Pointer(vIntf_zwp_fullscreen_shell_mode_feedback_v1_Listener.mode_successful) := @zwp_fullscreen_shell_mode_feedback_v1_mode_successful_Intf; 207 | Pointer(vIntf_zwp_fullscreen_shell_mode_feedback_v1_Listener.mode_failed) := @zwp_fullscreen_shell_mode_feedback_v1_mode_failed_Intf; 208 | Pointer(vIntf_zwp_fullscreen_shell_mode_feedback_v1_Listener.present_cancelled) := @zwp_fullscreen_shell_mode_feedback_v1_present_cancelled_Intf; 209 | 210 | 211 | zwp_fullscreen_shell_v1_interface.name := 'zwp_fullscreen_shell_v1'; 212 | zwp_fullscreen_shell_v1_interface.version := 1; 213 | zwp_fullscreen_shell_v1_interface.method_count := 3; 214 | zwp_fullscreen_shell_v1_interface.methods := @zwp_fullscreen_shell_v1_requests; 215 | zwp_fullscreen_shell_v1_interface.event_count := 1; 216 | zwp_fullscreen_shell_v1_interface.events := @zwp_fullscreen_shell_v1_events; 217 | 218 | zwp_fullscreen_shell_mode_feedback_v1_interface.name := 'zwp_fullscreen_shell_mode_feedback_v1'; 219 | zwp_fullscreen_shell_mode_feedback_v1_interface.version := 1; 220 | zwp_fullscreen_shell_mode_feedback_v1_interface.method_count := 0; 221 | zwp_fullscreen_shell_mode_feedback_v1_interface.methods := nil; 222 | zwp_fullscreen_shell_mode_feedback_v1_interface.event_count := 3; 223 | zwp_fullscreen_shell_mode_feedback_v1_interface.events := @zwp_fullscreen_shell_mode_feedback_v1_events; 224 | 225 | end. 226 | -------------------------------------------------------------------------------- /waylandunstablepkg/idle_inhibit_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit idle_inhibit_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_idle_inhibit_manager_v1 = Pointer; 14 | Pzwp_idle_inhibitor_v1 = Pointer; 15 | Pzwp_idle_inhibit_manager_v1_listener = ^Tzwp_idle_inhibit_manager_v1_listener; 16 | Tzwp_idle_inhibit_manager_v1_listener = record 17 | end; 18 | 19 | Pzwp_idle_inhibitor_v1_listener = ^Tzwp_idle_inhibitor_v1_listener; 20 | Tzwp_idle_inhibitor_v1_listener = record 21 | end; 22 | 23 | 24 | 25 | TZwpIdleInhibitManagerV1 = class; 26 | TZwpIdleInhibitorV1 = class; 27 | 28 | 29 | IZwpIdleInhibitManagerV1Listener = interface 30 | ['IZwpIdleInhibitManagerV1Listener'] 31 | end; 32 | 33 | IZwpIdleInhibitorV1Listener = interface 34 | ['IZwpIdleInhibitorV1Listener'] 35 | end; 36 | 37 | 38 | 39 | 40 | TZwpIdleInhibitManagerV1 = class(TWLProxyObject) 41 | private 42 | const _DESTROY = 0; 43 | const _CREATE_INHIBITOR = 1; 44 | public 45 | destructor Destroy; override; 46 | function CreateInhibitor(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZwpIdleInhibitorV1}): TZwpIdleInhibitorV1; 47 | function AddListener(AIntf: IZwpIdleInhibitManagerV1Listener): LongInt; 48 | end; 49 | 50 | TZwpIdleInhibitorV1 = class(TWLProxyObject) 51 | private 52 | const _DESTROY = 0; 53 | public 54 | destructor Destroy; override; 55 | function AddListener(AIntf: IZwpIdleInhibitorV1Listener): LongInt; 56 | end; 57 | 58 | 59 | 60 | 61 | 62 | 63 | var 64 | zwp_idle_inhibit_manager_v1_interface: Twl_interface; 65 | zwp_idle_inhibitor_v1_interface: Twl_interface; 66 | 67 | 68 | 69 | implementation 70 | 71 | var 72 | vIntf_zwp_idle_inhibit_manager_v1_Listener: Tzwp_idle_inhibit_manager_v1_listener; 73 | vIntf_zwp_idle_inhibitor_v1_Listener: Tzwp_idle_inhibitor_v1_listener; 74 | 75 | 76 | 77 | destructor TZwpIdleInhibitManagerV1.Destroy; 78 | begin 79 | wl_proxy_marshal(FProxy, _DESTROY); 80 | inherited Destroy; 81 | end; 82 | 83 | function TZwpIdleInhibitManagerV1.CreateInhibitor(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZwpIdleInhibitorV1}): TZwpIdleInhibitorV1; 84 | var 85 | id: Pwl_proxy; 86 | begin 87 | id := wl_proxy_marshal_constructor(FProxy, 88 | _CREATE_INHIBITOR, @zwp_idle_inhibitor_v1_interface, nil, ASurface.Proxy); 89 | if AProxyClass = nil then 90 | AProxyClass := TZwpIdleInhibitorV1; 91 | if not AProxyClass.InheritsFrom(TZwpIdleInhibitorV1) then 92 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpIdleInhibitorV1]); 93 | Result := TZwpIdleInhibitorV1(AProxyClass.Create(id)); 94 | end; 95 | 96 | function TZwpIdleInhibitManagerV1.AddListener(AIntf: IZwpIdleInhibitManagerV1Listener): LongInt; 97 | begin 98 | FUserDataRec.ListenerUserData := Pointer(AIntf); 99 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_idle_inhibit_manager_v1_Listener, @FUserDataRec); 100 | end; 101 | destructor TZwpIdleInhibitorV1.Destroy; 102 | begin 103 | wl_proxy_marshal(FProxy, _DESTROY); 104 | inherited Destroy; 105 | end; 106 | 107 | function TZwpIdleInhibitorV1.AddListener(AIntf: IZwpIdleInhibitorV1Listener): LongInt; 108 | begin 109 | FUserDataRec.ListenerUserData := Pointer(AIntf); 110 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_idle_inhibitor_v1_Listener, @FUserDataRec); 111 | end; 112 | 113 | 114 | 115 | 116 | 117 | 118 | const 119 | pInterfaces: array[0..9] of Pwl_interface = ( 120 | (nil), 121 | (nil), 122 | (nil), 123 | (nil), 124 | (nil), 125 | (nil), 126 | (nil), 127 | (nil), 128 | (@zwp_idle_inhibitor_v1_interface), 129 | (@wl_surface_interface) 130 | ); 131 | 132 | zwp_idle_inhibit_manager_v1_requests: array[0..1] of Twl_message = ( 133 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 134 | (name: 'create_inhibitor'; signature: 'no'; types: @pInterfaces[8]) 135 | ); 136 | zwp_idle_inhibitor_v1_requests: array[0..0] of Twl_message = ( 137 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 138 | ); 139 | 140 | initialization 141 | 142 | 143 | zwp_idle_inhibit_manager_v1_interface.name := 'zwp_idle_inhibit_manager_v1'; 144 | zwp_idle_inhibit_manager_v1_interface.version := 1; 145 | zwp_idle_inhibit_manager_v1_interface.method_count := 2; 146 | zwp_idle_inhibit_manager_v1_interface.methods := @zwp_idle_inhibit_manager_v1_requests; 147 | zwp_idle_inhibit_manager_v1_interface.event_count := 0; 148 | zwp_idle_inhibit_manager_v1_interface.events := nil; 149 | 150 | zwp_idle_inhibitor_v1_interface.name := 'zwp_idle_inhibitor_v1'; 151 | zwp_idle_inhibitor_v1_interface.version := 1; 152 | zwp_idle_inhibitor_v1_interface.method_count := 1; 153 | zwp_idle_inhibitor_v1_interface.methods := @zwp_idle_inhibitor_v1_requests; 154 | zwp_idle_inhibitor_v1_interface.event_count := 0; 155 | zwp_idle_inhibitor_v1_interface.events := nil; 156 | 157 | end. 158 | -------------------------------------------------------------------------------- /waylandunstablepkg/input_timestamps_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit input_timestamps_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_input_timestamps_manager_v1 = Pointer; 14 | Pzwp_input_timestamps_v1 = Pointer; 15 | Pzwp_input_timestamps_manager_v1_listener = ^Tzwp_input_timestamps_manager_v1_listener; 16 | Tzwp_input_timestamps_manager_v1_listener = record 17 | end; 18 | 19 | Pzwp_input_timestamps_v1_listener = ^Tzwp_input_timestamps_v1_listener; 20 | Tzwp_input_timestamps_v1_listener = record 21 | timestamp : procedure(data: Pointer; AZwpInputTimestampsV1: Pzwp_input_timestamps_v1; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord); cdecl; 22 | end; 23 | 24 | 25 | 26 | TZwpInputTimestampsManagerV1 = class; 27 | TZwpInputTimestampsV1 = class; 28 | 29 | 30 | IZwpInputTimestampsManagerV1Listener = interface 31 | ['IZwpInputTimestampsManagerV1Listener'] 32 | end; 33 | 34 | IZwpInputTimestampsV1Listener = interface 35 | ['IZwpInputTimestampsV1Listener'] 36 | procedure zwp_input_timestamps_v1_timestamp(AZwpInputTimestampsV1: TZwpInputTimestampsV1; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord); 37 | end; 38 | 39 | 40 | 41 | 42 | TZwpInputTimestampsManagerV1 = class(TWLProxyObject) 43 | private 44 | const _DESTROY = 0; 45 | const _GET_KEYBOARD_TIMESTAMPS = 1; 46 | const _GET_POINTER_TIMESTAMPS = 2; 47 | const _GET_TOUCH_TIMESTAMPS = 3; 48 | public 49 | destructor Destroy; override; 50 | function GetKeyboardTimestamps(AKeyboard: TWlKeyboard; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 51 | function GetPointerTimestamps(APointer: TWlPointer; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 52 | function GetTouchTimestamps(ATouch: TWlTouch; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 53 | function AddListener(AIntf: IZwpInputTimestampsManagerV1Listener): LongInt; 54 | end; 55 | 56 | TZwpInputTimestampsV1 = class(TWLProxyObject) 57 | private 58 | const _DESTROY = 0; 59 | public 60 | destructor Destroy; override; 61 | function AddListener(AIntf: IZwpInputTimestampsV1Listener): LongInt; 62 | end; 63 | 64 | 65 | 66 | 67 | 68 | 69 | var 70 | zwp_input_timestamps_manager_v1_interface: Twl_interface; 71 | zwp_input_timestamps_v1_interface: Twl_interface; 72 | 73 | 74 | 75 | implementation 76 | 77 | var 78 | vIntf_zwp_input_timestamps_manager_v1_Listener: Tzwp_input_timestamps_manager_v1_listener; 79 | vIntf_zwp_input_timestamps_v1_Listener: Tzwp_input_timestamps_v1_listener; 80 | 81 | 82 | 83 | destructor TZwpInputTimestampsManagerV1.Destroy; 84 | begin 85 | wl_proxy_marshal(FProxy, _DESTROY); 86 | inherited Destroy; 87 | end; 88 | 89 | function TZwpInputTimestampsManagerV1.GetKeyboardTimestamps(AKeyboard: TWlKeyboard; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 90 | var 91 | id: Pwl_proxy; 92 | begin 93 | id := wl_proxy_marshal_constructor(FProxy, 94 | _GET_KEYBOARD_TIMESTAMPS, @zwp_input_timestamps_v1_interface, nil, AKeyboard.Proxy); 95 | if AProxyClass = nil then 96 | AProxyClass := TZwpInputTimestampsV1; 97 | if not AProxyClass.InheritsFrom(TZwpInputTimestampsV1) then 98 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpInputTimestampsV1]); 99 | Result := TZwpInputTimestampsV1(AProxyClass.Create(id)); 100 | end; 101 | 102 | function TZwpInputTimestampsManagerV1.GetPointerTimestamps(APointer: TWlPointer; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 103 | var 104 | id: Pwl_proxy; 105 | begin 106 | id := wl_proxy_marshal_constructor(FProxy, 107 | _GET_POINTER_TIMESTAMPS, @zwp_input_timestamps_v1_interface, nil, APointer.Proxy); 108 | if AProxyClass = nil then 109 | AProxyClass := TZwpInputTimestampsV1; 110 | if not AProxyClass.InheritsFrom(TZwpInputTimestampsV1) then 111 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpInputTimestampsV1]); 112 | Result := TZwpInputTimestampsV1(AProxyClass.Create(id)); 113 | end; 114 | 115 | function TZwpInputTimestampsManagerV1.GetTouchTimestamps(ATouch: TWlTouch; AProxyClass: TWLProxyObjectClass = nil {TZwpInputTimestampsV1}): TZwpInputTimestampsV1; 116 | var 117 | id: Pwl_proxy; 118 | begin 119 | id := wl_proxy_marshal_constructor(FProxy, 120 | _GET_TOUCH_TIMESTAMPS, @zwp_input_timestamps_v1_interface, nil, ATouch.Proxy); 121 | if AProxyClass = nil then 122 | AProxyClass := TZwpInputTimestampsV1; 123 | if not AProxyClass.InheritsFrom(TZwpInputTimestampsV1) then 124 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpInputTimestampsV1]); 125 | Result := TZwpInputTimestampsV1(AProxyClass.Create(id)); 126 | end; 127 | 128 | function TZwpInputTimestampsManagerV1.AddListener(AIntf: IZwpInputTimestampsManagerV1Listener): LongInt; 129 | begin 130 | FUserDataRec.ListenerUserData := Pointer(AIntf); 131 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_input_timestamps_manager_v1_Listener, @FUserDataRec); 132 | end; 133 | destructor TZwpInputTimestampsV1.Destroy; 134 | begin 135 | wl_proxy_marshal(FProxy, _DESTROY); 136 | inherited Destroy; 137 | end; 138 | 139 | function TZwpInputTimestampsV1.AddListener(AIntf: IZwpInputTimestampsV1Listener): LongInt; 140 | begin 141 | FUserDataRec.ListenerUserData := Pointer(AIntf); 142 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_input_timestamps_v1_Listener, @FUserDataRec); 143 | end; 144 | 145 | 146 | 147 | 148 | procedure zwp_input_timestamps_v1_timestamp_Intf(AData: PWLUserData; Azwp_input_timestamps_v1: Pzwp_input_timestamps_v1; ATvSecHi: DWord; ATvSecLo: DWord; ATvNsec: DWord); cdecl; 149 | var 150 | AIntf: IZwpInputTimestampsV1Listener; 151 | begin 152 | if AData = nil then Exit; 153 | AIntf := IZwpInputTimestampsV1Listener(AData^.ListenerUserData); 154 | AIntf.zwp_input_timestamps_v1_timestamp(TZwpInputTimestampsV1(AData^.PascalObject), ATvSecHi, ATvSecLo, ATvNsec); 155 | end; 156 | 157 | 158 | 159 | const 160 | pInterfaces: array[0..13] of Pwl_interface = ( 161 | (nil), 162 | (nil), 163 | (nil), 164 | (nil), 165 | (nil), 166 | (nil), 167 | (nil), 168 | (nil), 169 | (@zwp_input_timestamps_v1_interface), 170 | (@wl_keyboard_interface), 171 | (@zwp_input_timestamps_v1_interface), 172 | (@wl_pointer_interface), 173 | (@zwp_input_timestamps_v1_interface), 174 | (@wl_touch_interface) 175 | ); 176 | 177 | zwp_input_timestamps_manager_v1_requests: array[0..3] of Twl_message = ( 178 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 179 | (name: 'get_keyboard_timestamps'; signature: 'no'; types: @pInterfaces[8]), 180 | (name: 'get_pointer_timestamps'; signature: 'no'; types: @pInterfaces[10]), 181 | (name: 'get_touch_timestamps'; signature: 'no'; types: @pInterfaces[12]) 182 | ); 183 | zwp_input_timestamps_v1_requests: array[0..0] of Twl_message = ( 184 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 185 | ); 186 | zwp_input_timestamps_v1_events: array[0..0] of Twl_message = ( 187 | (name: 'timestamp'; signature: 'uuu'; types: @pInterfaces[0]) 188 | ); 189 | 190 | initialization 191 | Pointer(vIntf_zwp_input_timestamps_v1_Listener.timestamp) := @zwp_input_timestamps_v1_timestamp_Intf; 192 | 193 | 194 | zwp_input_timestamps_manager_v1_interface.name := 'zwp_input_timestamps_manager_v1'; 195 | zwp_input_timestamps_manager_v1_interface.version := 1; 196 | zwp_input_timestamps_manager_v1_interface.method_count := 4; 197 | zwp_input_timestamps_manager_v1_interface.methods := @zwp_input_timestamps_manager_v1_requests; 198 | zwp_input_timestamps_manager_v1_interface.event_count := 0; 199 | zwp_input_timestamps_manager_v1_interface.events := nil; 200 | 201 | zwp_input_timestamps_v1_interface.name := 'zwp_input_timestamps_v1'; 202 | zwp_input_timestamps_v1_interface.version := 1; 203 | zwp_input_timestamps_v1_interface.method_count := 1; 204 | zwp_input_timestamps_v1_interface.methods := @zwp_input_timestamps_v1_requests; 205 | zwp_input_timestamps_v1_interface.event_count := 1; 206 | zwp_input_timestamps_v1_interface.events := @zwp_input_timestamps_v1_events; 207 | 208 | end. 209 | -------------------------------------------------------------------------------- /waylandunstablepkg/keyboard_shortcuts_inhibit_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit keyboard_shortcuts_inhibit_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_keyboard_shortcuts_inhibit_manager_v1 = Pointer; 14 | Pzwp_keyboard_shortcuts_inhibitor_v1 = Pointer; 15 | const 16 | ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_ERROR_ALREADY_INHIBITED = 0; // the shortcuts are already inhibited for this surface 17 | 18 | type 19 | Pzwp_keyboard_shortcuts_inhibit_manager_v1_listener = ^Tzwp_keyboard_shortcuts_inhibit_manager_v1_listener; 20 | Tzwp_keyboard_shortcuts_inhibit_manager_v1_listener = record 21 | end; 22 | 23 | Pzwp_keyboard_shortcuts_inhibitor_v1_listener = ^Tzwp_keyboard_shortcuts_inhibitor_v1_listener; 24 | Tzwp_keyboard_shortcuts_inhibitor_v1_listener = record 25 | active : procedure(data: Pointer; AZwpKeyboardShortcutsInhibitorV1: Pzwp_keyboard_shortcuts_inhibitor_v1); cdecl; 26 | inactive : procedure(data: Pointer; AZwpKeyboardShortcutsInhibitorV1: Pzwp_keyboard_shortcuts_inhibitor_v1); cdecl; 27 | end; 28 | 29 | 30 | 31 | TZwpKeyboardShortcutsInhibitManagerV1 = class; 32 | TZwpKeyboardShortcutsInhibitorV1 = class; 33 | 34 | 35 | IZwpKeyboardShortcutsInhibitManagerV1Listener = interface 36 | ['IZwpKeyboardShortcutsInhibitManagerV1Listener'] 37 | end; 38 | 39 | IZwpKeyboardShortcutsInhibitorV1Listener = interface 40 | ['IZwpKeyboardShortcutsInhibitorV1Listener'] 41 | procedure zwp_keyboard_shortcuts_inhibitor_v1_active(AZwpKeyboardShortcutsInhibitorV1: TZwpKeyboardShortcutsInhibitorV1); 42 | procedure zwp_keyboard_shortcuts_inhibitor_v1_inactive(AZwpKeyboardShortcutsInhibitorV1: TZwpKeyboardShortcutsInhibitorV1); 43 | end; 44 | 45 | 46 | 47 | 48 | TZwpKeyboardShortcutsInhibitManagerV1 = class(TWLProxyObject) 49 | private 50 | const _DESTROY = 0; 51 | const _INHIBIT_SHORTCUTS = 1; 52 | public 53 | destructor Destroy; override; 54 | function InhibitShortcuts(ASurface: TWlSurface; ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpKeyboardShortcutsInhibitorV1}): TZwpKeyboardShortcutsInhibitorV1; 55 | function AddListener(AIntf: IZwpKeyboardShortcutsInhibitManagerV1Listener): LongInt; 56 | end; 57 | 58 | TZwpKeyboardShortcutsInhibitorV1 = class(TWLProxyObject) 59 | private 60 | const _DESTROY = 0; 61 | public 62 | destructor Destroy; override; 63 | function AddListener(AIntf: IZwpKeyboardShortcutsInhibitorV1Listener): LongInt; 64 | end; 65 | 66 | 67 | 68 | 69 | 70 | 71 | var 72 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface: Twl_interface; 73 | zwp_keyboard_shortcuts_inhibitor_v1_interface: Twl_interface; 74 | 75 | 76 | 77 | implementation 78 | 79 | var 80 | vIntf_zwp_keyboard_shortcuts_inhibit_manager_v1_Listener: Tzwp_keyboard_shortcuts_inhibit_manager_v1_listener; 81 | vIntf_zwp_keyboard_shortcuts_inhibitor_v1_Listener: Tzwp_keyboard_shortcuts_inhibitor_v1_listener; 82 | 83 | 84 | 85 | destructor TZwpKeyboardShortcutsInhibitManagerV1.Destroy; 86 | begin 87 | wl_proxy_marshal(FProxy, _DESTROY); 88 | inherited Destroy; 89 | end; 90 | 91 | function TZwpKeyboardShortcutsInhibitManagerV1.InhibitShortcuts(ASurface: TWlSurface; ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpKeyboardShortcutsInhibitorV1}): TZwpKeyboardShortcutsInhibitorV1; 92 | var 93 | id: Pwl_proxy; 94 | begin 95 | id := wl_proxy_marshal_constructor(FProxy, 96 | _INHIBIT_SHORTCUTS, @zwp_keyboard_shortcuts_inhibitor_v1_interface, nil, ASurface.Proxy, ASeat.Proxy); 97 | if AProxyClass = nil then 98 | AProxyClass := TZwpKeyboardShortcutsInhibitorV1; 99 | if not AProxyClass.InheritsFrom(TZwpKeyboardShortcutsInhibitorV1) then 100 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpKeyboardShortcutsInhibitorV1]); 101 | Result := TZwpKeyboardShortcutsInhibitorV1(AProxyClass.Create(id)); 102 | end; 103 | 104 | function TZwpKeyboardShortcutsInhibitManagerV1.AddListener(AIntf: IZwpKeyboardShortcutsInhibitManagerV1Listener): LongInt; 105 | begin 106 | FUserDataRec.ListenerUserData := Pointer(AIntf); 107 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_keyboard_shortcuts_inhibit_manager_v1_Listener, @FUserDataRec); 108 | end; 109 | destructor TZwpKeyboardShortcutsInhibitorV1.Destroy; 110 | begin 111 | wl_proxy_marshal(FProxy, _DESTROY); 112 | inherited Destroy; 113 | end; 114 | 115 | function TZwpKeyboardShortcutsInhibitorV1.AddListener(AIntf: IZwpKeyboardShortcutsInhibitorV1Listener): LongInt; 116 | begin 117 | FUserDataRec.ListenerUserData := Pointer(AIntf); 118 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_keyboard_shortcuts_inhibitor_v1_Listener, @FUserDataRec); 119 | end; 120 | 121 | 122 | 123 | 124 | procedure zwp_keyboard_shortcuts_inhibitor_v1_active_Intf(AData: PWLUserData; Azwp_keyboard_shortcuts_inhibitor_v1: Pzwp_keyboard_shortcuts_inhibitor_v1); cdecl; 125 | var 126 | AIntf: IZwpKeyboardShortcutsInhibitorV1Listener; 127 | begin 128 | if AData = nil then Exit; 129 | AIntf := IZwpKeyboardShortcutsInhibitorV1Listener(AData^.ListenerUserData); 130 | AIntf.zwp_keyboard_shortcuts_inhibitor_v1_active(TZwpKeyboardShortcutsInhibitorV1(AData^.PascalObject)); 131 | end; 132 | 133 | procedure zwp_keyboard_shortcuts_inhibitor_v1_inactive_Intf(AData: PWLUserData; Azwp_keyboard_shortcuts_inhibitor_v1: Pzwp_keyboard_shortcuts_inhibitor_v1); cdecl; 134 | var 135 | AIntf: IZwpKeyboardShortcutsInhibitorV1Listener; 136 | begin 137 | if AData = nil then Exit; 138 | AIntf := IZwpKeyboardShortcutsInhibitorV1Listener(AData^.ListenerUserData); 139 | AIntf.zwp_keyboard_shortcuts_inhibitor_v1_inactive(TZwpKeyboardShortcutsInhibitorV1(AData^.PascalObject)); 140 | end; 141 | 142 | 143 | 144 | const 145 | pInterfaces: array[0..10] of Pwl_interface = ( 146 | (nil), 147 | (nil), 148 | (nil), 149 | (nil), 150 | (nil), 151 | (nil), 152 | (nil), 153 | (nil), 154 | (@zwp_keyboard_shortcuts_inhibitor_v1_interface), 155 | (@wl_surface_interface), 156 | (@wl_seat_interface) 157 | ); 158 | 159 | zwp_keyboard_shortcuts_inhibit_manager_v1_requests: array[0..1] of Twl_message = ( 160 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 161 | (name: 'inhibit_shortcuts'; signature: 'noo'; types: @pInterfaces[8]) 162 | ); 163 | zwp_keyboard_shortcuts_inhibitor_v1_requests: array[0..0] of Twl_message = ( 164 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 165 | ); 166 | zwp_keyboard_shortcuts_inhibitor_v1_events: array[0..1] of Twl_message = ( 167 | (name: 'active'; signature: ''; types: @pInterfaces[0]), 168 | (name: 'inactive'; signature: ''; types: @pInterfaces[0]) 169 | ); 170 | 171 | initialization 172 | Pointer(vIntf_zwp_keyboard_shortcuts_inhibitor_v1_Listener.active) := @zwp_keyboard_shortcuts_inhibitor_v1_active_Intf; 173 | Pointer(vIntf_zwp_keyboard_shortcuts_inhibitor_v1_Listener.inactive) := @zwp_keyboard_shortcuts_inhibitor_v1_inactive_Intf; 174 | 175 | 176 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.name := 'zwp_keyboard_shortcuts_inhibit_manager_v1'; 177 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.version := 1; 178 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.method_count := 2; 179 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.methods := @zwp_keyboard_shortcuts_inhibit_manager_v1_requests; 180 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.event_count := 0; 181 | zwp_keyboard_shortcuts_inhibit_manager_v1_interface.events := nil; 182 | 183 | zwp_keyboard_shortcuts_inhibitor_v1_interface.name := 'zwp_keyboard_shortcuts_inhibitor_v1'; 184 | zwp_keyboard_shortcuts_inhibitor_v1_interface.version := 1; 185 | zwp_keyboard_shortcuts_inhibitor_v1_interface.method_count := 1; 186 | zwp_keyboard_shortcuts_inhibitor_v1_interface.methods := @zwp_keyboard_shortcuts_inhibitor_v1_requests; 187 | zwp_keyboard_shortcuts_inhibitor_v1_interface.event_count := 2; 188 | zwp_keyboard_shortcuts_inhibitor_v1_interface.events := @zwp_keyboard_shortcuts_inhibitor_v1_events; 189 | 190 | end. 191 | -------------------------------------------------------------------------------- /waylandunstablepkg/linux_explicit_synchronization_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit linux_explicit_synchronization_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_linux_explicit_synchronization_v1 = Pointer; 14 | Pzwp_linux_surface_synchronization_v1 = Pointer; 15 | Pzwp_linux_buffer_release_v1 = Pointer; 16 | const 17 | ZWP_LINUX_EXPLICIT_SYNCHRONIZATION_V1_ERROR_SYNCHRONIZATION_EXISTS = 0; // the surface already has a synchronization object associated 18 | 19 | type 20 | Pzwp_linux_explicit_synchronization_v1_listener = ^Tzwp_linux_explicit_synchronization_v1_listener; 21 | Tzwp_linux_explicit_synchronization_v1_listener = record 22 | end; 23 | 24 | const 25 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_INVALID_FENCE = 0; // the fence specified by the client could not be imported 26 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_DUPLICATE_FENCE = 1; // multiple fences added for a single surface commit 27 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_DUPLICATE_RELEASE = 2; // multiple releases added for a single surface commit 28 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_NO_SURFACE = 3; // the associated wl_surface was destroyed 29 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_UNSUPPORTED_BUFFER = 4; // the buffer does not support explicit synchronization 30 | ZWP_LINUX_SURFACE_SYNCHRONIZATION_V1_ERROR_NO_BUFFER = 5; // no buffer was attached 31 | 32 | type 33 | Pzwp_linux_surface_synchronization_v1_listener = ^Tzwp_linux_surface_synchronization_v1_listener; 34 | Tzwp_linux_surface_synchronization_v1_listener = record 35 | end; 36 | 37 | Pzwp_linux_buffer_release_v1_listener = ^Tzwp_linux_buffer_release_v1_listener; 38 | Tzwp_linux_buffer_release_v1_listener = record 39 | fenced_release : procedure(data: Pointer; AZwpLinuxBufferReleaseV1: Pzwp_linux_buffer_release_v1; AFence: LongInt{fd}); cdecl; 40 | immediate_release : procedure(data: Pointer; AZwpLinuxBufferReleaseV1: Pzwp_linux_buffer_release_v1); cdecl; 41 | end; 42 | 43 | 44 | 45 | TZwpLinuxExplicitSynchronizationV1 = class; 46 | TZwpLinuxSurfaceSynchronizationV1 = class; 47 | TZwpLinuxBufferReleaseV1 = class; 48 | 49 | 50 | IZwpLinuxExplicitSynchronizationV1Listener = interface 51 | ['IZwpLinuxExplicitSynchronizationV1Listener'] 52 | end; 53 | 54 | IZwpLinuxSurfaceSynchronizationV1Listener = interface 55 | ['IZwpLinuxSurfaceSynchronizationV1Listener'] 56 | end; 57 | 58 | IZwpLinuxBufferReleaseV1Listener = interface 59 | ['IZwpLinuxBufferReleaseV1Listener'] 60 | procedure zwp_linux_buffer_release_v1_fenced_release(AZwpLinuxBufferReleaseV1: TZwpLinuxBufferReleaseV1; AFence: LongInt{fd}); 61 | procedure zwp_linux_buffer_release_v1_immediate_release(AZwpLinuxBufferReleaseV1: TZwpLinuxBufferReleaseV1); 62 | end; 63 | 64 | 65 | 66 | 67 | TZwpLinuxExplicitSynchronizationV1 = class(TWLProxyObject) 68 | private 69 | const _DESTROY = 0; 70 | const _GET_SYNCHRONIZATION = 1; 71 | public 72 | destructor Destroy; override; 73 | function GetSynchronization(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZwpLinuxSurfaceSynchronizationV1}): TZwpLinuxSurfaceSynchronizationV1; 74 | function AddListener(AIntf: IZwpLinuxExplicitSynchronizationV1Listener): LongInt; 75 | end; 76 | 77 | TZwpLinuxSurfaceSynchronizationV1 = class(TWLProxyObject) 78 | private 79 | const _DESTROY = 0; 80 | const _SET_ACQUIRE_FENCE = 1; 81 | const _GET_RELEASE = 2; 82 | public 83 | destructor Destroy; override; 84 | procedure SetAcquireFence(AFd: LongInt{fd}); 85 | function GetRelease(AProxyClass: TWLProxyObjectClass = nil {TZwpLinuxBufferReleaseV1}): TZwpLinuxBufferReleaseV1; 86 | function AddListener(AIntf: IZwpLinuxSurfaceSynchronizationV1Listener): LongInt; 87 | end; 88 | 89 | TZwpLinuxBufferReleaseV1 = class(TWLProxyObject) 90 | function AddListener(AIntf: IZwpLinuxBufferReleaseV1Listener): LongInt; 91 | end; 92 | 93 | 94 | 95 | 96 | 97 | 98 | var 99 | zwp_linux_explicit_synchronization_v1_interface: Twl_interface; 100 | zwp_linux_surface_synchronization_v1_interface: Twl_interface; 101 | zwp_linux_buffer_release_v1_interface: Twl_interface; 102 | 103 | 104 | 105 | implementation 106 | 107 | var 108 | vIntf_zwp_linux_explicit_synchronization_v1_Listener: Tzwp_linux_explicit_synchronization_v1_listener; 109 | vIntf_zwp_linux_surface_synchronization_v1_Listener: Tzwp_linux_surface_synchronization_v1_listener; 110 | vIntf_zwp_linux_buffer_release_v1_Listener: Tzwp_linux_buffer_release_v1_listener; 111 | 112 | 113 | 114 | destructor TZwpLinuxExplicitSynchronizationV1.Destroy; 115 | begin 116 | wl_proxy_marshal(FProxy, _DESTROY); 117 | inherited Destroy; 118 | end; 119 | 120 | function TZwpLinuxExplicitSynchronizationV1.GetSynchronization(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZwpLinuxSurfaceSynchronizationV1}): TZwpLinuxSurfaceSynchronizationV1; 121 | var 122 | id: Pwl_proxy; 123 | begin 124 | id := wl_proxy_marshal_constructor(FProxy, 125 | _GET_SYNCHRONIZATION, @zwp_linux_surface_synchronization_v1_interface, nil, ASurface.Proxy); 126 | if AProxyClass = nil then 127 | AProxyClass := TZwpLinuxSurfaceSynchronizationV1; 128 | if not AProxyClass.InheritsFrom(TZwpLinuxSurfaceSynchronizationV1) then 129 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpLinuxSurfaceSynchronizationV1]); 130 | Result := TZwpLinuxSurfaceSynchronizationV1(AProxyClass.Create(id)); 131 | end; 132 | 133 | function TZwpLinuxExplicitSynchronizationV1.AddListener(AIntf: IZwpLinuxExplicitSynchronizationV1Listener): LongInt; 134 | begin 135 | FUserDataRec.ListenerUserData := Pointer(AIntf); 136 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_linux_explicit_synchronization_v1_Listener, @FUserDataRec); 137 | end; 138 | destructor TZwpLinuxSurfaceSynchronizationV1.Destroy; 139 | begin 140 | wl_proxy_marshal(FProxy, _DESTROY); 141 | inherited Destroy; 142 | end; 143 | 144 | procedure TZwpLinuxSurfaceSynchronizationV1.SetAcquireFence(AFd: LongInt{fd}); 145 | begin 146 | wl_proxy_marshal(FProxy, _SET_ACQUIRE_FENCE, AFd); 147 | end; 148 | 149 | function TZwpLinuxSurfaceSynchronizationV1.GetRelease(AProxyClass: TWLProxyObjectClass = nil {TZwpLinuxBufferReleaseV1}): TZwpLinuxBufferReleaseV1; 150 | var 151 | release: Pwl_proxy; 152 | begin 153 | release := wl_proxy_marshal_constructor(FProxy, 154 | _GET_RELEASE, @zwp_linux_buffer_release_v1_interface, nil); 155 | if AProxyClass = nil then 156 | AProxyClass := TZwpLinuxBufferReleaseV1; 157 | if not AProxyClass.InheritsFrom(TZwpLinuxBufferReleaseV1) then 158 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpLinuxBufferReleaseV1]); 159 | Result := TZwpLinuxBufferReleaseV1(AProxyClass.Create(release)); 160 | end; 161 | 162 | function TZwpLinuxSurfaceSynchronizationV1.AddListener(AIntf: IZwpLinuxSurfaceSynchronizationV1Listener): LongInt; 163 | begin 164 | FUserDataRec.ListenerUserData := Pointer(AIntf); 165 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_linux_surface_synchronization_v1_Listener, @FUserDataRec); 166 | end; 167 | function TZwpLinuxBufferReleaseV1.AddListener(AIntf: IZwpLinuxBufferReleaseV1Listener): LongInt; 168 | begin 169 | FUserDataRec.ListenerUserData := Pointer(AIntf); 170 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_linux_buffer_release_v1_Listener, @FUserDataRec); 171 | end; 172 | 173 | 174 | 175 | 176 | procedure zwp_linux_buffer_release_v1_fenced_release_Intf(AData: PWLUserData; Azwp_linux_buffer_release_v1: Pzwp_linux_buffer_release_v1; AFence: LongInt{fd}); cdecl; 177 | var 178 | AIntf: IZwpLinuxBufferReleaseV1Listener; 179 | begin 180 | if AData = nil then Exit; 181 | AIntf := IZwpLinuxBufferReleaseV1Listener(AData^.ListenerUserData); 182 | AIntf.zwp_linux_buffer_release_v1_fenced_release(TZwpLinuxBufferReleaseV1(AData^.PascalObject), AFence); 183 | end; 184 | 185 | procedure zwp_linux_buffer_release_v1_immediate_release_Intf(AData: PWLUserData; Azwp_linux_buffer_release_v1: Pzwp_linux_buffer_release_v1); cdecl; 186 | var 187 | AIntf: IZwpLinuxBufferReleaseV1Listener; 188 | begin 189 | if AData = nil then Exit; 190 | AIntf := IZwpLinuxBufferReleaseV1Listener(AData^.ListenerUserData); 191 | AIntf.zwp_linux_buffer_release_v1_immediate_release(TZwpLinuxBufferReleaseV1(AData^.PascalObject)); 192 | end; 193 | 194 | 195 | 196 | const 197 | pInterfaces: array[0..10] of Pwl_interface = ( 198 | (nil), 199 | (nil), 200 | (nil), 201 | (nil), 202 | (nil), 203 | (nil), 204 | (nil), 205 | (nil), 206 | (@zwp_linux_surface_synchronization_v1_interface), 207 | (@wl_surface_interface), 208 | (@zwp_linux_buffer_release_v1_interface) 209 | ); 210 | 211 | zwp_linux_explicit_synchronization_v1_requests: array[0..1] of Twl_message = ( 212 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 213 | (name: 'get_synchronization'; signature: 'no'; types: @pInterfaces[8]) 214 | ); 215 | zwp_linux_surface_synchronization_v1_requests: array[0..2] of Twl_message = ( 216 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 217 | (name: 'set_acquire_fence'; signature: 'h'; types: @pInterfaces[0]), 218 | (name: 'get_release'; signature: 'n'; types: @pInterfaces[10]) 219 | ); 220 | zwp_linux_buffer_release_v1_events: array[0..1] of Twl_message = ( 221 | (name: 'fenced_release'; signature: 'h'; types: @pInterfaces[0]), 222 | (name: 'immediate_release'; signature: ''; types: @pInterfaces[0]) 223 | ); 224 | 225 | initialization 226 | Pointer(vIntf_zwp_linux_buffer_release_v1_Listener.fenced_release) := @zwp_linux_buffer_release_v1_fenced_release_Intf; 227 | Pointer(vIntf_zwp_linux_buffer_release_v1_Listener.immediate_release) := @zwp_linux_buffer_release_v1_immediate_release_Intf; 228 | 229 | 230 | zwp_linux_explicit_synchronization_v1_interface.name := 'zwp_linux_explicit_synchronization_v1'; 231 | zwp_linux_explicit_synchronization_v1_interface.version := 2; 232 | zwp_linux_explicit_synchronization_v1_interface.method_count := 2; 233 | zwp_linux_explicit_synchronization_v1_interface.methods := @zwp_linux_explicit_synchronization_v1_requests; 234 | zwp_linux_explicit_synchronization_v1_interface.event_count := 0; 235 | zwp_linux_explicit_synchronization_v1_interface.events := nil; 236 | 237 | zwp_linux_surface_synchronization_v1_interface.name := 'zwp_linux_surface_synchronization_v1'; 238 | zwp_linux_surface_synchronization_v1_interface.version := 2; 239 | zwp_linux_surface_synchronization_v1_interface.method_count := 3; 240 | zwp_linux_surface_synchronization_v1_interface.methods := @zwp_linux_surface_synchronization_v1_requests; 241 | zwp_linux_surface_synchronization_v1_interface.event_count := 0; 242 | zwp_linux_surface_synchronization_v1_interface.events := nil; 243 | 244 | zwp_linux_buffer_release_v1_interface.name := 'zwp_linux_buffer_release_v1'; 245 | zwp_linux_buffer_release_v1_interface.version := 1; 246 | zwp_linux_buffer_release_v1_interface.method_count := 0; 247 | zwp_linux_buffer_release_v1_interface.methods := nil; 248 | zwp_linux_buffer_release_v1_interface.event_count := 2; 249 | zwp_linux_buffer_release_v1_interface.events := @zwp_linux_buffer_release_v1_events; 250 | 251 | end. 252 | -------------------------------------------------------------------------------- /waylandunstablepkg/pointer_constraints_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit pointer_constraints_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_pointer_constraints_v1 = Pointer; 14 | Pzwp_locked_pointer_v1 = Pointer; 15 | Pzwp_confined_pointer_v1 = Pointer; 16 | const 17 | ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1; // pointer constraint already requested on that surface 18 | ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1; // the pointer constraint is defunct once deactivated 19 | ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2; // the pointer constraint may reactivate 20 | 21 | type 22 | Pzwp_pointer_constraints_v1_listener = ^Tzwp_pointer_constraints_v1_listener; 23 | Tzwp_pointer_constraints_v1_listener = record 24 | end; 25 | 26 | Pzwp_locked_pointer_v1_listener = ^Tzwp_locked_pointer_v1_listener; 27 | Tzwp_locked_pointer_v1_listener = record 28 | locked : procedure(data: Pointer; AZwpLockedPointerV1: Pzwp_locked_pointer_v1); cdecl; 29 | unlocked : procedure(data: Pointer; AZwpLockedPointerV1: Pzwp_locked_pointer_v1); cdecl; 30 | end; 31 | 32 | Pzwp_confined_pointer_v1_listener = ^Tzwp_confined_pointer_v1_listener; 33 | Tzwp_confined_pointer_v1_listener = record 34 | confined : procedure(data: Pointer; AZwpConfinedPointerV1: Pzwp_confined_pointer_v1); cdecl; 35 | unconfined : procedure(data: Pointer; AZwpConfinedPointerV1: Pzwp_confined_pointer_v1); cdecl; 36 | end; 37 | 38 | 39 | 40 | TZwpPointerConstraintsV1 = class; 41 | TZwpLockedPointerV1 = class; 42 | TZwpConfinedPointerV1 = class; 43 | 44 | 45 | IZwpPointerConstraintsV1Listener = interface 46 | ['IZwpPointerConstraintsV1Listener'] 47 | end; 48 | 49 | IZwpLockedPointerV1Listener = interface 50 | ['IZwpLockedPointerV1Listener'] 51 | procedure zwp_locked_pointer_v1_locked(AZwpLockedPointerV1: TZwpLockedPointerV1); 52 | procedure zwp_locked_pointer_v1_unlocked(AZwpLockedPointerV1: TZwpLockedPointerV1); 53 | end; 54 | 55 | IZwpConfinedPointerV1Listener = interface 56 | ['IZwpConfinedPointerV1Listener'] 57 | procedure zwp_confined_pointer_v1_confined(AZwpConfinedPointerV1: TZwpConfinedPointerV1); 58 | procedure zwp_confined_pointer_v1_unconfined(AZwpConfinedPointerV1: TZwpConfinedPointerV1); 59 | end; 60 | 61 | 62 | 63 | 64 | TZwpPointerConstraintsV1 = class(TWLProxyObject) 65 | private 66 | const _DESTROY = 0; 67 | const _LOCK_POINTER = 1; 68 | const _CONFINE_POINTER = 2; 69 | public 70 | destructor Destroy; override; 71 | function LockPointer(ASurface: TWlSurface; APointer: TWlPointer; ARegion: TWlRegion; ALifetime: DWord; AProxyClass: TWLProxyObjectClass = nil {TZwpLockedPointerV1}): TZwpLockedPointerV1; 72 | function ConfinePointer(ASurface: TWlSurface; APointer: TWlPointer; ARegion: TWlRegion; ALifetime: DWord; AProxyClass: TWLProxyObjectClass = nil {TZwpConfinedPointerV1}): TZwpConfinedPointerV1; 73 | function AddListener(AIntf: IZwpPointerConstraintsV1Listener): LongInt; 74 | end; 75 | 76 | TZwpLockedPointerV1 = class(TWLProxyObject) 77 | private 78 | const _DESTROY = 0; 79 | const _SET_CURSOR_POSITION_HINT = 1; 80 | const _SET_REGION = 2; 81 | public 82 | destructor Destroy; override; 83 | procedure SetCursorPositionHint(ASurfaceX: Twl_fixed; ASurfaceY: Twl_fixed); 84 | procedure SetRegion(ARegion: TWlRegion); 85 | function AddListener(AIntf: IZwpLockedPointerV1Listener): LongInt; 86 | end; 87 | 88 | TZwpConfinedPointerV1 = class(TWLProxyObject) 89 | private 90 | const _DESTROY = 0; 91 | const _SET_REGION = 1; 92 | public 93 | destructor Destroy; override; 94 | procedure SetRegion(ARegion: TWlRegion); 95 | function AddListener(AIntf: IZwpConfinedPointerV1Listener): LongInt; 96 | end; 97 | 98 | 99 | 100 | 101 | 102 | 103 | var 104 | zwp_pointer_constraints_v1_interface: Twl_interface; 105 | zwp_locked_pointer_v1_interface: Twl_interface; 106 | zwp_confined_pointer_v1_interface: Twl_interface; 107 | 108 | 109 | 110 | implementation 111 | 112 | var 113 | vIntf_zwp_pointer_constraints_v1_Listener: Tzwp_pointer_constraints_v1_listener; 114 | vIntf_zwp_locked_pointer_v1_Listener: Tzwp_locked_pointer_v1_listener; 115 | vIntf_zwp_confined_pointer_v1_Listener: Tzwp_confined_pointer_v1_listener; 116 | 117 | 118 | 119 | destructor TZwpPointerConstraintsV1.Destroy; 120 | begin 121 | wl_proxy_marshal(FProxy, _DESTROY); 122 | inherited Destroy; 123 | end; 124 | 125 | function TZwpPointerConstraintsV1.LockPointer(ASurface: TWlSurface; APointer: TWlPointer; ARegion: TWlRegion; ALifetime: DWord; AProxyClass: TWLProxyObjectClass = nil {TZwpLockedPointerV1}): TZwpLockedPointerV1; 126 | var 127 | id: Pwl_proxy; 128 | begin 129 | id := wl_proxy_marshal_constructor(FProxy, 130 | _LOCK_POINTER, @zwp_locked_pointer_v1_interface, nil, ASurface.Proxy, APointer.Proxy, ARegion.Proxy, ALifetime); 131 | if AProxyClass = nil then 132 | AProxyClass := TZwpLockedPointerV1; 133 | if not AProxyClass.InheritsFrom(TZwpLockedPointerV1) then 134 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpLockedPointerV1]); 135 | Result := TZwpLockedPointerV1(AProxyClass.Create(id)); 136 | end; 137 | 138 | function TZwpPointerConstraintsV1.ConfinePointer(ASurface: TWlSurface; APointer: TWlPointer; ARegion: TWlRegion; ALifetime: DWord; AProxyClass: TWLProxyObjectClass = nil {TZwpConfinedPointerV1}): TZwpConfinedPointerV1; 139 | var 140 | id: Pwl_proxy; 141 | begin 142 | id := wl_proxy_marshal_constructor(FProxy, 143 | _CONFINE_POINTER, @zwp_confined_pointer_v1_interface, nil, ASurface.Proxy, APointer.Proxy, ARegion.Proxy, ALifetime); 144 | if AProxyClass = nil then 145 | AProxyClass := TZwpConfinedPointerV1; 146 | if not AProxyClass.InheritsFrom(TZwpConfinedPointerV1) then 147 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpConfinedPointerV1]); 148 | Result := TZwpConfinedPointerV1(AProxyClass.Create(id)); 149 | end; 150 | 151 | function TZwpPointerConstraintsV1.AddListener(AIntf: IZwpPointerConstraintsV1Listener): LongInt; 152 | begin 153 | FUserDataRec.ListenerUserData := Pointer(AIntf); 154 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_pointer_constraints_v1_Listener, @FUserDataRec); 155 | end; 156 | destructor TZwpLockedPointerV1.Destroy; 157 | begin 158 | wl_proxy_marshal(FProxy, _DESTROY); 159 | inherited Destroy; 160 | end; 161 | 162 | procedure TZwpLockedPointerV1.SetCursorPositionHint(ASurfaceX: Twl_fixed; ASurfaceY: Twl_fixed); 163 | begin 164 | wl_proxy_marshal(FProxy, _SET_CURSOR_POSITION_HINT, ASurfaceX.AsFixed24_8, ASurfaceY.AsFixed24_8); 165 | end; 166 | 167 | procedure TZwpLockedPointerV1.SetRegion(ARegion: TWlRegion); 168 | begin 169 | wl_proxy_marshal(FProxy, _SET_REGION, ARegion.Proxy); 170 | end; 171 | 172 | function TZwpLockedPointerV1.AddListener(AIntf: IZwpLockedPointerV1Listener): LongInt; 173 | begin 174 | FUserDataRec.ListenerUserData := Pointer(AIntf); 175 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_locked_pointer_v1_Listener, @FUserDataRec); 176 | end; 177 | destructor TZwpConfinedPointerV1.Destroy; 178 | begin 179 | wl_proxy_marshal(FProxy, _DESTROY); 180 | inherited Destroy; 181 | end; 182 | 183 | procedure TZwpConfinedPointerV1.SetRegion(ARegion: TWlRegion); 184 | begin 185 | wl_proxy_marshal(FProxy, _SET_REGION, ARegion.Proxy); 186 | end; 187 | 188 | function TZwpConfinedPointerV1.AddListener(AIntf: IZwpConfinedPointerV1Listener): LongInt; 189 | begin 190 | FUserDataRec.ListenerUserData := Pointer(AIntf); 191 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_confined_pointer_v1_Listener, @FUserDataRec); 192 | end; 193 | 194 | 195 | 196 | 197 | procedure zwp_locked_pointer_v1_locked_Intf(AData: PWLUserData; Azwp_locked_pointer_v1: Pzwp_locked_pointer_v1); cdecl; 198 | var 199 | AIntf: IZwpLockedPointerV1Listener; 200 | begin 201 | if AData = nil then Exit; 202 | AIntf := IZwpLockedPointerV1Listener(AData^.ListenerUserData); 203 | AIntf.zwp_locked_pointer_v1_locked(TZwpLockedPointerV1(AData^.PascalObject)); 204 | end; 205 | 206 | procedure zwp_locked_pointer_v1_unlocked_Intf(AData: PWLUserData; Azwp_locked_pointer_v1: Pzwp_locked_pointer_v1); cdecl; 207 | var 208 | AIntf: IZwpLockedPointerV1Listener; 209 | begin 210 | if AData = nil then Exit; 211 | AIntf := IZwpLockedPointerV1Listener(AData^.ListenerUserData); 212 | AIntf.zwp_locked_pointer_v1_unlocked(TZwpLockedPointerV1(AData^.PascalObject)); 213 | end; 214 | 215 | procedure zwp_confined_pointer_v1_confined_Intf(AData: PWLUserData; Azwp_confined_pointer_v1: Pzwp_confined_pointer_v1); cdecl; 216 | var 217 | AIntf: IZwpConfinedPointerV1Listener; 218 | begin 219 | if AData = nil then Exit; 220 | AIntf := IZwpConfinedPointerV1Listener(AData^.ListenerUserData); 221 | AIntf.zwp_confined_pointer_v1_confined(TZwpConfinedPointerV1(AData^.PascalObject)); 222 | end; 223 | 224 | procedure zwp_confined_pointer_v1_unconfined_Intf(AData: PWLUserData; Azwp_confined_pointer_v1: Pzwp_confined_pointer_v1); cdecl; 225 | var 226 | AIntf: IZwpConfinedPointerV1Listener; 227 | begin 228 | if AData = nil then Exit; 229 | AIntf := IZwpConfinedPointerV1Listener(AData^.ListenerUserData); 230 | AIntf.zwp_confined_pointer_v1_unconfined(TZwpConfinedPointerV1(AData^.PascalObject)); 231 | end; 232 | 233 | 234 | 235 | const 236 | pInterfaces: array[0..19] of Pwl_interface = ( 237 | (nil), 238 | (nil), 239 | (nil), 240 | (nil), 241 | (nil), 242 | (nil), 243 | (nil), 244 | (nil), 245 | (@zwp_locked_pointer_v1_interface), 246 | (@wl_surface_interface), 247 | (@wl_pointer_interface), 248 | (@wl_region_interface), 249 | (nil), 250 | (@zwp_confined_pointer_v1_interface), 251 | (@wl_surface_interface), 252 | (@wl_pointer_interface), 253 | (@wl_region_interface), 254 | (nil), 255 | (@wl_region_interface), 256 | (@wl_region_interface) 257 | ); 258 | 259 | zwp_pointer_constraints_v1_requests: array[0..2] of Twl_message = ( 260 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 261 | (name: 'lock_pointer'; signature: 'noo?ou'; types: @pInterfaces[8]), 262 | (name: 'confine_pointer'; signature: 'noo?ou'; types: @pInterfaces[13]) 263 | ); 264 | zwp_locked_pointer_v1_requests: array[0..2] of Twl_message = ( 265 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 266 | (name: 'set_cursor_position_hint'; signature: 'ff'; types: @pInterfaces[0]), 267 | (name: 'set_region'; signature: '?o'; types: @pInterfaces[18]) 268 | ); 269 | zwp_locked_pointer_v1_events: array[0..1] of Twl_message = ( 270 | (name: 'locked'; signature: ''; types: @pInterfaces[0]), 271 | (name: 'unlocked'; signature: ''; types: @pInterfaces[0]) 272 | ); 273 | zwp_confined_pointer_v1_requests: array[0..1] of Twl_message = ( 274 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 275 | (name: 'set_region'; signature: '?o'; types: @pInterfaces[19]) 276 | ); 277 | zwp_confined_pointer_v1_events: array[0..1] of Twl_message = ( 278 | (name: 'confined'; signature: ''; types: @pInterfaces[0]), 279 | (name: 'unconfined'; signature: ''; types: @pInterfaces[0]) 280 | ); 281 | 282 | initialization 283 | Pointer(vIntf_zwp_locked_pointer_v1_Listener.locked) := @zwp_locked_pointer_v1_locked_Intf; 284 | Pointer(vIntf_zwp_locked_pointer_v1_Listener.unlocked) := @zwp_locked_pointer_v1_unlocked_Intf; 285 | Pointer(vIntf_zwp_confined_pointer_v1_Listener.confined) := @zwp_confined_pointer_v1_confined_Intf; 286 | Pointer(vIntf_zwp_confined_pointer_v1_Listener.unconfined) := @zwp_confined_pointer_v1_unconfined_Intf; 287 | 288 | 289 | zwp_pointer_constraints_v1_interface.name := 'zwp_pointer_constraints_v1'; 290 | zwp_pointer_constraints_v1_interface.version := 1; 291 | zwp_pointer_constraints_v1_interface.method_count := 3; 292 | zwp_pointer_constraints_v1_interface.methods := @zwp_pointer_constraints_v1_requests; 293 | zwp_pointer_constraints_v1_interface.event_count := 0; 294 | zwp_pointer_constraints_v1_interface.events := nil; 295 | 296 | zwp_locked_pointer_v1_interface.name := 'zwp_locked_pointer_v1'; 297 | zwp_locked_pointer_v1_interface.version := 1; 298 | zwp_locked_pointer_v1_interface.method_count := 3; 299 | zwp_locked_pointer_v1_interface.methods := @zwp_locked_pointer_v1_requests; 300 | zwp_locked_pointer_v1_interface.event_count := 2; 301 | zwp_locked_pointer_v1_interface.events := @zwp_locked_pointer_v1_events; 302 | 303 | zwp_confined_pointer_v1_interface.name := 'zwp_confined_pointer_v1'; 304 | zwp_confined_pointer_v1_interface.version := 1; 305 | zwp_confined_pointer_v1_interface.method_count := 2; 306 | zwp_confined_pointer_v1_interface.methods := @zwp_confined_pointer_v1_requests; 307 | zwp_confined_pointer_v1_interface.event_count := 2; 308 | zwp_confined_pointer_v1_interface.events := @zwp_confined_pointer_v1_events; 309 | 310 | end. 311 | -------------------------------------------------------------------------------- /waylandunstablepkg/relative_pointer_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit relative_pointer_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_relative_pointer_manager_v1 = Pointer; 14 | Pzwp_relative_pointer_v1 = Pointer; 15 | Pzwp_relative_pointer_manager_v1_listener = ^Tzwp_relative_pointer_manager_v1_listener; 16 | Tzwp_relative_pointer_manager_v1_listener = record 17 | end; 18 | 19 | Pzwp_relative_pointer_v1_listener = ^Tzwp_relative_pointer_v1_listener; 20 | Tzwp_relative_pointer_v1_listener = record 21 | relative_motion : procedure(data: Pointer; AZwpRelativePointerV1: Pzwp_relative_pointer_v1; AUtimeHi: DWord; AUtimeLo: DWord; ADx: Longint{24.8}; ADy: Longint{24.8}; ADxUnaccel: Longint{24.8}; ADyUnaccel: Longint{24.8}); cdecl; 22 | end; 23 | 24 | 25 | 26 | TZwpRelativePointerManagerV1 = class; 27 | TZwpRelativePointerV1 = class; 28 | 29 | 30 | IZwpRelativePointerManagerV1Listener = interface 31 | ['IZwpRelativePointerManagerV1Listener'] 32 | end; 33 | 34 | IZwpRelativePointerV1Listener = interface 35 | ['IZwpRelativePointerV1Listener'] 36 | procedure zwp_relative_pointer_v1_relative_motion(AZwpRelativePointerV1: TZwpRelativePointerV1; AUtimeHi: DWord; AUtimeLo: DWord; ADx: Twl_fixed; ADy: Twl_fixed; ADxUnaccel: Twl_fixed; ADyUnaccel: Twl_fixed); 37 | end; 38 | 39 | 40 | 41 | 42 | TZwpRelativePointerManagerV1 = class(TWLProxyObject) 43 | private 44 | const _DESTROY = 0; 45 | const _GET_RELATIVE_POINTER = 1; 46 | public 47 | destructor Destroy; override; 48 | function GetRelativePointer(APointer: TWlPointer; AProxyClass: TWLProxyObjectClass = nil {TZwpRelativePointerV1}): TZwpRelativePointerV1; 49 | function AddListener(AIntf: IZwpRelativePointerManagerV1Listener): LongInt; 50 | end; 51 | 52 | TZwpRelativePointerV1 = class(TWLProxyObject) 53 | private 54 | const _DESTROY = 0; 55 | public 56 | destructor Destroy; override; 57 | function AddListener(AIntf: IZwpRelativePointerV1Listener): LongInt; 58 | end; 59 | 60 | 61 | 62 | 63 | 64 | 65 | var 66 | zwp_relative_pointer_manager_v1_interface: Twl_interface; 67 | zwp_relative_pointer_v1_interface: Twl_interface; 68 | 69 | 70 | 71 | implementation 72 | 73 | var 74 | vIntf_zwp_relative_pointer_manager_v1_Listener: Tzwp_relative_pointer_manager_v1_listener; 75 | vIntf_zwp_relative_pointer_v1_Listener: Tzwp_relative_pointer_v1_listener; 76 | 77 | 78 | 79 | destructor TZwpRelativePointerManagerV1.Destroy; 80 | begin 81 | wl_proxy_marshal(FProxy, _DESTROY); 82 | inherited Destroy; 83 | end; 84 | 85 | function TZwpRelativePointerManagerV1.GetRelativePointer(APointer: TWlPointer; AProxyClass: TWLProxyObjectClass = nil {TZwpRelativePointerV1}): TZwpRelativePointerV1; 86 | var 87 | id: Pwl_proxy; 88 | begin 89 | id := wl_proxy_marshal_constructor(FProxy, 90 | _GET_RELATIVE_POINTER, @zwp_relative_pointer_v1_interface, nil, APointer.Proxy); 91 | if AProxyClass = nil then 92 | AProxyClass := TZwpRelativePointerV1; 93 | if not AProxyClass.InheritsFrom(TZwpRelativePointerV1) then 94 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpRelativePointerV1]); 95 | Result := TZwpRelativePointerV1(AProxyClass.Create(id)); 96 | end; 97 | 98 | function TZwpRelativePointerManagerV1.AddListener(AIntf: IZwpRelativePointerManagerV1Listener): LongInt; 99 | begin 100 | FUserDataRec.ListenerUserData := Pointer(AIntf); 101 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_relative_pointer_manager_v1_Listener, @FUserDataRec); 102 | end; 103 | destructor TZwpRelativePointerV1.Destroy; 104 | begin 105 | wl_proxy_marshal(FProxy, _DESTROY); 106 | inherited Destroy; 107 | end; 108 | 109 | function TZwpRelativePointerV1.AddListener(AIntf: IZwpRelativePointerV1Listener): LongInt; 110 | begin 111 | FUserDataRec.ListenerUserData := Pointer(AIntf); 112 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_relative_pointer_v1_Listener, @FUserDataRec); 113 | end; 114 | 115 | 116 | 117 | 118 | procedure zwp_relative_pointer_v1_relative_motion_Intf(AData: PWLUserData; Azwp_relative_pointer_v1: Pzwp_relative_pointer_v1; AUtimeHi: DWord; AUtimeLo: DWord; ADx: Longint{24.8}; ADy: Longint{24.8}; ADxUnaccel: Longint{24.8}; ADyUnaccel: Longint{24.8}); cdecl; 119 | var 120 | AIntf: IZwpRelativePointerV1Listener; 121 | begin 122 | if AData = nil then Exit; 123 | AIntf := IZwpRelativePointerV1Listener(AData^.ListenerUserData); 124 | AIntf.zwp_relative_pointer_v1_relative_motion(TZwpRelativePointerV1(AData^.PascalObject), AUtimeHi, AUtimeLo, Twl_fixed(ADx), Twl_fixed(ADy), Twl_fixed(ADxUnaccel), Twl_fixed(ADyUnaccel)); 125 | end; 126 | 127 | 128 | 129 | const 130 | pInterfaces: array[0..9] of Pwl_interface = ( 131 | (nil), 132 | (nil), 133 | (nil), 134 | (nil), 135 | (nil), 136 | (nil), 137 | (nil), 138 | (nil), 139 | (@zwp_relative_pointer_v1_interface), 140 | (@wl_pointer_interface) 141 | ); 142 | 143 | zwp_relative_pointer_manager_v1_requests: array[0..1] of Twl_message = ( 144 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 145 | (name: 'get_relative_pointer'; signature: 'no'; types: @pInterfaces[8]) 146 | ); 147 | zwp_relative_pointer_v1_requests: array[0..0] of Twl_message = ( 148 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 149 | ); 150 | zwp_relative_pointer_v1_events: array[0..0] of Twl_message = ( 151 | (name: 'relative_motion'; signature: 'uuffff'; types: @pInterfaces[0]) 152 | ); 153 | 154 | initialization 155 | Pointer(vIntf_zwp_relative_pointer_v1_Listener.relative_motion) := @zwp_relative_pointer_v1_relative_motion_Intf; 156 | 157 | 158 | zwp_relative_pointer_manager_v1_interface.name := 'zwp_relative_pointer_manager_v1'; 159 | zwp_relative_pointer_manager_v1_interface.version := 1; 160 | zwp_relative_pointer_manager_v1_interface.method_count := 2; 161 | zwp_relative_pointer_manager_v1_interface.methods := @zwp_relative_pointer_manager_v1_requests; 162 | zwp_relative_pointer_manager_v1_interface.event_count := 0; 163 | zwp_relative_pointer_manager_v1_interface.events := nil; 164 | 165 | zwp_relative_pointer_v1_interface.name := 'zwp_relative_pointer_v1'; 166 | zwp_relative_pointer_v1_interface.version := 1; 167 | zwp_relative_pointer_v1_interface.method_count := 1; 168 | zwp_relative_pointer_v1_interface.methods := @zwp_relative_pointer_v1_requests; 169 | zwp_relative_pointer_v1_interface.event_count := 1; 170 | zwp_relative_pointer_v1_interface.events := @zwp_relative_pointer_v1_events; 171 | 172 | end. 173 | -------------------------------------------------------------------------------- /waylandunstablepkg/text_input_unstable_v3_protocol.pas: -------------------------------------------------------------------------------- 1 | unit text_input_unstable_v3_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_text_input_v3 = Pointer; 14 | Pzwp_text_input_manager_v3 = Pointer; 15 | const 16 | ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD = 0; // input method caused the change 17 | ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER = 1; // something else than the input method caused the change 18 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE = $0; // no special behavior 19 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION = $1; // suggest word completions 20 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK = $2; // suggest word corrections 21 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION = $4; // switch to uppercase letters at the start of a sentence 22 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE = $8; // prefer lowercase letters 23 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE = $10; // prefer uppercase letters 24 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_TITLECASE = $20; // prefer casing for titles and headings (can be language dependent) 25 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT = $40; // characters should be hidden 26 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA = $80; // typed text should not be stored 27 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN = $100; // just Latin characters should be entered 28 | ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE = $200; // the text input is multiline 29 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL = 0; // default input, allowing all characters 30 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_ALPHA = 1; // allow only alphabetic characters 31 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DIGITS = 2; // allow only digits 32 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER = 3; // input a number (including decimal separator and sign) 33 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE = 4; // input a phone number 34 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL = 5; // input an URL 35 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL = 6; // input an email address 36 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NAME = 7; // input a name of a person 37 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PASSWORD = 8; // input a password (combine with sensitive_data hint) 38 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PIN = 9; // input is a numeric password (combine with sensitive_data hint) 39 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE = 10; // input a date 40 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME = 11; // input a time 41 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME = 12; // input a date and time 42 | ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL = 13; // input for a terminal 43 | 44 | type 45 | Pzwp_text_input_v3_listener = ^Tzwp_text_input_v3_listener; 46 | Tzwp_text_input_v3_listener = record 47 | enter : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; ASurface: Pwl_surface); cdecl; 48 | leave : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; ASurface: Pwl_surface); cdecl; 49 | preedit_string : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; AText: Pchar; ACursorBegin: LongInt; ACursorEnd: LongInt); cdecl; 50 | commit_string : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; AText: Pchar); cdecl; 51 | delete_surrounding_text : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; ABeforeLength: DWord; AAfterLength: DWord); cdecl; 52 | done : procedure(data: Pointer; AZwpTextInputV3: Pzwp_text_input_v3; ASerial: DWord); cdecl; 53 | end; 54 | 55 | Pzwp_text_input_manager_v3_listener = ^Tzwp_text_input_manager_v3_listener; 56 | Tzwp_text_input_manager_v3_listener = record 57 | end; 58 | 59 | 60 | 61 | TZwpTextInputV3 = class; 62 | TZwpTextInputManagerV3 = class; 63 | 64 | 65 | IZwpTextInputV3Listener = interface 66 | ['IZwpTextInputV3Listener'] 67 | procedure zwp_text_input_v3_enter(AZwpTextInputV3: TZwpTextInputV3; ASurface: TWlSurface); 68 | procedure zwp_text_input_v3_leave(AZwpTextInputV3: TZwpTextInputV3; ASurface: TWlSurface); 69 | procedure zwp_text_input_v3_preedit_string(AZwpTextInputV3: TZwpTextInputV3; AText: String; ACursorBegin: LongInt; ACursorEnd: LongInt); 70 | procedure zwp_text_input_v3_commit_string(AZwpTextInputV3: TZwpTextInputV3; AText: String); 71 | procedure zwp_text_input_v3_delete_surrounding_text(AZwpTextInputV3: TZwpTextInputV3; ABeforeLength: DWord; AAfterLength: DWord); 72 | procedure zwp_text_input_v3_done(AZwpTextInputV3: TZwpTextInputV3; ASerial: DWord); 73 | end; 74 | 75 | IZwpTextInputManagerV3Listener = interface 76 | ['IZwpTextInputManagerV3Listener'] 77 | end; 78 | 79 | 80 | 81 | 82 | TZwpTextInputV3 = class(TWLProxyObject) 83 | private 84 | const _DESTROY = 0; 85 | const _ENABLE = 1; 86 | const _DISABLE = 2; 87 | const _SET_SURROUNDING_TEXT = 3; 88 | const _SET_TEXT_CHANGE_CAUSE = 4; 89 | const _SET_CONTENT_TYPE = 5; 90 | const _SET_CURSOR_RECTANGLE = 6; 91 | const _COMMIT = 7; 92 | public 93 | destructor Destroy; override; 94 | procedure Enable; 95 | procedure Disable; 96 | procedure SetSurroundingText(AText: String; ACursor: LongInt; AAnchor: LongInt); 97 | procedure SetTextChangeCause(ACause: DWord); 98 | procedure SetContentType(AHint: DWord; APurpose: DWord); 99 | procedure SetCursorRectangle(AX: LongInt; AY: LongInt; AWidth: LongInt; AHeight: LongInt); 100 | procedure Commit; 101 | function AddListener(AIntf: IZwpTextInputV3Listener): LongInt; 102 | end; 103 | 104 | TZwpTextInputManagerV3 = class(TWLProxyObject) 105 | private 106 | const _DESTROY = 0; 107 | const _GET_TEXT_INPUT = 1; 108 | public 109 | destructor Destroy; override; 110 | function GetTextInput(ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpTextInputV3}): TZwpTextInputV3; 111 | function AddListener(AIntf: IZwpTextInputManagerV3Listener): LongInt; 112 | end; 113 | 114 | 115 | 116 | 117 | 118 | 119 | var 120 | zwp_text_input_v3_interface: Twl_interface; 121 | zwp_text_input_manager_v3_interface: Twl_interface; 122 | 123 | 124 | 125 | implementation 126 | 127 | var 128 | vIntf_zwp_text_input_v3_Listener: Tzwp_text_input_v3_listener; 129 | vIntf_zwp_text_input_manager_v3_Listener: Tzwp_text_input_manager_v3_listener; 130 | 131 | 132 | 133 | destructor TZwpTextInputV3.Destroy; 134 | begin 135 | wl_proxy_marshal(FProxy, _DESTROY); 136 | inherited Destroy; 137 | end; 138 | 139 | procedure TZwpTextInputV3.Enable; 140 | begin 141 | wl_proxy_marshal(FProxy, _ENABLE); 142 | end; 143 | 144 | procedure TZwpTextInputV3.Disable; 145 | begin 146 | wl_proxy_marshal(FProxy, _DISABLE); 147 | end; 148 | 149 | procedure TZwpTextInputV3.SetSurroundingText(AText: String; ACursor: LongInt; AAnchor: LongInt); 150 | begin 151 | wl_proxy_marshal(FProxy, _SET_SURROUNDING_TEXT, PChar(AText), ACursor, AAnchor); 152 | end; 153 | 154 | procedure TZwpTextInputV3.SetTextChangeCause(ACause: DWord); 155 | begin 156 | wl_proxy_marshal(FProxy, _SET_TEXT_CHANGE_CAUSE, ACause); 157 | end; 158 | 159 | procedure TZwpTextInputV3.SetContentType(AHint: DWord; APurpose: DWord); 160 | begin 161 | wl_proxy_marshal(FProxy, _SET_CONTENT_TYPE, AHint, APurpose); 162 | end; 163 | 164 | procedure TZwpTextInputV3.SetCursorRectangle(AX: LongInt; AY: LongInt; AWidth: LongInt; AHeight: LongInt); 165 | begin 166 | wl_proxy_marshal(FProxy, _SET_CURSOR_RECTANGLE, AX, AY, AWidth, AHeight); 167 | end; 168 | 169 | procedure TZwpTextInputV3.Commit; 170 | begin 171 | wl_proxy_marshal(FProxy, _COMMIT); 172 | end; 173 | 174 | function TZwpTextInputV3.AddListener(AIntf: IZwpTextInputV3Listener): LongInt; 175 | begin 176 | FUserDataRec.ListenerUserData := Pointer(AIntf); 177 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_text_input_v3_Listener, @FUserDataRec); 178 | end; 179 | destructor TZwpTextInputManagerV3.Destroy; 180 | begin 181 | wl_proxy_marshal(FProxy, _DESTROY); 182 | inherited Destroy; 183 | end; 184 | 185 | function TZwpTextInputManagerV3.GetTextInput(ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpTextInputV3}): TZwpTextInputV3; 186 | var 187 | id: Pwl_proxy; 188 | begin 189 | id := wl_proxy_marshal_constructor(FProxy, 190 | _GET_TEXT_INPUT, @zwp_text_input_v3_interface, nil, ASeat.Proxy); 191 | if AProxyClass = nil then 192 | AProxyClass := TZwpTextInputV3; 193 | if not AProxyClass.InheritsFrom(TZwpTextInputV3) then 194 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpTextInputV3]); 195 | Result := TZwpTextInputV3(AProxyClass.Create(id)); 196 | end; 197 | 198 | function TZwpTextInputManagerV3.AddListener(AIntf: IZwpTextInputManagerV3Listener): LongInt; 199 | begin 200 | FUserDataRec.ListenerUserData := Pointer(AIntf); 201 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_text_input_manager_v3_Listener, @FUserDataRec); 202 | end; 203 | 204 | 205 | 206 | 207 | procedure zwp_text_input_v3_enter_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; ASurface: Pwl_surface); cdecl; 208 | var 209 | AIntf: IZwpTextInputV3Listener; 210 | begin 211 | if AData = nil then Exit; 212 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 213 | AIntf.zwp_text_input_v3_enter(TZwpTextInputV3(AData^.PascalObject), TWlSurface(TWLProxyObject.WLToObj(ASurface))); 214 | end; 215 | 216 | procedure zwp_text_input_v3_leave_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; ASurface: Pwl_surface); cdecl; 217 | var 218 | AIntf: IZwpTextInputV3Listener; 219 | begin 220 | if AData = nil then Exit; 221 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 222 | AIntf.zwp_text_input_v3_leave(TZwpTextInputV3(AData^.PascalObject), TWlSurface(TWLProxyObject.WLToObj(ASurface))); 223 | end; 224 | 225 | procedure zwp_text_input_v3_preedit_string_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; AText: Pchar; ACursorBegin: LongInt; ACursorEnd: LongInt); cdecl; 226 | var 227 | AIntf: IZwpTextInputV3Listener; 228 | begin 229 | if AData = nil then Exit; 230 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 231 | AIntf.zwp_text_input_v3_preedit_string(TZwpTextInputV3(AData^.PascalObject), AText, ACursorBegin, ACursorEnd); 232 | end; 233 | 234 | procedure zwp_text_input_v3_commit_string_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; AText: Pchar); cdecl; 235 | var 236 | AIntf: IZwpTextInputV3Listener; 237 | begin 238 | if AData = nil then Exit; 239 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 240 | AIntf.zwp_text_input_v3_commit_string(TZwpTextInputV3(AData^.PascalObject), AText); 241 | end; 242 | 243 | procedure zwp_text_input_v3_delete_surrounding_text_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; ABeforeLength: DWord; AAfterLength: DWord); cdecl; 244 | var 245 | AIntf: IZwpTextInputV3Listener; 246 | begin 247 | if AData = nil then Exit; 248 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 249 | AIntf.zwp_text_input_v3_delete_surrounding_text(TZwpTextInputV3(AData^.PascalObject), ABeforeLength, AAfterLength); 250 | end; 251 | 252 | procedure zwp_text_input_v3_done_Intf(AData: PWLUserData; Azwp_text_input_v3: Pzwp_text_input_v3; ASerial: DWord); cdecl; 253 | var 254 | AIntf: IZwpTextInputV3Listener; 255 | begin 256 | if AData = nil then Exit; 257 | AIntf := IZwpTextInputV3Listener(AData^.ListenerUserData); 258 | AIntf.zwp_text_input_v3_done(TZwpTextInputV3(AData^.PascalObject), ASerial); 259 | end; 260 | 261 | 262 | 263 | const 264 | pInterfaces: array[0..11] of Pwl_interface = ( 265 | (nil), 266 | (nil), 267 | (nil), 268 | (nil), 269 | (nil), 270 | (nil), 271 | (nil), 272 | (nil), 273 | (@wl_surface_interface), 274 | (@wl_surface_interface), 275 | (@zwp_text_input_v3_interface), 276 | (@wl_seat_interface) 277 | ); 278 | 279 | zwp_text_input_v3_requests: array[0..7] of Twl_message = ( 280 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 281 | (name: 'enable'; signature: ''; types: @pInterfaces[0]), 282 | (name: 'disable'; signature: ''; types: @pInterfaces[0]), 283 | (name: 'set_surrounding_text'; signature: 'sii'; types: @pInterfaces[0]), 284 | (name: 'set_text_change_cause'; signature: 'u'; types: @pInterfaces[0]), 285 | (name: 'set_content_type'; signature: 'uu'; types: @pInterfaces[0]), 286 | (name: 'set_cursor_rectangle'; signature: 'iiii'; types: @pInterfaces[0]), 287 | (name: 'commit'; signature: ''; types: @pInterfaces[0]) 288 | ); 289 | zwp_text_input_v3_events: array[0..5] of Twl_message = ( 290 | (name: 'enter'; signature: 'o'; types: @pInterfaces[8]), 291 | (name: 'leave'; signature: 'o'; types: @pInterfaces[9]), 292 | (name: 'preedit_string'; signature: '?sii'; types: @pInterfaces[0]), 293 | (name: 'commit_string'; signature: '?s'; types: @pInterfaces[0]), 294 | (name: 'delete_surrounding_text'; signature: 'uu'; types: @pInterfaces[0]), 295 | (name: 'done'; signature: 'u'; types: @pInterfaces[0]) 296 | ); 297 | zwp_text_input_manager_v3_requests: array[0..1] of Twl_message = ( 298 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 299 | (name: 'get_text_input'; signature: 'no'; types: @pInterfaces[10]) 300 | ); 301 | 302 | initialization 303 | Pointer(vIntf_zwp_text_input_v3_Listener.enter) := @zwp_text_input_v3_enter_Intf; 304 | Pointer(vIntf_zwp_text_input_v3_Listener.leave) := @zwp_text_input_v3_leave_Intf; 305 | Pointer(vIntf_zwp_text_input_v3_Listener.preedit_string) := @zwp_text_input_v3_preedit_string_Intf; 306 | Pointer(vIntf_zwp_text_input_v3_Listener.commit_string) := @zwp_text_input_v3_commit_string_Intf; 307 | Pointer(vIntf_zwp_text_input_v3_Listener.delete_surrounding_text) := @zwp_text_input_v3_delete_surrounding_text_Intf; 308 | Pointer(vIntf_zwp_text_input_v3_Listener.done) := @zwp_text_input_v3_done_Intf; 309 | 310 | 311 | zwp_text_input_v3_interface.name := 'zwp_text_input_v3'; 312 | zwp_text_input_v3_interface.version := 1; 313 | zwp_text_input_v3_interface.method_count := 8; 314 | zwp_text_input_v3_interface.methods := @zwp_text_input_v3_requests; 315 | zwp_text_input_v3_interface.event_count := 6; 316 | zwp_text_input_v3_interface.events := @zwp_text_input_v3_events; 317 | 318 | zwp_text_input_manager_v3_interface.name := 'zwp_text_input_manager_v3'; 319 | zwp_text_input_manager_v3_interface.version := 1; 320 | zwp_text_input_manager_v3_interface.method_count := 2; 321 | zwp_text_input_manager_v3_interface.methods := @zwp_text_input_manager_v3_requests; 322 | zwp_text_input_manager_v3_interface.event_count := 0; 323 | zwp_text_input_manager_v3_interface.events := nil; 324 | 325 | end. 326 | -------------------------------------------------------------------------------- /waylandunstablepkg/waylandunstablepkg.lpk: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <CONFIG> 3 | <Package Version="5"> 4 | <Name Value="WaylandUnstablePkg"/> 5 | <Type Value="RunAndDesignTime"/> 6 | <CompilerOptions> 7 | <Version Value="11"/> 8 | <SearchPaths> 9 | <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 10 | </SearchPaths> 11 | </CompilerOptions> 12 | <Files Count="22"> 13 | <Item1> 14 | <Filename Value="fullscreen_shell_unstable_v1_protocol.pas"/> 15 | <UnitName Value="fullscreen_shell_unstable_v1_protocol"/> 16 | </Item1> 17 | <Item2> 18 | <Filename Value="idle_inhibit_unstable_v1_protocol.pas"/> 19 | <UnitName Value="idle_inhibit_unstable_v1_protocol"/> 20 | </Item2> 21 | <Item3> 22 | <Filename Value="input_method_unstable_v1_protocol.pas"/> 23 | <UnitName Value="input_method_unstable_v1_protocol"/> 24 | </Item3> 25 | <Item4> 26 | <Filename Value="input_timestamps_unstable_v1_protocol.pas"/> 27 | <UnitName Value="input_timestamps_unstable_v1_protocol"/> 28 | </Item4> 29 | <Item5> 30 | <Filename Value="keyboard_shortcuts_inhibit_unstable_v1_protocol.pas"/> 31 | <UnitName Value="keyboard_shortcuts_inhibit_unstable_v1_protocol"/> 32 | </Item5> 33 | <Item6> 34 | <Filename Value="linux_dmabuf_unstable_v1_protocol.pas"/> 35 | <UnitName Value="linux_dmabuf_unstable_v1_protocol"/> 36 | </Item6> 37 | <Item7> 38 | <Filename Value="linux_explicit_synchronization_unstable_v1_protocol.pas"/> 39 | <UnitName Value="linux_explicit_synchronization_unstable_v1_protocol"/> 40 | </Item7> 41 | <Item8> 42 | <Filename Value="pointer_constraints_unstable_v1_protocol.pas"/> 43 | <UnitName Value="pointer_constraints_unstable_v1_protocol"/> 44 | </Item8> 45 | <Item9> 46 | <Filename Value="pointer_gestures_unstable_v1_protocol.pas"/> 47 | <UnitName Value="pointer_gestures_unstable_v1_protocol"/> 48 | </Item9> 49 | <Item10> 50 | <Filename Value="primary_selection_unstable_v1_protocol.pas"/> 51 | <UnitName Value="primary_selection_unstable_v1_protocol"/> 52 | </Item10> 53 | <Item11> 54 | <Filename Value="relative_pointer_unstable_v1_protocol.pas"/> 55 | <UnitName Value="relative_pointer_unstable_v1_protocol"/> 56 | </Item11> 57 | <Item12> 58 | <Filename Value="tablet_unstable_v1_protocol.pas"/> 59 | <UnitName Value="tablet_unstable_v1_protocol"/> 60 | </Item12> 61 | <Item13> 62 | <Filename Value="tablet_unstable_v2_protocol.pas"/> 63 | <UnitName Value="tablet_unstable_v2_protocol"/> 64 | </Item13> 65 | <Item14> 66 | <Filename Value="text_input_unstable_v1_protocol.pas"/> 67 | <UnitName Value="text_input_unstable_v1_protocol"/> 68 | </Item14> 69 | <Item15> 70 | <Filename Value="text_input_unstable_v3_protocol.pas"/> 71 | <UnitName Value="text_input_unstable_v3_protocol"/> 72 | </Item15> 73 | <Item16> 74 | <Filename Value="xdg_decoration_unstable_v1_protocol.pas"/> 75 | <UnitName Value="xdg_decoration_unstable_v1_protocol"/> 76 | </Item16> 77 | <Item17> 78 | <Filename Value="xdg_foreign_unstable_v1_protocol.pas"/> 79 | <UnitName Value="xdg_foreign_unstable_v1_protocol"/> 80 | </Item17> 81 | <Item18> 82 | <Filename Value="xdg_foreign_unstable_v2_protocol.pas"/> 83 | <UnitName Value="xdg_foreign_unstable_v2_protocol"/> 84 | </Item18> 85 | <Item19> 86 | <Filename Value="xdg_output_unstable_v1_protocol.pas"/> 87 | <UnitName Value="xdg_output_unstable_v1_protocol"/> 88 | </Item19> 89 | <Item20> 90 | <Filename Value="xdg_shell_unstable_v5_protocol.pas"/> 91 | <UnitName Value="xdg_shell_unstable_v5_protocol"/> 92 | </Item20> 93 | <Item21> 94 | <Filename Value="xdg_shell_unstable_v6_protocol.pas"/> 95 | <UnitName Value="xdg_shell_unstable_v6_protocol"/> 96 | </Item21> 97 | <Item22> 98 | <Filename Value="xwayland_keyboard_grab_unstable_v1_protocol.pas"/> 99 | <UnitName Value="xwayland_keyboard_grab_unstable_v1_protocol"/> 100 | </Item22> 101 | </Files> 102 | <CompatibilityMode Value="True"/> 103 | <RequiredPkgs Count="3"> 104 | <Item1> 105 | <PackageName Value="WaylandStablePkg"/> 106 | </Item1> 107 | <Item2> 108 | <PackageName Value="WaylandPkg"/> 109 | </Item2> 110 | <Item3> 111 | <PackageName Value="FCL"/> 112 | </Item3> 113 | </RequiredPkgs> 114 | <UsageOptions> 115 | <UnitPath Value="$(PkgOutDir)"/> 116 | </UsageOptions> 117 | <PublishOptions> 118 | <Version Value="2"/> 119 | </PublishOptions> 120 | </Package> 121 | </CONFIG> 122 | -------------------------------------------------------------------------------- /waylandunstablepkg/waylandunstablepkg.pas: -------------------------------------------------------------------------------- 1 | { This file was automatically created by Lazarus. Do not edit! 2 | This source is only used to compile and install the package. 3 | } 4 | 5 | unit WaylandUnstablePkg; 6 | 7 | {$warn 5023 off : no warning about unused units} 8 | interface 9 | 10 | uses 11 | fullscreen_shell_unstable_v1_protocol, idle_inhibit_unstable_v1_protocol, 12 | input_method_unstable_v1_protocol, input_timestamps_unstable_v1_protocol, 13 | keyboard_shortcuts_inhibit_unstable_v1_protocol, 14 | linux_dmabuf_unstable_v1_protocol, 15 | linux_explicit_synchronization_unstable_v1_protocol, 16 | pointer_constraints_unstable_v1_protocol, 17 | pointer_gestures_unstable_v1_protocol, 18 | primary_selection_unstable_v1_protocol, 19 | relative_pointer_unstable_v1_protocol, tablet_unstable_v1_protocol, 20 | tablet_unstable_v2_protocol, text_input_unstable_v1_protocol, 21 | text_input_unstable_v3_protocol, xdg_decoration_unstable_v1_protocol, 22 | xdg_foreign_unstable_v1_protocol, xdg_foreign_unstable_v2_protocol, 23 | xdg_output_unstable_v1_protocol, xdg_shell_unstable_v5_protocol, 24 | xdg_shell_unstable_v6_protocol, xwayland_keyboard_grab_unstable_v1_protocol, 25 | LazarusPackageIntf; 26 | 27 | implementation 28 | 29 | procedure Register; 30 | begin 31 | end; 32 | 33 | initialization 34 | RegisterPackage('WaylandUnstablePkg', @Register); 35 | end. 36 | -------------------------------------------------------------------------------- /waylandunstablepkg/xdg_decoration_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit xdg_decoration_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzxdg_decoration_manager_v1 = Pointer; 14 | Pzxdg_toplevel_decoration_v1 = Pointer; 15 | Pzxdg_decoration_manager_v1_listener = ^Tzxdg_decoration_manager_v1_listener; 16 | Tzxdg_decoration_manager_v1_listener = record 17 | end; 18 | 19 | const 20 | ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0; // xdg_toplevel has a buffer attached before configure 21 | ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1; // xdg_toplevel already has a decoration object 22 | ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2; // xdg_toplevel destroyed before the decoration object 23 | ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1; // no server-side window decoration 24 | ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2; // server-side window decoration 25 | 26 | type 27 | Pzxdg_toplevel_decoration_v1_listener = ^Tzxdg_toplevel_decoration_v1_listener; 28 | Tzxdg_toplevel_decoration_v1_listener = record 29 | configure : procedure(data: Pointer; AZxdgToplevelDecorationV1: Pzxdg_toplevel_decoration_v1; AMode: DWord); cdecl; 30 | end; 31 | 32 | 33 | 34 | TZxdgDecorationManagerV1 = class; 35 | TZxdgToplevelDecorationV1 = class; 36 | 37 | 38 | IZxdgDecorationManagerV1Listener = interface 39 | ['IZxdgDecorationManagerV1Listener'] 40 | end; 41 | 42 | IZxdgToplevelDecorationV1Listener = interface 43 | ['IZxdgToplevelDecorationV1Listener'] 44 | procedure zxdg_toplevel_decoration_v1_configure(AZxdgToplevelDecorationV1: TZxdgToplevelDecorationV1; AMode: DWord); 45 | end; 46 | 47 | 48 | 49 | 50 | TZxdgDecorationManagerV1 = class(TWLProxyObject) 51 | private 52 | const _DESTROY = 0; 53 | const _GET_TOPLEVEL_DECORATION = 1; 54 | public 55 | destructor Destroy; override; 56 | function GetToplevelDecoration(AToplevel: TXdgToplevel; AProxyClass: TWLProxyObjectClass = nil {TZxdgToplevelDecorationV1}): TZxdgToplevelDecorationV1; 57 | function AddListener(AIntf: IZxdgDecorationManagerV1Listener): LongInt; 58 | end; 59 | 60 | TZxdgToplevelDecorationV1 = class(TWLProxyObject) 61 | private 62 | const _DESTROY = 0; 63 | const _SET_MODE = 1; 64 | const _UNSET_MODE = 2; 65 | public 66 | destructor Destroy; override; 67 | procedure SetMode(AMode: DWord); 68 | procedure UnsetMode; 69 | function AddListener(AIntf: IZxdgToplevelDecorationV1Listener): LongInt; 70 | end; 71 | 72 | 73 | 74 | 75 | 76 | 77 | var 78 | zxdg_decoration_manager_v1_interface: Twl_interface; 79 | zxdg_toplevel_decoration_v1_interface: Twl_interface; 80 | 81 | 82 | 83 | implementation 84 | 85 | var 86 | vIntf_zxdg_decoration_manager_v1_Listener: Tzxdg_decoration_manager_v1_listener; 87 | vIntf_zxdg_toplevel_decoration_v1_Listener: Tzxdg_toplevel_decoration_v1_listener; 88 | 89 | 90 | 91 | destructor TZxdgDecorationManagerV1.Destroy; 92 | begin 93 | wl_proxy_marshal(FProxy, _DESTROY); 94 | inherited Destroy; 95 | end; 96 | 97 | function TZxdgDecorationManagerV1.GetToplevelDecoration(AToplevel: TXdgToplevel; AProxyClass: TWLProxyObjectClass = nil {TZxdgToplevelDecorationV1}): TZxdgToplevelDecorationV1; 98 | var 99 | id: Pwl_proxy; 100 | begin 101 | id := wl_proxy_marshal_constructor(FProxy, 102 | _GET_TOPLEVEL_DECORATION, @zxdg_toplevel_decoration_v1_interface, nil, AToplevel.Proxy); 103 | if AProxyClass = nil then 104 | AProxyClass := TZxdgToplevelDecorationV1; 105 | if not AProxyClass.InheritsFrom(TZxdgToplevelDecorationV1) then 106 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgToplevelDecorationV1]); 107 | Result := TZxdgToplevelDecorationV1(AProxyClass.Create(id)); 108 | end; 109 | 110 | function TZxdgDecorationManagerV1.AddListener(AIntf: IZxdgDecorationManagerV1Listener): LongInt; 111 | begin 112 | FUserDataRec.ListenerUserData := Pointer(AIntf); 113 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_decoration_manager_v1_Listener, @FUserDataRec); 114 | end; 115 | destructor TZxdgToplevelDecorationV1.Destroy; 116 | begin 117 | wl_proxy_marshal(FProxy, _DESTROY); 118 | inherited Destroy; 119 | end; 120 | 121 | procedure TZxdgToplevelDecorationV1.SetMode(AMode: DWord); 122 | begin 123 | wl_proxy_marshal(FProxy, _SET_MODE, AMode); 124 | end; 125 | 126 | procedure TZxdgToplevelDecorationV1.UnsetMode; 127 | begin 128 | wl_proxy_marshal(FProxy, _UNSET_MODE); 129 | end; 130 | 131 | function TZxdgToplevelDecorationV1.AddListener(AIntf: IZxdgToplevelDecorationV1Listener): LongInt; 132 | begin 133 | FUserDataRec.ListenerUserData := Pointer(AIntf); 134 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_toplevel_decoration_v1_Listener, @FUserDataRec); 135 | end; 136 | 137 | 138 | 139 | 140 | procedure zxdg_toplevel_decoration_v1_configure_Intf(AData: PWLUserData; Azxdg_toplevel_decoration_v1: Pzxdg_toplevel_decoration_v1; AMode: DWord); cdecl; 141 | var 142 | AIntf: IZxdgToplevelDecorationV1Listener; 143 | begin 144 | if AData = nil then Exit; 145 | AIntf := IZxdgToplevelDecorationV1Listener(AData^.ListenerUserData); 146 | AIntf.zxdg_toplevel_decoration_v1_configure(TZxdgToplevelDecorationV1(AData^.PascalObject), AMode); 147 | end; 148 | 149 | 150 | 151 | const 152 | pInterfaces: array[0..9] of Pwl_interface = ( 153 | (nil), 154 | (nil), 155 | (nil), 156 | (nil), 157 | (nil), 158 | (nil), 159 | (nil), 160 | (nil), 161 | (@zxdg_toplevel_decoration_v1_interface), 162 | (@xdg_toplevel_interface) 163 | ); 164 | 165 | zxdg_decoration_manager_v1_requests: array[0..1] of Twl_message = ( 166 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 167 | (name: 'get_toplevel_decoration'; signature: 'no'; types: @pInterfaces[8]) 168 | ); 169 | zxdg_toplevel_decoration_v1_requests: array[0..2] of Twl_message = ( 170 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 171 | (name: 'set_mode'; signature: 'u'; types: @pInterfaces[0]), 172 | (name: 'unset_mode'; signature: ''; types: @pInterfaces[0]) 173 | ); 174 | zxdg_toplevel_decoration_v1_events: array[0..0] of Twl_message = ( 175 | (name: 'configure'; signature: 'u'; types: @pInterfaces[0]) 176 | ); 177 | 178 | initialization 179 | Pointer(vIntf_zxdg_toplevel_decoration_v1_Listener.configure) := @zxdg_toplevel_decoration_v1_configure_Intf; 180 | 181 | 182 | zxdg_decoration_manager_v1_interface.name := 'zxdg_decoration_manager_v1'; 183 | zxdg_decoration_manager_v1_interface.version := 1; 184 | zxdg_decoration_manager_v1_interface.method_count := 2; 185 | zxdg_decoration_manager_v1_interface.methods := @zxdg_decoration_manager_v1_requests; 186 | zxdg_decoration_manager_v1_interface.event_count := 0; 187 | zxdg_decoration_manager_v1_interface.events := nil; 188 | 189 | zxdg_toplevel_decoration_v1_interface.name := 'zxdg_toplevel_decoration_v1'; 190 | zxdg_toplevel_decoration_v1_interface.version := 1; 191 | zxdg_toplevel_decoration_v1_interface.method_count := 3; 192 | zxdg_toplevel_decoration_v1_interface.methods := @zxdg_toplevel_decoration_v1_requests; 193 | zxdg_toplevel_decoration_v1_interface.event_count := 1; 194 | zxdg_toplevel_decoration_v1_interface.events := @zxdg_toplevel_decoration_v1_events; 195 | 196 | end. 197 | -------------------------------------------------------------------------------- /waylandunstablepkg/xdg_foreign_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit xdg_foreign_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzxdg_exporter_v1 = Pointer; 14 | Pzxdg_importer_v1 = Pointer; 15 | Pzxdg_exported_v1 = Pointer; 16 | Pzxdg_imported_v1 = Pointer; 17 | Pzxdg_exporter_v1_listener = ^Tzxdg_exporter_v1_listener; 18 | Tzxdg_exporter_v1_listener = record 19 | end; 20 | 21 | Pzxdg_importer_v1_listener = ^Tzxdg_importer_v1_listener; 22 | Tzxdg_importer_v1_listener = record 23 | end; 24 | 25 | Pzxdg_exported_v1_listener = ^Tzxdg_exported_v1_listener; 26 | Tzxdg_exported_v1_listener = record 27 | handle : procedure(data: Pointer; AZxdgExportedV1: Pzxdg_exported_v1; AHandle: Pchar); cdecl; 28 | end; 29 | 30 | Pzxdg_imported_v1_listener = ^Tzxdg_imported_v1_listener; 31 | Tzxdg_imported_v1_listener = record 32 | destroyed : procedure(data: Pointer; AZxdgImportedV1: Pzxdg_imported_v1); cdecl; 33 | end; 34 | 35 | 36 | 37 | TZxdgExporterV1 = class; 38 | TZxdgImporterV1 = class; 39 | TZxdgExportedV1 = class; 40 | TZxdgImportedV1 = class; 41 | 42 | 43 | IZxdgExporterV1Listener = interface 44 | ['IZxdgExporterV1Listener'] 45 | end; 46 | 47 | IZxdgImporterV1Listener = interface 48 | ['IZxdgImporterV1Listener'] 49 | end; 50 | 51 | IZxdgExportedV1Listener = interface 52 | ['IZxdgExportedV1Listener'] 53 | procedure zxdg_exported_v1_handle(AZxdgExportedV1: TZxdgExportedV1; AHandle: String); 54 | end; 55 | 56 | IZxdgImportedV1Listener = interface 57 | ['IZxdgImportedV1Listener'] 58 | procedure zxdg_imported_v1_destroyed(AZxdgImportedV1: TZxdgImportedV1); 59 | end; 60 | 61 | 62 | 63 | 64 | TZxdgExporterV1 = class(TWLProxyObject) 65 | private 66 | const _DESTROY = 0; 67 | const _EXPORT = 1; 68 | public 69 | destructor Destroy; override; 70 | function Export(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZxdgExportedV1}): TZxdgExportedV1; 71 | function AddListener(AIntf: IZxdgExporterV1Listener): LongInt; 72 | end; 73 | 74 | TZxdgImporterV1 = class(TWLProxyObject) 75 | private 76 | const _DESTROY = 0; 77 | const _IMPORT = 1; 78 | public 79 | destructor Destroy; override; 80 | function Import(AHandle: String; AProxyClass: TWLProxyObjectClass = nil {TZxdgImportedV1}): TZxdgImportedV1; 81 | function AddListener(AIntf: IZxdgImporterV1Listener): LongInt; 82 | end; 83 | 84 | TZxdgExportedV1 = class(TWLProxyObject) 85 | private 86 | const _DESTROY = 0; 87 | public 88 | destructor Destroy; override; 89 | function AddListener(AIntf: IZxdgExportedV1Listener): LongInt; 90 | end; 91 | 92 | TZxdgImportedV1 = class(TWLProxyObject) 93 | private 94 | const _DESTROY = 0; 95 | const _SET_PARENT_OF = 1; 96 | public 97 | destructor Destroy; override; 98 | procedure SetParentOf(ASurface: TWlSurface); 99 | function AddListener(AIntf: IZxdgImportedV1Listener): LongInt; 100 | end; 101 | 102 | 103 | 104 | 105 | 106 | 107 | var 108 | zxdg_exporter_v1_interface: Twl_interface; 109 | zxdg_importer_v1_interface: Twl_interface; 110 | zxdg_exported_v1_interface: Twl_interface; 111 | zxdg_imported_v1_interface: Twl_interface; 112 | 113 | 114 | 115 | implementation 116 | 117 | var 118 | vIntf_zxdg_exporter_v1_Listener: Tzxdg_exporter_v1_listener; 119 | vIntf_zxdg_importer_v1_Listener: Tzxdg_importer_v1_listener; 120 | vIntf_zxdg_exported_v1_Listener: Tzxdg_exported_v1_listener; 121 | vIntf_zxdg_imported_v1_Listener: Tzxdg_imported_v1_listener; 122 | 123 | 124 | 125 | destructor TZxdgExporterV1.Destroy; 126 | begin 127 | wl_proxy_marshal(FProxy, _DESTROY); 128 | inherited Destroy; 129 | end; 130 | 131 | function TZxdgExporterV1.Export(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZxdgExportedV1}): TZxdgExportedV1; 132 | var 133 | id: Pwl_proxy; 134 | begin 135 | id := wl_proxy_marshal_constructor(FProxy, 136 | _EXPORT, @zxdg_exported_v1_interface, nil, ASurface.Proxy); 137 | if AProxyClass = nil then 138 | AProxyClass := TZxdgExportedV1; 139 | if not AProxyClass.InheritsFrom(TZxdgExportedV1) then 140 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgExportedV1]); 141 | Result := TZxdgExportedV1(AProxyClass.Create(id)); 142 | end; 143 | 144 | function TZxdgExporterV1.AddListener(AIntf: IZxdgExporterV1Listener): LongInt; 145 | begin 146 | FUserDataRec.ListenerUserData := Pointer(AIntf); 147 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_exporter_v1_Listener, @FUserDataRec); 148 | end; 149 | destructor TZxdgImporterV1.Destroy; 150 | begin 151 | wl_proxy_marshal(FProxy, _DESTROY); 152 | inherited Destroy; 153 | end; 154 | 155 | function TZxdgImporterV1.Import(AHandle: String; AProxyClass: TWLProxyObjectClass = nil {TZxdgImportedV1}): TZxdgImportedV1; 156 | var 157 | id: Pwl_proxy; 158 | begin 159 | id := wl_proxy_marshal_constructor(FProxy, 160 | _IMPORT, @zxdg_imported_v1_interface, nil, PChar(AHandle)); 161 | if AProxyClass = nil then 162 | AProxyClass := TZxdgImportedV1; 163 | if not AProxyClass.InheritsFrom(TZxdgImportedV1) then 164 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgImportedV1]); 165 | Result := TZxdgImportedV1(AProxyClass.Create(id)); 166 | end; 167 | 168 | function TZxdgImporterV1.AddListener(AIntf: IZxdgImporterV1Listener): LongInt; 169 | begin 170 | FUserDataRec.ListenerUserData := Pointer(AIntf); 171 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_importer_v1_Listener, @FUserDataRec); 172 | end; 173 | destructor TZxdgExportedV1.Destroy; 174 | begin 175 | wl_proxy_marshal(FProxy, _DESTROY); 176 | inherited Destroy; 177 | end; 178 | 179 | function TZxdgExportedV1.AddListener(AIntf: IZxdgExportedV1Listener): LongInt; 180 | begin 181 | FUserDataRec.ListenerUserData := Pointer(AIntf); 182 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_exported_v1_Listener, @FUserDataRec); 183 | end; 184 | destructor TZxdgImportedV1.Destroy; 185 | begin 186 | wl_proxy_marshal(FProxy, _DESTROY); 187 | inherited Destroy; 188 | end; 189 | 190 | procedure TZxdgImportedV1.SetParentOf(ASurface: TWlSurface); 191 | begin 192 | wl_proxy_marshal(FProxy, _SET_PARENT_OF, ASurface.Proxy); 193 | end; 194 | 195 | function TZxdgImportedV1.AddListener(AIntf: IZxdgImportedV1Listener): LongInt; 196 | begin 197 | FUserDataRec.ListenerUserData := Pointer(AIntf); 198 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_imported_v1_Listener, @FUserDataRec); 199 | end; 200 | 201 | 202 | 203 | 204 | procedure zxdg_exported_v1_handle_Intf(AData: PWLUserData; Azxdg_exported_v1: Pzxdg_exported_v1; AHandle: Pchar); cdecl; 205 | var 206 | AIntf: IZxdgExportedV1Listener; 207 | begin 208 | if AData = nil then Exit; 209 | AIntf := IZxdgExportedV1Listener(AData^.ListenerUserData); 210 | AIntf.zxdg_exported_v1_handle(TZxdgExportedV1(AData^.PascalObject), AHandle); 211 | end; 212 | 213 | procedure zxdg_imported_v1_destroyed_Intf(AData: PWLUserData; Azxdg_imported_v1: Pzxdg_imported_v1); cdecl; 214 | var 215 | AIntf: IZxdgImportedV1Listener; 216 | begin 217 | if AData = nil then Exit; 218 | AIntf := IZxdgImportedV1Listener(AData^.ListenerUserData); 219 | AIntf.zxdg_imported_v1_destroyed(TZxdgImportedV1(AData^.PascalObject)); 220 | end; 221 | 222 | 223 | 224 | const 225 | pInterfaces: array[0..12] of Pwl_interface = ( 226 | (nil), 227 | (nil), 228 | (nil), 229 | (nil), 230 | (nil), 231 | (nil), 232 | (nil), 233 | (nil), 234 | (@zxdg_exported_v1_interface), 235 | (@wl_surface_interface), 236 | (@zxdg_imported_v1_interface), 237 | (nil), 238 | (@wl_surface_interface) 239 | ); 240 | 241 | zxdg_exporter_v1_requests: array[0..1] of Twl_message = ( 242 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 243 | (name: 'export'; signature: 'no'; types: @pInterfaces[8]) 244 | ); 245 | zxdg_importer_v1_requests: array[0..1] of Twl_message = ( 246 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 247 | (name: 'import'; signature: 'ns'; types: @pInterfaces[10]) 248 | ); 249 | zxdg_exported_v1_requests: array[0..0] of Twl_message = ( 250 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 251 | ); 252 | zxdg_exported_v1_events: array[0..0] of Twl_message = ( 253 | (name: 'handle'; signature: 's'; types: @pInterfaces[0]) 254 | ); 255 | zxdg_imported_v1_requests: array[0..1] of Twl_message = ( 256 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 257 | (name: 'set_parent_of'; signature: 'o'; types: @pInterfaces[12]) 258 | ); 259 | zxdg_imported_v1_events: array[0..0] of Twl_message = ( 260 | (name: 'destroyed'; signature: ''; types: @pInterfaces[0]) 261 | ); 262 | 263 | initialization 264 | Pointer(vIntf_zxdg_exported_v1_Listener.handle) := @zxdg_exported_v1_handle_Intf; 265 | Pointer(vIntf_zxdg_imported_v1_Listener.destroyed) := @zxdg_imported_v1_destroyed_Intf; 266 | 267 | 268 | zxdg_exporter_v1_interface.name := 'zxdg_exporter_v1'; 269 | zxdg_exporter_v1_interface.version := 1; 270 | zxdg_exporter_v1_interface.method_count := 2; 271 | zxdg_exporter_v1_interface.methods := @zxdg_exporter_v1_requests; 272 | zxdg_exporter_v1_interface.event_count := 0; 273 | zxdg_exporter_v1_interface.events := nil; 274 | 275 | zxdg_importer_v1_interface.name := 'zxdg_importer_v1'; 276 | zxdg_importer_v1_interface.version := 1; 277 | zxdg_importer_v1_interface.method_count := 2; 278 | zxdg_importer_v1_interface.methods := @zxdg_importer_v1_requests; 279 | zxdg_importer_v1_interface.event_count := 0; 280 | zxdg_importer_v1_interface.events := nil; 281 | 282 | zxdg_exported_v1_interface.name := 'zxdg_exported_v1'; 283 | zxdg_exported_v1_interface.version := 1; 284 | zxdg_exported_v1_interface.method_count := 1; 285 | zxdg_exported_v1_interface.methods := @zxdg_exported_v1_requests; 286 | zxdg_exported_v1_interface.event_count := 1; 287 | zxdg_exported_v1_interface.events := @zxdg_exported_v1_events; 288 | 289 | zxdg_imported_v1_interface.name := 'zxdg_imported_v1'; 290 | zxdg_imported_v1_interface.version := 1; 291 | zxdg_imported_v1_interface.method_count := 2; 292 | zxdg_imported_v1_interface.methods := @zxdg_imported_v1_requests; 293 | zxdg_imported_v1_interface.event_count := 1; 294 | zxdg_imported_v1_interface.events := @zxdg_imported_v1_events; 295 | 296 | end. 297 | -------------------------------------------------------------------------------- /waylandunstablepkg/xdg_foreign_unstable_v2_protocol.pas: -------------------------------------------------------------------------------- 1 | unit xdg_foreign_unstable_v2_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzxdg_exporter_v2 = Pointer; 14 | Pzxdg_importer_v2 = Pointer; 15 | Pzxdg_exported_v2 = Pointer; 16 | Pzxdg_imported_v2 = Pointer; 17 | const 18 | ZXDG_EXPORTER_V2_ERROR_INVALID_SURFACE = 0; // surface is not an xdg_toplevel 19 | 20 | type 21 | Pzxdg_exporter_v2_listener = ^Tzxdg_exporter_v2_listener; 22 | Tzxdg_exporter_v2_listener = record 23 | end; 24 | 25 | Pzxdg_importer_v2_listener = ^Tzxdg_importer_v2_listener; 26 | Tzxdg_importer_v2_listener = record 27 | end; 28 | 29 | Pzxdg_exported_v2_listener = ^Tzxdg_exported_v2_listener; 30 | Tzxdg_exported_v2_listener = record 31 | handle : procedure(data: Pointer; AZxdgExportedV2: Pzxdg_exported_v2; AHandle: Pchar); cdecl; 32 | end; 33 | 34 | const 35 | ZXDG_IMPORTED_V2_ERROR_INVALID_SURFACE = 0; // surface is not an xdg_toplevel 36 | 37 | type 38 | Pzxdg_imported_v2_listener = ^Tzxdg_imported_v2_listener; 39 | Tzxdg_imported_v2_listener = record 40 | destroyed : procedure(data: Pointer; AZxdgImportedV2: Pzxdg_imported_v2); cdecl; 41 | end; 42 | 43 | 44 | 45 | TZxdgExporterV2 = class; 46 | TZxdgImporterV2 = class; 47 | TZxdgExportedV2 = class; 48 | TZxdgImportedV2 = class; 49 | 50 | 51 | IZxdgExporterV2Listener = interface 52 | ['IZxdgExporterV2Listener'] 53 | end; 54 | 55 | IZxdgImporterV2Listener = interface 56 | ['IZxdgImporterV2Listener'] 57 | end; 58 | 59 | IZxdgExportedV2Listener = interface 60 | ['IZxdgExportedV2Listener'] 61 | procedure zxdg_exported_v2_handle(AZxdgExportedV2: TZxdgExportedV2; AHandle: String); 62 | end; 63 | 64 | IZxdgImportedV2Listener = interface 65 | ['IZxdgImportedV2Listener'] 66 | procedure zxdg_imported_v2_destroyed(AZxdgImportedV2: TZxdgImportedV2); 67 | end; 68 | 69 | 70 | 71 | 72 | TZxdgExporterV2 = class(TWLProxyObject) 73 | private 74 | const _DESTROY = 0; 75 | const _EXPORT_TOPLEVEL = 1; 76 | public 77 | destructor Destroy; override; 78 | function ExportToplevel(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZxdgExportedV2}): TZxdgExportedV2; 79 | function AddListener(AIntf: IZxdgExporterV2Listener): LongInt; 80 | end; 81 | 82 | TZxdgImporterV2 = class(TWLProxyObject) 83 | private 84 | const _DESTROY = 0; 85 | const _IMPORT_TOPLEVEL = 1; 86 | public 87 | destructor Destroy; override; 88 | function ImportToplevel(AHandle: String; AProxyClass: TWLProxyObjectClass = nil {TZxdgImportedV2}): TZxdgImportedV2; 89 | function AddListener(AIntf: IZxdgImporterV2Listener): LongInt; 90 | end; 91 | 92 | TZxdgExportedV2 = class(TWLProxyObject) 93 | private 94 | const _DESTROY = 0; 95 | public 96 | destructor Destroy; override; 97 | function AddListener(AIntf: IZxdgExportedV2Listener): LongInt; 98 | end; 99 | 100 | TZxdgImportedV2 = class(TWLProxyObject) 101 | private 102 | const _DESTROY = 0; 103 | const _SET_PARENT_OF = 1; 104 | public 105 | destructor Destroy; override; 106 | procedure SetParentOf(ASurface: TWlSurface); 107 | function AddListener(AIntf: IZxdgImportedV2Listener): LongInt; 108 | end; 109 | 110 | 111 | 112 | 113 | 114 | 115 | var 116 | zxdg_exporter_v2_interface: Twl_interface; 117 | zxdg_importer_v2_interface: Twl_interface; 118 | zxdg_exported_v2_interface: Twl_interface; 119 | zxdg_imported_v2_interface: Twl_interface; 120 | 121 | 122 | 123 | implementation 124 | 125 | var 126 | vIntf_zxdg_exporter_v2_Listener: Tzxdg_exporter_v2_listener; 127 | vIntf_zxdg_importer_v2_Listener: Tzxdg_importer_v2_listener; 128 | vIntf_zxdg_exported_v2_Listener: Tzxdg_exported_v2_listener; 129 | vIntf_zxdg_imported_v2_Listener: Tzxdg_imported_v2_listener; 130 | 131 | 132 | 133 | destructor TZxdgExporterV2.Destroy; 134 | begin 135 | wl_proxy_marshal(FProxy, _DESTROY); 136 | inherited Destroy; 137 | end; 138 | 139 | function TZxdgExporterV2.ExportToplevel(ASurface: TWlSurface; AProxyClass: TWLProxyObjectClass = nil {TZxdgExportedV2}): TZxdgExportedV2; 140 | var 141 | id: Pwl_proxy; 142 | begin 143 | id := wl_proxy_marshal_constructor(FProxy, 144 | _EXPORT_TOPLEVEL, @zxdg_exported_v2_interface, nil, ASurface.Proxy); 145 | if AProxyClass = nil then 146 | AProxyClass := TZxdgExportedV2; 147 | if not AProxyClass.InheritsFrom(TZxdgExportedV2) then 148 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgExportedV2]); 149 | Result := TZxdgExportedV2(AProxyClass.Create(id)); 150 | end; 151 | 152 | function TZxdgExporterV2.AddListener(AIntf: IZxdgExporterV2Listener): LongInt; 153 | begin 154 | FUserDataRec.ListenerUserData := Pointer(AIntf); 155 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_exporter_v2_Listener, @FUserDataRec); 156 | end; 157 | destructor TZxdgImporterV2.Destroy; 158 | begin 159 | wl_proxy_marshal(FProxy, _DESTROY); 160 | inherited Destroy; 161 | end; 162 | 163 | function TZxdgImporterV2.ImportToplevel(AHandle: String; AProxyClass: TWLProxyObjectClass = nil {TZxdgImportedV2}): TZxdgImportedV2; 164 | var 165 | id: Pwl_proxy; 166 | begin 167 | id := wl_proxy_marshal_constructor(FProxy, 168 | _IMPORT_TOPLEVEL, @zxdg_imported_v2_interface, nil, PChar(AHandle)); 169 | if AProxyClass = nil then 170 | AProxyClass := TZxdgImportedV2; 171 | if not AProxyClass.InheritsFrom(TZxdgImportedV2) then 172 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgImportedV2]); 173 | Result := TZxdgImportedV2(AProxyClass.Create(id)); 174 | end; 175 | 176 | function TZxdgImporterV2.AddListener(AIntf: IZxdgImporterV2Listener): LongInt; 177 | begin 178 | FUserDataRec.ListenerUserData := Pointer(AIntf); 179 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_importer_v2_Listener, @FUserDataRec); 180 | end; 181 | destructor TZxdgExportedV2.Destroy; 182 | begin 183 | wl_proxy_marshal(FProxy, _DESTROY); 184 | inherited Destroy; 185 | end; 186 | 187 | function TZxdgExportedV2.AddListener(AIntf: IZxdgExportedV2Listener): LongInt; 188 | begin 189 | FUserDataRec.ListenerUserData := Pointer(AIntf); 190 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_exported_v2_Listener, @FUserDataRec); 191 | end; 192 | destructor TZxdgImportedV2.Destroy; 193 | begin 194 | wl_proxy_marshal(FProxy, _DESTROY); 195 | inherited Destroy; 196 | end; 197 | 198 | procedure TZxdgImportedV2.SetParentOf(ASurface: TWlSurface); 199 | begin 200 | wl_proxy_marshal(FProxy, _SET_PARENT_OF, ASurface.Proxy); 201 | end; 202 | 203 | function TZxdgImportedV2.AddListener(AIntf: IZxdgImportedV2Listener): LongInt; 204 | begin 205 | FUserDataRec.ListenerUserData := Pointer(AIntf); 206 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_imported_v2_Listener, @FUserDataRec); 207 | end; 208 | 209 | 210 | 211 | 212 | procedure zxdg_exported_v2_handle_Intf(AData: PWLUserData; Azxdg_exported_v2: Pzxdg_exported_v2; AHandle: Pchar); cdecl; 213 | var 214 | AIntf: IZxdgExportedV2Listener; 215 | begin 216 | if AData = nil then Exit; 217 | AIntf := IZxdgExportedV2Listener(AData^.ListenerUserData); 218 | AIntf.zxdg_exported_v2_handle(TZxdgExportedV2(AData^.PascalObject), AHandle); 219 | end; 220 | 221 | procedure zxdg_imported_v2_destroyed_Intf(AData: PWLUserData; Azxdg_imported_v2: Pzxdg_imported_v2); cdecl; 222 | var 223 | AIntf: IZxdgImportedV2Listener; 224 | begin 225 | if AData = nil then Exit; 226 | AIntf := IZxdgImportedV2Listener(AData^.ListenerUserData); 227 | AIntf.zxdg_imported_v2_destroyed(TZxdgImportedV2(AData^.PascalObject)); 228 | end; 229 | 230 | 231 | 232 | const 233 | pInterfaces: array[0..12] of Pwl_interface = ( 234 | (nil), 235 | (nil), 236 | (nil), 237 | (nil), 238 | (nil), 239 | (nil), 240 | (nil), 241 | (nil), 242 | (@zxdg_exported_v2_interface), 243 | (@wl_surface_interface), 244 | (@zxdg_imported_v2_interface), 245 | (nil), 246 | (@wl_surface_interface) 247 | ); 248 | 249 | zxdg_exporter_v2_requests: array[0..1] of Twl_message = ( 250 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 251 | (name: 'export_toplevel'; signature: 'no'; types: @pInterfaces[8]) 252 | ); 253 | zxdg_importer_v2_requests: array[0..1] of Twl_message = ( 254 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 255 | (name: 'import_toplevel'; signature: 'ns'; types: @pInterfaces[10]) 256 | ); 257 | zxdg_exported_v2_requests: array[0..0] of Twl_message = ( 258 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 259 | ); 260 | zxdg_exported_v2_events: array[0..0] of Twl_message = ( 261 | (name: 'handle'; signature: 's'; types: @pInterfaces[0]) 262 | ); 263 | zxdg_imported_v2_requests: array[0..1] of Twl_message = ( 264 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 265 | (name: 'set_parent_of'; signature: 'o'; types: @pInterfaces[12]) 266 | ); 267 | zxdg_imported_v2_events: array[0..0] of Twl_message = ( 268 | (name: 'destroyed'; signature: ''; types: @pInterfaces[0]) 269 | ); 270 | 271 | initialization 272 | Pointer(vIntf_zxdg_exported_v2_Listener.handle) := @zxdg_exported_v2_handle_Intf; 273 | Pointer(vIntf_zxdg_imported_v2_Listener.destroyed) := @zxdg_imported_v2_destroyed_Intf; 274 | 275 | 276 | zxdg_exporter_v2_interface.name := 'zxdg_exporter_v2'; 277 | zxdg_exporter_v2_interface.version := 1; 278 | zxdg_exporter_v2_interface.method_count := 2; 279 | zxdg_exporter_v2_interface.methods := @zxdg_exporter_v2_requests; 280 | zxdg_exporter_v2_interface.event_count := 0; 281 | zxdg_exporter_v2_interface.events := nil; 282 | 283 | zxdg_importer_v2_interface.name := 'zxdg_importer_v2'; 284 | zxdg_importer_v2_interface.version := 1; 285 | zxdg_importer_v2_interface.method_count := 2; 286 | zxdg_importer_v2_interface.methods := @zxdg_importer_v2_requests; 287 | zxdg_importer_v2_interface.event_count := 0; 288 | zxdg_importer_v2_interface.events := nil; 289 | 290 | zxdg_exported_v2_interface.name := 'zxdg_exported_v2'; 291 | zxdg_exported_v2_interface.version := 1; 292 | zxdg_exported_v2_interface.method_count := 1; 293 | zxdg_exported_v2_interface.methods := @zxdg_exported_v2_requests; 294 | zxdg_exported_v2_interface.event_count := 1; 295 | zxdg_exported_v2_interface.events := @zxdg_exported_v2_events; 296 | 297 | zxdg_imported_v2_interface.name := 'zxdg_imported_v2'; 298 | zxdg_imported_v2_interface.version := 1; 299 | zxdg_imported_v2_interface.method_count := 2; 300 | zxdg_imported_v2_interface.methods := @zxdg_imported_v2_requests; 301 | zxdg_imported_v2_interface.event_count := 1; 302 | zxdg_imported_v2_interface.events := @zxdg_imported_v2_events; 303 | 304 | end. 305 | -------------------------------------------------------------------------------- /waylandunstablepkg/xdg_output_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit xdg_output_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzxdg_output_manager_v1 = Pointer; 14 | Pzxdg_output_v1 = Pointer; 15 | Pzxdg_output_manager_v1_listener = ^Tzxdg_output_manager_v1_listener; 16 | Tzxdg_output_manager_v1_listener = record 17 | end; 18 | 19 | Pzxdg_output_v1_listener = ^Tzxdg_output_v1_listener; 20 | Tzxdg_output_v1_listener = record 21 | logical_position : procedure(data: Pointer; AZxdgOutputV1: Pzxdg_output_v1; AX: LongInt; AY: LongInt); cdecl; 22 | logical_size : procedure(data: Pointer; AZxdgOutputV1: Pzxdg_output_v1; AWidth: LongInt; AHeight: LongInt); cdecl; 23 | done : procedure(data: Pointer; AZxdgOutputV1: Pzxdg_output_v1); cdecl; 24 | name : procedure(data: Pointer; AZxdgOutputV1: Pzxdg_output_v1; AName: Pchar); cdecl; 25 | description : procedure(data: Pointer; AZxdgOutputV1: Pzxdg_output_v1; ADescription: Pchar); cdecl; 26 | end; 27 | 28 | 29 | 30 | TZxdgOutputManagerV1 = class; 31 | TZxdgOutputV1 = class; 32 | 33 | 34 | IZxdgOutputManagerV1Listener = interface 35 | ['IZxdgOutputManagerV1Listener'] 36 | end; 37 | 38 | IZxdgOutputV1Listener = interface 39 | ['IZxdgOutputV1Listener'] 40 | procedure zxdg_output_v1_logical_position(AZxdgOutputV1: TZxdgOutputV1; AX: LongInt; AY: LongInt); 41 | procedure zxdg_output_v1_logical_size(AZxdgOutputV1: TZxdgOutputV1; AWidth: LongInt; AHeight: LongInt); 42 | procedure zxdg_output_v1_done(AZxdgOutputV1: TZxdgOutputV1); 43 | procedure zxdg_output_v1_name(AZxdgOutputV1: TZxdgOutputV1; AName: String); {since: 2} 44 | procedure zxdg_output_v1_description(AZxdgOutputV1: TZxdgOutputV1; ADescription: String); {since: 2} 45 | end; 46 | 47 | 48 | 49 | 50 | TZxdgOutputManagerV1 = class(TWLProxyObject) 51 | private 52 | const _DESTROY = 0; 53 | const _GET_XDG_OUTPUT = 1; 54 | public 55 | destructor Destroy; override; 56 | function GetXdgOutput(AOutput: TWlOutput; AProxyClass: TWLProxyObjectClass = nil {TZxdgOutputV1}): TZxdgOutputV1; 57 | function AddListener(AIntf: IZxdgOutputManagerV1Listener): LongInt; 58 | end; 59 | 60 | TZxdgOutputV1 = class(TWLProxyObject) 61 | private 62 | const _DESTROY = 0; 63 | public 64 | destructor Destroy; override; 65 | function AddListener(AIntf: IZxdgOutputV1Listener): LongInt; 66 | end; 67 | 68 | 69 | 70 | 71 | 72 | 73 | var 74 | zxdg_output_manager_v1_interface: Twl_interface; 75 | zxdg_output_v1_interface: Twl_interface; 76 | 77 | 78 | 79 | implementation 80 | 81 | var 82 | vIntf_zxdg_output_manager_v1_Listener: Tzxdg_output_manager_v1_listener; 83 | vIntf_zxdg_output_v1_Listener: Tzxdg_output_v1_listener; 84 | 85 | 86 | 87 | destructor TZxdgOutputManagerV1.Destroy; 88 | begin 89 | wl_proxy_marshal(FProxy, _DESTROY); 90 | inherited Destroy; 91 | end; 92 | 93 | function TZxdgOutputManagerV1.GetXdgOutput(AOutput: TWlOutput; AProxyClass: TWLProxyObjectClass = nil {TZxdgOutputV1}): TZxdgOutputV1; 94 | var 95 | id: Pwl_proxy; 96 | begin 97 | id := wl_proxy_marshal_constructor(FProxy, 98 | _GET_XDG_OUTPUT, @zxdg_output_v1_interface, nil, AOutput.Proxy); 99 | if AProxyClass = nil then 100 | AProxyClass := TZxdgOutputV1; 101 | if not AProxyClass.InheritsFrom(TZxdgOutputV1) then 102 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZxdgOutputV1]); 103 | Result := TZxdgOutputV1(AProxyClass.Create(id)); 104 | end; 105 | 106 | function TZxdgOutputManagerV1.AddListener(AIntf: IZxdgOutputManagerV1Listener): LongInt; 107 | begin 108 | FUserDataRec.ListenerUserData := Pointer(AIntf); 109 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_output_manager_v1_Listener, @FUserDataRec); 110 | end; 111 | destructor TZxdgOutputV1.Destroy; 112 | begin 113 | wl_proxy_marshal(FProxy, _DESTROY); 114 | inherited Destroy; 115 | end; 116 | 117 | function TZxdgOutputV1.AddListener(AIntf: IZxdgOutputV1Listener): LongInt; 118 | begin 119 | FUserDataRec.ListenerUserData := Pointer(AIntf); 120 | Result := wl_proxy_add_listener(FProxy, @vIntf_zxdg_output_v1_Listener, @FUserDataRec); 121 | end; 122 | 123 | 124 | 125 | 126 | procedure zxdg_output_v1_logical_position_Intf(AData: PWLUserData; Azxdg_output_v1: Pzxdg_output_v1; AX: LongInt; AY: LongInt); cdecl; 127 | var 128 | AIntf: IZxdgOutputV1Listener; 129 | begin 130 | if AData = nil then Exit; 131 | AIntf := IZxdgOutputV1Listener(AData^.ListenerUserData); 132 | AIntf.zxdg_output_v1_logical_position(TZxdgOutputV1(AData^.PascalObject), AX, AY); 133 | end; 134 | 135 | procedure zxdg_output_v1_logical_size_Intf(AData: PWLUserData; Azxdg_output_v1: Pzxdg_output_v1; AWidth: LongInt; AHeight: LongInt); cdecl; 136 | var 137 | AIntf: IZxdgOutputV1Listener; 138 | begin 139 | if AData = nil then Exit; 140 | AIntf := IZxdgOutputV1Listener(AData^.ListenerUserData); 141 | AIntf.zxdg_output_v1_logical_size(TZxdgOutputV1(AData^.PascalObject), AWidth, AHeight); 142 | end; 143 | 144 | procedure zxdg_output_v1_done_Intf(AData: PWLUserData; Azxdg_output_v1: Pzxdg_output_v1); cdecl; 145 | var 146 | AIntf: IZxdgOutputV1Listener; 147 | begin 148 | if AData = nil then Exit; 149 | AIntf := IZxdgOutputV1Listener(AData^.ListenerUserData); 150 | AIntf.zxdg_output_v1_done(TZxdgOutputV1(AData^.PascalObject)); 151 | end; 152 | 153 | procedure zxdg_output_v1_name_Intf(AData: PWLUserData; Azxdg_output_v1: Pzxdg_output_v1; AName: Pchar); cdecl; 154 | var 155 | AIntf: IZxdgOutputV1Listener; 156 | begin 157 | if AData = nil then Exit; 158 | AIntf := IZxdgOutputV1Listener(AData^.ListenerUserData); 159 | AIntf.zxdg_output_v1_name(TZxdgOutputV1(AData^.PascalObject), AName); 160 | end; 161 | 162 | procedure zxdg_output_v1_description_Intf(AData: PWLUserData; Azxdg_output_v1: Pzxdg_output_v1; ADescription: Pchar); cdecl; 163 | var 164 | AIntf: IZxdgOutputV1Listener; 165 | begin 166 | if AData = nil then Exit; 167 | AIntf := IZxdgOutputV1Listener(AData^.ListenerUserData); 168 | AIntf.zxdg_output_v1_description(TZxdgOutputV1(AData^.PascalObject), ADescription); 169 | end; 170 | 171 | 172 | 173 | const 174 | pInterfaces: array[0..9] of Pwl_interface = ( 175 | (nil), 176 | (nil), 177 | (nil), 178 | (nil), 179 | (nil), 180 | (nil), 181 | (nil), 182 | (nil), 183 | (@zxdg_output_v1_interface), 184 | (@wl_output_interface) 185 | ); 186 | 187 | zxdg_output_manager_v1_requests: array[0..1] of Twl_message = ( 188 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 189 | (name: 'get_xdg_output'; signature: 'no'; types: @pInterfaces[8]) 190 | ); 191 | zxdg_output_v1_requests: array[0..0] of Twl_message = ( 192 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 193 | ); 194 | zxdg_output_v1_events: array[0..4] of Twl_message = ( 195 | (name: 'logical_position'; signature: 'ii'; types: @pInterfaces[0]), 196 | (name: 'logical_size'; signature: 'ii'; types: @pInterfaces[0]), 197 | (name: 'done'; signature: ''; types: @pInterfaces[0]), 198 | (name: 'name'; signature: '2s'; types: @pInterfaces[0]), 199 | (name: 'description'; signature: '2s'; types: @pInterfaces[0]) 200 | ); 201 | 202 | initialization 203 | Pointer(vIntf_zxdg_output_v1_Listener.logical_position) := @zxdg_output_v1_logical_position_Intf; 204 | Pointer(vIntf_zxdg_output_v1_Listener.logical_size) := @zxdg_output_v1_logical_size_Intf; 205 | Pointer(vIntf_zxdg_output_v1_Listener.done) := @zxdg_output_v1_done_Intf; 206 | Pointer(vIntf_zxdg_output_v1_Listener.name) := @zxdg_output_v1_name_Intf; 207 | Pointer(vIntf_zxdg_output_v1_Listener.description) := @zxdg_output_v1_description_Intf; 208 | 209 | 210 | zxdg_output_manager_v1_interface.name := 'zxdg_output_manager_v1'; 211 | zxdg_output_manager_v1_interface.version := 3; 212 | zxdg_output_manager_v1_interface.method_count := 2; 213 | zxdg_output_manager_v1_interface.methods := @zxdg_output_manager_v1_requests; 214 | zxdg_output_manager_v1_interface.event_count := 0; 215 | zxdg_output_manager_v1_interface.events := nil; 216 | 217 | zxdg_output_v1_interface.name := 'zxdg_output_v1'; 218 | zxdg_output_v1_interface.version := 3; 219 | zxdg_output_v1_interface.method_count := 1; 220 | zxdg_output_v1_interface.methods := @zxdg_output_v1_requests; 221 | zxdg_output_v1_interface.event_count := 5; 222 | zxdg_output_v1_interface.events := @zxdg_output_v1_events; 223 | 224 | end. 225 | -------------------------------------------------------------------------------- /waylandunstablepkg/xwayland_keyboard_grab_unstable_v1_protocol.pas: -------------------------------------------------------------------------------- 1 | unit xwayland_keyboard_grab_unstable_v1_protocol; 2 | 3 | {$mode objfpc} {$H+} 4 | {$interfaces corba} 5 | 6 | interface 7 | 8 | uses 9 | Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol; 10 | 11 | 12 | type 13 | Pzwp_xwayland_keyboard_grab_manager_v1 = Pointer; 14 | Pzwp_xwayland_keyboard_grab_v1 = Pointer; 15 | Pzwp_xwayland_keyboard_grab_manager_v1_listener = ^Tzwp_xwayland_keyboard_grab_manager_v1_listener; 16 | Tzwp_xwayland_keyboard_grab_manager_v1_listener = record 17 | end; 18 | 19 | Pzwp_xwayland_keyboard_grab_v1_listener = ^Tzwp_xwayland_keyboard_grab_v1_listener; 20 | Tzwp_xwayland_keyboard_grab_v1_listener = record 21 | end; 22 | 23 | 24 | 25 | TZwpXwaylandKeyboardGrabManagerV1 = class; 26 | TZwpXwaylandKeyboardGrabV1 = class; 27 | 28 | 29 | IZwpXwaylandKeyboardGrabManagerV1Listener = interface 30 | ['IZwpXwaylandKeyboardGrabManagerV1Listener'] 31 | end; 32 | 33 | IZwpXwaylandKeyboardGrabV1Listener = interface 34 | ['IZwpXwaylandKeyboardGrabV1Listener'] 35 | end; 36 | 37 | 38 | 39 | 40 | TZwpXwaylandKeyboardGrabManagerV1 = class(TWLProxyObject) 41 | private 42 | const _DESTROY = 0; 43 | const _GRAB_KEYBOARD = 1; 44 | public 45 | destructor Destroy; override; 46 | function GrabKeyboard(ASurface: TWlSurface; ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpXwaylandKeyboardGrabV1}): TZwpXwaylandKeyboardGrabV1; 47 | function AddListener(AIntf: IZwpXwaylandKeyboardGrabManagerV1Listener): LongInt; 48 | end; 49 | 50 | TZwpXwaylandKeyboardGrabV1 = class(TWLProxyObject) 51 | private 52 | const _DESTROY = 0; 53 | public 54 | destructor Destroy; override; 55 | function AddListener(AIntf: IZwpXwaylandKeyboardGrabV1Listener): LongInt; 56 | end; 57 | 58 | 59 | 60 | 61 | 62 | 63 | var 64 | zwp_xwayland_keyboard_grab_manager_v1_interface: Twl_interface; 65 | zwp_xwayland_keyboard_grab_v1_interface: Twl_interface; 66 | 67 | 68 | 69 | implementation 70 | 71 | var 72 | vIntf_zwp_xwayland_keyboard_grab_manager_v1_Listener: Tzwp_xwayland_keyboard_grab_manager_v1_listener; 73 | vIntf_zwp_xwayland_keyboard_grab_v1_Listener: Tzwp_xwayland_keyboard_grab_v1_listener; 74 | 75 | 76 | 77 | destructor TZwpXwaylandKeyboardGrabManagerV1.Destroy; 78 | begin 79 | wl_proxy_marshal(FProxy, _DESTROY); 80 | inherited Destroy; 81 | end; 82 | 83 | function TZwpXwaylandKeyboardGrabManagerV1.GrabKeyboard(ASurface: TWlSurface; ASeat: TWlSeat; AProxyClass: TWLProxyObjectClass = nil {TZwpXwaylandKeyboardGrabV1}): TZwpXwaylandKeyboardGrabV1; 84 | var 85 | id: Pwl_proxy; 86 | begin 87 | id := wl_proxy_marshal_constructor(FProxy, 88 | _GRAB_KEYBOARD, @zwp_xwayland_keyboard_grab_v1_interface, nil, ASurface.Proxy, ASeat.Proxy); 89 | if AProxyClass = nil then 90 | AProxyClass := TZwpXwaylandKeyboardGrabV1; 91 | if not AProxyClass.InheritsFrom(TZwpXwaylandKeyboardGrabV1) then 92 | Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpXwaylandKeyboardGrabV1]); 93 | Result := TZwpXwaylandKeyboardGrabV1(AProxyClass.Create(id)); 94 | end; 95 | 96 | function TZwpXwaylandKeyboardGrabManagerV1.AddListener(AIntf: IZwpXwaylandKeyboardGrabManagerV1Listener): LongInt; 97 | begin 98 | FUserDataRec.ListenerUserData := Pointer(AIntf); 99 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_xwayland_keyboard_grab_manager_v1_Listener, @FUserDataRec); 100 | end; 101 | destructor TZwpXwaylandKeyboardGrabV1.Destroy; 102 | begin 103 | wl_proxy_marshal(FProxy, _DESTROY); 104 | inherited Destroy; 105 | end; 106 | 107 | function TZwpXwaylandKeyboardGrabV1.AddListener(AIntf: IZwpXwaylandKeyboardGrabV1Listener): LongInt; 108 | begin 109 | FUserDataRec.ListenerUserData := Pointer(AIntf); 110 | Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_xwayland_keyboard_grab_v1_Listener, @FUserDataRec); 111 | end; 112 | 113 | 114 | 115 | 116 | 117 | 118 | const 119 | pInterfaces: array[0..10] of Pwl_interface = ( 120 | (nil), 121 | (nil), 122 | (nil), 123 | (nil), 124 | (nil), 125 | (nil), 126 | (nil), 127 | (nil), 128 | (@zwp_xwayland_keyboard_grab_v1_interface), 129 | (@wl_surface_interface), 130 | (@wl_seat_interface) 131 | ); 132 | 133 | zwp_xwayland_keyboard_grab_manager_v1_requests: array[0..1] of Twl_message = ( 134 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]), 135 | (name: 'grab_keyboard'; signature: 'noo'; types: @pInterfaces[8]) 136 | ); 137 | zwp_xwayland_keyboard_grab_v1_requests: array[0..0] of Twl_message = ( 138 | (name: 'destroy'; signature: ''; types: @pInterfaces[0]) 139 | ); 140 | 141 | initialization 142 | 143 | 144 | zwp_xwayland_keyboard_grab_manager_v1_interface.name := 'zwp_xwayland_keyboard_grab_manager_v1'; 145 | zwp_xwayland_keyboard_grab_manager_v1_interface.version := 1; 146 | zwp_xwayland_keyboard_grab_manager_v1_interface.method_count := 2; 147 | zwp_xwayland_keyboard_grab_manager_v1_interface.methods := @zwp_xwayland_keyboard_grab_manager_v1_requests; 148 | zwp_xwayland_keyboard_grab_manager_v1_interface.event_count := 0; 149 | zwp_xwayland_keyboard_grab_manager_v1_interface.events := nil; 150 | 151 | zwp_xwayland_keyboard_grab_v1_interface.name := 'zwp_xwayland_keyboard_grab_v1'; 152 | zwp_xwayland_keyboard_grab_v1_interface.version := 1; 153 | zwp_xwayland_keyboard_grab_v1_interface.method_count := 1; 154 | zwp_xwayland_keyboard_grab_v1_interface.methods := @zwp_xwayland_keyboard_grab_v1_requests; 155 | zwp_xwayland_keyboard_grab_v1_interface.event_count := 0; 156 | zwp_xwayland_keyboard_grab_v1_interface.events := nil; 157 | 158 | end. 159 | --------------------------------------------------------------------------------