コード例 #1
0
ファイル: deluxe.c プロジェクト: davehorner/XScreenSaverWin
static void
deluxe_reshape (Display *dpy, Window window, void *closure, 
                 unsigned int w, unsigned int h)
{
  struct state *st = (struct state *) closure;
  if (! st->dbuf) {   /* #### more complicated if we have a back buffer... */
    int i;
    XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
    XClearWindow (dpy, window);
    for (i = 0; i < st->count; i++)
      if (st->throbbers[i])
        st->throbbers[i]->fuse = 0;
  }
}
コード例 #2
0
ファイル: main.c プロジェクト: capnramses/opengl_expmts
void draw_frame (Display* display, Window window, GC graphics_context) {
	if (!display) {
		fprintf (stderr, "ERROR: lost display\n");
		return;
	}
	int black_colour = BlackPixel (display, DefaultScreen (display));
	int white_colour = WhitePixel (display, DefaultScreen (display));
	
	XClearWindow (display, window);
	
	XSetForeground (display, graphics_context, black_colour);
	int x = 0, y = 0;
	int width = 36, height = 1024;
	XFillRectangle (display, window, graphics_context, x, y, width, height);
	
	XSetForeground (display, graphics_context, lcharcoal_col.pixel);
	x = 36 + 6 * 80;
	width = 1024 - 36 + 6 * 80;
	height = 768;
	XFillRectangle (display, window, graphics_context, x, y, width, height);
	width = 36, height = 1024;
	
	XSetForeground (display, graphics_context, lineno_col.pixel);
	x = 3, y = 12;
	for (int i = 0; i < 100; i++) {
		char tmp[16];
		sprintf (tmp, "%4i", i + 98);
		int len = strlen (tmp);
		XDrawString (display, window, graphics_context, x, y, tmp, len);
		y += 12;
	}
	
	XSetForeground (display, graphics_context, ruler_col.pixel);
	XDrawLine (display, window, graphics_context, 36 + 6 * 80, 10,
		36 + 6 * 80, 758);
	XDrawLine (display, window, graphics_context, 1000, 10, 1000, 758);

	XSetForeground (display, graphics_context, text_col.pixel);
	x = 3 + width, y = 12 + 12;
	char txt[] = "Hello X11!";
	int len = strlen (txt);
	XDrawString (display, window, graphics_context, x, y, txt, len);
	y += 12;
	char txtb[] = "Here is a lengthy treatise on fonts.";
	len = strlen (txtb);
	XDrawString (display, window, graphics_context, x, y, txtb, len);
	
	//XFlush (display); // dispatches the command queue
}
コード例 #3
0
ファイル: xtut7.c プロジェクト: artem-yazkov/touch
int main_loop(Display *dpy, XFontSet font, GC pen, int width, int height,
		 char *text){
	int text_width;
	int textx, texty;
	XEvent ev;
	int font_ascent;
	XFontStruct **fonts;
	char **font_names;
	int nfonts;
	int j;

	printf("%s:%d\n", text, strlen(text));
	text_width = Xutf8TextEscapement(font, text, strlen(text));
	font_ascent = 0;
	nfonts = XFontsOfFontSet(font, &fonts, &font_names);
	for(j = 0; j < nfonts; j += 1){
		if (font_ascent < fonts[j]->ascent) font_ascent = fonts[j]->ascent;
		printf("Font: %s\n", font_names[j]);
	}


	/* as each event that we asked about occurs, we respond. */
	while(1){
		XNextEvent(dpy, &ev);
		switch(ev.type){
		case Expose:
			if (ev.xexpose.count > 0) break;
			XDrawLine(dpy, ev.xany.window, pen, 0, 0, width/2-text_width/2, height/2);
			XDrawLine(dpy, ev.xany.window, pen, width, 0, width/2+text_width/2, height/2);
			XDrawLine(dpy, ev.xany.window, pen, 0, height, width/2-text_width/2, height/2);
			XDrawLine(dpy, ev.xany.window, pen, width, height, width/2+text_width/2, height/2);
   			textx = (width - text_width)/2;
   			texty = (height + font_ascent)/2;
   			Xutf8DrawString(dpy, ev.xany.window, font, pen, textx, texty, text, strlen(text));
			break;
		case ConfigureNotify:
			if (width != ev.xconfigure.width
					|| height != ev.xconfigure.height) {
				width = ev.xconfigure.width;
				height = ev.xconfigure.height;
				XClearWindow(dpy, ev.xany.window);
			}
			break;
		case ButtonRelease:
			XCloseDisplay(dpy);
			return 0;
		}
	}
}
コード例 #4
0
/*****************************************************************************
  FUNCTION : ui_dispMapBW

  PURPOSE  : Program to display the MAPs of the network in black and white
  NOTES    : 
  RETURNS  : 
  UPDATE   : 22.09.94
******************************************************************************/
static void ui_displMapBW(void)
{
    FlintType strength, this_x, this_y;
    int xx,yy,xc=0,yc=0;
    uint dx,dy;
    FlintType save_act1,save_act2;
  
    /* save unit activations */
    save_act1 = krui_getUnitActivation(MAP_xUnit);
    save_act2 = krui_getUnitActivation(MAP_yUnit);

   /* clear the window */
    XSetForeground(ui_display, MAP_GRAPH_gc[0], 
		   BlackPixel(ui_display,MAP_GRAPH_screen));
    XSetBackground(ui_display, MAP_GRAPH_gc[0], 
		   WhitePixel(ui_display,MAP_GRAPH_screen));
    XClearWindow(ui_display,MAP_GRAPH_win);
  
  
    /* draw the MAP squares */
    for (this_y=MAP_yMin; this_y<MAP_yMax; this_y+=MAP_scaleY) {
	for (this_x=MAP_xMin; this_x<MAP_xMax; this_x+=MAP_scaleX) {
	    krui_setUnitActivation(MAP_xUnit, this_x);
	    krui_setUnitActivation(MAP_yUnit, this_y);
	    krui_updateNet(NULL,(int)NULL);
	    strength = krui_getUnitOutput(MAP_outputUnit);
	    dx = dy = 
		abs(18*(strength-MAP_minWght)/(MAP_maxWght-MAP_minWght)-9);
	    xx = (int)(xc*MAP_BW_squaresizeX)+20;
	    yy = (int)(yc*MAP_BW_squaresizeY)+20;
	    if(strength >(MAP_maxWght-MAP_minWght)/2 ){
		XFillRectangle(ui_display,MAP_GRAPH_win,
			       MAP_GRAPH_gc[0],xx,yy,dx,dy);
	    }else{
		XDrawRectangle(ui_display,MAP_GRAPH_win,
			       MAP_GRAPH_gc[0],xx,yy,dx,dy);
	    }
	    xc++;
	}
	yc++;xc=0;
    }
  
    /* restore unit activations */
    krui_setUnitActivation(MAP_xUnit,save_act1);
    krui_setUnitActivation(MAP_yUnit,save_act2);

    /* draw the scale */
    ui_map_scale(scale); 
} 
コード例 #5
0
ファイル: Repeater.c プロジェクト: aosm/X11libs
/*ARGSUSED*/
static void
tic(XtPointer client_data, XtIntervalId *id)
{
    RepeaterWidget rw = (RepeaterWidget)client_data;

    rw->repeater.timer = 0;		/* timer is removed */
    if (rw->repeater.flash) {
	Widget w = (Widget)rw;

	XClearWindow(XtDisplay(w), XtWindow(w));
	XtCallActionProc(w, "reset", NULL, NULL, 0);
	XClearWindow(XtDisplay(w), XtWindow(w));
	XtCallActionProc(w, "set", NULL, NULL, 0);
    }
    DO_CALLBACK(rw);

    rw->repeater.timer = ADD_TIMEOUT(rw, rw->repeater.next_delay);

    if (rw->repeater.decay) {
	rw->repeater.next_delay -= rw->repeater.decay;
	if (rw->repeater.next_delay < rw->repeater.minimum_delay)
	    rw->repeater.next_delay = rw->repeater.minimum_delay;
    }
}
コード例 #6
0
ファイル: rootimageapp.cpp プロジェクト: KDE/lightdm
void RootImageApp::setBackground()
{
    QFile stdIn;
    stdIn.open(0, QIODevice::ReadOnly);

    QImage image;
    image.load(&stdIn, "xpm");

    QPalette palette;
    palette.setBrush(desktop()->backgroundRole(), QBrush(image));
    desktop()->setPalette(palette);
    XClearWindow(QX11Info::display(), desktop()->winId());

    quit();
}
コード例 #7
0
ファイル: procCanvas.c プロジェクト: arulalant/uvcdat
/*      Clear the VCS Canvas.                                           */
int clearCanvas(Gconid_X_drawable connect_id)
       {
#ifdef X11WM
          /* Display window and clear */
	  if ((connect_id.display != NULL) &&
	     (connect_id.drawable != 0))
	    XClearWindow(connect_id.display,connect_id.drawable);
#elif defined QTWM
	  vcs_legacy_Qt_clear_window_by_id(connect_id.wkst_id);
#else
	  fprintf(stderr,"insert your WM clear function here\n");
#endif

	  return 0;
       }
