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
2025
February
January
2024
December
November
October
September
August
July
June
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
wine-commits
September 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 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
wine-commits@winehq.org
2 participants
828 discussions
Start a n
N
ew thread
Jacek Caban : jscript: Always use jsval-based to_number implementation.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 0bab034faceead6fafacf643ca5e908744d46df4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0bab034faceead6fafacf643c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:18:20 2012 +0200 jscript: Always use jsval-based to_number implementation. --- dlls/jscript/array.c | 8 ++-- dlls/jscript/date.c | 84 +++++++++++++++++----------------- dlls/jscript/engine.c | 20 ++++---- dlls/jscript/error.c | 2 +- dlls/jscript/global.c | 4 +- dlls/jscript/jscript.h | 4 +- dlls/jscript/jsutils.c | 118 ++++++++++++++++------------------------------- dlls/jscript/math.c | 42 +++++++++--------- dlls/jscript/number.c | 4 +- dlls/jscript/regexp.c | 2 +- 10 files changed, 124 insertions(+), 164 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=0bab034faceead6fafacf…
1
0
0
0
Jacek Caban : jscript: Always use jsval-based to_boolean.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 26576b83da35aabe7ba181b89fcad1cbd25feba2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=26576b83da35aabe7ba181b89…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:18:03 2012 +0200 jscript: Always use jsval-based to_boolean. --- dlls/jscript/bool.c | 2 +- dlls/jscript/engine.c | 8 ++-- dlls/jscript/jscript.h | 3 +- dlls/jscript/jsutils.c | 84 +++++++++++++++++------------------------------ 4 files changed, 37 insertions(+), 60 deletions(-) diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c index f8b4f84..9675965 100644 --- a/dlls/jscript/bool.c +++ b/dlls/jscript/bool.c @@ -128,7 +128,7 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, HRESULT hres; if(argc) { - hres = to_boolean_jsval(argv[0], &value); + hres = to_boolean(argv[0], &value); if(FAILED(hres)) return hres; } diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 8595c52..1ffb3d4 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -1212,7 +1212,7 @@ static HRESULT interp_cnd_nz(exec_ctx_t *ctx) TRACE("\n"); - hres = to_boolean_jsval(stack_top(ctx), &b); + hres = to_boolean(stack_top(ctx), &b); if(FAILED(hres)) return hres; @@ -1234,7 +1234,7 @@ static HRESULT interp_cnd_z(exec_ctx_t *ctx) TRACE("\n"); - hres = to_boolean_jsval(stack_top(ctx), &b); + hres = to_boolean(stack_top(ctx), &b); if(FAILED(hres)) return hres; @@ -2185,7 +2185,7 @@ static HRESULT interp_neg(exec_ctx_t *ctx) TRACE("\n"); v = stack_pop(ctx); - hres = to_boolean_jsval(v, &b); + hres = to_boolean(v, &b); jsval_release(v); if(FAILED(hres)) return hres; @@ -2325,7 +2325,7 @@ static HRESULT interp_jmp_z(exec_ctx_t *ctx) TRACE("\n"); v = stack_pop(ctx); - hres = to_boolean_jsval(v, &b); + hres = to_boolean(v, &b); jsval_release(v); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 651b49c..f9820bc 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -255,8 +255,7 @@ typedef enum { } hint_t; HRESULT to_primitive(script_ctx_t*,jsval_t,jsexcept_t*,jsval_t*, hint_t) DECLSPEC_HIDDEN; -HRESULT to_boolean(VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN; -HRESULT to_boolean_jsval(jsval_t,BOOL*) DECLSPEC_HIDDEN; +HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN; HRESULT to_number(script_ctx_t*,VARIANT*,jsexcept_t*,double*) DECLSPEC_HIDDEN; HRESULT to_number_jsval(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN; HRESULT to_integer(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN; diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 3a96a51..b5c3632 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -437,60 +437,32 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re } /* ECMA-262 3rd Edition 9.2 */ -HRESULT to_boolean(VARIANT *v, VARIANT_BOOL *b) +HRESULT to_boolean(jsval_t val, BOOL *ret) { - switch(V_VT(v)) { - case VT_EMPTY: - case VT_NULL: - *b = VARIANT_FALSE; - break; - case VT_I4: - *b = V_I4(v) ? VARIANT_TRUE : VARIANT_FALSE; - break; - case VT_R8: - if(isnan(V_R8(v))) *b = VARIANT_FALSE; - else *b = V_R8(v) ? VARIANT_TRUE : VARIANT_FALSE; - break; - case VT_BSTR: - *b = V_BSTR(v) && *V_BSTR(v) ? VARIANT_TRUE : VARIANT_FALSE; - break; - case VT_DISPATCH: - *b = V_DISPATCH(v) ? VARIANT_TRUE : VARIANT_FALSE; - break; - case VT_BOOL: - *b = V_BOOL(v); - break; - default: - FIXME("unimplemented for vt %d\n", V_VT(v)); - return E_NOTIMPL; - } - - return S_OK; -} - -/* ECMA-262 3rd Edition 9.2 */ -HRESULT to_boolean_jsval(jsval_t v, BOOL *ret) -{ - VARIANT_BOOL b; - VARIANT var; - HRESULT hres; - - if(v.type == JSV_BOOL) { - *ret = v.u.b; + switch(val.type) { + case JSV_UNDEFINED: + case JSV_NULL: + *ret = VARIANT_FALSE; + return S_OK; + case JSV_OBJECT: + *ret = get_object(val) != NULL; + return S_OK; + case JSV_STRING: + *ret = get_string(val) && *get_string(val); return S_OK; + case JSV_NUMBER: + *ret = !isnan(get_number(val)) && get_number(val); + return S_OK; + case JSV_BOOL: + *ret = get_bool(val); + return S_OK; + case JSV_VARIANT: + FIXME("unimplemented for variant %s\n", debugstr_variant(get_variant(val))); + return E_NOTIMPL; } - hres = jsval_to_variant(v, &var); - if(FAILED(hres)) - return hres; - - hres = to_boolean(&var, &b); - VariantClear(&var); - if(FAILED(hres)) - return hres; - - *ret = !!b; - return S_OK; + assert(0); + return E_FAIL; } static int hex_to_int(WCHAR c) @@ -986,11 +958,17 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY break; } case VT_BOOL: { - VARIANT_BOOL b; + jsval_t val; + BOOL b; + + hres = variant_to_jsval(src, &val); + if(FAILED(hres)) + return hres; - hres = to_boolean(src, &b); + hres = to_boolean(val, &b); + jsval_release(val); if(SUCCEEDED(hres)) - V_BOOL(dst) = b; + V_BOOL(dst) = b ? VARIANT_TRUE : VARIANT_FALSE; break; } case VT_BSTR: {
1
0
0
0
Jacek Caban : jscript: Always use jsval-based to_primitive.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: c1eb4326a05d13afa501435f00aae23cc871a34b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c1eb4326a05d13afa501435f0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:17:50 2012 +0200 jscript: Always use jsval-based to_primitive. --- dlls/jscript/date.c | 16 +++----- dlls/jscript/dispex.c | 29 ++------------ dlls/jscript/engine.c | 12 +++--- dlls/jscript/jscript.h | 5 +- dlls/jscript/jsutils.c | 103 ++++++++++++----------------------------------- 5 files changed, 45 insertions(+), 120 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c1eb4326a05d13afa5014…
1
0
0
0
Jacek Caban : jscript: Store exception value as jsval_t instead of VARIANT.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: daf0b8dad2f68292524787bf52e413b972cd2d13 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=daf0b8dad2f68292524787bf5…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:17:36 2012 +0200 jscript: Store exception value as jsval_t instead of VARIANT. --- dlls/jscript/engine.c | 38 +++++++------------------------------- dlls/jscript/error.c | 2 +- dlls/jscript/jscript.c | 2 +- dlls/jscript/jscript.h | 11 ++++++----- dlls/jscript/jsutils.c | 2 +- dlls/jscript/regexp.c | 2 +- 6 files changed, 17 insertions(+), 40 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 1cc8884..10e47f6 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -674,19 +674,9 @@ static HRESULT interp_case(exec_ctx_t *ctx) /* ECMA-262 3rd Edition 12.13 */ static HRESULT interp_throw(exec_ctx_t *ctx) { - VARIANT v; - jsval_t val; - HRESULT hres; - TRACE("\n"); - val = stack_pop(ctx); - hres = jsval_to_variant(val, &v); - jsval_release(val); - if(FAILED(hres)) - return hres; - - ctx->ei->var = v; + ctx->ei->val = stack_pop(ctx); return DISP_E_EXCEPTION; } @@ -778,9 +768,7 @@ static HRESULT interp_end_finally(exec_ctx_t *ctx) jsval_release(v); stack_popn(ctx, 1); - v = stack_pop(ctx); - hres = jsval_to_variant(v, &ctx->ei->var); - jsval_release(v); + ctx->ei->val = stack_pop(ctx); return SUCCEEDED(hres) ? DISP_E_EXCEPTION : hres; } @@ -2382,7 +2370,7 @@ OP_LIST static HRESULT unwind_exception(exec_ctx_t *ctx) { except_frame_t *except_frame; - VARIANT except_val; + jsval_t except_val; BSTR ident; HRESULT hres; @@ -2397,7 +2385,7 @@ static HRESULT unwind_exception(exec_ctx_t *ctx) ctx->ip = except_frame->catch_off; - except_val = ctx->ei->var; + except_val = ctx->ei->val; memset(ctx->ei, 0, sizeof(*ctx->ei)); ident = except_frame->ident; @@ -2408,30 +2396,18 @@ static HRESULT unwind_exception(exec_ctx_t *ctx) hres = create_dispex(ctx->script, NULL, NULL, &scope_obj); if(SUCCEEDED(hres)) { - jsval_t val; - - hres = variant_to_jsval(&except_val, &val); - if(SUCCEEDED(hres)) { - hres = jsdisp_propput_name(scope_obj, ident, val, ctx->ei); - jsval_release(val); - } + hres = jsdisp_propput_name(scope_obj, ident, except_val, ctx->ei); if(FAILED(hres)) jsdisp_release(scope_obj); } - VariantClear(&except_val); + jsval_release(except_val); if(FAILED(hres)) return hres; hres = scope_push(ctx->scope_chain, scope_obj, to_disp(scope_obj), &ctx->scope_chain); jsdisp_release(scope_obj); }else { - jsval_t exceptv; - - hres = variant_to_jsval(&except_val, &exceptv); - if(FAILED(hres)) - return hres; - - hres = stack_push(ctx, exceptv); + hres = stack_push(ctx, except_val); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 407bd3b..77497a9 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -400,7 +400,7 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, con return hres; if(ei) - var_set_jsdisp(&ei->var, err); + ei->val = jsval_obj(err); return error; } diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index bf6710b..f106be9 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -110,7 +110,7 @@ static HRESULT exec_global_code(JScript *This, bytecode_t *code) memset(&jsexcept, 0, sizeof(jsexcept)); hres = exec_source(exec_ctx, code, &code->global_code, FALSE, &jsexcept, NULL); - VariantClear(&jsexcept.var); + jsval_release(jsexcept.val); exec_release(exec_ctx); IActiveScriptSite_OnLeaveScript(This->site); diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index ef20c54..41c67c9 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -37,11 +37,7 @@ typedef struct _jsval_t jsval_t; typedef struct _script_ctx_t script_ctx_t; typedef struct _exec_ctx_t exec_ctx_t; typedef struct _dispex_prop_t dispex_prop_t; - -typedef struct { - EXCEPINFO ei; - VARIANT var; -} jsexcept_t; +typedef struct _jsexcept_t jsexcept_t; typedef struct { void **blocks; @@ -548,3 +544,8 @@ static inline LPWSTR heap_strdupW(LPCWSTR str) } #include "jsval.h" + +struct _jsexcept_t { + EXCEPINFO ei; + jsval_t val; +}; diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index a4f84c5..0439b10 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -1062,7 +1062,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY } if(FAILED(hres)) { - VariantClear(&ei.var); + jsval_release(ei.val); return hres; } diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index e783c54..1c891a6 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -3525,7 +3525,7 @@ static INT index_from_val(script_ctx_t *ctx, jsval_t v) memset(&ei, 0, sizeof(ei)); hres = to_number_jsval(ctx, v, &ei, &n); if(FAILED(hres)) { /* FIXME: Move ignoring exceptions to to_primitive */ - VariantClear(&ei.var); + jsval_release(ei.val); return 0; }
1
0
0
0
Jacek Caban : jscript: Store jsdisp_t values as jsval_t instead of VARIANT.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 80f7f3c2461399cca83ef603e80ed86d91c5c83e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=80f7f3c2461399cca83ef603e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:17:24 2012 +0200 jscript: Store jsdisp_t values as jsval_t instead of VARIANT. --- dlls/jscript/dispex.c | 64 +++++++++++++++++++++++++---------------------- dlls/jscript/function.c | 15 ++--------- dlls/jscript/jscript.h | 4 +- dlls/jscript/jsutils.c | 3 +- dlls/jscript/math.c | 5 +--- 5 files changed, 42 insertions(+), 49 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index e1b63c5..d6015e7 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -36,7 +36,7 @@ static const IID IID_IDispatchJS = #define GOLDEN_RATIO 0x9E3779B9U typedef enum { - PROP_VARIANT, + PROP_JSVAL, PROP_BUILTIN, PROP_PROTREF, PROP_DELETED @@ -49,7 +49,7 @@ struct _dispex_prop_t { DWORD flags; union { - VARIANT var; + jsval_t val; const builtin_prop_t *p; DWORD ref; } u; @@ -276,15 +276,15 @@ static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, BOOL search_p TRACE("creating prop %s\n", debugstr_w(name)); if(prop) { - prop->type = PROP_VARIANT; + prop->type = PROP_JSVAL; prop->flags = create_flags; }else { - prop = alloc_prop(This, name, PROP_VARIANT, create_flags); + prop = alloc_prop(This, name, PROP_JSVAL, create_flags); if(!prop) return E_OUTOFMEMORY; } - VariantInit(&prop->u.var); + prop->u.val = jsval_undefined(); } *ret = prop; @@ -372,15 +372,15 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t case PROP_PROTREF: return invoke_prop_func(This->prototype, jsthis, This->prototype->props+prop->u.ref, flags, argc, argv, r, ei, caller); - case PROP_VARIANT: { - if(V_VT(&prop->u.var) != VT_DISPATCH) { - FIXME("invoke vt %d\n", V_VT(&prop->u.var)); + case PROP_JSVAL: { + if(!is_object_instance(prop->u.val)) { + FIXME("invoke %s\n", debugstr_jsval(prop->u.val)); return E_FAIL; } - TRACE("call %s %p\n", debugstr_w(prop->name), V_DISPATCH(&prop->u.var)); + TRACE("call %s %p\n", debugstr_w(prop->name), get_object(prop->u.val)); - return disp_call_value(This->ctx, V_DISPATCH(&prop->u.var), jsthis, flags, argc, argv, r, ei); + return disp_call_value(This->ctx, get_object(prop->u.val), jsthis, flags, argc, argv, r, ei); } default: ERR("type %d\n", prop->type); @@ -403,9 +403,11 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp, if(FAILED(hres)) break; - prop->type = PROP_VARIANT; - var_set_jsdisp(&prop->u.var, obj); - hres = variant_to_jsval(&prop->u.var, r); + prop->type = PROP_JSVAL; + prop->u.val = jsval_obj(obj); + + jsdisp_addref(obj); + *r = jsval_obj(obj); }else { vdisp_t vthis; @@ -417,8 +419,8 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp, case PROP_PROTREF: hres = prop_get(This->prototype, This->prototype->props+prop->u.ref, dp, r, ei, caller); break; - case PROP_VARIANT: - hres = variant_to_jsval(&prop->u.var, r); + case PROP_JSVAL: + hres = jsval_copy(prop->u.val, r); break; default: ERR("type %d\n", prop->type); @@ -453,21 +455,23 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, return hres; } case PROP_PROTREF: - prop->type = PROP_VARIANT; + prop->type = PROP_JSVAL; prop->flags = PROPF_ENUM; - V_VT(&prop->u.var) = VT_EMPTY; + prop->u.val = jsval_undefined(); break; - case PROP_VARIANT: - VariantClear(&prop->u.var); + case PROP_JSVAL: + jsval_release(prop->u.val); break; default: ERR("type %d\n", prop->type); return E_FAIL; } - hres = jsval_to_variant(val, &prop->u.var); - if(FAILED(hres)) + hres = jsval_copy(val, &prop->u.val); + if(FAILED(hres)) { + prop->u.val = jsval_undefined(); return hres; + } if(This->builtin_info->on_put) This->builtin_info->on_put(This, prop->name); @@ -562,8 +566,8 @@ static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) dispex_prop_t *prop; for(prop = This->props; prop < This->props+This->prop_cnt; prop++) { - if(prop->type == PROP_VARIANT) - VariantClear(&prop->u.var); + if(prop->type == PROP_JSVAL) + jsval_release(prop->u.val); heap_free(prop->name); } heap_free(This->props); @@ -733,8 +737,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc static HRESULT delete_prop(dispex_prop_t *prop) { - if(prop->type == PROP_VARIANT) { - VariantClear(&prop->u.var); + if(prop->type == PROP_JSVAL) { + jsval_release(prop->u.val); prop->type = PROP_DELETED; } return S_OK; @@ -1252,7 +1256,7 @@ HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val, jsexc return prop_put(obj, prop, val, ei, NULL); } -HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, VARIANT *val) +HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, jsval_t val) { dispex_prop_t *prop; HRESULT hres; @@ -1261,10 +1265,10 @@ HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, VARIANT *val) if(FAILED(hres)) return hres; - return VariantCopy(&prop->u.var, val); + return jsval_copy(val, &prop->u.val); } -HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, VARIANT *val) +HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, jsval_t val) { dispex_prop_t *prop; HRESULT hres; @@ -1273,7 +1277,7 @@ HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, VARIANT *val) if(FAILED(hres)) return hres; - return VariantCopy(&prop->u.var, val); + return jsval_copy(val, &prop->u.val); } HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val, jsexcept_t *ei) @@ -1441,6 +1445,6 @@ HRESULT jsdisp_is_own_prop(jsdisp_t *obj, BSTR name, VARIANT_BOOL *ret) if(FAILED(hres)) return hres; - *ret = prop && (prop->type == PROP_VARIANT || prop->type == PROP_BUILTIN) ? VARIANT_TRUE : VARIANT_FALSE; + *ret = prop && (prop->type == PROP_JSVAL || prop->type == PROP_BUILTIN) ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 123c0b6..b3a616d 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -609,13 +609,8 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, if(FAILED(hres)) return hres; - if(builtin_info) { - VARIANT var; - - num_set_int(&var, function->length); - hres = jsdisp_propput_const(&function->dispex, lengthW, &var); - } - + if(builtin_info) + hres = jsdisp_propput_const(&function->dispex, lengthW, jsval_number(function->length)); if(SUCCEEDED(hres)) hres = set_prototype(ctx, &function->dispex, prototype); if(FAILED(hres)) { @@ -632,13 +627,9 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot) { - VARIANT v; - static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0}; - V_VT(&v) = VT_DISPATCH; - V_DISPATCH(&v) = to_disp(constr); - return jsdisp_propput_dontenum(prot, constructorW, &v); + return jsdisp_propput_dontenum(prot, constructorW, jsval_obj(constr)); } HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index c323dea..ef20c54 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -217,8 +217,8 @@ HRESULT disp_propget(script_ctx_t*,IDispatch*,DISPID,jsval_t*,jsexcept_t*) DECLS HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,jsval_t,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_propget(jsdisp_t*,DISPID,jsval_t*,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_propput_name(jsdisp_t*,const WCHAR*,jsval_t,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT jsdisp_propput_const(jsdisp_t*,const WCHAR*,VARIANT*) DECLSPEC_HIDDEN; -HRESULT jsdisp_propput_dontenum(jsdisp_t*,const WCHAR*,VARIANT*) DECLSPEC_HIDDEN; +HRESULT jsdisp_propput_const(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN; +HRESULT jsdisp_propput_dontenum(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN; HRESULT jsdisp_propput_idx(jsdisp_t*,DWORD,jsval_t,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_propget_name(jsdisp_t*,LPCWSTR,jsval_t*,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*,jsexcept_t*) DECLSPEC_HIDDEN; diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 83791d8..a4f84c5 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -260,7 +260,8 @@ HRESULT jsval_copy(jsval_t v, jsval_t *r) *r = v; return S_OK; case JSV_OBJECT: - IDispatch_AddRef(get_object(v)); + if(get_object(v)) + IDispatch_AddRef(get_object(v)); *r = v; return S_OK; case JSV_STRING: { diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c index 679e37e..4ed62b0 100644 --- a/dlls/jscript/math.c +++ b/dlls/jscript/math.c @@ -532,7 +532,6 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret) { jsdisp_t *math; unsigned i; - VARIANT v; HRESULT hres; struct { @@ -559,10 +558,8 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret) return hres; } - V_VT(&v) = VT_R8; for(i=0; i < sizeof(constants)/sizeof(*constants); i++) { - V_R8(&v) = constants[i].val; - hres = jsdisp_propput_const(math, constants[i].name, &v); + hres = jsdisp_propput_const(math, constants[i].name, jsval_number(constants[i].val)); if(FAILED(hres)) { jsdisp_release(math); return hres;
1
0
0
0
Jacek Caban : jscript: Use jsval_t instead of VARIANT for stack values.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 16b2b019b8b7bcdb55f5a15e2c97c9cac58355e7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16b2b019b8b7bcdb55f5a15e2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:17:02 2012 +0200 jscript: Use jsval_t instead of VARIANT for stack values. --- dlls/jscript/dispex.c | 81 ++--- dlls/jscript/engine.c | 981 +++++++++++++++++++---------------------------- dlls/jscript/engine.h | 8 +- dlls/jscript/function.c | 7 +- dlls/jscript/global.c | 10 +- dlls/jscript/jscript.h | 7 +- dlls/jscript/jsutils.c | 43 ++- 7 files changed, 483 insertions(+), 654 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=16b2b019b8b7bcdb55f5a…
1
0
0
0
Jacek Caban : jscript: Use jsval instead of VARIANT to pass arguments to builtin functions.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 847aebdc877482cb3954dbaa3bbe3f52bb7f1b21 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=847aebdc877482cb3954dbaa3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:16:42 2012 +0200 jscript: Use jsval instead of VARIANT to pass arguments to builtin functions. --- dlls/jscript/activex.c | 4 +- dlls/jscript/array.c | 263 +++++++++++++++++++++++------------------------ dlls/jscript/bool.c | 12 +- dlls/jscript/date.c | 190 +++++++++++++++++----------------- dlls/jscript/dispex.c | 168 ++++++++++++++++++------------ dlls/jscript/engine.c | 146 +++++++++++++++++++++------ dlls/jscript/error.c | 72 ++++++------- dlls/jscript/function.c | 101 ++++++++---------- dlls/jscript/global.c | 119 ++++++++++----------- dlls/jscript/jscript.h | 37 ++++--- dlls/jscript/jsutils.c | 175 ++++++++++++++++++++++++++++---- dlls/jscript/math.c | 78 +++++++------- dlls/jscript/number.c | 28 +++--- dlls/jscript/object.c | 22 ++-- dlls/jscript/regexp.c | 139 +++++++++++-------------- dlls/jscript/string.c | 260 ++++++++++++++++++++++------------------------- dlls/jscript/vbarray.c | 41 +++++--- 17 files changed, 1035 insertions(+), 820 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=847aebdc877482cb3954d…
1
0
0
0
Jacek Caban : jscript: Added new variable representation and use it for internal function return values .
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 932b3dd088388ed2d3ca1e5d992cc86473b3260a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=932b3dd088388ed2d3ca1e5d9…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 17 15:16:20 2012 +0200 jscript: Added new variable representation and use it for internal function return values. --- dlls/jscript/activex.c | 5 +- dlls/jscript/array.c | 136 +++++++--------- dlls/jscript/bool.c | 28 ++-- dlls/jscript/date.c | 416 +++++++++++++++++++++-------------------------- dlls/jscript/dispex.c | 73 +++++--- dlls/jscript/engine.c | 28 +++- dlls/jscript/error.c | 60 +++---- dlls/jscript/function.c | 94 +++++------ dlls/jscript/global.c | 276 ++++++++++++++----------------- dlls/jscript/jscript.h | 22 ++- dlls/jscript/jsutils.c | 152 +++++++++++++++++ dlls/jscript/jsval.h | 163 ++++++++++++++++++ dlls/jscript/math.c | 164 ++++++++++--------- dlls/jscript/number.c | 64 +++---- dlls/jscript/object.c | 76 ++++----- dlls/jscript/regexp.c | 84 ++++------ dlls/jscript/string.c | 256 ++++++++++++++---------------- dlls/jscript/vbarray.c | 40 ++--- 18 files changed, 1178 insertions(+), 959 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=932b3dd088388ed2d3ca1…
1
0
0
0
Alexandre Julliard : user32/tests: Add a test for calling UpdateLayeredWindow from a different thread.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: b57323a61e497923bd922d076a4cc47289e6b834 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b57323a61e497923bd922d076…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 17 14:03:42 2012 +0200 user32/tests: Add a test for calling UpdateLayeredWindow from a different thread. --- dlls/user32/tests/msg.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 0b63799..3208751 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -13792,6 +13792,27 @@ static const struct message WmSetLayeredStyle2[] = { { 0 } }; +struct layered_window_info +{ + HWND hwnd; + HDC hdc; + SIZE size; + HANDLE event; + BOOL ret; +}; + +static DWORD CALLBACK update_layered_proc( void *param ) +{ + struct layered_window_info *info = param; + POINT src = { 0, 0 }; + + info->ret = pUpdateLayeredWindow( info->hwnd, 0, NULL, &info->size, + info->hdc, &src, 0, NULL, ULW_OPAQUE ); + ok( info->ret, "failed\n"); + SetEvent( info->event ); + return 0; +} + static void test_layered_window(void) { HWND hwnd; @@ -13801,6 +13822,9 @@ static void test_layered_window(void) SIZE size; POINT pos, src; RECT rect, client; + HANDLE thread; + DWORD tid; + struct layered_window_info info; if (!pUpdateLayeredWindow) { @@ -13894,6 +13918,26 @@ static void test_layered_window(void) broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50), "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED ); + info.hwnd = hwnd; + info.hdc = hdc; + info.size.cx = 250; + info.size.cy = 300; + info.event = CreateEventA( NULL, TRUE, FALSE, NULL ); + info.ret = FALSE; + thread = CreateThread( NULL, 0, update_layered_proc, &info, 0, &tid ); + ok( WaitForSingleObject( info.event, 1000 ) == 0, "wait failed\n" ); + ok( info.ret, "UpdateLayeredWindow failed in other thread\n" ); + WaitForSingleObject( thread, 1000 ); + CloseHandle( thread ); + GetWindowRect( hwnd, &rect ); + ok( rect.left == 200 && rect.top == 200 && rect.right == 450 && rect.bottom == 500, + "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + GetClientRect( hwnd, &rect ); + ok( (rect.right == 250 && rect.bottom == 300) || + broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50), + "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + DestroyWindow( hwnd ); DeleteDC( hdc ); DeleteObject( bmp );
1
0
0
0
Alexandre Julliard : winex11: Allow retrieving the window data structure from another thread, with appropriate locking.
by Alexandre Julliard
17 Sep '12
17 Sep '12
Module: wine Branch: master Commit: 4289c74f508f01859b7bf3fa2d1b9ca4189e45bb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4289c74f508f01859b7bf3fa2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 17 13:03:52 2012 +0200 winex11: Allow retrieving the window data structure from another thread, with appropriate locking. --- dlls/winex11.drv/window.c | 105 ++++++++++++++++++++++++++++++++++----------- dlls/winex11.drv/x11drv.h | 2 + 2 files changed, 81 insertions(+), 26 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 7581436..421d67d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -85,6 +85,15 @@ static const char whole_window_prop[] = "__wine_x11_whole_window"; static const char clip_window_prop[] = "__wine_x11_clip_window"; static const char managed_prop[] = "__wine_x11_managed"; +static CRITICAL_SECTION win_data_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &win_data_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": win_data_section") } +}; +static CRITICAL_SECTION win_data_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + /*********************************************************************** *
http://standards.freedesktop.org/startup-notification-spec
@@ -1478,17 +1487,17 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd ) struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_win_data *data; - if (!(data = X11DRV_get_win_data( hwnd ))) return; + if (!(data = get_win_data( hwnd ))) return; - destroy_gl_drawable( hwnd ); destroy_whole_window( thread_data->display, data, FALSE ); - if (thread_data->last_focus == hwnd) thread_data->last_focus = 0; if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0; if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); - XDeleteContext( thread_data->display, (XID)hwnd, win_data_context ); + XDeleteContext( gdi_display, (XID)hwnd, win_data_context ); + release_win_data( data ); HeapFree( GetProcessHeap(), 0, data ); + destroy_gl_drawable( hwnd ); } @@ -1499,12 +1508,15 @@ void X11DRV_DestroyNotify( HWND hwnd, XEvent *event ) { Display *display = event->xdestroywindow.display; struct x11drv_win_data *data; + BOOL embedded; - if (!(data = X11DRV_get_win_data( hwnd ))) return; - if (!data->embedded) FIXME( "window %p/%lx destroyed from the outside\n", hwnd, data->whole_window ); + if (!(data = get_win_data( hwnd ))) return; + embedded = data->embedded; + if (!embedded) FIXME( "window %p/%lx destroyed from the outside\n", hwnd, data->whole_window ); destroy_whole_window( display, data, TRUE ); - if (data->embedded) SendMessageW( hwnd, WM_CLOSE, 0, 0 ); + release_win_data( data ); + if (embedded) SendMessageW( hwnd, WM_CLOSE, 0, 0 ); } @@ -1515,24 +1527,26 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd ) if ((data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)))) { data->hwnd = hwnd; - XSaveContext( display, (XID)hwnd, win_data_context, (char *)data ); + EnterCriticalSection( &win_data_section ); + XSaveContext( gdi_display, (XID)hwnd, win_data_context, (char *)data ); } return data; } /* initialize the desktop window id in the desktop manager process */ -static struct x11drv_win_data *create_desktop_win_data( Display *display, HWND hwnd ) +static BOOL create_desktop_win_data( Display *display, HWND hwnd ) { struct x11drv_win_data *data; - if (!(data = alloc_win_data( display, hwnd ))) return NULL; + if (!(data = alloc_win_data( display, hwnd ))) return FALSE; data->whole_window = root_window; data->managed = TRUE; SetPropA( data->hwnd, managed_prop, (HANDLE)1 ); SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window ); + release_win_data( data ); set_initial_wm_hints( hwnd ); - return data; + return TRUE; } /********************************************************************** @@ -1607,19 +1621,49 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd ) /*********************************************************************** + * get_win_data + * + * Lock and return the X11 data structure associated with a window. + */ +struct x11drv_win_data *get_win_data( HWND hwnd ) +{ + char *data; + + if (!hwnd) return NULL; + EnterCriticalSection( &win_data_section ); + if (!XFindContext( gdi_display, (XID)hwnd, win_data_context, &data )) + return (struct x11drv_win_data *)data; + LeaveCriticalSection( &win_data_section ); + return NULL; +} + + +/*********************************************************************** + * release_win_data + * + * Release the data returned by get_win_data. + */ +void release_win_data( struct x11drv_win_data *data ) +{ + if (data) LeaveCriticalSection( &win_data_section ); +} + + +/*********************************************************************** * X11DRV_get_win_data * * Return the X11 data structure associated with a window. */ struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ) { - struct x11drv_thread_data *thread_data = x11drv_thread_data(); - char *data; + struct x11drv_win_data *data = get_win_data( hwnd ); - if (!thread_data) return NULL; - if (!hwnd) return NULL; - if (XFindContext( thread_data->display, (XID)hwnd, win_data_context, &data )) data = NULL; - return (struct x11drv_win_data *)data; + if (data) + { + release_win_data( data ); + if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) data = NULL; + } + return data; } @@ -1640,11 +1684,14 @@ static struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd, const RECT *wi /* don't create win data for HWND_MESSAGE windows */ if (parent != GetDesktopWindow() && !GetAncestor( parent, GA_PARENT )) return NULL; + if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) return NULL; + display = thread_init_display(); if (!(data = alloc_win_data( display, hwnd ))) return NULL; data->whole_rect = data->window_rect = *window_rect; data->client_rect = *client_rect; + release_win_data( data ); if (parent == GetDesktopWindow()) { @@ -1775,14 +1822,17 @@ HWND create_foreign_window( Display *display, Window xwin ) */ Window X11DRV_get_whole_window( HWND hwnd ) { - struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); + struct x11drv_win_data *data = get_win_data( hwnd ); + Window ret; if (!data) { if (hwnd == GetDesktopWindow()) return root_window; return (Window)GetPropA( hwnd, whole_window_prop ); } - return data->whole_window; + ret = data->whole_window; + release_win_data( data ); + return ret; } @@ -1793,15 +1843,18 @@ Window X11DRV_get_whole_window( HWND hwnd ) */ XIC X11DRV_get_ic( HWND hwnd ) { - struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); + struct x11drv_win_data *data = get_win_data( hwnd ); XIM xim; + XIC ret = 0; - if (!data) return 0; - - x11drv_thread_data()->last_xic_hwnd = hwnd; - if (data->xic) return data->xic; - if (!(xim = x11drv_thread_data()->xim)) return 0; - return X11DRV_CreateIC( xim, data ); + if (data) + { + x11drv_thread_data()->last_xic_hwnd = hwnd; + ret = data->xic; + if (!ret && (xim = x11drv_thread_data()->xim)) ret = X11DRV_CreateIC( xim, data ); + release_win_data( data ); + } + return ret; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 05d0237..28cbe6a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -553,6 +553,8 @@ struct x11drv_win_data Pixmap icon_mask; }; +extern struct x11drv_win_data *get_win_data( HWND hwnd ) DECLSPEC_HIDDEN; +extern void release_win_data( struct x11drv_win_data *data ) DECLSPEC_HIDDEN; extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ) DECLSPEC_HIDDEN; extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN; extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
41
42
43
44
45
46
47
...
83
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Results per page:
10
25
50
100
200