コード例 #1
0
ファイル: comm.c プロジェクト: Bluerise/bitrig-xenocara
/* ARGSUSED */
static void
ClientTimedOut(XtPointer data, XtIntervalId *id)
{
  char msg[BUFSIZ];
  Widget w = (Widget) data;
  
  global_client.ident = NO_IDENT;
  XtDisownSelection(w, global_client.atom, 
		    XtLastTimestampProcessed(XtDisplay(w)));
  
  sprintf(msg, res_labels[4],
	  "the Editres Protocol.");
  SetMessage(global_screen_data.info_label, msg);
}
コード例 #2
0
ファイル: comm.c プロジェクト: idunham/dtextra
/* ARGSUSED */
static void
ClientTimedOut(XtPointer data, XtIntervalId *id)
{
  Widget w = (Widget) data;


  global_client.ident = NO_IDENT;
  XtDisownSelection(w,
		    global_client.atom, 
		    XtLastTimestampProcessed(XtDisplay(w)));

  /* "It appears that this client does not understand */
  /* the Editres Protocol" */
  SetMessage(global_screen_data.info_label,
	     res_labels[4],
	     "It appears that this client does not understand the Editres Protocol");

}   /* ClientTimedOut() */
コード例 #3
0
ファイル: TextStrSo.c プロジェクト: att/uwin
/*
 * SetSelection : indicate that we have the selection.
 *
 * Actions :
 *      - indicate it in the source
 *      - deal with Xt Selections (XtOwnSelection etc.)
 *      - call callback(s) (LoseSelection,GainSelection)
 *      - tell the widgets that display us about this (highlight)
 */
static void
SetSelection(XmTextSource source, XmTextPosition left,
	     XmTextPosition right, Time time)
{
    XmSourceData d = source->data;
    int i;
    Boolean gain = False;

    DEBUGOUT(_LtDebug(__FILE__, NULL, "XmTextStrSource SetSelection %d %d\n",
		      left, right));

    if (left >= right)
    {				/* No decent selection */
        /* SG 23/08/1998, just bring into line with changes in TextF.c */
        if(!source->data->hasselection)
        {
            return; /* Already no selection, don't do unnecessary work */
        }
	source->data->hasselection = False;
	source->data->left = -1;
	source->data->right = -1;
	source->data->prim_time = time;

	XtDisownSelection((Widget)d->widgets[0], XA_PRIMARY, time);

	for (i = 0; i < d->numwidgets; i++)
	{
	    XmTextSetHighlight((Widget)d->widgets[i],
			       0, XmTextGetLastPosition((Widget)d->widgets[0]),
			       XmHIGHLIGHT_NORMAL);
	}

	return;
    }

    /* Remember whether we used to have the selection */
    gain = (source->data->hasselection == False);

    /* We have a decent selection; indicate in memory */
    source->data->hasselection = True;
    source->data->left = left;
    source->data->right = right;
    source->data->prim_time = time;

    /* Xt, callbacks */
    DEBUGOUT(_LtDebug(__FILE__, (Widget)d->widgets[0],
		      "XtOwnSelection(_, XA_PRIMARY, ...)\n"));

    if (!XtOwnSelection((Widget)d->widgets[0], XA_PRIMARY, time,
			_XmTextConvertSelection, _XmTextLoseSelection, NULL))
    {
	gain = False;
    }

    if (gain)
    {
	XmAnyCallbackStruct cbs;

	cbs.reason = XmCR_GAIN_PRIMARY;
	cbs.event = NULL;	/* Have no information nested this deep */

	/* FIX ME : Only for one widget ? */
	XtCallCallbackList((Widget)source->data->widgets[0],
			   source->data->widgets[0]->text.gain_primary_callback,
			   (XtPointer)&cbs);

    }

    /* Widgets */
    for (i = 0; i < d->numwidgets; i++) {
	/* Unset the highlight over the complete widget */
	XmTextSetHighlight((Widget)d->widgets[i],
		0, XmTextGetLastPosition((Widget)d->widgets[0]),
		XmHIGHLIGHT_NORMAL);
	/* Highlight the selected area */
	XmTextSetHighlight((Widget)d->widgets[i], left, right,
		XmHIGHLIGHT_SELECTED);
    }
}