Пример #1
0
/* A device method. */
static void
x_update_scrollbar_instance_status (struct window *w, int active, int size,
				    struct scrollbar_instance *instance)
{
  struct frame *f = XFRAME (w->frame);
  Boolean managed = XtIsManaged (SCROLLBAR_X_WIDGET (instance));

  if (active && size)
    {
      widget_value *wv = scrollbar_instance_to_widget_value (instance);

      if (instance->scrollbar_instance_changed)
	{
	  lw_modify_all_widgets (SCROLLBAR_X_ID (instance), wv, 0);
	  instance->scrollbar_instance_changed = 0;
	}

      if (!managed)
	{
	  XtManageChild (SCROLLBAR_X_WIDGET (instance));
	  if (XtWindow (SCROLLBAR_X_WIDGET (instance)))
	    {
	      /* Raise this window so that it's visible on top of the
                 text window below it. */
	      XRaiseWindow (XtDisplay (SCROLLBAR_X_WIDGET (instance)),
			    XtWindow (SCROLLBAR_X_WIDGET (instance)));
	      update_one_widget_scrollbar_pointer
		(w, SCROLLBAR_X_WIDGET (instance));
	      if (!SCROLLBAR_X_BACKING_STORE_INITIALIZED (instance))
		{
		  update_one_scrollbar_bs (f, SCROLLBAR_X_WIDGET (instance));
		  SCROLLBAR_X_BACKING_STORE_INITIALIZED (instance) = 1;
		}
	    }
	}

      if (!wv->scrollbar_data) ABORT ();
      free_widget_value_tree (wv);
    }
  else if (managed)
    {
#if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID)
      /* This isn't needed with Athena Scrollbars.  It might not be needed */
      /* with Motif scrollbars (it is apparently needed with Lesstif). */
      XtUngrabKeyboard (SCROLLBAR_X_WIDGET (instance), CurrentTime);
#endif
      XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
    }
}
Пример #2
0
/************************************************************************ 
 *  FUNCTION: PLAYER_EditColor
 *  HISTORY: 
 *     01.29.95  ESF  Created.
 *     15.01.00  MSH  Fixed to update color indicator widget after edit.
 *  PURPOSE: 
 *  NOTES: 
 ************************************************************************/
void PLAYER_EditColor(void)
{
  /* Relinquish the keyboard focus */
  XtUngrabKeyboard(wPlayerNameText, CurrentTime);

  /* Popup the color editing dialog */
  COLEDIT_EditColor(COLOR_DieToColor(0), FALSE);

  /* Update the color indicator */
  XtVaSetValues(wPlayerColorDisplay, XtNbackground, 
		COLOR_QueryColor(COLOR_DieToColor(0)), NULL);

  /* Regain the keyboard focus */
  while(XtGrabKeyboard(wPlayerNameText, True, GrabModeAsync, GrabModeAsync, 
		       CurrentTime) == GrabNotViewable)
    ; /* TwiddleThumbs() */
}
Пример #3
0
/*ARGSUSED*/
static void 
Popdown(Widget shell,
        XEvent *event,		/* unused */
	String *params,
	Cardinal *num_params)
{
  XmScreen screen = (XmScreen) XmGetXmScreen(XtScreen(shell));
  XmGrabShellWidget grabshell = (XmGrabShellWidget)shell;
  Time time;
  
  /* Record for replay detection */
  if (event && (event->type == ButtonPress || event->type == ButtonRelease)) {
    grabshell->grab_shell.unpost_time = event->xbutton.time;
  }

  if (!(time = XtLastTimestampProcessed(XtDisplay(shell))))
    time = CurrentTime;

  /* CR 9920:  Popdown may be called before MapNotify. */
  if (grabshell->shell.popped_up && grabshell->grab_shell.mapped)
    {
      XErrorHandler old_handler;

      if (screen -> screen.unpostBehavior == XmUNPOST_AND_REPLAY)
	GSAllowEvents(shell, ReplayPointer, event ? event->xbutton.time : time);
      XtUngrabPointer(shell, time);
      XtUngrabKeyboard(shell, time);
      _XmPopdown(shell);

      /* Reset focus to old holder */
      old_handler = XSetErrorHandler(IgnoreXErrors);
      if (time != CurrentTime) time = time - 1; /* Avoid race in wm */
      XSetInputFocus(XtDisplay(shell), grabshell->grab_shell.old_focus,
		     grabshell->grab_shell.old_revert_to, time);
      XSync(XtDisplay(shell), False);
      XSetErrorHandler(old_handler);
    }

  grabshell->grab_shell.mapped = False;
}