EVALUATION
Commit to merlin-beta (regression).
###@###.### 2001-03-16
Name: dsR10078 Date: 03/17/2001
In XmText and XmTextField widgets default Motif translations for
Btn2Down event change the widget state, so that on the Btn2Up it will
be able to paste the primary selection contents.
The fix for 4407057 disables these translations, so primary selection
is not pasted.
###@###.### 2001-03-17
======================================================================
|
SUGGESTED FIX
Name: dsR10078 Date: 03/17/2001
Backout the fix for 4407057 and apply a new fix which is more compact,
provides more complete solution for disabling Motif default drag
support and doesn't have such side effects.
The previous version of the fix didn't address several cases: Motif
drag support for XmText and XmTextField widgets in
XmFileSelectionDialog is not disabled with unsetting
enableUnselectableDrag property, XmText and XmTextField can initiate
drag in responce to other events, not only on Btn2Down. New version
addresses all the cases.
I suggest to track all calls to XmDragStart application-wide and make
them fail if the source widget is not an awt_root_shell. This check
clearly separates drag operations initiated by Motif default drag
support and those initiated in java.
In Motif 2.1 there is a clean way for this: on the XmDisplay object
install a dragStartCallback, which sets 'doit' field of
XmDragStartCallbackStruct to True if the source widget is not equal to
the awt_root_shell.
In Motif 1.2 there is no such API, so this requires some trickery.
First of all we need to include a private Motif header file DragCP.h.
Then I suggest to install our own XmDragStartProc procedure into the
xmDragContextClassRec structure and keep a pointer to the original
routine. The new procedure will call the original one only if the
source widget for the drag is equal to the awt_root_shell.
The problem is that if we don't call the original routine the
XmDragContext object can never be destroyed. This happens because
throught Motif 1.2 source base a pointer to the created XmDragContext
object returned from XmDragStart is never kept. So in case if we don't
invoke the original DragStart routine this object will be lost. To
resolve it i suggest to call XtDestroyWidget on the XmDragContext
object if we don't call the original routine.
This is the most risky part of the fix, since we return a pointer to
the destroyed object. But since the object is destroyed if and only if
a XmDragStart is called by Motif drag support and Motif never keeps
the returned pointer (it always casts XmDragStart to void), i think
this is safe enough.
With this fix we can remove the code that disables Motif
drag support for List.
###@###.### 2001-03-17
======================================================================
|