# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1344042857 0 # Node ID a640714f908740545f2a0296fbf79df1b308bc7d # Parent 9d499b162fe1292ecf57c56f1442ed4996f54359 Fix handling the DW_DT_WORDBREAK flag on OS/2 to cause static text to word wrap. diff -r 9d499b162fe1 -r a640714f9087 os2/dw.c --- a/os2/dw.c Sat Aug 04 00:05:47 2012 +0000 +++ b/os2/dw.c Sat Aug 04 01:14:17 2012 +0000 @@ -1616,7 +1616,27 @@ if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) || WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT)) GpiSetColor(hpsPaint, fcolor); - WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); + if(style & DT_WORDBREAK) + { + int thisheight; + LONG drawn, totaldrawn = 0; + + dw_font_text_extents_get(hWnd, NULL, tempbuf, NULL, &thisheight); + + /* until all chars drawn */ + for(; totaldrawn != len; rclPaint.yTop -= thisheight) + { + /* draw the text */ + drawn = WinDrawText(hpsPaint, len - totaldrawn, (PCH)tempbuf + totaldrawn, + &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); + if(drawn) + totaldrawn += drawn; + else + break; + } + } + else + WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); } /* Function: BubbleProc @@ -6492,6 +6512,7 @@ { WindowData *blah = calloc(1, sizeof(WindowData)); + ENTRYFDATA efd = { sizeof(ENTRYFDATA), 32000, 0, 0 }; HWND tmp = WinCreateWindow(HWND_OBJECT, WC_ENTRYFIELD, (PSZ)text, @@ -6501,7 +6522,7 @@ NULLHANDLE, HWND_TOP, id, - NULL, + (PVOID)&efd, NULL); blah->oldproc = WinSubclassWindow(tmp, _entryproc); WinSetWindowPtr(tmp, QWP_USER, blah);