From a0cabe4f1a543df7c293922444bfe708224242d7 Mon Sep 17 00:00:00 2001 From: "peterlubczynski%netscape.com" Date: Wed, 16 May 2001 02:27:18 +0000 Subject: [PATCH] Fix for sample in plugins r=peterl sr=attinasi patch by kens@activestate.com bug 77234 git-svn-id: svn://10.0.0.236/trunk@95091 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/plugin/samples/simple/npsimple.cpp | 10 +++++++--- mozilla/modules/plugin/test/npsimple.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mozilla/modules/plugin/samples/simple/npsimple.cpp b/mozilla/modules/plugin/samples/simple/npsimple.cpp index 4cf56737866..147bebf3110 100644 --- a/mozilla/modules/plugin/samples/simple/npsimple.cpp +++ b/mozilla/modules/plugin/samples/simple/npsimple.cpp @@ -1148,9 +1148,13 @@ SimplePluginInstance::PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPAR if(paintStruct.fErase) FillRect(hdc, &paintStruct.rcPaint, (HBRUSH) GetStockObject(WHITE_BRUSH)); - - if(inst->fText) - TextOut(hdc, 0, 0, inst->fText, strlen(inst->fText)); + + if(inst->fText) { + RECT rcWnd; + GetWindowRect(hWnd, &rcWnd); + SetTextAlign(hdc, TA_CENTER); + TextOut(hdc, (rcWnd.right-rcWnd.left)/2, (rcWnd.bottom-rcWnd.top)/2, inst->fText, strlen(inst->fText)); + } EndPaint( hWnd, &paintStruct ); break; diff --git a/mozilla/modules/plugin/test/npsimple.cpp b/mozilla/modules/plugin/test/npsimple.cpp index 4cf56737866..147bebf3110 100644 --- a/mozilla/modules/plugin/test/npsimple.cpp +++ b/mozilla/modules/plugin/test/npsimple.cpp @@ -1148,9 +1148,13 @@ SimplePluginInstance::PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPAR if(paintStruct.fErase) FillRect(hdc, &paintStruct.rcPaint, (HBRUSH) GetStockObject(WHITE_BRUSH)); - - if(inst->fText) - TextOut(hdc, 0, 0, inst->fText, strlen(inst->fText)); + + if(inst->fText) { + RECT rcWnd; + GetWindowRect(hWnd, &rcWnd); + SetTextAlign(hdc, TA_CENTER); + TextOut(hdc, (rcWnd.right-rcWnd.left)/2, (rcWnd.bottom-rcWnd.top)/2, inst->fText, strlen(inst->fText)); + } EndPaint( hWnd, &paintStruct ); break;