< prev index next >

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

Print this page
rev 58018 : 8238575: DragSourceEvent.getLocation() returns wrong value on HiDPI screens (Windows)
Reviewed-by: XXX
   1 /*
   2  * Copyright (c) 1997, 2014, 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


 110 /**
 111  * AddRef
 112  */
 113 
 114 ULONG __stdcall AwtDropTarget::AddRef() {
 115     return (ULONG)++m_refs;
 116 }
 117 
 118 /**
 119  * Release
 120  */
 121 
 122 ULONG __stdcall AwtDropTarget::Release() {
 123     int refs;
 124 
 125     if ((refs = --m_refs) == 0) delete this;
 126 
 127     return (ULONG)refs;
 128 }
 129 
 130 void ScaleDown(POINT &cp, HWND m_window) {
 131     int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(m_window);
 132     Devices::InstanceAccess devices;
 133     AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
 134     if (device) {
 135         cp.x = device->ScaleDownX(cp.x);
 136         cp.y = device->ScaleDownY(cp.y);
 137     }
 138 }
 139 
 140 /**
 141  * DragEnter
 142  */
 143 
 144 HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) {
 145     TRY;
 146     if (NULL != m_pIDropTargetHelper) {
 147         m_pIDropTargetHelper->DragEnter(
 148             m_window,
 149             pDataObj,
 150             (LPPOINT)&pt,


   1 /*
   2  * Copyright (c) 1997, 2020, 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


 110 /**
 111  * AddRef
 112  */
 113 
 114 ULONG __stdcall AwtDropTarget::AddRef() {
 115     return (ULONG)++m_refs;
 116 }
 117 
 118 /**
 119  * Release
 120  */
 121 
 122 ULONG __stdcall AwtDropTarget::Release() {
 123     int refs;
 124 
 125     if ((refs = --m_refs) == 0) delete this;
 126 
 127     return (ULONG)refs;
 128 }
 129 
 130 static void ScaleDown(POINT &cp, HWND m_window) {
 131     int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(m_window);
 132     Devices::InstanceAccess devices;
 133     AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
 134     if (device) {
 135         cp.x = device->ScaleDownX(cp.x);
 136         cp.y = device->ScaleDownY(cp.y);
 137     }
 138 }
 139 
 140 /**
 141  * DragEnter
 142  */
 143 
 144 HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) {
 145     TRY;
 146     if (NULL != m_pIDropTargetHelper) {
 147         m_pIDropTargetHelper->DragEnter(
 148             m_window,
 149             pDataObj,
 150             (LPPOINT)&pt,


< prev index next >