Sign in Join
Wiki copytemporary

X11/es

Deutsch · English · Español

El paquete X11 contiene algunas unidades con las traducciones de los ficheros de cabecera X.

Listado de unidades

Las unidades más elementales son:

Por lo que pone en https://en.wikipedia.org/wiki/XCB los desarrolladores han implementado un lenguaje neutral de descripción de interface para facilitar su uso desde otros lenguajes de programación.

Unidades más nuevas:

Todas estas unidades enlazan a varias librerias X. Estas unidades hacen de interface a las librerías cliente documentadas y son por tanto ampliamente inmunes a los cambios en X11<->Xorg.

Ejemplos

Una ventana mostrando un mensaje de texto

Esta es una aplicación muy sencilla que muestra una ventana con un mensaje de texto. De forma rápida lo podemos salvar a un fichero con extensión .pas y cargarlo desde el IDE de fp (si no lo tenemos lo podemos instalar facilmente descargándolo previamente desde sourceforge (Freepascal para Linux):

pascal
program xshowwindow;

{$mode objfpc}{$H+}

uses
  xlib, x, ctypes;

procedure ModalShowX11Window(AMsg: string);
var
  d: PDisplay;
  w: TWindow;
  e: TXEvent;
  msg: PChar;
  s: cint;
begin
  msg := PChar(AMsg);

  { Abre la conexión con el servidor }
  d := XOpenDisplay(nil); //https://www.x.org/releases/X11R7.7-RC1/doc/man/man3/XOpenDisplay.3.xhtml
  if (d = nil) then
  begin
    WriteLn('[ModalShowX11Window] NO puedo abrir el Display');
    exit;
  end;

  s := DefaultScreen(d);

  { Crear la ventana } // https://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#XCreateWindow
  w := XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 400, 100, 1,
                           BlackPixel(d, s), WhitePixel(d, s));

  { Seleccionar el tipo de eventos en los que estamos interesados }
  XSelectInput(d, w, ExposureMask or KeyPressMask);

  { Mapear (mostrar) la ventana }
  XMapWindow(d, w); // https://www.x.org/releases/X11R7.7-RC1/doc/man/man3/XMapWindow.3.xhtml

  { bucle de eventos }
  while (True) do
  begin
    XNextEvent(d, @e); // https://www.x.org/releases/current/doc/man/man3/XNextEvent.3.xhtml
    { dibuja o redibuja la ventana }
    if (e._type = Expose) then
    begin
      XFillRectangle(d, w, DefaultGC(d, s), 30, 40, 10, 10); //https://www.x.org/releases/X11R7.7-RC1/doc/man/man3/XFillRectangle.3.xhtml
      XDrawString(d, w, DefaultGC(d, s), 50, 50, msg, strlen(msg)); // https://www.x.org/releases/X11R7.7-RC1/doc/man/man3/XDrawString.3.xhtml
    end;
    { Salir al presionar una tecla }
    if (e._type = KeyPress) then Break;
  end;

  { Cerrar la conexión con el servidor }
  XCloseDisplay(d); // https://www.x.org/archive/X11R6.8.2/doc/XOpenDisplay.3.html
end;

begin
  ModalShowX11Window('Hola, Esto es un mensaje de texto en la ventana :)');
end.

Podemos utilizar más funciones como XDrawLine, XDrawArc,.....

https://www.x.org/releases/X11R7.7-RC1/doc/man/man3/index.xhtml

See Also

Go back to Packages List


From the Free Pascal wiki, page "X11/es", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2017–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
Jma sp
Jma sp
Jma spA Una ventana mostrando un mensaje
Jma spA Una ventana mostrando un mensaje
Jma spA Una ventana mostrando un mensaje
Jma spA Una ventana mostrando un mensaje
Jma spA Una ventana mostrando un mensaje
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spUna ventana mostrando un mensaje de texto
Jma spListado de unidades
Jma spListado de unidades
Jma spListado de unidades
Jma spListado de unidades
TrevFixed syntax highlighting; deleted category included in page template (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.