first commit
This commit is contained in:
78
xim/xcb-util/.gitignore
vendored
Normal file
78
xim/xcb-util/.gitignore
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# X.Org module default exclusion patterns
|
||||
# The next section if for module specific patterns
|
||||
#
|
||||
# Do not edit the following section
|
||||
# GNU Build System (Autotools)
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
autoscan.log
|
||||
ChangeLog
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config-ml.in
|
||||
config.py
|
||||
config.status
|
||||
config.status.lineno
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
depcomp
|
||||
.deps/
|
||||
INSTALL
|
||||
install-sh
|
||||
.libs/
|
||||
libtool
|
||||
libtool.m4
|
||||
ltmain.sh
|
||||
lt~obsolete.m4
|
||||
ltoptions.m4
|
||||
ltsugar.m4
|
||||
ltversion.m4
|
||||
Makefile
|
||||
Makefile.in
|
||||
mdate-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
*.pc
|
||||
py-compile
|
||||
stamp-h?
|
||||
symlink-tree
|
||||
texinfo.tex
|
||||
ylwrap
|
||||
|
||||
# Do not edit the following section
|
||||
# Edit Compile Debug Document Distribute
|
||||
*~
|
||||
*.[0-9]
|
||||
*.[0-9]x
|
||||
*.bak
|
||||
*.bin
|
||||
core
|
||||
*.dll
|
||||
*.exe
|
||||
*-ISO*.bdf
|
||||
*-JIS*.bdf
|
||||
*-KOI8*.bdf
|
||||
*.kld
|
||||
*.ko
|
||||
*.ko.cmd
|
||||
*.lai
|
||||
*.l[oa]
|
||||
*.[oa]
|
||||
*.obj
|
||||
*.patch
|
||||
*.so
|
||||
*.pcf.gz
|
||||
*.pdb
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for xinit
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
98
xim/xcb-util/.gitlab-ci.yml
Normal file
98
xim/xcb-util/.gitlab-ci.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
|
||||
#
|
||||
# This CI uses the freedesktop.org ci-templates.
|
||||
# Please see the ci-templates documentation for details:
|
||||
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
||||
|
||||
.templates_sha: &template_sha 34f4ade99434043f88e164933f570301fd18b125 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
|
||||
|
||||
include:
|
||||
# Arch container builder template
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: *template_sha
|
||||
file: '/templates/arch.yml'
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: *template_sha
|
||||
file: '/templates/ci-fairy.yml'
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
|
||||
|
||||
stages:
|
||||
- prep # prep work like rebuilding the container images if there is a change
|
||||
- build # for actually building and testing things in a container
|
||||
- test
|
||||
- deploy
|
||||
|
||||
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: 'xorg/lib/libxcb-util'
|
||||
# The tag should be updated each time the list of packages is updated.
|
||||
# Changing a tag forces the associated image to be rebuilt.
|
||||
# Note: the tag has no meaning, we use a date format purely for readability
|
||||
FDO_DISTRIBUTION_TAG: '2022-07-20.0'
|
||||
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros doxygen graphviz xorgproto libxcb'
|
||||
GIT_SUBMODULE_STRATEGY: normal
|
||||
|
||||
#
|
||||
# Verify that commit messages are as expected
|
||||
#
|
||||
check-commits:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
stage: prep
|
||||
script:
|
||||
- ci-fairy check-commits --junit-xml=results.xml
|
||||
except:
|
||||
- master@xorg/lib/libxcb-util
|
||||
variables:
|
||||
GIT_DEPTH: 100
|
||||
artifacts:
|
||||
reports:
|
||||
junit: results.xml
|
||||
|
||||
#
|
||||
# Verify that the merge request has the allow-collaboration checkbox ticked
|
||||
#
|
||||
check-merge-request:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
stage: deploy
|
||||
script:
|
||||
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
|
||||
artifacts:
|
||||
when: on_failure
|
||||
reports:
|
||||
junit: results.xml
|
||||
allow_failure: true
|
||||
|
||||
|
||||
#
|
||||
# Build a container with the given tag and the packages pre-installed.
|
||||
# This only happens if/when the tag changes, otherwise the existing image is
|
||||
# re-used.
|
||||
#
|
||||
container-prep:
|
||||
extends:
|
||||
- .fdo.container-build@arch
|
||||
stage: prep
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
|
||||
#
|
||||
# The default build, runs on the image built above.
|
||||
#
|
||||
build:
|
||||
stage: build
|
||||
extends:
|
||||
- .fdo.distribution-image@arch
|
||||
script:
|
||||
- autoreconf -ivf
|
||||
- mkdir _builddir
|
||||
- pushd _builddir > /dev/null
|
||||
- ../configure --disable-silent-rules
|
||||
- make
|
||||
- make check
|
||||
- make distcheck
|
||||
- popd > /dev/null
|
||||
3
xim/xcb-util/.gitmodules
vendored
Normal file
3
xim/xcb-util/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "m4"]
|
||||
path = m4
|
||||
url = https://gitlab.freedesktop.org/xorg/util/xcb-util-m4.git
|
||||
29
xim/xcb-util/COPYING
Normal file
29
xim/xcb-util/COPYING
Normal file
@@ -0,0 +1,29 @@
|
||||
Copyright © 2008 Bart Massey <bart@cs.pdx.edu>
|
||||
Copyright © 2008 Ian Osgood <iano@quirkster.com>
|
||||
Copyright © 2008 Jamey Sharp <jamey@minilop.net>
|
||||
Copyright © 2008 Josh Triplett <josh@freedesktop.org>
|
||||
Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or
|
||||
their institutions shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization from the authors.
|
||||
23
xim/xcb-util/Makefile.am
Normal file
23
xim/xcb-util/Makefile.am
Normal file
@@ -0,0 +1,23 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src
|
||||
|
||||
pkgconfig_DATA = \
|
||||
xcb-atom.pc \
|
||||
xcb-aux.pc \
|
||||
xcb-event.pc \
|
||||
xcb-util.pc
|
||||
|
||||
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
||||
|
||||
.PHONY: ChangeLog INSTALL
|
||||
|
||||
INSTALL:
|
||||
$(INSTALL_CMD)
|
||||
|
||||
ChangeLog:
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog INSTALL
|
||||
|
||||
EXTRA_DIST = autogen.sh README.md
|
||||
35
xim/xcb-util/NEWS
Normal file
35
xim/xcb-util/NEWS
Normal file
@@ -0,0 +1,35 @@
|
||||
Release 0.4.1 (2022-12-19)
|
||||
==========================
|
||||
|
||||
- Add standard X.Org package changes to autogen.sh
|
||||
- Build xz tarballs instead of bzip2
|
||||
- Clean up some compiler warnings from clang
|
||||
- Do updates for migration to gitlab
|
||||
|
||||
Release 0.4.0 (2014-10-15)
|
||||
==========================
|
||||
|
||||
- Remove AM_MAINTAINER_MODE.
|
||||
- Use AC_CONFIG_HEADERS to create a config.h file.
|
||||
- Add missing COPYING file.
|
||||
- Remove the dependency on X11 Protocol.
|
||||
- #include <stdio.h> for vsnprintf case, not just vasprintf (#64807).
|
||||
|
||||
Release 0.3.9 (2012-05-30)
|
||||
==========================
|
||||
|
||||
- Remove xcb_bitops.h.
|
||||
- Do not rely anymore on gperf and m4 following removal of deprecated atoms.
|
||||
|
||||
Release 0.3.8 (2010-04-25)
|
||||
==========================
|
||||
|
||||
- Split up atom, aux event into their own repository.
|
||||
- Create a single shared library and header file.
|
||||
- Remove namespaceless pre-defined atoms.
|
||||
- Remove synchronous xcb_atom_get().
|
||||
- Remove useless xcb_atom_get_fast*() and xcb_atom_get_name().
|
||||
- Delete redundant core-protocol error codes.
|
||||
- Delete callback-based APIs for events, properties, and replies.
|
||||
- Link with -no-undefined.
|
||||
- Add AM_MAINTAINER_MODE for vendors.
|
||||
41
xim/xcb-util/README.md
Normal file
41
xim/xcb-util/README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
About XCB util modules
|
||||
======================
|
||||
|
||||
The XCB util modules provides a number of libraries which sit on top
|
||||
of libxcb, the core X protocol library, and some of the extension
|
||||
libraries. These experimental libraries provide convenience functions
|
||||
and interfaces which make the raw X protocol more usable. Some of the
|
||||
libraries also provide client-side code which is not strictly part of
|
||||
the X protocol but which have traditionally been provided by Xlib.
|
||||
|
||||
If you find any of these libraries useful, please let us know what
|
||||
you're using and why you aren't in a mental hospital yet. We'd welcome
|
||||
patches/suggestions for enhancement and new libraries; Please report any
|
||||
issues you find to the freedesktop.org bug tracker, at:
|
||||
|
||||
https://gitlab.freedesktop.org/xorg/lib/libxcb-util/-/issues
|
||||
|
||||
Discussion about XCB occurs on the XCB mailing list:
|
||||
|
||||
https://lists.freedesktop.org/mailman/listinfo/xcb
|
||||
|
||||
About XCB util module
|
||||
=====================
|
||||
|
||||
XCB util module provides the following libraries:
|
||||
|
||||
- aux: Convenient access to connection setup and some core requests.
|
||||
- atom: Standard core X atom constants and atom caching.
|
||||
- event: Some utilities that have little to do with events any more.
|
||||
|
||||
You can obtain the latest development versions of XCB util using GIT from:
|
||||
|
||||
https://gitlab.freedesktop.org/xorg/lib/libxcb-util
|
||||
|
||||
For anonymous checkouts, use:
|
||||
|
||||
git clone --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git
|
||||
|
||||
For developers, use:
|
||||
|
||||
git clone --recursive git@gitlab.freedesktop.org:xorg/lib/libxcb-util.git
|
||||
32
xim/xcb-util/autogen.sh
Executable file
32
xim/xcb-util/autogen.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#! /bin/sh
|
||||
|
||||
srcdir=`dirname "$0"`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd "$srcdir"
|
||||
|
||||
# If this is a git checkout, verify that the submodules are initialized,
|
||||
# otherwise autotools will just fail with an unhelpful error message.
|
||||
if [ -d ".git" ] && [ -r ".gitmodules" ]
|
||||
then
|
||||
# If git is not in PATH, this will not return 0, thus not keeping us
|
||||
# from building. Since the message is worthless when git is not
|
||||
# installed, this is what we want.
|
||||
if git submodule status 2>/dev/null | grep -q '^-'
|
||||
then
|
||||
echo "You have uninitialized git submodules." >&2
|
||||
echo "Please run: git submodule update --init" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
autoreconf -v --install || exit 1
|
||||
cd "$ORIGDIR" || exit $?
|
||||
|
||||
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
||||
git config --local format.subjectPrefix "PATCH libxcb-util"
|
||||
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
exec "$srcdir"/configure "$@"
|
||||
fi
|
||||
20
xim/xcb-util/configure.ac
Normal file
20
xim/xcb-util/configure.ac
Normal file
@@ -0,0 +1,20 @@
|
||||
AC_PREREQ(2.59c)
|
||||
AC_INIT([xcb-util],[0.4.1],
|
||||
[https://gitlab.freedesktop.org/xorg/lib/libxcb-util/-/issues],
|
||||
[xcb-util])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||
|
||||
XCB_UTIL_COMMON([1.4], [1.6])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE(vasprintf)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
xcb-atom.pc
|
||||
xcb-aux.pc
|
||||
xcb-event.pc
|
||||
xcb-util.pc])
|
||||
AC_OUTPUT
|
||||
17
xim/xcb-util/src/Makefile.am
Normal file
17
xim/xcb-util/src/Makefile.am
Normal file
@@ -0,0 +1,17 @@
|
||||
lib_LTLIBRARIES = libxcb-util.la
|
||||
|
||||
AM_CPPFLAGS = $(XCB_CFLAGS)
|
||||
AM_CFLAGS = $(CWARNFLAGS)
|
||||
|
||||
libxcb_util_la_LIBADD = $(XCB_LIBS)
|
||||
libxcb_util_la_LDFLAGS = -version-info 1:0:0 -no-undefined
|
||||
libxcb_util_la_SOURCES = \
|
||||
atoms.c \
|
||||
event.c \
|
||||
xcb_aux.c
|
||||
|
||||
xcbinclude_HEADERS = \
|
||||
xcb_util.h \
|
||||
xcb_atom.h \
|
||||
xcb_aux.h \
|
||||
xcb_event.h
|
||||
87
xim/xcb-util/src/atoms.c
Normal file
87
xim/xcb-util/src/atoms.c
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Rely on vasprintf (GNU extension) instead of vsnprintf if
|
||||
possible... */
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "xcb_atom.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with older compilers. */
|
||||
#endif
|
||||
|
||||
#if __has_attribute(__format__) \
|
||||
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
|
||||
__attribute__((__format__(__printf__,1,2)))
|
||||
#endif
|
||||
static char *makename(const char *fmt, ...)
|
||||
{
|
||||
char *ret;
|
||||
int n;
|
||||
va_list ap;
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
char *np;
|
||||
int size = 64;
|
||||
|
||||
/* First allocate 'size' bytes, should be enough usually */
|
||||
if((ret = malloc(size)) == NULL)
|
||||
return NULL;
|
||||
|
||||
while(1)
|
||||
{
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(ret, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(n < 0)
|
||||
return NULL;
|
||||
|
||||
if(n < size)
|
||||
return ret;
|
||||
|
||||
size = n + 1;
|
||||
if((np = realloc(ret, size)) == NULL)
|
||||
{
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = np;
|
||||
}
|
||||
#else
|
||||
va_start(ap, fmt);
|
||||
n = vasprintf(&ret, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(n < 0)
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
|
||||
{
|
||||
return makename("%s_S%u", base, screen);
|
||||
}
|
||||
|
||||
char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
|
||||
{
|
||||
return makename("%s_R%08X", base, resource);
|
||||
}
|
||||
|
||||
char *xcb_atom_name_unique(const char *base, uint32_t id)
|
||||
{
|
||||
if(base)
|
||||
return makename("%s_U%u", base, id);
|
||||
else
|
||||
return makename("U%u", id);
|
||||
}
|
||||
259
xim/xcb-util/src/event.c
Normal file
259
xim/xcb-util/src/event.c
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or
|
||||
* their institutions shall not be used in advertising or otherwise to
|
||||
* promote the sale, use or other dealings in this Software without
|
||||
* prior written authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xcb_event.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define ssizeof(foo) (ssize_t)sizeof(foo)
|
||||
#define countof(foo) (ssizeof(foo) / ssizeof(foo[0]))
|
||||
|
||||
static const char *labelError[] =
|
||||
{
|
||||
"Success",
|
||||
"BadRequest",
|
||||
"BadValue",
|
||||
"BadWindow",
|
||||
"BadPixmap",
|
||||
"BadAtom",
|
||||
"BadCursor",
|
||||
"BadFont",
|
||||
"BadMatch",
|
||||
"BadDrawable",
|
||||
"BadAccess",
|
||||
"BadAlloc",
|
||||
"BadColor",
|
||||
"BadGC",
|
||||
"BadIDChoice",
|
||||
"BadName",
|
||||
"BadLength",
|
||||
"BadImplementation",
|
||||
};
|
||||
|
||||
static const char *labelRequest[] =
|
||||
{
|
||||
"no request",
|
||||
"CreateWindow",
|
||||
"ChangeWindowAttributes",
|
||||
"GetWindowAttributes",
|
||||
"DestroyWindow",
|
||||
"DestroySubwindows",
|
||||
"ChangeSaveSet",
|
||||
"ReparentWindow",
|
||||
"MapWindow",
|
||||
"MapSubwindows",
|
||||
"UnmapWindow",
|
||||
"UnmapSubwindows",
|
||||
"ConfigureWindow",
|
||||
"CirculateWindow",
|
||||
"GetGeometry",
|
||||
"QueryTree",
|
||||
"InternAtom",
|
||||
"GetAtomName",
|
||||
"ChangeProperty",
|
||||
"DeleteProperty",
|
||||
"GetProperty",
|
||||
"ListProperties",
|
||||
"SetSelectionOwner",
|
||||
"GetSelectionOwner",
|
||||
"ConvertSelection",
|
||||
"SendEvent",
|
||||
"GrabPointer",
|
||||
"UngrabPointer",
|
||||
"GrabButton",
|
||||
"UngrabButton",
|
||||
"ChangeActivePointerGrab",
|
||||
"GrabKeyboard",
|
||||
"UngrabKeyboard",
|
||||
"GrabKey",
|
||||
"UngrabKey",
|
||||
"AllowEvents",
|
||||
"GrabServer",
|
||||
"UngrabServer",
|
||||
"QueryPointer",
|
||||
"GetMotionEvents",
|
||||
"TranslateCoords",
|
||||
"WarpPointer",
|
||||
"SetInputFocus",
|
||||
"GetInputFocus",
|
||||
"QueryKeymap",
|
||||
"OpenFont",
|
||||
"CloseFont",
|
||||
"QueryFont",
|
||||
"QueryTextExtents",
|
||||
"ListFonts",
|
||||
"ListFontsWithInfo",
|
||||
"SetFontPath",
|
||||
"GetFontPath",
|
||||
"CreatePixmap",
|
||||
"FreePixmap",
|
||||
"CreateGC",
|
||||
"ChangeGC",
|
||||
"CopyGC",
|
||||
"SetDashes",
|
||||
"SetClipRectangles",
|
||||
"FreeGC",
|
||||
"ClearArea",
|
||||
"CopyArea",
|
||||
"CopyPlane",
|
||||
"PolyPoint",
|
||||
"PolyLine",
|
||||
"PolySegment",
|
||||
"PolyRectangle",
|
||||
"PolyArc",
|
||||
"FillPoly",
|
||||
"PolyFillRectangle",
|
||||
"PolyFillArc",
|
||||
"PutImage",
|
||||
"GetImage",
|
||||
"PolyText",
|
||||
"PolyText",
|
||||
"ImageText",
|
||||
"ImageText",
|
||||
"CreateColormap",
|
||||
"FreeColormap",
|
||||
"CopyColormapAndFree",
|
||||
"InstallColormap",
|
||||
"UninstallColormap",
|
||||
"ListInstalledColormaps",
|
||||
"AllocColor",
|
||||
"AllocNamedColor",
|
||||
"AllocColorCells",
|
||||
"AllocColorPlanes",
|
||||
"FreeColors",
|
||||
"StoreColors",
|
||||
"StoreNamedColor",
|
||||
"QueryColors",
|
||||
"LookupColor",
|
||||
"CreateCursor",
|
||||
"CreateGlyphCursor",
|
||||
"FreeCursor",
|
||||
"RecolorCursor",
|
||||
"QueryBestSize",
|
||||
"QueryExtension",
|
||||
"ListExtensions",
|
||||
"ChangeKeyboardMapping",
|
||||
"GetKeyboardMapping",
|
||||
"ChangeKeyboardControl",
|
||||
"GetKeyboardControl",
|
||||
"Bell",
|
||||
"ChangePointerControl",
|
||||
"GetPointerControl",
|
||||
"SetScreenSaver",
|
||||
"GetScreenSaver",
|
||||
"ChangeHosts",
|
||||
"ListHosts",
|
||||
"SetAccessControl",
|
||||
"SetCloseDownMode",
|
||||
"KillClient",
|
||||
"RotateProperties",
|
||||
"ForceScreenSaver",
|
||||
"SetPointerMapping",
|
||||
"GetPointerMapping",
|
||||
"SetModifierMapping",
|
||||
"GetModifierMapping",
|
||||
"major 120",
|
||||
"major 121",
|
||||
"major 122",
|
||||
"major 123",
|
||||
"major 124",
|
||||
"major 125",
|
||||
"major 126",
|
||||
"NoOperation",
|
||||
};
|
||||
|
||||
static const char *labelEvent[] =
|
||||
{
|
||||
"error",
|
||||
"reply",
|
||||
"KeyPress",
|
||||
"KeyRelease",
|
||||
"ButtonPress",
|
||||
"ButtonRelease",
|
||||
"MotionNotify",
|
||||
"EnterNotify",
|
||||
"LeaveNotify",
|
||||
"FocusIn",
|
||||
"FocusOut",
|
||||
"KeymapNotify",
|
||||
"Expose",
|
||||
"GraphicsExpose",
|
||||
"NoExpose",
|
||||
"VisibilityNotify",
|
||||
"CreateNotify",
|
||||
"DestroyNotify",
|
||||
"UnmapNotify",
|
||||
"MapNotify",
|
||||
"MapRequest",
|
||||
"ReparentNotify",
|
||||
"ConfigureNotify",
|
||||
"ConfigureRequest",
|
||||
"GravityNotify",
|
||||
"ResizeRequest",
|
||||
"CirculateNotify",
|
||||
"CirculateRequest",
|
||||
"PropertyNotify",
|
||||
"SelectionClear",
|
||||
"SelectionRequest",
|
||||
"SelectionNotify",
|
||||
"ColormapNotify",
|
||||
"ClientMessage",
|
||||
"MappingNotify",
|
||||
};
|
||||
|
||||
const char *
|
||||
xcb_event_get_label(uint8_t type)
|
||||
{
|
||||
if(type < countof(labelEvent))
|
||||
return labelEvent[type];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
xcb_event_get_error_label(uint8_t type)
|
||||
{
|
||||
if(type < countof(labelError))
|
||||
return labelError[type];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
xcb_event_get_request_label(uint8_t type)
|
||||
{
|
||||
if(type < countof(labelRequest))
|
||||
return labelRequest[type];
|
||||
return NULL;
|
||||
}
|
||||
18
xim/xcb-util/src/xcb_atom.h
Normal file
18
xim/xcb-util/src/xcb_atom.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __XCB_ATOM_H__
|
||||
#define __XCB_ATOM_H__
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *xcb_atom_name_by_screen(const char *base, uint8_t screen);
|
||||
char *xcb_atom_name_by_resource(const char *base, uint32_t resource);
|
||||
char *xcb_atom_name_unique(const char *base, uint32_t id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XCB_ATOM_H__ */
|
||||
378
xim/xcb-util/src/xcb_aux.c
Normal file
378
xim/xcb-util/src/xcb_aux.c
Normal file
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* Copyright © 2008 Bart Massey <bart@cs.pdx.edu>
|
||||
* Copyright © 2008 Ian Osgood <iano@quirkster.com>
|
||||
* Copyright © 2008 Jamey Sharp <jamey@minilop.net>
|
||||
* Copyright © 2008 Josh Triplett <josh@freedesktop.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or
|
||||
* their institutions shall not be used in advertising or otherwise to
|
||||
* promote the sale, use or other dealings in this Software without
|
||||
* prior written authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include "xcb_aux.h"
|
||||
|
||||
/* Connection related functions */
|
||||
|
||||
uint8_t
|
||||
xcb_aux_get_depth (xcb_connection_t *c,
|
||||
xcb_screen_t *screen)
|
||||
{
|
||||
xcb_drawable_t drawable;
|
||||
xcb_get_geometry_reply_t *geom;
|
||||
uint8_t depth = 0;
|
||||
|
||||
drawable = screen->root;
|
||||
geom = xcb_get_geometry_reply (c, xcb_get_geometry(c, drawable), 0);
|
||||
|
||||
if (geom) {
|
||||
depth = geom->depth;
|
||||
free (geom);
|
||||
}
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
xcb_aux_get_depth_of_visual (xcb_screen_t *screen,
|
||||
xcb_visualid_t id)
|
||||
{
|
||||
xcb_depth_iterator_t i;
|
||||
xcb_visualtype_iterator_t j;
|
||||
for (i = xcb_screen_allowed_depths_iterator(screen);
|
||||
i.rem; xcb_depth_next(&i))
|
||||
for (j = xcb_depth_visuals_iterator(i.data);
|
||||
j.rem; xcb_visualtype_next(&j))
|
||||
if (j.data->visual_id == id)
|
||||
return i.data->depth;
|
||||
return 0;
|
||||
}
|
||||
|
||||
xcb_screen_t *
|
||||
xcb_aux_get_screen (xcb_connection_t *c,
|
||||
int screen)
|
||||
{
|
||||
xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(c));
|
||||
for (; i.rem; --screen, xcb_screen_next(&i))
|
||||
if (screen == 0)
|
||||
return i.data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
xcb_visualtype_t *
|
||||
xcb_aux_get_visualtype (xcb_connection_t *c,
|
||||
int scr,
|
||||
xcb_visualid_t vid)
|
||||
{
|
||||
xcb_screen_t *screen;
|
||||
xcb_depth_t *depth;
|
||||
xcb_visualtype_iterator_t iter;
|
||||
int cur;
|
||||
|
||||
screen = xcb_aux_get_screen (c, scr);
|
||||
if (!screen) return NULL;
|
||||
|
||||
depth = xcb_screen_allowed_depths_iterator(screen).data;
|
||||
if (!depth) return NULL;
|
||||
|
||||
iter = xcb_depth_visuals_iterator(depth);
|
||||
for (cur = 0 ; cur < iter.rem ; xcb_visualtype_next(&iter), ++cur)
|
||||
if (vid == iter.data->visual_id)
|
||||
return iter.data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcb_visualtype_t *
|
||||
xcb_aux_find_visual_by_id (xcb_screen_t *screen,
|
||||
xcb_visualid_t id)
|
||||
{
|
||||
xcb_depth_iterator_t i;
|
||||
xcb_visualtype_iterator_t j;
|
||||
for (i = xcb_screen_allowed_depths_iterator(screen);
|
||||
i.rem; xcb_depth_next(&i))
|
||||
for (j = xcb_depth_visuals_iterator(i.data);
|
||||
j.rem; xcb_visualtype_next(&j))
|
||||
if (j.data->visual_id == id)
|
||||
return j.data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
xcb_visualtype_t *
|
||||
xcb_aux_find_visual_by_attrs (xcb_screen_t *screen,
|
||||
int8_t class,
|
||||
int8_t depth)
|
||||
{
|
||||
xcb_depth_iterator_t i;
|
||||
xcb_visualtype_iterator_t j;
|
||||
for (i = xcb_screen_allowed_depths_iterator(screen);
|
||||
i.rem; xcb_depth_next(&i)) {
|
||||
if (depth != -1 && i.data->depth != depth)
|
||||
continue;
|
||||
for (j = xcb_depth_visuals_iterator(i.data);
|
||||
j.rem; xcb_visualtype_next(&j))
|
||||
if (class == -1 || j.data->_class == class)
|
||||
return j.data;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
xcb_aux_sync (xcb_connection_t *c)
|
||||
{
|
||||
free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL));
|
||||
}
|
||||
|
||||
/* structs instead of value lists */
|
||||
/* TODO: generate the struct types and functions from protocol masks and descriptions */
|
||||
|
||||
/* This generic implementation of pack_list depends on:
|
||||
a) structs packed to uint32_t size
|
||||
b) structs consist of just uint32_t/int32_t fields in the same order as bitmask
|
||||
*/
|
||||
|
||||
static void
|
||||
pack_list( uint32_t mask, const uint32_t *src, uint32_t *dest )
|
||||
{
|
||||
for ( ; mask; mask >>= 1, src++)
|
||||
if (mask & 1)
|
||||
*dest++ = *src;
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_window (xcb_connection_t *c,
|
||||
uint8_t depth,
|
||||
xcb_window_t wid,
|
||||
xcb_window_t parent,
|
||||
int16_t x,
|
||||
int16_t y,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint16_t border_width,
|
||||
uint16_t _class,
|
||||
xcb_visualid_t visual,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params)
|
||||
{
|
||||
uint32_t value_list[16];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_create_window(c, depth, wid, parent,
|
||||
x, y, width, height, border_width,
|
||||
_class, visual, mask, value_list);
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_window_checked (xcb_connection_t *c,
|
||||
uint8_t depth,
|
||||
xcb_window_t wid,
|
||||
xcb_window_t parent,
|
||||
int16_t x,
|
||||
int16_t y,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint16_t border_width,
|
||||
uint16_t _class,
|
||||
xcb_visualid_t visual,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params)
|
||||
{
|
||||
uint32_t value_list[16];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_create_window_checked(c, depth, wid, parent,
|
||||
x, y, width, height, border_width,
|
||||
_class, visual, mask, value_list);
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_window_attributes_checked (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params)
|
||||
{
|
||||
uint32_t value_list[16];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_change_window_attributes_checked( c, window, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_window_attributes (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params)
|
||||
{
|
||||
uint32_t value_list[16];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_change_window_attributes( c, window, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_configure_window (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint16_t mask,
|
||||
const xcb_params_configure_window_t *params)
|
||||
{
|
||||
uint32_t value_list[8];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_configure_window( c, window, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_gc (xcb_connection_t *c,
|
||||
xcb_gcontext_t gid,
|
||||
xcb_drawable_t drawable,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params)
|
||||
{
|
||||
uint32_t value_list[32];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_create_gc( c, gid, drawable, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_gc_checked (xcb_connection_t *c,
|
||||
xcb_gcontext_t gid,
|
||||
xcb_drawable_t drawable,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params)
|
||||
{
|
||||
uint32_t value_list[32];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_create_gc_checked( c, gid, drawable, mask, value_list);
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_gc (xcb_connection_t *c,
|
||||
xcb_gcontext_t gc,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params)
|
||||
{
|
||||
uint32_t value_list[32];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_change_gc( c, gc, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_gc_checked (xcb_connection_t *c,
|
||||
xcb_gcontext_t gc,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params)
|
||||
{
|
||||
uint32_t value_list[32];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_change_gc_checked( c, gc, mask, value_list );
|
||||
}
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_keyboard_control (xcb_connection_t *c,
|
||||
uint32_t mask,
|
||||
const xcb_params_keyboard_t *params)
|
||||
{
|
||||
uint32_t value_list[16];
|
||||
pack_list(mask, (const uint32_t *)params, value_list);
|
||||
return xcb_change_keyboard_control( c, mask, value_list );
|
||||
}
|
||||
|
||||
/* Color related functions */
|
||||
|
||||
/* Return true if the given color name can be translated locally,
|
||||
in which case load the components. Otherwise, a lookup_color request
|
||||
will be needed, so return false. */
|
||||
int
|
||||
xcb_aux_parse_color(const char *color_name,
|
||||
uint16_t *red, uint16_t *green, uint16_t *blue)
|
||||
{
|
||||
int n, r, g, b, i;
|
||||
if (!color_name || *color_name != '#')
|
||||
return 0;
|
||||
/*
|
||||
* Excitingly weird RGB parsing code from Xlib.
|
||||
*/
|
||||
n = strlen (color_name);
|
||||
color_name++;
|
||||
n--;
|
||||
if (n != 3 && n != 6 && n != 9 && n != 12)
|
||||
return 0;
|
||||
n /= 3;
|
||||
g = b = 0;
|
||||
do {
|
||||
r = g;
|
||||
g = b;
|
||||
b = 0;
|
||||
for (i = n; --i >= 0; ) {
|
||||
char c = *color_name++;
|
||||
b <<= 4;
|
||||
if (c >= '0' && c <= '9')
|
||||
b |= c - '0';
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
b |= c - ('A' - 10);
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
b |= c - ('a' - 10);
|
||||
else return 0;
|
||||
}
|
||||
} while (*color_name != '\0');
|
||||
n <<= 2;
|
||||
n = 16 - n;
|
||||
*red = (uint16_t) (r << n);
|
||||
*green = (uint16_t) (g << n);
|
||||
*blue = (uint16_t) (b << n);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Drawing related functions */
|
||||
|
||||
/* Adapted from Xlib */
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_set_line_attributes_checked (xcb_connection_t *dpy,
|
||||
xcb_gcontext_t gc,
|
||||
uint16_t linewidth,
|
||||
int32_t linestyle,
|
||||
int32_t capstyle,
|
||||
int32_t joinstyle)
|
||||
{
|
||||
uint32_t mask = 0;
|
||||
xcb_params_gc_t gv;
|
||||
|
||||
XCB_AUX_ADD_PARAM(&mask, &gv, line_width, linewidth);
|
||||
XCB_AUX_ADD_PARAM(&mask, &gv, line_style, linestyle);
|
||||
XCB_AUX_ADD_PARAM(&mask, &gv, cap_style, capstyle);
|
||||
XCB_AUX_ADD_PARAM(&mask, &gv, join_style, joinstyle);
|
||||
return xcb_aux_change_gc_checked(dpy, gc, mask, &gv);
|
||||
}
|
||||
|
||||
/* Adapted from Xlib */
|
||||
/* XXX It would be wiser for apps just to call
|
||||
clear_area() directly. */
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_clear_window(xcb_connection_t * dpy,
|
||||
xcb_window_t w)
|
||||
{
|
||||
return xcb_clear_area(dpy, 0, w, 0, 0, 0, 0);
|
||||
}
|
||||
217
xim/xcb-util/src/xcb_aux.h
Normal file
217
xim/xcb-util/src/xcb_aux.h
Normal file
@@ -0,0 +1,217 @@
|
||||
#ifndef __XCB_AUX_H__
|
||||
#define __XCB_AUX_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t xcb_aux_get_depth (xcb_connection_t *c,
|
||||
xcb_screen_t *screen);
|
||||
|
||||
uint8_t xcb_aux_get_depth_of_visual (xcb_screen_t *screen,
|
||||
xcb_visualid_t id);
|
||||
|
||||
xcb_screen_t *xcb_aux_get_screen (xcb_connection_t *c,
|
||||
int screen);
|
||||
|
||||
xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c,
|
||||
int screen,
|
||||
xcb_visualid_t vid);
|
||||
|
||||
xcb_visualtype_t *
|
||||
xcb_aux_find_visual_by_id (xcb_screen_t *screen,
|
||||
xcb_visualid_t id);
|
||||
|
||||
xcb_visualtype_t *
|
||||
xcb_aux_find_visual_by_attrs (xcb_screen_t *screen,
|
||||
int8_t class_,
|
||||
int8_t depth);
|
||||
|
||||
void xcb_aux_sync (xcb_connection_t *c);
|
||||
|
||||
/* internal helper macro for XCB_AUX_ADD_PARAM
|
||||
It gives the offset of the field 'param' in the structure pointed to by
|
||||
'paramsp' in multiples of an uint32_t's size. */
|
||||
#define XCB_AUX_INTERNAL_OFFSETOF(paramsp, param) \
|
||||
((uint32_t const*)(&((paramsp)->param))-(uint32_t const*)(paramsp))
|
||||
|
||||
/* add an optional parameter to an xcb_params_* structure
|
||||
parameters:
|
||||
maskp: pointer to bitmask whos bits mark used parameters
|
||||
paramsp: pointer to structure with parameters
|
||||
param: parameter to set
|
||||
value: value to set the parameter to
|
||||
*/
|
||||
#define XCB_AUX_ADD_PARAM(maskp, paramsp, param, value) \
|
||||
((*(maskp)|=1<<XCB_AUX_INTERNAL_OFFSETOF((paramsp),param)), \
|
||||
((paramsp)->param=(value)))
|
||||
|
||||
typedef struct {
|
||||
uint32_t back_pixmap;
|
||||
uint32_t back_pixel;
|
||||
uint32_t border_pixmap;
|
||||
uint32_t border_pixel;
|
||||
uint32_t bit_gravity;
|
||||
uint32_t win_gravity;
|
||||
uint32_t backing_store;
|
||||
uint32_t backing_planes;
|
||||
uint32_t backing_pixel;
|
||||
uint32_t override_redirect;
|
||||
uint32_t save_under;
|
||||
uint32_t event_mask;
|
||||
uint32_t dont_propagate;
|
||||
uint32_t colormap;
|
||||
uint32_t cursor;
|
||||
} xcb_params_cw_t;
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_window (xcb_connection_t *c,
|
||||
uint8_t depth,
|
||||
xcb_window_t wid,
|
||||
xcb_window_t parent,
|
||||
int16_t x,
|
||||
int16_t y,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint16_t border_width,
|
||||
uint16_t class_,
|
||||
xcb_visualid_t visual,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_window_checked (xcb_connection_t *c,
|
||||
uint8_t depth,
|
||||
xcb_window_t wid,
|
||||
xcb_window_t parent,
|
||||
int16_t x,
|
||||
int16_t y,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint16_t border_width,
|
||||
uint16_t class_,
|
||||
xcb_visualid_t visual,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_window_attributes (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_window_attributes_checked (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint32_t mask,
|
||||
const xcb_params_cw_t *params);
|
||||
|
||||
typedef struct {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t border_width;
|
||||
uint32_t sibling;
|
||||
uint32_t stack_mode;
|
||||
} xcb_params_configure_window_t;
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_configure_window (xcb_connection_t *c,
|
||||
xcb_window_t window,
|
||||
uint16_t mask,
|
||||
const xcb_params_configure_window_t *params);
|
||||
|
||||
typedef struct {
|
||||
uint32_t function;
|
||||
uint32_t plane_mask;
|
||||
uint32_t foreground;
|
||||
uint32_t background;
|
||||
uint32_t line_width;
|
||||
uint32_t line_style;
|
||||
uint32_t cap_style;
|
||||
uint32_t join_style;
|
||||
uint32_t fill_style;
|
||||
uint32_t fill_rule;
|
||||
uint32_t tile;
|
||||
uint32_t stipple;
|
||||
uint32_t tile_stipple_origin_x;
|
||||
uint32_t tile_stipple_origin_y;
|
||||
uint32_t font;
|
||||
uint32_t subwindow_mode;
|
||||
uint32_t graphics_exposures;
|
||||
uint32_t clip_originX;
|
||||
uint32_t clip_originY;
|
||||
uint32_t mask;
|
||||
uint32_t dash_offset;
|
||||
uint32_t dash_list;
|
||||
uint32_t arc_mode;
|
||||
} xcb_params_gc_t;
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_gc (xcb_connection_t *c,
|
||||
xcb_gcontext_t cid,
|
||||
xcb_drawable_t drawable,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_create_gc_checked (xcb_connection_t *c,
|
||||
xcb_gcontext_t gid,
|
||||
xcb_drawable_t drawable,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params);
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_gc (xcb_connection_t *c,
|
||||
xcb_gcontext_t gc,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_gc_checked (xcb_connection_t *c,
|
||||
xcb_gcontext_t gc,
|
||||
uint32_t mask,
|
||||
const xcb_params_gc_t *params);
|
||||
typedef struct {
|
||||
uint32_t key_click_percent;
|
||||
uint32_t bell_percent;
|
||||
uint32_t bell_pitch;
|
||||
uint32_t bell_duration;
|
||||
uint32_t led;
|
||||
uint32_t led_mode;
|
||||
uint32_t key;
|
||||
uint32_t auto_repeat_mode;
|
||||
} xcb_params_keyboard_t;
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_change_keyboard_control (xcb_connection_t *c,
|
||||
uint32_t mask,
|
||||
const xcb_params_keyboard_t *params);
|
||||
|
||||
int
|
||||
xcb_aux_parse_color(const char *color_name,
|
||||
uint16_t *red, uint16_t *green, uint16_t *blue);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_set_line_attributes_checked (xcb_connection_t *dpy,
|
||||
xcb_gcontext_t gc,
|
||||
uint16_t linewidth,
|
||||
int32_t linestyle,
|
||||
int32_t capstyle,
|
||||
int32_t joinstyle);
|
||||
|
||||
xcb_void_cookie_t
|
||||
xcb_aux_clear_window(xcb_connection_t * dpy,
|
||||
xcb_window_t w);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __XCB_AUX_H__ */
|
||||
90
xim/xcb-util/src/xcb_event.h
Normal file
90
xim/xcb-util/src/xcb_event.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or
|
||||
* their institutions shall not be used in advertising or otherwise to
|
||||
* promote the sale, use or other dealings in this Software without
|
||||
* prior written authorization from the authors.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup xcb__event_t XCB Event Functions
|
||||
*
|
||||
* These functions ease the handling of X events received.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __XCB_EVENT_H__
|
||||
#define __XCB_EVENT_H__
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Bit mask to find event type regardless of event source.
|
||||
*
|
||||
* Each event in the X11 protocol contains an 8-bit type code.
|
||||
* The most-significant bit in this code is set if the event was
|
||||
* generated from a SendEvent request. This mask can be used to
|
||||
* determine the type of event regardless of how the event was
|
||||
* generated. See the X11R6 protocol specification for details.
|
||||
*/
|
||||
#define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f)
|
||||
#define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONSE_TYPE_MASK)
|
||||
#define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONSE_TYPE_MASK)
|
||||
|
||||
/**
|
||||
* @brief Convert an event response type to a label.
|
||||
* @param type The event type.
|
||||
* @return A string with the event name, or NULL if unknown.
|
||||
*/
|
||||
const char * xcb_event_get_label(uint8_t type);
|
||||
|
||||
/**
|
||||
* @brief Convert an event error type to a label.
|
||||
* @param type The error type.
|
||||
* @return A string with the event name, or NULL if unknown or if the event is
|
||||
* not an error.
|
||||
*/
|
||||
const char * xcb_event_get_error_label(uint8_t type);
|
||||
|
||||
/**
|
||||
* @brief Convert an event request type to a label.
|
||||
* @param type The request type.
|
||||
* @return A string with the event name, or NULL if unknown or if the event is
|
||||
* not an error.
|
||||
*/
|
||||
const char * xcb_event_get_request_label(uint8_t type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __XCB_EVENT_H__ */
|
||||
8
xim/xcb-util/src/xcb_util.h
Normal file
8
xim/xcb-util/src/xcb_util.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __XCB_UTIL_H__
|
||||
#define __XCB_UTIL_H__
|
||||
|
||||
#include <xcb/xcb_atom.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
#include <xcb/xcb_event.h>
|
||||
|
||||
#endif /* __XCB_UTIL_H__ */
|
||||
11
xim/xcb-util/xcb-atom.pc.in
Normal file
11
xim/xcb-util/xcb-atom.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: XCB Atom library
|
||||
Description: XCB atom cache
|
||||
Version: @PACKAGE_VERSION@
|
||||
Requires: xcb
|
||||
Libs: -L${libdir} -lxcb-util
|
||||
Cflags: -I${includedir}
|
||||
11
xim/xcb-util/xcb-aux.pc.in
Normal file
11
xim/xcb-util/xcb-aux.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: XCB Aux library
|
||||
Description: XCB convenient functions
|
||||
Version: @PACKAGE_VERSION@
|
||||
Requires: xcb
|
||||
Libs: -L${libdir} -lxcb-util
|
||||
Cflags: -I${includedir}
|
||||
11
xim/xcb-util/xcb-event.pc.in
Normal file
11
xim/xcb-util/xcb-event.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: XCB Event library
|
||||
Description: XCB event callback interface
|
||||
Version: @PACKAGE_VERSION@
|
||||
Requires: xcb
|
||||
Libs: -L${libdir} -lxcb-util
|
||||
Cflags: -I${includedir}
|
||||
11
xim/xcb-util/xcb-util.pc.in
Normal file
11
xim/xcb-util/xcb-util.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: XCB Util Core library
|
||||
Description: XCB util core interface
|
||||
Version: @PACKAGE_VERSION@
|
||||
Requires: xcb
|
||||
Libs: -L${libdir} -lxcb-util
|
||||
Cflags: -I${includedir}
|
||||
1
xim/xcb-util/xcb/xcb_aux.h
Symbolic link
1
xim/xcb-util/xcb/xcb_aux.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../src/xcb_aux.h
|
||||
Reference in New Issue
Block a user