< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Component.cpp

Print this page


   1 /*
   2  * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


3852 
3853     // just post WM_CHAR with unicode key value
3854     DefWindowProc(WM_CHAR, (WPARAM)character, lParam);
3855     return mrConsume;
3856 }
3857 
3858 MsgRouting AwtComponent::WmPaste()
3859 {
3860     return mrDoDefault;
3861 }
3862 
3863 // support IME Composition messages
3864 void AwtComponent::SetCompositionWindow(RECT& r)
3865 {
3866     HWND hwnd = ImmGetHWnd();
3867     HIMC hIMC = ImmGetContext(hwnd);
3868     if (hIMC == NULL) {
3869         return;
3870     }
3871     COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}};





3872     ImmSetCompositionWindow(hIMC, &cf);
3873     ImmReleaseContext(hwnd, hIMC);
3874 }
3875 
3876 void AwtComponent::OpenCandidateWindow(int x, int y)
3877 {
3878     UINT bits = 1;
3879     POINT p = {0, 0}; // upper left corner of the client area
3880     HWND hWnd = ImmGetHWnd();
3881     if (!::IsWindowVisible(hWnd)) {
3882         return;
3883     }
3884     HWND hTop = GetTopLevelParentForWindow(hWnd);
3885     ::ClientToScreen(hTop, &p);
3886     int sx = ScaleUpX(x) - p.x;
3887     int sy = ScaleUpY(y) - p.y;
3888     if (!m_bitsCandType) {
3889         SetCandidateWindow(m_bitsCandType, sx, sy);
3890         return;
3891     }


   1 /*
   2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


3852 
3853     // just post WM_CHAR with unicode key value
3854     DefWindowProc(WM_CHAR, (WPARAM)character, lParam);
3855     return mrConsume;
3856 }
3857 
3858 MsgRouting AwtComponent::WmPaste()
3859 {
3860     return mrDoDefault;
3861 }
3862 
3863 // support IME Composition messages
3864 void AwtComponent::SetCompositionWindow(RECT& r)
3865 {
3866     HWND hwnd = ImmGetHWnd();
3867     HIMC hIMC = ImmGetContext(hwnd);
3868     if (hIMC == NULL) {
3869         return;
3870     }
3871     COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}};
3872     LOGFONT lf;
3873     HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
3874     if (GetObject(hFont, sizeof(lf), (LPVOID)&lf) == sizeof(lf)) {
3875         ImmSetCompositionFont(hIMC, &lf);
3876     }
3877     ImmSetCompositionWindow(hIMC, &cf);
3878     ImmReleaseContext(hwnd, hIMC);
3879 }
3880 
3881 void AwtComponent::OpenCandidateWindow(int x, int y)
3882 {
3883     UINT bits = 1;
3884     POINT p = {0, 0}; // upper left corner of the client area
3885     HWND hWnd = ImmGetHWnd();
3886     if (!::IsWindowVisible(hWnd)) {
3887         return;
3888     }
3889     HWND hTop = GetTopLevelParentForWindow(hWnd);
3890     ::ClientToScreen(hTop, &p);
3891     int sx = ScaleUpX(x) - p.x;
3892     int sy = ScaleUpY(y) - p.y;
3893     if (!m_bitsCandType) {
3894         SetCandidateWindow(m_bitsCandType, sx, sy);
3895         return;
3896     }


< prev index next >