Import composite and damage extensions.

This commit is contained in:
Xinhao Yuan 2022-07-22 13:03:24 -04:00
parent b7bac1dc76
commit 9334dc71a9
7 changed files with 39 additions and 0 deletions

View File

@ -66,6 +66,8 @@ jobs:
libxcb-shape0-dev \
libxcb-util0-dev \
libxcb-xfixes0-dev \
libxcb-composite0-dev \
libxcb-damage0-dev \
libxcb-xinerama0-dev \
libxcb-xkb-dev \
libxcb-xrm-dev \

View File

@ -116,6 +116,8 @@ jobs:
libxcb-shape0-dev \
libxcb-util0-dev \
libxcb-xfixes0-dev \
libxcb-composite0-dev \
libxcb-damage0-dev \
libxcb-xinerama0-dev \
libxcb-xkb-dev \
libxcb-xrm-dev \

View File

@ -55,6 +55,8 @@
#include <xcb/xtest.h>
#include <xcb/shape.h>
#include <xcb/xfixes.h>
#include <xcb/composite.h>
#include <xcb/damage.h>
#include <glib-unix.h>
@ -725,6 +727,8 @@ main(int argc, char **argv)
xcb_prefetch_extension_data(globalconf.connection, &xcb_xinerama_id);
xcb_prefetch_extension_data(globalconf.connection, &xcb_shape_id);
xcb_prefetch_extension_data(globalconf.connection, &xcb_xfixes_id);
xcb_prefetch_extension_data(globalconf.connection, &xcb_composite_id);
xcb_prefetch_extension_data(globalconf.connection, &xcb_damage_id);
if (xcb_cursor_context_new(globalconf.connection, globalconf.screen, &globalconf.cursor_ctx) < 0)
fatal("Failed to initialize xcb-cursor");
@ -793,6 +797,18 @@ main(int argc, char **argv)
xcb_discard_reply(globalconf.connection,
xcb_xfixes_query_version(globalconf.connection, 1, 0).sequence);
query = xcb_get_extension_data(globalconf.connection, &xcb_composite_id);
globalconf.have_composite = query && query->present;
if (globalconf.have_composite)
xcb_discard_reply(globalconf.connection,
xcb_composite_query_version(globalconf.connection, 0, 3).sequence);
query = xcb_get_extension_data(globalconf.connection, &xcb_damage_id);
globalconf.have_damage = query && query->present;
if (globalconf.have_damage)
xcb_discard_reply(globalconf.connection,
xcb_damage_query_version(globalconf.connection, 1, 0).sequence);
event_init();
/* Allocate the key symbols */

View File

@ -148,6 +148,8 @@ set(AWESOME_DEPENDENCIES
xcb-icccm
xcb-icccm>=0.3.8
xcb-xfixes
xcb-composite
xcb-damage
# NOTE: it's not clear what version is required, but 1.10 works at least.
# See https://github.com/awesomeWM/awesome/pull/149#issuecomment-94208356.
xcb-xkb

View File

@ -16,6 +16,8 @@ environment):
- [libxcb-keysyms >= 0.3.4](https://xcb.freedesktop.org/)
- [libxcb-icccm >= 0.3.8](https://xcb.freedesktop.org/)
- [libxcb-xfixes](https://xcb.freedesktop.org/)
- [libxcb-composite](https://xcb.freedesktop.org/)
- [libxcb-damage](https://xcb.freedesktop.org/)
- [xcb-util-xrm >= 1.0](https://github.com/Airblader/xcb-util-xrm)
- [libxkbcommon](http://xkbcommon.org/) with X11 support enabled
- [libstartup-notification >=

10
event.c
View File

@ -47,6 +47,7 @@
#include <xcb/xcb_event.h>
#include <xcb/xkb.h>
#include <xcb/xfixes.h>
#include <xcb/damage.h>
#define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \
static void \
@ -1023,6 +1024,10 @@ event_handle_selectionclear(xcb_selection_clear_event_t *ev)
selection_handle_selectionclear(ev);
}
static void
event_handle_damage_notify(xcb_damage_notify_event_t *ev) {
}
/** \brief awesome xerror function.
* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's).
@ -1143,6 +1148,7 @@ void event_handle(xcb_generic_event_t *event)
EXTENSION_EVENT(shape, XCB_SHAPE_NOTIFY, event_handle_shape_notify);
EXTENSION_EVENT(xkb, 0, event_handle_xkb_notify);
EXTENSION_EVENT(xfixes, XCB_XFIXES_SELECTION_NOTIFY, event_handle_xfixes_selection_notify);
EXTENSION_EVENT(damage, XCB_DAMAGE_NOTIFY, event_handle_damage_notify);
#undef EXTENSION_EVENT
}
@ -1165,6 +1171,10 @@ void event_init(void)
reply = xcb_get_extension_data(globalconf.connection, &xcb_xfixes_id);
if (reply && reply->present)
globalconf.event_base_xfixes = reply->first_event;
reply = xcb_get_extension_data(globalconf.connection, &xcb_damage_id);
if (reply && reply->present)
globalconf.event_base_damage = reply->first_event;
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -126,6 +126,10 @@ typedef struct
bool have_xkb;
/** Check for XFixes extension */
bool have_xfixes;
/** Check for Composite extension */
bool have_composite;
/** Check for Damage extenion */
bool have_damage;
/** Custom searchpaths are present, the runtime is tinted */
bool have_searchpaths;
/** When --no-argb is used in the modeline or command line */
@ -134,6 +138,7 @@ typedef struct
uint8_t event_base_xkb;
uint8_t event_base_randr;
uint8_t event_base_xfixes;
uint8_t event_base_damage;
/** Clients list */
client_array_t clients;
/** Embedded windows */