Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xfreerdp drop gdi #9492

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions client/X11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ include_directories(${OPENSSL_INCLUDE_DIR})
set(SRCS
xf_utils.h
xf_utils.c
xf_gdi.c
xf_gdi.h
xf_gfx.c
xf_gfx.h
xf_rail.c
Expand Down
67 changes: 4 additions & 63 deletions client/X11/xf_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
#include <winpr/sysinfo.h>
#include <X11/XKBlib.h>

#include "xf_gdi.h"
#include "xf_rail.h"
#if defined(CHANNEL_TSMF_CLIENT)
#include "xf_tsmf.h"
Expand Down Expand Up @@ -404,11 +403,8 @@ static BOOL xf_paint(xfContext* xfc, const GDI_RGN* region)
}
else
{
const BOOL sw =
freerdp_settings_get_bool(xfc->common.context.settings, FreeRDP_SoftwareGdi);
if (sw)
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image, region->x, region->y,
region->x, region->y, region->w, region->h);
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image, region->x, region->y, region->x,
region->y, region->w, region->h);
xf_draw_screen(xfc, region->x, region->y, region->w, region->h);
}
return TRUE;
Expand All @@ -422,8 +418,7 @@ static BOOL xf_end_paint(rdpContext* context)
if (gdi->suppressOutput)
return TRUE;

const BOOL sw = freerdp_settings_get_bool(context->settings, FreeRDP_SoftwareGdi);
HGDI_DC hdc = sw ? gdi->primary->hdc : xfc->hdc;
HGDI_DC hdc = gdi->primary->hdc;

if (!xfc->complex_regions)
{
Expand Down Expand Up @@ -495,33 +490,6 @@ static BOOL xf_sw_desktop_resize(rdpContext* context)
return ret;
}

static BOOL xf_hw_desktop_resize(rdpContext* context)
{
rdpGdi* gdi;
xfContext* xfc = (xfContext*)context;
rdpSettings* settings;
BOOL ret = FALSE;

WINPR_ASSERT(xfc);

gdi = context->gdi;
WINPR_ASSERT(gdi);

settings = context->settings;
WINPR_ASSERT(settings);

xf_lock_x11(xfc);

if (!gdi_resize(gdi, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth),
freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight)))
goto out;

ret = xf_desktop_resize(context);
out:
xf_unlock_x11(xfc);
return ret;
}

static BOOL xf_process_x_events(freerdp* instance)
{
BOOL status = TRUE;
Expand Down Expand Up @@ -631,12 +599,6 @@ BOOL xf_create_window(xfContext* xfc)
xfc->invert = FALSE;
}

if (!xfc->hdc)
{
if (!(xfc->hdc = gdi_CreateDC(xf_get_local_color_format(xfc, TRUE))))
return FALSE;
}

if (!xfc->remote_app)
{
xfc->attribs.background_pixel = BlackPixelOfScreen(xfc->screen);
Expand Down Expand Up @@ -756,12 +718,6 @@ static void xf_window_free(xfContext* xfc)
xfc->window = NULL;
}

if (xfc->hdc)
{
gdi_DeleteDC(xfc->hdc);
xfc->hdc = NULL;
}

#if defined(CHANNEL_TSMF_CLIENT)
if (xfc->xv_context)
{
Expand Down Expand Up @@ -1381,17 +1337,6 @@ static BOOL xf_post_connect(freerdp* instance)
if (!xf_register_pointer(context->graphics))
return FALSE;

if (!freerdp_settings_get_bool(settings, FreeRDP_SoftwareGdi))
{
if (!xf_register_graphics(context->graphics))
{
WLog_ERR(TAG, "failed to register graphics");
return FALSE;
}

xf_gdi_register_update_callbacks(update);
}

#ifdef WITH_XRENDER
xfc->scaledWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
xfc->scaledHeight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
Expand All @@ -1416,11 +1361,7 @@ static BOOL xf_post_connect(freerdp* instance)
}
}

if (freerdp_settings_get_bool(settings, FreeRDP_SoftwareGdi))
update->DesktopResize = xf_sw_desktop_resize;
else
update->DesktopResize = xf_hw_desktop_resize;

update->DesktopResize = xf_sw_desktop_resize;
update->EndPaint = xf_end_paint;
update->PlaySound = xf_play_sound;
update->SetKeyboardIndicators = xf_keyboard_set_indicators;
Expand Down