static int imfsample_configure(Tcl_Interp *interp, Imfsample *imfsample, int argc, char **argv, int flags) { /* Interpret the configuration arguments according to the specs. */ if (Tk_ConfigureWidget(interp, imfsample->tkwin, config_specs, argc, argv, (char *) imfsample, flags) != TCL_OK) return TCL_ERROR; /* Set the background for the window and create a graphics context for use during redisplay. */ Tk_SetWindowBackground(imfsample->tkwin, Tk_3DBorderColor(imfsample->fg_border)->pixel); Tk_SetWindowBackground(imfsample->tkwin, Tk_3DBorderColor(imfsample->bg_border)->pixel); Tk_SetWindowBackground(imfsample->tkwin, Tk_3DBorderColor(imfsample->cu_border)->pixel); if ((imfsample->copygc == None) && 1/*imfsample->double_buffer*/) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; imfsample->copygc = XCreateGC(imfsample->display, DefaultRootWindow(imfsample->display), GCFunction|GCGraphicsExposures, &gcValues); } if (imfsample->gc == None) { imfsample->gc = XCreateGC(imfsample->display, DefaultRootWindow(imfsample->display), None, NULL); } /* Register the desired geometry for the window, then arrange for the window to be redisplayed. */ Tk_GeometryRequest(imfsample->tkwin, imfsample->width, imfsample->height); Tk_SetInternalBorder(imfsample->tkwin, imfsample->border_width); /* Make sure the resized widget is redrawn. */ imfsample->redraw = TRUE; if (!imfsample->update_pending) { Tcl_DoWhenIdle(imfsample_display, (ClientData) imfsample); imfsample->update_pending = 1; } return TCL_OK; }
void Tk_SetBackgroundFromBorder( Tk_Window tkwin, /* Window whose background is to be set. */ Tk_3DBorder border) /* Token for border. */ { register TkBorder *borderPtr = (TkBorder *) border; Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel); }
/*--------------------------------------------------------------------------*/ int sci_opentk(char *fname, unsigned long l) { Tcl_Interp *TCLinterpLocal = NULL; CheckRhs(0, 0); CheckLhs(1, 1); TCLinterpLocal = Tcl_CreateInterp(); Tcl_Init(TCLinterpLocal); Tk_Init(TCLinterpLocal); TKmainWindow = Tk_MainWindow(TCLinterpLocal); Tk_GeometryRequest(TKmainWindow, 200, 200); Tk_SetWindowBackground(TKmainWindow, WhitePixelOfScreen(Tk_Screen(TKmainWindow))); LhsVar(1) = 0; PutLhsVar(); return 0; }
static PyObject * tkwin_SetBackground(TkWinObject * self, PyObject * args) { PyObject * bgobject; if (!PyArg_ParseTuple(args, "O", &bgobject)) return NULL; if (PyInt_Check(bgobject)) Tk_SetWindowBackground(self->tkwin, PyInt_AsLong(bgobject)); else if (PaxPixmap_Check(bgobject)) Tk_SetWindowBackgroundPixmap(self->tkwin, PaxPixmap_AsPixmap(bgobject)); else return PyErr_Format(PyExc_TypeError, "argument must be integer or pixmap"); Py_INCREF(Py_None); return Py_None; }