mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[client,warnings] properly handle function return
This commit is contained in:
@@ -700,7 +700,10 @@ static BOOL xf_event_FocusIn(xfContext* xfc, const XFocusInEvent* event, BOOL ap
|
||||
if (!app)
|
||||
xf_keyboard_release_all_keypress(xfc);
|
||||
else
|
||||
xf_rail_send_activate(xfc, event->window, TRUE);
|
||||
{
|
||||
if (!xf_rail_send_activate(xfc, event->window, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xf_pointer_update_scale(xfc);
|
||||
|
||||
@@ -731,7 +734,7 @@ static BOOL xf_event_FocusOut(xfContext* xfc, const XFocusOutEvent* event, BOOL
|
||||
|
||||
xf_keyboard_release_all_keypress(xfc);
|
||||
if (app)
|
||||
xf_rail_send_activate(xfc, event->window, FALSE);
|
||||
return xf_rail_send_activate(xfc, event->window, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct
|
||||
int type;
|
||||
bool focus;
|
||||
bool clicked;
|
||||
WINPR_ATTR_NODISCARD OnClick onclick;
|
||||
OnClick onclick;
|
||||
Window handle;
|
||||
} xfFloatbarButton;
|
||||
|
||||
|
||||
@@ -162,7 +162,9 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
|
||||
|
||||
xfc = (xfContext*)gdi->context;
|
||||
EnterCriticalSection(&context->mux);
|
||||
context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
||||
status = context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
||||
if (status != CHANNEL_RC_OK)
|
||||
goto fail;
|
||||
|
||||
for (UINT32 index = 0; index < count; index++)
|
||||
{
|
||||
@@ -187,6 +189,7 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
|
||||
break;
|
||||
}
|
||||
|
||||
fail:
|
||||
free(pSurfaceIds);
|
||||
LeaveCriticalSection(&context->mux);
|
||||
return status;
|
||||
@@ -422,7 +425,12 @@ static UINT xf_DeleteSurface(RdpgfxClientContext* context,
|
||||
if (surface)
|
||||
{
|
||||
if (surface->gdi.windowMapped)
|
||||
IFCALL(context->UnmapWindowForSurface, context, surface->gdi.windowId);
|
||||
{
|
||||
const UINT rc = IFCALLRESULT(CHANNEL_RC_OK, context->UnmapWindowForSurface, context,
|
||||
surface->gdi.windowId);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef WITH_GFX_H264
|
||||
h264_context_free(surface->gdi.h264);
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef struct
|
||||
const RECTANGLE_16* rect;
|
||||
} rail_paint_fn_arg_t;
|
||||
|
||||
void xf_rail_enable_remoteapp_mode(xfContext* xfc)
|
||||
BOOL xf_rail_enable_remoteapp_mode(xfContext* xfc)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
if (!xfc->remote_app)
|
||||
@@ -121,9 +121,10 @@ void xf_rail_enable_remoteapp_mode(xfContext* xfc)
|
||||
|
||||
gdi->suppressOutput = old;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_rail_disable_remoteapp_mode(xfContext* xfc)
|
||||
BOOL xf_rail_disable_remoteapp_mode(xfContext* xfc)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
if (xfc->remote_app)
|
||||
@@ -142,15 +143,16 @@ void xf_rail_disable_remoteapp_mode(xfContext* xfc)
|
||||
|
||||
gdi->suppressOutput = old;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
|
||||
BOOL xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
|
||||
{
|
||||
RAIL_ACTIVATE_ORDER activate = { 0 };
|
||||
xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, xwindow);
|
||||
|
||||
if (!appWindow)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
if (enabled)
|
||||
xf_SetWindowStyle(xfc, appWindow, appWindow->dwStyle, appWindow->dwExStyle);
|
||||
@@ -158,8 +160,9 @@ void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
|
||||
WINPR_ASSERT(appWindow->windowId <= UINT32_MAX);
|
||||
activate.windowId = (UINT32)appWindow->windowId;
|
||||
activate.enabled = enabled;
|
||||
xfc->rail->ClientActivate(xfc->rail, &activate);
|
||||
const UINT rc = xfc->rail->ClientActivate(xfc->rail, &activate);
|
||||
xf_rail_return_window(appWindow);
|
||||
return rc == CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
BOOL xf_rail_send_client_system_command(xfContext* xfc, UINT64 windowId, UINT16 command)
|
||||
@@ -181,14 +184,14 @@ BOOL xf_rail_send_client_system_command(xfContext* xfc, UINT64 windowId, UINT16
|
||||
* send an update to the RDP server informing it of the new window position
|
||||
* and size.
|
||||
*/
|
||||
void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
|
||||
BOOL xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
|
||||
{
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove = { 0 };
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
WINPR_ASSERT(appWindow);
|
||||
if (!appWindow->is_mapped || appWindow->local_move.state != LMS_NOT_ACTIVE)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
/* If current window position disagrees with RDP window position, send update to RDP server */
|
||||
if (appWindow->x != appWindow->windowOffsetX || appWindow->y != appWindow->windowOffsetY ||
|
||||
@@ -210,11 +213,13 @@ void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
|
||||
windowMove.right = WINPR_ASSERTING_INT_CAST(INT16, appWindow->x + appWindow->width + right);
|
||||
windowMove.bottom =
|
||||
WINPR_ASSERTING_INT_CAST(INT16, appWindow->y + appWindow->height + bottom);
|
||||
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
||||
const UINT rc = xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
||||
return rc == CHANNEL_RC_OK;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
BOOL xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
@@ -253,7 +258,9 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
windowMove.right = WINPR_ASSERTING_INT_CAST(INT16, appWindow->x + w); /* In the update to
|
||||
RDP the position is one past the window */
|
||||
windowMove.bottom = WINPR_ASSERTING_INT_CAST(INT16, appWindow->y + h);
|
||||
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
||||
const UINT rc = xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -266,7 +273,8 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
if ((appWindow->local_move.direction != NET_WM_MOVERESIZE_MOVE_KEYBOARD) &&
|
||||
(appWindow->local_move.direction != NET_WM_MOVERESIZE_SIZE_KEYBOARD))
|
||||
{
|
||||
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_BUTTON1, x, y);
|
||||
if (!freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_BUTTON1, x, y))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -279,6 +287,7 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
appWindow->windowWidth = WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->width);
|
||||
appWindow->windowHeight = WINPR_ASSERTING_INT_CAST(uint32_t, appWindow->height);
|
||||
appWindow->local_move.state = LMS_TERMINATING;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL xf_rail_paint_surface(xfContext* xfc, UINT64 windowId, const RECTANGLE_16* rect)
|
||||
|
||||
@@ -116,11 +116,11 @@ BOOL xf_rail_paint(xfContext* xfc, const RECTANGLE_16* rect);
|
||||
BOOL xf_rail_paint_surface(xfContext* xfc, UINT64 windowId, const RECTANGLE_16* rect);
|
||||
|
||||
BOOL xf_rail_send_client_system_command(xfContext* xfc, UINT64 windowId, UINT16 command);
|
||||
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled);
|
||||
void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow);
|
||||
void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow);
|
||||
void xf_rail_enable_remoteapp_mode(xfContext* xfc);
|
||||
void xf_rail_disable_remoteapp_mode(xfContext* xfc);
|
||||
BOOL xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled);
|
||||
BOOL xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow);
|
||||
BOOL xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow);
|
||||
BOOL xf_rail_enable_remoteapp_mode(xfContext* xfc);
|
||||
BOOL xf_rail_disable_remoteapp_mode(xfContext* xfc);
|
||||
|
||||
xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, INT32 x, INT32 y, UINT32 width,
|
||||
UINT32 height, UINT32 surfaceId);
|
||||
|
||||
@@ -126,7 +126,9 @@ rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoin
|
||||
if (!pEntryPoints)
|
||||
return NULL;
|
||||
|
||||
IFCALL(pEntryPoints->GlobalInit);
|
||||
if (!IFCALLRESULT(TRUE, pEntryPoints->GlobalInit))
|
||||
return NULL;
|
||||
|
||||
instance = freerdp_new();
|
||||
|
||||
if (!instance)
|
||||
@@ -1465,9 +1467,8 @@ BOOL freerdp_client_encomsp_set_control(EncomspClientContext* encomsp, BOOL cont
|
||||
if (control)
|
||||
pdu.Flags |= ENCOMSP_REQUEST_INTERACT;
|
||||
|
||||
encomsp->ChangeParticipantControlLevel(encomsp, &pdu);
|
||||
|
||||
return TRUE;
|
||||
const UINT rc = encomsp->ChangeParticipantControlLevel(encomsp, &pdu);
|
||||
return rc == CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static UINT
|
||||
@@ -1887,17 +1888,25 @@ static BOOL freerdp_handle_touch_up(rdpClientContext* cctx, const FreeRDP_TouchC
|
||||
? CONTACT_DATA_PRESSURE_PRESENT
|
||||
: 0;
|
||||
// Ensure contact position is unchanged from "engaged" to "out of range" state
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId,
|
||||
RDPINPUT_CONTACT_FLAG_UPDATE | RDPINPUT_CONTACT_FLAG_INRANGE |
|
||||
RDPINPUT_CONTACT_FLAG_INCONTACT,
|
||||
contactFlags, contact->pressure);
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId, flags,
|
||||
contactFlags, contact->pressure);
|
||||
const UINT rc1 =
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId,
|
||||
RDPINPUT_CONTACT_FLAG_UPDATE | RDPINPUT_CONTACT_FLAG_INRANGE |
|
||||
RDPINPUT_CONTACT_FLAG_INCONTACT,
|
||||
contactFlags, contact->pressure);
|
||||
if (rc1 != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
|
||||
const UINT rc2 = rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y,
|
||||
&contactId, flags, contactFlags, contact->pressure);
|
||||
if (rc2 != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WINPR_ASSERT(rdpei->TouchEnd);
|
||||
rdpei->TouchEnd(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
const UINT rc = rdpei->TouchEnd(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
#else
|
||||
@@ -1928,13 +1937,17 @@ static BOOL freerdp_handle_touch_down(rdpClientContext* cctx, const FreeRDP_Touc
|
||||
const UINT32 contactFlags = ((contact->flags & FREERDP_TOUCH_HAS_PRESSURE) != 0)
|
||||
? CONTACT_DATA_PRESSURE_PRESENT
|
||||
: 0;
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId, flags,
|
||||
contactFlags, contact->pressure);
|
||||
const UINT rc = rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId,
|
||||
flags, contactFlags, contact->pressure);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WINPR_ASSERT(rdpei->TouchBegin);
|
||||
rdpei->TouchBegin(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
const UINT rc = rdpei->TouchBegin(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -1976,13 +1989,17 @@ static BOOL freerdp_handle_touch_motion(rdpClientContext* cctx, const FreeRDP_To
|
||||
const UINT32 contactFlags = ((contact->flags & FREERDP_TOUCH_HAS_PRESSURE) != 0)
|
||||
? CONTACT_DATA_PRESSURE_PRESENT
|
||||
: 0;
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId, flags,
|
||||
contactFlags, contact->pressure);
|
||||
const UINT rc = rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId,
|
||||
flags, contactFlags, contact->pressure);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WINPR_ASSERT(rdpei->TouchUpdate);
|
||||
rdpei->TouchUpdate(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
const UINT rc = rdpei->TouchUpdate(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2012,13 +2029,17 @@ static BOOL freerdp_handle_touch_cancel(rdpClientContext* cctx, const FreeRDP_To
|
||||
const UINT32 contactFlags = ((contact->flags & FREERDP_TOUCH_HAS_PRESSURE) != 0)
|
||||
? CONTACT_DATA_PRESSURE_PRESENT
|
||||
: 0;
|
||||
rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId, flags,
|
||||
contactFlags, contact->pressure);
|
||||
const UINT rc = rdpei->TouchRawEvent(rdpei, contact->id, contact->x, contact->y, &contactId,
|
||||
flags, contactFlags, contact->pressure);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WINPR_ASSERT(rdpei->TouchUpdate);
|
||||
rdpei->TouchEnd(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
const UINT rc = rdpei->TouchEnd(rdpei, contact->id, contact->x, contact->y, &contactId);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2344,7 +2365,10 @@ BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx)
|
||||
{
|
||||
WLog_DBG(TAG, "unhover pen %" PRId32, pen->deviceid);
|
||||
pen->hovering = FALSE;
|
||||
rdpei->PenHoverCancel(rdpei, pen->deviceid, 0, pen->last_x, pen->last_y);
|
||||
const UINT rc =
|
||||
rdpei->PenHoverCancel(rdpei, pen->deviceid, 0, pen->last_x, pen->last_y);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -268,8 +268,12 @@ static void clip_data_entry_free(void* data)
|
||||
unlock_clipboard_data.common.msgType = CB_UNLOCK_CLIPDATA;
|
||||
unlock_clipboard_data.clipDataId = clip_data_entry->clip_data_id;
|
||||
|
||||
file_context->context->ClientUnlockClipboardData(file_context->context,
|
||||
&unlock_clipboard_data);
|
||||
const UINT rc = file_context->context->ClientUnlockClipboardData(file_context->context,
|
||||
&unlock_clipboard_data);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
WLog_Print(file_context->log, WLOG_DEBUG,
|
||||
"ClientUnlockClipboardData failed with %" PRIu32, rc);
|
||||
|
||||
clip_data_entry->has_clip_data_id = FALSE;
|
||||
|
||||
WLog_Print(file_context->log, WLOG_DEBUG, "Destroyed ClipDataEntry with id %u",
|
||||
|
||||
Reference in New Issue
Block a user