зеркало из https://github.com/mozilla/pjs.git
b=497498 move early drag end code to drag_motion_event_cb and correct return value r=roc
--HG-- extra : rebase_source : 418991e220b53a3254179bf45e18ab90a1124dff
This commit is contained in:
Родитель
08280da7ad
Коммит
de62deccd2
|
@ -277,7 +277,7 @@ nsWindow *nsWindow::sLastDragMotionWindow = NULL;
|
|||
|
||||
// Time of the last button release event. We use it to detect when the
|
||||
// drag ended before we could properly setup drag and drop.
|
||||
guint32 nsWindow::sLastButtonReleaseTime = 0;
|
||||
static guint32 sLastButtonReleaseTime = 0;
|
||||
static guint32 sLastUserInputTime = GDK_CURRENT_TIME;
|
||||
static guint32 sRetryGrabTime;
|
||||
|
||||
|
@ -3376,23 +3376,6 @@ nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
|
|||
{
|
||||
LOGDRAG(("nsWindow::OnDragMotionSignal\n"));
|
||||
|
||||
if (sLastButtonReleaseTime) {
|
||||
// The drag ended before it was even setup to handle the end of the drag
|
||||
// So, we fake the button getting released again to release the drag
|
||||
GtkWidget *widget = gtk_grab_get_current();
|
||||
GdkEvent event;
|
||||
gboolean retval;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = GDK_BUTTON_RELEASE;
|
||||
event.button.time = sLastButtonReleaseTime;
|
||||
event.button.button = 1;
|
||||
sLastButtonReleaseTime = 0;
|
||||
if (widget) {
|
||||
g_signal_emit_by_name(widget, "button_release_event", &event, &retval);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// get our drag context
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
|
||||
nsDragService *dragServiceGTK =
|
||||
|
@ -5952,6 +5935,24 @@ drag_motion_event_cb(GtkWidget *aWidget,
|
|||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
if (sLastButtonReleaseTime) {
|
||||
// The drag ended before it was even setup to handle the end of the drag
|
||||
// So, we fake the button getting released again to release the drag
|
||||
GtkWidget *widget = gtk_grab_get_current();
|
||||
GdkEvent event;
|
||||
gboolean retval;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = GDK_BUTTON_RELEASE;
|
||||
event.button.time = sLastButtonReleaseTime;
|
||||
event.button.button = 1;
|
||||
sLastButtonReleaseTime = 0;
|
||||
if (widget) {
|
||||
g_signal_emit_by_name(widget, "button_release_event", &event, &retval);
|
||||
// FALSE means we won't reply with a status message.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return window->OnDragMotionEvent(aWidget,
|
||||
aDragContext,
|
||||
aX, aY, aTime, aData);
|
||||
|
|
|
@ -307,7 +307,6 @@ public:
|
|||
#endif /* MOZ_X11 */
|
||||
|
||||
static guint32 sLastButtonPressTime;
|
||||
static guint32 sLastButtonReleaseTime;
|
||||
|
||||
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
||||
NS_IMETHOD BeginMoveDrag(nsMouseEvent* aEvent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче