XCB

Xlib/XCB, le serveur d'affichage et le gestionnaire de fenêtre

XCB (pour X C Binding) est une bibliothèque logicielle en langage C offrant une implémentation du protocole X Window System. Son objectif est de remplacer la Xlib, jugée vieillissante et inadaptée à certains usages. Le projet a démarré en 2001, sous l'impulsion de Bart Massey.

XCL (pour Xlib Compatibility Layer, « couche de compatibilité Xlib ») est une implémentation de l'API Xlib basée sur XCB, afin de fournir une couche de compatibilité aux applications basées sur la Xlib. Produite plus tard, la bibliothèque XLib/XCB fournit une ABI compatible aussi bien avec la Xlib qu'avec XCB, afin d'adoucir les difficultés de portage d'une bibliothèque à l'autre.

Objectifs de XCB

Les principaux objectifs de XCB sont :

  • La réduction de la taille et de la complexité de la bibliothèque ;
  • fournir un accès direct au protocole X11.

Les objectifs secondaires sont notamment de mettre en œuvre une interface en C complètement asynchrone, de faciliter l'amélioration du multi-threading et de rendre les extensions plus simples à implémenter (par une description des protocoles en XML).

Bart Massey a passé du temps afin de prouver que XCB est formellement correct en utilisant la notation Z (la Xlib est connue pour contenir des erreurs).

Exemple

/*
 * Exemple simple avec XCB dessinant un carré dans une fenêtre
 */

#include <xcb/xcb.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    xcb_connection_t    *c;
    xcb_screen_t        *s;
    xcb_drawable_t       w;
    xcb_gcontext_t       g;
    xcb_generic_event_t *e;
    uint32_t mask;
    uint32_t values[2];
    int      done = 0;
    xcb_rectangle_t r = { 20, 20, 60, 60 };

    /* ouvre la connexion avec le serveur */
    c = xcb_connect (NULL, NULL);
    if (xcb_connection_has_error(c)) {
        fprintf(stderr, "Cannot open display\n");
        exit(1);
    }

    /* récupérer le premier écran */
    s = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

    /* créer un contexte graphique pour le noir */
    g = xcb_generate_id (c);
    w = s->root;
    mask = XCB_GC_FOREGROUND | XCB_GRAPHICS_EXPOSURE;
    values[0] = s->black_pixel;
    values[1] = 0;
    xcb_create_gc (c, g, w, mask, values);

    /* créer une fenêtre */
    w = xcb_generate_id (c);
    mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
    values[0] = s->white_pixel;
    values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS;
    xcb_create_window (c, s->root_depth, w, s->root,
                       10, 10, 100, 100, 1,
                       XCB_WINDOW_CLASS_INPUT_OUTPUT, s->root_visual,
                       mask, values);

    /* afficher la fenêtre sur l'écran sélectionné */
    xcb_map_window (c, w);

    xcb_flush (c);

    /* boucle événementielle */
    while (!done && (e = xcb_wait_for_event(c))) {
        switch (e->response_type & ~0x80) {
            case XCB_EXPOSE:     /* dessiner ou redessiner la fenêtre */
                xcb_poly_fill_rectangle(c, w, g,  1, &r);
                xcb_flush(c);
                break;
            case XCB_KEY_PRESS:  /* stopper la boucle lorsqu'une touche est enfoncée */
                done = 1;
                break;
        }
        free(e);
    }

    /* fermer la connexion avec le serveur */
    xcb_disconnect (c);
 
    return 0;
}

Cet exemple illustre la similarité entre XCB et la Xlib. Certains programmeurs considèrent toutefois que XCB est légèrement plus bas niveau que la Xlib à l'heure actuelle.[réf. souhaitée]

Voir aussi

Articles connexes

Références

Liens externes

  1. « libxcb-1.17.0 »

Read other articles:

Keuskupan Málaga–SoatáDioecesis Malagensis-SoatensisLokasiNegaraKolombiaProvinsi gerejawiBucaramangaStatistikLuas7.466 km2 (2.883 sq mi)Populasi- Total- Katolik(per 2004)171.110161,133 (94.2%)InformasiRitusRitus LatinPendirian7 Juli 1987 (36 tahun lalu)KatedralCatedral de La Inmaculada Concepción in MálagaKonkatedralCo-Catedral de La Inmaculada Concepción in SoatáKepemimpinan kiniPausFransiskusUskupVíctor Manuel Ochoa CadavidPetaSitus webdiocesismal...

 

