mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 463088 - Tab tear off cursor needs to be constant on Windows. r=enndeakin.
This commit is contained in:
parent
b66ef2ce00
commit
492b851d97
@ -1924,6 +1924,9 @@
|
||||
// the tab by dropping it on the desktop would result in an
|
||||
// "internet shortcut"
|
||||
dt.mozSetDataAt("text/plain", spec, 0);
|
||||
|
||||
// Set the cursor to an arrow during tab drags.
|
||||
dt.mozCursor = "default";
|
||||
|
||||
var canvas = tabPreviews.capture(target, false);
|
||||
dt.setDragImage(canvas, 0, 0);
|
||||
|
@ -76,7 +76,8 @@ nsDOMDataTransfer::nsDOMDataTransfer()
|
||||
mIsExternal(PR_FALSE),
|
||||
mUserCancelled(PR_FALSE),
|
||||
mDragImageX(0),
|
||||
mDragImageY(0)
|
||||
mDragImageY(0),
|
||||
mCursorState(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
@ -297,6 +298,25 @@ nsDOMDataTransfer::GetMozItemCount(PRUint32* aCount)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataTransfer::GetMozCursor(nsAString& aCursorState)
|
||||
{
|
||||
if (mCursorState)
|
||||
aCursorState.AssignASCII("default");
|
||||
else
|
||||
aCursorState.AssignASCII("auto");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataTransfer::SetMozCursor(const nsAString& aCursorState)
|
||||
{
|
||||
// Lock the cursor to an arrow during the drag.
|
||||
mCursorState = aCursorState.EqualsASCII("default");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataTransfer::MozTypesAt(PRUint32 aIndex, nsIDOMDOMStringList** aTypes)
|
||||
{
|
||||
|
@ -167,6 +167,9 @@ protected:
|
||||
PRUint32 mDropEffect;
|
||||
PRUint32 mEffectAllowed;
|
||||
|
||||
// Indicates the behavior of the cursor during drag operations
|
||||
PRPackedBool mCursorState;
|
||||
|
||||
// readonly data transfers may not be modified except the drop effect and
|
||||
// effect allowed.
|
||||
PRPackedBool mReadOnly;
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(B5947DD0-8E86-4B9C-AA65-C86303EFCF94)]
|
||||
[scriptable, uuid(E4970BA1-9567-455C-8B4E-4607D7E741BB)]
|
||||
interface nsIDOMDataTransfer : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -180,6 +180,16 @@ interface nsIDOMNSDataTransfer : nsISupports
|
||||
*/
|
||||
readonly attribute unsigned long mozItemCount;
|
||||
|
||||
/**
|
||||
* Sets the drag cursor state. Primarily used to control the cursor during
|
||||
* tab drags, but could be expanded to other uses.
|
||||
*
|
||||
* Possible values:
|
||||
* auto - use default system behavior.
|
||||
* default - set the cursor to an arrow during the drag operation.
|
||||
*/
|
||||
attribute DOMString mozCursor;
|
||||
|
||||
/**
|
||||
* Holds a list of the format types of the data that is stored for an item
|
||||
* at the specified index. If the index is not in the range from 0 to
|
||||
|
@ -270,7 +270,7 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
|
||||
{
|
||||
// To do the drag we need to create an object that
|
||||
// implements the IDataObject interface (for OLE)
|
||||
nsNativeDragSource* nativeDragSource = new nsNativeDragSource();
|
||||
nsNativeDragSource* nativeDragSource = new nsNativeDragSource(mDataTransfer);
|
||||
if (!nativeDragSource)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -38,14 +38,17 @@
|
||||
#include "nsNativeDragSource.h"
|
||||
#include <stdio.h>
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
/*
|
||||
* class nsNativeDragSource
|
||||
*/
|
||||
nsNativeDragSource::nsNativeDragSource()
|
||||
: m_cRef(0), mUserCancelled(PR_FALSE)
|
||||
nsNativeDragSource::nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer) :
|
||||
m_cRef(0),
|
||||
mUserCancelled(PR_FALSE),
|
||||
m_hCursor(nsnull)
|
||||
{
|
||||
mDataTransfer = do_QueryInterface(aDataTransfer);
|
||||
}
|
||||
|
||||
nsNativeDragSource::~nsNativeDragSource()
|
||||
@ -122,5 +125,23 @@ nsNativeDragSource::GiveFeedback(DWORD dwEffect)
|
||||
#ifdef DEBUG
|
||||
//printf("GiveFeedback\n");
|
||||
#endif
|
||||
|
||||
// For drags involving tabs, we do some custom work with cursors.
|
||||
if (mDataTransfer) {
|
||||
nsAutoString cursor;
|
||||
mDataTransfer->GetMozCursor(cursor);
|
||||
if (cursor.EqualsASCII("default")) {
|
||||
m_hCursor = ::LoadCursor(0, IDC_ARROW);
|
||||
} else {
|
||||
m_hCursor = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_hCursor) {
|
||||
::SetCursor(m_hCursor);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Let the system choose which cursor to apply.
|
||||
return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS);
|
||||
}
|
||||
|
@ -38,6 +38,8 @@
|
||||
#define _nsNativeDragSource_h_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include <ole2.h>
|
||||
#include <oleidl.h>
|
||||
|
||||
@ -53,7 +55,7 @@ public:
|
||||
|
||||
// construct an nsNativeDragSource referencing adapter
|
||||
// nsNativeDragSource(nsIDragSource * adapter);
|
||||
nsNativeDragSource();
|
||||
nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer);
|
||||
~nsNativeDragSource();
|
||||
|
||||
// IUnknown methods - see iunknown.h for documentation
|
||||
@ -78,7 +80,14 @@ public:
|
||||
PRPackedBool UserCancelled() { return mUserCancelled; }
|
||||
|
||||
protected:
|
||||
ULONG m_cRef; // reference count
|
||||
// Reference count
|
||||
ULONG m_cRef;
|
||||
|
||||
// Data object, hold information about cursor state
|
||||
nsCOMPtr<nsIDOMNSDataTransfer> mDataTransfer;
|
||||
|
||||
// Custom drag cursor
|
||||
HCURSOR m_hCursor;
|
||||
|
||||
// true if the user cancelled the drag by pressing escape
|
||||
PRPackedBool mUserCancelled;
|
||||
|
Loading…
Reference in New Issue
Block a user