2011-08-09 06:24:12 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-09 06:24:12 +04:00
|
|
|
* X11 Windows
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_CLIENT_X11_WINDOW_H
|
|
|
|
#define FREERDP_CLIENT_X11_WINDOW_H
|
2011-08-09 06:24:12 +04:00
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
2012-11-22 06:22:06 +04:00
|
|
|
|
2023-10-11 18:03:39 +03:00
|
|
|
#include <winpr/platform.h>
|
2011-08-09 06:24:12 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2022-11-08 11:33:02 +03:00
|
|
|
#include <freerdp/gdi/gfx.h>
|
2011-08-09 06:24:12 +04:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
typedef struct xf_app_window xfAppWindow;
|
|
|
|
|
2011-11-29 01:50:08 +04:00
|
|
|
typedef struct xf_localmove xfLocalMove;
|
2011-08-09 06:24:12 +04:00
|
|
|
typedef struct xf_window xfWindow;
|
|
|
|
|
2013-06-15 21:41:05 +04:00
|
|
|
#include "xf_client.h"
|
2018-09-18 22:25:51 +03:00
|
|
|
#include "xf_floatbar.h"
|
2013-04-28 08:23:36 +04:00
|
|
|
#include "xfreerdp.h"
|
2011-08-09 06:24:12 +04:00
|
|
|
|
2011-11-29 01:50:08 +04:00
|
|
|
// Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
|
2023-10-11 18:03:39 +03:00
|
|
|
WINPR_PRAGMA_DIAG_PUSH
|
|
|
|
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
|
2021-09-08 16:37:45 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
|
|
|
|
#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
|
|
|
|
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
|
|
|
|
#define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
|
2011-11-29 01:50:08 +04:00
|
|
|
|
2015-02-23 20:22:28 +03:00
|
|
|
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
|
2019-11-06 17:24:51 +03:00
|
|
|
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
2015-02-23 20:22:28 +03:00
|
|
|
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
|
|
|
|
2023-10-11 18:03:39 +03:00
|
|
|
WINPR_PRAGMA_DIAG_POP
|
2021-09-08 16:37:45 +03:00
|
|
|
|
2011-12-03 02:51:30 +04:00
|
|
|
enum xf_localmove_state
|
|
|
|
{
|
|
|
|
LMS_NOT_ACTIVE,
|
2011-12-07 03:42:58 +04:00
|
|
|
LMS_STARTING,
|
2011-12-03 02:51:30 +04:00
|
|
|
LMS_ACTIVE,
|
|
|
|
LMS_TERMINATING
|
|
|
|
};
|
|
|
|
|
2011-11-29 01:50:08 +04:00
|
|
|
struct xf_localmove
|
|
|
|
{
|
2014-11-12 04:26:47 +03:00
|
|
|
int root_x;
|
2011-12-03 02:51:30 +04:00
|
|
|
int root_y;
|
2014-11-12 04:26:47 +03:00
|
|
|
int window_x;
|
2011-12-03 02:51:30 +04:00
|
|
|
int window_y;
|
|
|
|
enum xf_localmove_state state;
|
2012-08-04 02:35:17 +04:00
|
|
|
int direction;
|
2011-11-29 01:50:08 +04:00
|
|
|
};
|
|
|
|
|
2011-08-09 06:24:12 +04:00
|
|
|
struct xf_window
|
|
|
|
{
|
2011-08-17 10:14:02 +04:00
|
|
|
GC gc;
|
2011-08-23 05:22:05 +04:00
|
|
|
int left;
|
|
|
|
int top;
|
|
|
|
int right;
|
|
|
|
int bottom;
|
2011-08-09 06:24:12 +04:00
|
|
|
int width;
|
|
|
|
int height;
|
2014-05-23 15:09:11 +04:00
|
|
|
int shmid;
|
2011-08-09 06:24:12 +04:00
|
|
|
Window handle;
|
2014-11-12 04:26:47 +03:00
|
|
|
Window* xfwin;
|
2018-09-18 22:25:51 +03:00
|
|
|
xfFloatbar* floatbar;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL decorations;
|
|
|
|
BOOL is_mapped;
|
|
|
|
BOOL is_transient;
|
2014-11-12 06:27:33 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct xf_app_window
|
|
|
|
{
|
|
|
|
xfContext* xfc;
|
2014-11-13 00:42:32 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
2014-11-13 00:42:32 +03:00
|
|
|
char* title;
|
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
UINT32 surfaceId;
|
|
|
|
UINT64 windowId;
|
2014-11-13 00:42:32 +03:00
|
|
|
UINT32 ownerWindowId;
|
|
|
|
|
|
|
|
UINT32 dwStyle;
|
|
|
|
UINT32 dwExStyle;
|
|
|
|
UINT32 showState;
|
|
|
|
|
2015-10-16 02:18:21 +03:00
|
|
|
INT32 clientOffsetX;
|
|
|
|
INT32 clientOffsetY;
|
2014-11-13 00:42:32 +03:00
|
|
|
UINT32 clientAreaWidth;
|
|
|
|
UINT32 clientAreaHeight;
|
|
|
|
|
2015-10-16 02:18:21 +03:00
|
|
|
INT32 windowOffsetX;
|
|
|
|
INT32 windowOffsetY;
|
|
|
|
INT32 windowClientDeltaX;
|
|
|
|
INT32 windowClientDeltaY;
|
2014-11-13 00:42:32 +03:00
|
|
|
UINT32 windowWidth;
|
|
|
|
UINT32 windowHeight;
|
|
|
|
UINT32 numWindowRects;
|
|
|
|
RECTANGLE_16* windowRects;
|
|
|
|
|
2015-10-16 02:18:21 +03:00
|
|
|
INT32 visibleOffsetX;
|
|
|
|
INT32 visibleOffsetY;
|
2014-11-13 00:42:32 +03:00
|
|
|
UINT32 numVisibilityRects;
|
|
|
|
RECTANGLE_16* visibilityRects;
|
2014-11-12 06:27:33 +03:00
|
|
|
|
2015-02-12 02:24:06 +03:00
|
|
|
UINT32 localWindowOffsetCorrX;
|
|
|
|
UINT32 localWindowOffsetCorrY;
|
2022-06-23 08:57:38 +03:00
|
|
|
|
2022-05-07 04:21:21 +03:00
|
|
|
UINT32 resizeMarginLeft;
|
|
|
|
UINT32 resizeMarginTop;
|
|
|
|
UINT32 resizeMarginRight;
|
|
|
|
UINT32 resizeMarginBottom;
|
2015-02-12 02:24:06 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
GC gc;
|
|
|
|
int shmid;
|
|
|
|
Window handle;
|
|
|
|
Window* xfwin;
|
|
|
|
BOOL fullscreen;
|
|
|
|
BOOL decorations;
|
|
|
|
BOOL is_mapped;
|
|
|
|
BOOL is_transient;
|
2011-12-03 02:51:30 +04:00
|
|
|
xfLocalMove local_move;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE rail_state;
|
2022-04-27 12:37:57 +03:00
|
|
|
BOOL maxVert;
|
|
|
|
BOOL maxHorz;
|
|
|
|
BOOL minimized;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rail_ignore_configure;
|
2022-11-08 11:33:02 +03:00
|
|
|
|
|
|
|
Pixmap pixmap;
|
|
|
|
XImage* image;
|
2011-08-09 06:24:12 +04:00
|
|
|
};
|
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
void xf_ewmhints_init(xfContext* xfc);
|
|
|
|
|
|
|
|
BOOL xf_GetCurrentDesktop(xfContext* xfc);
|
|
|
|
BOOL xf_GetWorkArea(xfContext* xfc);
|
|
|
|
|
|
|
|
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen);
|
2018-09-18 22:25:51 +03:00
|
|
|
void xf_SetWindowMinimized(xfContext* xfc, xfWindow* window);
|
2014-11-12 04:26:47 +03:00
|
|
|
void xf_SetWindowDecorations(xfContext* xfc, Window window, BOOL show);
|
|
|
|
void xf_SetWindowUnlisted(xfContext* xfc, Window window);
|
|
|
|
|
2015-02-23 20:22:28 +03:00
|
|
|
xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height);
|
2014-11-12 04:26:47 +03:00
|
|
|
void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height);
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window);
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2016-08-18 21:14:52 +03:00
|
|
|
Window xf_CreateDummyWindow(xfContext* xfc);
|
|
|
|
void xf_DestroyDummyWindow(xfContext* xfc, Window window);
|
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length,
|
2018-09-18 22:25:51 +03:00
|
|
|
unsigned long* nitems, unsigned long* bytes, BYTE** prop);
|
2014-11-12 04:26:47 +03:00
|
|
|
void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int numArgs, ...);
|
|
|
|
|
2022-11-08 11:33:02 +03:00
|
|
|
BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow);
|
2014-11-13 00:42:32 +03:00
|
|
|
int xf_AppWindowInit(xfContext* xfc, xfAppWindow* appWindow);
|
2022-11-08 11:33:02 +03:00
|
|
|
|
|
|
|
BOOL xf_AppWindowResize(xfContext* xfc, xfAppWindow* appWindow);
|
|
|
|
|
2017-10-31 20:00:15 +03:00
|
|
|
void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, const char* name);
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width, int height);
|
|
|
|
void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state);
|
2019-11-06 17:24:51 +03:00
|
|
|
// void xf_SetWindowIcon(xfContext* xfc, xfAppWindow* appWindow, rdpIcon* icon);
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rects, int nrects);
|
2018-09-18 22:25:51 +03:00
|
|
|
void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
|
|
|
|
UINT32 rectsOffsetY, RECTANGLE_16* rects, int nrects);
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UINT32 ex_style);
|
2024-05-03 08:31:40 +03:00
|
|
|
void xf_SetWindowActions(xfContext* xfc, xfAppWindow* appWindow);
|
2018-09-18 22:25:51 +03:00
|
|
|
void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width,
|
|
|
|
int height);
|
2022-11-08 11:33:02 +03:00
|
|
|
UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface);
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow);
|
2019-11-06 17:24:51 +03:00
|
|
|
void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, int maxWidth, int maxHeight,
|
|
|
|
int maxPosX, int maxPosY, int minTrackWidth, int minTrackHeight,
|
|
|
|
int maxTrackWidth, int maxTrackHeight);
|
2014-11-12 06:27:33 +03:00
|
|
|
void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow, int direction, int x, int y);
|
|
|
|
void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow);
|
2014-11-13 00:42:32 +03:00
|
|
|
xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd);
|
2011-09-01 02:02:22 +04:00
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_CLIENT_X11_WINDOW_H */
|