29 Mart 2020 Pazar

X11 İstemcisi - Client

X11 Kütüphanesi
Şu satırı dahil ederiz. Kütüphanenin ismi xlib
#include <X11/Xlib.h>
X11'in API'si oldukça zor. Direkt X11 kodlaması yerine QT, GTK gibi kütüphaneler tercih edilmeli.
Açıklaması şöyle.
Libraries such as qt, gtk, sdl, are next — they make it easier to use X11, and work on other systems such as wayland, Microsoft's Windows, or MacOS.
Xlib ile ilgili bazı eleştiriler şöyle
Xlib is an excellent piece of work, but there are applications for which it is not ideal, for example:

- Small platforms: Xlib is a large piece of code, and it's difficult to make it smaller
- Latency hiding: Xlib requests requiring a reply are effectively synchronous: they block until the reply appears, whether   the result is needed immediately or not.
- Direct access to the protocol: Xlib does quite a bit of caching, layering, and similar optimizations. While this is   normally a feature, it makes it difficult to simply emit specified X protocol requests and process specific responses.
- Threaded applications: While Xlib does attempt to support multithreading, the API makes this difficult and error-prone.
- New extensions: The Xlib infrastructure provides limited support for the new creation of X extension client side code.
Window Manager
X Client'ın çalışması için Window Manager şart değil. Açıklaması şöyle
No, you don't need to be running a window manager to allow an X client to work. Some systems provide an option to just run a terminal at startup, and from that you can start additional programs, including window managers. Some kiosk setups which only want one application to run don't need a window manager. Some implementations of X for microsoft windows avoid an X window manager by letting the OS manage the windows.

Without a window manager you typically need to specify the geometry to the programs so you don't have everything placed in the top left corner.
Java Swing ve Window Manager
Açıklaması şöyle. Yani Java Swing uygulamaları için Window Manager gerekir.
@StephenKitt Java apps (swing) steal the focus upon starting, which means that they completely break any focus-follows-mouse model, unless treated specially. Just like Firefox, java apps need special assistance from the window manager, otherwise drop-down menus won't open, entry boxes won't focus, etc. I don't know if that's still the case, but java was assuming that a window manager is reparenting, unless it was named "LG3D" or similar (java library had a select list of non-parenting WMs, and all the other non-reparenting WMs had to lie about their name ;-))
...
@mosvy that's still the case, at least for openjdk. E.g. in xmonad, you have to configure "LG3D" as window manager-name. Otherwise java-applications with a gui won't work
X11 İstemcileri Birbirleri İle Etkileşebilirler
Açıklaması şöyle.
All the X11 clients on a desktop can access each other in depth, including getting the content of any window, changing it, closing any window, faking key and mouse events to any other client, grabbing any input device, etc.

The X11 protocol design is based on the idea that the clients are all TRUSTED and will collaborate, not step on each other's toes (the latter completely broken by modern apps like Firefox, Chrome or Java).

Hiç yorum yok:

Yorum Gönder