Pour les autres membres de la famille, voir Famille Sforza. Jean Galéas Sforza Portrait de Jean Galéas Sforza par Benedetto Briosco Titre Duc de Milan 26 décembre 1476 – 22 octobre 1494(17 ans, 9 mois et 26 jours) Prédécesseur Galéas Marie Sforza Successeur Ludovic Sforza Biographie Dynastie Sforza Date de naissance 20 juin 1469 Lieu de naissance Abbiategrasso Date de décès 22 octobre 1494 (à 25 ans) Lieu de décès Pavie Père Galéas Marie Sforza Mère Bonne ...

 

Forested headland nature reserve Balls Head ReserveSydney red gum at Balls Head ReserveLocation in Greater metropolitan SydneyTypeNature reserveLocationBalls Head Drive, Waverton, North Sydney Council, New South Wales, AustraliaNearest citySydneyCoordinates33°50.8′S 151°11.7′E / 33.8467°S 151.1950°E / -33.8467; 151.1950Designated1926 by Premier Jack LangEtymologyHenry Lidgbird BallManaged byNorth Sydney Council Waterhole at Balls Head, probably create...

Brazilian state Flag of the State of Espírito Santo The History of Espírito Santo is composed of studies focused on the evolution of the territory and society of the state of Espírito Santo, Brazil, from the first indigenous inhabitants and the creation of the Captaincy of Espírito Santo by Vasco Fernandes Coutinho, in 1535, to the present day. Also in 1535, the settlement of Vila Velha was founded, the first population center of the captaincy. In the task of catechizing the region's Indi...

 

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (ديسمبر 2018) مستشفى النصر الحكومي للأطفال إحداثيات 31°32′00″N 34°27′32″E / 31.533269938573°N 34.458806629722°E / 31.533269938573; 34.45...

 

American troop transport ship USAT St. Mihiel prior to World War II History United States NameSt. Mihiel NamesakeSt. Mihiel, a World War I battlefield in France OwnerUnited States government Operator United States Army (1920–1941) United States Navy (1941–1943) United States Army (1943–1947) BuilderAmerican International Shipbuilding Cost~$2,000,000 Yard number672[1][2] Laid down20 November 1918 as Sinnemahoning(?) Launched19 November 1919 CompletedSeptember 1920 Acquire...

Untuk kegunaan lain, lihat PKS dan PKS (disambiguasi). Logo Patroli Keamanan Sekolah Patroli Keamanan Sekolah atau dapat disingkat PKS adalah salah satu jenis kegiatan ekstrakurikuler yang umum ditemui di sekolah-sekolah di Indonesia yang dibentuk 5 Mei 1975. Sejarah PKS adalah singkatan dari Patroli Keamanan Sekolah jika kita mendengar kata Patroli, tentunya kita teringat tugas-tugas pengawasan daerah sesuai dengan perincian tugas yang dibebankannya, Misalnya Patroli Jalan Raya (PJR) adalah ...

 

1975 studio album by Shirley BasseyGood, Bad but BeautifulStudio album by Shirley BasseyReleased17 October 1975GenreVocal / MORLabelUnited ArtistsProducerMartin DavisShirley Bassey chronology The Shirley Bassey Singles Album(1975) Good, Bad but Beautiful(1975) Love, Life and Feelings(1976) Good, Bad but Beautiful is a 1975 album by Shirley Bassey. In the first half of the decade, Bassey recorded nine albums, with three making the top ten. In March 1975, Bassey released a compilation ...

 

Driverless subway line in Gyeonggi-do and Seoul, South Korea Shinbundang Line(DX Line) Shinbundang line trainOverviewNative name신분당선(新盆唐線)SinbundangseonStatusOperationalTerminiSinsaGwanggyoStations16ServiceTypeCommuter RailSystemSeoul Metropolitan SubwayOperator(s)Shinbundang Railroad Corporation, Gyeonggi Railroad Co., Ltd., New Seoul Railroad Co., Ltd., Neo TransHistoryOpened28 October 2011TechnicalLine length33.4 km (20.8 mi)Number of tracks2Track gauge1,435 ...

American biographical comedy-drama film For other films of a similar name, see W (disambiguation). W.Theatrical release posterDirected byOliver StoneWritten byStanley WeiserProduced byBill BlockEric KopeloffPaul HansonMoritz BormanStarring Josh Brolin James Cromwell Elizabeth Banks Ellen Burstyn Scott Glenn Thandiwe Newton Jeffrey Wright Toby Jones Stacy Keach Bruce McGill Richard Dreyfuss CinematographyPhedon Papamichael Jr.Edited byJulie MonroeJoe HutshingAlexis ChavezMusic byPaul CantelonP...

 

