예제 #1
0
파일: plugin.c 프로젝트: UlricE/SiagOffice
int plugin_hide(int ph)
{
	int i;
	XWMHints *hints;
	Display *display = XtDisplay(topLevel);
	Screen *screen = XtScreen(topLevel);
	Window w = plugin[ph].victim;

	XSync(display, False);
	XWithdrawWindow(display, w, XScreenNumberOfScreen(screen));
        XSync(display, False);
        hints = XGetWMHints(display, w);
        hints->flags |= WindowGroupHint;
        hints->window_group = RootWindowOfScreen(screen);
        XSetWMHints(display, w, hints);
#if 1	/* testing */
	for (i = 0; i < REPARENT_LOOPS; i++) {
		Window root, parent, *child;
		Cardinal n;
		XQueryTree(display, w, &root, &parent, &child, &n);
		XReparentWindow(display, w, root, 0, 0);
		XSync(display, False);
	}
#endif
	if (plugin[ph].core != None) {
		XtDestroyWidget(plugin[ph].core);
		plugin[ph].core = None;
	}
	return 0;
}
예제 #2
0
void KDETrayProxy::withdrawWindow(Window w)
{
    XWithdrawWindow(qt_xdisplay(), w, qt_xscreen());
    static Atom wm_state = XInternAtom(qt_xdisplay(), "WM_STATE", False);
    for(;;)
    {
        Atom type;
        int format;
        unsigned long length, after;
        unsigned char *data;
        int r = XGetWindowProperty(qt_xdisplay(), w, wm_state, 0, 2, False, AnyPropertyType, &type, &format, &length, &after, &data);
        bool withdrawn = true;
        if(r == Success && data && format == 32)
        {
            withdrawn = (*(long *)data == WithdrawnState);
            XFree((char *)data);
        }
        if(withdrawn)
            return; // --->
        struct timeval tm;
        tm.tv_sec = 0;
        tm.tv_usec = 10 * 1000; // 10ms
        select(0, NULL, NULL, NULL, &tm);
    }
}
void event_loop(Display *dpy) {
    XEvent event;
    
    while(1) {
	XNextEvent(dpy, &event);

	switch(event.type) {
	case Expose:
	    draw(dpy, event.xexpose.window);
	    break;
	
	case KeyPress:
	    printf("withdrawing window...\n");
	    XWithdrawWindow(dpy, event.xkey.window, DefaultScreen(dpy));
	    XFlush(dpy);
	    printf("sleeping...\n");
	    sleep(1);
	    printf("mapping window again...\n");
	    XMapWindow(dpy, event.xkey.window);
	    printf("drawing...\n");
	    draw(dpy, event.xkey.window);
	    XFlush(dpy);
	    break;
    
	case ConfigureNotify:
	    resize(dpy, event.xconfigure.window, event.xconfigure.width,
		   event.xconfigure.height);
	    break;
	}	
    }
}
예제 #4
0
void DockContainer::embed( WId id )
{
    if( id == _embeddedWinId || id == 0)
        return;
    QRect geom = KWin::windowInfo(id,NET::WMKDEFrameStrut).frameGeometry();

    // does the same as KWM::prepareForSwallowing()
    XWithdrawWindow( qt_xdisplay(), id, qt_xscreen() );
    while( KWin::windowInfo(id, NET::XAWMState).mappingState() != NET::Withdrawn );

    XReparentWindow( qt_xdisplay(), id, winId(), 0, 0 );

    // resize if window is bigger than frame
    if( (geom.width() > width()) ||
        (geom.height() > height()) )
        XResizeWindow( qt_xdisplay(), id, width(), height() );
    else
        XMoveWindow(qt_xdisplay(), id,
                    (sz() -  geom.width())/2 - border(),
                    (sz() - geom.height())/2 - border());
    XMapWindow( qt_xdisplay(), id );
    XUngrabButton( qt_xdisplay(), AnyButton, AnyModifier, winId() );

    _embeddedWinId = id;
}
예제 #5
0
void 
HidePresenceBox(
        WmScreenData *pSD,
        Boolean userDismissed )

{
    if (pSD->presence.onScreen)
    {
	/* Pop down the shell */
	XtPopdown (pSD->presence.shellW);

	/* 
	 * Do a withdraw to make sure window gets unmanaged
	 * (popdown does nothing if its unmapped)
	 */
	XWithdrawWindow (DISPLAY, XtWindow (pSD->presence.shellW),
			 pSD->screen);
	/* must sync to insure event order */
	XSync (DISPLAY, False);


	pSD->presence.onScreen = False;
	pSD->presence.userDismissed = userDismissed;
    }
} /* END OF FUNCTION   */
예제 #6
0
파일: xdep.cpp 프로젝트: bhache/pkg-neuron
void PrintableWindow::hide() {
	if (bound()) {
		if (is_mapped()) {
			xplace(xleft(), xtop());
//printf("hide %lx %d %d\n", (long)this, xleft_, xtop_);
			WindowRep& w = *((Window*)this)->rep();
			XWithdrawWindow(display()->rep()->display_, w.xwindow_, display()->rep()->screen_);
		}
	}
}
예제 #7
0
/*
 * This function hides the specified window
 */
void fgPlatformHideWindow( SFG_Window *window )
{
    if( window->Parent == NULL )
        XWithdrawWindow( fgDisplay.pDisplay.Display,
                         window->Window.Handle,
                         fgDisplay.pDisplay.Screen );
    else
        XUnmapWindow( fgDisplay.pDisplay.Display,
                      window->Window.Handle );
    XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
}
예제 #8
0
파일: ws.c 프로젝트: jlelli/mplayer-dl
/**
 * @brief Switch window fullscreen state.
 *
 *        Switch normal window to fullscreen and fullscreen window to normal.
 *
 * @param win pointer to a ws window structure
 */
