Bug #183370. Mouse pointer changes when dragging text and locks up X. Not part of the default build.

This commit is contained in:
blizzard%redhat.com 2003-02-17 18:50:01 +00:00
parent 511c2e945f
commit 5d219b9e49
3 changed files with 24 additions and 2 deletions

View File

@ -27,6 +27,7 @@
#include "nsDragService.h"
#include "nsWidgetsCID.h"
#include "nsWindow.h"
#include "nsIServiceManager.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
@ -136,12 +137,24 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
if (aActionType & DRAGDROP_ACTION_LINK)
action = (GdkDragAction)(action | GDK_ACTION_LINK);
// Create a fake event for the drag so we can pass the time
// (so to speak.) If we don't do this the drag can end as a
// result of a button release that is actually _earlier_ than
// CurrentTime. So we use the time on the last button press
// event, as that will always be older than the button release
// that ends any drag.
GdkEvent event;
memset(&event, 0, sizeof(GdkEvent));
event.type = GDK_BUTTON_PRESS;
event.button.window = mHiddenWidget->window;
event.button.time = nsWindow::mLastButtonPressTime;
// start our drag.
GdkDragContext *context = gtk_drag_begin(mHiddenWidget,
sourceList,
action,
1,
NULL);
&event);
// make sure to set our default icon
gtk_drag_set_icon_default(context);
gtk_target_list_unref(sourceList);

View File

@ -163,6 +163,10 @@ static nsresult initialize_prefs (void);
// this is the last window that had a drag event happen on it.
nsWindow *nsWindow::mLastDragMotionWindow = NULL;
// This is the time of the last button press event. The drag service
// uses it as the time to start drags.
guint32 nsWindow::mLastButtonPressTime = 0;
static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID);
// the current focus window
@ -1371,6 +1375,9 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
PRUint32 eventType;
nsEventStatus status;
// Always save the time of this event
mLastButtonPressTime = aEvent->time;
// check to see if we should rollup
nsWindow *containerWindow;
GetContainerWindow(&containerWindow);

View File

@ -234,7 +234,9 @@ public:
void SetNonXEmbedPluginFocus(void);
void LoseNonXEmbedPluginFocus(void);
Window mOldFocusWindow;
Window mOldFocusWindow;
static guint32 mLastButtonPressTime;
#ifdef USE_XIM
void IMEComposeStart(void);