🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #9496

Re: Programacion de XMapWindow y XMoveWindow

#9496
From: SETASETA
Date: Tue, 09 Jul 2002 20:17
115 lines
4873 bytes
Hola

 Tienes raz�n, yo los programas que he hecho le pasa lo que tu dices,
 pero es una fraci�n de segundo que tienes que estar muy atento para
 poder darte cuenta que se ha movido la ventana.
 
 En mi p�gina web tengo algunos programas hechos en X puro, miralos y si
> te sirve algo utilizalo.
> www.geocities.com/SETA43
> 
> Yo lo hago de la siguiente forma:
> 
> 
> void mode(int mode_code)
> {
> char mini[10]="juan";
>  XSizeHints *sizehints;
>     if(mode_code==2 || mode_code==3)
> 	{
>          XCloseDisplay(Midisplay);
>          free(pixmapBuffer);
>          goto fin;
>         }
>     Midisplay = XOpenDisplay (NULL);
>     if (!Midisplay)
>      {	fprintf (stderr, "Imposible abrir display \n"); exit (1); }
>     Mipantalla = DefaultScreen (Midisplay); Miattr.event_mask =
>     KeyPressMask | KeyReleaseMask | ButtonPressMask |
> 			   ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
> 			   PointerMotionMask | Button1MotionMask | Button2MotionMask |
> 			   Button3MotionMask | Button4MotionMask | Button5MotionMask |
> 			   ButtonMotionMask | KeymapStateMask | ExposureMask |
> 			   VisibilityChangeMask | StructureNotifyMask |
> 			   SubstructureNotifyMask | SubstructureRedirectMask |
> 			   FocusChangeMask | PropertyChangeMask | ColormapChangeMask |
> 			   OwnerGrabButtonMask;
> 
>     Miattr.background_pixel = WhitePixel(Midisplay,Mipantalla);
>     Miattr.border_pixel = BlackPixel(Midisplay,Mipantalla); Mimask |=
>     (CWBackPixel | CWBorderPixel | CWEventMask);
> 
>     switch(mode_code)
> 	{
> 	 case 10:
> 	    Miventana = XCreateWindow (Midisplay, RootWindow (Midisplay,
> 	    Mipantalla), 100, 100,
>             640, 480,10, 0,InputOutput, (Visual
>             *)CopyFromParent,Mimask,&Miattr);
> 		Wancho=640; Walto=480;
> 		break;
> 	 case 13:
> 	    Miventana = XCreateWindow (Midisplay, RootWindow (Midisplay,
> 	    Mipantalla), 100, 100,
>             320, 200,10, 0,InputOutput, (Visual
>             *)CopyFromParent,Mimask,&Miattr);
> 		Wancho=320; Walto=200;
> 	  break;
> 	 default:
> 	    Miventana = XCreateWindow (Midisplay, RootWindow (Midisplay,
> 	    Mipantalla), 100, 100,
>             320, 200,10, 0,InputOutput, (Visual
>             *)CopyFromParent,Mimask,&Miattr);
> 		Wancho=320; Walto=200;
> 	}
>     
>     	sizehints = XAllocSizeHints();
> 	if(sizehints) {
> 		sizehints->min_width = Wancho;
> 		sizehints->min_height =  Walto;
> 		sizehints->max_width =  Wancho;
> 		sizehints->max_height =  Walto;
> 		sizehints->base_width =  Wancho;
> 		sizehints->base_height =  Walto;
> 		sizehints->flags = PMinSize | PMaxSize | PBaseSize;
> 		XSetWMNormalHints(Midisplay, Miventana, sizehints); XFree(sizehints);
> 	}
>            
>     XSetStandardProperties(Midisplay,Miventana,VARI,VARI,None,NULL,0,NULL);
>     XMapWindow (Midisplay, Miventana);
>     espera(10);
> 	XFlush(Midisplay);
> 	Migc=DefaultGC(Midisplay,Mipantalla); Mivisual =
> 	DefaultVisual(Midisplay,Mipantalla); Midepth  =
> 	DefaultDepth(Midisplay,Mipantalla);
> /*
>         if(Midepth==8)
>             Mimapa =
>             XCreateColormap(Midisplay,XDefaultRootWindow(Midisplay),Mivisual,AllocAll);
>          else
> */
>             Mimapa=DefaultColormap(Midisplay,Mipantalla);
>     printf("Libreria SETA \ndepth=%d %dx%d\n",Midepth,Wancho,Walto);
>   	XMoveWindow(Midisplay,Miventana,16,16); switch(Midepth)
> 		{
> 		 case 8:
> 		  nbscreen=1;     break;
> 		 case 15:
> 		  nbscreen=2;	  break;
> 		 case 16:
> 		  nbscreen=2;	  break;
> 		 default:
> 		  nbscreen=4;
> 		}
> 	tamaBuffer=nbscreen*Wancho*Walto;
> 	pixmapBuffer = malloc( tamaBuffer );
>         
> 	offscreenBuffer = XCreateImage( Midisplay, Mivisual, Midepth, ZPixmap,
> 	0,
>                 (char *) pixmapBuffer, Wancho, Walto, (Midepth==8)?8:32,
>                 0);
> 	pvx=pixmapBuffer;;
> 	setfont("-");
> 
> fin:
> }
Technical Details
Message-ID: <pan.2002.07.09.22.14.35.439824.1909@inicia.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!81.0.45.13!not-for-mail
References: <aff7lq$kb7$1@news.eusc.inter.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,28e145ffa2596c05
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-07-09 15:15:48 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!81.0.45.13!not-for-mail
From: SETASETA <SETASETA@inicia.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Programacion de XMapWindow y XMoveWindow
Date: Tue, 09 Jul 2002 22:17:21 +0200
Lines: 116
Message-ID: <pan.2002.07.09.22.14.35.439824.1909@inicia.es>
References: <aff7lq$kb7$1@news.eusc.inter.net>
NNTP-Posting-Host: 81.0.45.13
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1026252946 22174242 81.0.45.13 (16 [142383])
X-Orig-Path: not-for-mail
User-Agent: Pan/0.11.2 (Unix)
X-Comment-To: "Franco Wankerl" <f.wankerl@nct.ch>