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
October 2009
----- 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
3 participants
1207 discussions
Start a n
N
ew thread
Alexandre Julliard : user32: Don't use a static dc for icon blitting.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: 5cdd8a2a4889f3f2556e57e020ba2a3eb5ff3142 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5cdd8a2a4889f3f2556e57e02…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Oct 5 15:18:10 2009 +0200 user32: Don't use a static dc for icon blitting. --- dlls/user32/cursoricon.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index a74b79d..fca04ce 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -674,10 +674,7 @@ static BOOL stretch_blt_icon(HBITMAP hDest, BITMAPINFO *pDestInfo, BITMAPINFO *p { HBITMAP hOld; BOOL res = FALSE; - static HDC hdcMem = NULL; - - if (!hdcMem) - hdcMem = CreateCompatibleDC(screen_dc); + HDC hdcMem = CreateCompatibleDC(screen_dc); if (hdcMem) { @@ -687,6 +684,7 @@ static BOOL stretch_blt_icon(HBITMAP hDest, BITMAPINFO *pDestInfo, BITMAPINFO *p 0, 0, pSrcInfo->bmiHeader.biWidth, pSrcInfo->bmiHeader.biHeight, pSrcBits, pSrcInfo, DIB_RGB_COLORS, SRCCOPY); SelectObject(hdcMem, hOld); + DeleteDC( hdcMem ); } return res;
1
0
0
0
Joel Holdsworth : user32: Fixed CURSORICON_CreateIconFromBMI to preserve the alpha channel.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: c2202929ab4b6d1ce379865dfd8904186814f265 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c2202929ab4b6d1ce379865df…
Author: Joel Holdsworth <joel(a)airwebreathe.org.uk> Date: Mon Jun 29 19:10:36 2009 +0100 user32: Fixed CURSORICON_CreateIconFromBMI to preserve the alpha channel. --- dlls/user32/cursoricon.c | 147 +++++++++++++++++++++++++++------------------- 1 files changed, 87 insertions(+), 60 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 23de6a5..a74b79d 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -659,6 +659,39 @@ static CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( CURSORICONFILEDIR *d return &dir->idEntries[n]; } +/*********************************************************************** + * stretch_blt_icon + * + * A helper function that stretches a bitmap buffer into an HBITMAP. + * + * PARAMS + * hDest [I] The handle of the destination bitmap. + * pDestInfo [I] The BITMAPINFO of the destination bitmap. + * pSrcInfo [I] The BITMAPINFO of the source bitmap. + * pSrcBits [I] A pointer to the source bitmap buffer. + **/ +static BOOL stretch_blt_icon(HBITMAP hDest, BITMAPINFO *pDestInfo, BITMAPINFO *pSrcInfo, char *pSrcBits) +{ + HBITMAP hOld; + BOOL res = FALSE; + static HDC hdcMem = NULL; + + if (!hdcMem) + hdcMem = CreateCompatibleDC(screen_dc); + + if (hdcMem) + { + hOld = SelectObject(hdcMem, hDest); + res = StretchDIBits(hdcMem, + 0, 0, pDestInfo->bmiHeader.biWidth, pDestInfo->bmiHeader.biHeight, + 0, 0, pSrcInfo->bmiHeader.biWidth, pSrcInfo->bmiHeader.biHeight, + pSrcBits, pSrcInfo, DIB_RGB_COLORS, SRCCOPY); + SelectObject(hdcMem, hOld); + } + + return res; +} + static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, POINT16 hotspot, BOOL bIcon, DWORD dwVersion, @@ -666,12 +699,11 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, UINT cFlag ) { HGLOBAL16 hObj; - static HDC hdcMem; int sizeAnd, sizeXor; HBITMAP hAndBits = 0, hXorBits = 0; /* error condition for later */ BITMAP bmpXor, bmpAnd; - BOOL DoStretch; INT size; + BITMAPINFO *pSrcInfo, *pDestInfo; if (dwVersion == 0x00020000) { @@ -693,11 +725,10 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, if (!width) width = bmi->bmiHeader.biWidth; if (!height) height = bmi->bmiHeader.biHeight/2; - DoStretch = (bmi->bmiHeader.biHeight/2 != height) || - (bmi->bmiHeader.biWidth != width); /* Scale the hotspot */ - if (DoStretch && hotspot.x != ICON_HOTSPOT && hotspot.y != ICON_HOTSPOT) + if (((bmi->bmiHeader.biHeight/2 != height) || (bmi->bmiHeader.biWidth != width)) && + hotspot.x != ICON_HOTSPOT && hotspot.y != ICON_HOTSPOT) { hotspot.x = (hotspot.x * width) / bmi->bmiHeader.biWidth; hotspot.y = (hotspot.y * height) / (bmi->bmiHeader.biHeight / 2); @@ -706,8 +737,6 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL ); if (screen_dc) { - BITMAPINFO* pInfo; - /* Make sure we have room for the monochrome bitmap later on. * Note that BITMAPINFOINFO and BITMAPCOREHEADER are the same * up to and including the biBitCount. In-memory icon resource @@ -719,40 +748,47 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, * BYTE icAND[] // DIB bits for AND mask */ - if ((pInfo = HeapAlloc( GetProcessHeap(), 0, - max(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD))))) + pSrcInfo = HeapAlloc( GetProcessHeap(), 0, + max(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD))); + pDestInfo = HeapAlloc( GetProcessHeap(), 0, + max(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD))); + if (pSrcInfo && pDestInfo) { - memcpy( pInfo, bmi, size ); - pInfo->bmiHeader.biHeight /= 2; + memcpy( pSrcInfo, bmi, size ); + pSrcInfo->bmiHeader.biHeight /= 2; + + memcpy( pDestInfo, bmi, size ); + pDestInfo->bmiHeader.biWidth = width; + pDestInfo->bmiHeader.biHeight = height; + pDestInfo->bmiHeader.biSizeImage = 0; /* Create the XOR bitmap */ + if(pSrcInfo->bmiHeader.biBitCount == 32) + { + void *pDIBBuffer = NULL; + hXorBits = CreateDIBSection(screen_dc, pDestInfo, DIB_RGB_COLORS, &pDIBBuffer, NULL, 0); - if (DoStretch) { + if(hXorBits) + { + if (!stretch_blt_icon(hXorBits, pDestInfo, pSrcInfo, (char*)bmi + size)) + { + DeleteObject(hXorBits); + hXorBits = 0; + } + } + } + else + { hXorBits = CreateCompatibleBitmap(screen_dc, width, height); + if(hXorBits) { - HBITMAP hOld; - BOOL res = FALSE; - - if (!hdcMem) hdcMem = CreateCompatibleDC(screen_dc); - if (hdcMem) { - hOld = SelectObject(hdcMem, hXorBits); - res = StretchDIBits(hdcMem, 0, 0, width, height, 0, 0, - bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight/2, - (char*)bmi + size, pInfo, DIB_RGB_COLORS, SRCCOPY); - SelectObject(hdcMem, hOld); + if(!stretch_blt_icon(hXorBits, pDestInfo, pSrcInfo, (char*)bmi + size)) + { + DeleteObject(hXorBits); + hXorBits = 0; + } } - if (!res) { DeleteObject(hXorBits); hXorBits = 0; } - } - } else { - if (is_dib_monochrome(bmi)) { - hXorBits = CreateBitmap(width, height, 1, 1, NULL); - SetDIBits(screen_dc, hXorBits, 0, height, - (char*)bmi + size, pInfo, DIB_RGB_COLORS); - } - else - hXorBits = CreateDIBitmap(screen_dc, &pInfo->bmiHeader, - CBM_INIT, (char*)bmi + size, pInfo, DIB_RGB_COLORS); } if( hXorBits ) @@ -761,51 +797,42 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, get_dib_width_bytes( bmi->bmiHeader.biWidth, bmi->bmiHeader.biBitCount ) * abs( bmi->bmiHeader.biHeight ) / 2; - pInfo->bmiHeader.biBitCount = 1; - if (pInfo->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) + pSrcInfo->bmiHeader.biBitCount = 1; + if (pSrcInfo->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) { - RGBQUAD *rgb = pInfo->bmiColors; + RGBQUAD *rgb = pSrcInfo->bmiColors; - pInfo->bmiHeader.biClrUsed = pInfo->bmiHeader.biClrImportant = 2; + pSrcInfo->bmiHeader.biClrUsed = pSrcInfo->bmiHeader.biClrImportant = 2; rgb[0].rgbBlue = rgb[0].rgbGreen = rgb[0].rgbRed = 0x00; rgb[1].rgbBlue = rgb[1].rgbGreen = rgb[1].rgbRed = 0xff; rgb[0].rgbReserved = rgb[1].rgbReserved = 0; } else { - RGBTRIPLE *rgb = (RGBTRIPLE *)(((BITMAPCOREHEADER *)pInfo) + 1); + RGBTRIPLE *rgb = (RGBTRIPLE *)(((BITMAPCOREHEADER *)pSrcInfo) + 1); rgb[0].rgbtBlue = rgb[0].rgbtGreen = rgb[0].rgbtRed = 0x00; rgb[1].rgbtBlue = rgb[1].rgbtGreen = rgb[1].rgbtRed = 0xff; } /* Create the AND bitmap */ + hAndBits = CreateBitmap(width, height, 1, 1, NULL); - if (DoStretch) { - if ((hAndBits = CreateBitmap(width, height, 1, 1, NULL))) { - HBITMAP hOld; - BOOL res = FALSE; - - if (!hdcMem) hdcMem = CreateCompatibleDC(screen_dc); - if (hdcMem) { - hOld = SelectObject(hdcMem, hAndBits); - res = StretchDIBits(hdcMem, 0, 0, width, height, 0, 0, - pInfo->bmiHeader.biWidth, pInfo->bmiHeader.biHeight, - xbits, pInfo, DIB_RGB_COLORS, SRCCOPY); - SelectObject(hdcMem, hOld); + if(!stretch_blt_icon(hAndBits, pDestInfo, pSrcInfo, xbits)) + { + DeleteObject(hAndBits); + hAndBits = 0; } - if (!res) { DeleteObject(hAndBits); hAndBits = 0; } - } - } else { - hAndBits = CreateBitmap(width, height, 1, 1, NULL); - - if (hAndBits) SetDIBits(screen_dc, hAndBits, 0, height, - xbits, pInfo, DIB_RGB_COLORS); + if( !hAndBits ) + { + DeleteObject( hXorBits ); + hXorBits = 0; + } } - if( !hAndBits ) DeleteObject( hXorBits ); - } - HeapFree( GetProcessHeap(), 0, pInfo ); + + HeapFree( GetProcessHeap(), 0, pSrcInfo ); + HeapFree( GetProcessHeap(), 0, pDestInfo ); } }
1
0
0
0
Joel Holdsworth : comdlg32: Replaced file dialog house icon with the shell icon for desktop.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: ee09534c27098bc8b00a7c0d5f9199232aab8fb5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ee09534c27098bc8b00a7c0d5…
Author: Joel Holdsworth <joel(a)airwebreathe.org.uk> Date: Sat Oct 3 10:12:55 2009 +0100 comdlg32: Replaced file dialog house icon with the shell icon for desktop. --- dlls/comdlg32/800.bmp | Bin 1334 -> 0 bytes dlls/comdlg32/cdlg_xx.rc | 3 --- dlls/comdlg32/filedlg.c | 27 +++++++++++++++++++-------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/dlls/comdlg32/800.bmp b/dlls/comdlg32/800.bmp deleted file mode 100644 index 3b7dae2..0000000 Binary files a/dlls/comdlg32/800.bmp and /dev/null differ diff --git a/dlls/comdlg32/cdlg_xx.rc b/dlls/comdlg32/cdlg_xx.rc index 0797897..24139d2 100644 --- a/dlls/comdlg32/cdlg_xx.rc +++ b/dlls/comdlg32/cdlg_xx.rc @@ -71,9 +71,6 @@ PD32_PORTRAIT ICON pd32_portrait.ico /* @makedep: pd32_landscape.ico */ PD32_LANDSCAPE ICON pd32_landscape.ico -/* @makedep: 800.bmp */ -800 BITMAP DISCARDABLE LOADONCALL "800.bmp" - /* @makedep: folder.ico */ FOLDER ICON folder.ico diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index a28c457..d1147eb 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -1320,15 +1320,16 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) {VIEW_LIST, FCIDM_TB_SMALLICON, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0 }, {VIEW_DETAILS, FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0 }, }; - TBADDBITMAP tba[2]; + static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR}; + RECT rectTB; RECT rectlook; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); - tba[0].hInst = HINST_COMMCTRL; - tba[0].nID = IDB_VIEW_SMALL_COLOR; - tba[1].hInst = COMDLG32_hInstance; - tba[1].nID = 800; + HIMAGELIST toolbarImageList; + SHFILEINFOA shFileInfo; + ITEMIDLIST *desktopPidl; + + FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("%p\n", fodInfos); @@ -1378,9 +1379,19 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) /* FIXME: use TB_LOADIMAGES when implemented */ /* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/ SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0); - SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba[0]); - SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 1, (LPARAM) &tba[1]); + SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba); + + /* Retrieve and add desktop icon to the toolbar */ + toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L); + SHGetSpecialFolderLocation(hwnd, CSIDL_DESKTOP, &desktopPidl); + SHGetFileInfoA((LPCSTR)desktopPidl, 0, &shFileInfo, sizeof(shFileInfo), + SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON); + ImageList_AddIcon(toolbarImageList, shFileInfo.hIcon); + + DestroyIcon(shFileInfo.hIcon); + CoTaskMemFree(desktopPidl); + /* Finish Toolbar Construction */ SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb); SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1
0
0
0
Gerald Pfeifer : winebuild: Add support for PLATFORM_FREEBSD.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: d222e8edf1983303a7f6ab1ba6bebf3770e00994 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d222e8edf1983303a7f6ab1ba…
Author: Gerald Pfeifer <gerald(a)pfeifer.com> Date: Mon Oct 5 02:24:57 2009 +0200 winebuild: Add support for PLATFORM_FREEBSD. --- tools/winebuild/build.h | 6 +++++- tools/winebuild/main.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 07ac347..b942934 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -124,7 +124,11 @@ enum target_cpu enum target_platform { - PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_WINDOWS + PLATFORM_UNSPECIFIED, + PLATFORM_APPLE, + PLATFORM_FREEBSD, + PLATFORM_SOLARIS, + PLATFORM_WINDOWS }; extern char *target_alias; diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index 9fef1c4..4dfa63f 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -64,6 +64,8 @@ enum target_cpu target_cpu = CPU_POWERPC; #ifdef __APPLE__ enum target_platform target_platform = PLATFORM_APPLE; +#elif defined(__FreeBSD__) +enum target_platform target_platform = PLATFORM_FREEBSD; #elif defined(__sun) enum target_platform target_platform = PLATFORM_SOLARIS; #elif defined(_WIN32) @@ -111,6 +113,7 @@ static const struct { { "macos", PLATFORM_APPLE }, { "darwin", PLATFORM_APPLE }, + { "freebsd", PLATFORM_FREEBSD }, { "solaris", PLATFORM_SOLARIS }, { "windows", PLATFORM_WINDOWS }, { "winnt", PLATFORM_WINDOWS }
1
0
0
0
Jörg Höhle : winecoreaudio: Accept up to 8 channels.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: b16fc0e163dd970665f6d37503c18e1b01f0452f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b16fc0e163dd970665f6d3750…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Mon Oct 5 10:34:24 2009 +0200 winecoreaudio: Accept up to 8 channels. --- dlls/winecoreaudio.drv/audio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/winecoreaudio.drv/audio.c b/dlls/winecoreaudio.drv/audio.c index 7f7c1ee..72e523e 100644 --- a/dlls/winecoreaudio.drv/audio.c +++ b/dlls/winecoreaudio.drv/audio.c @@ -449,7 +449,7 @@ static BOOL supportedFormat(LPWAVEFORMATEX wf) WAVEFORMATEXTENSIBLE * wfex = (WAVEFORMATEXTENSIBLE *)wf; if (wf->cbSize == 22 && IsEqualGUID(&wfex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) { - if (wf->nChannels >=1 && wf->nChannels <= 2) { + if (wf->nChannels >=1 && wf->nChannels <= 8) { if (wf->wBitsPerSample==wfex->Samples.wValidBitsPerSample) { if (wf->wBitsPerSample==8||wf->wBitsPerSample==16) return TRUE;
1
0
0
0
Jörg Höhle : wineoss: Fix the buffer size check for more than 2 channels.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: 55fca7778bf593e4ddde583868ea514ae93edb11 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=55fca7778bf593e4ddde58386…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Sat Oct 3 22:42:30 2009 +0200 wineoss: Fix the buffer size check for more than 2 channels. --- dlls/wineoss.drv/audio.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/wineoss.drv/audio.c b/dlls/wineoss.drv/audio.c index ddf973f..98575f1 100644 --- a/dlls/wineoss.drv/audio.c +++ b/dlls/wineoss.drv/audio.c @@ -2169,6 +2169,7 @@ static DWORD wodClose(WORD wDevID) */ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize) { + WORD delta; TRACE("(%u, %p, %08X);\n", wDevID, lpWaveHdr, dwSize); /* first, do the sanity checks... */ @@ -2187,10 +2188,11 @@ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize) lpWaveHdr->dwFlags |= WHDR_INQUEUE; lpWaveHdr->lpNext = 0; - if ((lpWaveHdr->dwBufferLength & (WOutDev[wDevID].waveFormat.Format.nBlockAlign - 1)) != 0) + delta = lpWaveHdr->dwBufferLength % WOutDev[wDevID].waveFormat.Format.nBlockAlign; + if (delta != 0) { WARN("WaveHdr length isn't a multiple of the PCM block size: %d %% %d\n",lpWaveHdr->dwBufferLength,WOutDev[wDevID].waveFormat.Format.nBlockAlign); - lpWaveHdr->dwBufferLength &= ~(WOutDev[wDevID].waveFormat.Format.nBlockAlign - 1); + lpWaveHdr->dwBufferLength -= delta; } OSS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_HEADER, (DWORD_PTR)lpWaveHdr, FALSE);
1
0
0
0
Jörg Höhle : winmm: Require at least 16 bytes in the WAVE fmt header for PlaySound.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: 376f74b452c2b8dff15b62f6225a27e29814accc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=376f74b452c2b8dff15b62f62…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Sat Oct 3 11:42:37 2009 +0200 winmm: Require at least 16 bytes in the WAVE fmt header for PlaySound. --- dlls/winmm/playsound.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index e1badec..54db68f 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -376,7 +376,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) (LPSTR)&mmckInfo.ckid, mmckInfo.fccType, mmckInfo.cksize); lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); - if (mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(WAVEFORMAT)) + if (mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(PCMWAVEFORMAT)) goto errCleanUp; TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Check range limits in MCM_SETCURSEL.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: b97697dbe7f43aca866ec1481e13b5dec9e54504 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b97697dbe7f43aca866ec1481…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sun Oct 4 23:17:33 2009 +0400 comctl32/monthcal: Check range limits in MCM_SETCURSEL. --- dlls/comctl32/monthcal.c | 57 ++++++++++++++++++++++++++++++++++++++++ dlls/comctl32/tests/monthcal.c | 33 +++++++++++++++++++++++ 2 files changed, 90 insertions(+), 0 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 2078efc..a35d261 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -202,6 +202,62 @@ static BOOL MONTHCAL_ValidateDate(const SYSTEMTIME *time) return TRUE; } +/* Compares two dates in SYSTEMTIME format + * + * PARAMETERS + * + * [I] first : pointer to valid first date data to compare + * [I] second : pointer to valid second date data to compare + * + * RETURN VALUE + * + * -1 : first < second + * 0 : first == second + * 1 : first > second + * + * Note that no date validation performed, alreadt validated values expected. + */ +static LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) +{ + FILETIME ft_first, ft_second; + + SystemTimeToFileTime(first, &ft_first); + SystemTimeToFileTime(second, &ft_second); + + return CompareFileTime(&ft_first, &ft_second); +} + +/* Checks largest possible date range and configured one + * + * PARAMETERS + * + * [I] infoPtr : valid pointer to control data + * [I] date : pointer to valid date data to check + * + * RETURN VALUE + * + * TRUE - date whithin largest and configured range + * FALSE - date is outside largest or configured range + */ +static BOOL MONTHCAL_IsDateInValidRange(const MONTHCAL_INFO *infoPtr, const SYSTEMTIME *date) +{ + static const SYSTEMTIME max_date = { .wYear = 9999, .wMonth = 12, .wDay = 31 }; + static const SYSTEMTIME min_date = { .wYear = 1752, .wMonth = 9, .wDay = 14 }; + + if((MONTHCAL_CompareSystemTime(date, &max_date) == 1) || + (MONTHCAL_CompareSystemTime(date, &min_date) == -1)) return FALSE; + + if(infoPtr->rangeValid & GDTR_MAX) { + if((MONTHCAL_CompareSystemTime(date, &infoPtr->maxSel) == 1)) return FALSE; + } + + if(infoPtr->rangeValid & GDTR_MIN) { + if((MONTHCAL_CompareSystemTime(date, &infoPtr->minSel) == -1)) return FALSE; + } + + return TRUE; +} + /* Used in MCM_SETRANGE/MCM_SETSELRANGE to determine resulting time part. Milliseconds are intentionaly not validated. */ static BOOL MONTHCAL_ValidateTime(const SYSTEMTIME *time) @@ -1119,6 +1175,7 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE; if(!MONTHCAL_ValidateDate(curSel)) return FALSE; + if(!MONTHCAL_IsDateInValidRange(infoPtr, curSel)) return FALSE; infoPtr->minSel = *curSel; infoPtr->maxSel = *curSel; diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 4a051b7..034487d 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -789,6 +789,39 @@ static void test_monthcal_currdate(void) ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE); + /* December, 31, 9999 is the maximum allowed date */ + memset(&st_new, 0, sizeof(st_new)); + st_new.wYear = 9999; + st_new.wMonth = 12; + st_new.wDay = 31; + res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new); + expect(1, res); + memset(&st_test, 0, sizeof(st_test)); + res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test); + expect(1, res); + expect(st_new.wYear, st_test.wYear); + expect(st_new.wMonth, st_test.wMonth); + expect(st_new.wDay, st_test.wDay); + expect(st_new.wHour, st_test.wHour); + expect(st_new.wMinute, st_test.wMinute); + expect(st_new.wSecond, st_test.wSecond); + /* try one day later */ + st_original = st_new; + st_new.wYear = 10000; + st_new.wMonth = 1; + st_new.wDay = 1; + res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new); + expect(0, res); + memset(&st_test, 0, sizeof(st_test)); + res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test); + expect(1, res); + expect(st_original.wYear, st_test.wYear); + expect(st_original.wMonth, st_test.wMonth); + expect(st_original.wDay, st_test.wDay); + expect(st_original.wHour, st_test.wHour); + expect(st_original.wMinute, st_test.wMinute); + expect(st_original.wSecond, st_test.wSecond); + DestroyWindow(hwnd); }
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Use true date comparison on multiselection, not only the day is valuable.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: 480f54b1407bc51150896a3abc82545037c466e7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=480f54b1407bc51150896a3ab…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sun Oct 4 23:17:07 2009 +0400 comctl32/monthcal: Use true date comparison on multiselection, not only the day is valuable. --- dlls/comctl32/monthcal.c | 133 ++++++++++++++++++++++++++++++++++------------ 1 files changed, 98 insertions(+), 35 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index a54cba7..2078efc 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -71,6 +71,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal); #define countof(arr) (sizeof(arr)/sizeof(arr[0])) +/* convert from days to 100 nanoseconds unit - used as FILETIME unit */ +#define DAYSTO100NSECS(days) (((ULONGLONG)(days))*24*60*60*10000000) + typedef struct { HWND hwndSelf; @@ -97,7 +100,7 @@ typedef struct MONTHDAYSTATE *monthdayState; SYSTEMTIME todaysDate; int status; /* See MC_SEL flags */ - int firstSelDay; /* first selected day */ + SYSTEMTIME firstSel; /* first selected day */ INT maxSelCount; SYSTEMTIME minSel; SYSTEMTIME maxSel; @@ -1108,7 +1111,6 @@ MONTHCAL_GetCurSel(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) } /* FIXME: if the specified date is not visible, make it visible */ -/* FIXME: redraw? */ static LRESULT MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) { @@ -1126,6 +1128,7 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) infoPtr->curSel = *curSel; + /* FIXME: it's possible to reduce rectangle here */ InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return TRUE; @@ -1181,15 +1184,28 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range) if(infoPtr->dwStyle & MCS_MULTISELECT) { + SYSTEMTIME old_range[2]; + /* adjust timestamps */ if(!MONTHCAL_ValidateTime(&range[0])) MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[0]); if(!MONTHCAL_ValidateTime(&range[1])) MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[1]); + old_range[0] = infoPtr->minSel; + old_range[1] = infoPtr->maxSel; + infoPtr->minSel = range[0]; infoPtr->maxSel = range[1]; + /* redraw if bounds changed */ + /* FIXME: no actual need to redraw everything */ + if(!MONTHCAL_IsDateEqual(&old_range[0], &range[0]) || + !MONTHCAL_IsDateEqual(&old_range[1], &range[1])) + { + InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + } + TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); return TRUE; } @@ -1566,7 +1582,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) } case MCHT_TODAYLINK: { - infoPtr->firstSelDay = infoPtr->todaysDate.wDay; + infoPtr->firstSel = infoPtr->todaysDate; infoPtr->curSel = infoPtr->todaysDate; infoPtr->minSel = infoPtr->todaysDate; infoPtr->maxSel = infoPtr->todaysDate; @@ -1580,7 +1596,18 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) case MCHT_CALENDARDATEPREV: case MCHT_CALENDARDATE: { - infoPtr->firstSelDay = ht.st.wDay; + infoPtr->firstSel = ht.st; + + if(infoPtr->dwStyle & MCS_MULTISELECT) + { + SYSTEMTIME st[2]; + + st[0] = st[1] = ht.st; + + /* clear selection range */ + MONTHCAL_SetSelRange(infoPtr, st); + } + infoPtr->status = MC_SEL_LBUTDOWN; MONTHCAL_SetDayFocus(infoPtr, &ht.st); return 0; @@ -1634,12 +1661,17 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) (hit == MCHT_CALENDARDATEPREV) || (hit == MCHT_CALENDARDATE)) { - SYSTEMTIME st[2], sel = infoPtr->curSel; + SYSTEMTIME sel = infoPtr->curSel; - st[0] = st[1] = ht.st; - MONTHCAL_SetSelRange(infoPtr, st); - /* will be invalidated here */ - MONTHCAL_SetCurSel(infoPtr, &st[0]); + if(!(infoPtr->dwStyle & MCS_MULTISELECT)) + { + SYSTEMTIME st[2]; + + st[0] = st[1] = ht.st; + MONTHCAL_SetSelRange(infoPtr, st); + /* will be invalidated here */ + MONTHCAL_SetCurSel(infoPtr, &st[0]); + } /* send MCN_SELCHANGE only if new date selected */ if (!MONTHCAL_IsDateEqual(&sel, &ht.st)) @@ -1691,8 +1723,8 @@ static LRESULT MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) { MCHITTESTINFO ht; - SYSTEMTIME old_focused; - int selday, hit; + SYSTEMTIME old_focused, st_ht; + INT hit; RECT r; if(!(infoPtr->status & MC_SEL_LBUTDOWN)) return 0; @@ -1711,47 +1743,78 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) return 0; } - selday = ht.st.wDay; + st_ht = ht.st; old_focused = infoPtr->focusedSel; MONTHCAL_SetDayFocus(infoPtr, &ht.st); MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &r); if(infoPtr->dwStyle & MCS_MULTISELECT) { - SYSTEMTIME selArray[2]; + SYSTEMTIME st[2]; + FILETIME ft_ht, ft_first; + ULARGE_INTEGER ul_ht, ul_first, ul_diff; int i; + LONG cmp; + + MONTHCAL_GetSelRange(infoPtr, st); + i = MONTHCAL_IsDateEqual(&infoPtr->firstSel, &st[0]) ? 1 : 0; + + SystemTimeToFileTime(&st_ht, &ft_ht); + SystemTimeToFileTime(&infoPtr->firstSel, &ft_first); + + cmp = CompareFileTime(&ft_ht, &ft_first); + + if(MONTHCAL_IsDateEqual(&infoPtr->firstSel, &st[1])) { + /* If we're still at the first selected date and range is empty, return. + If range isn't empty we should change range to a singel firstSel */ + if(MONTHCAL_IsDateEqual(&infoPtr->firstSel, &st_ht) && + MONTHCAL_IsDateEqual(&st[0], &st[1])) goto done; - MONTHCAL_GetSelRange(infoPtr, selArray); - i = 0; - if(infoPtr->firstSelDay==selArray[0].wDay) i=1; - TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); - if(infoPtr->firstSelDay==selArray[1].wDay) { - /* 1st time we get here: selArray[0]=selArray[1]) */ - /* if we're still at the first selected date, return */ - if(infoPtr->firstSelDay==selday) goto done; - if(selday<infoPtr->firstSelDay) i = 0; + /* new selected date is earlier */ + if(cmp == -1) i = 0; } - if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { - if(selday>infoPtr->firstSelDay) - selday = infoPtr->firstSelDay + infoPtr->maxSelCount; + ul_ht.LowPart = ft_ht.dwLowDateTime; + ul_ht.HighPart = ft_ht.dwHighDateTime; + ul_first.LowPart = ft_first.dwLowDateTime; + ul_first.HighPart = ft_first.dwHighDateTime; + + /* new selected date is later */ + if(cmp == 1) + ul_diff.QuadPart = ul_ht.QuadPart - ul_first.QuadPart; + else + ul_diff.QuadPart = -ul_ht.QuadPart + ul_first.QuadPart; + + if(ul_diff.QuadPart >= DAYSTO100NSECS(infoPtr->maxSelCount)) { + if(cmp == 1) + ul_ht.QuadPart = ul_first.QuadPart + DAYSTO100NSECS(infoPtr->maxSelCount - 1); else - selday = infoPtr->firstSelDay - infoPtr->maxSelCount; + ul_ht.QuadPart = ul_first.QuadPart - DAYSTO100NSECS(infoPtr->maxSelCount - 1); + + ft_ht.dwLowDateTime = ul_ht.LowPart; + ft_ht.dwHighDateTime = ul_ht.HighPart; + FileTimeToSystemTime(&ft_ht, &st_ht); } - if(selArray[i].wDay!=selday) { - TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); + if(!MONTHCAL_IsDateEqual(&st[i], &st_ht)) { + FILETIME ft_range0, ft_range1; + + st[i] = st_ht; + + SystemTimeToFileTime(&st[0], &ft_range0); + SystemTimeToFileTime(&st[1], &ft_range1); - selArray[i].wDay = selday; + /* swap bounds if needed */ + if(CompareFileTime(&ft_range0, &ft_range1) == 1) { + SYSTEMTIME swap = st[1]; - if(selArray[0].wDay>selArray[1].wDay) { - DWORD tempday; - tempday = selArray[1].wDay; - selArray[1].wDay = selArray[0].wDay; - selArray[0].wDay = tempday; + st[1] = st[0]; + st[0] = swap; } - MONTHCAL_SetSelRange(infoPtr, selArray); + MONTHCAL_CopyTime(&infoPtr->todaysDate, &st[0]); + MONTHCAL_CopyTime(&infoPtr->todaysDate, &st[1]); + MONTHCAL_SetSelRange(infoPtr, st); } }
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Handle mouse pointer followed focus rectangle more accurately.
by Alexandre Julliard
05 Oct '09
05 Oct '09
Module: wine Branch: master Commit: 1ebf42751e8d899a0e170067229230f097b67b11 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1ebf42751e8d899a0e1700672…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sun Oct 4 23:16:41 2009 +0400 comctl32/monthcal: Handle mouse pointer followed focus rectangle more accurately. --- dlls/comctl32/monthcal.c | 73 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 62 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index b5cb65a..a54cba7 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -102,6 +102,7 @@ typedef struct SYSTEMTIME minSel; SYSTEMTIME maxSel; SYSTEMTIME curSel; /* contains currently selected year, month and day */ + SYSTEMTIME focusedSel; /* date currently focused with mouse movement */ DWORD rangeValid; SYSTEMTIME minDate; SYSTEMTIME maxDate; @@ -312,6 +313,43 @@ static inline void MONTHCAL_CalcPosFromDay(const MONTHCAL_INFO *infoPtr, MONTHCAL_CalcDayRect(infoPtr, r, x, y); } +/* Focused day helper: + + - set focused date to given value; + - reset to zero value if NULL passed; + - invalidate previous and new day rectangle only if needed. +*/ +static void MONTHCAL_SetDayFocus(MONTHCAL_INFO *infoPtr, const SYSTEMTIME *st) +{ + RECT r; + + if(st) + { + /* there's nothing to do if it's the same date, + mouse move within same date rectangle case */ + if(MONTHCAL_IsDateEqual(&infoPtr->focusedSel, st)) return; + + /* invalidate old focused day */ + MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->focusedSel.wDay, + infoPtr->focusedSel.wMonth, &r); + InvalidateRect(infoPtr->hwndSelf, &r, FALSE); + + infoPtr->focusedSel = *st; + } + + MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->focusedSel.wDay, + infoPtr->focusedSel.wMonth, &r); + + if(!st & MONTHCAL_ValidateDate(&infoPtr->focusedSel)) + { + static const SYSTEMTIME st_null; + + infoPtr->focusedSel = st_null; + } + + /* on set invalidates new day, on reset clears previous focused day */ + InvalidateRect(infoPtr->hwndSelf, &r, FALSE); +} /* day is the day in the month(1 == 1st of the month) */ /* month is the month value(1 == january, 12 == december) */ @@ -393,8 +431,8 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int SetBkColor(hdc, oldBk); } - /* draw a rectangle around the currently selected days text */ - if((day == infoPtr->curSel.wDay) && (month == infoPtr->curSel.wMonth)) + /* draw focus rectangle */ + if((day == infoPtr->focusedSel.wDay) && (month == infoPtr->focusedSel.wMonth)) DrawFocusRect(hdc, &r); } @@ -1470,13 +1508,16 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); } + SetCapture(infoPtr->hwndSelf); + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); - TRACE("(%d, %d)\n", ht.pt.x, ht.pt.y); hit = MONTHCAL_HitTest(infoPtr, &ht); + TRACE("%x at (%d, %d)\n", hit, ht.pt.x, ht.pt.y); + switch(hit) { case MCHT_TITLEBTNNEXT: @@ -1535,12 +1576,13 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) MONTHCAL_NotifySelect(infoPtr); return 0; } + case MCHT_CALENDARDATENEXT: + case MCHT_CALENDARDATEPREV: case MCHT_CALENDARDATE: { - TRACE("MCHT_CALENDARDATE\n"); - infoPtr->firstSelDay = ht.st.wDay; infoPtr->status = MC_SEL_LBUTDOWN; + MONTHCAL_SetDayFocus(infoPtr, &ht.st); return 0; } } @@ -1570,6 +1612,8 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) redraw = TRUE; } + ReleaseCapture(); + /* always send NM_RELEASEDCAPTURE notification */ nmhdr.hwndFrom = infoPtr->hwndSelf; nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); @@ -1584,6 +1628,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) hit = MONTHCAL_HitTest(infoPtr, &ht); infoPtr->status = MC_SEL_LBUTUP; + MONTHCAL_SetDayFocus(infoPtr, NULL); if((hit == MCHT_CALENDARDATENEXT) || (hit == MCHT_CALENDARDATEPREV) || @@ -1646,7 +1691,8 @@ static LRESULT MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) { MCHITTESTINFO ht; - int oldselday, selday, hit; + SYSTEMTIME old_focused; + int selday, hit; RECT r; if(!(infoPtr->status & MC_SEL_LBUTDOWN)) return 0; @@ -1659,12 +1705,17 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) /* not on the calendar date numbers? bail out */ TRACE("hit:%x\n",hit); - if((hit & MCHT_CALENDARDATE) != MCHT_CALENDARDATE) return 0; + if((hit & MCHT_CALENDARDATE) != MCHT_CALENDARDATE) + { + MONTHCAL_SetDayFocus(infoPtr, NULL); + return 0; + } selday = ht.st.wDay; - oldselday = infoPtr->curSel.wDay; - infoPtr->curSel.wDay = selday; - MONTHCAL_CalcPosFromDay(infoPtr, selday, ht.st. wMonth, &r); + old_focused = infoPtr->focusedSel; + MONTHCAL_SetDayFocus(infoPtr, &ht.st); + + MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &r); if(infoPtr->dwStyle & MCS_MULTISELECT) { SYSTEMTIME selArray[2]; @@ -1709,7 +1760,7 @@ done: /* only redraw if the currently selected day changed */ /* FIXME: this should specify a rectangle containing only the days that changed */ /* using InvalidateRect */ - if(oldselday != infoPtr->curSel.wDay) + if(!MONTHCAL_IsDateEqual(&old_focused, &infoPtr->focusedSel)) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0;
1
0
0
0
← Newer
1
...
100
101
102
103
104
105
106
...
121
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Results per page:
10
25
50
100
200