< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -264,15 +264,18 @@
 
     ::GetCursorPos(&dragSource->m_dragPoint);
 
     dragSource->Signal();
 
+    AwtToolkit &toolkit = AwtToolkit::GetInstance();
+    toolkit.isInDoDragDropLoop = TRUE;
     res = ::DoDragDrop(dragSource,
                        dragSource,
                        convertActionsToDROPEFFECT(dragSource->m_actions),
                        &effects
           );
+    toolkit.isInDoDragDropLoop = FALSE;
 
     if (effects == DROPEFFECT_NONE && dragSource->m_dwPerformedDropEffect != DROPEFFECT_NONE) {
         effects = dragSource->m_dwPerformedDropEffect;
     }
     dragSource->m_dwPerformedDropEffect = DROPEFFECT_NONE;

@@ -624,10 +627,11 @@
 /**
  * QueryContinueDrag
  */
 
 HRESULT __stdcall  AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
     if (fEscapeKeyPressed)

@@ -679,10 +683,11 @@
 /**
  * GiveFeedback
  */
 
 HRESULT __stdcall  AwtDragSource::GiveFeedback(DWORD dwEffect) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     jint    modifiers = 0;
     SHORT   mods = 0;

@@ -758,10 +763,11 @@
  * GetData
  */
 
 HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc,
                                          STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
     STGMEDIUM *pPicMedia = PictureDragHelper::FindData(*pFormatEtc);
     if (NULL != pPicMedia) {
         *pmedium = *pPicMedia;
         //return  outside, so AddRef the instance of pstm or hGlobal!

@@ -932,10 +938,11 @@
  * GetDataHere
  */
 
 HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc,
                                              STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     if (pmedium->pUnkForRelease != (IUnknown *)NULL) {
         return E_INVALIDARG;
     }

@@ -1034,10 +1041,11 @@
 /**
  * QueryGetData
  */
 
 HRESULT __stdcall  AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     return MatchFormatEtc(pFormatEtc, (FORMATETC *)NULL);
 
     CATCH_BAD_ALLOC_RET(E_OUTOFMEMORY);

@@ -1047,10 +1055,11 @@
 /**
  * GetCanonicalFormatEtc
  */
 
 HRESULT __stdcall  AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     HRESULT   res = MatchFormatEtc(pFormatEtcIn, (FORMATETC *)NULL);
 
     if (res != S_OK) return res;

@@ -1067,10 +1076,11 @@
 /**
  * SetData
  */
 
 HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) {
+    AwtToolkit::GetInstance().eventNumber++;
     if (pFormatEtc->cfFormat == CF_PERFORMEDDROPEFFECT && pmedium->tymed == TYMED_HGLOBAL) {
         m_dwPerformedDropEffect = *(DWORD*)::GlobalLock(pmedium->hGlobal);
         ::GlobalUnlock(pmedium->hGlobal);
         if (fRelease) {
             ::ReleaseStgMedium(pmedium);

@@ -1089,10 +1099,11 @@
 /**
  * EnumFormatEtc
  */
 
 HRESULT __stdcall  AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     *ppenumFormatEtc = new ADSIEnumFormatEtc(this);
     return S_OK;
 

@@ -1102,34 +1113,37 @@
 /**
  * DAdvise
  */
 
 HRESULT __stdcall  AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return E_NOTIMPL;
 }
 
 /**
  * DUnadvise
  */
 
 HRESULT __stdcall  AwtDragSource::DUnadvise(DWORD dwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
 /**
  * EnumAdvise
  */
 
 HRESULT __stdcall  AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
 const UINT AwtDragSource::PROCESS_ID_FORMAT =
     ::RegisterClipboardFormat(TEXT("_SUNW_JAVA_AWT_PROCESS_ID"));
 
 HRESULT __stdcall AwtDragSource::GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) {
-
+    AwtToolkit::GetInstance().eventNumber++;
     if ((pFormatEtc->tymed & TYMED_HGLOBAL) == 0) {
         return DV_E_TYMED;
     } else if (pFormatEtc->lindex != -1) {
         return DV_E_LINDEX;
     } else if (pFormatEtc->dwAspect != DVASPECT_CONTENT) {
< prev index next >