winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
wine-devel
June 2019
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
[email protected]
73 participants
565 discussions
Start a n
N
ew thread
[PATCH 3/5] wined3d: Pass a wined3d_context_gl structure to context_activate().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- dlls/wined3d/context.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index ba3ac807ac3..2f3ed39a750 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -4211,23 +4211,21 @@ static void context_setup_target(struct wined3d_context *context, context_set_render_offscreen(context, render_offscreen); } -static void context_activate(struct wined3d_context *context, +static void wined3d_context_gl_activate(struct wined3d_context_gl *context_gl, struct wined3d_texture *texture, unsigned int sub_resource_idx) { - struct wined3d_context_gl *context_gl = wined3d_context_gl(context); - wined3d_context_gl_enter(context_gl); wined3d_context_gl_update_window(context_gl); - context_setup_target(context, texture, sub_resource_idx); - if (!context->valid) + context_setup_target(&context_gl->c, texture, sub_resource_idx); + if (!context_gl->c.valid) return; - if (context != context_get_current()) + if (&context_gl->c != context_get_current()) { - if (!context_set_current(context)) + if (!context_set_current(&context_gl->c)) ERR("Failed to activate the new context.\n"); } - else if (context->needs_set) + else if (context_gl->c.needs_set) { wined3d_context_gl_set_gl_context(context_gl); } @@ -4292,7 +4290,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, return NULL; } - context_activate(context, texture, sub_resource_idx); + wined3d_context_gl_activate(wined3d_context_gl(context), texture, sub_resource_idx); return context; } @@ -4309,7 +4307,8 @@ struct wined3d_context *context_reacquire(const struct wined3d_device *device, if (context->current_rt.texture) { - context_activate(context, context->current_rt.texture, context->current_rt.sub_resource_idx); + wined3d_context_gl_activate(wined3d_context_gl(context), + context->current_rt.texture, context->current_rt.sub_resource_idx); return context; } -- 2.11.0
4 years, 11 months
1
0
0
0
[PATCH 2/5] wined3d: Pass a wined3d_context_gl strcuture to find_draw_buffers_mask().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- dlls/wined3d/context.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index c0697408331..ba3ac807ac3 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3141,18 +3141,17 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, return TRUE; } -static unsigned int find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) +static uint32_t find_draw_buffers_mask(const struct wined3d_context_gl *context_gl, const struct wined3d_state *state) { - const struct wined3d_context_gl *context_gl = wined3d_context_gl_const(context); struct wined3d_rendertarget_view * const *rts = state->fb->render_targets; struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; - const struct wined3d_gl_info *gl_info = context->gl_info; + const struct wined3d_gl_info *gl_info = context_gl->c.gl_info; unsigned int rt_mask, mask; unsigned int i; if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rts[0]->resource); - else if (!context->render_offscreen) + else if (!context_gl->c.render_offscreen) return context_generate_rt_mask_from_resource(rts[0]->resource); rt_mask = ps ? ps->reg_maps.rt_mask : 1; @@ -3173,7 +3172,7 @@ static unsigned int find_draw_buffers_mask(const struct wined3d_context *context void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { struct wined3d_context_gl *context_gl = wined3d_context_gl(context); - unsigned int rt_mask = find_draw_buffers_mask(context, state); + uint32_t rt_mask = find_draw_buffers_mask(context_gl, state); const struct wined3d_fb_state *fb = state->fb; DWORD color_location = 0; DWORD *cur_mask; @@ -3473,12 +3472,12 @@ static void wined3d_context_gl_update_tex_unit_map(struct wined3d_context_gl *co void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { struct wined3d_context_gl *context_gl = wined3d_context_gl(context); - DWORD rt_mask, *cur_mask; + uint32_t rt_mask, *cur_mask; if (isStateDirty(context, STATE_FRAMEBUFFER)) return; cur_mask = context_gl->current_fbo ? &context_gl->current_fbo->rt_mask : &context_gl->draw_buffers_mask; - rt_mask = find_draw_buffers_mask(context, state); + rt_mask = find_draw_buffers_mask(context_gl, state); if (rt_mask != *cur_mask) { context_apply_draw_buffers(context, rt_mask); -- 2.11.0
4 years, 11 months
1
0
0
0
[PATCH 1/5] wined3d: Pass a wined3d_context_gl structure to context_generate_rt_mask_no_fbo().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- dlls/wined3d/context.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 796030561cb..c0697408331 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2747,10 +2747,9 @@ GLenum wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_g } } -static DWORD context_generate_rt_mask_no_fbo(const struct wined3d_context *context, struct wined3d_resource *rt) +static uint32_t wined3d_context_gl_generate_rt_mask_no_fbo(const struct wined3d_context_gl *context_gl, + struct wined3d_resource *rt) { - const struct wined3d_context_gl *context_gl = wined3d_context_gl_const(context); - if (!rt || rt->format->id == WINED3DFMT_NULL) return 0; else if (rt->type != WINED3D_RTYPE_BUFFER && texture_from_resource(rt)->swapchain) @@ -2764,8 +2763,8 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl, { struct wined3d_context *context = &context_gl->c; const struct wined3d_gl_info *gl_info; + uint32_t rt_mask, *cur_mask; struct wined3d_texture *rt; - DWORD rt_mask, *cur_mask; unsigned int sampler; SIZE rt_size; @@ -2796,7 +2795,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl, } else { - rt_mask = context_generate_rt_mask_no_fbo(context, &rt->resource); + rt_mask = wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, &rt->resource); } cur_mask = context_gl->current_fbo ? &context_gl->current_fbo->rt_mask : &context_gl->draw_buffers_mask; @@ -3029,7 +3028,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, struct wined3d_rendertarget_view * const *rts = fb->render_targets; const struct wined3d_gl_info *gl_info = context_gl->c.gl_info; struct wined3d_rendertarget_view *dsv = fb->depth_stencil; - DWORD rt_mask = 0, *cur_mask; + uint32_t rt_mask = 0, *cur_mask; unsigned int i; if (isStateDirty(&context_gl->c, STATE_FRAMEBUFFER) || fb != state->fb @@ -3088,7 +3087,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, } else { - rt_mask = context_generate_rt_mask_no_fbo(&context_gl->c, rt_count ? rts[0]->resource : NULL); + rt_mask = wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rt_count ? rts[0]->resource : NULL); } } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO @@ -3102,7 +3101,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, } else { - rt_mask = context_generate_rt_mask_no_fbo(&context_gl->c, rt_count ? rts[0]->resource : NULL); + rt_mask = wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rt_count ? rts[0]->resource : NULL); } cur_mask = context_gl->current_fbo ? &context_gl->current_fbo->rt_mask : &context_gl->draw_buffers_mask; @@ -3144,6 +3143,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, static unsigned int find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { + const struct wined3d_context_gl *context_gl = wined3d_context_gl_const(context); struct wined3d_rendertarget_view * const *rts = state->fb->render_targets; struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -3151,7 +3151,7 @@ static unsigned int find_draw_buffers_mask(const struct wined3d_context *context unsigned int i; if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return context_generate_rt_mask_no_fbo(context, rts[0]->resource); + return wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rts[0]->resource); else if (!context->render_offscreen) return context_generate_rt_mask_from_resource(rts[0]->resource); -- 2.11.0
4 years, 11 months
1
0
0
0
[PATCH 1/2] mf: Add rate support for presentation clock.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/mf/session.c | 107 +++++++++++++++++++++++++++++++++------------ dlls/mf/tests/mf.c | 52 ++++++++++++++++++++++ 2 files changed, 131 insertions(+), 28 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 8e41942448..3a33a88a4b 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -85,6 +85,7 @@ enum clock_command CLOCK_CMD_START = 0, CLOCK_CMD_STOP, CLOCK_CMD_PAUSE, + CLOCK_CMD_SET_RATE, CLOCK_CMD_MAX, }; @@ -94,6 +95,16 @@ enum clock_notification CLOCK_NOTIFY_STOP, CLOCK_NOTIFY_PAUSE, CLOCK_NOTIFY_RESTART, + CLOCK_NOTIFY_SET_RATE, +}; + +struct clock_state_change_param +{ + union + { + LONGLONG offset; + float rate; + } u; }; struct sink_notification @@ -101,7 +112,7 @@ struct sink_notification IUnknown IUnknown_iface; LONG refcount; MFTIME system_time; - LONGLONG offset; + struct clock_state_change_param param; enum clock_notification notification; IMFClockStateSink *sink; }; @@ -118,6 +129,7 @@ struct presentation_clock IMFClockStateSink *time_source_sink; MFCLOCK_STATE state; struct list sinks; + float rate; CRITICAL_SECTION cs; }; @@ -1092,8 +1104,8 @@ static const IUnknownVtbl sinknotificationvtbl = sink_notification_Release, }; -static HRESULT create_sink_notification(MFTIME system_time, LONGLONG offset, enum clock_notification notification, - IMFClockStateSink *sink, IUnknown **out) +static HRESULT create_sink_notification(MFTIME system_time, struct clock_state_change_param param, + enum clock_notification notification, IMFClockStateSink *sink, IUnknown **out) { struct sink_notification *object; @@ -1104,7 +1116,7 @@ static HRESULT create_sink_notification(MFTIME system_time, LONGLONG offset, enu object->IUnknown_iface.lpVtbl = &sinknotificationvtbl; object->refcount = 1; object->system_time = system_time; - object->offset = offset; + object->param = param; object->notification = notification; object->sink = sink; IMFClockStateSink_AddRef(object->sink); @@ -1114,15 +1126,15 @@ static HRESULT create_sink_notification(MFTIME system_time, LONGLONG offset, enu return S_OK; } -static HRESULT clock_call_state_change(MFTIME system_time, LONGLONG offset, enum clock_notification notification, - IMFClockStateSink *sink) +static HRESULT clock_call_state_change(MFTIME system_time, struct clock_state_change_param param, + enum clock_notification notification, IMFClockStateSink *sink) { HRESULT hr = S_OK; switch (notification) { case CLOCK_NOTIFY_START: - hr = IMFClockStateSink_OnClockStart(sink, system_time, offset); + hr = IMFClockStateSink_OnClockStart(sink, system_time, param.u.offset); break; case CLOCK_NOTIFY_STOP: hr = IMFClockStateSink_OnClockStop(sink, system_time); @@ -1133,6 +1145,10 @@ static HRESULT clock_call_state_change(MFTIME system_time, LONGLONG offset, enum case CLOCK_NOTIFY_RESTART: hr = IMFClockStateSink_OnClockRestart(sink, system_time); break; + case CLOCK_NOTIFY_SET_RATE: + /* System time source does not allow 0.0 rate, presentation clock allows it without raising errors. */ + IMFClockStateSink_OnClockSetRate(sink, system_time, param.u.rate); + break; default: ; } @@ -1140,20 +1156,22 @@ static HRESULT clock_call_state_change(MFTIME system_time, LONGLONG offset, enum return hr; } -static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_command command, LONGLONG offset) +static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_command command, + struct clock_state_change_param param) { static const BYTE state_change_is_allowed[MFCLOCK_STATE_PAUSED+1][CLOCK_CMD_MAX] = - { /* S S* P */ - /* INVALID */ { 1, 1, 1 }, - /* RUNNING */ { 1, 1, 1 }, - /* STOPPED */ { 1, 1, 0 }, - /* PAUSED */ { 1, 1, 0 }, + { /* S S* P, R */ + /* INVALID */ { 1, 1, 1, 1 }, + /* RUNNING */ { 1, 1, 1, 1 }, + /* STOPPED */ { 1, 1, 0, 1 }, + /* PAUSED */ { 1, 1, 0, 1 }, }; static const MFCLOCK_STATE states[CLOCK_CMD_MAX] = { - /* CLOCK_CMD_START */ MFCLOCK_STATE_RUNNING, - /* CLOCK_CMD_STOP */ MFCLOCK_STATE_STOPPED, - /* CLOCK_CMD_PAUSE */ MFCLOCK_STATE_PAUSED, + /* CLOCK_CMD_START */ MFCLOCK_STATE_RUNNING, + /* CLOCK_CMD_STOP */ MFCLOCK_STATE_STOPPED, + /* CLOCK_CMD_PAUSE */ MFCLOCK_STATE_PAUSED, + /* CLOCK_CMD_SET_RATE */ 0, /* Unused */ }; enum clock_notification notification; struct clock_sink *sink; @@ -1162,7 +1180,7 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c MFTIME system_time; HRESULT hr; - if (clock->state == states[command] && clock->state != MFCLOCK_STATE_RUNNING) + if (command != CLOCK_CMD_SET_RATE && clock->state == states[command] && clock->state != MFCLOCK_STATE_RUNNING) return MF_E_CLOCK_STATE_ALREADY_SET; if (!state_change_is_allowed[clock->state][command]) @@ -1173,7 +1191,7 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c switch (command) { case CLOCK_CMD_START: - if (clock->state == MFCLOCK_STATE_PAUSED && offset == PRESENTATION_CURRENT_POSITION) + if (clock->state == MFCLOCK_STATE_PAUSED && param.u.offset == PRESENTATION_CURRENT_POSITION) notification = CLOCK_NOTIFY_RESTART; else notification = CLOCK_NOTIFY_START; @@ -1184,18 +1202,21 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c case CLOCK_CMD_PAUSE: notification = CLOCK_NOTIFY_PAUSE; break; + case CLOCK_CMD_SET_RATE: + notification = CLOCK_NOTIFY_SET_RATE; + break; default: ; } - if (FAILED(hr = clock_call_state_change(system_time, offset, notification, clock->time_source_sink))) + if (FAILED(hr = clock_call_state_change(system_time, param, notification, clock->time_source_sink))) return hr; clock->state = states[command]; LIST_FOR_EACH_ENTRY(sink, &clock->sinks, struct clock_sink, entry) { - if (SUCCEEDED(create_sink_notification(system_time, offset, notification, sink->state_sink, ¬ify_object))) + if (SUCCEEDED(create_sink_notification(system_time, param, notification, sink->state_sink, ¬ify_object))) { hr = MFCreateAsyncResult(notify_object, &clock->IMFAsyncCallback_iface, NULL, &result); IUnknown_Release(notify_object); @@ -1213,12 +1234,14 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG start_offset) { struct presentation_clock *clock = impl_from_IMFPresentationClock(iface); + struct clock_state_change_param param = { 0 }; HRESULT hr; TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(start_offset)); EnterCriticalSection(&clock->cs); - hr = clock_change_state(clock, CLOCK_CMD_START, start_offset); + param.u.offset = start_offset; + hr = clock_change_state(clock, CLOCK_CMD_START, param); LeaveCriticalSection(&clock->cs); return hr; @@ -1227,12 +1250,13 @@ static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG static HRESULT WINAPI present_clock_Stop(IMFPresentationClock *iface) { struct presentation_clock *clock = impl_from_IMFPresentationClock(iface); + struct clock_state_change_param param = { 0 }; HRESULT hr; TRACE("%p.\n", iface); EnterCriticalSection(&clock->cs); - hr = clock_change_state(clock, CLOCK_CMD_STOP, 0); + hr = clock_change_state(clock, CLOCK_CMD_STOP, param); LeaveCriticalSection(&clock->cs); return hr; @@ -1241,12 +1265,13 @@ static HRESULT WINAPI present_clock_Stop(IMFPresentationClock *iface) static HRESULT WINAPI present_clock_Pause(IMFPresentationClock *iface) { struct presentation_clock *clock = impl_from_IMFPresentationClock(iface); + struct clock_state_change_param param = { 0 }; HRESULT hr; TRACE("%p.\n", iface); EnterCriticalSection(&clock->cs); - hr = clock_change_state(clock, CLOCK_CMD_PAUSE, 0); + hr = clock_change_state(clock, CLOCK_CMD_PAUSE, param); LeaveCriticalSection(&clock->cs); return hr; @@ -1292,16 +1317,41 @@ static ULONG WINAPI present_clock_rate_control_Release(IMFRateControl *iface) static HRESULT WINAPI present_clock_rate_SetRate(IMFRateControl *iface, BOOL thin, float rate) { - FIXME("%p, %d, %f.\n", iface, thin, rate); + struct presentation_clock *clock = impl_from_IMFRateControl(iface); + struct clock_state_change_param param; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %d, %f.\n", iface, thin, rate); + + if (thin) + return MF_E_THINNING_UNSUPPORTED; + + EnterCriticalSection(&clock->cs); + param.u.rate = rate; + if (SUCCEEDED(hr = clock_change_state(clock, CLOCK_CMD_SET_RATE, param))) + clock->rate = rate; + LeaveCriticalSection(&clock->cs); + + return hr; } static HRESULT WINAPI present_clock_rate_GetRate(IMFRateControl *iface, BOOL *thin, float *rate) { - FIXME("%p, %p, %p.\n", iface, thin, rate); + struct presentation_clock *clock = impl_from_IMFRateControl(iface); - return E_NOTIMPL; + TRACE("%p, %p, %p.\n", iface, thin, rate); + + if (!rate) + return E_INVALIDARG; + + if (thin) + *thin = FALSE; + + EnterCriticalSection(&clock->cs); + *rate = clock->rate; + LeaveCriticalSection(&clock->cs); + + return S_OK; } static const IMFRateControlVtbl presentclockratecontrolvtbl = @@ -1439,7 +1489,7 @@ static HRESULT WINAPI present_clock_sink_callback_Invoke(IMFAsyncCallback *iface data = impl_from_IUnknown(object); - clock_call_state_change(data->system_time, data->offset, data->notification, data->sink); + clock_call_state_change(data->system_time, data->param, data->notification, data->sink); IUnknown_Release(object); @@ -1475,6 +1525,7 @@ HRESULT WINAPI MFCreatePresentationClock(IMFPresentationClock **clock) object->IMFAsyncCallback_iface.lpVtbl = &presentclocksinkcallbackvtbl; object->refcount = 1; list_init(&object->sinks); + object->rate = 1.0f; InitializeCriticalSection(&object->cs); *clock = &object->IMFPresentationClock_iface; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 8f9a97d497..cb2db22d93 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1430,6 +1430,7 @@ static void test_presentation_clock(void) MFCLOCK_PROPERTIES props, props2; IMFRateControl *rate_control; IMFPresentationClock *clock; + MFSHUTDOWN_STATUS status; IMFShutdown *shutdown; MFTIME systime, time; LONGLONG clock_time; @@ -1437,7 +1438,9 @@ static void test_presentation_clock(void) IMFTimer *timer; unsigned int i; DWORD value; + float rate; HRESULT hr; + BOOL thin; hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); @@ -1577,6 +1580,40 @@ static void test_presentation_clock(void) hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFRateControl, (void **)&rate_control); ok(hr == S_OK, "Failed to get rate control interface, hr %#x.\n", hr); + + hr = IMFRateControl_GetRate(rate_control, NULL, &rate); + ok(hr == S_OK, "Failed to get clock rate, hr %#x.\n", hr); + + hr = IMFRateControl_GetRate(rate_control, &thin, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMFRateControl_GetRate(rate_control, &thin, &rate); + ok(hr == S_OK, "Failed to get clock rate, hr %#x.\n", hr); + ok(rate == 1.0f, "Unexpected rate.\n"); + ok(!thin, "Unexpected thinning.\n"); + + hr = IMFPresentationClock_Start(clock, 0); + ok(hr == S_OK, "Failed to stop, hr %#x.\n", hr); + + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0f); + ok(hr == S_OK, "Failed to set clock rate, hr %#x.\n", hr); + hr = IMFRateControl_GetRate(rate_control, &thin, &rate); + ok(hr == S_OK, "Failed to get clock rate, hr %#x.\n", hr); + ok(rate == 0.0f, "Unexpected rate.\n"); + hr = IMFRateControl_SetRate(rate_control, FALSE, 1.0f); + ok(hr == S_OK, "Failed to set clock rate, hr %#x.\n", hr); + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0f); + ok(hr == S_OK, "Failed to set clock rate, hr %#x.\n", hr); + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.5f); + ok(hr == S_OK, "Failed to set clock rate, hr %#x.\n", hr); + hr = IMFRateControl_SetRate(rate_control, TRUE, -1.0f); + ok(hr == MF_E_THINNING_UNSUPPORTED, "Unexpected hr %#x.\n", hr); + + hr = IMFRateControl_GetRate(rate_control, &thin, &rate); + ok(hr == S_OK, "Failed to get clock rate, hr %#x.\n", hr); + ok(rate == 0.5f, "Unexpected rate.\n"); + ok(!thin, "Unexpected thinning.\n"); + IMFRateControl_Release(rate_control); hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFTimer, (void **)&timer); @@ -1585,6 +1622,21 @@ static void test_presentation_clock(void) hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFShutdown, (void **)&shutdown); ok(hr == S_OK, "Failed to get shutdown interface, hr %#x.\n", hr); + + /* Shutdown behavior. */ + hr = IMFShutdown_GetShutdownStatus(shutdown, NULL); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMFShutdown_Shutdown(shutdown); +todo_wine + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + hr = IMFShutdown_GetShutdownStatus(shutdown, &status); +todo_wine { + ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr); + ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n"); +} IMFShutdown_Release(shutdown); IMFPresentationClock_Release(clock); -- 2.20.1
4 years, 11 months
1
1
0
0
[PATCH] comctl32/trackbar: Do not consider window size when initializing fixed length thumb.
by Nikolay Sivov
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47143
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/comctl32/tests/trackbar.c | 18 +++++++++++++++++- dlls/comctl32/trackbar.c | 19 +++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c index 7f17e9e4b6..eb5464483d 100644 --- a/dlls/comctl32/tests/trackbar.c +++ b/dlls/comctl32/tests/trackbar.c @@ -931,7 +931,7 @@ static void test_selection(void) static void test_thumb_length(void) { HWND hWndTrackbar; - int r; + int r, r2; hWndTrackbar = create_trackbar(defaultstyle, hWndParent); ok(hWndTrackbar != NULL, "Expected non NULL value\n"); @@ -963,6 +963,22 @@ static void test_thumb_length(void) ok_sequence(sequences, PARENT_SEQ_INDEX, parent_thumb_length_test_seq, "parent thumb length test sequence", TRUE); DestroyWindow(hWndTrackbar); + + /* Fixed thumb length does not depend on window size. */ + hWndTrackbar = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", WS_VISIBLE | TBS_ENABLESELRANGE + | TBS_FIXEDLENGTH, 0, 0, 0, 0, hWndParent, NULL, GetModuleHandleA(NULL), NULL); + + r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0, 0); + + DestroyWindow(hWndTrackbar); + + hWndTrackbar = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", WS_VISIBLE | TBS_ENABLESELRANGE + | TBS_FIXEDLENGTH, 0, 0, 200, 200, hWndParent, NULL, GetModuleHandleA(NULL), NULL); + + r2 = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0, 0); + ok(r2 == r, "Unexpected thumb length %d.\n", r); + + DestroyWindow(hWndTrackbar); } static void test_tic_settings(void) diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c index c3b9b27741..de3f93e8eb 100644 --- a/dlls/comctl32/trackbar.c +++ b/dlls/comctl32/trackbar.c @@ -1481,15 +1481,18 @@ TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr) infoPtr->uThumbLen = get_scaled_metric(infoPtr, infoPtr->dwStyle & TBS_ENABLESELRANGE ? 23 : 21); - GetClientRect(infoPtr->hwndSelf,&rect); - if (infoPtr->dwStyle & TBS_VERT) - client_size = rect.right - rect.left; - else - client_size = rect.bottom - rect.top; + if (!(infoPtr->dwStyle & TBS_FIXEDLENGTH)) + { + GetClientRect(infoPtr->hwndSelf, &rect); + if (infoPtr->dwStyle & TBS_VERT) + client_size = rect.right - rect.left; + else + client_size = rect.bottom - rect.top; - if (client_size < infoPtr->uThumbLen) - infoPtr->uThumbLen = client_size > get_scaled_metric(infoPtr, 9) ? - client_size - get_scaled_metric(infoPtr, 5) : get_scaled_metric(infoPtr, 4); + if (client_size < infoPtr->uThumbLen) + infoPtr->uThumbLen = client_size > get_scaled_metric(infoPtr, 9) ? + client_size - get_scaled_metric(infoPtr, 5) : get_scaled_metric(infoPtr, 4); + } TRACKBAR_CalcChannel (infoPtr); TRACKBAR_UpdateThumb (infoPtr); -- 2.20.1
4 years, 11 months
1
0
0
0
[PATCH v7 1/7] winex11.drv: Add Xinerama display device handler.
by Zhiyi Zhang
Display device handlers are used to initialize the display device registry data. Different handlers can be implemented according to the defined interface, for example, via Xinerama or XRandR. With those registry data, EnumDisplayDevices, EnumDisplayMonitors and GetMonitorInfo can be built on top of it. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- v2: Supersede 162308~162314, fix xinerama primary adapter reporting, fix registry data reinit failure. v3: Rebase v4: Merge patches. Rebase. Supersede 164594~164599, 164612~164613 v5: Fix explorer patch triggered user32 test failures. Supersede 165122~165128. v6: Restructure patches. Supersede 165134~165140 v7: Supersede 165307~165313. Add mutex to avoid init race. Remove old adapter keys during reinit. Add fallback monitor data in explorer. Simplify code. dlls/winex11.drv/Makefile.in | 1 + dlls/winex11.drv/display.c | 82 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 15 +++++++ dlls/winex11.drv/x11drv_main.c | 1 + dlls/winex11.drv/xinerama.c | 7 +++ 5 files changed, 106 insertions(+) create mode 100644 dlls/winex11.drv/display.c diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index 747f509b44..9ca2fc6efe 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -9,6 +9,7 @@ C_SRCS = \ brush.c \ clipboard.c \ desktop.c \ + display.c \ event.c \ graphics.c \ ime.c \ diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c new file mode 100644 index 0000000000..a82975bfb9 --- /dev/null +++ b/dlls/winex11.drv/display.c @@ -0,0 +1,82 @@ +/* + * X11DRV display device functions + * + * Copyright 2019 Zhiyi Zhang for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "wine/debug.h" +#include "x11drv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(x11drv); + +static const WCHAR video_keyW[] = { + 'H','A','R','D','W','A','R','E','\\', + 'D','E','V','I','C','E','M','A','P','\\', + 'V','I','D','E','O',0}; + +static struct x11drv_display_device_handler handler; + +void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *new_handler) +{ + if (new_handler->priority > handler.priority) + { + handler = *new_handler; + TRACE("Display device functions are now handled by: %s\n", handler.name); + } +} + +void X11DRV_DisplayDevices_Init(void) +{ + static const WCHAR init_mutexW[] = + {'_','_','x','1','1','_','d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t',0}; + HANDLE mutex; + HKEY video_hkey = NULL; + DWORD disposition = 0; + BOOL success = FALSE; + + mutex = CreateMutexW(NULL, FALSE, init_mutexW); + WaitForSingleObject(mutex, INFINITE); + + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey, + &disposition)) + goto fail; + + /* Avoid unnecessary reinit */ + if (disposition != REG_CREATED_NEW_KEY) + { + success = TRUE; + goto fail; + } + + TRACE("via %s\n", wine_dbgstr_a(handler.name)); + + success = TRUE; +fail: + RegCloseKey(video_hkey); + ReleaseMutex(mutex); + CloseHandle(mutex); + if (!success) + ERR("Failed to initialize display devices\n"); +} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c633102a38..fbc5a104f6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -665,6 +665,21 @@ struct x11drv_mode_info *X11DRV_Settings_SetHandlers(const char *name, void X11DRV_XF86VM_Init(void) DECLSPEC_HIDDEN; void X11DRV_XRandR_Init(void) DECLSPEC_HIDDEN; +/* X11 display device handler. Used to initialize display device registry data */ + +/* Required functions for display device registry initialization */ +struct x11drv_display_device_handler +{ + /* A name to tell what host driver is used */ + CHAR name[MAX_PATH]; + + /* Higher priority can override handlers with lower proprity */ + INT priority; +}; + +extern void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN; +extern void X11DRV_DisplayDevices_Init(void) DECLSPEC_HIDDEN; + /* XIM support */ extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN; extern XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index e67a3c05a9..69478741f1 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -597,6 +597,7 @@ static BOOL process_attach(void) X11DRV_InitKeyboard( gdi_display ); if (use_xim) use_xim = X11DRV_InitXIM( input_style ); + X11DRV_DisplayDevices_Init(); return TRUE; } diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index 739b139736..35dd36049b 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -30,6 +30,8 @@ #include "wine/library.h" #include "x11drv.h" #include "wine/debug.h" +#include "wine/heap.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(x11drv); @@ -201,6 +203,7 @@ RECT get_primary_monitor_rect(void) void xinerama_init( unsigned int width, unsigned int height ) { + struct x11drv_display_device_handler handler; MONITORINFOEXW *primary; int i; RECT rect; @@ -234,6 +237,10 @@ void xinerama_init( unsigned int width, unsigned int height ) (monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? " (primary)" : "" ); } + strcpy( handler.name, "Xinerama" ); + handler.priority = 100; + X11DRV_DisplayDevices_SetHandler( &handler ); + TRACE( "virtual size: %s primary: %s\n", wine_dbgstr_rect(&virtual_screen_rect), wine_dbgstr_rect(&primary->rcMonitor) ); } -- 2.20.1
4 years, 11 months
2
4
0
0
[PATCH 3/3] dbghelp: Reimplement SymGetLineFromAddr64 using SymGetLineFromAddrW64.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- dlls/dbghelp/symbol.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 0f133c0d34..fec82950bb 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1598,6 +1598,23 @@ static void copy_line_32_from_64(IMAGEHLP_LINE* l32, const IMAGEHLP_LINE64* l64) l32->Address = l64->Address; } +/****************************************************************** + * copy_line_64_from_W64 (internal) + * + */ +static void copy_line_64_from_W64(struct process* pcs, IMAGEHLP_LINE64* l64, const IMAGEHLP_LINEW64* l64w) +{ + char path[MAX_PATH]; + unsigned len = WideCharToMultiByte(CP_ACP, 0, l64w->FileName, -1, path, MAX_PATH, NULL, NULL); + + l64->Key = l64w->Key; + l64->LineNumber = l64w->LineNumber; + l64->FileName = fetch_buffer(pcs, len + 1); + lstrcpyA(l64->FileName, path); + + l64->Address = l64w->Address; +} + /****************************************************************** * copy_line_32_from_64W (internal) * @@ -1637,23 +1654,16 @@ BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line) { - struct module_pair pair; - struct symt_ht* symt; + IMAGEHLP_LINEW64 line64; TRACE("%p %s %p %p\n", hProcess, wine_dbgstr_longlong(dwAddr), pdwDisplacement, Line); if (Line->SizeOfStruct < sizeof(*Line)) return FALSE; - pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, dwAddr, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; - if ((symt = symt_find_nearest(pair.effective, dwAddr)) == NULL) return FALSE; - - if (symt->symt.tag != SymTagFunction) return FALSE; - if (!symt_fill_func_line_info(pair.effective, (struct symt_function*)symt, - dwAddr, Line)) return FALSE; - *pdwDisplacement = dwAddr - Line->Address; + line64.SizeOfStruct = sizeof(line64); + if(!SymGetLineFromAddrW64(hProcess, dwAddr, pdwDisplacement, &line64)) + return FALSE; + copy_line_64_from_W64(process_find_by_handle(hProcess), Line, &line64); return TRUE; } -- 2.17.1
4 years, 11 months
1
0
0
0
[PATCH 2/3] dbghelp: Reimplement SymGetLineFromAddr using SymGetLineFromAddrW64.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- dlls/dbghelp/symbol.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 177c66480d..0f133c0d34 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1598,6 +1598,22 @@ static void copy_line_32_from_64(IMAGEHLP_LINE* l32, const IMAGEHLP_LINE64* l64) l32->Address = l64->Address; } +/****************************************************************** + * copy_line_32_from_64W (internal) + * + */ +static void copy_line_32_from_64W(struct process* pcs, IMAGEHLP_LINE* l32, const IMAGEHLP_LINEW64* l64w) +{ + char path[MAX_PATH]; + unsigned len = WideCharToMultiByte(CP_ACP, 0, l64w->FileName, -1, path, MAX_PATH, NULL, NULL); + + l32->Key = l64w->Key; + l32->LineNumber = l64w->LineNumber; + l32->FileName = fetch_buffer(pcs, len + 1); + lstrcpyA(l32->FileName, path); + l32->Address = l64w->Address; +} + /****************************************************************** * SymGetLineFromAddr (DBGHELP.@) * @@ -1605,12 +1621,12 @@ static void copy_line_32_from_64(IMAGEHLP_LINE* l32, const IMAGEHLP_LINE64* l64) BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line) { - IMAGEHLP_LINE64 il64; + IMAGEHLP_LINEW64 il64w; - il64.SizeOfStruct = sizeof(il64); - if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64)) + il64w.SizeOfStruct = sizeof(il64w); + if (!SymGetLineFromAddrW64(hProcess, dwAddr, pdwDisplacement, &il64w)) return FALSE; - copy_line_32_from_64(Line, &il64); + copy_line_32_from_64W(process_find_by_handle(hProcess), Line, &il64w); return TRUE; } -- 2.17.1
4 years, 11 months
1
0
0
0
[PATCH] winemac.drv: Avoid casts from COM objects to interfaces
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- Not compile tested dlls/winemac.drv/dragdrop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c index e0890183bc..c1f542f324 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -60,8 +60,8 @@ static HRESULT WINAPI dddo_QueryInterface(IDataObject* iface, REFIID riid, LPVOI if (IsEqualIID(riid, &IID_IUnknown) || (IsEqualIID(riid, &IID_IDataObject))) { - *ppvObj = This; - IUnknown_AddRef((IUnknown*)This); + *ppvObj = iface; + IDataObject_AddRef(iface); return S_OK; } -- 2.20.1
4 years, 11 months
2
1
0
0
[PATCH v2 1/2] msscript: Cache state of IActiveScript in ScriptHost struct.
by Jactry Zeng
Superseded patch 165831. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> --- dlls/msscript.ocx/msscript.c | 23 ++++++-- dlls/msscript.ocx/tests/msscript.c | 91 +++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index 459c35aacf..7df5bd6f2f 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -71,6 +71,7 @@ typedef struct ScriptHost { IActiveScript *script; IActiveScriptParse *parse; + SCRIPTSTATE script_state; CLSID clsid; struct list named_items; @@ -568,6 +569,7 @@ static HRESULT init_script_host(const CLSID *clsid, ScriptHost **ret) WARN("InitNew failed, %#x\n", hr); goto failed; } + host->script_state = SCRIPTSTATE_INITIALIZED; *ret = host; return S_OK; @@ -952,6 +954,16 @@ static HRESULT WINAPI ScriptControl_AddObject(IScriptControl *iface, BSTR name, return hr; } +static HRESULT set_script_state(ScriptHost *host, SCRIPTSTATE state) +{ + HRESULT hr; + + hr = IActiveScript_SetScriptState(host->script, state); + if (SUCCEEDED(hr)) + host->script_state = state; + return hr; +} + static HRESULT WINAPI ScriptControl_Reset(IScriptControl *iface) { ScriptControl *This = impl_from_IScriptControl(iface); @@ -962,7 +974,7 @@ static HRESULT WINAPI ScriptControl_Reset(IScriptControl *iface) return E_FAIL; clear_named_items(This->host); - return IActiveScript_SetScriptState(This->host->script, SCRIPTSTATE_INITIALIZED); + return set_script_state(This->host, SCRIPTSTATE_INITIALIZED); } static HRESULT WINAPI ScriptControl_AddCode(IScriptControl *iface, BSTR code) @@ -987,9 +999,12 @@ static HRESULT WINAPI ScriptControl_Eval(IScriptControl *iface, BSTR expression, if (!This->host || This->state != Initialized) return E_FAIL; - hr = IActiveScript_SetScriptState(This->host->script, SCRIPTSTATE_STARTED); - if (FAILED(hr)) - return hr; + if (This->host->script_state != SCRIPTSTATE_STARTED) + { + hr = set_script_state(This->host, SCRIPTSTATE_STARTED); + if (FAILED(hr)) + return hr; + } hr = IActiveScriptParse_ParseScriptText(This->host->parse, expression, NULL, NULL, NULL, 0, 1, SCRIPTTEXT_ISEXPRESSION, res, &excepinfo); diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c index 2d500d8308..8ed4af2e6f 100644 --- a/dlls/msscript.ocx/tests/msscript.c +++ b/dlls/msscript.ocx/tests/msscript.c @@ -95,6 +95,8 @@ DEFINE_EXPECT(Close); DEFINE_EXPECT(SetScriptSite); DEFINE_EXPECT(QI_IActiveScriptParse); DEFINE_EXPECT(SetScriptState_INITIALIZED); +DEFINE_EXPECT(SetScriptState_STARTED); +DEFINE_EXPECT(ParseScriptText); DEFINE_EXPECT(AddNamedItem); #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) @@ -147,8 +149,8 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo) { - ok(0, "unexpected call\n"); - return E_NOTIMPL; + CHECK_EXPECT(ParseScriptText); + return S_OK; } static const IActiveScriptParseVtbl ActiveScriptParseVtbl = { @@ -304,6 +306,10 @@ static HRESULT WINAPI ActiveScript_SetScriptState(IActiveScript *iface, SCRIPTST CHECK_EXPECT(SetScriptState_INITIALIZED); return S_OK; } + else if (ss == SCRIPTSTATE_STARTED) { + CHECK_EXPECT(SetScriptState_STARTED); + return S_OK; + } else ok(0, "unexpected call, state %u\n", ss); @@ -1381,7 +1387,7 @@ static void _check_error(IScriptControl *sc, LONG exp_num, int line) { error_num = 0xdeadbeef; hr = IScriptError_get_Number(script_err, &error_num); - ok_(__FILE__,line)(hr == S_OK, "IScriptError_get_Number failed: 0x%08x.", hr); + ok_(__FILE__,line)(hr == S_OK, "IScriptError_get_Number failed: 0x%08x.\n", hr); ok_(__FILE__,line)(error_num == exp_num, "got wrong error number: %d, expected %d.\n", error_num, exp_num); IScriptError_Release(script_err); @@ -1485,6 +1491,85 @@ static void test_IScriptControl_Eval(void) SysFreeString(script_str); IScriptControl_Release(sc); + + /* custom script engine */ + if (register_script_engine()) + { + hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, + &IID_IScriptControl, (void **)&sc); + ok(hr == S_OK, "Failed to create IScriptControl interface: 0x%08x.\n", hr); + + SET_EXPECT(CreateInstance); + SET_EXPECT(SetInterfaceSafetyOptions); + SET_EXPECT(SetScriptSite); + SET_EXPECT(QI_IActiveScriptParse); + SET_EXPECT(InitNew); + + language= a2bstr("testscript"); + hr = IScriptControl_put_Language(sc, language); + ok(hr == S_OK, "IScriptControl_put_Language failed: 0x%08x.\n", hr); + SysFreeString(language); + + CHECK_CALLED(CreateInstance); + CHECK_CALLED(SetInterfaceSafetyOptions); + CHECK_CALLED(SetScriptSite); + CHECK_CALLED(QI_IActiveScriptParse); + CHECK_CALLED(InitNew); + + SET_EXPECT(SetScriptState_STARTED); + SET_EXPECT(ParseScriptText); + script_str = a2bstr("var1 = 1 + 1"); + V_VT(&var) = VT_NULL; + V_I4(&var) = 0xdeadbeef; + hr = IScriptControl_Eval(sc, script_str, &var); + ok(hr == S_OK, "IScriptControl_Eval failed: 0x%08x.\n", hr); + ok((V_VT(&var) == VT_EMPTY) && (V_I4(&var) == 0xdeadbeef), "V_VT(var) = %d, V_I4(var) = %d.\n", + V_VT(&var), V_I4(&var)); + SysFreeString(script_str); + CHECK_CALLED(SetScriptState_STARTED); + CHECK_CALLED(ParseScriptText); + + SET_EXPECT(ParseScriptText); + script_str = a2bstr("var2 = 10 + var1"); + V_VT(&var) = VT_NULL; + V_I4(&var) = 0xdeadbeef; + hr = IScriptControl_Eval(sc, script_str, &var); + ok(hr == S_OK, "IScriptControl_Eval failed: 0x%08x.\n", hr); + ok((V_VT(&var) == VT_EMPTY) && (V_I4(&var) == 0xdeadbeef), "V_VT(var) = %d, V_I4(var) = %d.\n", + V_VT(&var), V_I4(&var)); + SysFreeString(script_str); + CHECK_CALLED(ParseScriptText); + + SET_EXPECT(SetScriptState_INITIALIZED); + hr = IScriptControl_Reset(sc); + ok(hr == S_OK, "IScriptControl_Reset failed: 0x%08x.\n", hr); + CHECK_CALLED(SetScriptState_INITIALIZED); + + SET_EXPECT(SetScriptState_STARTED); + SET_EXPECT(ParseScriptText); + script_str = a2bstr("var2 = 10 + var1"); + V_VT(&var) = VT_NULL; + V_I4(&var) = 0xdeadbeef; + hr = IScriptControl_Eval(sc, script_str, &var); + ok(hr == S_OK, "IScriptControl_Eval failed: 0x%08x.\n", hr); + ok((V_VT(&var) == VT_EMPTY) && (V_I4(&var) == 0xdeadbeef), "V_VT(var) = %d, V_I4(var) = %d.\n", + V_VT(&var), V_I4(&var)); + SysFreeString(script_str); + CHECK_CALLED(SetScriptState_STARTED); + CHECK_CALLED(ParseScriptText); + + IActiveScriptSite_Release(site); + + init_registry(FALSE); + + SET_EXPECT(Close); + + IScriptControl_Release(sc); + + CHECK_CALLED(Close); + } + else + skip("Could not register TestScript engine.\n"); } START_TEST(msscript) -- 2.20.1
4 years, 11 months
2
2
0
0
← Newer
1
...
53
54
55
56
57
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Results per page:
10
25
50
100
200