コード例 #8
0
ファイル: redr_all.c プロジェクト: jttkim/jtk-misclibs
void w_redraw_all(Window win)
{
  WINDOW_DESCR *wd;
  int kind;
  XWindowAttributes xwa;

  if ((wd = find_window(win, &kind)))
  {
    XGetWindowAttributes(_wndh_gl.display, wd->user_window, &xwa);
    XClearWindow(_wndh_gl.display, wd->user_window);
    (wd->redraw)(wd->user_window, xwa.x, xwa.y, xwa.width, xwa.height, wd->slider_xpos, wd->slider_ypos);
  }
  else
    fprintf(stderr, "wndhndlr: w_redraw_all: Warning: Window not found\n");
}
コード例 #9
0
ファイル: graphics.c プロジェクト: WndSks/msys
/* INTPROTO */
void
rxvt_Gr_ClearWindow(rxvt_t *r, grwin_t *grwin)
{
    grcmd_t        *cmd, *next;

    for (cmd = grwin->graphics; cmd != NULL; cmd = next) {
	next = cmd->next;
	free(cmd->coords);
	if (cmd->text != NULL)
	    free(cmd->text);
	free(cmd);
    }
    grwin->graphics = NULL;
    XClearWindow(r->Xdisplay, grwin->win);
}
コード例 #10
0
ファイル: puff_c.c プロジェクト: trayres/PUFF
int ReadKey(void)
{
   XEvent xe;
   int i;

   XClearWindow(dpy,w);
   XFlush(dpy);
   while (key<0) {
      XNextEvent(dpy, &xe);
      process_event(&xe);
   }
   i=key;
   key=-1;
   return i;
}
コード例 #11
0
ファイル: xrama.c プロジェクト: BioinformaticsArchive/GromPy
static bool xrCallBack(struct t_x11 *x11,XEvent *event, Window w, void *data)
{
  t_app   *app;
  t_xrama *xr;
  char    buf[256];
  int     i;
  
  (void)XTextHeight(x11->font);
  app=(t_app *)data;
  xr=app->xr;
  scx=app->xrwd.width/(2.0*M_PI);
  scy=app->xrwd.height/(2.0*M_PI);
  switch (event->type) {
  case Expose:
    XClearWindow(x11->disp,app->xrwd.self);
    XDrawLine(x11->disp,app->xrwd.self,x11->gc,
	      SX(0),SY(-M_PI)+1,SX(0),SY(M_PI)-1);
    XDrawLine(x11->disp,app->xrwd.self,x11->gc,
	      SX(-M_PI)+1,SY(0),SX(M_PI)-1,SY(0));
    TextInRect(x11,app->xrwd.self,"Phi",SX(M_PI)-50,SY(0)+4,46,20,eXRight,eYTop);
    TextInRect(x11,app->xrwd.self,"Psi",SX(0)+4,4,46,20,eXLeft,eYTop);
    for(i=0; (i<xr->npp); i++) 
      if (app->bShowGly || !app->bIsGly[i])
	plot_pp(x11,app->xrwd.self,&(xr->pp[i]),xr->dih);
    break;
  case ButtonPress:
    if (label_pp(x11,app->xrwd.self,xr->npp,xr->pp,xr->dih,
		 event->xbutton.x,event->xbutton.y))
      ExposeWin(x11->disp,app->xrwd.self);
    break;
  case ConfigureNotify:
    app->xrwd.width=event->xconfigure.width;
    app->xrwd.height=event->xconfigure.height;
    break;
  }
  if (app->status == esGo) {
    if (!new_data(app->xr)) 
      app->status=ebStop;
    else {
      ExposeWin(x11->disp,app->xrwd.self);
      sprintf(buf,"Rama: t=%.2f",app->xr->t);
      XSetStandardProperties(x11->disp,app->wd.self,buf,
			     "Rama",0,NULL,0,NULL);
      
    }
  }
  return FALSE;
}
コード例 #12
0
ファイル: balloon.c プロジェクト: cneira/wmaker-crm
static void showText(WScreen *scr, int x, int y, int h, int w, const char *text)
{
	int width;
	int height;
	Pixmap pixmap;
	WMFont *font = scr->info_text_font;

	if (scr->balloon->contents)
		XFreePixmap(dpy, scr->balloon->contents);

	width = getMaxStringWidth(font, text) + 8;
	/*width = WMWidthOfString(font, text, strlen(text))+8; */
	height = countLines(text) * WMFontHeight(font) + 4;

	if (x < 0)
		x = 0;
	else if (x + width > scr->scr_width - 1)
		x = scr->scr_width - width;

	if (y - height - 2 < 0) {
		y += h;
		if (y < 0)
			y = 0;
	} else {
		y -= height + 2;
	}

	if (scr->window_title_texture[0])
		XSetForeground(dpy, scr->draw_gc, scr->window_title_texture[0]->any.color.pixel);
	else
		XSetForeground(dpy, scr->draw_gc, scr->light_pixel);

	pixmap = XCreatePixmap(dpy, scr->root_win, width, height, scr->w_depth);
	XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width, height);

	drawMultiLineString(scr->wmscreen, pixmap, scr->window_title_color[0], font, 4, 2, text, strlen(text));

	XResizeWindow(dpy, scr->balloon->window, width, height);
	XMoveWindow(dpy, scr->balloon->window, x, y);

	XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
	XClearWindow(dpy, scr->balloon->window);
	XMapRaised(dpy, scr->balloon->window);

	scr->balloon->contents = pixmap;

	scr->balloon->mapped = 1;
}
コード例 #13
0
ファイル: scores.c プロジェクト: stephank/jetpack
/*	dialog_key processes keypresses from the dialog
*/
int	dialog_key(XKeyEvent *event)
{
	int				length, l;
	char			buf[MAXNAMELENGTH];
	KeySym			keysym;
	XComposeStatus	composestatus;

	length = XLookupString(event, buf, MAXNAMELENGTH, &keysym,
							&composestatus);
	buf[1] = '\0';
	l = strlen(dtext);
	/*	check for printable character
	*/
	if((keysym >= ' ') && (keysym <= '~') && (length > 0)) {
		if((l + strlen(buf)) < MAXNAMELENGTH) {
			strcat(dtext, buf);
			display_dialog(dialogstringwindow);
		}
	} else {
		switch(keysym) {
			/*	delete key
			*/
			case XK_BackSpace:
			case XK_Delete:
				if(l >= 1) {
					XClearWindow(display, dialogstringwindow);
					l--;
					dtext[l] = '\0';
					display_dialog(dialogstringwindow);
					XFlush(display);
				}
				break;

			/* return is as good as hitting ok
			*/
			case '\n':
			case XK_Return:
			case XK_KP_Enter:
				XFillRectangle(display, dialogbuttonwindow,
								ctable[CBLUE].smallgc, 0, 0, 50, 30);
				display_dialog(dialogbuttonwindow);
				return(1);
			default:
				break;
		}
	}
	return(0);
}
コード例 #14
0
ファイル: cynosure.c プロジェクト: mmarseglia/xscreensaver
static unsigned long
cynosure_draw (Display *dpy, Window window, void *closure)
{
  struct state *st = (struct state *) closure;
  if (st->iterations > 0 && ++st->i >= st->iterations)
    {
      st->i = 0;
      if (!mono_p)
        XSetWindowBackground(st->dpy, st->window,
                             st->colors[random() % st->ncolors].pixel);
      XClearWindow(st->dpy, st->window);
    }
  paint(st);

  return st->delay;
}
コード例 #15
0
static void RedrawZTScale(Canvas canvas, Xv_Window paint_window, 
			  Rectlist *repaint_area)
{
    Window win;
    int which= (int)xv_get(canvas, XV_KEY_DATA, WHICH_TS);

    if (which==TOP_TS) {
	win= ztscl_top_win;
    }else {
	win= ztscl_bot_win;
    }
    XClearWindow(theDisp, win);
    DrawTimeScale(win, ztscl_gc, ts_xstart+ZTrkLabWidth, ZTrkLabWidth,
		  ts_tstart, time_inc, ZCvsWidth, ZTSHEIGHT, ZTotalSeconds,
		  (which==TOP_TS)? TS_UP:TS_DN);
}
コード例 #16
0
ファイル: puff_c.c プロジェクト: trayres/PUFF
int KeyPressed(void)
{
   XEvent xe;
   if (drawcounter>0 && drawcounter==prevdrawcounter) {
      XClearWindow(dpy,w);
      XFlush(dpy);
      drawcounter=0;
   }
   prevdrawcounter=drawcounter;
   if (key>=0) return 1;
   if (XCheckMaskEvent(dpy,KeyPressMask|KeyReleaseMask|StructureNotifyMask,&xe)) {
      process_event(&xe);
      if (key>=0) return 1;
   }
   return 0;
}
コード例 #17
0
ファイル: graphics.c プロジェクト: sundargates/qed-examples
void clearscreen (void) {
 int savecolor;

 if (disp_type == SCREEN) {
    XClearWindow (display, toplevel);
 }
 else {
/* erases current page.  Don't use erasepage, since this will erase *
 * everything, (even stuff outside the clipping path) causing       *
 * problems if this picture is incorporated into a larger document. */
    savecolor = currentcolor;
    setcolor (WHITE);
    fprintf(ps,"clippath fill\n\n");
    setcolor (savecolor);
 }
}
コード例 #18
0
ファイル: WindowDevice.cpp プロジェクト: aceskpark/osfeo
void

