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
February 2015
----- 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
411 discussions
Start a n
N
ew thread
Alexandre Julliard : imm32: Add a helper function to get the default context.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: 29ce21e25de5495520e13a9d797edbd7bfb0f1cf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=29ce21e25de5495520e13a9d7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Feb 26 22:50:44 2015 +0900 imm32: Add a helper function to get the default context. --- dlls/imm32/imm.c | 84 ++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 3f5ad31..07ab598 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -494,34 +494,45 @@ static InputContextData* get_imc_data(HIMC hIMC) return data; } -static IMMThreadData* IMM_GetInitializedThreadData(HWND hWnd) +static HIMC get_default_context( HWND hwnd ) { - IMMThreadData* thread_data = IMM_GetThreadDataForWindow(hWnd); + HIMC ret; + IMMThreadData* thread_data = IMM_GetThreadDataForWindow( hwnd ); - if (!thread_data) - return NULL; + if (!thread_data) return 0; - if (!thread_data->defaultContext && thread_data->threadID == GetCurrentThreadId()) + if (thread_data->defaultContext) { - HIMC defaultContext; + ret = thread_data->defaultContext; LeaveCriticalSection(&threaddata_cs); - defaultContext = ImmCreateContext(); - if (defaultContext) - ((InputContextData*)defaultContext)->threadDefault = TRUE; - thread_data = IMM_GetThreadDataForWindow(hWnd); - if (!thread_data) - { - IMM_DestroyContext(defaultContext); - return NULL; - } + return ret; + } - if (thread_data->defaultContext) /* someone beat us */ - IMM_DestroyContext(defaultContext); - else - thread_data->defaultContext = defaultContext; + /* can't create a default context in another thread */ + if (thread_data->threadID != GetCurrentThreadId()) + { + LeaveCriticalSection(&threaddata_cs); + return 0; } - return thread_data; + LeaveCriticalSection(&threaddata_cs); + + ret = ImmCreateContext(); + if (!ret) return 0; + ((InputContextData*)ret)->threadDefault = TRUE; + + /* thread_data is in the current thread so we can assume it's still valid */ + EnterCriticalSection(&threaddata_cs); + + if (thread_data->defaultContext) /* someone beat us */ + { + IMM_DestroyContext( ret ); + ret = thread_data->defaultContext; + } + else thread_data->defaultContext = ret; + + LeaveCriticalSection(&threaddata_cs); + return ret; } static BOOL IMM_IsCrossThreadAccess(HWND hWnd, HIMC hIMC) @@ -547,7 +558,6 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) { HIMC old = NULL; InputContextData *data = get_imc_data(hIMC); - IMMThreadData* thread_data = NULL; TRACE("(%p, %p):\n", hWnd, hIMC); @@ -563,20 +573,17 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) if (hIMC && IMM_IsCrossThreadAccess(hWnd, hIMC)) return NULL; - thread_data = IMM_GetInitializedThreadData(hWnd); - if (!thread_data) - return NULL; - if (hWnd) { + HIMC defaultContext = get_default_context( hWnd ); old = RemovePropW(hWnd,szwWineIMCProperty); if (old == NULL) - old = thread_data->defaultContext; + old = defaultContext; else if (old == (HIMC)-1) old = NULL; - if (hIMC != thread_data->defaultContext) + if (hIMC != defaultContext) { if (hIMC == NULL) /* Meaning disable imm for that window*/ SetPropW(hWnd,szwWineIMCProperty,(HANDLE)-1); @@ -591,7 +598,6 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) old_data->IMC.hWnd = NULL; } } - LeaveCriticalSection(&threaddata_cs); if (!hIMC) return old; @@ -633,18 +639,8 @@ static BOOL CALLBACK _ImmAssociateContextExEnumProc(HWND hwnd, LPARAM lParam) */ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) { - IMMThreadData* thread_data = NULL; - HIMC defaultContext = NULL; - TRACE("(%p, %p, 0x%x):\n", hWnd, hIMC, dwFlags); - thread_data = IMM_GetInitializedThreadData(hWnd); - if (!thread_data) - return FALSE; - - defaultContext = thread_data->defaultContext; - LeaveCriticalSection(&threaddata_cs); - if (!hWnd) return FALSE; @@ -654,8 +650,12 @@ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) ImmAssociateContext(hWnd,hIMC); return TRUE; case IACE_DEFAULT: + { + HIMC defaultContext = get_default_context( hWnd ); + if (!defaultContext) return FALSE; ImmAssociateContext(hWnd,defaultContext); return TRUE; + } case IACE_IGNORENOCONTEXT: if (GetPropW(hWnd,szwWineIMCProperty)) ImmAssociateContext(hWnd,hIMC); @@ -1496,7 +1496,6 @@ BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) HIMC WINAPI ImmGetContext(HWND hWnd) { HIMC rc; - IMMThreadData* thread_data; TRACE("%p\n", hWnd); @@ -1506,22 +1505,17 @@ HIMC WINAPI ImmGetContext(HWND hWnd) return NULL; } - thread_data = IMM_GetInitializedThreadData(hWnd); - if (!thread_data) - return NULL; - rc = GetPropW(hWnd,szwWineIMCProperty); if (rc == (HIMC)-1) rc = NULL; else if (rc == NULL) - rc = thread_data->defaultContext; + rc = get_default_context( hWnd ); if (rc) { InputContextData *data = rc; data->IMC.hWnd = hWnd; } - LeaveCriticalSection(&threaddata_cs); TRACE("returning %p\n", rc);
1
0
0
0
Aric Stewart : imm32: Limit cross thread access to ImmSet* functions.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: 5448acc37a9b8d4d5f3eea4fd74eed6657080e29 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5448acc37a9b8d4d5f3eea4fd…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 25 11:45:31 2015 -0600 imm32: Limit cross thread access to ImmSet* functions. --- dlls/imm32/imm.c | 21 +++++++++++++++++++++ dlls/imm32/tests/imm32.c | 28 ++++++++++++++-------------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 481f98f..3f5ad31 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2249,6 +2249,9 @@ BOOL WINAPI ImmSetCandidateWindow( if (!data || !lpCandidate) return FALSE; + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + TRACE("\t%x, %x, (%i,%i), (%i,%i - %i,%i)\n", lpCandidate->dwIndex, lpCandidate->dwStyle, lpCandidate->ptCurrentPos.x, lpCandidate->ptCurrentPos.y, @@ -2279,6 +2282,9 @@ BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf) return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + memcpy(&data->IMC.lfFont.W,lplf,sizeof(LOGFONTA)); MultiByteToWideChar(CP_ACP, 0, lplf->lfFaceName, -1, data->IMC.lfFont.W.lfFaceName, LF_FACESIZE); @@ -2302,6 +2308,9 @@ BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf) return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + data->IMC.lfFont.W = *lplf; ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, 0, IMC_SETCOMPOSITIONFONT); ImmInternalSendIMENotify(data, IMN_SETCOMPOSITIONFONT, 0); @@ -2443,6 +2452,9 @@ BOOL WINAPI ImmSetCompositionWindow( return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + data->IMC.cfCompForm = *lpCompForm; if (IsWindowVisible(data->immKbd->UIWnd)) @@ -2477,6 +2489,9 @@ BOOL WINAPI ImmSetConversionStatus( return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + if ( fdwConversion != data->IMC.fdwConversion ) { oldConversion = data->IMC.fdwConversion; @@ -2510,6 +2525,9 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + if (data->immKbd->UIWnd == NULL) { /* create the ime window */ @@ -2546,6 +2564,9 @@ BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos) return FALSE; } + if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + TRACE("\t(%i,%i)\n", lpptPos->x, lpptPos->y); data->IMC.ptStatusWndPos = *lpptPos; diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index d7854c6..870f5d2 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -525,15 +525,15 @@ static void test_ImmThreads(void) ok(rc == 0, "ImmGetOpenStatus failed\n"); rc = ImmSetOpenStatus(otherHimc, TRUE); - todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); + ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmSetOpenStatus(threadinfo.u_himc, TRUE); - todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); + ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); - todo_wine ok(rc == 0, "ImmGetOpenStatus failed\n"); + ok(rc == 0, "ImmGetOpenStatus failed\n"); rc = ImmGetOpenStatus(threadinfo.u_himc); ok (rc == 1 || broken(rc == 0), "ImmGetOpenStatus should return 1\n"); rc = ImmSetOpenStatus(otherHimc, FALSE); - todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); + ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); ok(rc == 0, "ImmGetOpenStatus failed\n"); @@ -548,9 +548,9 @@ static void test_ImmThreads(void) rc = ImmGetCompositionFontA(threadinfo.u_himc, &lf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont user himc failed\n"); rc = ImmSetCompositionFontA(otherHimc, &lf); - todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); + ok(rc == 0, "ImmSetCompositionFont should fail\n"); rc = ImmSetCompositionFontA(threadinfo.u_himc, &lf); - todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); + ok(rc == 0, "ImmSetCompositionFont should fail\n"); /* CompositionWindow */ rc = ImmSetCompositionWindow(himc, &cf); @@ -559,9 +559,9 @@ static void test_ImmThreads(void) ok(rc != 0, "ImmGetCompositionWindow failed\n"); rc = ImmSetCompositionWindow(otherHimc, &cf); - todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n"); + ok(rc == 0, "ImmSetCompositionWindow should fail\n"); rc = ImmSetCompositionWindow(threadinfo.u_himc, &cf); - todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n"); + ok(rc == 0, "ImmSetCompositionWindow should fail\n"); rc = ImmGetCompositionWindow(otherHimc, &cf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n"); rc = ImmGetCompositionWindow(threadinfo.u_himc, &cf); @@ -578,9 +578,9 @@ static void test_ImmThreads(void) rc = ImmGetConversionStatus(threadinfo.u_himc, &status, &sentence); ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n"); rc = ImmSetConversionStatus(otherHimc, status, sentence); - todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n"); + ok(rc == 0, "ImmSetConversionStatus should fail\n"); rc = ImmSetConversionStatus(threadinfo.u_himc, status, sentence); - todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n"); + ok(rc == 0, "ImmSetConversionStatus should fail\n"); /* StatusWindowPos */ rc = ImmSetStatusWindowPos(himc, &pt); @@ -589,9 +589,9 @@ static void test_ImmThreads(void) ok(rc != 0, "ImmGetStatusWindowPos failed\n"); rc = ImmSetStatusWindowPos(otherHimc, &pt); - todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); + ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); rc = ImmSetStatusWindowPos(threadinfo.u_himc, &pt); - todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); + ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); rc = ImmGetStatusWindowPos(otherHimc, &pt); ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n"); rc = ImmGetStatusWindowPos(threadinfo.u_himc, &pt); @@ -624,11 +624,11 @@ static void test_ImmThreads(void) rc = ImmGetCandidateWindow(otherHimc, 0, &cdf); ok (rc == 0, "ImmGetCandidateWindow should fail\n"); rc = ImmSetCandidateWindow(otherHimc, &cdf); - todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n"); + ok (rc == 0, "ImmSetCandidateWindow should fail\n"); rc = ImmGetCandidateWindow(threadinfo.u_himc, 0, &cdf); ok (rc == 1 || broken( rc == 0), "ImmGetCandidateWindow should succeed\n"); rc = ImmSetCandidateWindow(threadinfo.u_himc, &cdf); - todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n"); + ok (rc == 0, "ImmSetCandidateWindow should fail\n"); ImmReleaseContext(threadinfo.hwnd,otherHimc); ImmReleaseContext(hwnd,himc);
1
0
0
0
Aric Stewart : imm32: Restrict cross-thread association and destruction.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: fdf37fe7443f13a16ea68fc44d96cece20bad70b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fdf37fe7443f13a16ea68fc44…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 25 11:45:26 2015 -0600 imm32: Restrict cross-thread association and destruction. --- dlls/imm32/imm.c | 23 ++++++++++++++++++- dlls/imm32/tests/imm32.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 2b3804e..481f98f 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -74,6 +74,7 @@ typedef struct tagInputContextData { DWORD dwLock; INPUTCONTEXT IMC; + DWORD threadID; ImmHkl *immKbd; UINT lastVK; @@ -523,6 +524,22 @@ static IMMThreadData* IMM_GetInitializedThreadData(HWND hWnd) return thread_data; } +static BOOL IMM_IsCrossThreadAccess(HWND hWnd, HIMC hIMC) +{ + InputContextData *data; + + if (hWnd) + { + DWORD thread = GetWindowThreadProcessId(hWnd, NULL); + if (thread != GetCurrentThreadId()) return TRUE; + } + data = get_imc_data(hIMC); + if (data && data->threadID != GetCurrentThreadId()) + return TRUE; + + return FALSE; +} + /*********************************************************************** * ImmAssociateContext (IMM32.@) */ @@ -543,6 +560,9 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) if (hIMC && data->IMC.hWnd == hWnd) return hIMC; + if (hIMC && IMM_IsCrossThreadAccess(hWnd, hIMC)) + return NULL; + thread_data = IMM_GetInitializedThreadData(hWnd); if (!thread_data) return NULL; @@ -770,6 +790,7 @@ HIMC WINAPI ImmCreateContext(void) IMM_DestroyContext(new_context); return 0; } + new_context->threadID = GetCurrentThreadId(); SendMessageW(GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)GetKeyboardLayout(0)); new_context->immKbd->uSelected++; @@ -809,7 +830,7 @@ static BOOL IMM_DestroyContext(HIMC hIMC) */ BOOL WINAPI ImmDestroyContext(HIMC hIMC) { - if (!IMM_IsDefaultContext(hIMC)) + if (!IMM_IsDefaultContext(hIMC) && !IMM_IsCrossThreadAccess(NULL, hIMC)) return IMM_DestroyContext(hIMC); else return FALSE; diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 34e82c6..d7854c6 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -416,6 +416,7 @@ typedef struct _igc_threadinfo { HWND hwnd; HANDLE event; HIMC himc; + HIMC u_himc; } igc_threadinfo; @@ -424,6 +425,7 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam) HIMC h1,h2; HWND hwnd2; COMPOSITIONFORM cf; + CANDIDATEFORM cdf; POINT pt; MSG msg; @@ -452,6 +454,13 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam) /* priming for later tests */ ImmSetCompositionWindow(h1, &cf); ImmSetStatusWindowPos(h1, &pt); + info->u_himc = ImmCreateContext(); + ImmSetOpenStatus(info->u_himc, TRUE); + cdf.dwIndex = 0; + cdf.dwStyle = CFS_CANDIDATEPOS; + cdf.ptCurrentPos.x = 0; + cdf.ptCurrentPos.y = 0; + ImmSetCandidateWindow(info->u_himc, &cdf); SetEvent(info->event); @@ -487,15 +496,23 @@ static void test_ImmThreads(void) ok(himc != otherHimc, "Windows from other threads should have different himc\n"); ok(otherHimc == threadinfo.himc, "Context from other thread should not change in main thread\n"); - if (0) /* FIXME: Causes wine to hang */ - { h1 = ImmAssociateContext(hwnd,otherHimc); ok(h1 == NULL, "Should fail to be able to Associate a default context from a different thread\n"); h1 = ImmGetContext(hwnd); ok(h1 == himc, "Context for window should remain unchanged\n"); ImmReleaseContext(hwnd,h1); - } + h1 = ImmAssociateContext(hwnd, threadinfo.u_himc); + ok (h1 == NULL, "Should fail to associate a context from a different thread\n"); + h1 = ImmGetContext(hwnd); + ok(h1 == himc, "Context for window should remain unchanged\n"); + ImmReleaseContext(hwnd,h1); + + h1 = ImmAssociateContext(threadinfo.hwnd, threadinfo.u_himc); + ok (h1 == NULL, "Should fail to associate a context from a different thread into a window from that thread.\n"); + h1 = ImmGetContext(threadinfo.hwnd); + ok(h1 == threadinfo.himc, "Context for window should remain unchanged\n"); + ImmReleaseContext(threadinfo.hwnd,h1); /* OpenStatus */ rc = ImmSetOpenStatus(himc, TRUE); @@ -509,8 +526,12 @@ static void test_ImmThreads(void) rc = ImmSetOpenStatus(otherHimc, TRUE); todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); + rc = ImmSetOpenStatus(threadinfo.u_himc, TRUE); + todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); todo_wine ok(rc == 0, "ImmGetOpenStatus failed\n"); + rc = ImmGetOpenStatus(threadinfo.u_himc); + ok (rc == 1 || broken(rc == 0), "ImmGetOpenStatus should return 1\n"); rc = ImmSetOpenStatus(otherHimc, FALSE); todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); @@ -524,8 +545,12 @@ static void test_ImmThreads(void) rc = ImmGetCompositionFontA(otherHimc, &lf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n"); + rc = ImmGetCompositionFontA(threadinfo.u_himc, &lf); + ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont user himc failed\n"); rc = ImmSetCompositionFontA(otherHimc, &lf); todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); + rc = ImmSetCompositionFontA(threadinfo.u_himc, &lf); + todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); /* CompositionWindow */ rc = ImmSetCompositionWindow(himc, &cf); @@ -535,8 +560,12 @@ static void test_ImmThreads(void) rc = ImmSetCompositionWindow(otherHimc, &cf); todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n"); + rc = ImmSetCompositionWindow(threadinfo.u_himc, &cf); + todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n"); rc = ImmGetCompositionWindow(otherHimc, &cf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n"); + rc = ImmGetCompositionWindow(threadinfo.u_himc, &cf); + ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n"); /* ConversionStatus */ rc = ImmGetConversionStatus(himc, &status, &sentence); @@ -546,8 +575,12 @@ static void test_ImmThreads(void) rc = ImmGetConversionStatus(otherHimc, &status, &sentence); ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n"); + rc = ImmGetConversionStatus(threadinfo.u_himc, &status, &sentence); + ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n"); rc = ImmSetConversionStatus(otherHimc, status, sentence); todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n"); + rc = ImmSetConversionStatus(threadinfo.u_himc, status, sentence); + todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n"); /* StatusWindowPos */ rc = ImmSetStatusWindowPos(himc, &pt); @@ -557,8 +590,24 @@ static void test_ImmThreads(void) rc = ImmSetStatusWindowPos(otherHimc, &pt); todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); + rc = ImmSetStatusWindowPos(threadinfo.u_himc, &pt); + todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); rc = ImmGetStatusWindowPos(otherHimc, &pt); ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n"); + rc = ImmGetStatusWindowPos(threadinfo.u_himc, &pt); + ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n"); + + h1 = ImmAssociateContext(threadinfo.hwnd, NULL); + ok (h1 == otherHimc, "ImmAssociateContext cross thread with NULL should work\n"); + h1 = ImmGetContext(threadinfo.hwnd); + ok (h1 == NULL, "CrossThread window context should be NULL\n"); + h1 = ImmAssociateContext(threadinfo.hwnd, h1); + ok (h1 == NULL, "Resetting cross thread context should fail\n"); + h1 = ImmGetContext(threadinfo.hwnd); + ok (h1 == NULL, "CrossThread window context should still be NULL\n"); + + rc = ImmDestroyContext(threadinfo.u_himc); + ok (rc == 0, "ImmDestroyContext Cross Thread should fail\n"); /* Candidate Window */ rc = ImmGetCandidateWindow(himc, 0, &cdf); @@ -576,6 +625,10 @@ static void test_ImmThreads(void) ok (rc == 0, "ImmGetCandidateWindow should fail\n"); rc = ImmSetCandidateWindow(otherHimc, &cdf); todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n"); + rc = ImmGetCandidateWindow(threadinfo.u_himc, 0, &cdf); + ok (rc == 1 || broken( rc == 0), "ImmGetCandidateWindow should succeed\n"); + rc = ImmSetCandidateWindow(threadinfo.u_himc, &cdf); + todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n"); ImmReleaseContext(threadinfo.hwnd,otherHimc); ImmReleaseContext(hwnd,himc);
1
0
0
0
Aric Stewart : imm32: Use thread data from target HWND.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: 455ca1adb08a87c01a7b044171c909176d8895cf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=455ca1adb08a87c01a7b04417…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 25 11:45:22 2015 -0600 imm32: Use thread data from target HWND. --- dlls/imm32/imm.c | 39 +++++++++++++++++++++++++++++---------- dlls/imm32/tests/imm32.c | 21 ++++++++++++++------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index db5939c..2b3804e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -246,6 +246,21 @@ static IMMThreadData* IMM_GetThreadData(DWORD id) return data; } +static IMMThreadData* IMM_GetThreadDataForWindow(HWND hwnd) +{ + DWORD process; + DWORD thread = 0; + + if (hwnd) + { + thread = GetWindowThreadProcessId(hwnd, &process); + if (process != GetCurrentProcessId()) + return NULL; + } + + return IMM_GetThreadData(thread); +} + static BOOL IMM_IsDefaultContext(HIMC imc) { InputContextData *data = get_imc_data(imc); @@ -478,21 +493,21 @@ static InputContextData* get_imc_data(HIMC hIMC) return data; } -static IMMThreadData* IMM_GetInitializedThreadData(void) +static IMMThreadData* IMM_GetInitializedThreadData(HWND hWnd) { - IMMThreadData* thread_data = IMM_GetThreadData(0); + IMMThreadData* thread_data = IMM_GetThreadDataForWindow(hWnd); if (!thread_data) return NULL; - if (!thread_data->defaultContext) + if (!thread_data->defaultContext && thread_data->threadID == GetCurrentThreadId()) { HIMC defaultContext; LeaveCriticalSection(&threaddata_cs); defaultContext = ImmCreateContext(); if (defaultContext) ((InputContextData*)defaultContext)->threadDefault = TRUE; - thread_data = IMM_GetThreadData(0); + thread_data = IMM_GetThreadDataForWindow(hWnd); if (!thread_data) { IMM_DestroyContext(defaultContext); @@ -528,7 +543,7 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) if (hIMC && data->IMC.hWnd == hWnd) return hIMC; - thread_data = IMM_GetInitializedThreadData(); + thread_data = IMM_GetInitializedThreadData(hWnd); if (!thread_data) return NULL; @@ -603,7 +618,7 @@ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) TRACE("(%p, %p, 0x%x):\n", hWnd, hIMC, dwFlags); - thread_data = IMM_GetInitializedThreadData(); + thread_data = IMM_GetInitializedThreadData(hWnd); if (!thread_data) return FALSE; @@ -1470,7 +1485,7 @@ HIMC WINAPI ImmGetContext(HWND hWnd) return NULL; } - thread_data = IMM_GetInitializedThreadData(); + thread_data = IMM_GetInitializedThreadData(hWnd); if (!thread_data) return NULL; @@ -1595,18 +1610,21 @@ BOOL WINAPI ImmGetConversionStatus( HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) { HWND ret, new = NULL; - IMMThreadData* thread_data = IMM_GetThreadData(0); + IMMThreadData* thread_data = IMM_GetThreadDataForWindow(hWnd); if (!thread_data) return NULL; - if (thread_data->hwndDefault == NULL) + if (thread_data->hwndDefault == NULL && thread_data->threadID == GetCurrentThreadId()) { /* Do not create the window inside of a critical section */ LeaveCriticalSection(&threaddata_cs); new = CreateWindowExW( WS_EX_TOOLWINDOW, szwIME, NULL, WS_POPUP, 0, 0, 1, 1, 0, 0, 0, 0); - thread_data = IMM_GetThreadData(0); + thread_data = IMM_GetThreadDataForWindow(hWnd); if (!thread_data) + { + DestroyWindow(new); return NULL; + } /* See if anyone beat us */ if (thread_data->hwndDefault == NULL) { @@ -1622,6 +1640,7 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) { DestroyWindow(new); } + TRACE("Default is %p\n",ret); return ret; } diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index d434648..34e82c6 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -425,15 +425,17 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam) HWND hwnd2; COMPOSITIONFORM cf; POINT pt; + MSG msg; + igc_threadinfo *info= (igc_threadinfo*)lpParam; info->hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL); h1 = ImmGetContext(hwnd); - todo_wine ok(info->himc == h1, "hwnd context changed in new thread\n"); + ok(info->himc == h1, "hwnd context changed in new thread\n"); h2 = ImmGetContext(info->hwnd); - todo_wine ok(h2 != h1, "new hwnd in new thread should have different context\n"); + ok(h2 != h1, "new hwnd in new thread should have different context\n"); info->himc = h2; ImmReleaseContext(hwnd,h1); @@ -452,7 +454,12 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam) ImmSetStatusWindowPos(h1, &pt); SetEvent(info->event); - Sleep(INFINITE); + + while(GetMessageW(&msg, 0, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } return 1; } @@ -477,8 +484,8 @@ static void test_ImmThreads(void) otherHimc = ImmGetContext(threadinfo.hwnd); - todo_wine ok(himc != otherHimc, "Windows from other threads should have different himc\n"); - todo_wine ok(otherHimc == threadinfo.himc, "Context from other thread should not change in main thread\n"); + ok(himc != otherHimc, "Windows from other threads should have different himc\n"); + ok(otherHimc == threadinfo.himc, "Context from other thread should not change in main thread\n"); if (0) /* FIXME: Causes wine to hang */ { @@ -566,7 +573,7 @@ static void test_ImmThreads(void) ok (rc == 1, "ImmGetCandidateWindow should succeed\n"); rc = ImmGetCandidateWindow(otherHimc, 0, &cdf); - todo_wine ok (rc == 0, "ImmGetCandidateWindow should fail\n"); + ok (rc == 0, "ImmGetCandidateWindow should fail\n"); rc = ImmSetCandidateWindow(otherHimc, &cdf); todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n"); @@ -577,7 +584,7 @@ static void test_ImmThreads(void) TerminateThread(hThread, 1); himc = ImmGetContext(GetDesktopWindow()); - todo_wine ok(himc == NULL, "Should not be able to get himc from other process window\n"); + ok(himc == NULL, "Should not be able to get himc from other process window\n"); } static void test_ImmIsUIMessage(void)
1
0
0
0
Aric Stewart : imm32: Do not let ImmDestroyContext destroy any default contexts.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: f3967902c5e5684d20429caddd81d31a6f211b9a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f3967902c5e5684d20429cadd…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 25 11:45:18 2015 -0600 imm32: Do not let ImmDestroyContext destroy any default contexts. --- dlls/imm32/imm.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 9dbdc1a..db5939c 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -77,6 +77,7 @@ typedef struct tagInputContextData ImmHkl *immKbd; UINT lastVK; + BOOL threadDefault; DWORD magic; } InputContextData; @@ -119,6 +120,7 @@ static CRITICAL_SECTION threaddata_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; #define is_kbd_ime_unicode(p) (p->imeInfo.fdwProperty & IME_PROP_UNICODE) static BOOL IMM_DestroyContext(HIMC hIMC); +static InputContextData* get_imc_data(HIMC hIMC); static inline WCHAR *strdupAtoW( const char *str ) { @@ -244,6 +246,16 @@ static IMMThreadData* IMM_GetThreadData(DWORD id) return data; } +static BOOL IMM_IsDefaultContext(HIMC imc) +{ + InputContextData *data = get_imc_data(imc); + + if (!data) + return FALSE; + + return data->threadDefault; +} + static void IMM_FreeThreadData(void) { IMMThreadData *data; @@ -478,6 +490,8 @@ static IMMThreadData* IMM_GetInitializedThreadData(void) HIMC defaultContext; LeaveCriticalSection(&threaddata_cs); defaultContext = ImmCreateContext(); + if (defaultContext) + ((InputContextData*)defaultContext)->threadDefault = TRUE; thread_data = IMM_GetThreadData(0); if (!thread_data) { @@ -780,11 +794,7 @@ static BOOL IMM_DestroyContext(HIMC hIMC) */ BOOL WINAPI ImmDestroyContext(HIMC hIMC) { - IMMThreadData* thread_data = IMM_GetThreadData(0); - HIMC defaultContext = thread_data->defaultContext; - LeaveCriticalSection(&threaddata_cs); - - if (hIMC != defaultContext) + if (!IMM_IsDefaultContext(hIMC)) return IMM_DestroyContext(hIMC); else return FALSE;
1
0
0
0
Aric Stewart : imm32: Move thread data from TLSEntry to an internal list.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: e28fc1177a1f77e89b81abfd5ee606dcab071ad9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e28fc1177a1f77e89b81abfd5…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 25 11:45:11 2015 -0600 imm32: Move thread data from TLSEntry to an internal list. --- dlls/imm32/imm.c | 168 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 132 insertions(+), 36 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=e28fc1177a1f77e89b81a…
1
0
0
0
Sebastian Lackner : shell32: Simplify check for an empty string.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: 9491044e443bf5627f6ec5ecb42e1aafd26336b9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9491044e443bf5627f6ec5ecb…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Feb 26 06:32:13 2015 +0100 shell32: Simplify check for an empty string. --- dlls/shell32/assoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index 686c323..21df493 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -897,7 +897,7 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp *association = NULL; - if((type == AT_URLPROTOCOL || type == AT_FILEEXTENSION) && !lstrlenW(query)) + if((type == AT_URLPROTOCOL || type == AT_FILEEXTENSION) && !query[0]) return E_INVALIDARG; else if(type == AT_FILEEXTENSION && query[0] != '.') return E_INVALIDARG;
1
0
0
0
Sebastian Lackner : shell32: Fix memory leak in ApplicationAssociationRegistration_QueryCurrentDefault.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: aba6a680680c493add66f969a3a39b28f3a39779 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=aba6a680680c493add66f969a…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Feb 26 06:29:51 2015 +0100 shell32: Fix memory leak in ApplicationAssociationRegistration_QueryCurrentDefault. --- dlls/shell32/assoc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index 528666e..686c323 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -916,6 +916,11 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp ret = RegGetValueW(hkey, NULL, NULL, RRF_RT_REG_SZ, &keytype, *association, &size); if(ret == ERROR_SUCCESS) hr = S_OK; + else + { + CoTaskMemFree(*association); + *association = NULL; + } } else hr = E_OUTOFMEMORY; @@ -952,6 +957,11 @@ static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IAp ret = RegGetValueW(hkey, path, propid, RRF_RT_REG_SZ, &keytype, *association, &size); if(ret == ERROR_SUCCESS) hr = S_OK; + else + { + CoTaskMemFree(*association); + *association = NULL; + } } else hr = E_OUTOFMEMORY;
1
0
0
0
Amine Khaldi : include: Complete and properly pack DNS_HEADER structure.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: 3809c7a1bc8c35bed4850eb4761c62a38b3cb4a5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3809c7a1bc8c35bed4850eb47…
Author: Amine Khaldi <amine.khaldi(a)reactos.org> Date: Mon Feb 23 21:43:14 2015 +0100 include: Complete and properly pack DNS_HEADER structure. --- include/windns.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/include/windns.h b/include/windns.h index b8a3e09..fc2a49c 100644 --- a/include/windns.h +++ b/include/windns.h @@ -176,22 +176,26 @@ typedef struct _IP4_ARRAY IP4_ADDRESS AddrArray[1]; } IP4_ARRAY, *PIP4_ARRAY; +#include <pshpack1.h> typedef struct _DNS_HEADER { WORD Xid; - BYTE RecursionDesired; - BYTE Truncation; - BYTE Authoritative; - BYTE Opcode; - BYTE IsResponse; - BYTE ResponseCode; - BYTE Reserved; - BYTE RecursionAvailable; + BYTE RecursionDesired:1; + BYTE Truncation:1; + BYTE Authoritative:1; + BYTE Opcode:4; + BYTE IsResponse:1; + BYTE ResponseCode:4; + BYTE CheckingDisabled:1; + BYTE AuthenticatedData:1; + BYTE Reserved:1; + BYTE RecursionAvailable:1; WORD QuestionCount; WORD AnswerCount; WORD NameServerCount; WORD AdditionalCount; } DNS_HEADER, *PDNS_HEADER; +#include <poppack.h> typedef struct _DNS_MESSAGE_BUFFER {
1
0
0
0
Michael Müller : gdi32: Fix arguments for OSMesaMakeCurrent when using 16 bit formats.
by Alexandre Julliard
26 Feb '15
26 Feb '15
Module: wine Branch: master Commit: e618ab65ed5b623785c58ea5ece6e39895d43063 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e618ab65ed5b623785c58ea5e…
Author: Michael Müller <michael(a)fds-team.de> Date: Tue Feb 3 11:07:38 2015 +0100 gdi32: Fix arguments for OSMesaMakeCurrent when using 16 bit formats. --- dlls/gdi32/dibdrv/opengl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/dibdrv/opengl.c b/dlls/gdi32/dibdrv/opengl.c index 28a03f4..a25da208 100644 --- a/dlls/gdi32/dibdrv/opengl.c +++ b/dlls/gdi32/dibdrv/opengl.c @@ -251,6 +251,7 @@ static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context ) HBITMAP bitmap; BITMAPOBJ *bmp; dib_info dib; + GLenum type; BOOL ret = FALSE; if (!context) @@ -281,7 +282,12 @@ static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context ) TRACE( "context %p bits %p size %ux%u\n", context, bits, width, height ); - ret = pOSMesaMakeCurrent( context->context, bits, GL_UNSIGNED_BYTE, width, height ); + if (pixel_formats[context->format - 1].mesa == OSMESA_RGB_565) + type = GL_UNSIGNED_SHORT_5_6_5; + else + type = GL_UNSIGNED_BYTE; + + ret = pOSMesaMakeCurrent( context->context, bits, type, width, height ); if (ret) { pOSMesaPixelStore( OSMESA_ROW_LENGTH, abs( dib.stride ) * 8 / dib.bit_count );
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
42
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
Results per page:
10
25
50
100
200