http://bugs.winehq.org/show_bug.cgi?id=2527
--- Comment #29 from Jerome Leclanche adys.wh@gmail.com 2011-11-02 04:42:58 CDT --- For some reason I can't attach files...
Anyhow, the source is provided, and this is the open_popup function:
static void open_popup(DWORD mouseXY, char *text) { int mouseX, mouseY, cxscreen, startX, startY, side; /*cyscreen*/ PAINTSTRUCT ps; RECT purc = {0,0,0,0}; HFONT oldfont; #define POPUP_BORDER 1
close_popup(); // Open window with dummy position and size to get device context popup = CreateWindow("STATIC", "", WS_POPUP|WS_VISIBLE,10,10,250,50, hwndMain, NULL, t_hinst, NULL);
BeginPaint(popup,&ps); oldfont = SelectFont(ps.hdc,gfont); DrawText(ps.hdc, text, strlen(text), &purc, DT_CALCRECT); // Get extents for this text purc.right += POPUP_BORDER*2; purc.bottom += POPUP_BORDER*2;
mouseX = LOWORD(mouseXY); mouseY = HIWORD(mouseXY); cxscreen = GetSystemMetrics(SM_CXSCREEN); if (side=(cxscreen > (mouseX + winX + purc.right))) startX = mouseX + winX; else startX = mouseX + winX - purc.right; if (0 < (mouseY + winY - purc.bottom)) startY = mouseY + winY - purc.bottom; else startY = mouseY + winY; // Now make window the right size and in the right place MoveWindow(popup,startX,startY,purc.right,purc.bottom,FALSE); FillRect( ps.hdc, &purc, GetStockObject(WHITE_BRUSH)); FrameRect(ps.hdc, &purc, GetStockObject(BLACK_BRUSH)); purc.left += POPUP_BORDER; purc.top += POPUP_BORDER; purc.right -= POPUP_BORDER; purc.bottom -= POPUP_BORDER; DrawText(ps.hdc,text,strlen(text),&purc,DT_WORDBREAK|(side? DT_LEFT : DT_RIGHT)); SelectFont(ps.hdc,oldfont); EndPaint(popup,&ps); }
I'll let someone transform that into a testcase. The full wxtide.c file is provided in the .7z that comes with the download.