Example #1
0
void W_DragSourceStartTimer(WMDraggingInfo * info)
{
	W_DragSourceStopTimer();

	dndSourceTimer = WMAddTimerHandler(XDND_DESTINATION_RESPONSE_MAX_DELAY,
					   dragSourceResponseTimeOut, XDND_SOURCE_VIEW(info));
}
Example #2
0
void WMScreenAbortDrag(W_Screen *screen) {
  if (!screen || !screen->dragInfo.sourceInfo) return;
  W_DragSourceInfo *source = screen->dragInfo.sourceInfo;

  W_DragSourceStopTimer();

  // inform the other client
  if (source->destinationWindow)
    W_SendDnDClientMessage(screen->display, source->destinationWindow,
                           screen->xdndLeaveAtom, WMViewXID(source->sourceView), 0, 0, 0, 0);

  WMDeleteSelectionHandler(source->sourceView, screen->xdndSelectionAtom, CurrentTime);
  wfree(source->selectionProcs);

  if (source->sourceView->dragSourceProcs->endedDrag)
    source->sourceView->dragSourceProcs->endedDrag(source->sourceView, &source->imageLocation, False);

  if (source->icon)
    XDestroyWindow(screen->display, source->icon);

  if (source->dragCursor != None) {
    XDefineCursor(screen->display, screen->rootWin, screen->defaultCursor);
    XFreeCursor(screen->display, source->dragCursor);
  }

  wfree(source);
  screen->dragInfo.sourceInfo = NULL;
}
Example #3
0
static Bool processButtonRelease(WMDraggingInfo * info)
{
	if (XDND_SOURCE_STATE(info) == dropAllowedState) {
		/* begin drop */
		W_DragSourceStopTimer();

		if (!sendDropMessage(info))
			return False;

		W_DragSourceStartTimer(info);
		return True;
	} else {
		if (XDND_DEST_WIN(info) != None)
			sendLeaveMessage(info);

		W_DragSourceStopTimer();
		return False;
	}
}
Example #4
0
static void processMotion(WMDraggingInfo * info, WMPoint * mousePos)
{
	Window newDestination = findDestination(info, mousePos);

	W_DragSourceStopTimer();

	if (newDestination != XDND_DEST_WIN(info)) {
		recolorCursor(info, False);

		if (XDND_DEST_WIN(info) != None) {
			/* leaving a xdnd window */
			sendLeaveMessage(info);
		}

		XDND_DEST_WIN(info) = newDestination;
		XDND_DEST_ACTION(info) = None;
		XDND_NO_POS_ZONE(info).size.width = 0;
		XDND_NO_POS_ZONE(info).size.height = 0;

		if (newDestination != None) {
			/* entering a xdnd window */
			XDND_SOURCE_STATE(info) = idleState;
			storeDestinationProtocolVersion(info);

			if (!sendEnterMessage(info)) {
				XDND_DEST_WIN(info) = None;
				return;
			}

			W_DragSourceStartTimer(info);
		} else {
			XDND_SOURCE_STATE(info) = NULL;
		}
	} else {
		if (XDND_DEST_WIN(info) != None) {
			if (!sendPositionMessage(info, mousePos)) {
				XDND_DEST_WIN(info) = None;
				return;
			}

			W_DragSourceStartTimer(info);
		}
	}
}