X11/es

From Free Pascal wiki
Revision as of 14:17, 7 August 2017 by Jma sp (talk | contribs) ()
Jump to navigationJump to search

Deutsch (de) English (en) español (es)


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

Listado de unidades

Las unidades más elementales son:

  • X rutinas básicas de X.
  • xcms Algunas gestiones de color.
  • xlib Xlib toolkit.
  • xrender Extensión de renderizado de X.
  • xresource Gestión de recursos de X.
  • xshm Extensión de memoria compartida de X.
  • xutil X util lib.

Unidades más nuevas:

  • cursorfont
  • xinerama
  • xrandr
  • keysym
  • xf86dga.pp
  • xkb
  • xv
  • xf86vmode
  • xkblib
  • xvlib
  • xatom
  • xi

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

A Una ventana mostrando un mensaje

Esta es una aplicación muy sencilla que muestra una ventana con un mensaje escrito.

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);

  { open connection with the server }
  d := XOpenDisplay(nil);
  if (d = nil) then
  begin
    WriteLn('[ModalShowX11Window] Cannot open display');
    exit;
  end;

  s := DefaultScreen(d);

  { create window }
  w := XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 200, 200, 1,
                           BlackPixel(d, s), WhitePixel(d, s));

  { select kind of events we are interested in }
  XSelectInput(d, w, ExposureMask or KeyPressMask);

  { map (show) the window }
  XMapWindow(d, w);

  { event loop }
  while (True) do
  begin
    XNextEvent(d, @e);
    { draw or redraw the window }
    if (e._type = Expose) then
    begin
      XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
      XDrawString(d, w, DefaultGC(d, s), 50, 50, msg, strlen(msg));
    end;
    { exit on key press }
    if (e._type = KeyPress) then Break;
  end;

  { close connection to server }
  XCloseDisplay(d);
end;

begin
  ModalShowX11Window('My message');
end.

See Also

Go back to Packages List