void wsWindowFullscreen(wsWindow *win)
{
    if (win->isFullScreen) {
        if (vo_fs_type & vo_wm_FULLSCREEN)
            /* window manager supports EWMH */
            vo_x11_ewmh_fullscreen(win->WindowID, _NET_WM_STATE_REMOVE);
        else {
            win->X      = win->OldX;
            win->Y      = win->OldY;
            win->Width  = win->OldWidth;
            win->Height = win->OldHeight;
        }

        win->isFullScreen = False;
    } else {
        if (vo_fs_type & vo_wm_FULLSCREEN)
            /* window manager supports EWMH */
            vo_x11_ewmh_fullscreen(win->WindowID, _NET_WM_STATE_ADD);
        else {
            win->OldX      = win->X;
            win->OldY      = win->Y;
            win->OldWidth  = win->Width;
            win->OldHeight = win->Height;
        }

        win->isFullScreen = True;

        wsWindowUpdateXinerama(win);
    }

    /* unknown window manager and obsolete option -fsmode used */
    if (vo_wm_type == 0 && !(vo_fsmode & 16)) {
        XUnmapWindow(wsDisplay, win->WindowID); // required for MWM
        XWithdrawWindow(wsDisplay, win->WindowID, wsScreen);
    }

    /* restore window if window manager doesn't support EWMH */
    if (!(vo_fs_type & vo_wm_FULLSCREEN)) {
        if (!win->isFullScreen)
            wsWindowDecoration(win);

        wsWindowSizeHint(win);
        wsWindowLayer(wsDisplay, win->WindowID, win->isFullScreen);
        XMoveResizeWindow(wsDisplay, win->WindowID, win->X, win->Y, win->Width, win->Height);
    }

    /* some window managers lose ontop after fullscreen */
    if (!win->isFullScreen & vo_ontop)
        wsWindowLayer(wsDisplay, win->WindowID, vo_ontop);

    wsWindowRaiseTop(wsDisplay, win->WindowID);
    XFlush(wsDisplay);
}
예제 #9
0
// Cancel plot
static void popdown_plot_shell(PlotWindowInfo *plot)
{
    static bool entered = false;
    if (entered)
	return;

    entered = true;

    // Manage dialogs
    if (plot->working_dialog != 0)
	XtUnmanageChild(plot->working_dialog);
    if (plot->command_dialog != 0)
	XtUnmanageChild(plot->command_dialog);
    if (plot->export_dialog != 0)
	XtUnmanageChild(plot->export_dialog);

    if (plot->shell != 0)
    {
	XWithdrawWindow(XtDisplay(plot->shell), XtWindow(plot->shell),
			XScreenNumberOfScreen(XtScreen(plot->shell)));
	XtPopdown(plot->shell);

	// XtPopdown may not withdraw an iconified shell.  Hence, make
	// sure the shell really becomes disabled.
	XtSetSensitive(plot->shell, False);
    }

    // Manage settings
    if (plot->settings_timer != 0)
    {
	// Still waiting for settings
	XtRemoveTimeOut(plot->settings_timer);
	plot->settings_timer = 0;

	unlink(plot->settings_file.chars());
    }

    if (plot->settings_delay != 0)
    {
	plot->settings_delay->outcome = "canceled";
	delete plot->settings_delay;
	plot->settings_delay = 0;
    }

    plot->settings = "";

    plot->active = false;

    entered = false;
}
예제 #10
0
engine::engine(uint w, uint h) :
    width(w),
    height(h),
    curTime(std::chrono::system_clock::now())
{
    // создали нативное X11 окно
    
    XSetWindowAttributes attr; 
    data.display = XOpenDisplay(NULL);
    if(!data.display) 
       throw std::runtime_error("can't open X11 display");
    data.root   = XDefaultRootWindow(data.display);
    data.screen = XDefaultScreen(data.display);
    data.visual = XDefaultVisual(data.display, data.screen);
    data.window = XCreateSimpleWindow(data.display,data.root,0,0,width, height,0,0,0);
    
    // Настраиваем окно, обрабатываемые события, декорация и пр

    std::memset(&attr,0,sizeof(attr));
    attr.event_mask = StructureNotifyMask|ButtonPressMask|ButtonReleaseMask|Button1MotionMask|KeyPressMask;
    attr.background_pixel   = 0xFFFF0000;
    XWithdrawWindow(data.display,data.window, data.screen);  
    XChangeWindowAttributes(data.display,data.window,CWBackPixel|CWOverrideRedirect|CWSaveUnder|CWEventMask|CWBorderPixel, &attr);
    XMapWindow(data.display,data.window);
    XFlush(data.display); // немного паранойи

    // получаем GL контекст с помощью GLX
    
    int glx_attr[] = 
    {
        GLX_DOUBLEBUFFER,
        GLX_USE_GL,      True,
        GLX_RGBA,        True,
        GLX_BUFFER_SIZE, 32,
        GLX_DEPTH_SIZE,  24,
        None
    };
    auto visual = glXChooseVisual(data.display, data.screen, glx_attr);
    if(!visual)
       throw std::runtime_error("[GLX] unable to find visual");
    data.context = glXCreateContext(data.display, visual, NULL, True);
    if(!data.context)
       throw std::runtime_error("[GLX] unable to create window context");
    glXMakeCurrent(data.display, data.window, data.context);

    // задаем GL вьюпорт во все окно

    glViewport(0, 0, static_cast<GLsizei>(width), static_cast<GLsizei>(height));
}
예제 #11
0
static void
clutter_stage_x11_hide (ClutterStageWindow *stage_window)
{
  ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
  ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);

  if (stage_x11->xwin != None)
    {
      if (STAGE_X11_IS_MAPPED (stage_x11))
        set_stage_x11_state (stage_x11, 0, STAGE_X11_WITHDRAWN);

      g_assert (!STAGE_X11_IS_MAPPED (stage_x11));

      clutter_actor_unmap (CLUTTER_ACTOR (stage_cogl->wrapper));

      if (!stage_x11->is_foreign_xwin)
        XWithdrawWindow (backend_x11->xdpy, stage_x11->xwin, 0);
    }
}
예제 #12
0
void XtPopdown(
    Widget  widget)
{
    /* Unmap a shell widget if it is mapped, and remove from grab list */
    Widget hookobj;
    ShellWidget shell_widget = (ShellWidget) widget;
    XtGrabKind grab_kind;

    if (! XtIsShell(widget)) {
	XtAppErrorMsg(XtWidgetToApplicationContext(widget),
		"invalidClass","xtPopdown",XtCXtToolkitError,
            "XtPopdown requires a subclass of shellWidgetClass",
              (String *)NULL, (Cardinal *)NULL);
    }

#ifndef X_NO_XT_POPDOWN_CONFORMANCE
    if (!shell_widget->shell.popped_up)
        return;
#endif

    grab_kind = shell_widget->shell.grab_kind;
    XWithdrawWindow(XtDisplay(widget), XtWindow(widget),
		    XScreenNumberOfScreen(XtScreen(widget)));
    if (grab_kind != XtGrabNone)
	XtRemoveGrab(widget);
    shell_widget->shell.popped_up = FALSE;
    XtCallCallbacks(widget, XtNpopdownCallback, (XtPointer)&grab_kind);

    hookobj = XtHooksOfDisplay(XtDisplay(widget));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
	XtChangeHookDataRec call_data;

	call_data.type = XtHpopdown;
	call_data.widget = widget;
	XtCallCallbackList(hookobj,
		((HookObject)hookobj)->hooks.changehook_callbacks,
		(XtPointer)&call_data);
    }
} /* XtPopdown */
예제 #13
0
static void add(Window w){
    warn(DEBUG_INFO, "fdtray: Dock request for window %lx", w);
    int *data = malloc(sizeof(int));
    if(!data){
        warn(DEBUG_ERROR, "memory allocation failed");
        return;
    }
    void *v=catch_BadWindow_errors();
    XWithdrawWindow(display, w, screen);
    XSelectInput(display, w, StructureNotifyMask|PropertyChangeMask);
    Bool map = get_map(w);
    if(uncatch_BadWindow_errors(v)){
        warn(DEBUG_WARN, "fdtray: Dock request for invalid window %lx", w);
        free(data);
        return;
    }
    struct trayicon *icon = icon_add(my_id, w, data);
    if(!icon){
        free(data);
        return;
    }
    icon_set_mapping(icon, map);
}
예제 #14
0
/*
 * This function hides the current window
 */
