diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 0be9d634a..24bff5ebd 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -40,6 +40,7 @@ include_directories(SYSTEM ${X11_INCLUDE_DIRS}) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) set(SRCS + xf_types.h xf_utils.h xf_utils.c xf_x11_utils.c diff --git a/client/X11/xf_cliprdr.h b/client/X11/xf_cliprdr.h index b57779132..3d0a15323 100644 --- a/client/X11/xf_cliprdr.h +++ b/client/X11/xf_cliprdr.h @@ -20,11 +20,15 @@ #ifndef FREERDP_CLIENT_X11_CLIPRDR_H #define FREERDP_CLIENT_X11_CLIPRDR_H -#include "xf_client.h" -#include "xfreerdp.h" - +#include #include +#include + +#include "xf_types.h" + +typedef struct xf_clipboard xfClipboard; + void xf_clipboard_free(xfClipboard* clipboard); WINPR_ATTR_MALLOC(xf_clipboard_free, 1) diff --git a/client/X11/xf_disp.c b/client/X11/xf_disp.c index 045a649d7..2de050d43 100644 --- a/client/X11/xf_disp.c +++ b/client/X11/xf_disp.c @@ -35,6 +35,7 @@ #endif +#include "xfreerdp.h" #include "xf_disp.h" #include "xf_monitor.h" diff --git a/client/X11/xf_disp.h b/client/X11/xf_disp.h index 8c971596c..e28e1e246 100644 --- a/client/X11/xf_disp.h +++ b/client/X11/xf_disp.h @@ -22,8 +22,11 @@ #include #include -#include "xf_client.h" -#include "xfreerdp.h" +#include + +#include "xf_types.h" + +typedef struct s_xfDispContext xfDispContext; FREERDP_API BOOL xf_disp_init(xfDispContext* xfDisp, DispClientContext* disp); FREERDP_API BOOL xf_disp_uninit(xfDispContext* xfDisp, DispClientContext* disp); diff --git a/client/X11/xf_floatbar.h b/client/X11/xf_floatbar.h index 1e15ae17f..41cac3784 100644 --- a/client/X11/xf_floatbar.h +++ b/client/X11/xf_floatbar.h @@ -18,9 +18,13 @@ #ifndef FREERDP_CLIENT_X11_FLOATBAR_H #define FREERDP_CLIENT_X11_FLOATBAR_H -typedef struct xf_floatbar xfFloatbar; +#include -#include "xfreerdp.h" +#include + +#include "xf_types.h" + +typedef struct xf_floatbar xfFloatbar; void xf_floatbar_free(xfFloatbar* floatbar); diff --git a/client/X11/xf_monitor.h b/client/X11/xf_monitor.h index 6597c1560..d654b0621 100644 --- a/client/X11/xf_monitor.h +++ b/client/X11/xf_monitor.h @@ -22,24 +22,9 @@ #include #include +#include -typedef struct -{ - RECTANGLE_16 area; - RECTANGLE_16 workarea; - BOOL primary; -} MONITOR_INFO; - -typedef struct -{ - UINT32 nmonitors; - RECTANGLE_16 area; - RECTANGLE_16 workarea; - MONITOR_INFO* monitors; -} VIRTUAL_SCREEN; - -#include "xf_client.h" -#include "xfreerdp.h" +#include "xf_types.h" FREERDP_API int xf_list_monitors(xfContext* xfc); FREERDP_API BOOL xf_detect_monitors(xfContext* xfc, UINT32* pWidth, UINT32* pHeight); diff --git a/client/X11/xf_rail.h b/client/X11/xf_rail.h index 0867093a2..a91714851 100644 --- a/client/X11/xf_rail.h +++ b/client/X11/xf_rail.h @@ -20,11 +20,98 @@ #ifndef FREERDP_CLIENT_X11_RAIL_H #define FREERDP_CLIENT_X11_RAIL_H -#include "xf_client.h" -#include "xfreerdp.h" - #include +#include +#include + +#include "xf_types.h" + +enum xf_localmove_state +{ + LMS_NOT_ACTIVE, + LMS_STARTING, + LMS_ACTIVE, + LMS_TERMINATING +}; + +struct xf_localmove +{ + int root_x; + int root_y; + int window_x; + int window_y; + enum xf_localmove_state state; + int direction; +}; +typedef struct xf_localmove xfLocalMove; + +struct xf_app_window +{ + xfContext* xfc; + + int x; + int y; + int width; + int height; + char* title; + + UINT32 surfaceId; + UINT64 windowId; + UINT32 ownerWindowId; + + UINT32 dwStyle; + UINT32 dwExStyle; + UINT32 showState; + + INT32 clientOffsetX; + INT32 clientOffsetY; + UINT32 clientAreaWidth; + UINT32 clientAreaHeight; + + INT32 windowOffsetX; + INT32 windowOffsetY; + INT32 windowClientDeltaX; + INT32 windowClientDeltaY; + UINT32 windowWidth; + UINT32 windowHeight; + UINT32 numWindowRects; + RECTANGLE_16* windowRects; + + INT32 visibleOffsetX; + INT32 visibleOffsetY; + UINT32 numVisibilityRects; + RECTANGLE_16* visibilityRects; + + UINT32 localWindowOffsetCorrX; + UINT32 localWindowOffsetCorrY; + + UINT32 resizeMarginLeft; + UINT32 resizeMarginTop; + UINT32 resizeMarginRight; + UINT32 resizeMarginBottom; + + GC gc; + int shmid; + Window handle; + Window* xfwin; + BOOL fullscreen; + BOOL decorations; + BOOL is_mapped; + BOOL is_transient; + xfLocalMove local_move; + BYTE rail_state; + BOOL maxVert; + BOOL maxHorz; + BOOL minimized; + BOOL rail_ignore_configure; + + Pixmap pixmap; + XImage* image; +}; +typedef struct xf_app_window xfAppWindow; +typedef struct xf_rail_icon_cache xfRailIconCache; + BOOL xf_rail_paint(xfContext* xfc, const RECTANGLE_16* rect); BOOL xf_rail_paint_surface(xfContext* xfc, UINT64 windowId, const RECTANGLE_16* rect); diff --git a/client/X11/xf_types.h b/client/X11/xf_types.h new file mode 100644 index 000000000..22072ea2d --- /dev/null +++ b/client/X11/xf_types.h @@ -0,0 +1,42 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * X11 Client + * + * Copyright 2026 Thincast Technologies GmbH + * Copyright 2026 Armin Novak + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +/* Forward declarations */ +typedef struct xf_context xfContext; + +typedef struct +{ + RECTANGLE_16 area; + RECTANGLE_16 workarea; + BOOL primary; +} MONITOR_INFO; + +typedef struct +{ + UINT32 nmonitors; + RECTANGLE_16 area; + RECTANGLE_16 workarea; + MONITOR_INFO* monitors; +} VIRTUAL_SCREEN; diff --git a/client/X11/xf_video.h b/client/X11/xf_video.h index d14e7d42a..899cfeed0 100644 --- a/client/X11/xf_video.h +++ b/client/X11/xf_video.h @@ -19,10 +19,11 @@ #ifndef CLIENT_X11_XF_VIDEO_H_ #define CLIENT_X11_XF_VIDEO_H_ -#include "xfreerdp.h" +#include -#include -#include +#include "xf_types.h" + +typedef struct s_xfVideoContext xfVideoContext; void xf_video_control_init(xfContext* xfc, VideoClientContext* video); void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video); diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index 26e4292ba..5761170f8 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -26,14 +26,11 @@ #include #include -typedef struct xf_app_window xfAppWindow; - -typedef struct xf_localmove xfLocalMove; -typedef struct xf_window xfWindow; - -#include "xf_client.h" +#include "xf_types.h" +#include "xf_rail.h" #include "xf_floatbar.h" -#include "xfreerdp.h" + +typedef struct xf_window xfWindow; // Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html WINPR_PRAGMA_DIAG_PUSH @@ -58,24 +55,6 @@ WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO WINPR_PRAGMA_DIAG_POP -enum xf_localmove_state -{ - LMS_NOT_ACTIVE, - LMS_STARTING, - LMS_ACTIVE, - LMS_TERMINATING -}; - -struct xf_localmove -{ - int root_x; - int root_y; - int window_x; - int window_y; - enum xf_localmove_state state; - int direction; -}; - struct xf_window { GC gc; @@ -94,70 +73,6 @@ struct xf_window BOOL is_transient; }; -struct xf_app_window -{ - xfContext* xfc; - - int x; - int y; - int width; - int height; - char* title; - - UINT32 surfaceId; - UINT64 windowId; - UINT32 ownerWindowId; - - UINT32 dwStyle; - UINT32 dwExStyle; - UINT32 showState; - - INT32 clientOffsetX; - INT32 clientOffsetY; - UINT32 clientAreaWidth; - UINT32 clientAreaHeight; - - INT32 windowOffsetX; - INT32 windowOffsetY; - INT32 windowClientDeltaX; - INT32 windowClientDeltaY; - UINT32 windowWidth; - UINT32 windowHeight; - UINT32 numWindowRects; - RECTANGLE_16* windowRects; - - INT32 visibleOffsetX; - INT32 visibleOffsetY; - UINT32 numVisibilityRects; - RECTANGLE_16* visibilityRects; - - UINT32 localWindowOffsetCorrX; - UINT32 localWindowOffsetCorrY; - - UINT32 resizeMarginLeft; - UINT32 resizeMarginTop; - UINT32 resizeMarginRight; - UINT32 resizeMarginBottom; - - GC gc; - int shmid; - Window handle; - Window* xfwin; - BOOL fullscreen; - BOOL decorations; - BOOL is_mapped; - BOOL is_transient; - xfLocalMove local_move; - BYTE rail_state; - BOOL maxVert; - BOOL maxHorz; - BOOL minimized; - BOOL rail_ignore_configure; - - Pixmap pixmap; - XImage* image; -}; - void xf_ewmhints_init(xfContext* xfc); BOOL xf_GetWorkArea(xfContext* xfc); @@ -207,8 +122,6 @@ void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, int maxWidth void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow, int direction, int x, int y); void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow); -void xf_rail_return_window(xfAppWindow* window); - WINPR_ATTR_MALLOC(xf_rail_return_window, 1) xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd); diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 2ae744f33..c82da03fb 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -24,7 +24,11 @@ #include -typedef struct xf_context xfContext; +#include "xf_types.h" +#include "xf_disp.h" +#include "xf_cliprdr.h" +#include "xf_video.h" +#include "xf_rail.h" #ifdef WITH_XCURSOR #include @@ -54,6 +58,7 @@ typedef struct xf_context xfContext; #include #include #include +#include #if !defined(XcursorUInt) typedef unsigned int XcursorUInt; @@ -109,11 +114,6 @@ struct xf_glyph }; typedef struct xf_glyph xfGlyph; -typedef struct xf_clipboard xfClipboard; -typedef struct s_xfDispContext xfDispContext; -typedef struct s_xfVideoContext xfVideoContext; -typedef struct xf_rail_icon_cache xfRailIconCache; - /* Number of buttons that are mapped from X11 to RDP button events. */ #define NUM_BUTTONS_MAPPED 11