robert-ancell / x11.dart

Mozilla Public License 2.0
26 stars 2 forks source link

Can't connect to X11 server on localhost #13

Closed hanskokx closed 11 months ago

hanskokx commented 11 months ago

I'm trying to get the example code running on my development machine. Unfortunately, I'm receiving an error when doing so:

Unhandled Exception: SocketException: Connection failed (OS Error: Unix domain sockets are not available on this operating system.

Code example ```dart import 'package:x11/x11.dart'; Future main() async { final X11Client client = X11Client(); await client.connectToHost("localhost", 1); final X11ResourceId id = client.generateId(); client.createWindow( id, client.screens[0].window, const X11Rectangle(0, 0, 400, 300)); await client.changePropertyString(id, 'WM_NAME', 'x11`.dart'); client.mapWindow(id); client.setCloseDownMode(X11CloseDownMode.retainPermanent); await client.close(); } ```
Flutter/Dart version ``` Flutter 3.16.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision db7ef5bf9f (9 days ago) • 2023-11-15 11:25:44 -0800 Engine • revision 74d16627b9 Tools • Dart 3.2.0 • DevTools 2.28.2 ```
System info ``` ,.=:!!t3Z3z., user@localhost :tt:::tt333EE3 ------------- Et:::ztt33EEEL @Ee., .., OS: Windows 11 Pro x86_64 ;tt:::tt333EE7 ;EEEEEEttttt33# Host: Microsoft Corporation Surface Book 3 :Et:::zt333EEQ. $EEEEEttttt33QL Kernel: 10.0.22631 it::::tt333EEF @EEEEEEttttt33F Uptime: 5 days, 11 hours, 55 mins ;3=*^```"*4EEV :EEEEEEttttt33@. Packages: 11 (scoop) ,.=::::!t=., ` @EEEEEEtttz33QF Shell: PowerShell 7.3.9 ;::::::::zt33) "4EEEtttji3P* Resolution: 3240x2160 :t::::::::tt33.:Z3z.. `` ,..g. DE: Aero i::::::::zt33F AEEEtttt::::ztF WM: Explorer ;:::::::::t33V ;EEEttttt::::t3 WM Theme: Custom E::::::::zt33L @EEEtttt::::z3F Terminal: Windows Terminal {3=*^```"*4E3) ;EEEtttt:::::tZ` CPU: Intel i7-1065G7 (8) @ 1.500GHz ` :EEEEtttt::::z7 GPU: Caption "VEzjt:;;z>*` GPU: Intel(R) Iris(R) Plus Graphics GPU: NVIDIA GeForce GTX 1660 Ti with Max-Q Design GPU Memory: 21143MiB / 32354MiB ```
`flutter run` output and error summary ``` > flutter run -d windows Launching lib\main.dart on Windows in debug mode... Building Windows application... 9.9s ✓ Built build\windows\x64\runner\Debug\x11_desktop.exe. [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Connection failed (OS Error: Unix domain sockets are not available on this operating system.), address = /tmp/.X11-unix/X1, port = 0 #0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721:35) #1 _NativeSocket.connect (dart:io-patch/socket_patch.dart:984:12) #2 _RawSocket.connect (dart:io-patch/socket_patch.dart:1902:26) #3 RawSocket.connect (dart:io-patch/socket_patch.dart:21:23) #4 Socket._connect (dart:io-patch/socket_patch.dart:2128:22) #5 Socket.connect (dart:io/socket.dart:758:21) #6 X11Client.connectToHost (package:x11/src/x11_client.dart:288:28) #7 main (package:x11_desktop/main.dart:6:16) #8 _runMain. (dart:ui/hooks.dart:301:23) #9 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:297:19) #10 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12) Syncing files to device Windows... 77ms Flutter run key commands. r Hot reload. 🔥🔥🔥 R Hot restart. h List all available interactive commands. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device). A Dart VM Service on Windows is available at: http://127.0.0.1:56873/R1MEbj4uwK4=/ ```
X11 server logs and information ``` Welcome to the VcXsrv X Server Vendor: The VcXsrv Project Release: 1.20.14.0 OS: Windows NT 6.2 build 9200 (64-bit) Contact: marha@users.sourceforge.net LoadPreferences: C:\Users\hans\AppData\Roaming\.XWinrc not found LoadPreferences: Loading C:\Program Files\VcXsrv\system.XWinrc (II) AIGLX: Testing pixelFormatIndex 1 (II) GLX: enabled GLX_SGI_make_current_read (II) GLX: enabled GLX_SGI_swap_control (II) GLX: enabled GLX_MESA_swap_control (II) GLX: enabled GLX_SGIX_pbuffer (II) GLX: enabled GLX_ARB_multisample (II) GLX: enabled GLX_SGIS_multisample (II) GLX: enabled GLX_ARB_fbconfig_float (II) GLX: enabled GLX_EXT_fbconfig_packed_float (II) GLX: enabled GLX_ARB_create_context (II) GLX: enabled GLX_ARB_create_context_profile (II) GLX: enabled GLX_ARB_create_context_robustness (II) GLX: enabled GLX_EXT_create_context_es2_profile (II) GLX: enabled GLX_ARB_framebuffer_sRGB (II) AIGLX: enabled GLX_MESA_copy_sub_buffer (II) 112 pixel formats reported by wglGetPixelFormatAttribivARB (II) GLX: Initialized Win32 native WGL GL provider for screen 0 winClipboardThreadProc - DISPLAY=127.0.0.1:1.0 winClipboardProc - xcb_connect () returned and successfully opened the display. Using Composite redirection ```
robert-ancell commented 11 months ago

Looks like you need to connect using TCP on windows (DISPLAY=127.0.0.1:1.0 in the X11 server log). This is in https://github.com/robert-ancell/x11.dart/issues/2

hanskokx commented 11 months ago

Since the API isn't documented, can you at least provide some instructions for that?

robert-ancell commented 11 months ago

This library won't work on Windows until #2 is implemented.

hanskokx commented 11 months ago

Ah. Thanks.