WindowDevice::CLEAR()
{
#ifdef _UNIX
  XSetBackground(theDisplay, theGC, background);
  XClearWindow(theDisplay, theWindow);  
  XFlush(theDisplay);
#else
   wglMakeCurrent(theHDC, theHRC);
   glClearColor(1.0f,1.0f,1.0f,1.0f);
   glClear(GL_COLOR_BUFFER_BIT);
 
   glFlush();
#endif
}
コード例 #19
0
ファイル: shadebobs.c プロジェクト: RazZziel/pongclock
static unsigned long
shadebobs_draw (Display *dpy, Window window, void *closure)
{
  struct state *st = (struct state *) closure;

  if( st->draw_i++ >= st->cycles )
    {
      XWindowAttributes XWinAttribs;
      XGetWindowAttributes( st->dpy, st->window, &XWinAttribs );

      st->draw_i = 0;
#if 0
      memset( st->pImage->data, 0, st->pImage->bytes_per_line * st->pImage->height );
#else
      {
        /* fill the image with the actual value of the black pixel, not 0. */
        unsigned long black = BlackPixelOfScreen (XWinAttribs.screen);
        int x, y;
        for (y = 0; y < XWinAttribs.height; y++)
          for (x = 0; x < XWinAttribs.width; x++)
            XPutPixel (st->pImage, x, y, black);
      }
#endif

      for( st->iShadeBob=0; st->iShadeBob<st->nShadeBobCount; st->iShadeBob++ )
        ResetShadeBob( st, &st->aShadeBobs[ st->iShadeBob ] );
      XFreeColors( st->dpy, XWinAttribs.colormap, st->aiColorVals, st->iColorCount, 0 );
      free( st->aiColorVals );
      st->aiColorVals = SetPalette( st );
      XClearWindow( st->dpy, st->window );
    }

  for( st->iShadeBob=0; st->iShadeBob<st->nShadeBobCount; st->iShadeBob++ )
    Execute( st, &st->aShadeBobs[ st->iShadeBob ] );

#ifdef VERBOSE
  iFrame++;
  if( nTime - time( NULL ) )
    {
      printf( "%s: %d FPS\n", progname, iFrame );
      nTime = time( NULL );
      iFrame = 0;
    }
#endif  /*  VERBOSE */

  return st->delay;
}
コード例 #20
0
/*
 ****************************************************************
 *	Malha de Eventos					*
 ****************************************************************
 */
