Beispiel #1
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;
}
Beispiel #2
0
static void lostSelection(WMView * view, Atom selection, void *cdata)
{
	TextField *tPtr = (WMTextField *) view->self;

	/* Parameter not used, but tell the compiler that it is ok */
	(void) cdata;

	if (tPtr->flags.ownsSelection) {
		WMDeleteSelectionHandler(view, selection, CurrentTime);
		tPtr->flags.ownsSelection = 0;
	}
	if (tPtr->selection.count != 0) {
		tPtr->selection.count = 0;
		paintTextField(tPtr);
	}
}
Beispiel #3
0
static void destroyTextField(TextField * tPtr)
{
	if (tPtr->timerID)
		WMDeleteTimerHandler(tPtr->timerID);

	W_DestroyIC(tPtr->view);

	WMReleaseFont(tPtr->font);
	/*// use lostSelection() instead of WMDeleteSelectionHandler here? */
	WMDeleteSelectionHandler(tPtr->view, XA_PRIMARY, CurrentTime);
	WMRemoveNotificationObserver(tPtr);

	if (tPtr->text)
		wfree(tPtr->text);

	wfree(tPtr);
}
Beispiel #4
0
static void endDragProcess(WMDraggingInfo * info, Bool deposited)
{
	WMView *view = XDND_SOURCE_VIEW(info);
	WMScreen *scr = W_VIEW_SCREEN(XDND_SOURCE_VIEW(info));

	/* free selection handler while view exists */
	WMDeleteSelectionHandler(view, scr->xdndSelectionAtom, CurrentTime);
	wfree(XDND_SELECTION_PROCS(info));

	if (XDND_DRAG_CURSOR(info) != None) {
		XFreeCursor(scr->display, XDND_DRAG_CURSOR(info));
		XDND_DRAG_CURSOR(info) = None;
	}

	if (view->dragSourceProcs->endedDrag != NULL) {
		/* this can destroy source view (with a "move" action for example) */
		view->dragSourceProcs->endedDrag(view, &XDND_DRAG_ICON_POS(info), deposited);
	}

	/* clear remaining draggging infos */
	wfree(XDND_SOURCE_INFO(info));
	XDND_SOURCE_INFO(info) = NULL;
}