void FGAPIENTRY glutHideWindow( void )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutHideWindow" );
    FREEGLUT_EXIT_IF_NO_WINDOW ( "glutHideWindow" );

#if TARGET_HOST_UNIX_X11

    if( fgStructure.CurrentWindow->Parent == NULL )
        XWithdrawWindow( fgDisplay.Display,
                         fgStructure.CurrentWindow->Window.Handle,
                         fgDisplay.Screen );
    else
        XUnmapWindow( fgDisplay.Display,
                      fgStructure.CurrentWindow->Window.Handle );
    XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */

#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE

    ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_HIDE );

#endif

    fgStructure.CurrentWindow->State.Redisplay = GL_FALSE;
}
예제 #15
0
/*
 * This function hides the current window
 */
void FGAPIENTRY glutHideWindow( void )
{
    freeglut_assert_ready;
    freeglut_assert_window;

#if TARGET_HOST_UNIX_X11

    if( fgStructure.Window->Parent == NULL )
        XWithdrawWindow( fgDisplay.Display,
                         fgStructure.Window->Window.Handle,
                         fgDisplay.Screen );
    else
        XUnmapWindow( fgDisplay.Display,
                      fgStructure.Window->Window.Handle );
    XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */

#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE

    ShowWindow( fgStructure.Window->Window.Handle, SW_HIDE );

#endif

    fgStructure.Window->State.Redisplay = GL_FALSE;
}
예제 #16
0
// ----------------------------------------------------------------------------------------------
//    Switch to fullscreen.
// ----------------------------------------------------------------------------------------------
void wsFullScreen(wsTWindow *win)
{
    int decoration = 0;

    if (win->isFullScreen) {
        vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH

        if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
            win->X      = win->OldX;
            win->Y      = win->OldY;
            win->Width  = win->OldWidth;
            win->Height = win->OldHeight;
            decoration  = win->Decorations;
        }

#ifdef ENABLE_DPMS
        wsScreenSaverOn(wsDisplay);
#endif

        win->isFullScreen = False;
    } else {
        if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
            win->OldX      = win->X;
            win->OldY      = win->Y;
            win->OldWidth  = win->Width;
            win->OldHeight = win->Height;
            vo_dx           = win->X;
            vo_dy           = win->Y;
            vo_dwidth       = win->Width;
            vo_dheight      = win->Height;
            vo_screenwidth  = wsMaxX;
            vo_screenheight = wsMaxY;
            xinerama_x      = wsOrgX;
            xinerama_y      = wsOrgY;
            update_xinerama_info();
            wsMaxX      = vo_screenwidth;
            wsMaxY      = vo_screenheight;
            wsOrgX      = xinerama_x;
            wsOrgY      = xinerama_y;
            win->X      = wsOrgX;
            win->Y      = wsOrgY;
            win->Width  = wsMaxX;
            win->Height = wsMaxY;
        }

        win->isFullScreen = True;
#ifdef ENABLE_DPMS
        wsScreenSaverOff(wsDisplay);
