mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #11083 from akallabeth/tz-bias-reset
[winpr,timezone] unify reset of Daylight/StandardBias
This commit is contained in:
@@ -331,11 +331,9 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
|
||||
if (fieldFlags & WINDOW_ORDER_STATE_NEW)
|
||||
{
|
||||
if (!appWindow)
|
||||
appWindow =
|
||||
xf_rail_add_window(xfc, orderInfo->windowId,
|
||||
WINPR_ASSERTING_INT_CAST(uint32_t, windowState->windowOffsetX),
|
||||
WINPR_ASSERTING_INT_CAST(uint32_t, windowState->windowOffsetY),
|
||||
windowState->windowWidth, windowState->windowHeight, 0xFFFFFFFF);
|
||||
appWindow = xf_rail_add_window(xfc, orderInfo->windowId, windowState->windowOffsetX,
|
||||
windowState->windowOffsetY, windowState->windowWidth,
|
||||
windowState->windowHeight, 0xFFFFFFFF);
|
||||
|
||||
if (!appWindow)
|
||||
return FALSE;
|
||||
@@ -1197,7 +1195,7 @@ int xf_rail_uninit(xfContext* xfc, RailClientContext* rail)
|
||||
return 1;
|
||||
}
|
||||
|
||||
xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, UINT32 x, UINT32 y, UINT32 width,
|
||||
xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, INT32 x, INT32 y, UINT32 width,
|
||||
UINT32 height, UINT32 surfaceId)
|
||||
{
|
||||
xfAppWindow* appWindow = NULL;
|
||||
@@ -1213,8 +1211,8 @@ xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, UINT32 x, UINT32 y, U
|
||||
appWindow->xfc = xfc;
|
||||
appWindow->windowId = id;
|
||||
appWindow->surfaceId = surfaceId;
|
||||
appWindow->x = WINPR_ASSERTING_INT_CAST(int, x);
|
||||
appWindow->y = WINPR_ASSERTING_INT_CAST(int, y);
|
||||
appWindow->x = x;
|
||||
appWindow->y = y;
|
||||
appWindow->width = WINPR_ASSERTING_INT_CAST(int, width);
|
||||
appWindow->height = WINPR_ASSERTING_INT_CAST(int, height);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ 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);
|
||||
|
||||
xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, UINT32 x, UINT32 y, UINT32 width,
|
||||
xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, INT32 x, INT32 y, UINT32 width,
|
||||
UINT32 height, UINT32 surfaceId);
|
||||
xfAppWindow* xf_rail_get_window(xfContext* xfc, UINT64 id);
|
||||
|
||||
|
||||
@@ -731,23 +731,29 @@ static int dynamic_time_zone_from_localtime(const struct tm* local_time,
|
||||
int rc = HAVE_TRANSITION_DATES;
|
||||
|
||||
tz->Bias = get_bias(local_time, FALSE);
|
||||
|
||||
/* If the current time has (or had) DST */
|
||||
if (local_time->tm_isdst >= 0)
|
||||
{
|
||||
/* DST bias is the difference between standard time and DST in minutes */
|
||||
const LONG d = get_bias(local_time, TRUE);
|
||||
tz->DaylightBias = -1 * (tz->Bias - d);
|
||||
if (!get_transition_date(local_time, FALSE, &tz->StandardDate))
|
||||
{
|
||||
rc |= HAVE_NO_STANDARD_TRANSITION_DATE;
|
||||
tz->StandardBias = 0;
|
||||
}
|
||||
if (!get_transition_date(local_time, TRUE, &tz->DaylightDate))
|
||||
{
|
||||
rc |= HAVE_NO_DAYLIGHT_TRANSITION_DATE;
|
||||
tz->DaylightBias = 0;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz)
|
||||
{
|
||||
BOOL doesNotHaveStandardDate = FALSE;
|
||||
BOOL doesNotHaveDaylightDate = FALSE;
|
||||
const char** list = NULL;
|
||||
char* tzid = NULL;
|
||||
const char* defaultName = "Client Local Time";
|
||||
@@ -767,13 +773,7 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz)
|
||||
|
||||
tz->Bias = get_bias(local_time, FALSE);
|
||||
if (local_time->tm_isdst >= 0)
|
||||
{
|
||||
const int rc = dynamic_time_zone_from_localtime(local_time, tz);
|
||||
if (rc & HAVE_NO_STANDARD_TRANSITION_DATE)
|
||||
doesNotHaveStandardDate = TRUE;
|
||||
if (rc & HAVE_NO_DAYLIGHT_TRANSITION_DATE)
|
||||
doesNotHaveDaylightDate = TRUE;
|
||||
}
|
||||
dynamic_time_zone_from_localtime(local_time, tz);
|
||||
|
||||
tzid = winpr_guess_time_zone();
|
||||
if (!map_iana_id(tzid, tz))
|
||||
@@ -796,12 +796,6 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz)
|
||||
else
|
||||
res = (local_time->tm_isdst) ? TIME_ZONE_ID_DAYLIGHT : TIME_ZONE_ID_STANDARD;
|
||||
|
||||
if (doesNotHaveDaylightDate)
|
||||
tz->DaylightBias = 0;
|
||||
|
||||
if (doesNotHaveStandardDate)
|
||||
tz->StandardBias = 0;
|
||||
|
||||
out_error:
|
||||
free(tzid);
|
||||
free((void*)list);
|
||||
|
||||
Reference in New Issue
Block a user