1*9f62ea84SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9f62ea84SAndrew Rist * distributed with this work for additional information 6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance 9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an 15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the 17*9f62ea84SAndrew Rist * specific language governing permissions and limitations 18*9f62ea84SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*9f62ea84SAndrew Rist *************************************************************/ 21*9f62ea84SAndrew Rist 22*9f62ea84SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <string.h> 25cdf0e10cSrcweir 26cdf0e10cSrcweir #define INCL_DOS 27cdf0e10cSrcweir #define INCL_PM 28cdf0e10cSrcweir #define INCL_WIN 29cdf0e10cSrcweir #include <svpm.h> 30cdf0e10cSrcweir 31cdf0e10cSrcweir // ======================================================================= 32cdf0e10cSrcweir 33cdf0e10cSrcweir #define _SV_SALFRAME_CXX 34cdf0e10cSrcweir 35cdf0e10cSrcweir #ifndef DEBUG_HXX 36cdf0e10cSrcweir #include <tools/debug.hxx> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir #define private public 40cdf0e10cSrcweir 41cdf0e10cSrcweir #ifndef _SV_SALLANG_HXX 42cdf0e10cSrcweir #include <sallang.hxx> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #ifndef _SV_SALIDS_HRC 45cdf0e10cSrcweir #include <salids.hrc> 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #include <saldata.hxx> 48cdf0e10cSrcweir #include <salinst.h> 49cdf0e10cSrcweir #include <salgdi.h> 50cdf0e10cSrcweir #include <salframe.h> 51cdf0e10cSrcweir #include <vcl/timer.hxx> 52cdf0e10cSrcweir #include <vcl/settings.hxx> 53cdf0e10cSrcweir #ifndef _SV_KEYCOES_HXX 54cdf0e10cSrcweir #include <vcl/keycodes.hxx> 55cdf0e10cSrcweir #endif 56cdf0e10cSrcweir #include <saltimer.h> 57cdf0e10cSrcweir 58cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 59cdf0e10cSrcweir extern "C" int debug_printf(const char *f, ...); 60cdf0e10cSrcweir 61cdf0e10cSrcweir static BOOL _bCapture; 62cdf0e10cSrcweir 63cdf0e10cSrcweir #else 64cdf0e10cSrcweir #define debug_printf( ...) { 1; } 65cdf0e10cSrcweir #endif 66cdf0e10cSrcweir 67cdf0e10cSrcweir // ======================================================================= 68cdf0e10cSrcweir 69cdf0e10cSrcweir HPOINTER ImplLoadPointer( ULONG nId ); 70cdf0e10cSrcweir 71cdf0e10cSrcweir static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); 72cdf0e10cSrcweir static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); 73cdf0e10cSrcweir static void ImplSalCalcFrameSize( HWND hWnd, 74cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); 75cdf0e10cSrcweir static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, 76cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); 77cdf0e10cSrcweir MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, 78cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // ======================================================================= 81cdf0e10cSrcweir 82cdf0e10cSrcweir static LanguageType eImplKeyboardLanguage = LANGUAGE_DONTKNOW; 83cdf0e10cSrcweir BOOL Os2SalFrame::mbInReparent = FALSE; 84cdf0e10cSrcweir ULONG Os2SalFrame::mnInputLang = 0; 85cdf0e10cSrcweir 86cdf0e10cSrcweir // ======================================================================= 87cdf0e10cSrcweir 88cdf0e10cSrcweir // define a new flag 89cdf0e10cSrcweir #define SWP_CENTER (SWP_NOAUTOCLOSE<<4) 90cdf0e10cSrcweir #define SWP_SHOWMAXIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MAXIMIZE) 91cdf0e10cSrcweir #define SWP_SHOWMINIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MINIMIZE) 92cdf0e10cSrcweir #define SWP_SHOWNORMAL (SWP_ACTIVATE | SWP_SHOW | SWP_RESTORE) 93cdf0e10cSrcweir 94cdf0e10cSrcweir static LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN); 95cdf0e10cSrcweir static LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir BOOL APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir BOOL rc = WinQueryWindowRect( hwnd, prclDest); 100cdf0e10cSrcweir ULONG tmp = prclDest->yBottom; 101cdf0e10cSrcweir prclDest->yBottom = prclDest->yTop; 102cdf0e10cSrcweir prclDest->yTop = tmp; 103cdf0e10cSrcweir return rc; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir BOOL APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir BOOL rc = WinQueryPointerPos( hwndDesktop, pptl); 109cdf0e10cSrcweir pptl->y = nScreenHeight - pptl->y; 110cdf0e10cSrcweir return rc; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir BOOL APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir SWP swpOwner; 116cdf0e10cSrcweir BOOL rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp); 117cdf0e10cSrcweir 118cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 119cdf0e10cSrcweir debug_printf( "> WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", 120cdf0e10cSrcweir pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); 121cdf0e10cSrcweir #endif 122cdf0e10cSrcweir 123cdf0e10cSrcweir Os2SalFrame* pParentFrame = pFrame->mpParentFrame; 124cdf0e10cSrcweir 125cdf0e10cSrcweir //YD adjust to owner coordinates 126cdf0e10cSrcweir if ( pParentFrame ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir POINTL ptlOwner = {0}; 129cdf0e10cSrcweir 130cdf0e10cSrcweir // coords are relative to screen, map to parent frame client area 131cdf0e10cSrcweir ptlOwner.x = pswp->x; 132cdf0e10cSrcweir ptlOwner.y = pswp->y; 133cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pParentFrame->mhWndClient, &ptlOwner, 1); 134cdf0e10cSrcweir pswp->x = ptlOwner.x; 135cdf0e10cSrcweir pswp->y = ptlOwner.y; 136cdf0e10cSrcweir // get parent client area size 137cdf0e10cSrcweir WinQueryWindowPos( pParentFrame->mhWndClient, &swpOwner); 138cdf0e10cSrcweir } else 139cdf0e10cSrcweir { 140cdf0e10cSrcweir // no owner info, use DESKTOP???? 141cdf0e10cSrcweir swpOwner.cx = nScreenWidth; 142cdf0e10cSrcweir swpOwner.cy = nScreenHeight; 143cdf0e10cSrcweir } 144cdf0e10cSrcweir 145cdf0e10cSrcweir // invert Y coordinate 146cdf0e10cSrcweir pswp->y = swpOwner.cy - (pswp->y + pswp->cy); 147cdf0e10cSrcweir 148cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 149cdf0e10cSrcweir debug_printf( "< WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", 150cdf0e10cSrcweir pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); 151cdf0e10cSrcweir #endif 152cdf0e10cSrcweir return rc; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir BOOL APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y, 156cdf0e10cSrcweir LONG cx, LONG cy, ULONG fl) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir SWP swpOwner = {0}; 159cdf0e10cSrcweir POINTL ptlOwner = {0}; 160cdf0e10cSrcweir HWND hParent = NULL; 161cdf0e10cSrcweir 162cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 163cdf0e10cSrcweir debug_printf( ">WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl 0x%08x\n", 164cdf0e10cSrcweir pFrame->mhWndFrame, x, y, cx, cy, fl); 165cdf0e10cSrcweir #endif 166cdf0e10cSrcweir 167cdf0e10cSrcweir // first resize window if requested 168cdf0e10cSrcweir if ( (fl & SWP_SIZE) ) { 169cdf0e10cSrcweir ULONG flag = SWP_SIZE; 170cdf0e10cSrcweir LONG nX = 0, nY = 0; 171cdf0e10cSrcweir LONG frameFrameX, frameFrameY, frameCaptionY; 172cdf0e10cSrcweir 173cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, frameFrameX, frameFrameY, frameCaptionY ); 174cdf0e10cSrcweir // if we change y size, we need to move the window down 175cdf0e10cSrcweir // because os2 window origin is lower left corner 176cdf0e10cSrcweir if (pFrame->maGeometry.nHeight != cy) { 177cdf0e10cSrcweir SWP aSWP; 178cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndFrame, &aSWP); 179cdf0e10cSrcweir nX = aSWP.x; 180cdf0e10cSrcweir nY = aSWP.y - (cy + 2*frameFrameY + frameCaptionY - aSWP.cy); 181cdf0e10cSrcweir flag |= SWP_MOVE; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, NULL, nX, nY, 184cdf0e10cSrcweir cx+2*frameFrameX, cy+2*frameFrameY+frameCaptionY, flag); 185cdf0e10cSrcweir fl = fl & ~SWP_SIZE; 186cdf0e10cSrcweir } 187cdf0e10cSrcweir else // otherwise get current size 188cdf0e10cSrcweir { 189cdf0e10cSrcweir SWP swp = {0}; 190cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndClient, &swp); 191cdf0e10cSrcweir cx = swp.cx; 192cdf0e10cSrcweir cy = swp.cy; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir // get parent window handle 196cdf0e10cSrcweir Os2SalFrame* pParentFrame = pFrame->mpParentFrame; 197cdf0e10cSrcweir 198cdf0e10cSrcweir // use desktop if parent is not defined 199cdf0e10cSrcweir hParent = pParentFrame ? pParentFrame->mhWndClient : HWND_DESKTOP; 200cdf0e10cSrcweir // if parent is not visible, use desktop as reference 201cdf0e10cSrcweir hParent = WinIsWindowVisible( hParent) ? hParent : HWND_DESKTOP; 202cdf0e10cSrcweir 203cdf0e10cSrcweir WinQueryWindowPos( hParent, &swpOwner); 204cdf0e10cSrcweir 205cdf0e10cSrcweir //YD adjust to owner coordinates only when moving and not centering 206cdf0e10cSrcweir //if (!(fl & SWP_CENTER) && (fl & SWP_MOVE)) 207cdf0e10cSrcweir if ((fl & SWP_MOVE)) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir 210cdf0e10cSrcweir // if SWP_CENTER is specified, change position to parent center 211cdf0e10cSrcweir if (fl & SWP_CENTER) { 212cdf0e10cSrcweir ptlOwner.x = (swpOwner.cx - cx) / 2; 213cdf0e10cSrcweir ptlOwner.y = (swpOwner.cy - cy) / 2; 214cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 215cdf0e10cSrcweir debug_printf( "_WinSetWindowPos SWP_CENTER\n"); 216cdf0e10cSrcweir #endif 217cdf0e10cSrcweir fl = fl & ~SWP_CENTER; 218cdf0e10cSrcweir } else { 219cdf0e10cSrcweir // coords are relative to parent frame client area, map to screen 220cdf0e10cSrcweir // map Y to OS/2 system coordinates 221cdf0e10cSrcweir ptlOwner.x = x; 222cdf0e10cSrcweir ptlOwner.y = swpOwner.cy - (y + cy); 223cdf0e10cSrcweir 224cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 225cdf0e10cSrcweir debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) OS2\n", 226cdf0e10cSrcweir hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); 227cdf0e10cSrcweir #endif 228cdf0e10cSrcweir } 229cdf0e10cSrcweir // map from client area to screen 230cdf0e10cSrcweir WinMapWindowPoints( hParent, HWND_DESKTOP, &ptlOwner, 1); 231cdf0e10cSrcweir x = ptlOwner.x; 232cdf0e10cSrcweir y = ptlOwner.y; 233cdf0e10cSrcweir 234cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 235cdf0e10cSrcweir debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) MAPPED OS2\n", 236cdf0e10cSrcweir hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); 237cdf0e10cSrcweir #endif 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 241cdf0e10cSrcweir debug_printf( "<WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl=%x\n", 242cdf0e10cSrcweir pFrame->mhWndFrame, x, y, cx, cy, fl); 243cdf0e10cSrcweir #endif 244cdf0e10cSrcweir return WinSetWindowPos( pFrame->mhWndFrame, hwndInsertBehind, x, y, 0, 0, fl); 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir // ======================================================================= 248cdf0e10cSrcweir 249cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 250cdf0e10cSrcweir static void dumpWindowInfo( char* fnc, HWND hwnd) 251cdf0e10cSrcweir { 252cdf0e10cSrcweir SWP aSWP; 253cdf0e10cSrcweir HWND hwnd2; 254cdf0e10cSrcweir char szTitle[256]; 255cdf0e10cSrcweir 256cdf0e10cSrcweir #if 0 257cdf0e10cSrcweir _WinQueryWindowPos( hwnd, &aSWP ); 258cdf0e10cSrcweir strcpy(szTitle,""); 259cdf0e10cSrcweir WinQueryWindowText(hwnd, sizeof(szTitle), szTitle); 260cdf0e10cSrcweir debug_printf( "%s: window %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd, 261cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 262cdf0e10cSrcweir hwnd2 = WinQueryWindow(hwnd, QW_PARENT); 263cdf0e10cSrcweir _WinQueryWindowPos( hwnd2, &aSWP ); 264cdf0e10cSrcweir strcpy(szTitle,""); 265cdf0e10cSrcweir WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); 266cdf0e10cSrcweir debug_printf( "%s: parent %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, 267cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 268cdf0e10cSrcweir hwnd2 = WinQueryWindow(hwnd, QW_OWNER); 269cdf0e10cSrcweir _WinQueryWindowPos( hwnd2, &aSWP ); 270cdf0e10cSrcweir strcpy(szTitle,""); 271cdf0e10cSrcweir WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); 272cdf0e10cSrcweir debug_printf( "%s: owner %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, 273cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 274cdf0e10cSrcweir #endif 275cdf0e10cSrcweir } 276cdf0e10cSrcweir #endif 277cdf0e10cSrcweir 278cdf0e10cSrcweir // ======================================================================= 279cdf0e10cSrcweir 280cdf0e10cSrcweir #ifdef ENABLE_IME 281cdf0e10cSrcweir 282cdf0e10cSrcweir struct ImplSalIMEProc 283cdf0e10cSrcweir { 284cdf0e10cSrcweir ULONG nOrd; 285cdf0e10cSrcweir PFN* pProc; 286cdf0e10cSrcweir }; 287cdf0e10cSrcweir 288cdf0e10cSrcweir #define SAL_IME_PROC_COUNT 12 289cdf0e10cSrcweir 290cdf0e10cSrcweir // ----------------------------------------------------------------------- 291cdf0e10cSrcweir 292cdf0e10cSrcweir static SalIMEData* GetSalIMEData() 293cdf0e10cSrcweir { 294cdf0e10cSrcweir SalData* pSalData = GetSalData(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir if ( !pSalData->mbIMEInit ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir pSalData->mbIMEInit = TRUE; 299cdf0e10cSrcweir 300cdf0e10cSrcweir HMODULE hMod = 0; 301cdf0e10cSrcweir if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) ) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir SalIMEData* pIMEData = new SalIMEData; 304cdf0e10cSrcweir BOOL bError = FALSE; 305cdf0e10cSrcweir ImplSalIMEProc aProcAry[SAL_IME_PROC_COUNT] = 306cdf0e10cSrcweir { 307cdf0e10cSrcweir { 101, (PFN*)&(pIMEData->mpAssocIME) }, 308cdf0e10cSrcweir { 104, (PFN*)&(pIMEData->mpGetIME) }, 309cdf0e10cSrcweir { 106, (PFN*)&(pIMEData->mpReleaseIME) }, 310cdf0e10cSrcweir { 117, (PFN*)&(pIMEData->mpSetConversionFont) }, 311cdf0e10cSrcweir { 144, (PFN*)&(pIMEData->mpSetConversionFontSize) }, 312cdf0e10cSrcweir { 118, (PFN*)&(pIMEData->mpGetConversionString) }, 313cdf0e10cSrcweir { 122, (PFN*)&(pIMEData->mpGetResultString) }, 314cdf0e10cSrcweir { 115, (PFN*)&(pIMEData->mpSetCandidateWin) }, 315cdf0e10cSrcweir { 130, (PFN*)&(pIMEData->mpQueryIMEProperty) }, 316cdf0e10cSrcweir { 131, (PFN*)&(pIMEData->mpRequestIME) }, 317cdf0e10cSrcweir { 128, (PFN*)&(pIMEData->mpSetIMEMode) }, 318cdf0e10cSrcweir { 127, (PFN*)&(pIMEData->mpQueryIMEMode) } 319cdf0e10cSrcweir }; 320cdf0e10cSrcweir 321cdf0e10cSrcweir pIMEData->mhModIME = hMod; 322cdf0e10cSrcweir for ( USHORT i = 0; i < SAL_IME_PROC_COUNT; i++ ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir if ( 0 != DosQueryProcAddr( pIMEData->mhModIME, aProcAry[i].nOrd, 0, aProcAry[i].pProc ) ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir bError = TRUE; 327cdf0e10cSrcweir break; 328cdf0e10cSrcweir } 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir if ( bError ) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir DosFreeModule( pIMEData->mhModIME ); 334cdf0e10cSrcweir delete pIMEData; 335cdf0e10cSrcweir } 336cdf0e10cSrcweir else 337cdf0e10cSrcweir pSalData->mpIMEData = pIMEData; 338cdf0e10cSrcweir } 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir return pSalData->mpIMEData; 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir // ----------------------------------------------------------------------- 345cdf0e10cSrcweir 346cdf0e10cSrcweir void ImplReleaseSALIMEData() 347cdf0e10cSrcweir { 348cdf0e10cSrcweir SalData* pSalData = GetSalData(); 349cdf0e10cSrcweir 350cdf0e10cSrcweir if ( pSalData->mpIMEData ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir DosFreeModule( pSalData->mpIMEData->mhModIME ); 353cdf0e10cSrcweir delete pSalData->mpIMEData; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir #endif 358cdf0e10cSrcweir 359cdf0e10cSrcweir // ======================================================================= 360cdf0e10cSrcweir 361cdf0e10cSrcweir static void ImplSaveFrameState( Os2SalFrame* pFrame ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir // Position, Groesse und Status fuer GetWindowState() merken 364cdf0e10cSrcweir if ( !pFrame->mbFullScreen ) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir SWP aSWP; 367cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( pFrame->mhWndFrame); 368cdf0e10cSrcweir 369cdf0e10cSrcweir // Query actual state (maState uses screen coords) 370cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndFrame, &aSWP ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir if ( aSWP.fl & SWP_MINIMIZE ) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 375cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MINIMIZED\n", 376cdf0e10cSrcweir pFrame->mhWndFrame); 377cdf0e10cSrcweir #endif 378cdf0e10cSrcweir pFrame->maState.mnState |= SAL_FRAMESTATE_MINIMIZED; 379cdf0e10cSrcweir if ( bVisible ) 380cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWMAXIMIZED; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir else if ( aSWP.fl & SWP_MAXIMIZE ) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 385cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MAXIMIZED\n", 386cdf0e10cSrcweir pFrame->mhWndFrame); 387cdf0e10cSrcweir #endif 388cdf0e10cSrcweir pFrame->maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED; 389cdf0e10cSrcweir pFrame->maState.mnState |= SAL_FRAMESTATE_MAXIMIZED; 390cdf0e10cSrcweir if ( bVisible ) 391cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWMINIMIZED; 392cdf0e10cSrcweir pFrame->mbRestoreMaximize = TRUE; 393cdf0e10cSrcweir } 394cdf0e10cSrcweir else 395cdf0e10cSrcweir { 396cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 397cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 398cdf0e10cSrcweir // to be consistent with Unix, the frame state is without(!) decoration 399cdf0e10cSrcweir long nTopDeco = nFrameY + nCaptionY; 400cdf0e10cSrcweir long nLeftDeco = nFrameX; 401cdf0e10cSrcweir long nBottomDeco = nFrameY; 402cdf0e10cSrcweir long nRightDeco = nFrameX; 403cdf0e10cSrcweir 404cdf0e10cSrcweir pFrame->maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED); 405cdf0e10cSrcweir // subtract decoration, store screen coords 406cdf0e10cSrcweir pFrame->maState.mnX = aSWP.x+nLeftDeco; 407cdf0e10cSrcweir pFrame->maState.mnY = nScreenHeight - (aSWP.y+aSWP.cy)+nTopDeco; 408cdf0e10cSrcweir pFrame->maState.mnWidth = aSWP.cx-nLeftDeco-nRightDeco; 409cdf0e10cSrcweir pFrame->maState.mnHeight = aSWP.cy-nTopDeco-nBottomDeco; 410cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 411cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x (%dx%d) at %d,%d VCL\n", 412cdf0e10cSrcweir pFrame->mhWndFrame, 413cdf0e10cSrcweir pFrame->maState.mnWidth,pFrame->maState.mnHeight,pFrame->maState.mnX,pFrame->maState.mnY); 414cdf0e10cSrcweir #endif 415cdf0e10cSrcweir if ( bVisible ) 416cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWNORMAL; 417cdf0e10cSrcweir pFrame->mbRestoreMaximize = FALSE; 418cdf0e10cSrcweir //debug_printf( "ImplSaveFrameState: window %08x at %d,%d (size %dx%d)\n", 419cdf0e10cSrcweir // pFrame->mhWndFrame, 420cdf0e10cSrcweir // pFrame->maState.mnX, pFrame->maState.mnY, pFrame->maState.mnWidth, pFrame->maState.mnHeight); 421cdf0e10cSrcweir } 422cdf0e10cSrcweir } 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir // ----------------------------------------------------------------------- 426cdf0e10cSrcweir 427cdf0e10cSrcweir long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* ) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir return 0; 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir // ----------------------------------------------------------------------- 433cdf0e10cSrcweir 434cdf0e10cSrcweir static void ImplSalCalcFrameSize( HWND hWnd, 435cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 438cdf0e10cSrcweir if ( !pFrame ) 439cdf0e10cSrcweir return; 440cdf0e10cSrcweir return ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, 444cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) 445cdf0e10cSrcweir { 446cdf0e10cSrcweir if ( pFrame->mbSizeBorder ) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER ); 449cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER ); 450cdf0e10cSrcweir } 451cdf0e10cSrcweir else if ( pFrame->mbFixBorder ) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXDLGFRAME ); 454cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir else if ( pFrame->mbBorder ) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER ); 459cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir else 462cdf0e10cSrcweir { 463cdf0e10cSrcweir nFrameX = 0; 464cdf0e10cSrcweir nFrameY = 0; 465cdf0e10cSrcweir } 466cdf0e10cSrcweir if ( pFrame->mbCaption ) 467cdf0e10cSrcweir nCaptionY = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); 468cdf0e10cSrcweir else 469cdf0e10cSrcweir nCaptionY = 0; 470cdf0e10cSrcweir 471cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 472cdf0e10cSrcweir //if (_bCapture) 473cdf0e10cSrcweir debug_printf("ImplSalCalcFrameSize 0x%08x x=%d y=%d t=%d\n", pFrame->mhWndFrame, nFrameX, nFrameY, nCaptionY); 474cdf0e10cSrcweir #endif 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir // ----------------------------------------------------------------------- 478cdf0e10cSrcweir 479cdf0e10cSrcweir static void ImplSalCalcFullScreenSize( const Os2SalFrame* pFrame, 480cdf0e10cSrcweir LONG& rX, LONG& rY, LONG& rDX, LONG& rDY ) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir // set window to screen size 483cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 484cdf0e10cSrcweir LONG rScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); 485cdf0e10cSrcweir LONG rScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); 486cdf0e10cSrcweir 487cdf0e10cSrcweir // Framegroessen berechnen 488cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 489cdf0e10cSrcweir 490cdf0e10cSrcweir rX = -nFrameX; 491cdf0e10cSrcweir rY = -(nFrameY+nCaptionY); 492cdf0e10cSrcweir rDX = rScreenDX+(nFrameX*2); 493cdf0e10cSrcweir rDY = rScreenDY+(nFrameY*2)+nCaptionY; 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir // ----------------------------------------------------------------------- 497cdf0e10cSrcweir 498cdf0e10cSrcweir static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, BOOL bAlways = FALSE ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir SWP aSWP; 501cdf0e10cSrcweir _WinQueryWindowPos( pFrame, &aSWP ); 502cdf0e10cSrcweir if ( bAlways || !(aSWP.fl & SWP_MINIMIZE) ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir // set window to screen size 505cdf0e10cSrcweir LONG nX; 506cdf0e10cSrcweir LONG nY; 507cdf0e10cSrcweir LONG nWidth; 508cdf0e10cSrcweir LONG nHeight; 509cdf0e10cSrcweir ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight ); 510cdf0e10cSrcweir _WinSetWindowPos( pFrame, 0, 511cdf0e10cSrcweir nX, nY, nWidth, nHeight, 512cdf0e10cSrcweir SWP_MOVE | SWP_SIZE ); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir // ----------------------------------------------------------------------- 517cdf0e10cSrcweir 518cdf0e10cSrcweir // Uebersetzungstabelle von System-Keycodes in StarView-Keycodes 519cdf0e10cSrcweir #define KEY_TAB_SIZE (VK_ENDDRAG+1) 520cdf0e10cSrcweir 521cdf0e10cSrcweir static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] = 522cdf0e10cSrcweir { 523cdf0e10cSrcweir // StarView-Code System-Code Index 524cdf0e10cSrcweir 0, // 0x00 525cdf0e10cSrcweir 0, // VK_BUTTON1 0x01 526cdf0e10cSrcweir 0, // VK_BUTTON2 0x02 527cdf0e10cSrcweir 0, // VK_BUTTON3 0x03 528cdf0e10cSrcweir 0, // VK_BREAK 0x04 529cdf0e10cSrcweir KEY_BACKSPACE, // VK_BACKSPACE 0x05 530cdf0e10cSrcweir KEY_TAB, // VK_TAB 0x06 531cdf0e10cSrcweir KEY_TAB, // VK_BACKTAB 0x07 532cdf0e10cSrcweir KEY_RETURN, // VK_NEWLINE 0x08 533cdf0e10cSrcweir 0, // VK_SHIFT 0x09 534cdf0e10cSrcweir 0, // VK_CTRL 0x0A 535cdf0e10cSrcweir 0, // VK_ALT 0x0B 536cdf0e10cSrcweir 0, // VK_ALTGRAF 0x0C 537cdf0e10cSrcweir 0, // VK_PAUSE 0x0D 538cdf0e10cSrcweir 0, // VK_CAPSLOCK 0x0E 539cdf0e10cSrcweir KEY_ESCAPE, // VK_ESC 0x0F 540cdf0e10cSrcweir KEY_SPACE, // VK_SPACE 0x10 541cdf0e10cSrcweir KEY_PAGEUP, // VK_PAGEUP 0x11 542cdf0e10cSrcweir KEY_PAGEDOWN, // VK_PAGEDOWN 0x12 543cdf0e10cSrcweir KEY_END, // VK_END 0x13 544cdf0e10cSrcweir KEY_HOME, // VK_HOME 0x14 545cdf0e10cSrcweir KEY_LEFT, // VK_LEFT 0x15 546cdf0e10cSrcweir KEY_UP, // VK_UP 0x16 547cdf0e10cSrcweir KEY_RIGHT, // VK_RIGHT 0x17 548cdf0e10cSrcweir KEY_DOWN, // VK_DOWN 0x18 549cdf0e10cSrcweir 0, // VK_PRINTSCRN 0x19 550cdf0e10cSrcweir KEY_INSERT, // VK_INSERT 0x1A 551cdf0e10cSrcweir KEY_DELETE, // VK_DELETE 0x1B 552cdf0e10cSrcweir 0, // VK_SCRLLOCK 0x1C 553cdf0e10cSrcweir 0, // VK_NUMLOCK 0x1D 554cdf0e10cSrcweir KEY_RETURN, // VK_ENTER 0x1E 555cdf0e10cSrcweir 0, // VK_SYSRQ 0x1F 556cdf0e10cSrcweir KEY_F1, // VK_F1 0x20 557cdf0e10cSrcweir KEY_F2, // VK_F2 0x21 558cdf0e10cSrcweir KEY_F3, // VK_F3 0x22 559cdf0e10cSrcweir KEY_F4, // VK_F4 0x23 560cdf0e10cSrcweir KEY_F5, // VK_F5 0x24 561cdf0e10cSrcweir KEY_F6, // VK_F6 0x25 562cdf0e10cSrcweir KEY_F7, // VK_F7 0x26 563cdf0e10cSrcweir KEY_F8, // VK_F8 0x27 564cdf0e10cSrcweir KEY_F9, // VK_F9 0x28 565cdf0e10cSrcweir KEY_F10, // VK_F10 0x29 566cdf0e10cSrcweir KEY_F11, // VK_F11 0x2A 567cdf0e10cSrcweir KEY_F12, // VK_F12 0x2B 568cdf0e10cSrcweir KEY_F13, // VK_F13 0x2C 569cdf0e10cSrcweir KEY_F14, // VK_F14 0x2D 570cdf0e10cSrcweir KEY_F15, // VK_F15 0x2E 571cdf0e10cSrcweir KEY_F16, // VK_F16 0x2F 572cdf0e10cSrcweir KEY_F17, // VK_F17 0x30 573cdf0e10cSrcweir KEY_F18, // VK_F18 0x31 574cdf0e10cSrcweir KEY_F19, // VK_F19 0x32 575cdf0e10cSrcweir KEY_F20, // VK_F20 0x33 576cdf0e10cSrcweir KEY_F21, // VK_F21 0x34 577cdf0e10cSrcweir KEY_F22, // VK_F22 0x35 578cdf0e10cSrcweir KEY_F23, // VK_F23 0x36 579cdf0e10cSrcweir KEY_F24, // VK_F24 0x37 580cdf0e10cSrcweir 0 // VK_ENDDRAG 0x38 581cdf0e10cSrcweir }; 582cdf0e10cSrcweir 583cdf0e10cSrcweir // ======================================================================= 584cdf0e10cSrcweir 585cdf0e10cSrcweir SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir SalData* pSalData = GetSalData(); 588cdf0e10cSrcweir Os2SalFrame* pFrame = new Os2SalFrame; 589cdf0e10cSrcweir HWND hWndFrame; 590cdf0e10cSrcweir HWND hWndClient; 591cdf0e10cSrcweir ULONG nFrameFlags = FCF_NOBYTEALIGN | FCF_SCREENALIGN; 592cdf0e10cSrcweir ULONG nFrameStyle = 0; 593cdf0e10cSrcweir ULONG nClientStyle = WS_CLIPSIBLINGS; 594cdf0e10cSrcweir BOOL bSubFrame = FALSE; 595cdf0e10cSrcweir 596cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 597cdf0e10cSrcweir debug_printf(">ImplSalCreateFrame hWndParent 0x%x, nSalFrameStyle 0x%x\n", hWndParent, nSalFrameStyle); 598cdf0e10cSrcweir #endif 599cdf0e10cSrcweir 600cdf0e10cSrcweir if ( hWndParent ) 601cdf0e10cSrcweir { 602cdf0e10cSrcweir bSubFrame = TRUE; 603cdf0e10cSrcweir pFrame->mbNoIcon = TRUE; 604cdf0e10cSrcweir } 605cdf0e10cSrcweir 606cdf0e10cSrcweir // determine creation data (bei Moveable nehmen wir DLG-Border, damit 607cdf0e10cSrcweir // es besser aussieht) 608cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE ) 609cdf0e10cSrcweir nFrameFlags |= FCF_CLOSEBUTTON; 610cdf0e10cSrcweir 611cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) { 612cdf0e10cSrcweir pFrame->mbCaption = TRUE; 613cdf0e10cSrcweir nFrameStyle = WS_ANIMATE; 614cdf0e10cSrcweir nFrameFlags |= FCF_SYSMENU | FCF_TITLEBAR | FCF_DLGBORDER; 615cdf0e10cSrcweir if ( !hWndParent ) 616cdf0e10cSrcweir nFrameFlags |= FCF_MINBUTTON; 617cdf0e10cSrcweir 618cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir pFrame->mbSizeBorder = TRUE; 621cdf0e10cSrcweir nFrameFlags |= FCF_SIZEBORDER; 622cdf0e10cSrcweir if ( !hWndParent ) 623cdf0e10cSrcweir nFrameFlags |= FCF_MAXBUTTON; 624cdf0e10cSrcweir } 625cdf0e10cSrcweir else 626cdf0e10cSrcweir pFrame->mbFixBorder = TRUE; 627cdf0e10cSrcweir 628cdf0e10cSrcweir // add task list style if not a tool window 629cdf0e10cSrcweir if ( !(nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) { 630cdf0e10cSrcweir nFrameFlags |= FCF_TASKLIST; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir pFrame->mbNoIcon = TRUE; 637cdf0e10cSrcweir // YD gives small caption -> nExSysStyle |= WS_EX_TOOLWINDOW; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir 640cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) 641cdf0e10cSrcweir { 642cdf0e10cSrcweir //nExSysStyle |= WS_EX_TOOLWINDOW; 643cdf0e10cSrcweir pFrame->mbFloatWin = TRUE; 644cdf0e10cSrcweir } 645cdf0e10cSrcweir //if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP ) 646cdf0e10cSrcweir // nExSysStyle |= WS_EX_TOPMOST; 647cdf0e10cSrcweir 648cdf0e10cSrcweir // init frame data 649cdf0e10cSrcweir pFrame->mnStyle = nSalFrameStyle; 650cdf0e10cSrcweir 651cdf0e10cSrcweir // determine show style 652cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWNORMAL; 653cdf0e10cSrcweir 654cdf0e10cSrcweir // create frame 655cdf0e10cSrcweir //YD FIXME this is a potential bug with multiple threads and cuncurrent 656cdf0e10cSrcweir //window creation, because this field is accessed in 657cdf0e10cSrcweir //WM_CREATE to get window data, 658cdf0e10cSrcweir pSalData->mpCreateFrame = pFrame; 659cdf0e10cSrcweir 660cdf0e10cSrcweir //YD FIXME if SAL_FRAME_CHILD is specified, use hWndParent as parent handle... 661cdf0e10cSrcweir hWndFrame = WinCreateStdWindow( HWND_DESKTOP, nFrameStyle, &nFrameFlags, 662cdf0e10cSrcweir (PSZ)(bSubFrame ? SAL_SUBFRAME_CLASSNAME : SAL_FRAME_CLASSNAME), 663cdf0e10cSrcweir NULL, 664cdf0e10cSrcweir nClientStyle, 0, 0, &hWndClient ); 665cdf0e10cSrcweir debug_printf("ImplSalCreateFrame hWndParent 0x%x, hWndFrame 0x%x, hWndClient 0x%x\n", hWndParent, hWndFrame, hWndClient); 666cdf0e10cSrcweir if ( !hWndFrame ) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir delete pFrame; 669cdf0e10cSrcweir return NULL; 670cdf0e10cSrcweir } 671cdf0e10cSrcweir 672cdf0e10cSrcweir // Parent setzen (Owner) 673cdf0e10cSrcweir if ( hWndParent != 0 && hWndParent != HWND_DESKTOP ) 674cdf0e10cSrcweir WinSetOwner( hWndFrame, hWndParent ); 675cdf0e10cSrcweir 676cdf0e10cSrcweir Os2SalFrame* pParentFrame = GetWindowPtr( hWndParent ); 677cdf0e10cSrcweir if ( pParentFrame ) 678cdf0e10cSrcweir pFrame->mpParentFrame = pParentFrame; 679cdf0e10cSrcweir 680cdf0e10cSrcweir // Icon setzen (YD win32 does it in the class registration) 681cdf0e10cSrcweir if ( nFrameFlags & FCF_MINBUTTON ) 682cdf0e10cSrcweir WinSendMsg( hWndFrame, WM_SETICON, (MPARAM)pInst->mhAppIcon, (MPARAM)0 ); 683cdf0e10cSrcweir 684cdf0e10cSrcweir // If we have an Window with an Caption Bar and without 685cdf0e10cSrcweir // an MaximizeBox, we change the SystemMenu 686cdf0e10cSrcweir if ( (nFrameFlags & (FCF_TITLEBAR | FCF_MAXBUTTON)) == (FCF_TITLEBAR) ) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); 689cdf0e10cSrcweir if ( hSysMenu ) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir if ( !(nFrameFlags & (FCF_MINBUTTON | FCF_MAXBUTTON)) ) 692cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_RESTORE, FALSE); 693cdf0e10cSrcweir if ( !(nFrameFlags & FCF_MINBUTTON) ) 694cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_MINIMIZE, FALSE); 695cdf0e10cSrcweir if ( !(nFrameFlags & FCF_MAXBUTTON) ) 696cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_MAXIMIZE, FALSE); 697cdf0e10cSrcweir if ( !(nFrameFlags & FCF_SIZEBORDER) ) 698cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_SIZE, FALSE); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir } 701cdf0e10cSrcweir if ( (nFrameFlags & FCF_SYSMENU) && !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) ) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); 704cdf0e10cSrcweir if ( hSysMenu ) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_CLOSE, FALSE); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir // ticket#124 subclass frame window: we need to intercept TRACK message 711cdf0e10cSrcweir aSalShlData.mpFrameProc = WinSubclassWindow( hWndFrame, SalFrameSubClassWndProc); 712cdf0e10cSrcweir 713cdf0e10cSrcweir // init OS/2 frame data 714cdf0e10cSrcweir pFrame->mhAB = pInst->mhAB; 715cdf0e10cSrcweir 716cdf0e10cSrcweir // YD 18/08 under OS/2, invisible frames have size 0,0 at 0,0, so 717cdf0e10cSrcweir // we need to set an initial size/position manually 718cdf0e10cSrcweir SWP aSWP; 719cdf0e10cSrcweir memset( &aSWP, 0, sizeof( aSWP ) ); 720cdf0e10cSrcweir WinQueryTaskSizePos( pInst->mhAB, 0, &aSWP ); 721cdf0e10cSrcweir WinSetWindowPos( hWndFrame, NULL, aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, 722cdf0e10cSrcweir SWP_MOVE | SWP_SIZE); 723cdf0e10cSrcweir 724cdf0e10cSrcweir #ifdef ENABLE_IME 725cdf0e10cSrcweir // Input-Context einstellen 726cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 727cdf0e10cSrcweir if ( pIMEData ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir pFrame->mhIMEContext = 0; 730cdf0e10cSrcweir if ( 0 != pIMEData->mpAssocIME( hWndClient, pFrame->mhIMEContext, &pFrame->mhDefIMEContext ) ) 731cdf0e10cSrcweir pFrame->mhDefIMEContext = 0; 732cdf0e10cSrcweir } 733cdf0e10cSrcweir else 734cdf0e10cSrcweir { 735cdf0e10cSrcweir pFrame->mhIMEContext = 0; 736cdf0e10cSrcweir pFrame->mhDefIMEContext = 0; 737cdf0e10cSrcweir } 738cdf0e10cSrcweir #endif 739cdf0e10cSrcweir 740cdf0e10cSrcweir RECTL rectl; 741cdf0e10cSrcweir _WinQueryWindowRect( hWndClient, &rectl ); 742cdf0e10cSrcweir pFrame->mnWidth = rectl.xRight; 743cdf0e10cSrcweir pFrame->mnHeight = rectl.yBottom; 744cdf0e10cSrcweir debug_printf( "ImplSalCreateFrame %dx%d\n", pFrame->mnWidth, pFrame->mnHeight); 745cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 746cdf0e10cSrcweir pFrame->mbDefPos = TRUE; 747cdf0e10cSrcweir 748cdf0e10cSrcweir UpdateFrameGeometry( hWndFrame, pFrame ); 749cdf0e10cSrcweir 750cdf0e10cSrcweir if( pFrame->mnShowState == SWP_SHOWMAXIMIZED ) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir // #96084 set a useful internal window size because 753cdf0e10cSrcweir // the window will not be maximized (and the size updated) before show() 754cdf0e10cSrcweir SetMaximizedFrameGeometry( hWndFrame, pFrame ); 755cdf0e10cSrcweir } 756cdf0e10cSrcweir 757cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 758cdf0e10cSrcweir dumpWindowInfo( "<ImplSalCreateFrame (exit)", hWndFrame); 759cdf0e10cSrcweir #endif 760cdf0e10cSrcweir 761cdf0e10cSrcweir return pFrame; 762cdf0e10cSrcweir } 763cdf0e10cSrcweir 764cdf0e10cSrcweir // ======================================================================= 765cdf0e10cSrcweir 766cdf0e10cSrcweir Os2SalFrame::Os2SalFrame() 767cdf0e10cSrcweir { 768cdf0e10cSrcweir SalData* pSalData = GetSalData(); 769cdf0e10cSrcweir 770cdf0e10cSrcweir mbGraphics = NULL; 771cdf0e10cSrcweir mhPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE ); 772cdf0e10cSrcweir mpGraphics = NULL; 773cdf0e10cSrcweir mpInst = NULL; 774cdf0e10cSrcweir mbFullScreen = FALSE; 775cdf0e10cSrcweir mbAllwayOnTop = FALSE; 776cdf0e10cSrcweir mbVisible = FALSE; 777cdf0e10cSrcweir mbMinHide = FALSE; 778cdf0e10cSrcweir mbInShow = FALSE; 779cdf0e10cSrcweir mbRestoreMaximize = FALSE; 780cdf0e10cSrcweir mbInMoveMsg = FALSE; 781cdf0e10cSrcweir mbInSizeMsg = FALSE; 782cdf0e10cSrcweir mbDefPos = TRUE; 783cdf0e10cSrcweir mbOverwriteState = TRUE; 784cdf0e10cSrcweir mbHandleIME = FALSE; 785cdf0e10cSrcweir mbConversionMode = FALSE; 786cdf0e10cSrcweir mbCandidateMode = FALSE; 787cdf0e10cSrcweir mbCaption = FALSE; 788cdf0e10cSrcweir //mhDefIMEContext = 0; 789cdf0e10cSrcweir mpGraphics = NULL; 790cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 791cdf0e10cSrcweir mnWidth = 0; 792cdf0e10cSrcweir mnHeight = 0; 793cdf0e10cSrcweir mnMinWidth = 0; 794cdf0e10cSrcweir mnMinHeight = 0; 795cdf0e10cSrcweir mnMaxWidth = SHRT_MAX; 796cdf0e10cSrcweir mnMaxHeight = SHRT_MAX; 797cdf0e10cSrcweir mnInputLang = 0; 798cdf0e10cSrcweir mnKeyboardHandle = 0; 799cdf0e10cSrcweir mbGraphics = FALSE; 800cdf0e10cSrcweir mbCaption = FALSE; 801cdf0e10cSrcweir mbBorder = FALSE; 802cdf0e10cSrcweir mbFixBorder = FALSE; 803cdf0e10cSrcweir mbSizeBorder = FALSE; 804cdf0e10cSrcweir mbFullScreen = FALSE; 805cdf0e10cSrcweir //mbPresentation = FALSE; 806cdf0e10cSrcweir mbInShow = FALSE; 807cdf0e10cSrcweir mbRestoreMaximize = FALSE; 808cdf0e10cSrcweir mbInMoveMsg = FALSE; 809cdf0e10cSrcweir mbInSizeMsg = FALSE; 810cdf0e10cSrcweir //mbFullScreenToolWin = FALSE; 811cdf0e10cSrcweir mbDefPos = TRUE; 812cdf0e10cSrcweir mbOverwriteState = TRUE; 813cdf0e10cSrcweir //mbIME = FALSE; 814cdf0e10cSrcweir mbHandleIME = FALSE; 815cdf0e10cSrcweir //mbSpezIME = FALSE; 816cdf0e10cSrcweir //mbAtCursorIME = FALSE; 817cdf0e10cSrcweir mbCandidateMode = FALSE; 818cdf0e10cSrcweir mbFloatWin = FALSE; 819cdf0e10cSrcweir mbNoIcon = FALSE; 820cdf0e10cSrcweir //mSelectedhMenu = 0; 821cdf0e10cSrcweir //mLastActivatedhMenu = 0; 822cdf0e10cSrcweir mpParentFrame = NULL; 823cdf0e10cSrcweir 824cdf0e10cSrcweir memset( &maState, 0, sizeof( SalFrameState ) ); 825cdf0e10cSrcweir maSysData.nSize = sizeof( SystemEnvData ); 826cdf0e10cSrcweir memset( &maGeometry, 0, sizeof( maGeometry ) ); 827cdf0e10cSrcweir 828cdf0e10cSrcweir // insert frame in framelist 829cdf0e10cSrcweir mpNextFrame = pSalData->mpFirstFrame; 830cdf0e10cSrcweir pSalData->mpFirstFrame = this; 831cdf0e10cSrcweir } 832cdf0e10cSrcweir 833cdf0e10cSrcweir // ----------------------------------------------------------------------- 834cdf0e10cSrcweir 835cdf0e10cSrcweir Os2SalFrame::~Os2SalFrame() 836cdf0e10cSrcweir { 837cdf0e10cSrcweir SalData* pSalData = GetSalData(); 838cdf0e10cSrcweir 839cdf0e10cSrcweir // destroy DC 840cdf0e10cSrcweir if ( mpGraphics ) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir ImplSalDeInitGraphics( mpGraphics ); 843cdf0e10cSrcweir WinReleasePS( mpGraphics->mhPS ); 844cdf0e10cSrcweir delete mpGraphics; 845cdf0e10cSrcweir } 846cdf0e10cSrcweir 847cdf0e10cSrcweir // destroy system frame 848cdf0e10cSrcweir WinDestroyWindow( mhWndFrame ); 849cdf0e10cSrcweir 850cdf0e10cSrcweir // remove frame from framelist 851cdf0e10cSrcweir if ( this == pSalData->mpFirstFrame ) 852cdf0e10cSrcweir pSalData->mpFirstFrame = mpNextFrame; 853cdf0e10cSrcweir else 854cdf0e10cSrcweir { 855cdf0e10cSrcweir Os2SalFrame* pTempFrame = pSalData->mpFirstFrame; 856cdf0e10cSrcweir while ( pTempFrame->mpNextFrame != this ) 857cdf0e10cSrcweir pTempFrame = pTempFrame->mpNextFrame; 858cdf0e10cSrcweir 859cdf0e10cSrcweir pTempFrame->mpNextFrame = mpNextFrame; 860cdf0e10cSrcweir } 861cdf0e10cSrcweir } 862cdf0e10cSrcweir 863cdf0e10cSrcweir // ----------------------------------------------------------------------- 864cdf0e10cSrcweir 865cdf0e10cSrcweir static HDC ImplWinGetDC( HWND hWnd ) 866cdf0e10cSrcweir { 867cdf0e10cSrcweir HDC hDC = WinQueryWindowDC( hWnd ); 868cdf0e10cSrcweir if ( !hDC ) 869cdf0e10cSrcweir hDC = WinOpenWindowDC( hWnd ); 870cdf0e10cSrcweir return hDC; 871cdf0e10cSrcweir } 872cdf0e10cSrcweir 873cdf0e10cSrcweir // ----------------------------------------------------------------------- 874cdf0e10cSrcweir 875cdf0e10cSrcweir SalGraphics* Os2SalFrame::GetGraphics() 876cdf0e10cSrcweir { 877cdf0e10cSrcweir if ( mbGraphics ) 878cdf0e10cSrcweir return NULL; 879cdf0e10cSrcweir 880cdf0e10cSrcweir if ( !mpGraphics ) 881cdf0e10cSrcweir { 882cdf0e10cSrcweir SalData* pSalData = GetSalData(); 883cdf0e10cSrcweir mpGraphics = new Os2SalGraphics; 884cdf0e10cSrcweir mpGraphics->mhPS = WinGetPS( mhWndClient ); 885cdf0e10cSrcweir mpGraphics->mhDC = ImplWinGetDC( mhWndClient ); 886cdf0e10cSrcweir mpGraphics->mhWnd = mhWndClient; 887cdf0e10cSrcweir mpGraphics->mnHeight = mnHeight; 888cdf0e10cSrcweir mpGraphics->mbPrinter = FALSE; 889cdf0e10cSrcweir mpGraphics->mbVirDev = FALSE; 890cdf0e10cSrcweir mpGraphics->mbWindow = TRUE; 891cdf0e10cSrcweir mpGraphics->mbScreen = TRUE; 892cdf0e10cSrcweir ImplSalInitGraphics( mpGraphics ); 893cdf0e10cSrcweir mbGraphics = TRUE; 894cdf0e10cSrcweir } 895cdf0e10cSrcweir else 896cdf0e10cSrcweir mbGraphics = TRUE; 897cdf0e10cSrcweir 898cdf0e10cSrcweir return mpGraphics; 899cdf0e10cSrcweir } 900cdf0e10cSrcweir 901cdf0e10cSrcweir // ----------------------------------------------------------------------- 902cdf0e10cSrcweir 903cdf0e10cSrcweir void Os2SalFrame::ReleaseGraphics( SalGraphics* ) 904cdf0e10cSrcweir { 905cdf0e10cSrcweir mbGraphics = FALSE; 906cdf0e10cSrcweir } 907cdf0e10cSrcweir 908cdf0e10cSrcweir // ----------------------------------------------------------------------- 909cdf0e10cSrcweir 910cdf0e10cSrcweir BOOL Os2SalFrame::PostEvent( void* pData ) 911cdf0e10cSrcweir { 912cdf0e10cSrcweir return (BOOL)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData ); 913cdf0e10cSrcweir } 914cdf0e10cSrcweir 915cdf0e10cSrcweir // ----------------------------------------------------------------------- 916cdf0e10cSrcweir 917cdf0e10cSrcweir void Os2SalFrame::SetTitle( const XubString& rTitle ) 918cdf0e10cSrcweir { 919cdf0e10cSrcweir // set window title 920cdf0e10cSrcweir ByteString title( rTitle, gsl_getSystemTextEncoding() ); 921cdf0e10cSrcweir debug_printf("Os2SalFrame::SetTitle %x '%s'\n", mhWndFrame, title.GetBuffer() ); 922cdf0e10cSrcweir WinSetWindowText( mhWndFrame, title.GetBuffer() ); 923cdf0e10cSrcweir } 924cdf0e10cSrcweir 925cdf0e10cSrcweir // ----------------------------------------------------------------------- 926cdf0e10cSrcweir 927cdf0e10cSrcweir void Os2SalFrame::SetIcon( USHORT nIcon ) 928cdf0e10cSrcweir { 929cdf0e10cSrcweir debug_printf("Os2SalFrame::SetIcon\n"); 930cdf0e10cSrcweir 931cdf0e10cSrcweir // If we have a window without an Icon (for example a dialog), ignore this call 932cdf0e10cSrcweir if ( mbNoIcon ) 933cdf0e10cSrcweir return; 934cdf0e10cSrcweir 935cdf0e10cSrcweir // 0 means default (class) icon 936cdf0e10cSrcweir HPOINTER hIcon = NULL; 937cdf0e10cSrcweir if ( !nIcon ) 938cdf0e10cSrcweir nIcon = 1; 939cdf0e10cSrcweir 940cdf0e10cSrcweir ImplLoadSalIcon( nIcon, hIcon ); 941cdf0e10cSrcweir 942cdf0e10cSrcweir DBG_ASSERT( hIcon , "Os2SalFrame::SetIcon(): Could not load icon !" ); 943cdf0e10cSrcweir 944cdf0e10cSrcweir // Icon setzen 945cdf0e10cSrcweir WinSendMsg( mhWndFrame, WM_SETICON, (MPARAM)hIcon, (MPARAM)0 ); 946cdf0e10cSrcweir } 947cdf0e10cSrcweir 948cdf0e10cSrcweir // ----------------------------------------------------------------------- 949cdf0e10cSrcweir 950cdf0e10cSrcweir SalFrame* Os2SalFrame::GetParent() const 951cdf0e10cSrcweir { 952cdf0e10cSrcweir //debug_printf("Os2SalFrame::GetParent\n"); 953cdf0e10cSrcweir return GetWindowPtr( WinQueryWindow(mhWndFrame, QW_OWNER) ); 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir // ----------------------------------------------------------------------- 957cdf0e10cSrcweir 958cdf0e10cSrcweir static void ImplSalShow( HWND hWnd, ULONG bVisible, ULONG bNoActivate ) 959cdf0e10cSrcweir { 960cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 961cdf0e10cSrcweir if ( !pFrame ) 962cdf0e10cSrcweir return; 963cdf0e10cSrcweir 964cdf0e10cSrcweir if ( bVisible ) 965cdf0e10cSrcweir { 966cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 967cdf0e10cSrcweir pFrame->mbOverwriteState = TRUE; 968cdf0e10cSrcweir pFrame->mbInShow = TRUE; 969cdf0e10cSrcweir 970cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 971cdf0e10cSrcweir debug_printf( "ImplSalShow hwnd %x visible flag %d, no activate: flag %d\n", hWnd, bVisible, bNoActivate); 972cdf0e10cSrcweir #endif 973cdf0e10cSrcweir 974cdf0e10cSrcweir if( bNoActivate ) 975cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOW); 976cdf0e10cSrcweir else 977cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, pFrame->mnShowState); 978cdf0e10cSrcweir 979cdf0e10cSrcweir pFrame->mbInShow = FALSE; 980cdf0e10cSrcweir 981cdf0e10cSrcweir // Direct Paint only, if we get the SolarMutx 982cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 983cdf0e10cSrcweir { 984cdf0e10cSrcweir WinUpdateWindow( hWnd ); 985cdf0e10cSrcweir ImplSalYieldMutexRelease(); 986cdf0e10cSrcweir } 987cdf0e10cSrcweir } 988cdf0e10cSrcweir else 989cdf0e10cSrcweir { 990cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 991cdf0e10cSrcweir debug_printf( "ImplSalShow hwnd %x HIDE\n"); 992cdf0e10cSrcweir #endif 993cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_HIDE); 994cdf0e10cSrcweir } 995cdf0e10cSrcweir } 996cdf0e10cSrcweir 997cdf0e10cSrcweir 998cdf0e10cSrcweir // ----------------------------------------------------------------------- 999cdf0e10cSrcweir 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir void Os2SalFrame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir // ----------------------------------------------------------------------- 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir void Os2SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) 1008cdf0e10cSrcweir { 1009cdf0e10cSrcweir // Post this Message to the window, because this only works 1010cdf0e10cSrcweir // in the thread of the window, which has create this window. 1011cdf0e10cSrcweir // We post this message to avoid deadlocks 1012cdf0e10cSrcweir if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) 1013cdf0e10cSrcweir WinPostMsg( mhWndFrame, SAL_MSG_SHOW, (MPARAM)bVisible, (MPARAM)bNoActivate ); 1014cdf0e10cSrcweir else 1015cdf0e10cSrcweir ImplSalShow( mhWndFrame, bVisible, bNoActivate ); 1016cdf0e10cSrcweir } 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir // ----------------------------------------------------------------------- 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir void Os2SalFrame::Enable( BOOL bEnable ) 1021cdf0e10cSrcweir { 1022cdf0e10cSrcweir WinEnableWindow( mhWndFrame, bEnable ); 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir // ----------------------------------------------------------------------- 1026cdf0e10cSrcweir 1027cdf0e10cSrcweir void Os2SalFrame::SetMinClientSize( long nWidth, long nHeight ) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir debug_printf("Os2SalFrame::SetMinClientSize\n"); 1030cdf0e10cSrcweir mnMinWidth = nWidth; 1031cdf0e10cSrcweir mnMinHeight = nHeight; 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir void Os2SalFrame::SetMaxClientSize( long nWidth, long nHeight ) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir debug_printf("Os2SalFrame::SetMaxClientSize\n"); 1037cdf0e10cSrcweir mnMaxWidth = nWidth; 1038cdf0e10cSrcweir mnMaxHeight = nHeight; 1039cdf0e10cSrcweir } 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir // ----------------------------------------------------------------------- 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir void Os2SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, 1044cdf0e10cSrcweir USHORT nFlags ) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir // calculation frame size 1047cdf0e10cSrcweir USHORT nEvent = 0; 1048cdf0e10cSrcweir ULONG nPosFlags = 0; 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1051cdf0e10cSrcweir //dumpWindowInfo( "-Os2SalFrame::SetPosSize", mhWndFrame); 1052cdf0e10cSrcweir debug_printf( ">Os2SalFrame::SetPosSize go to %d,%d (%dx%d) VCL\n",nX,nY,nWidth,nHeight); 1053cdf0e10cSrcweir #endif 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir SWP aSWP; 1056cdf0e10cSrcweir _WinQueryWindowPos( this, &aSWP ); 1057cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( mhWndFrame ); 1058cdf0e10cSrcweir if ( !bVisible ) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir if ( mbFloatWin ) 1061cdf0e10cSrcweir mnShowState = SWP_SHOW; 1062cdf0e10cSrcweir else 1063cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 1064cdf0e10cSrcweir } 1065cdf0e10cSrcweir else 1066cdf0e10cSrcweir { 1067cdf0e10cSrcweir if ( (aSWP.fl & SWP_MINIMIZE) || (aSWP.fl & SWP_MAXIMIZE) ) 1068cdf0e10cSrcweir WinSetWindowPos(mhWndFrame, NULL, 0, 0, 0, 0, SWP_RESTORE ); 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir if ( (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) ) { 1072cdf0e10cSrcweir nPosFlags |= SWP_MOVE; 1073cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1074cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize MOVE to %d,%d\n", nX, nY); 1075cdf0e10cSrcweir #endif 1076cdf0e10cSrcweir //DBG_ASSERT( nX && nY, " Windowposition of (0,0) requested!" ); 1077cdf0e10cSrcweir nEvent = SALEVENT_MOVE; 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir if ( (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) ) { 1081cdf0e10cSrcweir nPosFlags |= SWP_SIZE; 1082cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1083cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize SIZE to %d,%d\n", nWidth,nHeight); 1084cdf0e10cSrcweir #endif 1085cdf0e10cSrcweir nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE; 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir // Default-Position, dann zentrieren, ansonsten Position beibehalten 1089cdf0e10cSrcweir if ( mbDefPos && !(nPosFlags & SWP_MOVE)) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir // calculate bottom left corner of frame 1092cdf0e10cSrcweir mbDefPos = FALSE; 1093cdf0e10cSrcweir nPosFlags |= SWP_MOVE | SWP_CENTER; 1094cdf0e10cSrcweir nEvent = SALEVENT_MOVERESIZE; 1095cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 10 1096cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize CENTER\n"); 1097cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize default position to %d,%d\n", nX, nY); 1098cdf0e10cSrcweir #endif 1099cdf0e10cSrcweir } 1100cdf0e10cSrcweir 1101cdf0e10cSrcweir // Adjust Window in the screen 1102cdf0e10cSrcweir BOOL bCheckOffScreen = TRUE; 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir // but don't do this for floaters or ownerdraw windows that are currently moved interactively 1105cdf0e10cSrcweir if( (mnStyle & SAL_FRAME_STYLE_FLOAT) && !(mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) 1106cdf0e10cSrcweir bCheckOffScreen = FALSE; 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir if( mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir // may be the window is currently being moved (mouse is captured), then no check is required 1111cdf0e10cSrcweir if( mhWndClient == WinQueryCapture( HWND_DESKTOP) ) 1112cdf0e10cSrcweir bCheckOffScreen = FALSE; 1113cdf0e10cSrcweir else 1114cdf0e10cSrcweir bCheckOffScreen = TRUE; 1115cdf0e10cSrcweir } 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir if( bCheckOffScreen ) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir if ( nX+nWidth > nScreenWidth ) 1120cdf0e10cSrcweir nX = nScreenWidth - nWidth; 1121cdf0e10cSrcweir if ( nY+nHeight > nScreenHeight ) 1122cdf0e10cSrcweir nY = nScreenHeight - nHeight; 1123cdf0e10cSrcweir if ( nX < 0 ) 1124cdf0e10cSrcweir nX = 0; 1125cdf0e10cSrcweir if ( nY < 0 ) 1126cdf0e10cSrcweir nY = 0; 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir // bring floating windows always to top 1130cdf0e10cSrcweir // do not change zorder, otherwise tooltips will bring main window to top (ticket:14) 1131cdf0e10cSrcweir //if( (mnStyle & SAL_FRAME_STYLE_FLOAT) ) 1132cdf0e10cSrcweir // nPosFlags |= SWP_ZORDER; // do not change z-order 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir // set new position 1135cdf0e10cSrcweir _WinSetWindowPos( this, HWND_TOP, nX, nY, nWidth, nHeight, nPosFlags); // | SWP_RESTORE 1136cdf0e10cSrcweir 1137cdf0e10cSrcweir UpdateFrameGeometry( mhWndFrame, this ); 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir // Notification -- really ??? 1140cdf0e10cSrcweir if( nEvent ) 1141cdf0e10cSrcweir CallCallback( nEvent, NULL ); 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1144cdf0e10cSrcweir dumpWindowInfo( "<Os2SalFrame::SetPosSize (exit)", mhWndFrame); 1145cdf0e10cSrcweir #endif 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir // ----------------------------------------------------------------------- 1150cdf0e10cSrcweir 1151cdf0e10cSrcweir void Os2SalFrame::SetParent( SalFrame* pNewParent ) 1152cdf0e10cSrcweir { 1153cdf0e10cSrcweir APIRET rc; 1154cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1155cdf0e10cSrcweir debug_printf("Os2SalFrame::SetParent mhWndFrame 0x%08x to 0x%08x\n", 1156cdf0e10cSrcweir static_cast<Os2SalFrame*>(this)->mhWndFrame, 1157cdf0e10cSrcweir static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); 1158cdf0e10cSrcweir #endif 1159cdf0e10cSrcweir Os2SalFrame::mbInReparent = TRUE; 1160cdf0e10cSrcweir //rc = WinSetParent(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1161cdf0e10cSrcweir // static_cast<Os2SalFrame*>(pNewParent)->mhWndClient, TRUE); 1162cdf0e10cSrcweir rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1163cdf0e10cSrcweir static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); 1164cdf0e10cSrcweir mpParentFrame = static_cast<Os2SalFrame*>(pNewParent); 1165cdf0e10cSrcweir Os2SalFrame::mbInReparent = FALSE; 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir bool Os2SalFrame::SetPluginParent( SystemParentData* pNewParent ) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir APIRET rc; 1171cdf0e10cSrcweir if ( pNewParent->hWnd == 0 ) 1172cdf0e10cSrcweir { 1173cdf0e10cSrcweir pNewParent->hWnd = HWND_DESKTOP; 1174cdf0e10cSrcweir } 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir Os2SalFrame::mbInReparent = TRUE; 1177cdf0e10cSrcweir rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1178cdf0e10cSrcweir pNewParent->hWnd); 1179cdf0e10cSrcweir Os2SalFrame::mbInReparent = FALSE; 1180cdf0e10cSrcweir return true; 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir 1184cdf0e10cSrcweir // ----------------------------------------------------------------------- 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir void Os2SalFrame::GetWorkArea( RECTL &rRect ) 1187cdf0e10cSrcweir { 1188cdf0e10cSrcweir rRect.xLeft = rRect.yTop = 0; 1189cdf0e10cSrcweir rRect.xRight = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN )-1; 1190cdf0e10cSrcweir rRect.yBottom = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN )-1; 1191cdf0e10cSrcweir } 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir // ----------------------------------------------------------------------- 1194cdf0e10cSrcweir 1195cdf0e10cSrcweir void Os2SalFrame::GetWorkArea( Rectangle &rRect ) 1196cdf0e10cSrcweir { 1197cdf0e10cSrcweir RECTL aRect; 1198cdf0e10cSrcweir GetWorkArea( aRect); 1199cdf0e10cSrcweir rRect.nLeft = aRect.xLeft; 1200cdf0e10cSrcweir rRect.nRight = aRect.xRight; // win -1; 1201cdf0e10cSrcweir rRect.nTop = aRect.yTop; 1202cdf0e10cSrcweir rRect.nBottom = aRect.yBottom; // win -1; 1203cdf0e10cSrcweir } 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir // ----------------------------------------------------------------------- 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir void Os2SalFrame::GetClientSize( long& rWidth, long& rHeight ) 1208cdf0e10cSrcweir { 1209cdf0e10cSrcweir rWidth = maGeometry.nWidth; 1210cdf0e10cSrcweir rHeight = maGeometry.nHeight; 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir // ----------------------------------------------------------------------- 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir void Os2SalFrame::SetWindowState( const SalFrameState* pState ) 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir LONG nX; 1218cdf0e10cSrcweir LONG nY; 1219cdf0e10cSrcweir LONG nWidth; 1220cdf0e10cSrcweir LONG nHeight; 1221cdf0e10cSrcweir ULONG nPosSize = 0; 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1224cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState\n"); 1225cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState %08x (%dx%d) at %d,%d VCL\n", 1226cdf0e10cSrcweir mhWndFrame, 1227cdf0e10cSrcweir pState->mnWidth,pState->mnHeight,pState->mnX,pState->mnY); 1228cdf0e10cSrcweir #endif 1229cdf0e10cSrcweir 1230cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( mhWndFrame ); 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir // get screen coordinates 1233cdf0e10cSrcweir SWP aSWP; 1234cdf0e10cSrcweir WinQueryWindowPos( mhWndFrame, &aSWP ); 1235cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 1236cdf0e10cSrcweir ImplSalCalcFrameSize( this, nFrameX, nFrameY, nCaptionY ); 1237cdf0e10cSrcweir 1238cdf0e10cSrcweir long nTopDeco = nFrameY + nCaptionY; 1239cdf0e10cSrcweir long nLeftDeco = nFrameX; 1240cdf0e10cSrcweir long nBottomDeco = nFrameY; 1241cdf0e10cSrcweir long nRightDeco = nFrameX; 1242cdf0e10cSrcweir 1243cdf0e10cSrcweir // Fenster-Position/Groesse in den Bildschirm einpassen 1244cdf0e10cSrcweir if ((pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y)) ) 1245cdf0e10cSrcweir nPosSize |= SWP_MOVE; 1246cdf0e10cSrcweir if ((pState->mnMask & (SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT)) ) 1247cdf0e10cSrcweir nPosSize |= SWP_SIZE; 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_X ) 1250cdf0e10cSrcweir nX = (int)pState->mnX - nLeftDeco; 1251cdf0e10cSrcweir else 1252cdf0e10cSrcweir nX = aSWP.x; 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir // keep Y inverted since height is still unknown, will invert later 1255cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_Y ) 1256cdf0e10cSrcweir nY = (int)pState->mnY - nTopDeco; 1257cdf0e10cSrcweir else 1258cdf0e10cSrcweir nY = nScreenHeight - (aSWP.y+aSWP.cy); 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH ) 1261cdf0e10cSrcweir nWidth = (int)pState->mnWidth + nLeftDeco + nRightDeco; 1262cdf0e10cSrcweir else 1263cdf0e10cSrcweir nWidth = aSWP.cx; 1264cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT ) 1265cdf0e10cSrcweir nHeight = (int)pState->mnHeight + nTopDeco + nBottomDeco; 1266cdf0e10cSrcweir else 1267cdf0e10cSrcweir nHeight = aSWP.cy; 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1270cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState (%dx%d) at %d,%d\n", nWidth,nHeight,nX,nY); 1271cdf0e10cSrcweir #endif 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir // Adjust Window in the screen: 1274cdf0e10cSrcweir // if it does not fit into the screen do nothing, ie default pos/size will be used 1275cdf0e10cSrcweir // if there is an overlap with the screen border move the window while keeping its size 1276cdf0e10cSrcweir 1277cdf0e10cSrcweir //if( nWidth > nScreenWidth || nHeight > nScreenHeight ) 1278cdf0e10cSrcweir // nPosSize |= (SWP_NOMOVE | SWP_NOSIZE); 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir if ( nX+nWidth > nScreenWidth ) 1281cdf0e10cSrcweir nX = (nScreenWidth) - nWidth; 1282cdf0e10cSrcweir if ( nY+nHeight > nScreenHeight ) 1283cdf0e10cSrcweir nY = (nScreenHeight) - nHeight; 1284cdf0e10cSrcweir if ( nX < 0 ) 1285cdf0e10cSrcweir nX = 0; 1286cdf0e10cSrcweir if ( nY < 0 ) 1287cdf0e10cSrcweir nY = 0; 1288cdf0e10cSrcweir 1289cdf0e10cSrcweir // Restore-Position setzen 1290cdf0e10cSrcweir SWP aPlacement; 1291cdf0e10cSrcweir WinQueryWindowPos( mhWndFrame, &aPlacement ); 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir // Status setzen 1294cdf0e10cSrcweir bVisible = WinIsWindowVisible( mhWndFrame); 1295cdf0e10cSrcweir BOOL bUpdateHiddenFramePos = FALSE; 1296cdf0e10cSrcweir if ( !bVisible ) 1297cdf0e10cSrcweir { 1298cdf0e10cSrcweir aPlacement.fl = SWP_HIDE; 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir if ( mbOverwriteState ) 1301cdf0e10cSrcweir { 1302cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) 1303cdf0e10cSrcweir { 1304cdf0e10cSrcweir if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) 1305cdf0e10cSrcweir mnShowState = SWP_SHOWMINIMIZED; 1306cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1307cdf0e10cSrcweir { 1308cdf0e10cSrcweir mnShowState = SWP_SHOWMAXIMIZED; 1309cdf0e10cSrcweir bUpdateHiddenFramePos = TRUE; 1310cdf0e10cSrcweir } 1311cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) 1312cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir } 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir else 1317cdf0e10cSrcweir { 1318cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) 1321cdf0e10cSrcweir { 1322cdf0e10cSrcweir //if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1323cdf0e10cSrcweir // aPlacement.flags |= WPF_RESTORETOMAXIMIZED; 1324cdf0e10cSrcweir aPlacement.fl = SWP_SHOWMINIMIZED; 1325cdf0e10cSrcweir } 1326cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1327cdf0e10cSrcweir aPlacement.fl = SWP_SHOWMAXIMIZED; 1328cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) 1329cdf0e10cSrcweir aPlacement.fl = SWP_RESTORE; 1330cdf0e10cSrcweir } 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch 1334cdf0e10cSrcweir // umgesetzt werden muss, dann SetWindowPos() benutzen, da 1335cdf0e10cSrcweir // SetWindowPlacement() die TaskBar mit einrechnet 1336cdf0e10cSrcweir if ( !(aPlacement.fl & SWP_MINIMIZE) 1337cdf0e10cSrcweir && !( aPlacement.fl & SWP_MAXIMIZE ) 1338cdf0e10cSrcweir && (!bVisible || (aPlacement.fl == SWP_RESTORE)) ) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir if( bUpdateHiddenFramePos ) 1341cdf0e10cSrcweir { 1342cdf0e10cSrcweir // #96084 set a useful internal window size because 1343cdf0e10cSrcweir // the window will not be maximized (and the size updated) before show() 1344cdf0e10cSrcweir SetMaximizedFrameGeometry( mhWndFrame, this ); 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir else 1347cdf0e10cSrcweir WinSetWindowPos( mhWndFrame, 0, nX, 1348cdf0e10cSrcweir nScreenHeight - (nY+nHeight), nWidth, nHeight, nPosSize); 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir else 1351cdf0e10cSrcweir { 1352cdf0e10cSrcweir if( (nPosSize & (SWP_MOVE|SWP_SIZE)) ) 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir aPlacement.x = nX; 1355cdf0e10cSrcweir aPlacement.y = nScreenHeight-(nY+nHeight); 1356cdf0e10cSrcweir aPlacement.cx = nWidth; 1357cdf0e10cSrcweir aPlacement.cy = nHeight; 1358cdf0e10cSrcweir } 1359cdf0e10cSrcweir WinSetWindowPos( mhWndFrame, 0, aPlacement.x, aPlacement.y, 1360cdf0e10cSrcweir aPlacement.cx, aPlacement.cy, aPlacement.fl ); 1361cdf0e10cSrcweir } 1362cdf0e10cSrcweir 1363cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1364cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState DONE\n"); 1365cdf0e10cSrcweir #endif 1366cdf0e10cSrcweir } 1367cdf0e10cSrcweir 1368cdf0e10cSrcweir // ----------------------------------------------------------------------- 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir BOOL Os2SalFrame::GetWindowState( SalFrameState* pState ) 1371cdf0e10cSrcweir { 1372cdf0e10cSrcweir if ( maState.mnWidth && maState.mnHeight ) 1373cdf0e10cSrcweir { 1374cdf0e10cSrcweir *pState = maState; 1375cdf0e10cSrcweir // #94144# allow Minimize again, should be masked out when read from configuration 1376cdf0e10cSrcweir // 91625 - Don't save minimize 1377cdf0e10cSrcweir //if ( !(pState->mnState & SAL_FRAMESTATE_MAXIMIZED) ) 1378cdf0e10cSrcweir if ( !(pState->mnState & (SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED)) ) 1379cdf0e10cSrcweir pState->mnState |= SAL_FRAMESTATE_NORMAL; 1380cdf0e10cSrcweir return TRUE; 1381cdf0e10cSrcweir } 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir return FALSE; 1384cdf0e10cSrcweir } 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir // ----------------------------------------------------------------------- 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir void Os2SalFrame::SetScreenNumber( unsigned int nNewScreen ) 1389cdf0e10cSrcweir { 1390cdf0e10cSrcweir #if 0 1391cdf0e10cSrcweir WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); 1392cdf0e10cSrcweir if( pSys ) 1393cdf0e10cSrcweir { 1394cdf0e10cSrcweir const std::vector<WinSalSystem::DisplayMonitor>& rMonitors = 1395cdf0e10cSrcweir pSys->getMonitors(); 1396cdf0e10cSrcweir size_t nMon = rMonitors.size(); 1397cdf0e10cSrcweir if( nNewScreen < nMon ) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); 1400cdf0e10cSrcweir Point aCurPos( maGeometry.nX, maGeometry.nY ); 1401cdf0e10cSrcweir for( size_t i = 0; i < nMon; i++ ) 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir if( rMonitors[i].m_aArea.IsInside( aCurPos ) ) 1404cdf0e10cSrcweir { 1405cdf0e10cSrcweir aOldMonPos = rMonitors[i].m_aArea.TopLeft(); 1406cdf0e10cSrcweir break; 1407cdf0e10cSrcweir } 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir mnDisplay = nNewScreen; 1410cdf0e10cSrcweir maGeometry.nScreenNumber = nNewScreen; 1411cdf0e10cSrcweir SetPosSize( aNewMonPos.X() + (maGeometry.nX - aOldMonPos.X()), 1412cdf0e10cSrcweir aNewMonPos.Y() + (maGeometry.nY - aOldMonPos.Y()), 1413cdf0e10cSrcweir 0, 0, 1414cdf0e10cSrcweir SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); 1415cdf0e10cSrcweir } 1416cdf0e10cSrcweir } 1417cdf0e10cSrcweir #endif 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir // ----------------------------------------------------------------------- 1421cdf0e10cSrcweir 1422cdf0e10cSrcweir // native menu implementation - currently empty 1423cdf0e10cSrcweir void Os2SalFrame::DrawMenuBar() 1424cdf0e10cSrcweir { 1425cdf0e10cSrcweir } 1426cdf0e10cSrcweir 1427cdf0e10cSrcweir void Os2SalFrame::SetMenu( SalMenu* pSalMenu ) 1428cdf0e10cSrcweir { 1429cdf0e10cSrcweir } 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir // ----------------------------------------------------------------------- 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir void Os2SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) 1434cdf0e10cSrcweir { 1435cdf0e10cSrcweir if ( mbFullScreen == bFullScreen ) 1436cdf0e10cSrcweir return; 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir mbFullScreen = bFullScreen; 1439cdf0e10cSrcweir if ( bFullScreen ) 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir // save old position 1442cdf0e10cSrcweir memset( &maFullScreenRect, 0, sizeof( SWP ) ); 1443cdf0e10cSrcweir _WinQueryWindowPos( this, &maFullScreenRect ); 1444cdf0e10cSrcweir 1445cdf0e10cSrcweir // set window to screen size 1446cdf0e10cSrcweir ImplSalFrameFullScreenPos( this, TRUE ); 1447cdf0e10cSrcweir } 1448cdf0e10cSrcweir else 1449cdf0e10cSrcweir { 1450cdf0e10cSrcweir _WinSetWindowPos( this, 1451cdf0e10cSrcweir 0, 1452cdf0e10cSrcweir maFullScreenRect.x, maFullScreenRect.y, 1453cdf0e10cSrcweir maFullScreenRect.cx, maFullScreenRect.cy, 1454cdf0e10cSrcweir SWP_MOVE | SWP_SIZE ); 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir } 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir // ----------------------------------------------------------------------- 1459cdf0e10cSrcweir 1460cdf0e10cSrcweir void Os2SalFrame::StartPresentation( BOOL bStart ) 1461cdf0e10cSrcweir { 1462cdf0e10cSrcweir // SysSetObjectData("<WP_DESKTOP>","Autolockup=no"); oder OS2.INI: PM_Lockup 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir // ----------------------------------------------------------------------- 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop ) 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir mbAllwayOnTop = bOnTop; 1470cdf0e10cSrcweir #if 0 1471cdf0e10cSrcweir HWND hWnd; 1472cdf0e10cSrcweir if ( bOnTop ) 1473cdf0e10cSrcweir hWnd = HWND_TOPMOST; 1474cdf0e10cSrcweir else 1475cdf0e10cSrcweir hWnd = HWND_NOTOPMOST; 1476cdf0e10cSrcweir SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); 1477cdf0e10cSrcweir #endif 1478cdf0e10cSrcweir } 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir 1481cdf0e10cSrcweir // ----------------------------------------------------------------------- 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir static void ImplSalToTop( HWND hWnd, ULONG nFlags ) 1484cdf0e10cSrcweir { 1485cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 1486cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1487cdf0e10cSrcweir debug_printf("ImplSalToTop hWnd %08x, nFlags %x\n", hWnd, nFlags); 1488cdf0e10cSrcweir #endif 1489cdf0e10cSrcweir 1490cdf0e10cSrcweir // if window is minimized, first restore it 1491cdf0e10cSrcweir SWP aSWP; 1492cdf0e10cSrcweir WinQueryWindowPos( hWnd, &aSWP ); 1493cdf0e10cSrcweir if ( aSWP.fl & SWP_MINIMIZE ) 1494cdf0e10cSrcweir WinSetWindowPos( hWnd, NULL, 0, 0, 0, 0, SWP_RESTORE ); 1495cdf0e10cSrcweir 1496cdf0e10cSrcweir if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) 1497cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); 1498cdf0e10cSrcweir 1499cdf0e10cSrcweir if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) 1500cdf0e10cSrcweir { 1501cdf0e10cSrcweir ULONG nStyle; 1502cdf0e10cSrcweir if ( pFrame->mbRestoreMaximize ) 1503cdf0e10cSrcweir nStyle = SWP_MAXIMIZE; 1504cdf0e10cSrcweir else 1505cdf0e10cSrcweir nStyle = SWP_RESTORE; 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, NULL, 0, 0, 0, 0, nStyle ); 1508cdf0e10cSrcweir } 1509cdf0e10cSrcweir WinSetFocus( HWND_DESKTOP, pFrame->mhWndClient ); 1510cdf0e10cSrcweir } 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir // ----------------------------------------------------------------------- 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir void Os2SalFrame::ToTop( USHORT nFlags ) 1515cdf0e10cSrcweir { 1516cdf0e10cSrcweir nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32 1517cdf0e10cSrcweir // Post this Message to the window, because this only works 1518cdf0e10cSrcweir // in the thread of the window, which has create this window. 1519cdf0e10cSrcweir // We post this message to avoid deadlocks 1520cdf0e10cSrcweir if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) 1521cdf0e10cSrcweir WinPostMsg( mhWndFrame, SAL_MSG_TOTOP, (MPARAM)nFlags, 0 ); 1522cdf0e10cSrcweir else 1523cdf0e10cSrcweir ImplSalToTop( mhWndFrame, nFlags ); 1524cdf0e10cSrcweir } 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir // ----------------------------------------------------------------------- 1527cdf0e10cSrcweir 1528cdf0e10cSrcweir void Os2SalFrame::SetPointer( PointerStyle ePointerStyle ) 1529cdf0e10cSrcweir { 1530cdf0e10cSrcweir struct ImplPtrData 1531cdf0e10cSrcweir { 1532cdf0e10cSrcweir HPOINTER mhPointer; 1533cdf0e10cSrcweir ULONG mnSysId; 1534cdf0e10cSrcweir ULONG mnOwnId; 1535cdf0e10cSrcweir }; 1536cdf0e10cSrcweir 1537cdf0e10cSrcweir static ImplPtrData aImplPtrTab[POINTER_COUNT] = 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir { 0, SPTR_ARROW, 0 }, // POINTER_ARROW 1540cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL 1541cdf0e10cSrcweir { 0, SPTR_WAIT, 0 }, // POINTER_WAIT 1542cdf0e10cSrcweir { 0, SPTR_TEXT, 0 }, // POINTER_BEAM 1543cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP 1544cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS 1545cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE 1546cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_NSIZE 1547cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_SSIZE 1548cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WSIZE 1549cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_ESIZE 1550cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_NWSIZE 1551cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_NESIZE 1552cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_SWSIZE 1553cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_SESIZE 1554cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_NSIZE 1555cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_SSIZE 1556cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE 1557cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE 1558cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE 1559cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE 1560cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE 1561cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE 1562cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT 1563cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT 1564cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR 1565cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR 1566cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND 1567cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND 1568cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN 1569cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY 1570cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL 1571cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE 1572cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR 1573cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR 1574cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR 1575cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK 1576cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP 1577cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT 1578cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT 1579cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA 1580cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA 1581cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA 1582cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK 1583cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK 1584cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE 1585cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE 1586cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE 1587cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK 1588cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK 1589cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES 1590cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES 1591cdf0e10cSrcweir { 0, SPTR_ILLEGAL, 0 }, // POINTER_NOTALLOWED 1592cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE 1593cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT 1594cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON 1595cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER 1596cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC 1597cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE 1598cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT 1599cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE 1600cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND 1601cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT 1602cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT 1603cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION 1604cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART 1605cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE 1606cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL 1607cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW 1608cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD 1609cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN 1610cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED 1611cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE 1612cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE 1613cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N 1614cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S 1615cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W 1616cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E 1617cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW 1618cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE 1619cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW 1620cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE 1621cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS 1622cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE 1623cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE 1624cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH 1625cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL 1626cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE 1627cdf0e10cSrcweir 1628cdf0e10cSrcweir // --> FME 2004-07-30 #i32329# Enhanced table selection 1629cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S 1630cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E 1631cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE 1632cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W 1633cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW 1634cdf0e10cSrcweir // <-- 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir // --> FME 2004-08-16 #i20119# Paintbrush tool 1637cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH 1638cdf0e10cSrcweir // <-- 1639cdf0e10cSrcweir }; 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir #if POINTER_COUNT != 94 1642cdf0e10cSrcweir #error New Pointer must be defined! 1643cdf0e10cSrcweir #endif 1644cdf0e10cSrcweir 1645cdf0e10cSrcweir //debug_printf("Os2SalFrame::SetPointer\n"); 1646cdf0e10cSrcweir 1647cdf0e10cSrcweir // Mousepointer loaded ? 1648cdf0e10cSrcweir if ( !aImplPtrTab[ePointerStyle].mhPointer ) 1649cdf0e10cSrcweir { 1650cdf0e10cSrcweir if ( aImplPtrTab[ePointerStyle].mnOwnId ) 1651cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = ImplLoadSalCursor( (ULONG)aImplPtrTab[ePointerStyle].mnOwnId ); 1652cdf0e10cSrcweir else 1653cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = WinQuerySysPointer( HWND_DESKTOP, aImplPtrTab[ePointerStyle].mnSysId, FALSE ); 1654cdf0e10cSrcweir } 1655cdf0e10cSrcweir if (aImplPtrTab[ePointerStyle].mhPointer == 0) { 1656cdf0e10cSrcweir debug_printf( "SetPointer ePointerStyle %d unknown\n", ePointerStyle); 1657cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = SPTR_ICONERROR; 1658cdf0e10cSrcweir } 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir // Unterscheidet sich der Mauspointer, dann den neuen setzen 1661cdf0e10cSrcweir if ( mhPointer != aImplPtrTab[ePointerStyle].mhPointer ) 1662cdf0e10cSrcweir { 1663cdf0e10cSrcweir mhPointer = aImplPtrTab[ePointerStyle].mhPointer; 1664cdf0e10cSrcweir WinSetPointer( HWND_DESKTOP, mhPointer ); 1665cdf0e10cSrcweir } 1666cdf0e10cSrcweir } 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir // ----------------------------------------------------------------------- 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir void Os2SalFrame::CaptureMouse( BOOL bCapture ) 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 1673cdf0e10cSrcweir _bCapture=bCapture; 1674cdf0e10cSrcweir debug_printf("Os2SalFrame::CaptureMouse bCapture %d\n", bCapture); 1675cdf0e10cSrcweir #endif 1676cdf0e10cSrcweir if ( bCapture ) 1677cdf0e10cSrcweir WinSetCapture( HWND_DESKTOP, mhWndClient ); 1678cdf0e10cSrcweir else 1679cdf0e10cSrcweir WinSetCapture( HWND_DESKTOP, 0 ); 1680cdf0e10cSrcweir } 1681cdf0e10cSrcweir 1682cdf0e10cSrcweir // ----------------------------------------------------------------------- 1683cdf0e10cSrcweir 1684cdf0e10cSrcweir void Os2SalFrame::SetPointerPos( long nX, long nY ) 1685cdf0e10cSrcweir { 1686cdf0e10cSrcweir POINTL aPt; 1687cdf0e10cSrcweir aPt.x = nX; 1688cdf0e10cSrcweir aPt.y = mnHeight - nY - 1; // convert sal coords to sys 1689cdf0e10cSrcweir WinMapWindowPoints( mhWndClient, HWND_DESKTOP, &aPt, 1 ); 1690cdf0e10cSrcweir WinSetPointerPos( HWND_DESKTOP, aPt.x, aPt.y ); 1691cdf0e10cSrcweir } 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir // ----------------------------------------------------------------------- 1694cdf0e10cSrcweir 1695cdf0e10cSrcweir void Os2SalFrame::Flush() 1696cdf0e10cSrcweir { 1697cdf0e10cSrcweir } 1698cdf0e10cSrcweir 1699cdf0e10cSrcweir // ----------------------------------------------------------------------- 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir void Os2SalFrame::Sync() 1702cdf0e10cSrcweir { 1703cdf0e10cSrcweir } 1704cdf0e10cSrcweir 1705cdf0e10cSrcweir // ----------------------------------------------------------------------- 1706cdf0e10cSrcweir 1707cdf0e10cSrcweir void Os2SalFrame::SetInputContext( SalInputContext* pContext ) 1708cdf0e10cSrcweir { 1709cdf0e10cSrcweir #ifdef ENABLE_IME 1710cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 1711cdf0e10cSrcweir if ( pIMEData ) 1712cdf0e10cSrcweir { 1713cdf0e10cSrcweir HWND hWnd = mhWndClient; 1714cdf0e10cSrcweir HIMI hIMI = 0; 1715cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 1716cdf0e10cSrcweir if ( hIMI ) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir ULONG nInputMode; 1719cdf0e10cSrcweir ULONG nConversionMode; 1720cdf0e10cSrcweir if ( 0 == pIMEData->mpQueryIMEMode( hIMI, &nInputMode, &nConversionMode ) ) 1721cdf0e10cSrcweir { 1722cdf0e10cSrcweir if ( pContext->mnOptions & SAL_INPUTCONTEXT_TEXT ) 1723cdf0e10cSrcweir { 1724cdf0e10cSrcweir nInputMode &= ~IMI_IM_IME_DISABLE; 1725cdf0e10cSrcweir if ( pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ) 1726cdf0e10cSrcweir nInputMode &= ~IMI_IM_IME_ON; 1727cdf0e10cSrcweir // !!! Da derzeit ueber das OS2-IME-UI der IME-Mode nicht einschaltbar ist !!! 1728cdf0e10cSrcweir // if ( SAL_INPUTCONTEXT_EXTTEXTINPUT_ON ) 1729cdf0e10cSrcweir nInputMode |= IMI_IM_IME_ON; 1730cdf0e10cSrcweir } 1731cdf0e10cSrcweir else 1732cdf0e10cSrcweir nInputMode |= IMI_IM_IME_DISABLE; 1733cdf0e10cSrcweir pIMEData->mpSetIMEMode( hIMI, nInputMode, nConversionMode ); 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 1737cdf0e10cSrcweir } 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir #endif 1740cdf0e10cSrcweir } 1741cdf0e10cSrcweir 1742cdf0e10cSrcweir // ----------------------------------------------------------------------- 1743cdf0e10cSrcweir #if 0 1744cdf0e10cSrcweir void Os2SalFrame::UpdateExtTextInputArea() 1745cdf0e10cSrcweir { 1746cdf0e10cSrcweir #ifdef ENABLE_IME 1747cdf0e10cSrcweir #endif 1748cdf0e10cSrcweir } 1749cdf0e10cSrcweir #endif 1750cdf0e10cSrcweir 1751cdf0e10cSrcweir // ----------------------------------------------------------------------- 1752cdf0e10cSrcweir 1753cdf0e10cSrcweir void Os2SalFrame::EndExtTextInput( USHORT nFlags ) 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir #ifdef ENABLE_IME 1756cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 1757cdf0e10cSrcweir if ( pIMEData ) 1758cdf0e10cSrcweir { 1759cdf0e10cSrcweir HWND hWnd = mhWndClient; 1760cdf0e10cSrcweir HIMI hIMI = 0; 1761cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 1762cdf0e10cSrcweir if ( hIMI ) 1763cdf0e10cSrcweir { 1764cdf0e10cSrcweir ULONG nIndex; 1765cdf0e10cSrcweir if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE ) 1766cdf0e10cSrcweir nIndex = CNV_COMPLETE; 1767cdf0e10cSrcweir else 1768cdf0e10cSrcweir nIndex = CNV_CANCEL; 1769cdf0e10cSrcweir 1770cdf0e10cSrcweir pIMEData->mpRequestIME( hIMI, REQ_CONVERSIONSTRING, nIndex, 0 ); 1771cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 1772cdf0e10cSrcweir } 1773cdf0e10cSrcweir } 1774cdf0e10cSrcweir #endif 1775cdf0e10cSrcweir } 1776cdf0e10cSrcweir 1777cdf0e10cSrcweir // ----------------------------------------------------------------------- 1778cdf0e10cSrcweir 1779cdf0e10cSrcweir XubString Os2SalFrame::GetKeyName( USHORT nCode ) 1780cdf0e10cSrcweir { 1781cdf0e10cSrcweir if ( eImplKeyboardLanguage == LANGUAGE_DONTKNOW ) 1782cdf0e10cSrcweir eImplKeyboardLanguage = MsLangId::getSystemLanguage(); 1783cdf0e10cSrcweir 1784cdf0e10cSrcweir XubString aKeyCode; 1785cdf0e10cSrcweir XubString aCode; 1786cdf0e10cSrcweir const sal_Unicode** pLangTab = ImplGetLangTab( eImplKeyboardLanguage ); 1787cdf0e10cSrcweir 1788cdf0e10cSrcweir if ( nCode & KEY_SHIFT ) 1789cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_SHIFT]; 1790cdf0e10cSrcweir 1791cdf0e10cSrcweir if ( nCode & KEY_MOD1 ) 1792cdf0e10cSrcweir { 1793cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1794cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_CTRL]; 1795cdf0e10cSrcweir else 1796cdf0e10cSrcweir { 1797cdf0e10cSrcweir aKeyCode += '+'; 1798cdf0e10cSrcweir aKeyCode += pLangTab[LSTR_KEY_CTRL]; 1799cdf0e10cSrcweir } 1800cdf0e10cSrcweir } 1801cdf0e10cSrcweir 1802cdf0e10cSrcweir if ( nCode & KEY_MOD2 ) 1803cdf0e10cSrcweir { 1804cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1805cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_ALT]; 1806cdf0e10cSrcweir else 1807cdf0e10cSrcweir { 1808cdf0e10cSrcweir aKeyCode += '+'; 1809cdf0e10cSrcweir aKeyCode += pLangTab[LSTR_KEY_ALT]; 1810cdf0e10cSrcweir } 1811cdf0e10cSrcweir } 1812cdf0e10cSrcweir 1813cdf0e10cSrcweir USHORT nKeyCode = nCode & 0x0FFF; 1814cdf0e10cSrcweir if ( (nKeyCode >= KEY_0) && (nKeyCode <= KEY_9) ) 1815cdf0e10cSrcweir aCode = sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_0)); 1816cdf0e10cSrcweir else if ( (nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z) ) 1817cdf0e10cSrcweir aCode = sal::static_int_cast<sal_Char>('A' + (nKeyCode - KEY_A)); 1818cdf0e10cSrcweir else if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F26) ) 1819cdf0e10cSrcweir { 1820cdf0e10cSrcweir aCode += 'F'; 1821cdf0e10cSrcweir if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F9) ) 1822cdf0e10cSrcweir { 1823cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('1' + (nKeyCode - KEY_F1)); 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir else if ( (nKeyCode >= KEY_F10) && (nKeyCode <= KEY_F19) ) 1826cdf0e10cSrcweir { 1827cdf0e10cSrcweir aCode += '1'; 1828cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F10)); 1829cdf0e10cSrcweir } 1830cdf0e10cSrcweir else 1831cdf0e10cSrcweir { 1832cdf0e10cSrcweir aCode += '2'; 1833cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F20)); 1834cdf0e10cSrcweir } 1835cdf0e10cSrcweir } 1836cdf0e10cSrcweir else 1837cdf0e10cSrcweir { 1838cdf0e10cSrcweir switch ( nKeyCode ) 1839cdf0e10cSrcweir { 1840cdf0e10cSrcweir case KEY_DOWN: 1841cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_DOWN]; 1842cdf0e10cSrcweir break; 1843cdf0e10cSrcweir case KEY_UP: 1844cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_UP]; 1845cdf0e10cSrcweir break; 1846cdf0e10cSrcweir case KEY_LEFT: 1847cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_LEFT]; 1848cdf0e10cSrcweir break; 1849cdf0e10cSrcweir case KEY_RIGHT: 1850cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_RIGHT]; 1851cdf0e10cSrcweir break; 1852cdf0e10cSrcweir case KEY_HOME: 1853cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_HOME]; 1854cdf0e10cSrcweir break; 1855cdf0e10cSrcweir case KEY_END: 1856cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_END]; 1857cdf0e10cSrcweir break; 1858cdf0e10cSrcweir case KEY_PAGEUP: 1859cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_PAGEUP]; 1860cdf0e10cSrcweir break; 1861cdf0e10cSrcweir case KEY_PAGEDOWN: 1862cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_PAGEDOWN]; 1863cdf0e10cSrcweir break; 1864cdf0e10cSrcweir case KEY_RETURN: 1865cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_RETURN]; 1866cdf0e10cSrcweir break; 1867cdf0e10cSrcweir case KEY_ESCAPE: 1868cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_ESC]; 1869cdf0e10cSrcweir break; 1870cdf0e10cSrcweir case KEY_TAB: 1871cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_TAB]; 1872cdf0e10cSrcweir break; 1873cdf0e10cSrcweir case KEY_BACKSPACE: 1874cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_BACKSPACE]; 1875cdf0e10cSrcweir break; 1876cdf0e10cSrcweir case KEY_SPACE: 1877cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_SPACE]; 1878cdf0e10cSrcweir break; 1879cdf0e10cSrcweir case KEY_INSERT: 1880cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_INSERT]; 1881cdf0e10cSrcweir break; 1882cdf0e10cSrcweir case KEY_DELETE: 1883cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_DELETE]; 1884cdf0e10cSrcweir break; 1885cdf0e10cSrcweir 1886cdf0e10cSrcweir case KEY_ADD: 1887cdf0e10cSrcweir aCode += '+'; 1888cdf0e10cSrcweir break; 1889cdf0e10cSrcweir case KEY_SUBTRACT: 1890cdf0e10cSrcweir aCode += '-'; 1891cdf0e10cSrcweir break; 1892cdf0e10cSrcweir case KEY_MULTIPLY: 1893cdf0e10cSrcweir aCode += '*'; 1894cdf0e10cSrcweir break; 1895cdf0e10cSrcweir case KEY_DIVIDE: 1896cdf0e10cSrcweir aCode += '/'; 1897cdf0e10cSrcweir break; 1898cdf0e10cSrcweir case KEY_POINT: 1899cdf0e10cSrcweir aCode += '.'; 1900cdf0e10cSrcweir break; 1901cdf0e10cSrcweir case KEY_COMMA: 1902cdf0e10cSrcweir aCode += ','; 1903cdf0e10cSrcweir break; 1904cdf0e10cSrcweir case KEY_LESS: 1905cdf0e10cSrcweir aCode += '<'; 1906cdf0e10cSrcweir break; 1907cdf0e10cSrcweir case KEY_GREATER: 1908cdf0e10cSrcweir aCode += '>'; 1909cdf0e10cSrcweir break; 1910cdf0e10cSrcweir case KEY_EQUAL: 1911cdf0e10cSrcweir aCode += '='; 1912cdf0e10cSrcweir break; 1913cdf0e10cSrcweir } 1914cdf0e10cSrcweir } 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir if ( aCode.Len() ) 1917cdf0e10cSrcweir { 1918cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1919cdf0e10cSrcweir aKeyCode = aCode; 1920cdf0e10cSrcweir else 1921cdf0e10cSrcweir { 1922cdf0e10cSrcweir aKeyCode += '+'; 1923cdf0e10cSrcweir aKeyCode += aCode; 1924cdf0e10cSrcweir } 1925cdf0e10cSrcweir } 1926cdf0e10cSrcweir 1927cdf0e10cSrcweir return aKeyCode; 1928cdf0e10cSrcweir } 1929cdf0e10cSrcweir 1930cdf0e10cSrcweir // ----------------------------------------------------------------------- 1931cdf0e10cSrcweir 1932cdf0e10cSrcweir XubString Os2SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir return GetKeyName( nKeyCode ); 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir 1937cdf0e10cSrcweir // ----------------------------------------------------------------------- 1938cdf0e10cSrcweir 1939cdf0e10cSrcweir inline long ImplOS2ColorToSal( long nOS2Color ) 1940cdf0e10cSrcweir { 1941cdf0e10cSrcweir return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color ); 1942cdf0e10cSrcweir } 1943cdf0e10cSrcweir 1944cdf0e10cSrcweir // ----------------------------------------------------------------------- 1945cdf0e10cSrcweir 1946cdf0e10cSrcweir static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown ) 1947cdf0e10cSrcweir { 1948cdf0e10cSrcweir LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue ); 1949cdf0e10cSrcweir 1950cdf0e10cSrcweir rCode = 0; 1951cdf0e10cSrcweir rClicks = 1; 1952cdf0e10cSrcweir rDown = TRUE; 1953cdf0e10cSrcweir 1954cdf0e10cSrcweir switch ( lValue & 0xFFFF ) 1955cdf0e10cSrcweir { 1956cdf0e10cSrcweir case WM_BUTTON1UP: 1957cdf0e10cSrcweir case WM_BUTTON1CLICK: 1958cdf0e10cSrcweir rCode = MOUSE_LEFT; 1959cdf0e10cSrcweir rDown = FALSE; 1960cdf0e10cSrcweir break; 1961cdf0e10cSrcweir case WM_BUTTON1DOWN: 1962cdf0e10cSrcweir case WM_BUTTON1MOTIONSTART: 1963cdf0e10cSrcweir rCode = MOUSE_LEFT; 1964cdf0e10cSrcweir break; 1965cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 1966cdf0e10cSrcweir rCode = MOUSE_LEFT; 1967cdf0e10cSrcweir rClicks = 2; 1968cdf0e10cSrcweir break; 1969cdf0e10cSrcweir 1970cdf0e10cSrcweir case WM_BUTTON2UP: 1971cdf0e10cSrcweir case WM_BUTTON2CLICK: 1972cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1973cdf0e10cSrcweir rDown = FALSE; 1974cdf0e10cSrcweir break; 1975cdf0e10cSrcweir case WM_BUTTON2DOWN: 1976cdf0e10cSrcweir case WM_BUTTON2MOTIONSTART: 1977cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1978cdf0e10cSrcweir break; 1979cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 1980cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1981cdf0e10cSrcweir rClicks = 2; 1982cdf0e10cSrcweir break; 1983cdf0e10cSrcweir 1984cdf0e10cSrcweir case WM_BUTTON3UP: 1985cdf0e10cSrcweir case WM_BUTTON3CLICK: 1986cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1987cdf0e10cSrcweir rDown = FALSE; 1988cdf0e10cSrcweir break; 1989cdf0e10cSrcweir case WM_BUTTON3DOWN: 1990cdf0e10cSrcweir case WM_BUTTON3MOTIONSTART: 1991cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1992cdf0e10cSrcweir break; 1993cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 1994cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1995cdf0e10cSrcweir rClicks = 2; 1996cdf0e10cSrcweir break; 1997cdf0e10cSrcweir } 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir if ( !rCode ) 2000cdf0e10cSrcweir return FALSE; 2001cdf0e10cSrcweir 2002cdf0e10cSrcweir lValue = (lValue & 0xFFFF0000) >> 16; 2003cdf0e10cSrcweir if ( lValue != 0xFFFF ) 2004cdf0e10cSrcweir { 2005cdf0e10cSrcweir if ( lValue & KC_SHIFT ) 2006cdf0e10cSrcweir rCode |= KEY_SHIFT; 2007cdf0e10cSrcweir if ( lValue & KC_CTRL ) 2008cdf0e10cSrcweir rCode |= KEY_MOD1; 2009cdf0e10cSrcweir if ( lValue & KC_ALT ) 2010cdf0e10cSrcweir rCode |= KEY_MOD2; 2011cdf0e10cSrcweir } 2012cdf0e10cSrcweir 2013cdf0e10cSrcweir return TRUE; 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir // ----------------------------------------------------------------------- 2017cdf0e10cSrcweir 2018cdf0e10cSrcweir static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 ) 2019cdf0e10cSrcweir { 2020cdf0e10cSrcweir ULONG nWrong = 0; 2021cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() ); 2022cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetGreen()-(short)rColor2.GetGreen() ); 2023cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetBlue()-(short)rColor2.GetBlue() ); 2024cdf0e10cSrcweir return (nWrong < 30); 2025cdf0e10cSrcweir } 2026cdf0e10cSrcweir 2027cdf0e10cSrcweir // ----------------------------------------------------------------------- 2028cdf0e10cSrcweir 2029cdf0e10cSrcweir static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont ) 2030cdf0e10cSrcweir { 2031cdf0e10cSrcweir char aNumBuf[10]; 2032cdf0e10cSrcweir int nNumBufLen = 0; 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir while ( *pFontName && (*pFontName != '.') && 2035cdf0e10cSrcweir (nNumBufLen < sizeof(aNumBuf)-1) ) 2036cdf0e10cSrcweir { 2037cdf0e10cSrcweir aNumBuf[nNumBufLen] = *pFontName; 2038cdf0e10cSrcweir nNumBufLen++; 2039cdf0e10cSrcweir pFontName++; 2040cdf0e10cSrcweir } 2041cdf0e10cSrcweir aNumBuf[nNumBufLen] = '\0'; 2042cdf0e10cSrcweir 2043cdf0e10cSrcweir pFontName++; 2044cdf0e10cSrcweir while ( *pFontName == ' ' ) 2045cdf0e10cSrcweir pFontName++; 2046cdf0e10cSrcweir 2047cdf0e10cSrcweir int nFontHeight = atoi( aNumBuf ); 2048cdf0e10cSrcweir int nFontNameLen = strlen( pFontName ); 2049cdf0e10cSrcweir if ( nFontHeight && nFontNameLen ) 2050cdf0e10cSrcweir { 2051cdf0e10cSrcweir rFont.SetFamily( FAMILY_DONTKNOW ); 2052cdf0e10cSrcweir rFont.SetWeight( WEIGHT_NORMAL ); 2053cdf0e10cSrcweir rFont.SetItalic( ITALIC_NONE ); 2054cdf0e10cSrcweir // search for a style embedded in the name, e.g. 'WarpSans Bold' 2055cdf0e10cSrcweir // because we need to split the style from the family name 2056cdf0e10cSrcweir if (strstr( pFontName, " Bold") 2057cdf0e10cSrcweir || strstr( pFontName, " Italic") 2058cdf0e10cSrcweir || strstr( pFontName, "-Normal")) 2059cdf0e10cSrcweir { 2060cdf0e10cSrcweir char* fontName = strdup( pFontName); 2061cdf0e10cSrcweir char* style = strstr( fontName, " Bold"); 2062cdf0e10cSrcweir if (style) 2063cdf0e10cSrcweir rFont.SetWeight( WEIGHT_BOLD ); 2064cdf0e10cSrcweir 2065cdf0e10cSrcweir if (!style) 2066cdf0e10cSrcweir style = strstr( fontName, " Italic"); 2067cdf0e10cSrcweir if (style) 2068cdf0e10cSrcweir rFont.SetItalic( ITALIC_NORMAL ); 2069cdf0e10cSrcweir 2070cdf0e10cSrcweir if (!style) 2071cdf0e10cSrcweir style = strstr( fontName, "-Normal"); 2072cdf0e10cSrcweir // store style, skip whitespace char 2073cdf0e10cSrcweir rFont.SetStyleName( ::rtl::OStringToOUString ( style+1, gsl_getSystemTextEncoding()) ); 2074cdf0e10cSrcweir // truncate name 2075cdf0e10cSrcweir *style = 0; 2076cdf0e10cSrcweir // store family name 2077cdf0e10cSrcweir rFont.SetName( ::rtl::OStringToOUString ( fontName, gsl_getSystemTextEncoding()) ); 2078cdf0e10cSrcweir free( fontName); 2079cdf0e10cSrcweir } 2080cdf0e10cSrcweir else 2081cdf0e10cSrcweir { 2082cdf0e10cSrcweir rFont.SetName( ::rtl::OStringToOUString (pFontName, gsl_getSystemTextEncoding()) ); 2083cdf0e10cSrcweir rFont.SetStyleName( ::rtl::OStringToOUString ("", gsl_getSystemTextEncoding()) ); 2084cdf0e10cSrcweir } 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir rFont.SetSize( Size( 0, nFontHeight ) ); 2087cdf0e10cSrcweir return TRUE; 2088cdf0e10cSrcweir } 2089cdf0e10cSrcweir else 2090cdf0e10cSrcweir return FALSE; 2091cdf0e10cSrcweir } 2092cdf0e10cSrcweir 2093cdf0e10cSrcweir // ----------------------------------------------------------------------- 2094cdf0e10cSrcweir 2095cdf0e10cSrcweir void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) 2096cdf0e10cSrcweir { 2097cdf0e10cSrcweir static char aControlPanel[] = "PM_ControlPanel"; 2098cdf0e10cSrcweir static char aSystemFonts[] = "PM_SystemFonts"; 2099cdf0e10cSrcweir char aDummyStr[] = ""; 2100cdf0e10cSrcweir 2101cdf0e10cSrcweir // --- Mouse setting --- 2102cdf0e10cSrcweir USHORT nCode; 2103cdf0e10cSrcweir USHORT nClicks; 2104cdf0e10cSrcweir BOOL bDown; 2105cdf0e10cSrcweir MouseSettings aMouseSettings = rSettings.GetMouseSettings(); 2106cdf0e10cSrcweir aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) ); 2107cdf0e10cSrcweir if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) ) 2108cdf0e10cSrcweir aMouseSettings.SetStartDragCode( nCode ); 2109cdf0e10cSrcweir if ( ImplMouseSysValueToSAL( SV_CONTEXTMENU, nCode, nClicks, bDown ) ) 2110cdf0e10cSrcweir { 2111cdf0e10cSrcweir aMouseSettings.SetContextMenuCode( nCode ); 2112cdf0e10cSrcweir aMouseSettings.SetContextMenuClicks( nClicks ); 2113cdf0e10cSrcweir aMouseSettings.SetContextMenuDown( bDown ); 2114cdf0e10cSrcweir } 2115cdf0e10cSrcweir aMouseSettings.SetButtonStartRepeat( WinQuerySysValue( HWND_DESKTOP, SV_FIRSTSCROLLRATE ) ); 2116cdf0e10cSrcweir aMouseSettings.SetButtonRepeat( WinQuerySysValue( HWND_DESKTOP, SV_SCROLLRATE ) ); 2117cdf0e10cSrcweir rSettings.SetMouseSettings( aMouseSettings ); 2118cdf0e10cSrcweir 2119cdf0e10cSrcweir // --- Style settings --- 2120cdf0e10cSrcweir StyleSettings aStyleSettings = rSettings.GetStyleSettings(); 2121cdf0e10cSrcweir // General settings 2122cdf0e10cSrcweir LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 ); 2123cdf0e10cSrcweir ULONG nSalDisplayTime; 2124cdf0e10cSrcweir if ( nDisplayTime < 0 ) 2125cdf0e10cSrcweir nSalDisplayTime = LOGO_DISPLAYTIME_STARTTIME; 2126cdf0e10cSrcweir else if ( !nDisplayTime ) 2127cdf0e10cSrcweir nSalDisplayTime = LOGO_DISPLAYTIME_NOLOGO; 2128cdf0e10cSrcweir else 2129cdf0e10cSrcweir nSalDisplayTime = (ULONG)nDisplayTime; 2130cdf0e10cSrcweir aStyleSettings.SetLogoDisplayTime( nSalDisplayTime ); 2131cdf0e10cSrcweir 2132cdf0e10cSrcweir aStyleSettings.SetCursorBlinkTime( WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE ) ); 2133cdf0e10cSrcweir ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions(); 2134cdf0e10cSrcweir if ( WinQuerySysValue( HWND_DESKTOP, SV_DYNAMICDRAG ) ) 2135cdf0e10cSrcweir nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT; 2136cdf0e10cSrcweir else 2137cdf0e10cSrcweir nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT); 2138cdf0e10cSrcweir aStyleSettings.SetDragFullOptions( nDragFullOptions ); 2139cdf0e10cSrcweir 2140cdf0e10cSrcweir // Size settings 2141cdf0e10cSrcweir aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) ); 2142cdf0e10cSrcweir aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); 2143cdf0e10cSrcweir 2144cdf0e10cSrcweir // Color settings 2145cdf0e10cSrcweir aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); 2146cdf0e10cSrcweir aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); 2147cdf0e10cSrcweir aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); 2148cdf0e10cSrcweir aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); 2149cdf0e10cSrcweir aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); 2150cdf0e10cSrcweir aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); 2151cdf0e10cSrcweir aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); 2152cdf0e10cSrcweir aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2153cdf0e10cSrcweir aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); 2154cdf0e10cSrcweir aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); 2155cdf0e10cSrcweir aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); 2156cdf0e10cSrcweir aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); 2157cdf0e10cSrcweir aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); 2158cdf0e10cSrcweir aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); 2159cdf0e10cSrcweir aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); 2160cdf0e10cSrcweir aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2161cdf0e10cSrcweir aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2162cdf0e10cSrcweir aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); 2163cdf0e10cSrcweir aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); 2164cdf0e10cSrcweir aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) ); 2165cdf0e10cSrcweir aStyleSettings.SetLabelTextColor( aStyleSettings.GetGroupTextColor() ); 2166cdf0e10cSrcweir aStyleSettings.SetInfoTextColor( aStyleSettings.GetGroupTextColor() ); 2167cdf0e10cSrcweir aStyleSettings.SetWindowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOW, 0 ) ) ); 2168cdf0e10cSrcweir aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() ); 2169cdf0e10cSrcweir aStyleSettings.SetWindowTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWTEXT, 0 ) ) ); 2170cdf0e10cSrcweir aStyleSettings.SetFieldColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ENTRYFIELD, 0 ) ) ); 2171cdf0e10cSrcweir aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() ); 2172cdf0e10cSrcweir aStyleSettings.SetDisableColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUDISABLEDTEXT, 0 ) ) ); 2173cdf0e10cSrcweir aStyleSettings.SetHighlightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEBACKGROUND, 0 ) ) ); 2174cdf0e10cSrcweir aStyleSettings.SetHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEFOREGROUND, 0 ) ) ); 2175cdf0e10cSrcweir Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) ); 2176cdf0e10cSrcweir if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) ) 2177cdf0e10cSrcweir { 2178cdf0e10cSrcweir aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); 2179cdf0e10cSrcweir aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); 2180cdf0e10cSrcweir } 2181cdf0e10cSrcweir else 2182cdf0e10cSrcweir { 2183cdf0e10cSrcweir aStyleSettings.SetMenuHighlightColor( aMenuHighColor ); 2184cdf0e10cSrcweir aStyleSettings.SetMenuHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITE, 0 ) ) ); 2185cdf0e10cSrcweir } 2186cdf0e10cSrcweir // Checked-Color berechnen 2187cdf0e10cSrcweir Color aColor1 = aStyleSettings.GetFaceColor(); 2188cdf0e10cSrcweir Color aColor2 = aStyleSettings.GetLightColor(); 2189cdf0e10cSrcweir BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2); 2190cdf0e10cSrcweir BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2); 2191cdf0e10cSrcweir BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2); 2192cdf0e10cSrcweir aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); 2193cdf0e10cSrcweir 2194cdf0e10cSrcweir // Fonts updaten 2195cdf0e10cSrcweir Font aFont; 2196cdf0e10cSrcweir char aFontNameBuf[255]; 2197cdf0e10cSrcweir aFont = aStyleSettings.GetMenuFont(); 2198cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"Menus", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2199cdf0e10cSrcweir { 2200cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) { 2201cdf0e10cSrcweir #if 0 2202cdf0e10cSrcweir // Add Workplace Sans if not already listed 2203cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2204cdf0e10cSrcweir { 2205cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2206cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2207cdf0e10cSrcweir aFont.SetName( aFontName ); 2208cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2209cdf0e10cSrcweir } 2210cdf0e10cSrcweir #endif 2211cdf0e10cSrcweir aStyleSettings.SetMenuFont( aFont ); 2212cdf0e10cSrcweir } 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir aFont = aStyleSettings.GetIconFont(); 2215cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"IconText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2216cdf0e10cSrcweir { 2217cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2218cdf0e10cSrcweir aStyleSettings.SetIconFont( aFont ); 2219cdf0e10cSrcweir } 2220cdf0e10cSrcweir aFont = aStyleSettings.GetTitleFont(); 2221cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowTitles", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2222cdf0e10cSrcweir { 2223cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2224cdf0e10cSrcweir { 2225cdf0e10cSrcweir // Add Workplace Sans if not already listed 2226cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2227cdf0e10cSrcweir { 2228cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2229cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2230cdf0e10cSrcweir aFont.SetName( aFontName ); 2231cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2232cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 2233cdf0e10cSrcweir aFont.SetItalic( ITALIC_NONE ); 2234cdf0e10cSrcweir } 2235cdf0e10cSrcweir aStyleSettings.SetTitleFont( aFont ); 2236cdf0e10cSrcweir aStyleSettings.SetFloatTitleFont( aFont ); 2237cdf0e10cSrcweir } 2238cdf0e10cSrcweir } 2239cdf0e10cSrcweir aFont = aStyleSettings.GetAppFont(); 2240cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2241cdf0e10cSrcweir { 2242cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2243cdf0e10cSrcweir { 2244cdf0e10cSrcweir Font aHelpFont = aFont; 2245cdf0e10cSrcweir aHelpFont.SetName( (sal_Unicode*)L"Helv;WarpSans" ); 2246cdf0e10cSrcweir aHelpFont.SetSize( Size( 0, 8 ) ); 2247cdf0e10cSrcweir aHelpFont.SetWeight( WEIGHT_NORMAL ); 2248cdf0e10cSrcweir aHelpFont.SetItalic( ITALIC_NONE ); 2249cdf0e10cSrcweir aStyleSettings.SetHelpFont( aHelpFont ); 2250cdf0e10cSrcweir 2251cdf0e10cSrcweir // Add Workplace Sans if not already listed 2252cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2253cdf0e10cSrcweir { 2254cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2255cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2256cdf0e10cSrcweir aFont.SetName( aFontName ); 2257cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2258cdf0e10cSrcweir } 2259cdf0e10cSrcweir aStyleSettings.SetAppFont( aFont ); 2260cdf0e10cSrcweir aStyleSettings.SetToolFont( aFont ); 2261cdf0e10cSrcweir aStyleSettings.SetLabelFont( aFont ); 2262cdf0e10cSrcweir aStyleSettings.SetInfoFont( aFont ); 2263cdf0e10cSrcweir aStyleSettings.SetRadioCheckFont( aFont ); 2264cdf0e10cSrcweir aStyleSettings.SetPushButtonFont( aFont ); 2265cdf0e10cSrcweir aStyleSettings.SetFieldFont( aFont ); 2266cdf0e10cSrcweir aStyleSettings.SetGroupFont( aFont ); 2267cdf0e10cSrcweir } 2268cdf0e10cSrcweir } 2269cdf0e10cSrcweir 2270cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 2271cdf0e10cSrcweir } 2272cdf0e10cSrcweir 2273cdf0e10cSrcweir // ----------------------------------------------------------------------- 2274cdf0e10cSrcweir 2275cdf0e10cSrcweir SalBitmap* Os2SalFrame::SnapShot() 2276cdf0e10cSrcweir { 2277cdf0e10cSrcweir debug_printf("Os2SalFrame::SnapShot\n"); 2278cdf0e10cSrcweir return NULL; 2279cdf0e10cSrcweir } 2280cdf0e10cSrcweir 2281cdf0e10cSrcweir // ----------------------------------------------------------------------- 2282cdf0e10cSrcweir 2283cdf0e10cSrcweir const SystemEnvData* Os2SalFrame::GetSystemData() const 2284cdf0e10cSrcweir { 2285cdf0e10cSrcweir return &maSysData; 2286cdf0e10cSrcweir } 2287cdf0e10cSrcweir 2288cdf0e10cSrcweir // ----------------------------------------------------------------------- 2289cdf0e10cSrcweir 2290cdf0e10cSrcweir void Os2SalFrame::Beep( SoundType eSoundType ) 2291cdf0e10cSrcweir { 2292cdf0e10cSrcweir static ULONG aImplSoundTab[5] = 2293cdf0e10cSrcweir { 2294cdf0e10cSrcweir WA_NOTE, // SOUND_DEFAULT 2295cdf0e10cSrcweir WA_NOTE, // SOUND_INFO 2296cdf0e10cSrcweir WA_WARNING, // SOUND_WARNING 2297cdf0e10cSrcweir WA_ERROR, // SOUND_ERROR 2298cdf0e10cSrcweir WA_NOTE // SOUND_QUERY 2299cdf0e10cSrcweir }; 2300cdf0e10cSrcweir 2301cdf0e10cSrcweir #if 0 2302cdf0e10cSrcweir #if SOUND_COUNT != 5 2303cdf0e10cSrcweir #error New Sound must be defined! 2304cdf0e10cSrcweir #endif 2305cdf0e10cSrcweir #endif 2306cdf0e10cSrcweir 2307cdf0e10cSrcweir debug_printf("Os2SalFrame::Beep %d\n", eSoundType); 2308cdf0e10cSrcweir WinAlarm( HWND_DESKTOP, aImplSoundTab[eSoundType] ); 2309cdf0e10cSrcweir } 2310cdf0e10cSrcweir 2311cdf0e10cSrcweir // ----------------------------------------------------------------------- 2312cdf0e10cSrcweir 2313cdf0e10cSrcweir SalFrame::SalPointerState Os2SalFrame::GetPointerState() 2314cdf0e10cSrcweir { 2315cdf0e10cSrcweir SalPointerState aState; 2316cdf0e10cSrcweir aState.mnState = 0; 2317cdf0e10cSrcweir 2318cdf0e10cSrcweir // MausModus feststellen und setzen 2319cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) 2320cdf0e10cSrcweir aState.mnState |= MOUSE_LEFT; 2321cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) 2322cdf0e10cSrcweir aState.mnState |= MOUSE_RIGHT; 2323cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) 2324cdf0e10cSrcweir aState.mnState |= MOUSE_MIDDLE; 2325cdf0e10cSrcweir // Modifier-Tasten setzen 2326cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2327cdf0e10cSrcweir aState.mnState |= KEY_SHIFT; 2328cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2329cdf0e10cSrcweir aState.mnState |= KEY_MOD1; 2330cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2331cdf0e10cSrcweir aState.mnState |= KEY_MOD2; 2332cdf0e10cSrcweir 2333cdf0e10cSrcweir POINTL pt; 2334cdf0e10cSrcweir _WinQueryPointerPos( HWND_DESKTOP, &pt ); 2335cdf0e10cSrcweir 2336cdf0e10cSrcweir aState.maPos = Point( pt.x - maGeometry.nX, pt.y - maGeometry.nY ); 2337cdf0e10cSrcweir return aState; 2338cdf0e10cSrcweir } 2339cdf0e10cSrcweir 2340cdf0e10cSrcweir // ----------------------------------------------------------------------- 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir void Os2SalFrame::SetBackgroundBitmap( SalBitmap* ) 2343cdf0e10cSrcweir { 2344cdf0e10cSrcweir } 2345cdf0e10cSrcweir 2346cdf0e10cSrcweir // ----------------------------------------------------------------------- 2347cdf0e10cSrcweir 2348cdf0e10cSrcweir void SalTestMouseLeave() 2349cdf0e10cSrcweir { 2350cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2351cdf0e10cSrcweir 2352cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg && !::WinQueryCapture( HWND_DESKTOP ) ) 2353cdf0e10cSrcweir { 2354cdf0e10cSrcweir POINTL aPt; 2355cdf0e10cSrcweir WinQueryPointerPos( HWND_DESKTOP, &aPt ); 2356cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg != WinWindowFromPoint( HWND_DESKTOP, &aPt, TRUE ) ) 2357cdf0e10cSrcweir WinSendMsg( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MPFROM2SHORT( aPt.x, aPt.y ) ); 2358cdf0e10cSrcweir } 2359cdf0e10cSrcweir } 2360cdf0e10cSrcweir 2361cdf0e10cSrcweir // ----------------------------------------------------------------------- 2362cdf0e10cSrcweir 2363cdf0e10cSrcweir static long ImplHandleMouseMsg( HWND hWnd, 2364cdf0e10cSrcweir UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2365cdf0e10cSrcweir { 2366cdf0e10cSrcweir SalMouseEvent aMouseEvt; 2367cdf0e10cSrcweir long nRet; 2368cdf0e10cSrcweir USHORT nEvent; 2369cdf0e10cSrcweir BOOL bCall = TRUE; 2370cdf0e10cSrcweir USHORT nFlags = SHORT2FROMMP( nMP2 ); 2371cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2372cdf0e10cSrcweir if ( !pFrame ) 2373cdf0e10cSrcweir return 0; 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir aMouseEvt.mnX = (short)SHORT1FROMMP( nMP1 ); 2376cdf0e10cSrcweir aMouseEvt.mnY = pFrame->mnHeight - (short)SHORT2FROMMP( nMP1 ) - 1; 2377cdf0e10cSrcweir aMouseEvt.mnCode = 0; 2378cdf0e10cSrcweir aMouseEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2379cdf0e10cSrcweir 2380cdf0e10cSrcweir // MausModus feststellen und setzen 2381cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) 2382cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_LEFT; 2383cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) 2384cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_RIGHT; 2385cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) 2386cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_MIDDLE; 2387cdf0e10cSrcweir // Modifier-Tasten setzen 2388cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2389cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_SHIFT; 2390cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2391cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_MOD1; 2392cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2393cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_MOD2; 2394cdf0e10cSrcweir 2395cdf0e10cSrcweir switch ( nMsg ) 2396cdf0e10cSrcweir { 2397cdf0e10cSrcweir case WM_MOUSEMOVE: 2398cdf0e10cSrcweir { 2399cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2400cdf0e10cSrcweir 2401cdf0e10cSrcweir // Da bei Druecken von Modifier-Tasten die MouseEvents 2402cdf0e10cSrcweir // nicht zusammengefast werden (da diese durch KeyEvents 2403cdf0e10cSrcweir // unterbrochen werden), machen wir dieses hier selber 2404cdf0e10cSrcweir if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) ) 2405cdf0e10cSrcweir { 2406cdf0e10cSrcweir QMSG aTempMsg; 2407cdf0e10cSrcweir if ( WinPeekMsg( pSalData->mhAB, &aTempMsg, 2408cdf0e10cSrcweir pFrame->mhWndClient, 2409cdf0e10cSrcweir WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) 2410cdf0e10cSrcweir { 2411cdf0e10cSrcweir if ( (aTempMsg.msg == WM_MOUSEMOVE) && 2412cdf0e10cSrcweir (aTempMsg.mp2 == nMP2) ) 2413cdf0e10cSrcweir return 1; 2414cdf0e10cSrcweir } 2415cdf0e10cSrcweir } 2416cdf0e10cSrcweir 2417cdf0e10cSrcweir // Test for MouseLeave 2418cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg && 2419cdf0e10cSrcweir (pSalData->mhWantLeaveMsg != pFrame->mhWndClient) ) 2420cdf0e10cSrcweir { 2421cdf0e10cSrcweir POINTL aMousePoint; 2422cdf0e10cSrcweir WinQueryMsgPos( pFrame->mhAB, &aMousePoint ); 2423cdf0e10cSrcweir WinSendMsg( pSalData->mhWantLeaveMsg, 2424cdf0e10cSrcweir SAL_MSG_MOUSELEAVE, 2425cdf0e10cSrcweir 0, MPFROM2SHORT( aMousePoint.x, aMousePoint.y ) ); 2426cdf0e10cSrcweir } 2427cdf0e10cSrcweir pSalData->mhWantLeaveMsg = pFrame->mhWndClient; 2428cdf0e10cSrcweir // Start MouseLeave-Timer 2429cdf0e10cSrcweir if ( !pSalData->mpMouseLeaveTimer ) 2430cdf0e10cSrcweir { 2431cdf0e10cSrcweir pSalData->mpMouseLeaveTimer = new AutoTimer; 2432cdf0e10cSrcweir pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT ); 2433cdf0e10cSrcweir pSalData->mpMouseLeaveTimer->Start(); 2434cdf0e10cSrcweir // We dont need to set a timeout handler, because we test 2435cdf0e10cSrcweir // for mouseleave in the timeout callback 2436cdf0e10cSrcweir } 2437cdf0e10cSrcweir aMouseEvt.mnButton = 0; 2438cdf0e10cSrcweir nEvent = SALEVENT_MOUSEMOVE; 2439cdf0e10cSrcweir } 2440cdf0e10cSrcweir break; 2441cdf0e10cSrcweir 2442cdf0e10cSrcweir case SAL_MSG_MOUSELEAVE: 2443cdf0e10cSrcweir { 2444cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2445cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg == pFrame->mhWndClient ) 2446cdf0e10cSrcweir { 2447cdf0e10cSrcweir pSalData->mhWantLeaveMsg = 0; 2448cdf0e10cSrcweir if ( pSalData->mpMouseLeaveTimer ) 2449cdf0e10cSrcweir { 2450cdf0e10cSrcweir delete pSalData->mpMouseLeaveTimer; 2451cdf0e10cSrcweir pSalData->mpMouseLeaveTimer = NULL; 2452cdf0e10cSrcweir } 2453cdf0e10cSrcweir 2454cdf0e10cSrcweir // Mouse-Coordinaates are relativ to the screen 2455cdf0e10cSrcweir POINTL aPt; 2456cdf0e10cSrcweir aPt.x = (short)SHORT1FROMMP( nMP2 ); 2457cdf0e10cSrcweir aPt.y = (short)SHORT2FROMMP( nMP2 ); 2458cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); 2459cdf0e10cSrcweir aPt.y = pFrame->mnHeight - aPt.y - 1; 2460cdf0e10cSrcweir aMouseEvt.mnX = aPt.x; 2461cdf0e10cSrcweir aMouseEvt.mnY = aPt.y; 2462cdf0e10cSrcweir aMouseEvt.mnButton = 0; 2463cdf0e10cSrcweir nEvent = SALEVENT_MOUSELEAVE; 2464cdf0e10cSrcweir } 2465cdf0e10cSrcweir else 2466cdf0e10cSrcweir bCall = FALSE; 2467cdf0e10cSrcweir } 2468cdf0e10cSrcweir break; 2469cdf0e10cSrcweir 2470cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 2471cdf0e10cSrcweir case WM_BUTTON1DOWN: 2472cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_LEFT; 2473cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2474cdf0e10cSrcweir break; 2475cdf0e10cSrcweir 2476cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 2477cdf0e10cSrcweir case WM_BUTTON2DOWN: 2478cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_RIGHT; 2479cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2480cdf0e10cSrcweir break; 2481cdf0e10cSrcweir 2482cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 2483cdf0e10cSrcweir case WM_BUTTON3DOWN: 2484cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_MIDDLE; 2485cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2486cdf0e10cSrcweir break; 2487cdf0e10cSrcweir 2488cdf0e10cSrcweir case WM_BUTTON1UP: 2489cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_LEFT; 2490cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2491cdf0e10cSrcweir break; 2492cdf0e10cSrcweir 2493cdf0e10cSrcweir case WM_BUTTON2UP: 2494cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_RIGHT; 2495cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2496cdf0e10cSrcweir break; 2497cdf0e10cSrcweir 2498cdf0e10cSrcweir case WM_BUTTON3UP: 2499cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_MIDDLE; 2500cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2501cdf0e10cSrcweir break; 2502cdf0e10cSrcweir } 2503cdf0e10cSrcweir 2504cdf0e10cSrcweir // check if this window was destroyed - this might happen if we are the help window 2505cdf0e10cSrcweir // and sent a mouse leave message to the application which killed the help window, ie ourself 2506cdf0e10cSrcweir if( !WinIsWindow( pFrame->mhAB, hWnd ) ) 2507cdf0e10cSrcweir return 0; 2508cdf0e10cSrcweir 2509cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2510cdf0e10cSrcweir //if (_bCapture) 2511cdf0e10cSrcweir debug_printf("ImplHandleMouseMsg mouse %d,%d\n",aMouseEvt.mnX,aMouseEvt.mnY); 2512cdf0e10cSrcweir #endif 2513cdf0e10cSrcweir 2514cdf0e10cSrcweir if ( bCall ) 2515cdf0e10cSrcweir { 2516cdf0e10cSrcweir if ( nEvent == SALEVENT_MOUSEBUTTONDOWN ) 2517cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 2518cdf0e10cSrcweir 2519cdf0e10cSrcweir // --- RTL --- (mirror mouse pos) 2520cdf0e10cSrcweir //if( Application::GetSettings().GetLayoutRTL() ) 2521cdf0e10cSrcweir // aMouseEvt.mnX = pFrame->maGeometry.nWidth-1-aMouseEvt.mnX; 2522cdf0e10cSrcweir 2523cdf0e10cSrcweir nRet = pFrame->CallCallback( nEvent, &aMouseEvt ); 2524cdf0e10cSrcweir if ( nMsg == WM_MOUSEMOVE ) 2525cdf0e10cSrcweir { 2526cdf0e10cSrcweir WinSetPointer( HWND_DESKTOP, pFrame->mhPointer ); 2527cdf0e10cSrcweir nRet = TRUE; 2528cdf0e10cSrcweir } 2529cdf0e10cSrcweir } 2530cdf0e10cSrcweir else 2531cdf0e10cSrcweir nRet = 0; 2532cdf0e10cSrcweir 2533cdf0e10cSrcweir return nRet; 2534cdf0e10cSrcweir } 2535cdf0e10cSrcweir 2536cdf0e10cSrcweir // ----------------------------------------------------------------------- 2537cdf0e10cSrcweir 2538cdf0e10cSrcweir static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2539cdf0e10cSrcweir { 2540cdf0e10cSrcweir 2541cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 2542cdf0e10cSrcweir 2543cdf0e10cSrcweir long nRet = 0; 2544cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2545cdf0e10cSrcweir if ( pFrame ) 2546cdf0e10cSrcweir { 2547cdf0e10cSrcweir 2548cdf0e10cSrcweir // Mouse-Coordinaates are relativ to the screen 2549cdf0e10cSrcweir POINTL aPt; 2550cdf0e10cSrcweir WinQueryMsgPos( pFrame->mhAB, &aPt ); 2551cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); 2552cdf0e10cSrcweir aPt.y = pFrame->mnHeight - aPt.y - 1; 2553cdf0e10cSrcweir 2554cdf0e10cSrcweir SalWheelMouseEvent aWheelEvt; 2555cdf0e10cSrcweir aWheelEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2556cdf0e10cSrcweir aWheelEvt.mnX = aPt.x; 2557cdf0e10cSrcweir aWheelEvt.mnY = aPt.y; 2558cdf0e10cSrcweir aWheelEvt.mnCode = 0; 2559cdf0e10cSrcweir bool bNeg = (SHORT2FROMMP(nMP2) == SB_LINEDOWN || SHORT2FROMMP(nMP2) == SB_PAGEDOWN ); 2560cdf0e10cSrcweir aWheelEvt.mnDelta = bNeg ? -120 : 120; 2561cdf0e10cSrcweir aWheelEvt.mnNotchDelta = bNeg ? -1 : 1; 2562cdf0e10cSrcweir if (SHORT2FROMMP(nMP2) == SB_PAGEUP || SHORT2FROMMP(nMP2) == SB_PAGEDOWN) 2563cdf0e10cSrcweir aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; 2564cdf0e10cSrcweir else 2565cdf0e10cSrcweir aWheelEvt.mnScrollLines = 1; 2566cdf0e10cSrcweir 2567cdf0e10cSrcweir if( nMsg == WM_HSCROLL ) 2568cdf0e10cSrcweir aWheelEvt.mbHorz = TRUE; 2569cdf0e10cSrcweir 2570cdf0e10cSrcweir // Modifier-Tasten setzen 2571cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2572cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_SHIFT; 2573cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2574cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_MOD1; 2575cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2576cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_MOD2; 2577cdf0e10cSrcweir 2578cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_WHEELMOUSE, &aWheelEvt ); 2579cdf0e10cSrcweir } 2580cdf0e10cSrcweir 2581cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2582cdf0e10cSrcweir 2583cdf0e10cSrcweir return nRet; 2584cdf0e10cSrcweir } 2585cdf0e10cSrcweir 2586cdf0e10cSrcweir 2587cdf0e10cSrcweir // ----------------------------------------------------------------------- 2588cdf0e10cSrcweir 2589cdf0e10cSrcweir static USHORT ImplSalGetKeyCode( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) 2590cdf0e10cSrcweir { 2591cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); 2592cdf0e10cSrcweir UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); 2593cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); 2594cdf0e10cSrcweir UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); 2595cdf0e10cSrcweir USHORT rSVCode = 0; 2596cdf0e10cSrcweir 2597cdf0e10cSrcweir // Ist virtueller KeyCode gesetzt und befindet sich der KeyCode in der 2598cdf0e10cSrcweir // Tabelle, dann mappen 2599cdf0e10cSrcweir if ( (nKeyFlags & KC_VIRTUALKEY) && (nKeyCode < KEY_TAB_SIZE) ) 2600cdf0e10cSrcweir rSVCode = aImplTranslateKeyTab[nKeyCode]; 2601cdf0e10cSrcweir 2602cdf0e10cSrcweir // Wenn kein KeyCode ermittelt werden konnte, versuchen wir aus dem 2603cdf0e10cSrcweir // CharCode einen zu erzeugen 2604cdf0e10cSrcweir if ( !rSVCode && nCharCode ) 2605cdf0e10cSrcweir { 2606cdf0e10cSrcweir // Bei 0-9, a-z und A-Z auch KeyCode setzen 2607cdf0e10cSrcweir if ( (nCharCode >= '0') && (nCharCode <= '9') && (!rSVCode || !(nKeyFlags & KC_SHIFT)) ) 2608cdf0e10cSrcweir rSVCode = KEYGROUP_NUM + (nCharCode-'0'); 2609cdf0e10cSrcweir else if ( (nCharCode >= 'a') && (nCharCode <= 'z') ) 2610cdf0e10cSrcweir rSVCode = KEYGROUP_ALPHA + (nCharCode-'a'); 2611cdf0e10cSrcweir else if ( (nCharCode >= 'A') && (nCharCode <= 'Z') ) 2612cdf0e10cSrcweir rSVCode = KEYGROUP_ALPHA + (nCharCode-'A'); 2613cdf0e10cSrcweir else 2614cdf0e10cSrcweir { 2615cdf0e10cSrcweir switch ( nCharCode ) 2616cdf0e10cSrcweir { 2617cdf0e10cSrcweir case '+': 2618cdf0e10cSrcweir rSVCode = KEY_ADD; 2619cdf0e10cSrcweir break; 2620cdf0e10cSrcweir case '-': 2621cdf0e10cSrcweir rSVCode = KEY_SUBTRACT; 2622cdf0e10cSrcweir break; 2623cdf0e10cSrcweir case '*': 2624cdf0e10cSrcweir rSVCode = KEY_MULTIPLY; 2625cdf0e10cSrcweir break; 2626cdf0e10cSrcweir case '/': 2627cdf0e10cSrcweir rSVCode = KEY_DIVIDE; 2628cdf0e10cSrcweir break; 2629cdf0e10cSrcweir case '.': 2630cdf0e10cSrcweir rSVCode = KEY_POINT; 2631cdf0e10cSrcweir break; 2632cdf0e10cSrcweir case ',': 2633cdf0e10cSrcweir rSVCode = KEY_COMMA; 2634cdf0e10cSrcweir break; 2635cdf0e10cSrcweir case '<': 2636cdf0e10cSrcweir rSVCode = KEY_LESS; 2637cdf0e10cSrcweir break; 2638cdf0e10cSrcweir case '>': 2639cdf0e10cSrcweir rSVCode = KEY_GREATER; 2640cdf0e10cSrcweir break; 2641cdf0e10cSrcweir case '=': 2642cdf0e10cSrcweir rSVCode = KEY_EQUAL; 2643cdf0e10cSrcweir break; 2644cdf0e10cSrcweir } 2645cdf0e10cSrcweir } 2646cdf0e10cSrcweir } 2647cdf0e10cSrcweir 2648cdf0e10cSrcweir // "Numlock-Hack": we want to get correct keycodes from the numpad 2649cdf0e10cSrcweir if ( (nCharCode >= '0') && (nCharCode <= '9') && !(nKeyFlags & KC_SHIFT) ) 2650cdf0e10cSrcweir rSVCode = KEYGROUP_NUM + (nCharCode-'0'); 2651cdf0e10cSrcweir if ( nCharCode == ',' ) 2652cdf0e10cSrcweir rSVCode = KEY_COMMA; 2653cdf0e10cSrcweir if ( nCharCode == '.' ) 2654cdf0e10cSrcweir rSVCode = KEY_POINT; 2655cdf0e10cSrcweir 2656cdf0e10cSrcweir return rSVCode; 2657cdf0e10cSrcweir } 2658cdf0e10cSrcweir 2659cdf0e10cSrcweir // ----------------------------------------------------------------------- 2660cdf0e10cSrcweir 2661cdf0e10cSrcweir static void ImplUpdateInputLang( Os2SalFrame* pFrame ) 2662cdf0e10cSrcweir { 2663cdf0e10cSrcweir BOOL bLanguageChange = FALSE; 2664cdf0e10cSrcweir ULONG nLang = 0; 2665cdf0e10cSrcweir APIRET rc; 2666cdf0e10cSrcweir UconvObject uconv_object = NULL; 2667cdf0e10cSrcweir LocaleObject locale_object = NULL; 2668cdf0e10cSrcweir UniChar *pinfo_item; 2669cdf0e10cSrcweir 2670cdf0e10cSrcweir // we do not support change of input language while working, 2671cdf0e10cSrcweir // so exit if already defined (mnInputLang is a static class field) 2672cdf0e10cSrcweir if (pFrame->mnInputLang) 2673cdf0e10cSrcweir return; 2674cdf0e10cSrcweir 2675cdf0e10cSrcweir // get current locale 2676cdf0e10cSrcweir rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); 2677cdf0e10cSrcweir // get Win32 locale id and sublanguage (hex uni string) 2678cdf0e10cSrcweir rc = UniQueryLocaleItem(locale_object, LOCI_xWinLocale, &pinfo_item); 2679cdf0e10cSrcweir // convert uni string to integer 2680cdf0e10cSrcweir rc = UniStrtoul(locale_object, pinfo_item, &pinfo_item, 16, &nLang); 2681cdf0e10cSrcweir rc = UniFreeMem(pinfo_item); 2682cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2683cdf0e10cSrcweir debug_printf("ImplUpdateInputLang nLang %04x\n", nLang); 2684cdf0e10cSrcweir char char_buffer[256]; 2685cdf0e10cSrcweir rc = UniCreateUconvObject((UniChar *)L"", &uconv_object); 2686cdf0e10cSrcweir rc = UniQueryLocaleItem(locale_object, LOCI_sKeyboard, &pinfo_item); 2687cdf0e10cSrcweir rc = UniStrFromUcs(uconv_object, char_buffer, pinfo_item, sizeof(char_buffer)); 2688cdf0e10cSrcweir debug_printf("Keyboard name is: %s\n", char_buffer ); 2689cdf0e10cSrcweir rc = UniFreeMem(pinfo_item); 2690cdf0e10cSrcweir #endif 2691cdf0e10cSrcweir rc = UniFreeLocaleObject(locale_object); 2692cdf0e10cSrcweir 2693cdf0e10cSrcweir // keep input lang up-to-date 2694cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2695cdf0e10cSrcweir debug_printf("ImplUpdateInputLang pFrame %08x lang changed from %d to %d\n", 2696cdf0e10cSrcweir pFrame, pFrame->mnInputLang, nLang); 2697cdf0e10cSrcweir #endif 2698cdf0e10cSrcweir pFrame->mnInputLang = nLang; 2699cdf0e10cSrcweir } 2700cdf0e10cSrcweir 2701cdf0e10cSrcweir 2702cdf0e10cSrcweir static sal_Unicode ImplGetCharCode( Os2SalFrame* pFrame, USHORT nKeyFlags, 2703cdf0e10cSrcweir sal_Char nCharCode, UCHAR nScanCode ) 2704cdf0e10cSrcweir { 2705cdf0e10cSrcweir ImplUpdateInputLang( pFrame ); 2706cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2707cdf0e10cSrcweir debug_printf("ImplGetCharCode nCharCode %c, %04x\n", nCharCode, nCharCode); 2708cdf0e10cSrcweir #endif 2709cdf0e10cSrcweir return OUString( &nCharCode, 1, gsl_getSystemTextEncoding()).toChar(); 2710cdf0e10cSrcweir } 2711cdf0e10cSrcweir 2712cdf0e10cSrcweir // ----------------------------------------------------------------------- 2713cdf0e10cSrcweir 2714cdf0e10cSrcweir LanguageType Os2SalFrame::GetInputLanguage() 2715cdf0e10cSrcweir { 2716cdf0e10cSrcweir if( !mnInputLang ) 2717cdf0e10cSrcweir ImplUpdateInputLang( this ); 2718cdf0e10cSrcweir 2719cdf0e10cSrcweir if( !mnInputLang ) 2720cdf0e10cSrcweir return LANGUAGE_DONTKNOW; 2721cdf0e10cSrcweir else 2722cdf0e10cSrcweir return (LanguageType) mnInputLang; 2723cdf0e10cSrcweir } 2724cdf0e10cSrcweir 2725cdf0e10cSrcweir // ----------------------------------------------------------------------- 2726cdf0e10cSrcweir 2727cdf0e10cSrcweir BOOL Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) 2728cdf0e10cSrcweir { 2729cdf0e10cSrcweir // not supported yet 2730cdf0e10cSrcweir return FALSE; 2731cdf0e10cSrcweir } 2732cdf0e10cSrcweir 2733cdf0e10cSrcweir // ----------------------------------------------------------------------- 2734cdf0e10cSrcweir 2735cdf0e10cSrcweir static sal_Unicode ImplConvertKey( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) 2736cdf0e10cSrcweir { 2737cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); 2738cdf0e10cSrcweir UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); 2739cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); 2740cdf0e10cSrcweir UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); 2741cdf0e10cSrcweir sal_Unicode rSVCharCode = 0; 2742cdf0e10cSrcweir 2743cdf0e10cSrcweir // Ist Character-Code gesetzt 2744cdf0e10cSrcweir // !!! Bei CTRL/ALT ist KC_CHAR nicht gesetzt, jedoch moechten wir 2745cdf0e10cSrcweir // !!! dann auch einen CharCode und machen die Behandlung deshalb 2746cdf0e10cSrcweir // !!! selber 2747cdf0e10cSrcweir if ( (nKeyFlags & KC_CHAR) || (nKeyFlags & KC_CTRL) || (nKeyFlags & KC_ALT) ) 2748cdf0e10cSrcweir rSVCharCode = ImplGetCharCode( pFrame, nKeyFlags, nCharCode, nScanCode); 2749cdf0e10cSrcweir 2750cdf0e10cSrcweir // ret unicode 2751cdf0e10cSrcweir return rSVCharCode; 2752cdf0e10cSrcweir } 2753cdf0e10cSrcweir 2754cdf0e10cSrcweir // ----------------------------------------------------------------------- 2755cdf0e10cSrcweir 2756cdf0e10cSrcweir static long ImplHandleKeyMsg( HWND hWnd, 2757cdf0e10cSrcweir UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2758cdf0e10cSrcweir { 2759cdf0e10cSrcweir static USHORT nLastOS2KeyChar = 0; 2760cdf0e10cSrcweir static sal_Unicode nLastChar = 0; 2761cdf0e10cSrcweir USHORT nRepeat = CHAR3FROMMP( nMP1 ) - 1; 2762cdf0e10cSrcweir SHORT nFlags = SHORT1FROMMP( nMP1 ); 2763cdf0e10cSrcweir USHORT nModCode = 0; 2764cdf0e10cSrcweir USHORT nSVCode = 0; 2765cdf0e10cSrcweir USHORT nOS2KeyCode = (UCHAR)SHORT2FROMMP( nMP2 ); 2766cdf0e10cSrcweir sal_Unicode nSVCharCode = 0; 2767cdf0e10cSrcweir long nRet = 0; 2768cdf0e10cSrcweir 2769cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2770cdf0e10cSrcweir if ( !pFrame ) 2771cdf0e10cSrcweir return 0; 2772cdf0e10cSrcweir 2773cdf0e10cSrcweir // determine modifiers 2774cdf0e10cSrcweir if ( nFlags & KC_SHIFT ) 2775cdf0e10cSrcweir nModCode |= KEY_SHIFT; 2776cdf0e10cSrcweir if ( nFlags & KC_CTRL ) 2777cdf0e10cSrcweir nModCode |= KEY_MOD1; 2778cdf0e10cSrcweir if ( nFlags & KC_ALT ) 2779cdf0e10cSrcweir nModCode |= KEY_MOD2; 2780cdf0e10cSrcweir 2781cdf0e10cSrcweir // Bei Shift, Control und Alt schicken wir einen KeyModChange-Event 2782cdf0e10cSrcweir if ( (nOS2KeyCode == VK_SHIFT) || (nOS2KeyCode == VK_CTRL) || 2783cdf0e10cSrcweir (nOS2KeyCode == VK_ALT) || (nOS2KeyCode == VK_ALTGRAF) ) 2784cdf0e10cSrcweir { 2785cdf0e10cSrcweir SalKeyModEvent aModEvt; 2786cdf0e10cSrcweir aModEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2787cdf0e10cSrcweir aModEvt.mnCode = nModCode; 2788cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2789cdf0e10cSrcweir debug_printf("SALEVENT_KEYMODCHANGE\n"); 2790cdf0e10cSrcweir #endif 2791cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); 2792cdf0e10cSrcweir } 2793cdf0e10cSrcweir else 2794cdf0e10cSrcweir { 2795cdf0e10cSrcweir nSVCode = ImplSalGetKeyCode( pFrame, nMP1, nMP2 ); 2796cdf0e10cSrcweir nSVCharCode = ImplConvertKey( pFrame, nMP1, nMP2 ); 2797cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2798cdf0e10cSrcweir debug_printf("nSVCode %04x nSVCharCode %04x\n",nSVCode,nSVCharCode ); 2799cdf0e10cSrcweir #endif 2800cdf0e10cSrcweir 2801cdf0e10cSrcweir // Fuer Java muessen wir bei KeyUp einen CharCode liefern 2802cdf0e10cSrcweir if ( nFlags & KC_KEYUP ) 2803cdf0e10cSrcweir { 2804cdf0e10cSrcweir if ( !nSVCharCode ) 2805cdf0e10cSrcweir { 2806cdf0e10cSrcweir if ( nLastOS2KeyChar == nOS2KeyCode ) 2807cdf0e10cSrcweir { 2808cdf0e10cSrcweir nSVCharCode = nLastChar; 2809cdf0e10cSrcweir nLastOS2KeyChar = 0; 2810cdf0e10cSrcweir nLastChar = 0; 2811cdf0e10cSrcweir } 2812cdf0e10cSrcweir } 2813cdf0e10cSrcweir else 2814cdf0e10cSrcweir { 2815cdf0e10cSrcweir nLastOS2KeyChar = 0; 2816cdf0e10cSrcweir nLastChar = 0; 2817cdf0e10cSrcweir } 2818cdf0e10cSrcweir } 2819cdf0e10cSrcweir else 2820cdf0e10cSrcweir { 2821cdf0e10cSrcweir nLastOS2KeyChar = nOS2KeyCode; 2822cdf0e10cSrcweir nLastChar = nSVCharCode; 2823cdf0e10cSrcweir } 2824cdf0e10cSrcweir 2825cdf0e10cSrcweir if ( nSVCode || nSVCharCode ) 2826cdf0e10cSrcweir { 2827cdf0e10cSrcweir SalKeyEvent aKeyEvt; 2828cdf0e10cSrcweir aKeyEvt.mnCode = nSVCode; 2829cdf0e10cSrcweir aKeyEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2830cdf0e10cSrcweir aKeyEvt.mnCode |= nModCode; 2831cdf0e10cSrcweir aKeyEvt.mnCharCode = nSVCharCode; 2832cdf0e10cSrcweir aKeyEvt.mnRepeat = nRepeat; 2833cdf0e10cSrcweir 2834cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2835cdf0e10cSrcweir debug_printf( (nFlags & KC_KEYUP) ? "SALEVENT_KEYUP\n" : "SALEVENT_KEYINPUT\n"); 2836cdf0e10cSrcweir #endif 2837cdf0e10cSrcweir nRet = pFrame->CallCallback( (nFlags & KC_KEYUP) ? SALEVENT_KEYUP : SALEVENT_KEYINPUT, 2838cdf0e10cSrcweir &aKeyEvt ); 2839cdf0e10cSrcweir } 2840cdf0e10cSrcweir } 2841cdf0e10cSrcweir 2842cdf0e10cSrcweir return nRet; 2843cdf0e10cSrcweir } 2844cdf0e10cSrcweir 2845cdf0e10cSrcweir // ----------------------------------------------------------------------- 2846cdf0e10cSrcweir 2847cdf0e10cSrcweir static bool ImplHandlePaintMsg( HWND hWnd ) 2848cdf0e10cSrcweir { 2849cdf0e10cSrcweir BOOL bMutex = FALSE; 2850cdf0e10cSrcweir 2851cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2852cdf0e10cSrcweir bMutex = TRUE; 2853cdf0e10cSrcweir 2854cdf0e10cSrcweir // if we don't get the mutex, we can also change the clip region, 2855cdf0e10cSrcweir // because other threads doesn't use the mutex from the main 2856cdf0e10cSrcweir // thread --> see GetGraphics() 2857cdf0e10cSrcweir 2858cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2859cdf0e10cSrcweir if ( pFrame ) 2860cdf0e10cSrcweir { 2861cdf0e10cSrcweir // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine 2862cdf0e10cSrcweir // Paint-Region anliegt 2863cdf0e10cSrcweir if ( WinQueryUpdateRect( hWnd, NULL ) ) 2864cdf0e10cSrcweir { 2865cdf0e10cSrcweir // Call BeginPaint/EndPaint to query the rect and send 2866cdf0e10cSrcweir // this Notofication to rect 2867cdf0e10cSrcweir HPS hPS; 2868cdf0e10cSrcweir RECTL aUpdateRect; 2869cdf0e10cSrcweir hPS = WinBeginPaint( hWnd, NULLHANDLE, &aUpdateRect ); 2870cdf0e10cSrcweir WinEndPaint( hPS ); 2871cdf0e10cSrcweir 2872cdf0e10cSrcweir // Paint 2873cdf0e10cSrcweir if ( bMutex ) 2874cdf0e10cSrcweir { 2875cdf0e10cSrcweir SalPaintEvent aPEvt( aUpdateRect.xLeft, pFrame->mnHeight - aUpdateRect.yTop, aUpdateRect.xRight- aUpdateRect.xLeft, aUpdateRect.yTop - aUpdateRect.yBottom ); 2876cdf0e10cSrcweir 2877cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); 2878cdf0e10cSrcweir } 2879cdf0e10cSrcweir else 2880cdf0e10cSrcweir { 2881cdf0e10cSrcweir RECTL* pRect = new RECTL; 2882cdf0e10cSrcweir WinCopyRect( pFrame->mhAB, pRect, &aUpdateRect ); 2883cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); 2884cdf0e10cSrcweir } 2885cdf0e10cSrcweir } 2886cdf0e10cSrcweir } 2887cdf0e10cSrcweir 2888cdf0e10cSrcweir if ( bMutex ) 2889cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2890cdf0e10cSrcweir 2891cdf0e10cSrcweir return bMutex ? true : false; 2892cdf0e10cSrcweir } 2893cdf0e10cSrcweir 2894cdf0e10cSrcweir // ----------------------------------------------------------------------- 2895cdf0e10cSrcweir 2896cdf0e10cSrcweir static void ImplHandlePaintMsg2( HWND hWnd, RECTL* pRect ) 2897cdf0e10cSrcweir { 2898cdf0e10cSrcweir // Paint 2899cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2900cdf0e10cSrcweir { 2901cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2902cdf0e10cSrcweir if ( pFrame ) 2903cdf0e10cSrcweir { 2904cdf0e10cSrcweir SalPaintEvent aPEvt( pRect->xLeft, pFrame->mnHeight - pRect->yTop, pRect->xRight - pRect->xLeft, pRect->yTop - pRect->yBottom ); 2905cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); 2906cdf0e10cSrcweir } 2907cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2908cdf0e10cSrcweir delete pRect; 2909cdf0e10cSrcweir } 2910cdf0e10cSrcweir else 2911cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); 2912cdf0e10cSrcweir } 2913cdf0e10cSrcweir 2914cdf0e10cSrcweir // ----------------------------------------------------------------------- 2915cdf0e10cSrcweir 2916cdf0e10cSrcweir static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) 2917cdf0e10cSrcweir { 2918cdf0e10cSrcweir // calculate and set frame geometry of a maximized window - useful if the window is still hidden 2919cdf0e10cSrcweir 2920cdf0e10cSrcweir RECTL aRect; 2921cdf0e10cSrcweir pFrame->GetWorkArea( aRect); 2922cdf0e10cSrcweir 2923cdf0e10cSrcweir // a maximized window has no other borders than the caption 2924cdf0e10cSrcweir pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; 2925cdf0e10cSrcweir pFrame->maGeometry.nTopDecoration = pFrame->mbCaption ? WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) : 0; 2926cdf0e10cSrcweir 2927cdf0e10cSrcweir aRect.yTop += pFrame->maGeometry.nTopDecoration; 2928cdf0e10cSrcweir pFrame->maGeometry.nX = aRect.xLeft; 2929cdf0e10cSrcweir pFrame->maGeometry.nY = aRect.yBottom; 2930cdf0e10cSrcweir pFrame->maGeometry.nWidth = aRect.xRight - aRect.xLeft + 1; 2931cdf0e10cSrcweir pFrame->maGeometry.nHeight = aRect.yBottom - aRect.yTop + 1; 2932cdf0e10cSrcweir } 2933cdf0e10cSrcweir 2934cdf0e10cSrcweir static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) 2935cdf0e10cSrcweir { 2936cdf0e10cSrcweir if( !pFrame ) 2937cdf0e10cSrcweir return; 2938cdf0e10cSrcweir 2939cdf0e10cSrcweir //SalFrame has a 2940cdf0e10cSrcweir //maGeometry member that holds absolute screen positions (and needs to be 2941cdf0e10cSrcweir //updated if the window is moved by the way). 2942cdf0e10cSrcweir 2943cdf0e10cSrcweir // reset data 2944cdf0e10cSrcweir memset(&pFrame->maGeometry, 0, sizeof(SalFrameGeometry) ); 2945cdf0e10cSrcweir 2946cdf0e10cSrcweir SWP swp; 2947cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 2948cdf0e10cSrcweir 2949cdf0e10cSrcweir // get frame size 2950cdf0e10cSrcweir WinQueryWindowPos(pFrame->mhWndFrame, &swp); 2951cdf0e10cSrcweir if (swp.fl & SWP_MINIMIZE) 2952cdf0e10cSrcweir return; 2953cdf0e10cSrcweir 2954cdf0e10cSrcweir // map from client area to screen 2955cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY); 2956cdf0e10cSrcweir pFrame->maGeometry.nTopDecoration = nFrameY + nCaptionY; 2957cdf0e10cSrcweir pFrame->maGeometry.nLeftDecoration = nFrameX; 2958cdf0e10cSrcweir pFrame->maGeometry.nRightDecoration = nFrameX; 2959cdf0e10cSrcweir pFrame->maGeometry.nBottomDecoration = nFrameY; 2960cdf0e10cSrcweir 2961cdf0e10cSrcweir // position of client area, not of frame corner! 2962cdf0e10cSrcweir pFrame->maGeometry.nX = swp.x + nFrameX; 2963cdf0e10cSrcweir pFrame->maGeometry.nY = nScreenHeight - (swp.y + swp.cy) + nFrameY + nCaptionY; 2964cdf0e10cSrcweir 2965cdf0e10cSrcweir int nWidth = swp.cx - pFrame->maGeometry.nRightDecoration - pFrame->maGeometry.nLeftDecoration; 2966cdf0e10cSrcweir int nHeight = swp.cy - pFrame->maGeometry.nBottomDecoration - pFrame->maGeometry.nTopDecoration; 2967cdf0e10cSrcweir 2968cdf0e10cSrcweir // clamp to zero 2969cdf0e10cSrcweir pFrame->maGeometry.nHeight = nHeight < 0 ? 0 : nHeight; 2970cdf0e10cSrcweir pFrame->maGeometry.nWidth = nWidth < 0 ? 0 : nWidth; 2971cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 2972cdf0e10cSrcweir debug_printf( "UpdateFrameGeometry: hwnd %x, frame %x at %d,%d (%dx%d)\n", 2973cdf0e10cSrcweir hWnd, pFrame->mhWndFrame, 2974cdf0e10cSrcweir pFrame->maGeometry.nX, pFrame->maGeometry.nY, 2975cdf0e10cSrcweir pFrame->maGeometry.nWidth,pFrame->maGeometry.nHeight); 2976cdf0e10cSrcweir #endif 2977cdf0e10cSrcweir } 2978cdf0e10cSrcweir 2979cdf0e10cSrcweir // ----------------------------------------------------------------------- 2980cdf0e10cSrcweir 2981cdf0e10cSrcweir static void ImplHandleMoveMsg( HWND hWnd) 2982cdf0e10cSrcweir { 2983cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2984cdf0e10cSrcweir { 2985cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2986cdf0e10cSrcweir if ( pFrame ) 2987cdf0e10cSrcweir { 2988cdf0e10cSrcweir UpdateFrameGeometry( hWnd, pFrame ); 2989cdf0e10cSrcweir 2990cdf0e10cSrcweir if ( WinIsWindowVisible( hWnd )) 2991cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 2992cdf0e10cSrcweir 2993cdf0e10cSrcweir // Gegen moegliche Rekursionen sichern 2994cdf0e10cSrcweir if ( !pFrame->mbInMoveMsg ) 2995cdf0e10cSrcweir { 2996cdf0e10cSrcweir // Fenster im FullScreenModus wieder einpassen 2997cdf0e10cSrcweir pFrame->mbInMoveMsg = TRUE; 2998cdf0e10cSrcweir if ( pFrame->mbFullScreen ) 2999cdf0e10cSrcweir ImplSalFrameFullScreenPos( pFrame ); 3000cdf0e10cSrcweir pFrame->mbInMoveMsg = FALSE; 3001cdf0e10cSrcweir } 3002cdf0e10cSrcweir 3003cdf0e10cSrcweir // Status merken 3004cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 3005cdf0e10cSrcweir 3006cdf0e10cSrcweir // Call Hdl 3007cdf0e10cSrcweir //#93851 if we call this handler, VCL floating windows are not updated correctly 3008cdf0e10cSrcweir //ImplCallMoveHdl( hWnd ); 3009cdf0e10cSrcweir 3010cdf0e10cSrcweir } 3011cdf0e10cSrcweir 3012cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3013cdf0e10cSrcweir } 3014cdf0e10cSrcweir else 3015cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); 3016cdf0e10cSrcweir } 3017cdf0e10cSrcweir 3018cdf0e10cSrcweir // ----------------------------------------------------------------------- 3019cdf0e10cSrcweir 3020cdf0e10cSrcweir static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) 3021cdf0e10cSrcweir { 3022cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3023cdf0e10cSrcweir if ( pFrame ) 3024cdf0e10cSrcweir { 3025cdf0e10cSrcweir UpdateFrameGeometry( hWnd, pFrame ); 3026cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 3027cdf0e10cSrcweir pFrame->mnWidth = (short)SHORT1FROMMP( nMP2 ); 3028cdf0e10cSrcweir pFrame->mnHeight = (short)SHORT2FROMMP( nMP2 ); 3029cdf0e10cSrcweir if ( pFrame->mpGraphics ) 3030cdf0e10cSrcweir pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); 3031cdf0e10cSrcweir // Status merken 3032cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 3033cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_RESIZE, 0 ); 3034cdf0e10cSrcweir if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) 3035cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 3036cdf0e10cSrcweir } 3037cdf0e10cSrcweir } 3038cdf0e10cSrcweir 3039cdf0e10cSrcweir // ----------------------------------------------------------------------- 3040cdf0e10cSrcweir 3041cdf0e10cSrcweir static long ImplHandleFocusMsg( Os2SalFrame* pFrame, MPARAM nMP2 ) 3042cdf0e10cSrcweir { 3043cdf0e10cSrcweir if ( pFrame && !Os2SalFrame::mbInReparent ) 3044cdf0e10cSrcweir { 3045cdf0e10cSrcweir if ( SHORT1FROMMP( nMP2 ) ) 3046cdf0e10cSrcweir { 3047cdf0e10cSrcweir if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) 3048cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 3049cdf0e10cSrcweir return pFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); 3050cdf0e10cSrcweir } 3051cdf0e10cSrcweir else 3052cdf0e10cSrcweir { 3053cdf0e10cSrcweir return pFrame->CallCallback( SALEVENT_LOSEFOCUS, 0 ); 3054cdf0e10cSrcweir } 3055cdf0e10cSrcweir } 3056cdf0e10cSrcweir } 3057cdf0e10cSrcweir 3058cdf0e10cSrcweir // ----------------------------------------------------------------------- 3059cdf0e10cSrcweir 3060cdf0e10cSrcweir static void ImplHandleCloseMsg( HWND hWnd ) 3061cdf0e10cSrcweir { 3062cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3063cdf0e10cSrcweir { 3064cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3065cdf0e10cSrcweir if ( pFrame ) 3066cdf0e10cSrcweir { 3067cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_CLOSE, 0 ); 3068cdf0e10cSrcweir } 3069cdf0e10cSrcweir 3070cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3071cdf0e10cSrcweir } 3072cdf0e10cSrcweir else 3073cdf0e10cSrcweir WinPostMsg( hWnd, WM_CLOSE, 0, 0 ); 3074cdf0e10cSrcweir } 3075cdf0e10cSrcweir 3076cdf0e10cSrcweir // ----------------------------------------------------------------------- 3077cdf0e10cSrcweir 3078cdf0e10cSrcweir inline void ImplHandleUserEvent( HWND hWnd, MPARAM nMP2 ) 3079cdf0e10cSrcweir { 3080cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3081cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3082cdf0e10cSrcweir if ( pFrame ) 3083cdf0e10cSrcweir { 3084cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_USEREVENT, (void*)nMP2 ); 3085cdf0e10cSrcweir } 3086cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3087cdf0e10cSrcweir } 3088cdf0e10cSrcweir 3089cdf0e10cSrcweir // ----------------------------------------------------------------------- 3090cdf0e10cSrcweir 3091cdf0e10cSrcweir static int SalImplHandleProcessMenu( Os2SalFrame* pFrame, ULONG nMsg, MPARAM nMP1, MPARAM nMP2) 3092cdf0e10cSrcweir { 3093cdf0e10cSrcweir long nRet = 0; 3094cdf0e10cSrcweir debug_printf("SalImplHandleProcessMenu\n"); 3095cdf0e10cSrcweir #if 0 3096cdf0e10cSrcweir DWORD err=0; 3097cdf0e10cSrcweir if( !HIWORD(wParam) ) 3098cdf0e10cSrcweir { 3099cdf0e10cSrcweir // Menu command 3100cdf0e10cSrcweir WORD nId = LOWORD(wParam); 3101cdf0e10cSrcweir if( nId ) // zero for separators 3102cdf0e10cSrcweir { 3103cdf0e10cSrcweir SalMenuEvent aMenuEvt; 3104cdf0e10cSrcweir aMenuEvt.mnId = nId; 3105cdf0e10cSrcweir WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( pFrame->mSelectedhMenu, nId, FALSE ); 3106cdf0e10cSrcweir if( pSalMenuItem ) 3107cdf0e10cSrcweir aMenuEvt.mpMenu = pSalMenuItem->mpMenu; 3108cdf0e10cSrcweir else 3109cdf0e10cSrcweir aMenuEvt.mpMenu = NULL; 3110cdf0e10cSrcweir 3111cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_MENUCOMMAND, &aMenuEvt ); 3112cdf0e10cSrcweir } 3113cdf0e10cSrcweir } 3114cdf0e10cSrcweir #endif 3115cdf0e10cSrcweir //return (nRet != 0); 3116cdf0e10cSrcweir return (nRet == 0); 3117cdf0e10cSrcweir } 3118cdf0e10cSrcweir 3119cdf0e10cSrcweir // ----------------------------------------------------------------------- 3120cdf0e10cSrcweir 3121cdf0e10cSrcweir static void ImplHandleInputLangChange( HWND hWnd ) 3122cdf0e10cSrcweir { 3123cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3124cdf0e10cSrcweir 3125cdf0e10cSrcweir // Feststellen, ob wir IME unterstuetzen 3126cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3127cdf0e10cSrcweir #if 0 3128cdf0e10cSrcweir if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) 3129cdf0e10cSrcweir { 3130cdf0e10cSrcweir HWND hWnd = pFrame->mhWnd; 3131cdf0e10cSrcweir HKL hKL = (HKL)lParam; 3132cdf0e10cSrcweir UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); 3133cdf0e10cSrcweir 3134cdf0e10cSrcweir pFrame->mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0; 3135cdf0e10cSrcweir pFrame->mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0; 3136cdf0e10cSrcweir pFrame->mbHandleIME = !pFrame->mbSpezIME; 3137cdf0e10cSrcweir } 3138cdf0e10cSrcweir #endif 3139cdf0e10cSrcweir 3140cdf0e10cSrcweir // trigger input language and codepage update 3141cdf0e10cSrcweir UINT nLang = pFrame->mnInputLang; 3142cdf0e10cSrcweir ImplUpdateInputLang( pFrame ); 3143cdf0e10cSrcweir debug_printf("ImplHandleInputLangChange new language 0x%04x\n",pFrame->mnInputLang); 3144cdf0e10cSrcweir 3145cdf0e10cSrcweir // notify change 3146cdf0e10cSrcweir if( nLang != pFrame->mnInputLang ) 3147cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_INPUTLANGUAGECHANGE, 0 ); 3148cdf0e10cSrcweir 3149cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3150cdf0e10cSrcweir } 3151cdf0e10cSrcweir 3152cdf0e10cSrcweir // ----------------------------------------------------------------------- 3153cdf0e10cSrcweir 3154cdf0e10cSrcweir #ifdef ENABLE_IME 3155cdf0e10cSrcweir 3156cdf0e10cSrcweir static long ImplHandleIMEStartConversion( Os2SalFrame* pFrame ) 3157cdf0e10cSrcweir { 3158cdf0e10cSrcweir long nRet = FALSE; 3159cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3160cdf0e10cSrcweir if ( pIMEData ) 3161cdf0e10cSrcweir { 3162cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3163cdf0e10cSrcweir HIMI hIMI = 0; 3164cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3165cdf0e10cSrcweir if ( hIMI ) 3166cdf0e10cSrcweir { 3167cdf0e10cSrcweir ULONG nProp; 3168cdf0e10cSrcweir if ( 0 != pIMEData->mpQueryIMEProperty( hIMI, QIP_PROPERTY, &nProp ) ) 3169cdf0e10cSrcweir pFrame->mbHandleIME = FALSE; 3170cdf0e10cSrcweir else 3171cdf0e10cSrcweir { 3172cdf0e10cSrcweir pFrame->mbHandleIME = !(nProp & PRP_SPECIALUI); 3173cdf0e10cSrcweir 3174cdf0e10cSrcweir } 3175cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3176cdf0e10cSrcweir { 3177cdf0e10cSrcweir /* Windows-Code, der noch nicht angepasst wurde !!! 3178cdf0e10cSrcweir // Cursor-Position ermitteln und aus der die Default-Position fuer 3179cdf0e10cSrcweir // das Composition-Fenster berechnen 3180cdf0e10cSrcweir SalCursorPosEvent aCursorPosEvt; 3181cdf0e10cSrcweir pFrame->CallCallback( pFrame->mpInst, pFrame, 3182cdf0e10cSrcweir SALEVENT_CURSORPOS, (void*)&aCursorPosEvt ); 3183cdf0e10cSrcweir COMPOSITIONFORM aForm; 3184cdf0e10cSrcweir memset( &aForm, 0, sizeof( aForm ) ); 3185cdf0e10cSrcweir if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight ) 3186cdf0e10cSrcweir aForm.dwStyle |= CFS_DEFAULT; 3187cdf0e10cSrcweir else 3188cdf0e10cSrcweir { 3189cdf0e10cSrcweir aForm.dwStyle |= CFS_POINT; 3190cdf0e10cSrcweir aForm.ptCurrentPos.x = aCursorPosEvt.mnX; 3191cdf0e10cSrcweir aForm.ptCurrentPos.y = aCursorPosEvt.mnY; 3192cdf0e10cSrcweir } 3193cdf0e10cSrcweir ImmSetCompositionWindow( hIMC, &aForm ); 3194cdf0e10cSrcweir 3195cdf0e10cSrcweir // Den InputContect-Font ermitteln und diesem dem Composition-Fenster 3196cdf0e10cSrcweir // bekannt machen 3197cdf0e10cSrcweir */ 3198cdf0e10cSrcweir 3199cdf0e10cSrcweir pFrame->mbConversionMode = TRUE; 3200cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_STARTEXTTEXTINPUT, (void*)NULL ); 3201cdf0e10cSrcweir nRet = TRUE; 3202cdf0e10cSrcweir } 3203cdf0e10cSrcweir 3204cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3205cdf0e10cSrcweir } 3206cdf0e10cSrcweir } 3207cdf0e10cSrcweir 3208cdf0e10cSrcweir return nRet; 3209cdf0e10cSrcweir } 3210cdf0e10cSrcweir 3211cdf0e10cSrcweir // ----------------------------------------------------------------------- 3212cdf0e10cSrcweir 3213cdf0e10cSrcweir static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) 3214cdf0e10cSrcweir { 3215cdf0e10cSrcweir long nRet = FALSE; 3216cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3217cdf0e10cSrcweir if ( pIMEData ) 3218cdf0e10cSrcweir { 3219cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3220cdf0e10cSrcweir HIMI hIMI = 0; 3221cdf0e10cSrcweir ULONG nMP2 = (ULONG)nMP2Param; 3222cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3223cdf0e10cSrcweir if ( hIMI ) 3224cdf0e10cSrcweir { 3225cdf0e10cSrcweir if ( nMP2 & (IMR_RESULT_RESULTSTRING | 3226cdf0e10cSrcweir IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | 3227cdf0e10cSrcweir IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) 3228cdf0e10cSrcweir { 3229cdf0e10cSrcweir SalExtTextInputEvent aEvt; 3230cdf0e10cSrcweir aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 3231cdf0e10cSrcweir aEvt.mpTextAttr = NULL; 3232cdf0e10cSrcweir aEvt.mnCursorPos = 0; 3233cdf0e10cSrcweir aEvt.mnDeltaStart = 0; 3234cdf0e10cSrcweir aEvt.mbOnlyCursor = FALSE; 3235cdf0e10cSrcweir aEvt.mbCursorVisible = TRUE; 3236cdf0e10cSrcweir 3237cdf0e10cSrcweir ULONG nBufLen = 0; 3238cdf0e10cSrcweir xub_Unicode* pBuf = NULL; 3239cdf0e10cSrcweir ULONG nAttrBufLen = 0; 3240cdf0e10cSrcweir PM_BYTE* pAttrBuf = NULL; 3241cdf0e10cSrcweir BOOL bLastCursor = FALSE; 3242cdf0e10cSrcweir if ( nMP2 & IMR_RESULT_RESULTSTRING ) 3243cdf0e10cSrcweir { 3244cdf0e10cSrcweir pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen ); 3245cdf0e10cSrcweir if ( nBufLen > 0 ) 3246cdf0e10cSrcweir { 3247cdf0e10cSrcweir pBuf = new xub_Unicode[nBufLen]; 3248cdf0e10cSrcweir pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, pBuf, &nBufLen ); 3249cdf0e10cSrcweir } 3250cdf0e10cSrcweir 3251cdf0e10cSrcweir bLastCursor = TRUE; 3252cdf0e10cSrcweir aEvt.mbCursorVisible = TRUE; 3253cdf0e10cSrcweir } 3254cdf0e10cSrcweir else if ( nMP2 & (IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | 3255cdf0e10cSrcweir IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) 3256cdf0e10cSrcweir { 3257cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); 3258cdf0e10cSrcweir if ( nBufLen > 0 ) 3259cdf0e10cSrcweir { 3260cdf0e10cSrcweir pBuf = new xub_Unicode[nBufLen]; 3261cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, pBuf, &nBufLen ); 3262cdf0e10cSrcweir } 3263cdf0e10cSrcweir 3264cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, 0, &nAttrBufLen ); 3265cdf0e10cSrcweir if ( nAttrBufLen > 0 ) 3266cdf0e10cSrcweir { 3267cdf0e10cSrcweir pAttrBuf = new PM_BYTE[nAttrBufLen]; 3268cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, pAttrBuf, &nAttrBufLen ); 3269cdf0e10cSrcweir } 3270cdf0e10cSrcweir 3271cdf0e10cSrcweir /* !!! Wir bekommen derzeit nur falsche Daten, deshalb zeigen wir derzeit 3272cdf0e10cSrcweir !!! auch keine Cursor an 3273cdf0e10cSrcweir ULONG nTempBufLen; 3274cdf0e10cSrcweir ULONG nCursorPos = 0; 3275cdf0e10cSrcweir ULONG nCursorAttr = 0; 3276cdf0e10cSrcweir ULONG nChangePos = 0; 3277cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3278cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); 3279cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3280cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORATTR, &nCursorAttr, &nTempBufLen ); 3281cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3282cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CHANGESTART, &nChangePos, &nTempBufLen ); 3283cdf0e10cSrcweir 3284cdf0e10cSrcweir aEvt.mnCursorPos = nCursorPos; 3285cdf0e10cSrcweir aEvt.mnDeltaStart = nChangePos; 3286cdf0e10cSrcweir if ( nCursorAttr & CP_CURSORATTR_INVISIBLE ) 3287cdf0e10cSrcweir aEvt.mbCursorVisible = FALSE; 3288cdf0e10cSrcweir */ 3289cdf0e10cSrcweir aEvt.mnCursorPos = 0; 3290cdf0e10cSrcweir aEvt.mnDeltaStart = 0; 3291cdf0e10cSrcweir aEvt.mbCursorVisible = FALSE; 3292cdf0e10cSrcweir 3293cdf0e10cSrcweir if ( (nMP2 == IMR_CONV_CURSORPOS) || 3294cdf0e10cSrcweir (nMP2 == IMR_CONV_CURSORATTR) ) 3295cdf0e10cSrcweir aEvt.mbOnlyCursor = TRUE; 3296cdf0e10cSrcweir } 3297cdf0e10cSrcweir 3298cdf0e10cSrcweir USHORT* pSalAttrAry = NULL; 3299cdf0e10cSrcweir if ( pBuf ) 3300cdf0e10cSrcweir { 3301cdf0e10cSrcweir aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); 3302cdf0e10cSrcweir delete [] pBuf; 3303cdf0e10cSrcweir if ( pAttrBuf ) 3304cdf0e10cSrcweir { 3305cdf0e10cSrcweir USHORT nTextLen = aEvt.maText.Len(); 3306cdf0e10cSrcweir if ( nTextLen ) 3307cdf0e10cSrcweir { 3308cdf0e10cSrcweir pSalAttrAry = new USHORT[nTextLen]; 3309cdf0e10cSrcweir memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) ); 3310cdf0e10cSrcweir for ( USHORT i = 0; (i < nTextLen) && (i < nAttrBufLen); i++ ) 3311cdf0e10cSrcweir { 3312cdf0e10cSrcweir PM_BYTE nOS2Attr = pAttrBuf[i]; 3313cdf0e10cSrcweir USHORT nSalAttr; 3314cdf0e10cSrcweir if ( nOS2Attr == CP_ATTR_TARGET_CONVERTED ) 3315cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT; 3316cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_CONVERTED ) 3317cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE; 3318cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_TARGET_NOTCONVERTED ) 3319cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3320cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_INPUT_ERROR ) 3321cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3322cdf0e10cSrcweir else /* ( nOS2Attr == CP_ATTR_INPUT ) */ 3323cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3324cdf0e10cSrcweir pSalAttrAry[i] = nSalAttr; 3325cdf0e10cSrcweir } 3326cdf0e10cSrcweir aEvt.mpTextAttr = pSalAttrAry; 3327cdf0e10cSrcweir } 3328cdf0e10cSrcweir delete [] pAttrBuf; 3329cdf0e10cSrcweir } 3330cdf0e10cSrcweir if ( bLastCursor ) 3331cdf0e10cSrcweir aEvt.mnCursorPos = aEvt.maText.Len(); 3332cdf0e10cSrcweir } 3333cdf0e10cSrcweir 3334cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3335cdf0e10cSrcweir 3336cdf0e10cSrcweir // Handler rufen und wenn wir ein Attribute-Array haben, danach 3337cdf0e10cSrcweir // wieder zerstoeren 3338cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); 3339cdf0e10cSrcweir if ( pSalAttrAry ) 3340cdf0e10cSrcweir delete [] pSalAttrAry; 3341cdf0e10cSrcweir } 3342cdf0e10cSrcweir else 3343cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3344cdf0e10cSrcweir } 3345cdf0e10cSrcweir 3346cdf0e10cSrcweir nRet = TRUE; 3347cdf0e10cSrcweir } 3348cdf0e10cSrcweir 3349cdf0e10cSrcweir return nRet; 3350cdf0e10cSrcweir } 3351cdf0e10cSrcweir 3352cdf0e10cSrcweir // ----------------------------------------------------------------------- 3353cdf0e10cSrcweir 3354cdf0e10cSrcweir inline long ImplHandleIMEEndConversion( Os2SalFrame* pFrame ) 3355cdf0e10cSrcweir { 3356cdf0e10cSrcweir pFrame->mbConversionMode = FALSE; 3357cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL ); 3358cdf0e10cSrcweir return TRUE; 3359cdf0e10cSrcweir } 3360cdf0e10cSrcweir 3361cdf0e10cSrcweir // ----------------------------------------------------------------------- 3362cdf0e10cSrcweir 3363cdf0e10cSrcweir static void ImplHandleIMEOpenCandidate( Os2SalFrame* pFrame ) 3364cdf0e10cSrcweir { 3365cdf0e10cSrcweir pFrame->mbCandidateMode = TRUE; 3366cdf0e10cSrcweir 3367cdf0e10cSrcweir long nRet = FALSE; 3368cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3369cdf0e10cSrcweir if ( pIMEData ) 3370cdf0e10cSrcweir { 3371cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3372cdf0e10cSrcweir HIMI hIMI = 0; 3373cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3374cdf0e10cSrcweir if ( hIMI ) 3375cdf0e10cSrcweir { 3376cdf0e10cSrcweir ULONG nBufLen = 0; 3377cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); 3378cdf0e10cSrcweir if ( nBufLen > 0 ) 3379cdf0e10cSrcweir { 3380cdf0e10cSrcweir /* !!! Wir bekommen derzeit nur falsche Daten steht der Cursor immer bei 0 3381cdf0e10cSrcweir ULONG nTempBufLen = sizeof( ULONG ); 3382cdf0e10cSrcweir ULONG nCursorPos = 0; 3383cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); 3384cdf0e10cSrcweir */ 3385cdf0e10cSrcweir ULONG nCursorPos = 0; 3386cdf0e10cSrcweir 3387cdf0e10cSrcweir SalExtTextInputPosEvent aEvt; 3388cdf0e10cSrcweir aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 3389cdf0e10cSrcweir aEvt.mnFirstPos = nCursorPos; 3390cdf0e10cSrcweir aEvt.mnChars = nBufLen-nCursorPos; 3391cdf0e10cSrcweir aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars]; 3392cdf0e10cSrcweir memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) ); 3393cdf0e10cSrcweir 3394cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt ); 3395cdf0e10cSrcweir 3396cdf0e10cSrcweir long nMinLeft = aEvt.mpPosAry[0].mnX; 3397cdf0e10cSrcweir long nMinTop = aEvt.mpPosAry[0].mnY; 3398cdf0e10cSrcweir long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight; 3399cdf0e10cSrcweir long nMaxRight = nMinLeft; 3400cdf0e10cSrcweir USHORT i = 0; 3401cdf0e10cSrcweir while ( i < aEvt.mnChars ) 3402cdf0e10cSrcweir { 3403cdf0e10cSrcweir // Solange wir uns auf der gleichen Zeile bewegen, 3404cdf0e10cSrcweir // ermitteln wir die Rechteck-Grenzen 3405cdf0e10cSrcweir if ( !aEvt.mpPosAry[i].mnHeight || 3406cdf0e10cSrcweir (aEvt.mpPosAry[i].mnY < nMaxBottom-1) ) 3407cdf0e10cSrcweir { 3408cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnX < nMinLeft ) 3409cdf0e10cSrcweir nMinLeft = aEvt.mpPosAry[i].mnX; 3410cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight ) 3411cdf0e10cSrcweir nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth; 3412cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnY < nMinTop ) 3413cdf0e10cSrcweir nMinTop = aEvt.mpPosAry[i].mnY; 3414cdf0e10cSrcweir i++; 3415cdf0e10cSrcweir } 3416cdf0e10cSrcweir else 3417cdf0e10cSrcweir break; 3418cdf0e10cSrcweir } 3419cdf0e10cSrcweir 3420cdf0e10cSrcweir CANDIDATEPOS aForm; 3421cdf0e10cSrcweir aForm.ulIndex = 0; 3422cdf0e10cSrcweir aForm.ulStyle = CPS_EXCLUDE; 3423cdf0e10cSrcweir aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX; 3424cdf0e10cSrcweir aForm.ptCurrentPos.y = pFrame->mnHeight - (nMaxBottom+1) - 1; 3425cdf0e10cSrcweir aForm.rcArea.xLeft = nMinLeft; 3426cdf0e10cSrcweir aForm.rcArea.yBottom = pFrame->mnHeight - nMaxBottom - 1; 3427cdf0e10cSrcweir aForm.rcArea.xRight = nMaxRight+1; 3428cdf0e10cSrcweir aForm.rcArea.yTop = pFrame->mnHeight - nMinTop - 1; 3429cdf0e10cSrcweir pIMEData->mpSetCandidateWin( hIMI, &aForm ); 3430cdf0e10cSrcweir 3431cdf0e10cSrcweir delete aEvt.mpPosAry; 3432cdf0e10cSrcweir } 3433cdf0e10cSrcweir 3434cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3435cdf0e10cSrcweir } 3436cdf0e10cSrcweir } 3437cdf0e10cSrcweir } 3438cdf0e10cSrcweir 3439cdf0e10cSrcweir // ----------------------------------------------------------------------- 3440cdf0e10cSrcweir 3441cdf0e10cSrcweir inline void ImplHandleIMECloseCandidate( Os2SalFrame* pFrame ) 3442cdf0e10cSrcweir { 3443cdf0e10cSrcweir pFrame->mbCandidateMode = FALSE; 3444cdf0e10cSrcweir } 3445cdf0e10cSrcweir 3446cdf0e10cSrcweir #endif 3447cdf0e10cSrcweir 3448cdf0e10cSrcweir // ----------------------------------------------------------------------- 3449cdf0e10cSrcweir 3450cdf0e10cSrcweir MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, 3451cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 3452cdf0e10cSrcweir { 3453cdf0e10cSrcweir Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( hWnd ); 3454cdf0e10cSrcweir MRESULT nRet = (MRESULT)0; 3455cdf0e10cSrcweir BOOL bDef = TRUE; 3456cdf0e10cSrcweir bool bCheckTimers= false; 3457cdf0e10cSrcweir 3458cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 3459cdf0e10cSrcweir if (nMsg!=WM_TIMER && nMsg!=WM_MOUSEMOVE) 3460cdf0e10cSrcweir debug_printf( "SalFrameWndProc hWnd 0x%x nMsg 0x%x\n", hWnd, nMsg); 3461cdf0e10cSrcweir #endif 3462cdf0e10cSrcweir 3463cdf0e10cSrcweir switch( nMsg ) 3464cdf0e10cSrcweir { 3465cdf0e10cSrcweir case WM_MOUSEMOVE: 3466cdf0e10cSrcweir case WM_BUTTON1DOWN: 3467cdf0e10cSrcweir case WM_BUTTON2DOWN: 3468cdf0e10cSrcweir case WM_BUTTON3DOWN: 3469cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 3470cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 3471cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 3472cdf0e10cSrcweir case WM_BUTTON1UP: 3473cdf0e10cSrcweir case WM_BUTTON2UP: 3474cdf0e10cSrcweir case WM_BUTTON3UP: 3475cdf0e10cSrcweir case SAL_MSG_MOUSELEAVE: 3476cdf0e10cSrcweir // ButtonUp/Down nie an die WinDefWindowProc weiterleiten, weil sonst 3477cdf0e10cSrcweir // die Message an den Owner weitergeleitet wird 3478cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3479cdf0e10cSrcweir bDef = !ImplHandleMouseMsg( hWnd, nMsg, nMP1, nMP2 ); 3480cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3481cdf0e10cSrcweir break; 3482cdf0e10cSrcweir 3483cdf0e10cSrcweir case WM_CHAR: 3484cdf0e10cSrcweir if ( pFrame->mbConversionMode ) 3485cdf0e10cSrcweir bDef = FALSE; 3486cdf0e10cSrcweir else 3487cdf0e10cSrcweir bDef = !ImplHandleKeyMsg( hWnd, nMsg, nMP1, nMP2 ); 3488cdf0e10cSrcweir break; 3489cdf0e10cSrcweir 3490cdf0e10cSrcweir case WM_ERASEBACKGROUND: 3491cdf0e10cSrcweir nRet = (MRESULT)FALSE; 3492cdf0e10cSrcweir bDef = FALSE; 3493cdf0e10cSrcweir break; 3494cdf0e10cSrcweir 3495cdf0e10cSrcweir case WM_PAINT: 3496cdf0e10cSrcweir bCheckTimers = ImplHandlePaintMsg( hWnd ); 3497cdf0e10cSrcweir bDef = FALSE; 3498cdf0e10cSrcweir break; 3499cdf0e10cSrcweir case SAL_MSG_POSTPAINT: 3500cdf0e10cSrcweir ImplHandlePaintMsg2( hWnd, (RECTL*)nMP1 ); 3501cdf0e10cSrcweir bCheckTimers = true; 3502cdf0e10cSrcweir bDef = FALSE; 3503cdf0e10cSrcweir break; 3504cdf0e10cSrcweir 3505cdf0e10cSrcweir case WM_MOVE: 3506cdf0e10cSrcweir case SAL_MSG_POSTMOVE: 3507cdf0e10cSrcweir ImplHandleMoveMsg( hWnd ); 3508cdf0e10cSrcweir bDef = FALSE; 3509cdf0e10cSrcweir break; 3510cdf0e10cSrcweir 3511cdf0e10cSrcweir case WM_SIZE: 3512cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3513cdf0e10cSrcweir { 3514cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, nMP2 ); 3515cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3516cdf0e10cSrcweir } 3517cdf0e10cSrcweir else 3518cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTSIZE, nMP1, nMP2 ); 3519cdf0e10cSrcweir break; 3520cdf0e10cSrcweir case SAL_MSG_POSTSIZE: 3521cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, nMP2 ); 3522cdf0e10cSrcweir break; 3523cdf0e10cSrcweir case WM_MINMAXFRAME: 3524cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3525cdf0e10cSrcweir { 3526cdf0e10cSrcweir PSWP pswp = (PSWP) nMP1; 3527cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, MPFROM2SHORT( pswp->cx, pswp->cy) ); 3528cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3529cdf0e10cSrcweir } 3530cdf0e10cSrcweir else 3531cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTSIZE, 0, nMP2 ); 3532cdf0e10cSrcweir break; 3533cdf0e10cSrcweir 3534cdf0e10cSrcweir case WM_CALCVALIDRECTS: 3535cdf0e10cSrcweir return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 3536cdf0e10cSrcweir 3537cdf0e10cSrcweir case WM_SETFOCUS: 3538cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3539cdf0e10cSrcweir { 3540cdf0e10cSrcweir ImplHandleFocusMsg( pFrame, nMP2 ); 3541cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3542cdf0e10cSrcweir } 3543cdf0e10cSrcweir else 3544cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTFOCUS, 0, nMP2 ); 3545cdf0e10cSrcweir break; 3546cdf0e10cSrcweir case SAL_MSG_POSTFOCUS: 3547cdf0e10cSrcweir ImplHandleFocusMsg( pFrame, nMP2 ); 3548cdf0e10cSrcweir break; 3549cdf0e10cSrcweir 3550cdf0e10cSrcweir case WM_TRANSLATEACCEL: 3551cdf0e10cSrcweir { 3552cdf0e10cSrcweir // Da uns OS/2 zu viele Tasten abfaegnt, unternehmen wir etwas, 3553cdf0e10cSrcweir // damit wir Shift+F1, Shift+F10 und Shift+Enter bekommen 3554cdf0e10cSrcweir PQMSG pMsg = (PQMSG)nMP1; 3555cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( pMsg->mp1 ); 3556cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( pMsg->mp2 ); 3557cdf0e10cSrcweir 3558cdf0e10cSrcweir if ( !(nKeyFlags & KC_KEYUP) && (nKeyFlags & KC_VIRTUALKEY) && 3559cdf0e10cSrcweir (nKeyFlags & KC_SHIFT) && (nKeyCode != VK_ESC) ) 3560cdf0e10cSrcweir return (MRESULT)FALSE; 3561cdf0e10cSrcweir 3562cdf0e10cSrcweir if ( nKeyCode == VK_F1 ) 3563cdf0e10cSrcweir return (MRESULT)FALSE; 3564cdf0e10cSrcweir } 3565cdf0e10cSrcweir break; 3566cdf0e10cSrcweir 3567cdf0e10cSrcweir case WM_CREATE: 3568cdf0e10cSrcweir { 3569cdf0e10cSrcweir HWND hWndFrame = WinQueryWindow(hWnd, QW_PARENT); 3570cdf0e10cSrcweir if (hWndFrame == 0) 3571cdf0e10cSrcweir debug_printf(" WARNING NULL FRAME!!\n"); 3572cdf0e10cSrcweir SalData* pSalData = GetSalData(); 3573cdf0e10cSrcweir // Window-Instanz am Windowhandle speichern 3574cdf0e10cSrcweir pFrame = pSalData->mpCreateFrame; 3575cdf0e10cSrcweir pSalData->mpCreateFrame = NULL; 3576cdf0e10cSrcweir SetWindowPtr( hWnd, pFrame ); 3577cdf0e10cSrcweir SetWindowPtr( hWndFrame, pFrame); 3578cdf0e10cSrcweir // HWND schon hier setzen, da schon auf den Instanzdaten 3579cdf0e10cSrcweir // gearbeitet werden kann, wenn Messages waehrend 3580cdf0e10cSrcweir // CreateWindow() gesendet werden 3581cdf0e10cSrcweir pFrame->mhWndClient = hWnd; 3582cdf0e10cSrcweir pFrame->mhWndFrame = hWndFrame; 3583cdf0e10cSrcweir pFrame->maSysData.hWnd = hWnd; 3584cdf0e10cSrcweir } 3585cdf0e10cSrcweir break; 3586cdf0e10cSrcweir 3587cdf0e10cSrcweir case WM_CLOSE: 3588cdf0e10cSrcweir ImplHandleCloseMsg( hWnd ); 3589cdf0e10cSrcweir bDef = FALSE; 3590cdf0e10cSrcweir break; 3591cdf0e10cSrcweir 3592cdf0e10cSrcweir case WM_SYSVALUECHANGED: 3593cdf0e10cSrcweir if ( pFrame->mbFullScreen ) 3594cdf0e10cSrcweir ImplSalFrameFullScreenPos( pFrame ); 3595cdf0e10cSrcweir // kein break, da der Rest auch noch verarbeitet werden soll 3596cdf0e10cSrcweir case PL_ALTERED: 3597cdf0e10cSrcweir case WM_SYSCOLORCHANGE: 3598cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3599cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_SETTINGSCHANGED, 0 ); 3600cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3601cdf0e10cSrcweir break; 3602cdf0e10cSrcweir 3603cdf0e10cSrcweir case SAL_MSG_USEREVENT: 3604cdf0e10cSrcweir ImplHandleUserEvent( hWnd, nMP2 ); 3605cdf0e10cSrcweir bDef = FALSE; 3606cdf0e10cSrcweir break; 3607cdf0e10cSrcweir case SAL_MSG_TOTOP: 3608cdf0e10cSrcweir ImplSalToTop( hWnd, (ULONG)nMP1 ); 3609cdf0e10cSrcweir bDef = FALSE; 3610cdf0e10cSrcweir break; 3611cdf0e10cSrcweir case SAL_MSG_SHOW: 3612cdf0e10cSrcweir ImplSalShow( hWnd, (ULONG)nMP1, (ULONG)nMP2 ); 3613cdf0e10cSrcweir bDef = FALSE; 3614cdf0e10cSrcweir break; 3615cdf0e10cSrcweir 3616cdf0e10cSrcweir case WM_KBDLAYERCHANGED: 3617cdf0e10cSrcweir debug_printf("hWnd 0x%08x WM_KBDLAYERCHANGED\n", hWnd); 3618cdf0e10cSrcweir ImplHandleInputLangChange( hWnd ); 3619cdf0e10cSrcweir break; 3620cdf0e10cSrcweir 3621cdf0e10cSrcweir case WM_HSCROLL: 3622cdf0e10cSrcweir case WM_VSCROLL: 3623cdf0e10cSrcweir ImplHandleWheelMsg( hWnd, nMsg, nMP1, nMP2 ); 3624cdf0e10cSrcweir bDef = FALSE; 3625cdf0e10cSrcweir break; 3626cdf0e10cSrcweir 3627cdf0e10cSrcweir case WM_COMMAND: 3628cdf0e10cSrcweir case SAL_MSG_SYSPROCESSMENU: 3629cdf0e10cSrcweir if ( SalImplHandleProcessMenu( pFrame, nMsg, nMP1, nMP2 ) ) 3630cdf0e10cSrcweir { 3631cdf0e10cSrcweir bDef = FALSE; 3632cdf0e10cSrcweir nRet = (MRESULT)1; 3633cdf0e10cSrcweir } 3634cdf0e10cSrcweir break; 3635cdf0e10cSrcweir 3636cdf0e10cSrcweir #ifdef ENABLE_IME 3637cdf0e10cSrcweir case WM_IMEREQUEST: 3638cdf0e10cSrcweir if ( (ULONG)nMP1 == IMR_CONVRESULT ) 3639cdf0e10cSrcweir { 3640cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3641cdf0e10cSrcweir { 3642cdf0e10cSrcweir // Nur im Conversionmodus akzeptieren wir den IME-Input 3643cdf0e10cSrcweir if ( pFrame->mbConversionMode ) 3644cdf0e10cSrcweir { 3645cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3646cdf0e10cSrcweir if ( ImplHandleIMEConversion( pFrame, nMP2 ) ) 3647cdf0e10cSrcweir { 3648cdf0e10cSrcweir bDef = FALSE; 3649cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3650cdf0e10cSrcweir } 3651cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3652cdf0e10cSrcweir } 3653cdf0e10cSrcweir } 3654cdf0e10cSrcweir } 3655cdf0e10cSrcweir else if ( (ULONG)nMP1 == IMR_CANDIDATE ) 3656cdf0e10cSrcweir { 3657cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3658cdf0e10cSrcweir { 3659cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3660cdf0e10cSrcweir if ( (ULONG)nMP2 & IMR_CANDIDATE_SHOW ) 3661cdf0e10cSrcweir ImplHandleIMEOpenCandidate( pFrame ); 3662cdf0e10cSrcweir else if ( (ULONG)nMP2 & IMR_CANDIDATE_HIDE ) 3663cdf0e10cSrcweir ImplHandleIMECloseCandidate( pFrame ); 3664cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3665cdf0e10cSrcweir } 3666cdf0e10cSrcweir } 3667cdf0e10cSrcweir break; 3668cdf0e10cSrcweir 3669cdf0e10cSrcweir case WM_IMENOTIFY: 3670cdf0e10cSrcweir if ( (ULONG)nMP1 == IMN_STARTCONVERSION ) 3671cdf0e10cSrcweir { 3672cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3673cdf0e10cSrcweir if ( ImplHandleIMEStartConversion( pFrame ) ) 3674cdf0e10cSrcweir { 3675cdf0e10cSrcweir bDef = FALSE; 3676cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3677cdf0e10cSrcweir } 3678cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3679cdf0e10cSrcweir } 3680cdf0e10cSrcweir else if ( (ULONG)nMP1 == IMN_ENDCONVERSION ) 3681cdf0e10cSrcweir { 3682cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3683cdf0e10cSrcweir { 3684cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3685cdf0e10cSrcweir if ( ImplHandleIMEEndConversion( pFrame ) ) 3686cdf0e10cSrcweir { 3687cdf0e10cSrcweir bDef = FALSE; 3688cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3689cdf0e10cSrcweir } 3690cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3691cdf0e10cSrcweir } 3692cdf0e10cSrcweir } 3693cdf0e10cSrcweir break; 3694cdf0e10cSrcweir #endif 3695cdf0e10cSrcweir } 3696cdf0e10cSrcweir 3697cdf0e10cSrcweir if( bCheckTimers ) 3698cdf0e10cSrcweir { 3699cdf0e10cSrcweir SalData* pSalData = GetSalData(); 3700cdf0e10cSrcweir if( pSalData->mnNextTimerTime ) 3701cdf0e10cSrcweir { 3702cdf0e10cSrcweir ULONG nCurTime; 3703cdf0e10cSrcweir DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID)&nCurTime, sizeof(ULONG)); 3704cdf0e10cSrcweir if( pSalData->mnNextTimerTime < nCurTime ) 3705cdf0e10cSrcweir { 3706cdf0e10cSrcweir QMSG aMsg; 3707cdf0e10cSrcweir if (!WinPeekMsg( pFrame->mhAB, &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) 3708cdf0e10cSrcweir WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, (MPARAM)nCurTime ); 3709cdf0e10cSrcweir } 3710cdf0e10cSrcweir } 3711cdf0e10cSrcweir } 3712cdf0e10cSrcweir 3713cdf0e10cSrcweir if ( bDef ) 3714cdf0e10cSrcweir nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); 3715cdf0e10cSrcweir 3716cdf0e10cSrcweir return nRet; 3717cdf0e10cSrcweir } 3718cdf0e10cSrcweir 3719cdf0e10cSrcweir // ----------------------------------------------------------------------- 3720cdf0e10cSrcweir 3721cdf0e10cSrcweir void Os2SalFrame::ResetClipRegion() 3722cdf0e10cSrcweir { 3723cdf0e10cSrcweir } 3724cdf0e10cSrcweir 3725cdf0e10cSrcweir void Os2SalFrame::BeginSetClipRegion( ULONG ) 3726cdf0e10cSrcweir { 3727cdf0e10cSrcweir } 3728cdf0e10cSrcweir 3729cdf0e10cSrcweir void Os2SalFrame::UnionClipRegion( long, long, long, long ) 3730cdf0e10cSrcweir { 3731cdf0e10cSrcweir } 3732cdf0e10cSrcweir 3733cdf0e10cSrcweir void Os2SalFrame::EndSetClipRegion() 3734cdf0e10cSrcweir { 3735cdf0e10cSrcweir } 3736cdf0e10cSrcweir 3737cdf0e10cSrcweir // ----------------------------------------------------------------------- 3738cdf0e10cSrcweir 3739cdf0e10cSrcweir MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, 3740cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 3741cdf0e10cSrcweir { 3742cdf0e10cSrcweir MRESULT mReturn = 0L; 3743cdf0e10cSrcweir 3744cdf0e10cSrcweir // ticket#124 min size of 132 px is too much 3745cdf0e10cSrcweir if (nMsg == WM_QUERYTRACKINFO) { 3746cdf0e10cSrcweir PTRACKINFO pti; 3747cdf0e10cSrcweir // first, let PM initialize TRACKINFO 3748cdf0e10cSrcweir mReturn = aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); 3749cdf0e10cSrcweir // now change default min size 3750cdf0e10cSrcweir pti = (PTRACKINFO) nMP2; 3751cdf0e10cSrcweir pti->ptlMinTrackSize.x = 64L; 3752cdf0e10cSrcweir // now return to PM 3753cdf0e10cSrcweir return mReturn; 3754cdf0e10cSrcweir } 3755cdf0e10cSrcweir 3756cdf0e10cSrcweir return aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); 3757cdf0e10cSrcweir } 3758cdf0e10cSrcweir 3759cdf0e10cSrcweir // ----------------------------------------------------------------------- 3760