KeySym
wait_for_events (Display *dpy, Window win, int time_interval)
{
	int		fd;
	XEvent		ev;

	fd = ConnectionNumber (dpy);

	for (EVER)
	{
		if (attention (1, &fd, -1, time_interval) < 0)
			return (XK_Down);

		while (XPending (dpy))
		{
			XNextEvent (dpy, &ev);

			switch (ev.type)
			{
			    case Expose:
				XClearWindow (dpy, win);
				XFlush (dpy);
				break;

			    case ButtonPress:
				return (XK_Escape);

			    case KeyPress:
			    {
				char	text[8];
				KeySym	keysym;

				XLookupString (&ev.xkey, text, sizeof (text), &keysym, NULL);

				return (keysym);
			    }

			    default:
				break;
			}

		}	/* end while (há eventos pendentes) */

	}	/* end for (aguardando eventos) */

}	/* end wait_for_events */
コード例 #21
0
ファイル: hhomepage.c プロジェクト: robertoxmed/xhextris
void xhextrisHomepage()
{
    int y, i, x;
    static char *header[] = {"Ordre","Joueur","Score","Ligne", "Pièce"};
    char message[16];

    XClearWindow(dpy,win);
    XMapWindow(dpy,wincur);
    fprintf(stderr, "wincur > %d\n", (int)wincur);
    for (i = 0, y=((CURSOR_H<<2))+32; i < 10; i++,y+=16)
      DISPLAYTEXT(50, y, help[i]);

    y += 32;

    for (i = 0, x=35; i < 5; i++) {
      DISPLAYTEXT(x, y, header[i]);
      x+=strlen(header[i])*9;
    }

    y += 16;

    for (i=0;
	 i<((MAXHIGHSCORES > MAXROW) ? MAXROW : MAXHIGHSCORES); 
	 i++,y+=16) {
      x=35;
      sprintf(message,"%3d",i+1);
      DISPLAYTEXT(x, y, message);
      x+=strlen(header[0])*10;
      DISPLAYTEXT(x, y,(high_scores[i].userid));
      x+=strlen(message)*10;
      sprintf(message,"%*ld",
	      (int) strlen(header[2]),
	      high_scores[i].score);
      DISPLAYTEXT(x, y,(message));
      x+=strlen(message)*10;
      sprintf(message,"%*d",
	      (int) strlen(header[3]),
	      high_scores[i].rows);
      DISPLAYTEXT(x, y, message);
      x+=strlen(message)*10;
      sprintf(message,"%*d",
	       (int) strlen(header[4]),
	      high_scores[i].pieces);
      DISPLAYTEXT(x, y, message);
    }
}
コード例 #22
0
ファイル: xlib_events.c プロジェクト: BehaviorEnterprises/Fex
void configurenotify(XEvent *ev) {
	while (XCheckTypedEvent(dpy,ConfigureNotify, ev));
	XConfigureEvent *e = &ev->xconfigure;
	if (e->window == win) {
		/* The XServer is not storing the new/current values for width +
		 * height.  These must be retrieved directly.
		 * Is this an X11 bug? */
		Window wig;
		int ig;
		unsigned int uig;
		XGetGeometry(dpy, win, &wig, &ig, &ig, &ww, &wh, &uig, &uig);
		//ww = e->width; wh = e->height;
		spectro_draw();
		XSetWindowBackgroundPixmap(dpy, win, buf);
		XClearWindow(dpy,win);
	}
}
コード例 #23
0
/*****************************************************************************
  FUNCTION : ui_map_zoom_out

  PURPOSE  : Zomms away from the weight squares
  NOTES    :
  RETURNS  : 
  UPDATE   : 20.05.1994
******************************************************************************/
static void ui_map_zoom_out(Widget w)
{
    /* delete the old screen display */
    XClearWindow(ui_display,MAP_GRAPH_win);

    /* compute new display geometry */
    ui_map_geometry(-1);

    /* display the new setting */
    if(ui_col_monochromeMode){
	ui_displMapBW();
	ui_map_grid(0);
    }else{
	ui_displMapCOL();
	ui_map_grid(1);
    }
}
コード例 #24
0
void
scrollbar_draw_downarrow(unsigned char image_state, unsigned char force_modes)
{

    D_SCROLLBAR(("scrollbar_draw_downarrow(%u, 0x%02x)\n", (unsigned int) image_state, (unsigned int) force_modes));
    if (image_state != IMAGE_STATE_CURRENT) {
        if ((image_state == IMAGE_STATE_NORMAL) && (images[image_down].current != images[image_down].norm)) {
            images[image_down].current = images[image_down].norm;
            force_modes = MODE_MASK;
        } else if ((image_state == IMAGE_STATE_SELECTED) && (images[image_down].current != images[image_down].selected)) {
            images[image_down].current = images[image_down].selected;
            force_modes = MODE_MASK;
        } else if ((image_state == IMAGE_STATE_CLICKED) && (images[image_down].current != images[image_down].clicked)) {
            images[image_down].current = images[image_down].clicked;
            force_modes = MODE_MASK;
        } else if ((image_state == IMAGE_STATE_DISABLED) && (images[image_down].current != images[image_down].disabled)) {
            images[image_down].current = images[image_down].disabled;
            force_modes = MODE_MASK;
        }
    }
    if (!image_mode_is(image_down, MODE_MASK)) {
        /* Solid mode.  Redraw every time since it's cheap. */
        if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING)) {
            XSetWindowBackground(Xdisplay, scrollbar.dn_win, PixColors[bgColor]);
            XClearWindow(Xdisplay, scrollbar.dn_win);
        } else {
            XSetForeground(Xdisplay, gc_scrollbar, images[image_down].current->bg);
            XFillRectangle(Xdisplay, scrollbar.dn_win, gc_scrollbar, 0, 0, scrollbar_arrow_width(), scrollbar_arrow_height());
        }
        XSetForeground(Xdisplay, gc_top, get_top_shadow_color(images[image_down].current->bg, ""));
        XSetForeground(Xdisplay, gc_bottom, get_bottom_shadow_color(images[image_down].current->bg, ""));
        if (image_state == IMAGE_STATE_CLICKED) {
            scrollbar_set_downarrow_pressed(1);
            draw_downarrow_clicked(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
        } else {
            scrollbar_set_downarrow_pressed(0);
            draw_downarrow_raised(scrollbar.dn_win, gc_top, gc_bottom, 0, 0, scrollbar_arrow_width() - 1, scrollbar_get_shadow());
        }
        return;
    }
    if (!((images[image_down].mode & MODE_MASK) & (force_modes))) {
        return;
    }
    render_simage(images[image_down].current, scrollbar.dn_win, scrollbar_arrow_width(), scrollbar_arrow_height(), image_down, 0);
}
コード例 #25
0
ファイル: coral.c プロジェクト: doctorfree/Coral
void
print_help() 
{
    static char str[80];
    static int y_str, spacing;
    static int ascent, descent, dir;
    static XCharStruct overall;
    static GC gc;

    gc = Data_GC[1];
    XClearWindow(dpy, help);
    y_str = 60;
    sprintf(str,"During run-time, interactive control can be exerted via : ");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    XQueryTextExtents(dpy,(XID)XGContextFromGC(gc),"Hey!",
			4,&dir,&ascent,&descent,&overall);
    spacing = ascent + descent + 5;
    y_str += 2 * spacing;
    sprintf(str,"        - lowers the value of mincolindex, + raises it");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        f or F saves coral to a PPM file");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        h or H or ? displays this message");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        n goes on to the next coral");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        N creates a new replacement coral");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        r or s spins the colorwheel");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        w decrements, W increments the color wheel index");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += spacing;
    sprintf(str,"        q or Q exits");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
    y_str += 2*spacing;
    sprintf(str,"Press 'h', 'H', or '?' to unmap the help window");
    XDrawImageString(dpy,help,gc,x_str,y_str,str,strlen(str));
}
コード例 #26
0
ファイル: proba3.c プロジェクト: Macvol/OldBundle
void init_x() {
/* get the colors black and white (see section for details) */        
	unsigned long black,white;

	dis=XOpenDisplay((char *)0);
   	screen=DefaultScreen(dis);
	black=BlackPixel(dis,screen),
	white=WhitePixel(dis, screen);
   	win=XCreateSimpleWindow(dis,DefaultRootWindow(dis),0,0,	
		300, 300, 5,black, white);
	XSetStandardProperties(dis,win,"Bugaga","Hi",None,NULL,0,NULL);
	XSelectInput(dis, win, ExposureMask|ButtonPressMask|KeyPressMask);
        gc=XCreateGC(dis, win, 0,0);        
	XSetBackground(dis,gc,white);
	XSetForeground(dis,gc,black);
	XClearWindow(dis, win);
	XMapRaised(dis, win);
};
コード例 #27
0
ファイル: extinitwin.c プロジェクト: Limsik/e17
static void
_eiw_window_loop(Window win, EImage * im, EiwData * d)
{
   Pixmap              pmap, mask;
   Window              ww;
   int                 dd, x, y, w, h;
   unsigned int        mm;

   EImageRenderPixmaps(im, NULL, 0, &pmap, &mask, 0, 0);
   EImageGetSize(im, &w, &h);
   XShapeCombineMask(disp, d->cwin, ShapeBounding, 0, 0, mask, ShapeSet);
   XSetWindowBackgroundPixmap(disp, d->cwin, pmap);
   EImagePixmapsFree(pmap, mask);
   XClearWindow(disp, d->cwin);
   XQueryPointer(disp, win, &ww, &ww, &dd, &dd, &x, &y, &mm);
   XMoveResizeWindow(disp, d->cwin, x - w / 2, y - h / 2, w, h);
   XMapWindow(disp, d->cwin);
}
コード例 #28
0
ファイル: dockapp.c プロジェクト: yogsothoth/wmmp
void
dockapp_set_background(Pixmap pixmap)
{
    if (dockapp_iswindowed) {
	Pixmap bg;
	bg = create_bg_pixmap();
	XCopyArea(display, pixmap, bg, gc, 0, 0, width, height,
		  offset_w, offset_w);
	XSetWindowBackgroundPixmap(display, icon_window, bg);
	XSetWindowBackgroundPixmap(display, window, bg);
	XFreePixmap(display, bg);
    } else {
	XSetWindowBackgroundPixmap(display, icon_window, pixmap);
	XSetWindowBackgroundPixmap(display, window, pixmap);
    }
    XClearWindow(display, icon_window);
    XFlush(display);
}
コード例 #29
0
ファイル: worm.c プロジェクト: BuBuaBu/bang-screensaver
ENTRYPOINT void
refresh_worm (ModeInfo * mi)
{
	if (MI_WIN_IS_USE3D(mi))
		/* The 3D code does drawing&clearing by XORing.  We do not
		   want to go to too much trouble here to make it redraw
		   correctly. */
		XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi));
	else if (worms != NULL) {
		wormstruct *wp = &worms[MI_SCREEN(mi)];
		int         i;

		for (i = 0; i < wp->nw; i++) {
			wp->worm[i].redrawing = 1;
			wp->worm[i].redrawpos = 0;
		}
	}
}
コード例 #30
0
static void
mousefunc_sweep_draw(struct client_ctx *cc)
{
    struct screen_ctx	*sc = cc->sc;
    char			 s[14]; /* fits " nnnn x nnnn \0" */

    (void)snprintf(s, sizeof(s), " %4d x %-4d ",
                   (cc->geom.w - cc->hint.basew) / cc->hint.incw,
                   (cc->geom.h - cc->hint.baseh) / cc->hint.inch);

    XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
    XMoveResizeWindow(X_Dpy, sc->menuwin, 0, 0,
                      xu_xft_width(sc->xftfont, s, strlen(s)), sc->xftfont->height);
    XMapWindow(X_Dpy, sc->menuwin);
    XClearWindow(X_Dpy, sc->menuwin);

    xu_xft_draw(sc, s, CWM_COLOR_MENU_FONT, 0, sc->xftfont->ascent + 1);
}