#endif

        vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD); // adds fullscreen state if wm supports EWMH
    }

    if (!(vo_fs_type & vo_wm_FULLSCREEN)) { // shouldn't be needed with EWMH fs
        vo_x11_decoration(wsDisplay, win->WindowID, decoration);
        vo_x11_sizehint(win->X, win->Y, win->Width, win->Height, 0);
        vo_x11_setlayer(wsDisplay, win->WindowID, win->isFullScreen);

        if ((!(win->isFullScreen)) & vo_ontop)
            vo_x11_setlayer(wsDisplay, win->WindowID, 1);

        XMoveResizeWindow(wsDisplay, win->WindowID, win->X, win->Y, win->Width, win->Height);
    }

    if (vo_wm_type == 0 && !(vo_fsmode & 16)) {
        XWithdrawWindow(wsDisplay, win->WindowID, wsScreen);
    }

    XMapRaised(wsDisplay, win->WindowID);
    XRaiseWindow(wsDisplay, win->WindowID);
    XFlush(wsDisplay);
}
예제 #17
0
void KWM::prepareForSwallowing(Window w){
  XWithdrawWindow(qt_xdisplay(), w, qt_xscreen());
  while (getWindowState(w) != WithdrawnState);
}
예제 #18
0
void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
{
	switch (state)
	{
		case WINDOW_HIDE:
			XWithdrawWindow(xfc->display, appWindow->handle, xfc->screen_number);
			break;

		case WINDOW_SHOW_MINIMIZED:
			XIconifyWindow(xfc->display, appWindow->handle, xfc->screen_number);
			break;

		case WINDOW_SHOW_MAXIMIZED:
			/* Set the window as maximized */
			xf_SendClientEvent(xfc, appWindow->handle, xfc->_NET_WM_STATE, 4,
			                   _NET_WM_STATE_ADD,
			                   xfc->_NET_WM_STATE_MAXIMIZED_VERT,
			                   xfc->_NET_WM_STATE_MAXIMIZED_HORZ, 0);

			/*
			 * This is a workaround for the case where the window is maximized locally before the rail server is told to maximize
			 * the window, this appears to be a race condition where the local window with incomplete data and once the window is
			 * actually maximized on the server - an update of the new areas may not happen. So, we simply to do a full update of
			 * the entire window once the rail server notifies us that the window is now maximized.
			 */
			if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
			{
				xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth,
				                    appWindow->windowHeight);
			}

			break;

		case WINDOW_SHOW:
			/* Ensure the window is not maximized */
			xf_SendClientEvent(xfc, appWindow->handle, xfc->_NET_WM_STATE, 4,
			                   _NET_WM_STATE_REMOVE,
			                   xfc->_NET_WM_STATE_MAXIMIZED_VERT,
			                   xfc->_NET_WM_STATE_MAXIMIZED_HORZ, 0);

			/*
			 * Ignore configure requests until both the Maximized properties have been processed
			 * to prevent condition where WM overrides size of request due to one or both of these properties
			 * still being set - which causes a position adjustment to be sent back to the server
			 * thus causing the window to not return to its original size
			 */
			if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED)
				appWindow->rail_ignore_configure = TRUE;

			if (appWindow->is_transient)
				xf_SetWindowUnlisted(xfc, appWindow->handle);

			XMapWindow(xfc->display, appWindow->handle);

			break;
	}

	/* Save the current rail state of this window */
	appWindow->rail_state = state;
	XFlush(xfc->display);
}
예제 #19
0
static GLUTwindow *
processWindowWorkList(GLUTwindow * window)
{
  int workMask;

  if (window->prevWorkWin) {
    window->prevWorkWin = processWindowWorkList(window->prevWorkWin);
  } else {
    beforeEnd = &window->prevWorkWin;
  }

  /* Capture work mask for work that needs to be done to this
     window, then clear the window's work mask (excepting the
     dummy work bit, see below).  Then, process the captured
     work mask.  This allows callbacks in the processing the
     captured work mask to set the window's work mask for
     subsequent processing. */

  workMask = window->workMask;
  assert((workMask & GLUT_DUMMY_WORK) == 0);

  /* Set the dummy work bit, clearing all other bits, to
     indicate that the window is currently on the window work
     list _and_ that the window's work mask is currently being
     processed.  This convinces __glutPutOnWorkList that this
     window is on the work list still. */
  window->workMask = GLUT_DUMMY_WORK;

  /* Optimization: most of the time, the work to do is a
     redisplay and not these other types of work.  Check for
     the following cases as a group to before checking each one
     individually one by one. This saves about 25 MIPS
     instructions in the common redisplay only case. */
  if (workMask & (GLUT_EVENT_MASK_WORK | GLUT_DEVICE_MASK_WORK |
      GLUT_CONFIGURE_WORK | GLUT_COLORMAP_WORK | GLUT_MAP_WORK)) {
#if !defined(_WIN32)
    /* Be sure to set event mask BEFORE map window is done. */
    if (workMask & GLUT_EVENT_MASK_WORK) {
      long eventMask;

      /* Make sure children are not propogating events this
         window is selecting for.  Be sure to do this before
         enabling events on the children's parent. */
      if (window->children) {
        GLUTwindow *child = window->children;
        unsigned long attribMask = CWDontPropagate;
        XSetWindowAttributes wa;

        wa.do_not_propagate_mask = window->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK;
        if (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) {
          wa.event_mask = child->eventMask | (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK);
          attribMask |= CWEventMask;
        }
        do {
          XChangeWindowAttributes(__glutDisplay, child->win,
            attribMask, &wa);
          child = child->siblings;
        } while (child);
      }
      eventMask = window->eventMask;
      if (window->parent && window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK)
        eventMask |= (window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK);
      XSelectInput(__glutDisplay, window->win, eventMask);
      if (window->overlay)
        XSelectInput(__glutDisplay, window->overlay->win,
          window->eventMask & GLUT_OVERLAY_EVENT_FILTER_MASK);
    }
#endif /* !_WIN32 */
    /* Be sure to set device mask BEFORE map window is done. */
    if (workMask & GLUT_DEVICE_MASK_WORK) {
      __glutUpdateInputDeviceMaskFunc(window);
    }
    /* Be sure to configure window BEFORE map window is done. */
    if (workMask & GLUT_CONFIGURE_WORK) {
#if defined(_WIN32)
      RECT changes;
      POINT point;
      UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER
	| SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER;

      GetClientRect(window->win, &changes);
      
      /* If this window is a toplevel window, translate the 0,0 client
         coordinate into a screen coordinate for proper placement. */
      if (!window->parent) {
        point.x = 0;
        point.y = 0;
        ClientToScreen(window->win, &point);
        changes.left = point.x;
        changes.top = point.y;
      }
      if (window->desiredConfMask & (CWX | CWY)) {
        changes.left = window->desiredX;
        changes.top = window->desiredY;
	flags &= ~SWP_NOMOVE;
      }
      if (window->desiredConfMask & (CWWidth | CWHeight)) {
        changes.right = changes.left + window->desiredWidth;
        changes.bottom = changes.top + window->desiredHeight;
	flags &= ~SWP_NOSIZE;
	/* XXX If overlay exists, resize the overlay here, ie.
	   if (window->overlay) ... */
      }
      if (window->desiredConfMask & CWStackMode) {
	flags &= ~SWP_NOZORDER;
	/* XXX Overlay support might require something special here. */
      }

      /* Adjust the window rectangle because Win32 thinks that the x, y,
         width & height are the WHOLE window (including decorations),
         whereas GLUT treats the x, y, width & height as only the CLIENT
         area of the window.  Only do this to top level windows
         that are not in game mode (since game mode windows do
         not have any decorations). */
      if (!window->parent && window != __glutGameModeWindow) {
        AdjustWindowRect(&changes,
          WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
          FALSE);
      }

      /* Do the repositioning, moving, and push/pop. */
      SetWindowPos(window->win,
        window->desiredStack == Above ? HWND_TOP : HWND_NOTOPMOST,
        changes.left, changes.top,
        changes.right - changes.left, changes.bottom - changes.top,
        flags);

      /* Zero out the mask. */
      window->desiredConfMask = 0;

      /* This hack causes the window to go back to the right position
         when it is taken out of fullscreen mode. */
      if (workMask & GLUT_FULL_SCREEN_WORK) {
        window->desiredConfMask |= CWX | CWY;
        window->desiredX = point.x;
        window->desiredY = point.y;
      }
#else /* !_WIN32 */
      XWindowChanges changes;

      changes.x = window->desiredX;
      changes.y = window->desiredY;
      if (window->desiredConfMask & (CWWidth | CWHeight)) {
        changes.width = window->desiredWidth;
        changes.height = window->desiredHeight;
        if (window->overlay)
          XResizeWindow(__glutDisplay, window->overlay->win,
            window->desiredWidth, window->desiredHeight);
        if (__glutMotifHints != None) {
          if (workMask & GLUT_FULL_SCREEN_WORK) {
            MotifWmHints hints;

            hints.flags = MWM_HINTS_DECORATIONS;
            hints.decorations = 0;  /* Absolutely no
                                       decorations. */
            XChangeProperty(__glutDisplay, window->win,
              __glutMotifHints, __glutMotifHints, 32,
              PropModeReplace, (unsigned char *) &hints, 4);
            if (workMask & GLUT_MAP_WORK) {
              /* Handle case where glutFullScreen is called
                 before the first time that the window is
                 mapped. Some window managers will randomly or
                 interactively position the window the first
                 time it is mapped if the window's
                 WM_NORMAL_HINTS property does not request an
                 explicit position. We don't want any such
                 window manager interaction when going
                 fullscreen.  Overwrite the WM_NORMAL_HINTS
                 property installed by glutCreateWindow's
                 XSetWMProperties property with one explicitly
                 requesting a fullscreen window. */
              XSizeHints hints;

              hints.flags = USPosition | USSize;
              hints.x = 0;
              hints.y = 0;
              hints.width = window->desiredWidth;
              hints.height = window->desiredHeight;
              XSetWMNormalHints(__glutDisplay, window->win, &hints);
            }
          } else {
            XDeleteProperty(__glutDisplay, window->win, __glutMotifHints);
          }
        }
      }
      if (window->desiredConfMask & CWStackMode) {
        changes.stack_mode = window->desiredStack;
        /* Do not let glutPushWindow push window beneath the
           underlay. */
        if (window->parent && window->parent->overlay
          && window->desiredStack == Below) {
          changes.stack_mode = Above;
          changes.sibling = window->parent->overlay->win;
          window->desiredConfMask |= CWSibling;
        }
      }
      XConfigureWindow(__glutDisplay, window->win,
        window->desiredConfMask, &changes);
      window->desiredConfMask = 0;
#endif
    }
#if !defined(_WIN32)
    /* Be sure to establish the colormaps BEFORE map window is
       done. */
    if (workMask & GLUT_COLORMAP_WORK) {
      __glutEstablishColormapsProperty(window);
    }
#endif
    if (workMask & GLUT_MAP_WORK) {
      switch (window->desiredMapState) {
      case WithdrawnState:
        if (window->parent) {
          XUnmapWindow(__glutDisplay, window->win);
        } else {
          XWithdrawWindow(__glutDisplay, window->win,
            __glutScreen);
        }
        window->shownState = 0;
        break;
      case NormalState:
        XMapWindow(__glutDisplay, window->win);
        window->shownState = 1;
        break;
#ifdef _WIN32
      case GameModeState:  /* Not an Xlib value. */
        ShowWindow(window->win, SW_SHOW);
        window->shownState = 1;
        break;
#endif
      case IconicState:
        XIconifyWindow(__glutDisplay, window->win, __glutScreen);
        window->shownState = 0;
        break;
      }
    }
  }
  if (workMask & (GLUT_REDISPLAY_WORK | GLUT_OVERLAY_REDISPLAY_WORK | GLUT_REPAIR_WORK | GLUT_OVERLAY_REPAIR_WORK)) {
    if (window->forceReshape) {
      /* Guarantee that before a display callback is generated
         for a window, a reshape callback must be generated. */
      __glutSetWindow(window);
      window->reshape(window->width, window->height);
      window->forceReshape = False;

      /* Setting the redisplay bit on the first reshape is
         necessary to make the "Mesa glXSwapBuffers to repair
         damage" hack operate correctly.  Without indicating a
         redisplay is necessary, there's not an initial back
         buffer render from which to blit from when damage
         happens to the window. */
      workMask |= GLUT_REDISPLAY_WORK;
    }
    /* The code below is more involved than otherwise necessary
       because it is paranoid about the overlay or entire window
       being removed or destroyed in the course of the callbacks.
       Notice how the global __glutWindowDamaged is used to record
       the layers' damage status.  See the code in glutLayerGet for
       how __glutWindowDamaged is used. The  point is to not have to
       update the "damaged" field after  the callback since the
       window (or overlay) may be destroyed (or removed) when the
       callback returns. */

    if (window->overlay && window->overlay->display) {
      int num = window->num;
      Window xid = window->overlay ? window->overlay->win : None;

      /* If an overlay display callback is registered, we
         differentiate between a redisplay needed for the
         overlay and/or normal plane.  If there is no overlay
         display callback registered, we simply use the
         standard display callback. */

      if (workMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) {
        if (__glutMesaSwapHackSupport) {
          if (window->usedSwapBuffers) {
            if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) {
	      SWAP_BUFFERS_WINDOW(window);
              goto skippedDisplayCallback1;
            }
          }
        }
        /* Render to normal plane. */
#ifdef _WIN32
        window->renderDc = window->hdc;
#endif
        window->renderWin = window->win;
        window->renderCtx = window->ctx;
        __glutWindowDamaged = (workMask & GLUT_REPAIR_WORK);
        __glutSetWindow(window);
        window->usedSwapBuffers = 0;
        window->display();
        __glutWindowDamaged = 0;

      skippedDisplayCallback1:;
      }
      if (workMask & (GLUT_OVERLAY_REDISPLAY_WORK | GLUT_OVERLAY_REPAIR_WORK)) {
        window = __glutWindowList[num];
        if (window && window->overlay &&
          window->overlay->win == xid && window->overlay->display) {

          /* Render to overlay. */
#ifdef _WIN32
          window->renderDc = window->overlay->hdc;
#endif
          window->renderWin = window->overlay->win;
          window->renderCtx = window->overlay->ctx;
          __glutWindowDamaged = (workMask & GLUT_OVERLAY_REPAIR_WORK);
          __glutSetWindow(window);
          window->overlay->display();
          __glutWindowDamaged = 0;
        } else {
          /* Overlay may have since been destroyed or the
             overlay callback may have been disabled during
             normal display callback. */
        }
      }
    } else {
      if (__glutMesaSwapHackSupport) {
        if (!window->overlay && window->usedSwapBuffers) {
          if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) {
	    SWAP_BUFFERS_WINDOW(window);
            goto skippedDisplayCallback2;
          }
        }
      }
      /* Render to normal plane (and possibly overlay). */
      __glutWindowDamaged = (workMask & (GLUT_OVERLAY_REPAIR_WORK | GLUT_REPAIR_WORK));
      __glutSetWindow(window);
      window->usedSwapBuffers = 0;
      window->display();
      __glutWindowDamaged = 0;

    skippedDisplayCallback2:;
    }
  }
  /* Combine workMask with window->workMask to determine what
     finish and debug work there is. */
  workMask |= window->workMask;

  if (workMask & GLUT_FINISH_WORK) {
    /* Finish work makes sure a glFinish gets done to indirect
       rendering contexts.  Indirect contexts tend to have much 
       longer latency because lots of OpenGL extension requests 
       can queue up in the X protocol stream. __glutSetWindow
       is where the finish works gets queued for indirect
       contexts. */
    __glutSetWindow(window);
#if !defined(_WIN32)
    if (!window->isDirect)
#endif
    {
       glFinish();
    }
  }
  if (workMask & GLUT_DEBUG_WORK) {
    __glutSetWindow(window);
    glutReportErrors();
  }
  /* Strip out dummy, finish, and debug work bits. */
  window->workMask &= ~(GLUT_DUMMY_WORK | GLUT_FINISH_WORK | GLUT_DEBUG_WORK);
  if (window->workMask) {
    /* Leave on work list. */
    return window;
  } else {
    /* Remove current window from work list. */
    return window->prevWorkWin;
  }
}
예제 #20
0
void DockBarExtension::windowAdded(WId win)
{
    // try to read WM_COMMAND
    int argc;
    char **argv;
    QString command;
    if(XGetCommand(qt_xdisplay(), win, &argv, &argc))
    {
        command = KShell::joinArgs(argv, argc);
        XFreeStringList(argv);
    }

    // try to read wm hints
    WId resIconwin = 0;
    XWMHints *wmhints = XGetWMHints(qt_xdisplay(), win);
    if(0 != wmhints)
    {   // we managed to read wm hints
        // read IconWindowHint
        bool is_valid = false;
        /* a good dockapp set the icon hint and the state hint,
           if it uses its icon, the window initial state must be "withdrawn"
           if not, then the initial state must be "normal"
           this filters the problematic Eterm whose initial state is "normal"
           and which has an iconwin.
        */
        if((wmhints->flags & IconWindowHint) && (wmhints->flags & StateHint))
        {
            resIconwin = wmhints->icon_window;
            is_valid = (resIconwin && wmhints->initial_state == 0) || (resIconwin == 0 && wmhints->initial_state == 1);

            /* an alternative is a window who does not have an icon,
               but whose initial state is set to "withdrawn". This has been
               added for wmxmms... I hope it won't swallow to much windows :-/
            */
        }
        else if((wmhints->flags & IconWindowHint) == 0 && (wmhints->flags & StateHint))
        {
            is_valid = (wmhints->initial_state == 0);
        }
        XFree(wmhints);
        if(!is_valid)
            return; // we won't swallow this one
    }
    else
        return;

    // The following if statement was at one point commented out,
    // without a comment as to why. This caused problems like
    // Eterm windows getting swallowed whole. So, perhaps now I'll
    // get bug reports about whatever commenting it out was supposed
    // to fix.
    if(resIconwin == 0)
        resIconwin = win;

    // try to read class hint
    XClassHint hint;
    QString resClass, resName;
    if(XGetClassHint(qt_xdisplay(), win, &hint))
    {
        resName = hint.res_name;
        resClass = hint.res_class;
    }
    else
    {
        kdDebug() << "Could not read XClassHint of window " << win << endl;
        return;
    }
    /* withdrawing the window prevents kwin from managing the window,
       which causes the double-launch bug (one instance from the kwin
       session, and one from the dockbar) bug when kde is restarted */
    if(resIconwin != win)
    {
        XWithdrawWindow(qt_xdisplay(), win, qt_xscreen());
        while(KWin::windowInfo(win, NET::XAWMState).mappingState() != NET::Withdrawn)
            ;
    }

    // add a container
    embedWindow(resIconwin, command, resName, resClass);
    saveContainerConfig();
}
예제 #21
0
gboolean reparent_icon(TrayWindow *traywin)
{
	if (systray_profile)
		fprintf(stderr,
		        "[%f] %s:%d win = %lu (%s)\n",
		        profiling_get_time(),
		        __FUNCTION__,
		        __LINE__,
		        traywin->win,
		        traywin->name);
	if (traywin->reparented)
		return TRUE;

	// Watch for the icon trying to resize itself / closing again
	XSync(server.display, False);
	error = FALSE;
	XErrorHandler old = XSetErrorHandler(window_error_handler);
	if (systray_profile)
		fprintf(stderr, "XSelectInput(server.display, traywin->win, ...)\n");
	XSelectInput(server.display, traywin->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
	XWithdrawWindow(server.display, traywin->win, server.screen);
	XReparentWindow(server.display, traywin->win, traywin->parent, 0, 0);

	if (systray_profile)
		fprintf(stderr,
				"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = "
				"%d)\n",
		        traywin->win,
		        traywin->width,
		        traywin->height);
	XMoveResizeWindow(server.display, traywin->win, 0, 0, traywin->width, traywin->height);

	// Embed into parent
	{
		XEvent e;
		e.xclient.type = ClientMessage;
		e.xclient.serial = 0;
		e.xclient.send_event = True;
		e.xclient.message_type = server.atom._XEMBED;
		e.xclient.window = traywin->win;
		e.xclient.format = 32;
		e.xclient.data.l[0] = CurrentTime;
		e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY;
		e.xclient.data.l[2] = 0;
		e.xclient.data.l[3] = traywin->parent;
		e.xclient.data.l[4] = 0;
		if (systray_profile)
			fprintf(stderr, "XSendEvent(server.display, traywin->win, False, NoEventMask, &e)\n");
		XSendEvent(server.display, traywin->win, False, NoEventMask, &e);
	}

	XSync(server.display, False);
	XSetErrorHandler(old);
	if (error != FALSE) {
		fprintf(stderr,
		        RED "systray %d: cannot embed icon for window %lu (%s) parent %lu pid %d" RESET "\n",
		        __LINE__,
		        traywin->win,
		        traywin->name,
		        traywin->parent,
		        traywin->pid);
		remove_icon(traywin);
		return FALSE;
	}

	traywin->reparented = TRUE;

	if (systray_profile)
		fprintf(stderr,
		        "[%f] %s:%d win = %lu (%s)\n",
		        profiling_get_time(),
		        __FUNCTION__,
		        __LINE__,
		        traywin->win,
		        traywin->name);

	return TRUE;
}
예제 #22
0
int main(int argc, char *argv[]) {
	Window window;
	int input_mask;
	XEvent event;
	
    testContext *cxt = test_context_new();
    window = create_window(cxt);
	
	input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
				 ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
				 PointerMotionMask | Button1MotionMask | Button2MotionMask |
				 Button3MotionMask | Button4MotionMask | Button5MotionMask |
				 ButtonMotionMask | KeymapStateMask | ExposureMask |
				 VisibilityChangeMask | StructureNotifyMask | SubstructureNotifyMask |
				 SubstructureRedirectMask | FocusChangeMask | PropertyChangeMask |
				 ColormapChangeMask | OwnerGrabButtonMask;
	XSelectInput(cxt->display, window, input_mask); //设置要响应的事件
	
	XMapWindow(cxt->display, window);
	XFlush(cxt->display);
    int x=0, y=0;
    int width=200, height=300;
    KeySym keysym;
    int num = 0;
	while (1) {
		XNextEvent(cxt->display, &event); //获取事件
		if (event.type!=MotionNotify)
			fprintf(stdout, "event type:%d;%s\n", event.type, X11_EVENT_STRINGS[event.type]);
        switch (event.type) {
        case ButtonPress:
#if 0
            /*点一次按键就移动窗口并修改其尺寸*/
            x+=30;
            y+=20;
            width += 40;
            height += 60;
            XMoveResizeWindow(cxt->display, window, x, y, width, height);
#else
            /* 在窗口区域内按住鼠标左键进行拖动 */
            XUngrabPointer(cxt->display, CurrentTime); //必须要有这句,没有这句不会产生拖动的效果。
            Window child_window;
            XTranslateCoordinates(cxt->display, window, 
                    RootWindowOfScreen(cxt->screen), event.xbutton.x, event.xbutton.y,
                    &x, &y, &child_window); /**< 加上这句解决鼠标拖动窗体时鼠标位置不对的问题 */
            fprintf(stdout, "x:%d;y:%d;%d;%d\n", x, y, event.xbutton.x, event.xbutton.y);
            sendClientEvent(cxt, window, cxt->_NET_WM_MOVERESIZE, 5, x, y, 8, 1, 1);
#endif
            break;
        case KeyPress:
            keysym = XLookupKeysym (&event.xkey, 0);
            if (XK_h == keysym) {
                fprintf(stdout, "h key press;try to hide\n");
                XWithdrawWindow(cxt->display, window, cxt->screen_number);
            } else if (XK_m == keysym) {
                /* 窗口移动 */
                XMoveWindow(cxt->display, window, 200, 100);
            } else if (XK_i == keysym) {
                /* 最小化 */
                XIconifyWindow(cxt->display, window, cxt->screen_number);
            } else if (XK_a == keysym) {
                // 最大化
                //_NET_WM_STATE_MAXIMIZED_{VERT,HORZ} indicates that the window is {vertically,horizontally} maximized
                sendClientEvent(cxt, window, cxt->_NET_WM_STATE, 4, 1, 
                        XInternAtom(cxt->display, "_NET_WM_STATE_MAXIMIZED_VERT", False),
                        XInternAtom(cxt->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False), 0);
            } else if (XK_c == keysym) {
            	fprintf(stdout, "c press\n");
            	// Cursor c = XcursorLibraryLoadCursor(cxt->display, "sb_v_double_arrow");
            	Cursor c = XcursorLibraryLoadCursor(cxt->display, "pencil");
            	XDefineCursor(cxt->display, window, c);
            } else if (XK_q == keysym) {
                fprintf(stdout, "try to quit\n");
                exit(0);
            }
            break;
        case ConfigureNotify:
            if (num++>100) {
                int x, y;
                int child_x;
                int child_y;
                unsigned int mask;
                Window root_window;
                Window child_window;
                XQueryPointer(cxt->display, window,
                    &root_window, &child_window, &x, &y, &child_x, &child_y, &mask); // 鼠标当前位置
                fprintf(stdout, "button position-----------------%d %d %d %d \n", x, y, child_x, child_y);
                fprintf(stdout, "test to stop move=================\n");
                // 停止窗口拖动
                sendClientEvent(cxt, window, cxt->_NET_WM_MOVERESIZE, 5, 0, 0, 11, 1, 1);
                num = 0;
            }
            break;
        }
	}
	
	XDestroyWindow(cxt->display, window);
	XCloseDisplay(cxt->display);
    free(cxt);
    return 0;
}
예제 #23
0
int main (unsigned int argc, char **argv)
{
  FILE *fp;
  
  /* check for existance of ARBOR_GUI_LANGUAGE, exit if absent */
  if (getenv("ARBOR_GUI_LANGUAGE") == NULL)
    {
      printf("Environment variable ARBOR_GUI_LANGUAGE not set.  Exiting...\n");
      exit(1) ;
    }

  /* Add Xt support for i18n: locale */
  XtSetLanguageProc(NULL, NULL, NULL);
  
  XtToolkitInitialize ();
  app_context = XtCreateApplicationContext ();
  display = XtOpenDisplay (app_context, 
			   NULL, 
			   argv[0], 
			   "SysAdmin",
			   NULL, 
			   0, 
			   (int *) &argc, 
			   argv);
  if (!display)
    {
      printf("%s: can't open display, exiting...\n", argv[0]);
      exit (-1);
    }
  
  if ( argc == 2)
    {
      fp = fopen(argv[1],"r");
      if ( fp == (FILE *) NULL)
	{
	  printf ("\007Unable to open password file \"%s\".\n", argv[1]);
	  exit(-1);
	}

      if (fgets(gsSybase_User,80,fp) != NULL)
	gsSybase_User[strlen(gsSybase_User)-1] = 0;
      else
	{
	  printf("\007\nERROR -- Unable to read password file; exiting.") ;
	  exit(1) ;
	}
      if (fgets(gsSybase_Pass,80,fp) != NULL)
	gsSybase_Pass[strlen(gsSybase_Pass)-1] = 0;
      else
	{
	  printf("\007\nERROR -- Unable to read password file; exiting.") ;
	  exit(1) ;
	}

      fclose(fp);
      if ( unlink(argv[1]) )
	{
	  printf("\007WARNING -- Unable to remove password file.\n");
	}
      gintAutoLogin = 1;
    }

  /* Register converters, just in case you are really unlucky !! */
  XmRegisterConverters();
  
  /* String to unit type doesn't get added !! */
  XtAddConverter ( XmRString, XmRUnitType, XmCvtStringToUnitType, NULL, 0 );
  
  strcpy(gstrProcessname, "SysAdmin");
  gLoginMethod1 = GUI_DSQUERY_ONLY;
  create_gCIloginwindow ( display, "SysAdmin", argc, argv );

  XtRealizeWidget (gCIloginwindow);
  XmProcessTraversal(gCIpassword,XmTRAVERSE_CURRENT);
 
  if ( gintAutoLogin )
    {
      XWithdrawWindow(display, XtWindow(gCIloginwindow), 0);
      XmTextSetString(gCIusername,gsSybase_User);
      CI_sybase_login_cb(okloginbtn, NULL, NULL);
    }

  XtAppMainLoop (app_context);

  return(0);
}
예제 #24
0
void draw_help_text(void)

{

  char text[BUFSIZ];
  char *printer;
  gframe_t *frame;
  int code;

  if (Glob->debug) {
    fprintf(stderr, "** draw_help_text **\n");
  }

  /*
   * set local variables
   */

  frame = Glob->help_text_frame;
  code = Glob->help_code;

  XRaiseWindow(Glob->rdisplay, Glob->help_window);

  switch (code) {

  case HELP_PLOT:

    sprintf(text, "%s",
	    "CHANGE TIME FRAME\n \n"
	    "  ANY BUTTON - Double click to change time\n"
	    "  If realtime mode, click on NOW to get current data");
    
    print_text(frame, text);
    
    break;

  case TSCALE_HELP:

    sprintf(text, "%s",
	    "HELP - PROVIDE THIS WINDOW\n \n"
	    "To obtain help on any time_hist action, click any\n"
	    "mouse button in the appropriate window.\n \n"
	    "For rview help, select HELP on the cappi window.\n \n"
	    "Click on CLOSE when you are done.");
    
    print_text(frame, text);
    
    break;
    
  case TSCALE_SELECT:
    
    sprintf(text, "%s",
	    "SELECT TRACKS\n \n"
	    "  Click on SELECT with any button\n"
	    "  Then, move into cappi window, and click on the\n"
	    "  track of interest, as follows:\n \n"
	    "    LEFT   BUTTON - select simple track\n"
	    "    MIDDLE BUTTON - select partial track\n"
	    "    RIGHT  BUTTON - select complex track");

    print_text(frame, text);
    
    break;
    
  case TSCALE_TRACK_SET:
    
    sprintf(text, "%s",
	    "CHANGE TRACK SET SELECTION\n \n"
	    "  LEFT   BUTTON - tracks at current time\n"
	    "  RIGHT  BUTTON - all tracks during ops period");

    print_text(frame, text);
    
    break;
    
  case TSCALE_DATE:
    
    sprintf(text, "%s",
	    "CHANGE PLOT DATE\n \n"
	    "  LEFT   BUTTON - back by a day\n"
	    "  RIGHT  BUTTON - forward by a day");

    print_text(frame, text);
    
    break;
    
  case TSCALE_TIME:
    
    sprintf(text, "%s",
	    "CHANGE PLOT TIME\n \n"
	    "  LEFT   BUTTON - back one scan \n\n"
	    "  RIGHT  BUTTON - ahead by one scan \n\n");

    print_text(frame, text);
    
    break;
    
  case TSCALE_NOW:
    
    sprintf(text, "%s",
	    "CHANGE TO CURRENT DATA\n \n"
	    "  ANY    BUTTON - change to current time");

    print_text(frame, text);
    
    break;
    
  case TSCALE_QUIT:
    
    sprintf(text, "%s",
	    "QUIT\n \n"
	    "  ANY BUTTON - quit time_hist\n");
    
    print_text(frame, text);
    
    break;
    
  case THIST_VOL:
    
    sprintf(text, "%s",
	    "VOLUME PLOT OPTION\n \n"
	    "  LEFT   BUTTON - off\n"
	    "  RIGHT  BUTTON - on ");

    print_text(frame, text);
    
    break;
    
  case THIST_AREA:

    sprintf(text, "%s",
	    "AREA PLOT OPTION\n \n"
	    "  LEFT   BUTTON - off\n"
	    "  RIGHT  BUTTON - on ");

    print_text(frame, text);
    
    break;
    
  case THIST_PFLUX:
    
    sprintf(text, "%s",
	    "PRECIP FLUX PLOT OPTION\n \n"
	    "  LEFT   BUTTON - off\n"
	    "  RIGHT  BUTTON - on ");

    print_text(frame, text);
    
    break;
    
  case THIST_MASS:
    
    sprintf(text, "%s",
	    "MASS PLOT OPTION\n \n"
	    "  LEFT   BUTTON - off\n"
	    "  RIGHT  BUTTON - on ");

    print_text(frame, text);
    
    break;
    
  case THIST_FORECAST:
    
    sprintf(text, "%s%g%s%ld",
	    "FCAST - OPTION TO PLOT FORECAST DATA\n \n"
	    "  LEFT   BUTTON - no forecast plotted\n"
	    "  MIDDLE BUTTON - forecast plotted from present only\n"
	    "  RIGHT  BUTTON - forecast plotted at all scan times\n \n"
	    "    Forecast interval        : ",
	    Glob->track_shmem->forecast_interval / 60.0, " min\n"
	    "    Number of forecast steps : ",
	    (long) Glob->track_shmem->n_forecast_steps);

    print_text(frame, text);
    
    break;
    
  case THIST_FIT:
    
    sprintf(text, "%s",
	    "OPTION TO FIT GAUSSIAN TO TIME HISTORIES\n \n"
	    "  LEFT BUTTON - Fit OFF\n \n"
	    "  RIGHT BUTTON - Fit ON\n");
    
    print_text(frame, text);
    
    break;

  case THIST_COPY:
    
    printer = xGetResString(Glob->rdisplay, Glob->prog_name,
			    "ps_printer", PS_PRINTER),

    sprintf(text, "%s%s%s",
	    "COPY - MAKE HARD COPY\n \n"
	    "  ANY BUTTON - print time history to printer ",
	    printer, "\n");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_MAXZ:
    
    sprintf(text, "%s",
	    "TIME HEIGHT PROFILE - MAX REFLECTIVITY\n \n"
	    "  LEFT   BUTTON - no data - height lines only if selected\n"
	    "  RIGHT  BUTTON - max reflectivity");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_MEANZ:

    sprintf(text, "%s",
	    "TIME HEIGHT PROFILE - MEAN REFLECTIVITY\n \n"
	    "  LEFT   BUTTON - no data - height lines only if selected\n"
	    "  RIGHT  BUTTON - mean reflectivity");
    
    print_text(frame, text);
    
    break;
    
  case TIMEHT_MASS:
    
    sprintf(text, "%s",
	    "TIME HEIGHT PROFILE - MASS\n \n"
	    "  LEFT   BUTTON - no data - height lines only if selected\n"
	    "  RIGHT  BUTTON - mass");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_VORTICITY:
    
    sprintf(text, "%s",
	    "TIME HEIGHT PROFILE - VORTICITY\n \n"
	    "  LEFT   BUTTON - no data - height lines only if selected\n"
	    "  RIGHT  BUTTON - vorticity");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_CENTROIDS:
    
    sprintf(text, "%s%s%s%s",
	    "VOLUME- AND REFL-WEIGHTED CENTROIDS\n \n",
	    "  LEFT   BUTTON - centroids off\n",
	    "  RIGHT  BUTTON - only Z-wt centroid on\n",
	    "  RIGHT  BUTTON - both vol and Z-wt centroids on");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_HTMAXZ:
    
    sprintf(text, "%s",
	    "HEIGHT TRACE OF MAX REFLECTIVITY\n \n"
	    "  LEFT   BUTTON - height trace off\n"
	    "  MIDDLE BUTTON - height trace on\n"
	    "  RIGHT  BUTTON - height trace on, values plotted");

    print_text(frame, text);
    
    break;
    
  case TIMEHT_COPY:
    
    printer = xGetResString(Glob->rdisplay, Glob->prog_name,
			    "ps_printer", PS_PRINTER),

    sprintf(text, "%s%s%s",
	    "COPY - MAKE HARD COPY\n \n"
	    "  ANY BUTTON - print time-height profile to printer ",
	    printer,
	    "\n");

    print_text(frame, text);
    
    break;

  case RDIST_VOL:
    
    sprintf(text, "%s",
	    "CUMULATIVE VOLUME HISTOGRAM - % Volume vs, Reflectivity\n \n"
	    "  ANY BUTTON - volume histogram on\n");
    
    print_text(frame, text);
    
    break;

  case RDIST_AREA:
    
    sprintf(text, "%s",
	    "CUMULATIVE AREA HISTOGRAM - % Area vs, Reflectivity\n \n"
	    "  ANY BUTTON - area histogram on\n");
    
    print_text(frame, text);
    
    break;

  case RDIST_FLIP:
    
    sprintf(text, "%s",
	    "FLIP DATA REPRESENTATION\n \n"
	    "  ANY BUTTON - Flip vertical plotting\n");
    
    print_text(frame, text);
    
    break;

  case RDIST_FIT:
    
    sprintf(text, "%s",
	    "OPTION TO FIT DISTRIBUTION TO HISTOGRAM\n \n"
	    "  LEFT BUTTON - Fit OFF\n \n"
	    "  RIGHT BUTTON - Fit ON\n");
    
    print_text(frame, text);
    
    break;

  case RDIST_COPY:
    
    printer = xGetResString(Glob->rdisplay, Glob->prog_name,
			    "ps_printer", PS_PRINTER),

    sprintf(text, "%s%s%s",
	    "COPY - MAKE HARD COPY\n \n"
	    "  ANY BUTTON - print refl distribution to printer ",
	    printer,
	    "\n");

    print_text(frame, text);
    
    break;

  case HELP_CLOSE:
    
#ifdef X11R3
    XWithdrawWindow(Glob->rdisplay, Glob->help_window,
		    Glob->rscreen);
#else
    XIconifyWindow(Glob->rdisplay, Glob->help_window,
		   Glob->rscreen);
#endif
    
    Glob->help = FALSE;
    break;

  } /* switch */
  
  safe_XFlush(Glob->rdisplay);
  Glob->help_status = CURRENT;

}