Questa voce sull'argomento calciatori ungheresi è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti del progetto di riferimento. György Skvarek Nazionalità  Ungheria Calcio Ruolo Attaccante Termine carriera 1935 CarrieraSquadre di club1 1926-1927 III. Kerületi15 (4)1927-1932 Hungária MTK? (?)1932-1934 Montpellier? (?)1934-1935 III. Kerületi? (?)Nazionale 1927-1928 Ungheria2 (2) 1 I due numeri indicano le ...

 

This article's tone or style may not reflect the encyclopedic tone used on Wikipedia. See Wikipedia's guide to writing better articles for suggestions. (March 2023) (Learn how and when to remove this message) Aztec society was traditionally divided into social classes. They became sophisticated once the Mexica people settled and began to build the Aztec Empire. The class structure was so elaborate that it impressed the Spanish almost as much as Aztec architecture. Classes Upper The inaugural ...

Municipality in Dalmatian Hinterland, CroatiaKlisMunicipality FlagKlisCoordinates: 43°34′N 16°31′E / 43.567°N 16.517°E / 43.567; 16.517Country CroatiaHistorical regionDalmatian HinterlandCounty Split-DalmatiaArea[1] • Municipality149.1 km2 (57.6 sq mi) • Urban24.1 km2 (9.3 sq mi)Population (2021)[2] • Municipality5,226 • Density35/km2 (91/sq mi)...

 

Separate areas of the United Kingdom appointed a lord-lieutenant Parts of this article (those related to the current status of the boundaries, which are now historical) need to be updated. Please help update this article to reflect recent events or newly available information. (September 2021) Lieutenancy areaCategoryCountyLocationUnited KingdomCreated byLieutenancies Act 1997 & the Northern Ireland (Lieutenancy) Order 1975Created1997 (GB), 1975 (NI)Number99 (as of 2008)Possible type...

 

GATRA Media GroupSampul Gatra 13 Maret 2014Pemimpin redaksiMukhlison S. WidodoKategoriMajalah beritaFrekuensiMingguan[1]Terbitan pertama1994[2]NegaraIndonesiaBahasaBahasa IndonesiaSitus webwww.gatra.com Gatra (digayakan dengan huruf kapital semua) adalah sebuah majalah berita mingguan yang diterbitkan di Indonesia sejak tahun 1994. Pendirinya adalah beberapa anggota majalah Tempo yang baru saja dibredel saat itu. Didirikan oleh pengusaha yang dekat dengan rezim Orde Baru, Bob ...

В Википедии есть статьи о других людях с такой фамилией, см. Кондратьев; Кондратьев, Александр. Александр Васильевич Кондратьев Дата рождения 14 ноября 1901(1901-11-14) Место рождения город Санкт-Петербург Дата смерти 5 сентября 1981(1981-09-05) (79 лет) Место смерти город Ленинград �...

 

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. حزيرانمعلومات عامةجزء من شهور سريانية تعديل - تعديل مصدري - تعديل ويكي بيانات حَزِيرَان هو الشهر السادس (6) من شهور ال...

 

Histology features of a lipoblast, also known as an adipocyte precursor cell or preadipocyte. Adipogenesis is the formation of adipocytes (fat cells) from stem cells.[1] It involves 2 phases, determination, and terminal differentiation. Determination is mesenchymal stem cells committing to the adipocyte precursor cells, also known as lipoblasts or preadipocytes which lose the potential to differentiate to other types of cells such as chondrocytes, myocytes, and osteoblasts.[2]...

Elang Jawa sebagai penopang tunggal dalam Lambang Negara Republik Indonesia, Garuda Pancasila Meterai kota Berlin tahun 1280, memuat gambar lambang kebesaran Brandenburg diapit dua ekor beruang sebagai penopang Standesscheibe kota Solothurn, ca. 1520, memuat gambar dua ekor singa sebagai penopang Lambang kebesaran kerajaan Inggris terdahulu, diapit gambar singa dan naga sebagai pendukung, dari lukisan Raja Edward VI, ca. 1547 Penopang dalam heraldik adalah gambar makhluk atau benda yang lazim...

 

Monumental medieval tombstones in the Balkans StećakAlthough gable-shaped with a slab pedestal is not the most represented form of stećak (9%), they are usually the most elaborately and richly decorated ones. UNESCO World Heritage SiteOfficial nameStećci Medieval Tombstone GraveyardsTypeCulturalCriteriaiii, viDesignated2016 (40th session)Reference no.1504RegionEurope and North America Stećci at Radimlja necropolisStećak (plural stećci; Cyrillic стећак, стећци) is the na...