Beispiel #1
0
int
main(
  int argc,
  char ** argv )
{

  XtAppContext app_context;
  Widget TheWindow = XtVaAppInitialize( &app_context,
				        "Full Screen Test",
				        NULL, 0,
				        &argc, argv,
				        NULL,
				        NULL );

  if (TheWindow == NULL) exit(1);

  Display *display=XOpenDisplay(NULL);

  int screen = DefaultScreen(display);

  // Destroy the window asociated to the widget
  XtUnrealizeWidget( TheWindow );

  // Put some values in the size, otherwise the window creation will complain
  XtConfigureWidget( TheWindow, 0, 0, 10, 10, 0 );

  // Now set the attributes for the new window
  XSetWindowAttributes attr;

  // We'll handle it; make the Window manager leave us alone
  attr.override_redirect = true;

  Visual *visual =  DefaultVisual(display,screen);

  // Create a window with our attributes
  XtCreateWindow( TheWindow, InputOutput, visual, CWOverrideRedirect, &attr );

  SoXt::init( TheWindow );

  SoXtExaminerViewer *Viewer =
    new SoXtExaminerViewer(TheWindow, "My Examiner Viewer");

  Viewer->setDecoration(FALSE);
  Viewer->setBorder(FALSE);

  SoXt::show(TheWindow);

  // Set size and position; no border
  XtConfigureWidget( TheWindow, 0, 0,
		     DisplayWidth( display, DefaultScreen( display ) ),
		     DisplayHeight( display, DefaultScreen( display ) ), 0 );


  SoXt::mainLoop();

}
Beispiel #2
0
void
ResizeScrollBar(XtermWidget xw)
{
    TScreen *screen = TScreenOf(xw);

    if (screen->scrollWidget != 0) {
	int height = screen->fullVwin.height + screen->border * 2;
	int width = screen->scrollWidget->core.width;
	int ypos = -ScrollBarBorder(xw);
#ifdef SCROLLBAR_RIGHT
	int xpos = ((xw->misc.useRight)
		    ? (screen->fullVwin.fullwidth -
		       screen->scrollWidget->core.width -
		       BorderWidth(screen->scrollWidget))
		    : -ScrollBarBorder(xw));
#else
	int xpos = -ScrollBarBorder(xw);
#endif

	TRACE(("ResizeScrollBar at %d,%d %dx%d\n", ypos, xpos, height, width));

	XtConfigureWidget(
			     screen->scrollWidget,
			     (Position) xpos,
			     (Position) ypos,
			     (Dimension) width,
			     (Dimension) height,
			     BorderWidth(screen->scrollWidget));
	ScrollBarDrawThumb(screen->scrollWidget);
    }
}
Beispiel #3
0
void XtMoveWidget(
    Widget w,
    _XtPosition x,
    _XtPosition y)
{
    XtConfigureWidget(w, x, y, w->core.width, w->core.height,
                      w->core.border_width);
} /* XtMoveWidget */
Beispiel #4
0
void XtResizeWidget(
    Widget w,
    _XtDimension width,
    _XtDimension height,
    _XtDimension borderWidth)
{
    XtConfigureWidget(w, w->core.x, w->core.y, width, height, borderWidth);
} /* XtResizeWidget */
void ResizeScrollBar(TScreen *screen)
{

    /* [email protected] Jul-23-2002 */
    XtConfigureWidget(screen->scrollWidget,
                      -1,-1,
                      screen->scrollWidget->core.width,
                      screen->fullVwin.height + screen->border * 2,
                      screen->scrollWidget->core.border_width);

    ScrollBarDrawThumb(screen->scrollWidget);
}
Beispiel #6
0
static int setwinargs(ArgList args, int n, WnWindow *win, int changed,
		      int *sizep, char **titlep, Widget w)
{
  WnPosition prefpos;
  int enlarge = 1, shrink = 1;
  int sx = 350, sy = 350, noborder = 0, haspref, hassize;
  static char geometry[30];

  WnGet(win, WN_ENLARGE, &enlarge);
  WnGet(win, WN_SHRINK, &shrink);
  hassize = WnGet(win, WN_XSIZE, &sx);
  hassize &= WnGet(win, WN_YSIZE, &sy);
  WnGet(win, WN_NAME, titlep);
  WnGet(win, WN_NOBORDER, &noborder);
  haspref = WnGet(win, WN_PREFPOS, &prefpos);

  if (changed & WNF_HASNAME) {
    XtSetArg(args[n], XmNtitle, *titlep); n++;
  }

  if ((changed & WNF_HASPREF) && haspref > 0) {
    sx = prefpos.xmax - prefpos.xmin + 1;
    sy = prefpos.ymax - prefpos.ymin + 1;
    sprintf(geometry, "=%dx%d+%d-%d", sx, sy, prefpos.xmin, prefpos.ymin);
    XtSetArg(args[n], XmNgeometry, geometry); n++;
    if (w != NULL)
      XtConfigureWidget(w,
			prefpos.xmin, HeightOfScreen(XtScreen(w))-prefpos.ymax-1,
			sx, sy, 0);
  }
  if ((changed & WNF_HASSIZE) && hassize == 1) {
    XtSetArg(args[n], XmNwidth, sx); n++;
    XtSetArg(args[n], XmNheight, sy); n++;
  }

  if (changed & WNF_NOBORDER) {
    XtSetArg(args[n], XmNmwmDecorations,
	     noborder ? 0 : MWM_DECOR_ALL); n++;
  }
  if (changed & (WNF_ENLARGE|WNF_SHRINK)) {
    XtSetArg(args[n], XmNmwmFunctions,
	     enlarge||shrink ? MWM_FUNC_ALL : (MWM_FUNC_ALL|MWM_FUNC_RESIZE)); n++;
  }

  if (sizep) {
    sizep[0] = sx;
    sizep[1] = sy;
  }
  return n;
}
Beispiel #7
0
void
ws_geometry_window(PceWindow sw, int x, int y, int w, int h, int pen)
{ Widget wid = widgetWindow(sw);

  w -= 2*pen;
  h -= 2*pen;
  if ( w < 1 ) w = 1;			/* avoid X-errors */
  if ( h < 1 ) h = 1;

  if ( wid )
  { DEBUG(NAME_tile, Cprintf("ws_geometry_window(%s, %d, %d, %d, %d, %d)\n",
			     pp(sw), x, y, w, h, pen));
    XtConfigureWidget(wid, x, y, w, h, pen);
  }
}
Beispiel #8
0
static void DoLayout(Widget w)
{
	MwRudegridWidget rw = (MwRudegridWidget)w;
	Widget child;
	int *cols, *rows;
	int x, y;
	int w1, h1;
	int gx, gy;
	int gw, gh;
	int i, ncols, nrows;
	MwRudegridConstraints rc;

	cols = parse_layout(rw->core.width, rw->rudegrid.x_layout, &ncols);
	rows = parse_layout(rw->core.height, rw->rudegrid.y_layout, &nrows);

	for (i = 0; i < rw->composite.num_children; i++) {
		child = rw->composite.children[i];
		if (!child->core.managed) continue;

		rc = (MwRudegridConstraints)child->core.constraints;
		gx = rc->rudegrid.gridx;
		if (gx < 0) gx = 0;
		if (gx >= ncols) gx = ncols-1;
		gy = rc->rudegrid.gridy;
		if (gy < 0) gy = 0;
		if (gy >= nrows) gy = nrows-1;
		gw = rc->rudegrid.gridWidth;
		if (gw < 0) gw = 0;
		if (gw+gx >= ncols) gw = ncols-gx-1;
		gh = rc->rudegrid.gridHeight;
		if (gh < 0) gh = 0;
		if (gh+gy >= nrows) gh = nrows-gy-1;
		x = cols[gx];
		y = rows[gy];
		w1 = cols[gw+gx]-x;
		if (w1 < REALLYSMALL) w1 = REALLYSMALL;
		h1 = rows[gh+gy]-y;
		if (h1 < REALLYSMALL) h1 = REALLYSMALL;
		XtConfigureWidget(child, x, y, w1, h1, 0);
	}
	MwFree(cols);
	MwFree(rows);
}
Beispiel #9
0
static void
XawPortholeResize(Widget gw)
{
    PortholeWidget pw = (PortholeWidget)gw;
    Widget child = find_child(pw);

    /*
     * If we have a child, we need to make sure that it is at least as big
     * as we are and in the right place
     */
    if (child) {
	Position x, y;
	Dimension width, height;

	layout_child(pw, child, NULL, &x, &y, &width, &height);
	XtConfigureWidget(child, x, y, width, height, 0);
    }

    SendReport(pw, XawPRCanvasWidth | XawPRCanvasHeight);
}
Beispiel #10
0
void
ResizeScrollBar(TScreen *screen)
{
    XtConfigureWidget(
        screen->scrollWidget,
#ifdef SCROLLBAR_RIGHT
        (term->misc.useRight)
        ? (term->core.width -
           screen->scrollWidget->core.width -
           screen->scrollWidget->core.border_width)
        : -1,
#else
        -1,
#endif
        -1,
        screen->scrollWidget->core.width,
        screen->fullVwin.height + screen->border * 2,
        screen->scrollWidget->core.border_width);
    ScrollBarDrawThumb(screen->scrollWidget);
}
static void PortholeCB(Widget w, 
		       XtPointer client_data, 
		       XtPointer call_data)
{
    // Setup panner after change in porthole

    XtCheckSubclass(w, pannedGraphEditWidgetClass, "Bad widget class");
    const PannedGraphEditWidget pw = PannedGraphEditWidget(w);

    Arg args[10];
    int arg = 0;
    XawPannerReport *report = (XawPannerReport *) call_data;
    Widget panner = Widget(client_data);

    Widget form = XtParent(w);
    Dimension form_width, form_height, form_border_width;
    XtVaGetValues(form,
		  XtNwidth,       &form_width,
		  XtNheight,      &form_height,
		  XtNborderWidth, &form_border_width,
		  XtPointer(0));

    WidgetList children;
    XtVaGetValues(w,
                  XtNchildren, &children,
                  XtPointer(0));
    Widget graph_edit = children[0];

    arg = 0;
    XtSetArg (args[arg], ARGSTR(XtNsliderX), report->slider_x); arg++;
    XtSetArg (args[arg], ARGSTR(XtNsliderY), report->slider_y); arg++;
    if (report->changed != (XawPRSliderX | XawPRSliderY))
    {
	XtSetArg (args[arg], ARGSTR(XtNsliderWidth),  report->slider_width);  arg++;
	XtSetArg (args[arg], ARGSTR(XtNsliderHeight), report->slider_height); arg++;
	XtSetArg (args[arg], ARGSTR(XtNcanvasWidth),  report->canvas_width);  arg++;
	XtSetArg (args[arg], ARGSTR(XtNcanvasHeight), report->canvas_height); arg++;
    }
    XtSetValues (panner, args, arg);

    // std::clog << "Form   size " << BoxPoint(form_width, form_height) << "\n";
    // std::clog << "Canvas size " << BoxPoint(report->canvas_width, 
    //                                         report->canvas_height) << "\n";

    Dimension scale, panner_border_width;
    XtVaGetValues(panner, 
		  XtNdefaultScale, &scale,
		  XtNborderWidth,  &panner_border_width,
		  XtPointer(0));

    // Determine new panner size
    Dimension panner_width  = 
	min(max((report->canvas_width * scale) / 100, 
		pw->pannedGraphEdit.minimumPannerWidth),
	    (form_width * pw->pannedGraphEdit.maximumScale) / 100);

    Dimension panner_height = 
	min(max((report->canvas_height * scale) / 100, 
		pw->pannedGraphEdit.minimumPannerHeight), 
	    (form_height * pw->pannedGraphEdit.maximumScale) / 100);

    // std::clog << "Panner size " << BoxPoint(panner_width, panner_height) << "\n";

    Dimension extra_width;
    Dimension extra_height;
    Graph *graph;
    XtVaGetValues(graph_edit,
		  XtNextraWidth,  &extra_width,
		  XtNextraHeight, &extra_height,
		  XtNgraph,       &graph,
		  XtPointer(0));

    bool need_panner = 
	graph != 0
	&& graph->firstVisibleNode() != 0
	&& (report->canvas_width  - extra_width  >= form_width ||
	    report->canvas_height - extra_height >= form_height);

    if (need_panner && panner_width > 0 && panner_height > 0)
    {
	// Map panner in lower right edge of the form

	Dimension panner_window_width = 
	    panner_width  + panner_border_width * 2;
	Dimension panner_window_height = 
	    panner_height + panner_border_width * 2;

	if (!XtIsManaged(panner))
	    XtManageChild(panner);

	// Add the panner size as extra space to graph editor such
	// that the panner cannot obscure parts of the graph.

	extra_width =  panner_window_width;
	extra_height = panner_window_height;
	XtVaSetValues(graph_edit,
		      XtNextraWidth,  extra_width,
		      XtNextraHeight, extra_height,
		      XtPointer(0));

	int panner_x = form_width  - form_border_width - panner_window_width;
	int panner_y = form_height - form_border_width - panner_window_height;

	XtConfigureWidget(panner,
			  panner_x, panner_y, 
			  panner_width, panner_height,
			  panner_border_width);
    }
    else
    {
	// Unmap panner
	XtUnmanageChild(panner);
	XtVaSetValues(graph_edit,
		      XtNextraWidth,  0,
		      XtNextraHeight, 0,
		      XtPointer(0));
    }
}
Beispiel #12
0
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeConfigureWidget(Widget w,int x,int y,int width,int height)
{
    assert( _XfeIsAlive(w) );

#if 0
	printf("_XfeConfigureWidget(%s,%d,%d,%d,%d)\n",XtName(w),x,y,width,height);
#endif

#if 0
	assert( x >= 0 );
	assert( y >= 0 );

	assert( width > 0 );
	assert( height > 0 );
#endif

	/* Ignore this request if width or height are 0 */
	if (!width || !height)
	{
		return;
	}

	/* Make sure the positions and dimensions are different */
	if ((_XfeX(w) == x) && (_XfeY(w) == y) && 
		(_XfeWidth(w) == width) && (_XfeHeight(w) == height))
	{
		return;
	}

	/* Configure XfePrimitive class */
	if (XfeIsPrimitive(w))
	{
		Boolean use_preferred_height;
		Boolean use_preferred_width;
		
		use_preferred_width = _XfeUsePreferredWidth(w);
		use_preferred_height = _XfeUsePreferredHeight(w);
		
		_XfeUsePreferredWidth(w) = False;
		_XfeUsePreferredHeight(w) = False;
		
		XtConfigureWidget(w,x,y,width,height,_XfeBorderWidth(w));
		
		_XfeUsePreferredWidth(w) = use_preferred_width;
		_XfeUsePreferredHeight(w) = use_preferred_height;
	}
	/* Configure XfeManager class */
	else if (XfeIsManager(w))
	{
		Boolean use_preferred_height;
		Boolean use_preferred_width;

		_XfemOldWidth(w) = _XfeWidth(w);
		_XfemOldHeight(w) = _XfeHeight(w);
		
		use_preferred_width = _XfemUsePreferredWidth(w);
		use_preferred_height = _XfemUsePreferredHeight(w);
		
		_XfemUsePreferredWidth(w) = False;
		_XfemUsePreferredHeight(w) = False;
		
		XtConfigureWidget(w,x,y,width,height,_XfeBorderWidth(w));
		
		_XfemUsePreferredWidth(w) = use_preferred_width;
		_XfemUsePreferredHeight(w) = use_preferred_height;
	}
	/* Configure any other class */
	else
	{
		_XmConfigureObject(w,x,y,width,height,_XfeBorderWidth(w));
	}
}
Beispiel #13
0
static void
XawFormResize(Widget w)
{
    FormWidget fw = (FormWidget)w;
    WidgetList children = fw->composite.children;
    int num_children = fw->composite.num_children;
    Widget *childP;
    int x, y;
    int width, height;
    Boolean unmap = XtIsRealized(w) && w->core.mapped_when_managed &&
		    XtIsManaged(w);

    if (unmap)
	XtUnmapWidget(w);

    if (!fw->form.resize_is_no_op)
	for (childP = children; childP - children < num_children; childP++) {
	    FormConstraints form = (FormConstraints)(*childP)->core.constraints;

	    if (!XtIsManaged(*childP))
		continue;

#ifndef OLDXAW
	    x = TransformCoord(form->form.virtual_x, fw->form.old_width,
			       XtWidth(fw), form->form.left);
	    y = TransformCoord(form->form.virtual_y, fw->form.old_height,
			       XtHeight(fw), form->form.top);
	    width = TransformCoord(form->form.virtual_x +
				   form->form.virtual_width +
				   (XtBorderWidth(*childP) << 1),
				   fw->form.old_width, XtWidth(fw),
				   form->form.right) -
				   (x + (XtBorderWidth(*childP) << 1));
	    height = TransformCoord(form->form.virtual_y +
				    form->form.virtual_height +
				    (XtBorderWidth(*childP) << 1),
				    fw->form.old_height, XtHeight(fw),
				    form->form.bottom) -
				    (y + (XtBorderWidth(*childP) << 1));
#else
	    x = TransformCoord(XtX(*childP), fw->form.old_width,
			      XtWidth(fw), form->form.left);
	    y = TransformCoord(XtY(*childP), fw->form.old_height,
			       XtHeight(fw), form->form.top);
	    width = TransformCoord(XtX(*childP) + form->form.virtual_width +
				   (XtBorderWidth(*childP) << 1),
				   fw->form.old_width, XtWidth(fw),
				   form->form.right) -
				   (x + (XtBorderWidth(*childP) << 1));
	    height = TransformCoord(XtY(*childP) + form->form.virtual_height +
				    (XtBorderWidth(*childP) << 1),
				    fw->form.old_height, XtHeight(fw),
				    form->form.bottom) -
				    (y + (XtBorderWidth(*childP) << 1));
	    form->form.virtual_width = width;
	    form->form.virtual_height = height;
#endif

	    width = width < 1 ? 1 : width;
	    height = height < 1 ? 1 : height;

	    XtConfigureWidget(*childP, x, y, width, height,
			      XtBorderWidth(*childP));
	}

    if (unmap)
	XtMapWidget(w);

#ifdef OLDXAW
    fw->form.old_width = XtWidth(fw);
    fw->form.old_height = XtHeight(fw);
#endif
}
Beispiel #14
0
static void Layout(Widget w)
{
    MwRowWidget cw = (MwRowWidget) w;
    XtWidgetGeometry pref_geom , inten_geom;
    Widget *child;
    Dimension width , height;
    Dimension chwidth , chheight ,bwidth;
    Position x,y;
    int lposition , rposition;
    int gravitation;
    int lspace , rspace;
    Boolean resizable;
    int normalwidth = 0 , ressize = 0;
    double psize;
    int chnum = 0;
    int rawwidth;

    inten_geom.request_mode = CWWidth | CWHeight;
    inten_geom.width = cw->core.width;
    inten_geom.height = cw->core.height;

    mwRowClassRec.baseConst_class.get_internal_dimension(w , &x , &y , &width,&height);

    rawwidth = width;

    ForAllChildren(cw , child)
    {

        if (!XtIsManaged(*child)) continue;

        XtVaGetValues(*child , XtNwidth , &chwidth ,
                      XtNleft_space , &lspace ,
                      XtNright_space , &rspace ,
                      XtNresizable , &resizable ,
                      NULL);

        if (resizable)
        {
            XtQueryGeometry(*child , &inten_geom , &pref_geom);
            ressize += pref_geom.width;
            chwidth = 0;
        }

        chnum ++;
        rawwidth -= rspace + lspace;
        normalwidth += rspace + lspace + chwidth;
    }

    if (ressize)
    {
        psize = (double) (width - (cw->core.width - width) -normalwidth) /
                (double) ressize;
    }
    else
    {
        psize = 0;
    }

    inten_geom.request_mode = CWWidth | CWHeight;
    inten_geom.width = width;
    inten_geom.height = height;

    lposition = x + cw->row.spacing;
    rposition = x + width - cw->row.spacing;

    ForAllChildren(cw , child)
    {

        if (!XtIsManaged(*child)) continue;

        XtVaGetValues(*child , XtNheight , &chheight ,
                      XtNwidth , &chwidth ,
                      XtNgravitation , &gravitation ,
                      XtNborderWidth , &bwidth ,
                      XtNleft_space , &lspace ,
                      XtNright_space , &rspace ,
                      XtNresizable , &resizable ,
                      NULL);

        if (cw->row.homogenous)
        {
            chwidth = rawwidth / chnum;
        }
        else
        {
            if (resizable)
            {
                XtQueryGeometry(*child , &inten_geom , &pref_geom);
                chwidth = (int) pref_geom.width * psize;
                chwidth = chwidth ? chwidth : 4;
            }
        }

        switch (gravitation)
        {
        case XtCright:
            rposition -= rspace + chwidth;
            XtConfigureWidget(*child , rposition ,
                              y + cw->row.spacing , chwidth ,
                              height - 2 * cw->row.spacing , bwidth);

            rposition -= lspace;
            break;
        case XtCleft:
        default:
            lposition += lspace;
            XtConfigureWidget(*child , lposition ,
                              y + cw->row.spacing , chwidth ,
                              height - 2 * cw->row.spacing , bwidth);

            lposition += chwidth + rspace;
        }
    }
}