Changeset 10216 for trunk/src


Ignore:
Timestamp:
Aug 8, 2003, 3:30:22 PM (22 years ago)
Author:
sandervl
Message:

KOM: WM_IME_CHAR generation + processing added for DBCS input

Location:
trunk/src/user32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/combo.c

    r9524 r10216  
    4949 * Drawing globals
    5050 */
    51 static HBITMAP  hComboBmp = 0;
    52 static UINT     CBitHeight, CBitWidth;
     51static HBITMAP  hComboBmp = 0;
     52static UINT CBitHeight, CBitWidth;
    5353
    5454/*
     
    8787static BOOL COMBO_Init()
    8888{
    89   HDC           hDC;
     89  HDC       hDC;
    9090
    9191  if( hComboBmp ) return TRUE;
    9292  if( (hDC = CreateCompatibleDC(0)) )
    9393  {
    94     BOOL        bRet = FALSE;
     94    BOOL    bRet = FALSE;
    9595    if( (hComboBmp = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO))) )
    9696    {
     
    131131       /* some braindead apps do try to use scrollbar/border flags */
    132132
    133         lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
     133    lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
    134134        SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
    135135
    136         /*
    137         * We also have to remove the client edge style to make sure
    138         * we don't end-up with a non client area.
    139         */
     136    /*
     137    * We also have to remove the client edge style to make sure
     138    * we don't end-up with a non client area.
     139    */
    140140        SetWindowLongA( hwnd, GWL_EXSTYLE,
    141141                        GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
    142142
    143         if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
     143    if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
    144144              lphc->dwStyle |= CBS_HASSTRINGS;
    145         if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
    146               lphc->wState |= CBF_NOTIFY;
     145    if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
     146          lphc->wState |= CBF_NOTIFY;
    147147
    148148        TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
     
    163163
    164164       if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
    165            DestroyWindow( lphc->hWndLBox );
     165       DestroyWindow( lphc->hWndLBox );
    166166
    167167       SetWindowLongA( lphc->self, 0, 0 );
     
    303303   */
    304304  SetWindowPos( lphc->self,
    305                 (HWND)NULL,
    306                 0, 0,
    307                 windowRect.right  - windowRect.left,
    308                 newComboHeight,
    309                 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
     305        (HWND)NULL,
     306        0, 0,
     307        windowRect.right  - windowRect.left,
     308        newComboHeight,
     309        SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
    310310}
    311311
     
    405405       */
    406406      if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
    407         lprLB->right -= COMBO_EDITBUTTONSPACE();
     407    lprLB->right -= COMBO_EDITBUTTONSPACE();
    408408    }
    409409    else
     
    412412
    413413  TRACE("\ttext\t= (%i,%i-%i,%i)\n",
    414         lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
     414    lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
    415415
    416416  TRACE("\tbutton\t= (%i,%i-%i,%i)\n",
    417         lprButton->left, lprButton->top, lprButton->right, lprButton->bottom);
     417    lprButton->left, lprButton->top, lprButton->right, lprButton->bottom);
    418418
    419419  TRACE("\tlbox\t= (%i,%i-%i,%i)\n",
    420         lprLB->left, lprLB->top, lprLB->right, lprLB->bottom );
     420    lprLB->left, lprLB->top, lprLB->right, lprLB->bottom );
    421421}
    422422
     
    468468    if (posChanging->cy != newComboHeight)
    469469    {
    470         TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n",
    471               posChanging->cy, newComboHeight, lphc->droppedRect.bottom,
    472               lphc->droppedRect.top);
     470    TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n",
     471          posChanging->cy, newComboHeight, lphc->droppedRect.bottom,
     472          lphc->droppedRect.top);
    473473      lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight;
    474474
     
    524524      if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
    525525      {
    526         lphc->droppedRect.top   = lphc->textRect.bottom + COMBO_YBORDERSIZE();
    527 
    528         /*
    529         * If it's a dropdown, the listbox is offset
    530         */
    531         if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
    532           lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
    533 
    534         ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect);
    535         ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right);
     526    lphc->droppedRect.top   = lphc->textRect.bottom + COMBO_YBORDERSIZE();
     527
     528    /*
     529    * If it's a dropdown, the listbox is offset
     530    */
     531    if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     532      lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
     533
     534    ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect);
     535    ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right);
    536536      }
    537537
     
    542542
    543543      if( lphc->dwStyle & CBS_SORT )
    544         lbeStyle |= LBS_SORT;
     544    lbeStyle |= LBS_SORT;
    545545      if( lphc->dwStyle & CBS_HASSTRINGS )
    546         lbeStyle |= LBS_HASSTRINGS;
     546    lbeStyle |= LBS_HASSTRINGS;
    547547      if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
    548         lbeStyle |= LBS_NOINTEGRALHEIGHT;
     548    lbeStyle |= LBS_NOINTEGRALHEIGHT;
    549549      if( lphc->dwStyle & CBS_DISABLENOSCROLL )
    550         lbeStyle |= LBS_DISABLENOSCROLL;
    551 
    552       if( CB_GETTYPE(lphc) == CBS_SIMPLE )      /* child listbox */
     550    lbeStyle |= LBS_DISABLENOSCROLL;
     551
     552      if( CB_GETTYPE(lphc) == CBS_SIMPLE )  /* child listbox */
    553553      {
    554         lbeStyle |= WS_VISIBLE;
    555 
    556         /*
    557         * In win 95 look n feel, the listbox in the simple combobox has
    558         * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
    559         */
    560         if (TWEAK_WineLook > WIN31_LOOK)
    561         {
    562           lbeStyle   &= ~WS_BORDER;
    563           lbeExStyle |= WS_EX_CLIENTEDGE;
    564         }
     554    lbeStyle |= WS_VISIBLE;
     555
     556    /*
     557    * In win 95 look n feel, the listbox in the simple combobox has
     558    * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
     559    */
     560    if (TWEAK_WineLook > WIN31_LOOK)
     561    {
     562      lbeStyle   &= ~WS_BORDER;
     563      lbeExStyle |= WS_EX_CLIENTEDGE;
     564    }
    565565      }
    566566
    567567      lphc->hWndLBox = CreateWindowExW(lbeExStyle,
    568                                        clbName,
    569                                        NULL,
    570                                        lbeStyle,
    571                                        lphc->droppedRect.left,
    572                                        lphc->droppedRect.top,
    573                                        lphc->droppedRect.right - lphc->droppedRect.left,
    574                                        lphc->droppedRect.bottom - lphc->droppedRect.top,
     568                       clbName,
     569                       NULL,
     570                       lbeStyle,
     571                       lphc->droppedRect.left,
     572                       lphc->droppedRect.top,
     573                       lphc->droppedRect.right - lphc->droppedRect.left,
     574                       lphc->droppedRect.bottom - lphc->droppedRect.top,
    575575                                       hwnd, (HMENU)ID_CB_LISTBOX,
    576576                                       GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
     
    578578      if( lphc->hWndLBox )
    579579      {
    580           BOOL  bEdit = TRUE;
    581           lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO;
    582 
    583           /*
    584            * In Win95 look, the border fo the edit control is
    585            * provided by the combobox
    586            */
    587           if (TWEAK_WineLook == WIN31_LOOK)
    588             lbeStyle |= WS_BORDER;
    589 
    590           if( lphc->wState & CBF_EDIT )
    591           {
    592               if( lphc->dwStyle & CBS_OEMCONVERT )
    593                   lbeStyle |= ES_OEMCONVERT;
    594               if( lphc->dwStyle & CBS_AUTOHSCROLL )
    595                   lbeStyle |= ES_AUTOHSCROLL;
    596               if( lphc->dwStyle & CBS_LOWERCASE )
    597                   lbeStyle |= ES_LOWERCASE;
    598               else if( lphc->dwStyle & CBS_UPPERCASE )
    599                   lbeStyle |= ES_UPPERCASE;
     580      BOOL  bEdit = TRUE;
     581      lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO;
     582
     583      /*
     584       * In Win95 look, the border fo the edit control is
     585       * provided by the combobox
     586       */
     587      if (TWEAK_WineLook == WIN31_LOOK)
     588        lbeStyle |= WS_BORDER;
     589
     590      if( lphc->wState & CBF_EDIT )
     591      {
     592          if( lphc->dwStyle & CBS_OEMCONVERT )
     593          lbeStyle |= ES_OEMCONVERT;
     594          if( lphc->dwStyle & CBS_AUTOHSCROLL )
     595          lbeStyle |= ES_AUTOHSCROLL;
     596          if( lphc->dwStyle & CBS_LOWERCASE )
     597          lbeStyle |= ES_LOWERCASE;
     598          else if( lphc->dwStyle & CBS_UPPERCASE )
     599          lbeStyle |= ES_UPPERCASE;
    600600
    601601              if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
    602602
    603               lphc->hWndEdit = CreateWindowExW(0,
    604                                                editName,
    605                                                NULL,
    606                                                lbeStyle,
    607                                                lphc->textRect.left, lphc->textRect.top,
    608                                                lphc->textRect.right - lphc->textRect.left,
    609                                                lphc->textRect.bottom - lphc->textRect.top,
     603          lphc->hWndEdit = CreateWindowExW(0,
     604                           editName,
     605                           NULL,
     606                           lbeStyle,
     607                           lphc->textRect.left, lphc->textRect.top,
     608                           lphc->textRect.right - lphc->textRect.left,
     609                           lphc->textRect.bottom - lphc->textRect.top,
    610610                                               hwnd, (HMENU)ID_CB_EDIT,
    611611                                               GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
    612612
    613               if( !lphc->hWndEdit )
    614                 bEdit = FALSE;
    615           }
     613          if( !lphc->hWndEdit )
     614        bEdit = FALSE;
     615      }
    616616
    617617          if( bEdit )
    618           {
    619             if( CB_GETTYPE(lphc) != CBS_SIMPLE )
    620             {
     618      {
     619        if( CB_GETTYPE(lphc) != CBS_SIMPLE )
     620        {
    621621              /* Now do the trick with parent */
    622               SetParent(lphc->hWndLBox, HWND_DESKTOP);
     622          SetParent(lphc->hWndLBox, HWND_DESKTOP);
    623623              /*
    624624               * If the combo is a dropdown, we must resize the control
    625                * to fit only the text area and button. To do this,
    626                * we send a dummy resize and the WM_WINDOWPOSCHANGING message
    627                * will take care of setting the height for us.
     625           * to fit only the text area and button. To do this,
     626           * we send a dummy resize and the WM_WINDOWPOSCHANGING message
     627           * will take care of setting the height for us.
    628628               */
    629               CBForceDummyResize(lphc);
    630             }
    631 
    632             TRACE("init done\n");
    633             return 0;
    634           }
    635           ERR("edit control failure.\n");
     629          CBForceDummyResize(lphc);
     630        }
     631
     632        TRACE("init done\n");
     633        return 0;
     634      }
     635      ERR("edit control failure.\n");
    636636      } else ERR("listbox failure.\n");
    637637  } else ERR("no owner for visible combo.\n");
     
    657657    if (TWEAK_WineLook == WIN31_LOOK)
    658658    {
    659         UINT      x, y;
    660         BOOL      bBool;
    661         HDC       hMemDC;
    662         HBRUSH    hPrevBrush;
    663         COLORREF  oldTextColor, oldBkColor;
    664 
    665 
    666         hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
    667 
    668         /*
    669         * Draw the button background
    670         */
    671         PatBlt( hdc,
    672                 rectButton.left,
    673                 rectButton.top,
    674                 rectButton.right-rectButton.left,
    675                 rectButton.bottom-rectButton.top,
    676                 PATCOPY );
    677 
    678         if( (bBool = lphc->wState & CBF_BUTTONDOWN) )
    679         {
    680             DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );
    681         }
    682         else
    683         {
    684             DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );
    685         }
    686 
    687         /*
    688         * Remove the edge of the button from the rectangle
    689         * and calculate the position of the bitmap.
    690         */
    691         InflateRect( &rectButton, -2, -2);
    692 
    693         x = (rectButton.left + rectButton.right - CBitWidth) >> 1;
    694         y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;
    695 
    696 
    697         hMemDC = CreateCompatibleDC( hdc );
    698         SelectObject( hMemDC, hComboBmp );
    699         oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );
    700         oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :
    701                                 RGB(0,0,0) );
    702         BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY );
    703         SetBkColor( hdc, oldBkColor );
    704         SetTextColor( hdc, oldTextColor );
    705         DeleteDC( hMemDC );
    706         SelectObject( hdc, hPrevBrush );
     659        UINT      x, y;
     660    BOOL      bBool;
     661    HDC       hMemDC;
     662    HBRUSH    hPrevBrush;
     663    COLORREF  oldTextColor, oldBkColor;
     664
     665
     666    hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
     667
     668    /*
     669    * Draw the button background
     670    */
     671    PatBlt( hdc,
     672        rectButton.left,
     673        rectButton.top,
     674        rectButton.right-rectButton.left,
     675        rectButton.bottom-rectButton.top,
     676        PATCOPY );
     677
     678    if( (bBool = lphc->wState & CBF_BUTTONDOWN) )
     679    {
     680        DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );
     681    }
     682    else
     683    {
     684        DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );
     685    }
     686
     687    /*
     688    * Remove the edge of the button from the rectangle
     689    * and calculate the position of the bitmap.
     690    */
     691    InflateRect( &rectButton, -2, -2);
     692
     693    x = (rectButton.left + rectButton.right - CBitWidth) >> 1;
     694    y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;
     695
     696
     697    hMemDC = CreateCompatibleDC( hdc );
     698    SelectObject( hMemDC, hComboBmp );
     699    oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );
     700    oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :
     701                RGB(0,0,0) );
     702    BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY );
     703    SetBkColor( hdc, oldBkColor );
     704    SetTextColor( hdc, oldTextColor );
     705    DeleteDC( hMemDC );
     706    SelectObject( hdc, hPrevBrush );
    707707    }
    708708    else
     
    710710        UINT buttonState = DFCS_SCROLLCOMBOBOX;
    711711
    712         if (lphc->wState & CBF_BUTTONDOWN)
    713         {
    714             buttonState |= DFCS_PUSHED;
    715         }
    716 
    717         if (CB_DISABLED(lphc))
    718         {
    719           buttonState |= DFCS_INACTIVE;
    720         }
    721 
    722         DrawFrameControl(hdc,
    723                         &rectButton,
    724                         DFC_SCROLL,
    725                         buttonState);
     712    if (lphc->wState & CBF_BUTTONDOWN)
     713    {
     714        buttonState |= DFCS_PUSHED;
     715    }
     716
     717    if (CB_DISABLED(lphc))
     718    {
     719      buttonState |= DFCS_INACTIVE;
     720    }
     721
     722    DrawFrameControl(hdc,
     723            &rectButton,
     724            DFC_SCROLL,
     725            buttonState);
    726726    }
    727727}
     
    737737  RECT        rectEdit)
    738738{
    739    INT  id, size = 0;
     739   INT  id, size = 0;
    740740   LPWSTR pText = NULL;
    741741
     
    751751        size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
    752752        if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
    753         {
     753    {
    754754            /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
    755             size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);
    756             pText[size] = '\0'; /* just in case */
    757         } else return;
     755        size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);
     756        pText[size] = '\0'; /* just in case */
     757    } else return;
    758758   }
    759759   else
    760760       if( !CB_OWNERDRAWN(lphc) )
    761            return;
     761       return;
    762762
    763763   if( lphc->wState & CBF_EDIT )
    764764   {
    765765        static const WCHAR empty_stringW[] = { 0 };
    766         if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );
    767         if( lphc->wState & CBF_FOCUSED )
    768             SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
     766    if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );
     767    if( lphc->wState & CBF_FOCUSED )
     768        SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
    769769   }
    770770   else /* paint text field ourselves */
    771771   {
    772      UINT       itemState = ODS_COMBOBOXEDIT;
    773      HFONT      hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
     772     UINT   itemState = ODS_COMBOBOXEDIT;
     773     HFONT  hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
    774774
    775775     /*
     
    786786       /* setup state for DRAWITEM message. Owner will highlight */
    787787       if ( (lphc->wState & CBF_FOCUSED) &&
    788             !(lphc->wState & CBF_DROPPED) )
    789            itemState |= ODS_SELECTED | ODS_FOCUS;
     788        !(lphc->wState & CBF_DROPPED) )
     789       itemState |= ODS_SELECTED | ODS_FOCUS;
    790790
    791791       /*
    792         * Save the current clip region.
    793         * To retrieve the clip region, we need to create one "dummy"
    794         * clip region.
    795         */
     792    * Save the current clip region.
     793    * To retrieve the clip region, we need to create one "dummy"
     794    * clip region.
     795    */
    796796       clipRegion = CreateRectRgnIndirect(&rectEdit);
    797797
    798798       if (GetClipRgn(hdc, clipRegion)!=1)
    799799       {
    800         DeleteObject(clipRegion);
    801         clipRegion=(HRGN)NULL;
     800    DeleteObject(clipRegion);
     801    clipRegion=(HRGN)NULL;
    802802       }
    803803
    804804       if (!IsWindowEnabled(lphc->self) & WS_DISABLED) itemState |= ODS_DISABLED;
    805805
    806        dis.CtlType      = ODT_COMBOBOX;
    807        dis.CtlID        = ctlid;
    808        dis.hwndItem     = lphc->self;
    809        dis.itemAction   = ODA_DRAWENTIRE;
    810        dis.itemID       = id;
    811        dis.itemState    = itemState;
    812        dis.hDC          = hdc;
    813        dis.rcItem       = rectEdit;
    814        dis.itemData     = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA,
    815                                         (WPARAM)id, 0 );
     806       dis.CtlType  = ODT_COMBOBOX;
     807       dis.CtlID    = ctlid;
     808       dis.hwndItem = lphc->self;
     809       dis.itemAction   = ODA_DRAWENTIRE;
     810       dis.itemID   = id;
     811       dis.itemState    = itemState;
     812       dis.hDC      = hdc;
     813       dis.rcItem   = rectEdit;
     814       dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA,
     815                    (WPARAM)id, 0 );
    816816
    817817       /*
    818         * Clip the DC and have the parent draw the item.
    819         */
     818    * Clip the DC and have the parent draw the item.
     819    */
    820820       IntersectClipRect(hdc,
    821                         rectEdit.left,  rectEdit.top,
    822                         rectEdit.right, rectEdit.bottom);
     821            rectEdit.left,  rectEdit.top,
     822            rectEdit.right, rectEdit.bottom);
    823823
    824824       SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
    825825
    826826       /*
    827         * Reset the clipping region.
    828         */
     827    * Reset the clipping region.
     828    */
    829829       SelectClipRgn(hdc, clipRegion);
    830830     }
     
    834834
    835835       if ( (lphc->wState & CBF_FOCUSED) &&
    836             !(lphc->wState & CBF_DROPPED) ) {
    837 
    838            /* highlight */
    839            FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
    840            SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
    841            SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
     836        !(lphc->wState & CBF_DROPPED) ) {
     837
     838       /* highlight */
     839       FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
     840       SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
     841       SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
    842842       }
    843843
    844844       ExtTextOutW( hdc,
    845                     rectEdit.left + 1,
    846                     rectEdit.top + 1,
    847                     ETO_OPAQUE | ETO_CLIPPED,
    848                     &rectEdit,
    849                     pText ? pText : empty_stringW , size, NULL );
     845            rectEdit.left + 1,
     846            rectEdit.top + 1,
     847            ETO_OPAQUE | ETO_CLIPPED,
     848            &rectEdit,
     849            pText ? pText : empty_stringW , size, NULL );
    850850
    851851       if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
    852         DrawFocusRect( hdc, &rectEdit );
     852    DrawFocusRect( hdc, &rectEdit );
    853853     }
    854854
     
    857857   }
    858858   if (pText)
    859         HeapFree( GetProcessHeap(), 0, pText );
     859    HeapFree( GetProcessHeap(), 0, pText );
    860860}
    861861
     
    943943{
    944944  HBRUSH  hBkgBrush;
    945   HDC     hDC;
     945  HDC     hDC;
    946946
    947947  if(lphc->wState & CBF_EDIT)
     
    949949
    950950  hDC = (hParamDC) ? hParamDC
    951                    : GetDC(hwnd);
     951           : GetDC(hwnd);
    952952  /*
    953953   * Retrieve the background brush
     
    969969{
    970970  PAINTSTRUCT ps;
    971   HDC   hDC;
     971  HDC   hDC;
    972972
    973973  hDC = (hParamDC) ? hParamDC
    974                    : BeginPaint( lphc->self, &ps);
     974           : BeginPaint( lphc->self, &ps);
    975975
    976976  TRACE("hdc=%04x\n", hDC);
     
    978978  if( hDC && !(lphc->wState & CBF_NOREDRAW) )
    979979  {
    980       HBRUSH    hPrevBrush, hBkgBrush;
     980      HBRUSH    hPrevBrush, hBkgBrush;
    981981
    982982      /*
     
    993993      if (TWEAK_WineLook != WIN31_LOOK)
    994994      {
    995         CBPaintBorder(lphc->self, lphc, hDC);
     995    CBPaintBorder(lphc->self, lphc, hDC);
    996996      }
    997997
    998998      if( !IsRectEmpty(&lphc->buttonRect) )
    999999      {
    1000         CBPaintButton(lphc, hDC, lphc->buttonRect);
     1000    CBPaintButton(lphc, hDC, lphc->buttonRect);
    10011001      }
    10021002
     
    10131013      if( !(lphc->wState & CBF_EDIT) )
    10141014      {
    1015         /*
    1016         * The text area has a border only in Win 3.1 look.
    1017         */
    1018         if (TWEAK_WineLook == WIN31_LOOK)
    1019         {
    1020           HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) );
    1021 
    1022           Rectangle( hDC,
    1023                      lphc->textRect.left, lphc->textRect.top,
    1024                      lphc->textRect.right - 1, lphc->textRect.bottom - 1);
    1025 
    1026           SelectObject( hDC, hPrevPen );
    1027         }
    1028 
    1029         CBPaintText( lphc, hDC, lphc->textRect);
     1015    /*
     1016    * The text area has a border only in Win 3.1 look.
     1017    */
     1018    if (TWEAK_WineLook == WIN31_LOOK)
     1019    {
     1020      HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) );
     1021
     1022      Rectangle( hDC,
     1023             lphc->textRect.left, lphc->textRect.top,
     1024             lphc->textRect.right - 1, lphc->textRect.bottom - 1);
     1025
     1026      SelectObject( hDC, hPrevPen );
     1027    }
     1028
     1029    CBPaintText( lphc, hDC, lphc->textRect);
    10301030      }
    10311031
    10321032      if( hPrevBrush )
    1033         SelectObject( hDC, hPrevBrush );
     1033    SelectObject( hDC, hPrevBrush );
    10341034  }
    10351035
     
    10471047static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
    10481048{
    1049    INT  length, idx;
     1049   INT  length, idx;
    10501050   LPWSTR pText = NULL;
    10511051
     
    10631063       else pText[0] = '\0';
    10641064       idx = SendMessageW(lphc->hWndLBox, LB_FINDSTRING,
    1065                              (WPARAM)(-1), (LPARAM)pText );
     1065                 (WPARAM)(-1), (LPARAM)pText );
    10661066       HeapFree( GetProcessHeap(), 0, pText );
    10671067   }
     
    10831083static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
    10841084{
    1085    INT  length;
     1085   INT  length;
    10861086   LPWSTR pText = NULL;
    10871087   static const WCHAR empty_stringW[] = { 0 };
     
    10941094       if( length )
    10951095       {
    1096            if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) )
    1097            {
    1098                 SendMessageW(lphc->hWndLBox, LB_GETTEXT,
    1099                                 (WPARAM)index, (LPARAM)pText );
    1100            }
     1096       if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) )
     1097       {
     1098        SendMessageW(lphc->hWndLBox, LB_GETTEXT,
     1099                (WPARAM)index, (LPARAM)pText );
     1100       }
    11011101       }
    11021102   }
     
    11371137       /* Update edit only if item is in the list */
    11381138       if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
    1139         CBUpdateEdit( lphc, lphc->droppedIndex );
     1139    CBUpdateEdit( lphc, lphc->droppedIndex );
    11401140   }
    11411141   else
     
    11851185
    11861186   SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom,
    1187                 lphc->droppedRect.right - lphc->droppedRect.left,
    1188                 nDroppedHeight,
    1189                 SWP_NOACTIVATE | SWP_SHOWWINDOW);
     1187        lphc->droppedRect.right - lphc->droppedRect.left,
     1188        nDroppedHeight,
     1189        SWP_NOACTIVATE | SWP_SHOWWINDOW);
    11901190
    11911191
    11921192   if( !(lphc->wState & CBF_NOREDRAW) )
    11931193     RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
    1194                            RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
     1194               RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
    11951195
    11961196   EnableWindow( lphc->hWndLBox, TRUE );
     
    12061206static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
    12071207{
    1208    HWND hWnd = lphc->self;
     1208   HWND hWnd = lphc->self;
    12091209
    12101210   TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
    1211         lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
     1211    lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
    12121212
    12131213   CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
     
    12181218       if( lphc->wState & CBF_DROPPED )
    12191219       {
    1220            RECT rect;
    1221 
    1222            lphc->wState &= ~CBF_DROPPED;
    1223            ShowWindow( lphc->hWndLBox, SW_HIDE );
     1220       RECT rect;
     1221
     1222       lphc->wState &= ~CBF_DROPPED;
     1223       ShowWindow( lphc->hWndLBox, SW_HIDE );
    12241224
    12251225           if(GetCapture() == lphc->hWndLBox)
     
    12281228           }
    12291229
    1230            if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
    1231            {
    1232                rect = lphc->buttonRect;
    1233            }
    1234            else
     1230       if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     1231       {
     1232           rect = lphc->buttonRect;
     1233       }
     1234       else
    12351235           {
    1236                if( bButton )
    1237                {
    1238                 UnionRect( &rect,
    1239                             &lphc->buttonRect,
    1240                             &lphc->textRect);
    1241                }
    1242                else
    1243                 rect = lphc->textRect;
    1244 
    1245                bButton = TRUE;
    1246            }
    1247 
    1248            if( bButton && !(lphc->wState & CBF_NOREDRAW) )
    1249                RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE |
    1250                                RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
    1251            CB_NOTIFY( lphc, CBN_CLOSEUP );
     1236           if( bButton )
     1237           {
     1238        UnionRect( &rect,
     1239                &lphc->buttonRect,
     1240                &lphc->textRect);
     1241           }
     1242           else
     1243        rect = lphc->textRect;
     1244
     1245           bButton = TRUE;
     1246       }
     1247
     1248       if( bButton && !(lphc->wState & CBF_NOREDRAW) )
     1249           RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE |
     1250                   RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
     1251       CB_NOTIFY( lphc, CBN_CLOSEUP );
    12521252       }
    12531253   }
     
    12901290 *           COMBO_RollupListbox
    12911291 *
    1292  * @@PF Odin specific function. 
     1292 * @@PF Odin specific function.
    12931293 */
    12941294BOOL COMBO_RollupListbox( LPHEADCOMBO lphc)
     
    13271327
    13281328       if( !(lphc->wState & CBF_EDIT) )
    1329         InvalidateRect(lphc->self, &lphc->textRect, TRUE);
     1329    InvalidateRect(lphc->self, &lphc->textRect, TRUE);
    13301330
    13311331       CB_NOTIFY( lphc, CBN_SETFOCUS );
     
    13391339static void COMBO_KillFocus( LPHEADCOMBO lphc )
    13401340{
    1341    HWND hWnd = lphc->self;
     1341   HWND hWnd = lphc->self;
    13421342
    13431343   if( lphc->wState & CBF_FOCUSED )
     
    13491349               SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
    13501350
    1351            lphc->wState &= ~CBF_FOCUSED;
     1351       lphc->wState &= ~CBF_FOCUSED;
    13521352
    13531353           /* redraw text */
    1354            if( !(lphc->wState & CBF_EDIT) )
    1355              InvalidateRect(lphc->self, &lphc->textRect, TRUE);
     1354       if( !(lphc->wState & CBF_EDIT) )
     1355         InvalidateRect(lphc->self, &lphc->textRect, TRUE);
    13561356
    13571357           CB_NOTIFY( lphc, CBN_KILLFOCUS );
     
    13711371       switch( HIWORD(wParam) >> 8 )
    13721372       {
    1373            case (EN_SETFOCUS >> 8):
    1374 
    1375                 TRACE("[%04x]: edit [%04x] got focus\n",
    1376                              lphc->self, lphc->hWndEdit );
    1377 
    1378                 COMBO_SetFocus( lphc );
    1379                 break;
    1380 
    1381            case (EN_KILLFOCUS >> 8):
    1382 
    1383                 TRACE("[%04x]: edit [%04x] lost focus\n",
    1384                              lphc->self, lphc->hWndEdit );
    1385 
    1386                 /* NOTE: it seems that Windows' edit control sends an
    1387                 * undocumented message WM_USER + 0x1B instead of this
    1388                 * notification (only when it happens to be a part of
    1389                 * the combo). ?? - AK.
    1390                 */
    1391 
    1392                 COMBO_KillFocus( lphc );
    1393                 break;
    1394 
    1395 
    1396            case (EN_CHANGE >> 8):
    1397                /*
    1398                 * In some circumstances (when the selection of the combobox
    1399                 * is changed for example) we don't wans the EN_CHANGE notification
    1400                 * to be forwarded to the parent of the combobox. This code
    1401                 * checks a flag that is set in these occasions and ignores the
    1402                 * notification.
    1403                 */
    1404                 if (lphc->wState & CBF_NOLBSELECT)
    1405                 {
    1406                   lphc->wState &= ~CBF_NOLBSELECT;
    1407                 }
    1408                 else
    1409                 {
    1410                   CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
    1411                 }
    1412 
    1413                 if (!(lphc->wState & CBF_NOEDITNOTIFY))
    1414                   CB_NOTIFY( lphc, CBN_EDITCHANGE );
    1415                 break;
    1416 
    1417            case (EN_UPDATE >> 8):
    1418                 if (!(lphc->wState & CBF_NOEDITNOTIFY))
    1419                   CB_NOTIFY( lphc, CBN_EDITUPDATE );
    1420                 break;
    1421 
    1422            case (EN_ERRSPACE >> 8):
    1423                 CB_NOTIFY( lphc, CBN_ERRSPACE );
     1373       case (EN_SETFOCUS >> 8):
     1374
     1375        TRACE("[%04x]: edit [%04x] got focus\n",
     1376                 lphc->self, lphc->hWndEdit );
     1377
     1378        COMBO_SetFocus( lphc );
     1379            break;
     1380
     1381       case (EN_KILLFOCUS >> 8):
     1382
     1383        TRACE("[%04x]: edit [%04x] lost focus\n",
     1384                 lphc->self, lphc->hWndEdit );
     1385
     1386        /* NOTE: it seems that Windows' edit control sends an
     1387        * undocumented message WM_USER + 0x1B instead of this
     1388        * notification (only when it happens to be a part of
     1389        * the combo). ?? - AK.
     1390        */
     1391
     1392        COMBO_KillFocus( lphc );
     1393        break;
     1394
     1395
     1396       case (EN_CHANGE >> 8):
     1397           /*
     1398            * In some circumstances (when the selection of the combobox
     1399        * is changed for example) we don't wans the EN_CHANGE notification
     1400        * to be forwarded to the parent of the combobox. This code
     1401        * checks a flag that is set in these occasions and ignores the
     1402        * notification.
     1403            */
     1404        if (lphc->wState & CBF_NOLBSELECT)
     1405        {
     1406          lphc->wState &= ~CBF_NOLBSELECT;
     1407        }
     1408        else
     1409        {
     1410          CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
     1411        }
     1412
     1413            if (!(lphc->wState & CBF_NOEDITNOTIFY))
     1414          CB_NOTIFY( lphc, CBN_EDITCHANGE );
     1415        break;
     1416
     1417       case (EN_UPDATE >> 8):
     1418            if (!(lphc->wState & CBF_NOEDITNOTIFY))
     1419          CB_NOTIFY( lphc, CBN_EDITUPDATE );
     1420        break;
     1421
     1422       case (EN_ERRSPACE >> 8):
     1423        CB_NOTIFY( lphc, CBN_ERRSPACE );
    14241424       }
    14251425   }
     
    14281428       switch( HIWORD(wParam) )
    14291429       {
    1430            case LBN_ERRSPACE:
    1431                 CB_NOTIFY( lphc, CBN_ERRSPACE );
    1432                 break;
    1433 
    1434            case LBN_DBLCLK:
    1435                 CB_NOTIFY( lphc, CBN_DBLCLK );
    1436                 break;
    1437 
    1438            case LBN_SELCHANGE:
    1439            case LBN_SELCANCEL:
    1440 
    1441                 TRACE("[%04x]: lbox selection change [%04x]\n",
    1442                              lphc->self, lphc->wState );
    1443 
    1444                 if( HIWORD(wParam) == LBN_SELCHANGE)
    1445                 {
    1446                    if( lphc->wState & CBF_EDIT )
    1447                    {
    1448                        INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
    1449                        lphc->wState |= CBF_NOLBSELECT;
    1450                        CBUpdateEdit( lphc, index );
    1451                        /* select text in edit, as Windows does */
    1452                        SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
    1453                    }
    1454                    else
    1455                        InvalidateRect(lphc->self, &lphc->textRect, TRUE);
    1456                 }
    1457 
    1458                 /* do not roll up if selection is being tracked
    1459                 * by arrowkeys in the dropdown listbox */
     1430       case LBN_ERRSPACE:
     1431        CB_NOTIFY( lphc, CBN_ERRSPACE );
     1432        break;
     1433
     1434       case LBN_DBLCLK:
     1435        CB_NOTIFY( lphc, CBN_DBLCLK );
     1436        break;
     1437
     1438       case LBN_SELCHANGE:
     1439       case LBN_SELCANCEL:
     1440
     1441        TRACE("[%04x]: lbox selection change [%04x]\n",
     1442                 lphc->self, lphc->wState );
     1443
     1444        if( HIWORD(wParam) == LBN_SELCHANGE)
     1445        {
     1446           if( lphc->wState & CBF_EDIT )
     1447           {
     1448               INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
     1449               lphc->wState |= CBF_NOLBSELECT;
     1450               CBUpdateEdit( lphc, index );
     1451               /* select text in edit, as Windows does */
     1452               SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
     1453           }
     1454           else
     1455               InvalidateRect(lphc->self, &lphc->textRect, TRUE);
     1456        }
     1457
     1458        /* do not roll up if selection is being tracked
     1459        * by arrowkeys in the dropdown listbox */
    14601460                if( ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) )
    14611461                {
    14621462                   CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE );
    14631463                }
    1464                 else lphc->wState &= ~CBF_NOROLLUP;
    1465 
    1466                 CB_NOTIFY( lphc, CBN_SELCHANGE );
    1467 
    1468                 /* fall through */
    1469 
    1470            case LBN_SETFOCUS:
    1471            case LBN_KILLFOCUS:
    1472                 /* nothing to do here since ComboLBox always resets the focus to its
    1473                 * combo/edit counterpart */
    1474                 break;
     1464        else lphc->wState &= ~CBF_NOROLLUP;
     1465
     1466        CB_NOTIFY( lphc, CBN_SELCHANGE );
     1467
     1468        /* fall through */
     1469
     1470       case LBN_SETFOCUS:
     1471       case LBN_KILLFOCUS:
     1472        /* nothing to do here since ComboLBox always resets the focus to its
     1473        * combo/edit counterpart */
     1474        break;
    14751475       }
    14761476   }
     
    15461546       if( idx != LB_ERR )
    15471547       {
    1548            INT n = 0;
     1548       INT n = 0;
    15491549           INT length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN,
    1550                                                 (WPARAM)idx, 0 );
    1551 
    1552             if(unicode)
    1553             {
    1554                 LPWSTR lpBuffer, lpText = (LPWSTR)lParam;
    1555 
    1556                 /* 'length' is without the terminating character */
    1557                 if(length >= N)
    1558                     lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
    1559                 else
    1560                     lpBuffer = lpText;
    1561 
    1562                 if(lpBuffer)
    1563                 {
    1564                     n = SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);
    1565 
    1566                     /* truncate if buffer is too short */
    1567                     if(length >= N)
    1568                     {
    1569                         if(N && lpText)
    1570                         {
    1571                             if(n != LB_ERR)
    1572                                 strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1);
    1573                             lpText[N - 1] = '\0';
    1574                         }
    1575                         HeapFree( GetProcessHeap(), 0, lpBuffer );
     1550                            (WPARAM)idx, 0 );
     1551
     1552        if(unicode)
     1553        {
     1554        LPWSTR lpBuffer, lpText = (LPWSTR)lParam;
     1555
     1556        /* 'length' is without the terminating character */
     1557        if(length >= N)
     1558            lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
     1559        else
     1560            lpBuffer = lpText;
     1561
     1562        if(lpBuffer)
     1563        {
     1564            n = SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);
     1565
     1566            /* truncate if buffer is too short */
     1567            if(length >= N)
     1568            {
     1569            if(N && lpText)
     1570            {
     1571                if(n != LB_ERR)
     1572                strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1);
     1573                lpText[N - 1] = '\0';
     1574            }
     1575                    HeapFree( GetProcessHeap(), 0, lpBuffer );
    15761576                   }
    1577                }
    1578            }
    1579            else
    1580            {
    1581                 LPSTR lpBuffer, lpText = (LPSTR)lParam;
    1582 
    1583                 /* 'length' is without the terminating character */
    1584                 if(length >= N)
    1585                     lpBuffer = HeapAlloc(GetProcessHeap(), 0, length + 1);
    1586                 else
    1587                     lpBuffer = lpText;
    1588 
    1589                 if(lpBuffer)
    1590                 {
    1591                     n = SendMessageA(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);
    1592 
    1593                     /* truncate if buffer is too short */
    1594                     if(length >= N)
    1595                     {
    1596                         if(N && lpText)
    1597                         {
    1598                             if(n != LB_ERR)
    1599                                 strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1);
    1600                             lpText[N - 1] = '\0';
    1601                         }
    1602                         HeapFree( GetProcessHeap(), 0, lpBuffer );
     1577           }
     1578       }
     1579       else
     1580       {
     1581        LPSTR lpBuffer, lpText = (LPSTR)lParam;
     1582
     1583        /* 'length' is without the terminating character */
     1584        if(length >= N)
     1585            lpBuffer = HeapAlloc(GetProcessHeap(), 0, length + 1);
     1586        else
     1587            lpBuffer = lpText;
     1588
     1589        if(lpBuffer)
     1590        {
     1591            n = SendMessageA(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);
     1592
     1593            /* truncate if buffer is too short */
     1594            if(length >= N)
     1595            {
     1596            if(N && lpText)
     1597            {
     1598                if(n != LB_ERR)
     1599                strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1);
     1600                lpText[N - 1] = '\0';
     1601            }
     1602                    HeapFree( GetProcessHeap(), 0, lpBuffer );
    16031603                   }
    1604                }
    1605            }
    1606            if (n<0)
    1607                n=0;
    1608            else
    1609                n++;
    1610            return (LRESULT)n;
     1604           }
     1605       }
     1606       if (n<0)
     1607           n=0;
     1608       else
     1609           n++;
     1610       return (LRESULT)n;
    16111611       }
    16121612   }
     
    16271627  BOOL        bRedraw)
    16281628{
    1629    BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE);
     1629   BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE);
    16301630
    16311631   /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
     
    16341634   if( lphc->wState & CBF_EDIT )
    16351635     SetWindowPos( lphc->hWndEdit, 0,
    1636                    rectEdit->left, rectEdit->top,
    1637                    rectEdit->right - rectEdit->left,
    1638                    rectEdit->bottom - rectEdit->top,
     1636           rectEdit->left, rectEdit->top,
     1637           rectEdit->right - rectEdit->left,
     1638           rectEdit->bottom - rectEdit->top,
    16391639                       SWP_NOZORDER | SWP_NOACTIVATE | ((bDrop) ? SWP_NOREDRAW : 0) );
    16401640
    16411641   SetWindowPos( lphc->hWndLBox, 0,
    1642                 rectLB->left, rectLB->top,
     1642        rectLB->left, rectLB->top,
    16431643                 rectLB->right - rectLB->left,
    1644                 rectLB->bottom - rectLB->top,
    1645                    SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );
     1644        rectLB->bottom - rectLB->top,
     1645           SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );
    16461646
    16471647   if( bDrop )
     
    16661666  {
    16671667  CBCalcPlacement(lphc->self,
    1668                   lphc,
    1669                   &lphc->textRect,
    1670                   &lphc->buttonRect,
    1671                   &lphc->droppedRect);
     1668          lphc,
     1669          &lphc->textRect,
     1670          &lphc->buttonRect,
     1671          &lphc->droppedRect);
    16721672
    16731673  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
     
    16981698  {
    16991699    CBCalcPlacement(lphc->self,
    1700                     lphc,
    1701                     &lphc->textRect,
    1702                     &lphc->buttonRect,
    1703                     &lphc->droppedRect);
     1700            lphc,
     1701            &lphc->textRect,
     1702            &lphc->buttonRect,
     1703            &lphc->droppedRect);
    17041704
    17051705    CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
     
    17171717static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
    17181718{
    1719    LRESULT      lRet = CB_ERR;
     1719   LRESULT  lRet = CB_ERR;
    17201720
    17211721   if( index == -1 ) /* set text field height */
     
    17251725           lphc->editHeight = height;
    17261726
    1727         /*
    1728           * Redo the layout of the control.
    1729           */
    1730         if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
    1731         {
    1732            CBCalcPlacement(lphc->self,
    1733                            lphc,
    1734                            &lphc->textRect,
    1735                            &lphc->buttonRect,
    1736                            &lphc->droppedRect);
    1737 
    1738            CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
    1739         }
    1740         else
    1741         {
    1742            CBForceDummyResize(lphc);
    1743         }
    1744 
    1745            lRet = height;
     1727    /*
     1728      * Redo the layout of the control.
     1729      */
     1730    if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
     1731    {
     1732       CBCalcPlacement(lphc->self,
     1733               lphc,
     1734               &lphc->textRect,
     1735               &lphc->buttonRect,
     1736               &lphc->droppedRect);
     1737
     1738       CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
     1739    }
     1740    else
     1741    {
     1742       CBForceDummyResize(lphc);
     1743    }
     1744
     1745       lRet = height;
    17461746       }
    17471747   }
    1748    else if ( CB_OWNERDRAWN(lphc) )      /* set listbox item height */
    1749         lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT,
    1750                               (WPARAM)index, (LPARAM)height );
     1748   else if ( CB_OWNERDRAWN(lphc) )  /* set listbox item height */
     1749    lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT,
     1750                  (WPARAM)index, (LPARAM)height );
    17511751   return lRet;
    17521752}
     
    17901790       if( lphc->wState & CBF_DROPPED )
    17911791       {
    1792            /* got a click to cancel selection */
     1792       /* got a click to cancel selection */
    17931793
    17941794           lphc->wState &= ~CBF_BUTTONDOWN;
    17951795           CBRollUp( lphc, TRUE, FALSE );
    1796            if( !IsWindow( hWnd ) ) return;
     1796       if( !IsWindow( hWnd ) ) return;
    17971797
    17981798           if( lphc->wState & CBF_CAPTURE )
     
    18041804       else
    18051805       {
    1806            /* drop down the listbox and start tracking */
     1806       /* drop down the listbox and start tracking */
    18071807
    18081808           lphc->wState |= CBF_CAPTURE;
     
    18261826       if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
    18271827       {
    1828            INT index = CBUpdateLBox( lphc, TRUE );
    1829            /* Update edit only if item is in the list */
    1830            if(index >= 0)
    1831            {
    1832                lphc->wState |= CBF_NOLBSELECT;
    1833                CBUpdateEdit( lphc, index );
    1834                lphc->wState &= ~CBF_NOLBSELECT;
    1835            }
     1828       INT index = CBUpdateLBox( lphc, TRUE );
     1829       /* Update edit only if item is in the list */
     1830       if(index >= 0)
     1831       {
     1832           lphc->wState |= CBF_NOLBSELECT;
     1833           CBUpdateEdit( lphc, index );
     1834           lphc->wState &= ~CBF_NOLBSELECT;
     1835       }
    18361836       }
    18371837       ReleaseCapture();
     
    19041904      {
    19051905
    1906         /* System messages */
    1907 
    1908         case WM_NCCREATE:
    1909         {
    1910                 LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
    1911                                        ((LPCREATESTRUCTA)lParam)->style;
     1906    /* System messages */
     1907
     1908        case WM_NCCREATE:
     1909    {
     1910        LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
     1911                       ((LPCREATESTRUCTA)lParam)->style;
    19121912                return COMBO_NCCreate(hwnd, style);
    1913         }
    1914         case WM_NCDESTROY:
    1915                 COMBO_NCDestroy(lphc);
    1916                 break;/* -> DefWindowProc */
    1917 
    1918         case WM_CREATE:
    1919         {
    1920                 HWND hwndParent;
    1921                 LONG style;
    1922                 if(unicode)
    1923                 {
    1924                     hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;
    1925                     style = ((LPCREATESTRUCTW)lParam)->style;
    1926                 }
    1927                 else
    1928                 {
    1929                     hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
    1930                     style = ((LPCREATESTRUCTA)lParam)->style;
    1931                 }
     1913    }
     1914        case WM_NCDESTROY:
     1915        COMBO_NCDestroy(lphc);
     1916        break;/* -> DefWindowProc */
     1917
     1918        case WM_CREATE:
     1919    {
     1920        HWND hwndParent;
     1921        LONG style;
     1922        if(unicode)
     1923        {
     1924            hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;
     1925            style = ((LPCREATESTRUCTW)lParam)->style;
     1926        }
     1927        else
     1928        {
     1929            hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
     1930            style = ((LPCREATESTRUCTA)lParam)->style;
     1931        }
    19321932                return COMBO_Create(hwnd, lphc, hwndParent, style);
    1933         }
     1933    }
    19341934
    19351935        case WM_PRINTCLIENT:
    1936                 if (lParam & PRF_ERASEBKGND)
    1937                   COMBO_EraseBackground(hwnd, lphc, wParam);
    1938 
    1939                 /* Fallthrough */
    1940         case WM_PAINT:
    1941                 /* wParam may contain a valid HDC! */
    1942                 return  COMBO_Paint(lphc, wParam);
    1943         case WM_ERASEBKGND:
    1944                 return  COMBO_EraseBackground(hwnd, lphc, wParam);
    1945         case WM_GETDLGCODE:
    1946         {
    1947                 LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;
    1948                 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
    1949                 {
    1950                    int vk = (int)((LPMSG)lParam)->wParam;
    1951 
    1952                    if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
    1953                        result |= DLGC_WANTMESSAGE;
    1954                 }
    1955                 return  result;
    1956         }
    1957         case WM_WINDOWPOSCHANGING:
    1958                 return  COMBO_WindowPosChanging(hwnd, lphc, (LPWINDOWPOS)lParam);
     1936            if (lParam & PRF_ERASEBKGND)
     1937          COMBO_EraseBackground(hwnd, lphc, wParam);
     1938
     1939        /* Fallthrough */
     1940        case WM_PAINT:
     1941        /* wParam may contain a valid HDC! */
     1942        return  COMBO_Paint(lphc, wParam);
     1943    case WM_ERASEBKGND:
     1944        return  COMBO_EraseBackground(hwnd, lphc, wParam);
     1945    case WM_GETDLGCODE:
     1946    {
     1947        LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;
     1948        if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
     1949        {
     1950           int vk = (int)((LPMSG)lParam)->wParam;
     1951
     1952           if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
     1953               result |= DLGC_WANTMESSAGE;
     1954        }
     1955        return  result;
     1956    }
     1957    case WM_WINDOWPOSCHANGING:
     1958            return  COMBO_WindowPosChanging(hwnd, lphc, (LPWINDOWPOS)lParam);
    19591959    case WM_WINDOWPOSCHANGED:
    19601960        /* SetWindowPos can be called on a Combobox to resize its Listbox.
     
    19641964         */
    19651965        /* fall through */
    1966         case WM_SIZE:
    1967                 if( lphc->hWndLBox &&
    1968                   !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
    1969                 return  TRUE;
    1970         case WM_SETFONT:
    1971                 COMBO_Font( lphc, (HFONT16)wParam, (BOOL)lParam );
    1972                 return  TRUE;
    1973         case WM_GETFONT:
    1974                 return  (LRESULT)lphc->hFont;
    1975         case WM_SETFOCUS:
    1976                 if( lphc->wState & CBF_EDIT )
    1977                     SetFocus( lphc->hWndEdit );
    1978                 else
    1979                     COMBO_SetFocus( lphc );
    1980                 return  TRUE;
    1981         case WM_KILLFOCUS:
     1966    case WM_SIZE:
     1967            if( lphc->hWndLBox &&
     1968          !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
     1969        return  TRUE;
     1970    case WM_SETFONT:
     1971        COMBO_Font( lphc, (HFONT16)wParam, (BOOL)lParam );
     1972        return  TRUE;
     1973    case WM_GETFONT:
     1974        return  (LRESULT)lphc->hFont;
     1975    case WM_SETFOCUS:
     1976        if( lphc->wState & CBF_EDIT )
     1977            SetFocus( lphc->hWndEdit );
     1978        else
     1979            COMBO_SetFocus( lphc );
     1980        return  TRUE;
     1981    case WM_KILLFOCUS:
    19821982            {
    19831983                HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
    1984                 if( !hwndFocus ||
    1985                     (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
    1986                     COMBO_KillFocus( lphc );
    1987                 return  TRUE;
     1984        if( !hwndFocus ||
     1985            (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
     1986            COMBO_KillFocus( lphc );
     1987        return  TRUE;
    19881988            }
    1989         case WM_COMMAND:
    1990                 return  COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
    1991         case WM_GETTEXT:
    1992                 return COMBO_GetText( lphc, (INT)wParam, lParam, unicode );
    1993         case WM_SETTEXT:
    1994         case WM_GETTEXTLENGTH:
    1995         case WM_CLEAR:
     1989    case WM_COMMAND:
     1990        return  COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
     1991    case WM_GETTEXT:
     1992        return COMBO_GetText( lphc, (INT)wParam, lParam, unicode );
     1993    case WM_SETTEXT:
     1994    case WM_GETTEXTLENGTH:
     1995    case WM_CLEAR:
    19961996                if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
    19971997                {
     
    20002000                return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
    20012001                }
    2002                 else if( lphc->wState & CBF_EDIT )
    2003                 {
    2004                     LRESULT ret;
    2005                     lphc->wState |= CBF_NOEDITNOTIFY;
    2006                     ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
    2007                                     SendMessageA(lphc->hWndEdit, message, wParam, lParam);
    2008                     lphc->wState &= ~CBF_NOEDITNOTIFY;
    2009                     return ret;
    2010                 }
    2011                 else return CB_ERR;
    2012         case WM_CUT:
     2002        else if( lphc->wState & CBF_EDIT )
     2003        {
     2004            LRESULT ret;
     2005            lphc->wState |= CBF_NOEDITNOTIFY;
     2006            ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
     2007                    SendMessageA(lphc->hWndEdit, message, wParam, lParam);
     2008            lphc->wState &= ~CBF_NOEDITNOTIFY;
     2009            return ret;
     2010        }
     2011        else return CB_ERR;
     2012    case WM_CUT:
    20132013        case WM_PASTE:
    2014         case WM_COPY:
    2015                 if( lphc->wState & CBF_EDIT )
    2016                 {
    2017                     return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
    2018                                      SendMessageA(lphc->hWndEdit, message, wParam, lParam);
    2019                 }
    2020                 else return  CB_ERR;
    2021 
    2022         case WM_DRAWITEM:
    2023         case WM_DELETEITEM:
    2024         case WM_COMPAREITEM:
    2025         case WM_MEASUREITEM:
    2026                 return COMBO_ItemOp(lphc, message, lParam);
    2027         case WM_ENABLE:
    2028                 if( lphc->wState & CBF_EDIT )
    2029                     EnableWindow( lphc->hWndEdit, (BOOL)wParam );
    2030                 EnableWindow( lphc->hWndLBox, (BOOL)wParam );
    2031 
    2032                 /* Force the control to repaint when the enabled state changes. */
    2033                 InvalidateRect(lphc->self, NULL, TRUE);
    2034                 return  TRUE;
    2035         case WM_SETREDRAW:
    2036                 if( wParam )
    2037                     lphc->wState &= ~CBF_NOREDRAW;
    2038                 else
    2039                     lphc->wState |= CBF_NOREDRAW;
    2040 
    2041                 if( lphc->wState & CBF_EDIT )
    2042                     SendMessageW(lphc->hWndEdit, message, wParam, lParam);
    2043                 SendMessageW(lphc->hWndLBox, message, wParam, lParam);
    2044                 return  0;
    2045         case WM_SYSKEYDOWN:
    2046                 if( KEYDATA_ALT & HIWORD(lParam) )
    2047                     if( wParam == VK_UP || wParam == VK_DOWN )
    2048                         COMBO_FlipListbox( lphc, FALSE, FALSE );
     2014    case WM_COPY:
     2015        if( lphc->wState & CBF_EDIT )
     2016        {
     2017            return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
     2018                     SendMessageA(lphc->hWndEdit, message, wParam, lParam);
     2019        }
     2020        else return  CB_ERR;
     2021
     2022    case WM_DRAWITEM:
     2023    case WM_DELETEITEM:
     2024    case WM_COMPAREITEM:
     2025    case WM_MEASUREITEM:
     2026        return COMBO_ItemOp(lphc, message, lParam);
     2027    case WM_ENABLE:
     2028        if( lphc->wState & CBF_EDIT )
     2029            EnableWindow( lphc->hWndEdit, (BOOL)wParam );
     2030        EnableWindow( lphc->hWndLBox, (BOOL)wParam );
     2031
     2032        /* Force the control to repaint when the enabled state changes. */
     2033        InvalidateRect(lphc->self, NULL, TRUE);
     2034        return  TRUE;
     2035    case WM_SETREDRAW:
     2036        if( wParam )
     2037            lphc->wState &= ~CBF_NOREDRAW;
     2038        else
     2039            lphc->wState |= CBF_NOREDRAW;
     2040
     2041        if( lphc->wState & CBF_EDIT )
     2042            SendMessageW(lphc->hWndEdit, message, wParam, lParam);
     2043        SendMessageW(lphc->hWndLBox, message, wParam, lParam);
     2044        return  0;
     2045    case WM_SYSKEYDOWN:
     2046        if( KEYDATA_ALT & HIWORD(lParam) )
     2047            if( wParam == VK_UP || wParam == VK_DOWN )
     2048            COMBO_FlipListbox( lphc, FALSE, FALSE );
    20492049                return  0;
    20502050
    2051         case WM_CHAR:
    2052         case WM_KEYDOWN:
    2053         {
    2054                 HWND hwndTarget;
    2055 
    2056                 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
    2057                      (lphc->wState & CBF_DROPPED))
    2058                 {
    2059                    CBRollUp( lphc, wParam == VK_RETURN, FALSE );
    2060                    return TRUE;
    2061                 }
    2062 
    2063                 if( lphc->wState & CBF_EDIT )
    2064                     hwndTarget = lphc->hWndEdit;
    2065                 else
    2066                     hwndTarget = lphc->hWndLBox;
    2067 
    2068                 return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
    2069                                  SendMessageA(hwndTarget, message, wParam, lParam);
    2070         }
    2071         case WM_LBUTTONDOWN:
    2072                 if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
    2073                 if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
    2074                 return  TRUE;
    2075         case WM_LBUTTONUP:
    2076                 COMBO_LButtonUp( lphc );
    2077                 return  TRUE;
    2078         case WM_MOUSEMOVE:
    2079                 if( lphc->wState & CBF_CAPTURE )
    2080                     COMBO_MouseMove( lphc, wParam, lParam );
    2081                 return  TRUE;
     2051#ifdef __WIN32OS2__
     2052    case WM_IME_CHAR:
     2053#endif
     2054    case WM_CHAR:
     2055    case WM_KEYDOWN:
     2056    {
     2057        HWND hwndTarget;
     2058
     2059        if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
     2060             (lphc->wState & CBF_DROPPED))
     2061        {
     2062           CBRollUp( lphc, wParam == VK_RETURN, FALSE );
     2063           return TRUE;
     2064        }
     2065
     2066        if( lphc->wState & CBF_EDIT )
     2067            hwndTarget = lphc->hWndEdit;
     2068        else
     2069            hwndTarget = lphc->hWndLBox;
     2070
     2071        return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
     2072                 SendMessageA(hwndTarget, message, wParam, lParam);
     2073    }
     2074    case WM_LBUTTONDOWN:
     2075        if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
     2076        if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
     2077        return  TRUE;
     2078    case WM_LBUTTONUP:
     2079        COMBO_LButtonUp( lphc );
     2080        return  TRUE;
     2081    case WM_MOUSEMOVE:
     2082        if( lphc->wState & CBF_CAPTURE )
     2083            COMBO_MouseMove( lphc, wParam, lParam );
     2084        return  TRUE;
    20822085
    20832086        case WM_MOUSEWHEEL:
    20842087                if (wParam & (MK_SHIFT | MK_CONTROL))
    20852088                    return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
    2086                                      DefWindowProcA(hwnd, message, wParam, lParam);
     2089                     DefWindowProcA(hwnd, message, wParam, lParam);
    20872090                if (SHIWORD(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
    20882091                if (SHIWORD(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
    20892092                return TRUE;
    20902093
    2091         /* Combo messages */
    2092 
    2093         case CB_ADDSTRING16:
    2094                 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
    2095                 /* fall through */
    2096         case CB_ADDSTRING:
    2097                 return unicode ? SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam) :
    2098                                 SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
    2099         case CB_INSERTSTRING16:
    2100                 wParam = (INT)(INT16)wParam;
    2101                 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
    2102                 /* fall through */
    2103         case CB_INSERTSTRING:
    2104                 return unicode ? SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam) :
    2105                                 SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
    2106         case CB_DELETESTRING16:
    2107         case CB_DELETESTRING:
    2108                 return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
    2109                                 SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
    2110         case CB_SELECTSTRING16:
    2111                 wParam = (INT)(INT16)wParam;
    2112                 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
    2113                 /* fall through */
    2114         case CB_SELECTSTRING:
    2115                 return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
    2116         case CB_FINDSTRING16:
    2117                 wParam = (INT)(INT16)wParam;
    2118                 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
    2119                 /* fall through */
    2120         case CB_FINDSTRING:
    2121                 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
    2122                                 SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);
    2123         case CB_FINDSTRINGEXACT16:
    2124                 wParam = (INT)(INT16)wParam;
    2125                 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
    2126                 /* fall through */
    2127         case CB_FINDSTRINGEXACT:
    2128                 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
    2129                                 SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);
    2130         case CB_SETITEMHEIGHT16:
    2131                 wParam = (INT)(INT16)wParam;    /* signed integer */
    2132                 /* fall through */
    2133         case CB_SETITEMHEIGHT:
    2134                 return  COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
    2135         case CB_GETITEMHEIGHT16:
    2136                 wParam = (INT)(INT16)wParam;
    2137                 /* fall through */
    2138         case CB_GETITEMHEIGHT:
    2139                 if( (INT)wParam >= 0 )  /* listbox item */
     2094    /* Combo messages */
     2095
     2096    case CB_ADDSTRING16:
     2097        if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
     2098        /* fall through */
     2099    case CB_ADDSTRING:
     2100        return unicode ? SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam) :
     2101                SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
     2102    case CB_INSERTSTRING16:
     2103        wParam = (INT)(INT16)wParam;
     2104        if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
     2105        /* fall through */
     2106    case CB_INSERTSTRING:
     2107        return unicode ? SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam) :
     2108                SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
     2109    case CB_DELETESTRING16:
     2110    case CB_DELETESTRING:
     2111        return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
     2112                SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
     2113    case CB_SELECTSTRING16:
     2114        wParam = (INT)(INT16)wParam;
     2115        if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
     2116        /* fall through */
     2117    case CB_SELECTSTRING:
     2118        return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
     2119    case CB_FINDSTRING16:
     2120        wParam = (INT)(INT16)wParam;
     2121        if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
     2122        /* fall through */
     2123    case CB_FINDSTRING:
     2124        return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
     2125                SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);
     2126    case CB_FINDSTRINGEXACT16:
     2127        wParam = (INT)(INT16)wParam;
     2128        if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
     2129        /* fall through */
     2130    case CB_FINDSTRINGEXACT:
     2131        return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
     2132                SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);
     2133    case CB_SETITEMHEIGHT16:
     2134        wParam = (INT)(INT16)wParam;    /* signed integer */
     2135        /* fall through */
     2136    case CB_SETITEMHEIGHT:
     2137        return  COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
     2138    case CB_GETITEMHEIGHT16:
     2139        wParam = (INT)(INT16)wParam;
     2140        /* fall through */
     2141    case CB_GETITEMHEIGHT:
     2142        if( (INT)wParam >= 0 )  /* listbox item */
    21402143                    return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
    21412144                return  CBGetTextAreaHeight(hwnd, lphc);
    2142         case CB_RESETCONTENT16:
    2143         case CB_RESETCONTENT:
    2144                 SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
     2145    case CB_RESETCONTENT16:
     2146    case CB_RESETCONTENT:
     2147        SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
    21452148                if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
    2146                 {
    2147                     static const WCHAR empty_stringW[] = { 0 };
     2149        {
     2150            static const WCHAR empty_stringW[] = { 0 };
    21482151                    SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
    2149                 }
     2152        }
    21502153                else
    21512154                    InvalidateRect(lphc->self, NULL, TRUE);
    2152                 return  TRUE;
    2153         case CB_INITSTORAGE:
    2154                 return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
    2155         case CB_GETHORIZONTALEXTENT:
    2156                 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
    2157         case CB_SETHORIZONTALEXTENT:
    2158                 return SendMessageW(lphc->hWndLBox, LB_SETHORIZONTALEXTENT, wParam, 0);
    2159         case CB_GETTOPINDEX:
    2160                 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
    2161         case CB_GETLOCALE:
    2162                 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
    2163         case CB_SETLOCALE:
    2164                 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
    2165         case CB_GETDROPPEDWIDTH:
    2166                 if( lphc->droppedWidth )
     2155        return  TRUE;
     2156    case CB_INITSTORAGE:
     2157        return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
     2158    case CB_GETHORIZONTALEXTENT:
     2159        return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
     2160    case CB_SETHORIZONTALEXTENT:
     2161        return SendMessageW(lphc->hWndLBox, LB_SETHORIZONTALEXTENT, wParam, 0);
     2162    case CB_GETTOPINDEX:
     2163        return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
     2164    case CB_GETLOCALE:
     2165        return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
     2166    case CB_SETLOCALE:
     2167        return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
     2168    case CB_GETDROPPEDWIDTH:
     2169        if( lphc->droppedWidth )
    21672170                    return  lphc->droppedWidth;
    2168                 return  lphc->droppedRect.right - lphc->droppedRect.left;
    2169         case CB_SETDROPPEDWIDTH:
    2170                 if( (CB_GETTYPE(lphc) != CBS_SIMPLE) &&
    2171                     (INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;
    2172                 return  CB_ERR;
    2173         case CB_GETDROPPEDCONTROLRECT16:
    2174                 lParam = (LPARAM)MapSL(lParam);
    2175                 if( lParam )
    2176                 {
    2177                     RECT        r;
    2178                     CBGetDroppedControlRect( lphc, &r );
    2179                     CONV_RECT32TO16( &r, (LPRECT16)lParam );
    2180                 }
    2181                 return  CB_OKAY;
    2182         case CB_GETDROPPEDCONTROLRECT:
    2183                 if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
    2184                 return  CB_OKAY;
    2185         case CB_GETDROPPEDSTATE16:
    2186         case CB_GETDROPPEDSTATE:
    2187                 return  (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;
    2188         case CB_DIR16:
     2171        return  lphc->droppedRect.right - lphc->droppedRect.left;
     2172    case CB_SETDROPPEDWIDTH:
     2173        if( (CB_GETTYPE(lphc) != CBS_SIMPLE) &&
     2174            (INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;
     2175        return  CB_ERR;
     2176    case CB_GETDROPPEDCONTROLRECT16:
     2177        lParam = (LPARAM)MapSL(lParam);
     2178        if( lParam )
     2179        {
     2180            RECT    r;
     2181            CBGetDroppedControlRect( lphc, &r );
     2182            CONV_RECT32TO16( &r, (LPRECT16)lParam );
     2183        }
     2184        return  CB_OKAY;
     2185    case CB_GETDROPPEDCONTROLRECT:
     2186        if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
     2187        return  CB_OKAY;
     2188    case CB_GETDROPPEDSTATE16:
     2189    case CB_GETDROPPEDSTATE:
     2190        return  (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;
     2191    case CB_DIR16:
    21892192                lParam = (LPARAM)MapSL(lParam);
    2190                 message = LB_DIR16;
     2193        message = LB_DIR16;
    21912194                /* fall through */
    2192         case CB_DIR:
    2193                 if(message == CB_DIR) message = LB_DIR;
    2194                 return unicode ? SendMessageW(lphc->hWndLBox, message, wParam, lParam) :
    2195                                 SendMessageA(lphc->hWndLBox, message, wParam, lParam);
    2196 
    2197         case CB_SHOWDROPDOWN16:
    2198         case CB_SHOWDROPDOWN:
    2199                 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
    2200                 {
    2201                     if( wParam )
    2202                     {
    2203                         if( !(lphc->wState & CBF_DROPPED) )
    2204                             CBDropDown( lphc );
    2205                     }
    2206                     else
    2207                         if( lphc->wState & CBF_DROPPED )
    2208                             CBRollUp( lphc, FALSE, TRUE );
    2209                 }
    2210                 return  TRUE;
    2211         case CB_GETCOUNT16:
    2212         case CB_GETCOUNT:
    2213                 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
    2214         case CB_GETCURSEL16:
    2215         case CB_GETCURSEL:
    2216                 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
    2217         case CB_SETCURSEL16:
    2218                 wParam = (INT)(INT16)wParam;
    2219                 /* fall through */
    2220         case CB_SETCURSEL:
    2221                 lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);
    2222                 if( lParam >= 0 )
    2223                     SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0);
    2224 
    2225                 /* no LBN_SELCHANGE in this case, update manually */
    2226                 if( lphc->wState & CBF_EDIT )
    2227                     CBUpdateEdit( lphc, (INT)wParam );
    2228                 else
    2229                     InvalidateRect(lphc->self, &lphc->textRect, TRUE);
    2230                 lphc->wState &= ~CBF_SELCHANGE;
    2231                 return  lParam;
    2232         case CB_GETLBTEXT16:
    2233                 wParam = (INT)(INT16)wParam;
    2234                 lParam = (LPARAM)MapSL(lParam);
    2235                 /* fall through */
    2236         case CB_GETLBTEXT:
    2237                 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
    2238                                 SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
    2239         case CB_GETLBTEXTLEN16:
    2240                 wParam = (INT)(INT16)wParam;
    2241                 /* fall through */
    2242         case CB_GETLBTEXTLEN:
    2243                 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
    2244         case CB_GETITEMDATA16:
    2245                 wParam = (INT)(INT16)wParam;
    2246                 /* fall through */
    2247         case CB_GETITEMDATA:
    2248                 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
    2249         case CB_SETITEMDATA16:
    2250                 wParam = (INT)(INT16)wParam;
    2251                 /* fall through */
    2252         case CB_SETITEMDATA:
    2253                 return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
    2254         case CB_GETEDITSEL16:
    2255                 wParam = lParam = 0;   /* just in case */
    2256                 /* fall through */
    2257         case CB_GETEDITSEL:
    2258                 /* Edit checks passed parameters itself */
    2259                 if( lphc->wState & CBF_EDIT )
    2260                     return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
    2261                 return  CB_ERR;
    2262         case CB_SETEDITSEL16:
    2263         case CB_SETEDITSEL:
    2264                 if( lphc->wState & CBF_EDIT )
     2195    case CB_DIR:
     2196        if(message == CB_DIR) message = LB_DIR;
     2197        return unicode ? SendMessageW(lphc->hWndLBox, message, wParam, lParam) :
     2198                SendMessageA(lphc->hWndLBox, message, wParam, lParam);
     2199
     2200    case CB_SHOWDROPDOWN16:
     2201    case CB_SHOWDROPDOWN:
     2202        if( CB_GETTYPE(lphc) != CBS_SIMPLE )
     2203        {
     2204            if( wParam )
     2205            {
     2206            if( !(lphc->wState & CBF_DROPPED) )
     2207                CBDropDown( lphc );
     2208            }
     2209            else
     2210            if( lphc->wState & CBF_DROPPED )
     2211                    CBRollUp( lphc, FALSE, TRUE );
     2212        }
     2213        return  TRUE;
     2214    case CB_GETCOUNT16:
     2215    case CB_GETCOUNT:
     2216        return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
     2217    case CB_GETCURSEL16:
     2218    case CB_GETCURSEL:
     2219        return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
     2220    case CB_SETCURSEL16:
     2221        wParam = (INT)(INT16)wParam;
     2222        /* fall through */
     2223    case CB_SETCURSEL:
     2224        lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);
     2225            if( lParam >= 0 )
     2226                SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0);
     2227
     2228        /* no LBN_SELCHANGE in this case, update manually */
     2229        if( lphc->wState & CBF_EDIT )
     2230            CBUpdateEdit( lphc, (INT)wParam );
     2231        else
     2232            InvalidateRect(lphc->self, &lphc->textRect, TRUE);
     2233        lphc->wState &= ~CBF_SELCHANGE;
     2234            return  lParam;
     2235    case CB_GETLBTEXT16:
     2236        wParam = (INT)(INT16)wParam;
     2237        lParam = (LPARAM)MapSL(lParam);
     2238        /* fall through */
     2239    case CB_GETLBTEXT:
     2240        return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
     2241                SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
     2242    case CB_GETLBTEXTLEN16:
     2243        wParam = (INT)(INT16)wParam;
     2244        /* fall through */
     2245    case CB_GETLBTEXTLEN:
     2246        return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
     2247    case CB_GETITEMDATA16:
     2248        wParam = (INT)(INT16)wParam;
     2249        /* fall through */
     2250    case CB_GETITEMDATA:
     2251        return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
     2252    case CB_SETITEMDATA16:
     2253        wParam = (INT)(INT16)wParam;
     2254        /* fall through */
     2255    case CB_SETITEMDATA:
     2256        return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
     2257    case CB_GETEDITSEL16:
     2258        wParam = lParam = 0;   /* just in case */
     2259        /* fall through */
     2260    case CB_GETEDITSEL:
     2261        /* Edit checks passed parameters itself */
     2262        if( lphc->wState & CBF_EDIT )
     2263            return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
     2264        return  CB_ERR;
     2265    case CB_SETEDITSEL16:
     2266    case CB_SETEDITSEL:
     2267        if( lphc->wState & CBF_EDIT )
    22652268                    return SendMessageW(lphc->hWndEdit, EM_SETSEL,
    2266                           (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
    2267                 return  CB_ERR;
    2268         case CB_SETEXTENDEDUI16:
    2269         case CB_SETEXTENDEDUI:
     2269              (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
     2270        return  CB_ERR;
     2271    case CB_SETEXTENDEDUI16:
     2272    case CB_SETEXTENDEDUI:
    22702273                if( CB_GETTYPE(lphc) == CBS_SIMPLE )
    22712274                    return  CB_ERR;
    2272                 if( wParam )
    2273                     lphc->wState |= CBF_EUI;
    2274                 else lphc->wState &= ~CBF_EUI;
    2275                 return  CB_OKAY;
    2276         case CB_GETEXTENDEDUI16:
    2277         case CB_GETEXTENDEDUI:
    2278                 return  (lphc->wState & CBF_EUI) ? TRUE : FALSE;
    2279 
    2280         default:
    2281                 if (message >= WM_USER)
    2282                     WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
    2283                         message - WM_USER, wParam, lParam );
    2284                 break;
     2275        if( wParam )
     2276            lphc->wState |= CBF_EUI;
     2277        else lphc->wState &= ~CBF_EUI;
     2278        return  CB_OKAY;
     2279    case CB_GETEXTENDEDUI16:
     2280    case CB_GETEXTENDEDUI:
     2281        return  (lphc->wState & CBF_EUI) ? TRUE : FALSE;
     2282
     2283    default:
     2284        if (message >= WM_USER)
     2285            WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
     2286            message - WM_USER, wParam, lParam );
     2287        break;
    22852288      }
    22862289      return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
  • trunk/src/user32/edit.c

    r10195 r10216  
    888888    case WM_CHAR:
    889889    {
    890 #ifdef __WIN32OS2__
    891         static BOOL bDbcsLead = FALSE;
    892         static CHAR cDbcsLead = 0;
    893 
    894890        WCHAR charW;
    895891        DPRINTF_EDIT_MSG32("WM_CHAR");
     
    899895        else
    900896        {
    901             WCHAR charA = bDbcsLead ? (( wParam << 8 ) | cDbcsLead ) : wParam;
    902             int   size = bDbcsLead ? 2 : 1;
    903 
    904             bDbcsLead = !bDbcsLead && IsDBCSLeadByte( wParam );
    905 
    906             if( bDbcsLead )
    907                 cDbcsLead = wParam;
    908             else
    909                 MultiByteToWideChar(CP_ACP, 0, (LPSTR)&charA, size, &charW, 1);
     897            CHAR charA = wParam;
     898            MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
    910899        }
    911900
     
    916905           break;
    917906        }
    918         if( !bDbcsLead )
    919             EDIT_WM_Char(hwnd, es, charW);
    920 #else
    921                 WCHAR charW;
    922                 DPRINTF_EDIT_MSG32("WM_CHAR");
    923 
    924                 if(unicode)
    925                     charW = wParam;
    926                 else
    927                 {
    928                     CHAR charA = wParam;
    929                     MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
    930                 }
    931 
    932                 if ((charW == VK_RETURN || charW == VK_ESCAPE) && es->hwndListBox)
    933                 {
    934                    if (SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0))
    935                       SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0);
    936                    break;
    937                 }
    938                 EDIT_WM_Char(hwnd, es, charW);
    939 #endif
     907        EDIT_WM_Char(hwnd, es, charW);
    940908        break;
    941909    }
     
    1016984        result = EDIT_WM_HScroll(hwnd, es, LOWORD(wParam), SHIWORD(wParam));
    1017985        break;
     986
     987#ifdef __WIN32OS2__
     988    case WM_IME_CHAR:
     989    {
     990        WCHAR charW;
     991        DPRINTF_EDIT_MSG32("WM_IME_CHAR");
     992
     993        if(unicode)
     994            charW = wParam;
     995        else
     996        {
     997            // always DBCS char
     998            CHAR charA[ 2 ];
     999
     1000            charA[ 0 ] = ( CHAR )( wParam >> 8 );
     1001            charA[ 1 ] = ( CHAR )wParam;
     1002
     1003            MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )&charW, 1);
     1004        }
     1005
     1006        EDIT_WM_Char(hwnd, es, charW);
     1007        break;
     1008    }
     1009#endif
    10181010
    10191011    case WM_KEYDOWN:
  • trunk/src/user32/listbox.c

    r10195 r10216  
    29922992    case WM_CHAR:
    29932993    {
    2994 #ifdef __WIN32OS2__
    2995         static BOOL bDbcsLead = FALSE;
    2996         static CHAR cDbcsLead = 0;
    2997 
    29982994        WCHAR charW;
    29992995        if(unicode)
     
    30012997        else
    30022998        {
    3003             WCHAR charA = bDbcsLead ? (( wParam << 8 ) | cDbcsLead ) : wParam;
    3004             int   size = bDbcsLead ? 2 : 1;
    3005 
    3006             bDbcsLead = !bDbcsLead && IsDBCSLeadByte( wParam );
    3007 
    3008             if( bDbcsLead )
    3009                 cDbcsLead = wParam;
    3010             else
    3011                 MultiByteToWideChar(CP_ACP, 0, (LPSTR)&charA, size, &charW, 1);
    3012         }
    3013         return bDbcsLead ? 0 : LISTBOX_HandleChar( hwnd, descr, charW );
    3014 #else
     2999            CHAR charA = (CHAR)wParam;
     3000            MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
     3001        }
     3002        return LISTBOX_HandleChar( hwnd, descr, charW );
     3003    }
     3004
     3005#ifdef __WIN32OS2__
     3006    case WM_IME_CHAR:
     3007    {
    30153008        WCHAR charW;
     3009
    30163010        if(unicode)
    30173011            charW = (WCHAR)wParam;
    30183012        else
    30193013        {
    3020             CHAR charA = (CHAR)wParam;
    3021             MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
     3014            // always DBCS char
     3015            CHAR charA[ 2 ];
     3016
     3017            charA[ 0 ] = ( CHAR )( wParam >> 8 );
     3018            charA[ 1 ] = ( CHAR )wParam;
     3019
     3020            MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )&charW, 1);
    30223021        }
    30233022        return LISTBOX_HandleChar( hwnd, descr, charW );
     3023    }
    30243024#endif
    3025     }
    30263025
    30273026    case WM_SYSTIMER:
  • trunk/src/user32/oslibmsg.cpp

    r10212 r10216  
    1 /* $Id: oslibmsg.cpp,v 1.74 2003-08-06 11:00:44 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.75 2003-08-08 13:30:19 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    236236// Check for a queued WM_CHAR message (e.g. inserted by TranslateMessage)
    237237//******************************************************************************
    238 BOOL ReturnQueuedWMCHAR(LPMSG pMsg, TEB *teb, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 
     238BOOL ReturnQueuedWMCHAR(LPMSG pMsg, TEB *teb, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
    239239                        BOOL isUnicode, BOOL fRemove)
    240240{
     
    251251                return FALSE;
    252252        }
    253    
     253
    254254        if(fRemove & PM_REMOVE_W) {
    255255            teb->o.odin.fTranslated = FALSE;
     
    276276        // call the keyboard hook here
    277277        // send keyboard messages to the registered hooks
    278         if(fRemove & PM_REMOVE_W) 
     278        if(fRemove & PM_REMOVE_W)
    279279        {
    280280            switch (pMsg->message)
     
    291291            }
    292292        }
    293    
     293
    294294        //GetMessageW and PeekMessageW expect the character code in UTF-16
    295295        //(we save it in ascii format)
     
    298298            CHAR  charA;
    299299            WCHAR charW;
    300    
     300
    301301            charA = pMsg->wParam;
    302302            MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
     
    400400            goto continuegetmsg;
    401401        break;
    402     case WINWM_CHAR:
    403     case WINWM_SYSCHAR:
     402    case WINWM_IME_CHAR:
    404403        // prevent from calling wrong DispatchMsg() (DBCS generated WM_CHAR)
    405404        memset( &teb->o.odin.winmsg, 0, sizeof( MSG ));
     
    464463        ULONG ulPMFilter;
    465464
    466         for(int i=0;i<uMsgFilterMax-uMsgFilterMin+1;i++) 
     465        for(int i=0;i<uMsgFilterMax-uMsgFilterMin+1;i++)
    467466        {
    468467            rc = 0;
     
    523522                goto continuepeekmsg;
    524523            break;
    525         case WINWM_CHAR:
    526         case WINWM_SYSCHAR:
     524        case WINWM_IME_CHAR:
    527525            // prevent from calling wrong DispatchMsg() (DBCS generated WM_CHAR)
    528526            memset( &teb->o.odin.winmsg, 0, sizeof( MSG ));
  • trunk/src/user32/oslibmsg.h

    r10185 r10216  
    1 /* $Id: oslibmsg.h,v 1.21 2003-07-28 11:27:45 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.22 2003-08-08 13:30:19 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    147147#define WINWM_SYSDEADCHAR           0x0107
    148148#define WINWM_KEYLAST               0x0108
     149#define WINWM_IME_STARTCOMPOSITION  0x010D
     150#define WINWM_IME_ENDCOMPOSITION    0x010E
     151#define WINWM_IME_COMPOSITION       0x010F
     152#define WINWM_IME_KEYLAST           0x010F
    149153#define WINWM_INITDIALOG            0x0110
    150154#define WINWM_COMMAND               0x0111
     
    195199#define WINWM_DROPFILES             0x0233
    196200#define WINWM_MDIREFRESHMENU        0x0234
     201#define WINWM_IME_SETCONTEXT        0x0281
     202#define WINWM_IME_NOTIFY            0x0282
     203#define WINWM_IME_CONTROL           0x0283
     204#define WINWM_IME_COMPOSITIONFULL   0x0284
     205#define WINWM_IME_SELECT            0x0285
     206#define WINWM_IME_CHAR              0x0286
     207#define WINWM_IME_REQUEST           0x0288
     208#define WINWM_IME_KEYDOWN           0x0290
     209#define WINWM_IME_KEYUP             0x0291
    197210#define WINWM_CUT                   0x0300
    198211#define WINWM_COPY                  0x0301
  • trunk/src/user32/oslibmsgtranslate.cpp

    r10212 r10216  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.114 2003-08-06 11:00:45 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.115 2003-08-08 13:30:19 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    720720        WORD  wWinScan;
    721721
    722         if ( (!IsDBCSEnv() && scanCode == 0) || 
    723              (scanCode==0 ) && !( flags & KC_CHAR ) ) 
     722        if ( (!IsDBCSEnv() && scanCode == 0) ||
     723             (scanCode==0 ) && !( flags & KC_CHAR ) )
    724724        {
    725725            goto dummymessage;
     
    746746            if( CHAR2FROMMP( os2Msg->mp2 ))     // DBCS character
    747747            {
     748                CHAR dbcsCh[ 2 ] = { CHAR1FROMMP( os2Msg->mp2 ), CHAR2FROMMP( os2Msg->mp2 )};
     749
    748750                if( isUnicode )
    749751                {
    750                     char  dbcsCh[] = { CHAR1FROMMP( os2Msg->mp2 ), CHAR2FROMMP( os2Msg->mp2 ), 0 };
    751                     WCHAR uniChar[ 2 ];
    752 
    753                     lstrcpynAtoW(( LPWSTR )&uniChar, ( LPCSTR )&dbcsCh, 2 );
    754                     winMsg->wParam = ( WPARAM )uniChar[ 0 ];
     752                    WCHAR  uniChar;
     753
     754                    MultiByteToWideChar( CP_ACP, 0, dbcsCh, 2, &uniChar, 1 );
     755                    winMsg->wParam = ( WPARAM )uniChar;
    755756                }
    756                 // insert DBCS trail byte for Non-Unicode window
    757                 else if(fMsgRemoved && !(teb->o.odin.fTranslated))
    758                 {
    759                     MSG extramsg;
    760                     memcpy(&extramsg, winMsg, sizeof(MSG));
    761 
    762                     //After SetFocus(0), all keystrokes are converted in WM_SYS*
    763                     extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR;
    764 
    765                     extramsg.wParam = CHAR2FROMMP( os2Msg->mp2 );
    766                     extramsg.lParam = 0;
    767 
    768                     setThreadQueueExtraCharMessage(teb, &extramsg);
    769                 }
     757                else
     758                    winMsg->wParam = ( dbcsCh[ 0 ] << 8 ) | dbcsCh[ 1 ];
    770759            }
    771760        }
     
    830819          else if( scanCode == 0 )
    831820          {
    832             //After SetFocus(0), all keystrokes are converted in WM_SYS*
    833             winMsg->message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR :  WINWM_CHAR;
     821            if( CHAR2FROMMP( os2Msg->mp2 ))
     822                winMsg->message = WINWM_IME_CHAR;
     823            else
     824            {
     825                //After SetFocus(0), all keystrokes are converted in WM_SYS*
     826                winMsg->message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR :  WINWM_CHAR;
     827            }
    834828          }
    835829          else
  • trunk/src/user32/win32wbase.cpp

    r10190 r10216  
    1 /* $Id: win32wbase.cpp,v 1.376 2003-07-31 15:56:45 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.377 2003-08-08 13:30:20 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    21232123        return 0; //comctl32 controls expect this
    21242124
     2125    case WM_IME_CHAR:
     2126        if( wParam & 0xFF00 ) // DBCS ?
     2127            SendMessageA( getWindowHandle(), WM_CHAR, ( WPARAM )( BYTE )( wParam >> 8 ), lParam );
     2128        SendMessageA( getWindowHandle(), WM_CHAR, ( WPARAM )( BYTE )( wParam & 0xFF ), lParam );
     2129        break;
     2130
    21252131    default:
    21262132        return 0;
     
    22052211        return TRUE;
    22062212    }
     2213
     2214    case WM_IME_CHAR:
     2215        SendMessageW( getWindowHandle(), WM_CHAR, wParam, lParam );
     2216        return 0;
    22072217
    22082218    default:
  • trunk/src/user32/windowmsg.cpp

    r10204 r10216  
    1 /* $Id: windowmsg.cpp,v 1.46 2003-08-04 17:01:58 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.47 2003-08-08 13:30:22 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    3535#include "timer.h"
    3636
    37 #define DBG_LOCALLOG    DBG_windowmsg
     37#define DBG_LOCALLOG    DBG_windowmsg
    3838#include "dbglocal.h"
    3939
     
    5050    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
    5151    {
    52         if (msg->lParam)
     52    if (msg->lParam)
    5353        {
    5454/*            HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
     
    5656            /* before calling window proc, verify whether timer is still valid;
    5757               there's a slim chance that the application kills the timer
    58                between GetMessage and DispatchMessage API calls */
     58           between GetMessage and DispatchMessage API calls */
    5959            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam))
    6060                return 0; /* invalid winproc */
    6161
    62             return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
     62        return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
    6363                                   msg->message, msg->wParam, GetTickCount() );
    6464        }
     
    7676    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
    7777    {
    78         if (msg->lParam)
     78    if (msg->lParam)
    7979        {
    8080/*            HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
     
    8282            /* before calling window proc, verify whether timer is still valid;
    8383               there's a slim chance that the application kills the timer
    84                between GetMessage and DispatchMessage API calls */
     84           between GetMessage and DispatchMessage API calls */
    8585            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam))
    8686                return 0; /* invalid winproc */
    8787
    88             return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
     88        return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
    8989                                   msg->message, msg->wParam, GetTickCount() );
    9090        }
     
    100100         (msg->message >  WM_SYSKEYUP)||
    101101         (msg->message == WM_CHAR)    ||
     102#ifdef __WIN32OS2__
     103         (msg->message == WM_DEADCHAR)||
     104         (msg->message == WM_IME_CHAR) )
     105#else
    102106         (msg->message == WM_DEADCHAR) )
     107#endif
    103108    {
    104109        SetLastError(ERROR_INVALID_PARAMETER);
     
    448453        return 0;
    449454
     455#ifdef __WIN32OS2__
     456    case WM_IME_CHAR:
     457    {
     458        // always DBCS char
     459        CHAR charA[ 2 ];
     460
     461        charA[ 0 ] = ( CHAR )( *pwparam >> 8 );
     462        charA[ 1 ] = ( CHAR )*pwparam;
     463
     464        MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )pwparam, 1);
     465
     466        return 0;
     467    }
     468#endif
     469
    450470    case WM_PAINTCLIPBOARD:
    451471    case WM_SIZECLIPBOARD:
     
    725745        return 0;
    726746
     747#ifdef __WIN32OS2__
     748    case WM_IME_CHAR:
     749    {   // always DBCS char
     750        CHAR charA[ 2 ];
     751
     752        WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )pwparam, 1, ( LPSTR )charA, 2, 0, 0 );
     753        *pwparam = ( charA[ 0 ] << 8 ) | charA[ 1 ];
     754
     755        return 0;
     756    }
     757#endif
     758
    727759    case WM_PAINTCLIPBOARD:
    728760    case WM_SIZECLIPBOARD:
     
    862894    LRESULT result;
    863895
    864 #ifdef __WIN32OS2__
    865     if( IsDBCSEnv() && msg == WM_CHAR )
    866     {
    867         static BYTE dbcsLead = 0;
    868         WCHAR charA = wParam;
    869         int size = dbcsLead ? 2 : 1;
    870 
    871         if( dbcsLead )
    872                charA = ( charA << 8 ) | dbcsLead;
    873         else if( IsDBCSLeadByte( wParam ))
    874         {
    875             dbcsLead = wParam;
    876             return 0;
    877         }
    878         MultiByteToWideChar( CP_ACP, 0, ( LPSTR )&charA, size, ( LPWSTR )&wParam, 1 );
    879 
    880         dbcsLead = 0;
    881     }
    882     else
    883 #endif
    884896    if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    885897
     
    888900
    889901#ifdef __WIN32OS2__
    890     if(IsDBCSEnv()) 
     902    if(IsDBCSEnv())
    891903    {
    892904      switch( msg )
     
    940952    LRESULT result;
    941953
    942 #ifdef __WIN32OS2__
    943     if( IsDBCSEnv() && msg == WM_CHAR )
    944     {
    945         char charA[ 2 ];
    946 
    947         if( WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )&wParam, 1, ( LPSTR )charA, 2, 0, 0 ) > 1 )
    948         {
    949             func( hwnd, msg, ( WPARAM )charA[ 0 ], lParam );
    950             wParam = charA[ 1 ];
    951         }
    952         else
    953             wParam = charA[ 0 ];
    954     }
    955     else
    956 #endif
    957954    if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    958955
Note: See TracChangeset for help on using the changeset viewer.