Windows Integration
发布时间:2026-09-14 | 浏览:2
marchaesen/vcxsrv
Installation and Configuration
X Server Architecture
Windows Integration
Multiwindow Mode
Graphics Rendering Pipeline
2D Graphics (Pixman)
3D Graphics (OpenGL)
Direct Rendering Infrastructure (DRI)
Windows GLX Implementation
Mesa 3D Implementation
mhmake Build Tool
Makefile Structure
Protocol Implementation
X11 Protocol and XCB
xorg-server/damageext/makefile
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/glx/simpledib.c
xorg-server/hw/xwin/makefile
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/winglobals.c
xorg-server/hw/xwin/winglobals.h
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsgwindow.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwndproc.c
xorg-server/hw/xwin/xdmcphostselect.c
This page explains how VcXsrv integrates X Window System applications with the Windows desktop environment. It covers the mechanisms for representing X windows as Windows windows, managing window properties, handling input events, and ensuring seamless interaction between the X server and the Windows operating system.
For information about multiwindow mode specifically, see Multiwindow Mode . For details on input handling, see Input System .
Architecture Overview
VcXsrv provides multiple display modes, with the "multi-window" mode being the most integrated with Windows. In this mode, each X window appears as a separate Windows window, allowing X applications to blend naturally with Windows applications.
xorg-server/hw/xwin/winmultiwindowwm.c 177-1174
xorg-server/hw/xwin/win.h 66-134
xorg-server/hw/xwin/winwindow.h 32-171
Window Creation and Management
When an X client creates a window, VcXsrv creates a corresponding Windows window and establishes a mapping between them.
xorg-server/hw/xwin/winmultiwindowwindow.c 99-138
xorg-server/hw/xwin/winmultiwindowwindow.c 342-370
xorg-server/hw/xwin/winmultiwindowwindow.c 447-604
Window Properties Mapping
VcXsrv maps X window properties to corresponding Windows window properties:
xorg-server/hw/xwin/winmultiwindowwm.c 627-648
xorg-server/hw/xwin/winmultiwindowwm.c 666-689
Thread Architecture
The Windows integration is implemented using several threads:
Main Server Thread : Handles the core X server functionality
Window Manager Thread : Manages window creation, mapping, and property synchronization
X Message Thread : Processes X protocol messages for window management
Clipboard Thread : Handles clipboard integration (when enabled)
xorg-server/hw/xwin/winmultiwindowwm.c 930-1173
xorg-server/hw/xwin/winmultiwindowwm.c 1197-2014
xorg-server/hw/xwin/winclipboardwrappers.c 67-152
Message Processing
VcXsrv processes both Windows messages and X11 events, translating between the two systems:
Windows to X11 Translation
Windows messages are received by the window procedure ( winTopLevelWindowProc ) and translated to X11 events.
xorg-server/hw/xwin/winmultiwindowwndproc.c 498-1122
xorg-server/hw/xwin/winwndproc.c 151-779
X11 to Windows Translation
X11 events and requests are translated to Windows operations by the window manager thread.
xorg-server/hw/xwin/winmultiwindowwm.c 945-1152
Window Styling and Decorations
VcXsrv applies appropriate window styles to X windows based on their properties:
Normal Windows : Standard window with title bar, borders, and minimize/maximize buttons
Dialog Windows : Dialog-style windows with a title bar but no minimize/maximize buttons
Utility Windows : Small windows with minimal decorations
Override-redirect Windows : Windows without decorations (popup menus, tooltips)
The window styles are determined by examining X window properties including:
Motif WM hints (decoration flags)
Window type atoms (_NET_WM_WINDOW_TYPE)
Window state (_NET_WM_STATE)
xorg-server/hw/xwin/winmultiwindowwm.c 191-193
xorg-server/hw/xwin/winmultiwindowwm.c 694-736
Alpha Channel/Transparency Support
VcXsrv supports alpha channel/transparency for X windows with 32-bit depth, using different Windows APIs depending on the Windows version:
For Windows 10 and later: SetWindowCompositionAttribute
For Windows 7 and Vista: DwmEnableBlurBehindWindow
This allows X windows with transparency to blend properly with the Windows desktop.
xorg-server/hw/xwin/winmultiwindowwndproc.c 373-456
System Tray Integration
VcXsrv adds an icon to the Windows system tray (notification area) to provide quick access to server controls and to show server status.
The tray icon provides a menu with options like:
Custom menu items from configuration files
xorg-server/hw/xwin/wintrayicon.c 1-205
xorg-server/hw/xwin/winwndproc.c 188-226
xorg-server/hw/xwin/winglobals.c 63-64
Desktop Integration
Multi-Monitor Support
VcXsrv supports multiple monitors, allowing X windows to be positioned correctly across different monitors. It detects monitor configuration changes and adjusts the X screen size and position accordingly.
When the desktop configuration changes (monitor added/removed or resolution changed), VcXsrv receives a WM_DISPLAYCHANGE message and updates the X screen configuration to match.
xorg-server/hw/xwin/winwndproc.c 228-381
xorg-server/hw/xwin/winmultiwindowwindow.c 157-279
Window Activation and Focus
VcXsrv manages window activation and focus by:
Translating Windows WM_SETFOCUS events to X focus events
Setting the X input focus when a window is activated
Handling the WM_ACTIVATE message to notify X clients
xorg-server/hw/xwin/winmultiwindowwndproc.c 856-901
xorg-server/hw/xwin/winmultiwindowwm.c 1047-1089
Configuration Options
VcXsrv provides several command-line options to control Windows integration:
xorg-server/hw/xwin/winprocarg.c 457-892
xorg-server/hw/xwin/winglobals.c 60-82
Technical Implementation Details
Windows windows and X windows are mapped to each other using window properties:
WIN_WINDOW_PROP : Stores a pointer to the X window structure
WIN_WID_PROP : Stores the X window ID
WIN_STATE_PROP : Stores the window state (normal, maximized, minimized)
WIN_SCR_PROP : Stores a pointer to the screen structure
xorg-server/hw/xwin/winglobals.c 103-107
xorg-server/hw/xwin/winmultiwindowwindow.c 605-607
Window Message Communication
Communication between threads is done using custom window messages:
WM_WM_MOVE : Window moved
WM_WM_SIZE : Window resized
WM_WM_RAISE : Raise window
WM_WM_LOWER : Lower window
WM_WM_ACTIVATE : Activate window
WM_WM_KILL : Close window
WM_WM_NAME_EVENT : Window name changed
WM_WM_HINTS_EVENT : Window hints changed
xorg-server/hw/xwin/winwindow.h 98-110
xorg-server/hw/xwin/winmultiwindowwm.c 945-1152
The Windows integration in VcXsrv provides a seamless experience for running X applications on Windows. By carefully mapping X windows to Windows windows and translating events between the two systems, VcXsrv makes X applications appear and behave like native Windows applications while maintaining compatibility with the X11 protocol.
Refresh this wiki
Windows Integration
Architecture Overview
Window Creation and Management
Window Properties Mapping
Thread Architecture
Message Processing
Windows to X11 Translation
X11 to Windows Translation
Window Styling and Decorations
Alpha Channel/Transparency Support
System Tray Integration
Desktop Integration
Multi-Monitor Support
Window Activation and Focus
Configuration Options
Technical Implementation Details
Window Message Communication