Commit c350873c authored by Mike Gabriel's avatar Mike Gabriel

Convert nx-X11/lib/ build flow from imake to autotools.

parent 1472e7e3
#!/usr/bin/make -f #!/usr/bin/make -f
NULL =
# helpers for "install" target
INSTALL_DIR=install -d -m 755 INSTALL_DIR=install -d -m 755
INSTALL_FILE=install -m 644 INSTALL_FILE=install -m 644
INSTALL_PROGRAM=install -m 755 INSTALL_PROGRAM=install -m 755
INSTALL_SYMLINK=ln -s -f INSTALL_SYMLINK=ln -s -f
COPY_SYMLINK=cp -a
COPY_DEREFERENCED=cp -RH # helpers for "build" target
SYMLINK_FILE=ln -f -s
# helpers for "clean" and "uninstall" targets
RM_FILE=rm -f RM_FILE=rm -f
RM_DIR=rmdir -p --ignore-fail-on-non-empty RM_DIR=rmdir -p --ignore-fail-on-non-empty
...@@ -30,22 +36,48 @@ NX_VERSION_PATCH=$(shell ./version.sh 4) ...@@ -30,22 +36,48 @@ NX_VERSION_PATCH=$(shell ./version.sh 4)
SHELL:=/bin/bash SHELL:=/bin/bash
NX_X11_HEADERS = \
Xlib.h \
Xresource.h \
Xutil.h \
cursorfont.h \
Xlibint.h \
Xcms.h \
Xlocale.h \
XKBlib.h \
XlibConf.h \
Xregion.h \
ImUtil.h \
$(NULL)
NX_XTRANS_HEADERS = \
transport.c \
Xtrans.c \
Xtrans.h \
Xtransint.h \
Xtranslcl.c \
Xtranssock.c \
Xtransutil.c \
$(NULL)
%: %:
if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi
if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi
if test -d nx-X11; then \ if test -d nx-X11; then \
if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi; \
if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \
if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \
fi fi
# clean auto-generated files # clean auto-generated files
if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \
./mesa-quilt pop -a; \ if [ -x ./mesa-quilt ]; then ./mesa-quilt pop -a; fi; \
rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -Rf nx-X11/extras/Mesa/.pc/; \
rm -f nx-X11/config/cf/nxversion.def; \ rm -f nx-X11/config/cf/nxversion.def; \
rm -f nx-X11/config/cf/date.def; \ rm -f nx-X11/config/cf/date.def; \
rm -f bin/nxagent; \ rm -f bin/nxagent; \
rm -f bin/nxproxy; \ rm -f bin/nxproxy; \
${MAKE} clean-env; \
fi fi
all: all:
...@@ -54,7 +86,7 @@ all: ...@@ -54,7 +86,7 @@ all:
test: test:
echo "No testing for NX (redistributed)" echo "No testing for NX (redistributed)"
build-env: version:
# prepare nx-X11/config/cf/nxversion.def # prepare nx-X11/config/cf/nxversion.def
sed \ sed \
-e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \ -e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \
...@@ -64,8 +96,34 @@ build-env: ...@@ -64,8 +96,34 @@ build-env:
nx-X11/config/cf/nxversion.def.in \ nx-X11/config/cf/nxversion.def.in \
> nx-X11/config/cf/nxversion.def > nx-X11/config/cf/nxversion.def
build-env: version
# prepare Makefiles and the nx-X11 symlinking magic # prepare Makefiles and the nx-X11 symlinking magic
cd nx-X11 && make BuildEnv FONT_DEFINES=$(FONT_DEFINES) ${MAKE} -C nx-X11 BuildIncludes FONT_DEFINES=$(FONT_DEFINES)
# set up environment for libNX_X11 build (X11 header files)
mkdir -p nx-X11/exports/include/nx-X11/
for header in $(NX_X11_HEADERS); do \
${SYMLINK_FILE} ../../../lib/include/X11/$${header} nx-X11/exports/include/nx-X11/$${header}; \
done
# set up environment for libNX_X11 build (Xtrans header/include files)
mkdir -p nx-X11/exports/include/nx-X11/Xtrans/
for header in $(NX_XTRANS_HEADERS); do \
${SYMLINK_FILE} ../../../../lib/include/xtrans/$${header} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \
done
clean-env: version
for header in $(NX_X11_HEADERS); do \
${RM_FILE} nx-X11/exports/include/nx-X11/$${header}; \
done
for header in $(NX_XTRANS_HEADERS); do \
${RM_FILE} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \
done
-rmdir exports/include/nx-X11/Xtrans/
-rmdir exports/include/nx-X11/
${MAKE} -C nx-X11 CleanEnv FONT_DEFINES=$(FONT_DEFINES)
build-lite: build-lite:
cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE}
...@@ -73,17 +131,26 @@ build-lite: ...@@ -73,17 +131,26 @@ build-lite:
build-full: build-env build-full: build-env
# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles...
# build nxcomp first
cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE}
# build libNX_X11 and libNX_Xext prior to building
# nxcomp{ext,shad}.
cd nx-X11/lib && make
# build libNX_X11 second
cd nx-X11/lib && autoreconf -vfsi && (${CONFIGURE} --disable-poll) && ${MAKE}
mkdir -p nx-X11/exports/lib/
$(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so nx-X11/exports/lib/libNX_X11.so
$(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6 nx-X11/exports/lib/libNX_X11.so.6
$(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6.3.0 nx-X11/exports/lib/libNX_X11.so.6.3.0
# build nxcompshad third
cd nxcompshad && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxcompshad && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE}
# build nxagent fourth
./mesa-quilt push -a ./mesa-quilt push -a
${MAKE} -C nx-X11 BuildDependsOnly FONT_DEFINES=$(FONT_DEFINES)
${MAKE} -C nx-X11 World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB)
cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB) # build nxproxy fifth
cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE}
build: build:
...@@ -149,12 +216,9 @@ install-full: ...@@ -149,12 +216,9 @@ install-full:
done; done;
$(INSTALL_DIR) $(DESTDIR)$(SHLIBDIR) $(INSTALL_DIR) $(DESTDIR)$(SHLIBDIR)
$(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(SHLIBDIR)/
$(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(SHLIBDIR)/
$(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(SHLIBDIR)/
$(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)
$(INSTALL_SYMLINK) ../../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/libX11.so.6 $(INSTALL_SYMLINK) ../../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/libX11.so.6
$(INSTALL_SYMLINK) ../../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.2 $(INSTALL_SYMLINK) ../../libNX_X11.so.6.3.0 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.3.0
. replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \
while read dirname; do \ while read dirname; do \
...@@ -168,11 +232,11 @@ install-full: ...@@ -168,11 +232,11 @@ install-full:
$(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/
$(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx
$(INSTALL_FILE) nx-X11/lib/X11/XErrorDB $(DESTDIR)$(PREFIX)/share/nx/
$(INSTALL_FILE) nx-X11/lib/X11/Xcms.txt $(DESTDIR)$(PREFIX)/share/nx/
$(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent
$(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy
$(MAKE) -C nx-X11/lib install
uninstall: uninstall:
$(MAKE) uninstall-lite $(MAKE) uninstall-lite
[ ! -d nx-X11 ] || $(MAKE) uninstall-full [ ! -d nx-X11 ] || $(MAKE) uninstall-full
......
...@@ -874,8 +874,8 @@ libNX_X11.so.6 libnx-x11-6 #MINVER# ...@@ -874,8 +874,8 @@ libNX_X11.so.6 libnx-x11-6 #MINVER#
_XLockMutex_fn@Base 3.5.0.29 _XLockMutex_fn@Base 3.5.0.29
_XLookupKeysym@Base 3.5.0.29 _XLookupKeysym@Base 3.5.0.29
_XLookupString@Base 3.5.0.29 _XLookupString@Base 3.5.0.29
_XNoticeCreateBitmap@Base 3.5.0.29 #MISSING: 3.5.99.9# _XNoticeCreateBitmap@Base 3.5.0.29
_XNoticePutBitmap@Base 3.5.0.29 #MISSING: 3.5.99.9# _XNoticePutBitmap@Base 3.5.0.29
_XOpenLC@Base 3.5.0.29 _XOpenLC@Base 3.5.0.29
_XParseBaseFontNameList@Base 3.5.0.29 _XParseBaseFontNameList@Base 3.5.0.29
_XPollfdCacheAdd@Base 3.5.0.29 _XPollfdCacheAdd@Base 3.5.0.29
...@@ -909,7 +909,7 @@ libNX_X11.so.6 libnx-x11-6 #MINVER# ...@@ -909,7 +909,7 @@ libNX_X11.so.6 libnx-x11-6 #MINVER#
_XTextHeight@Base 3.5.0.29 _XTextHeight@Base 3.5.0.29
_XTranslateKey@Base 3.5.0.29 _XTranslateKey@Base 3.5.0.29
_XTranslateKeySym@Base 3.5.0.29 _XTranslateKeySym@Base 3.5.0.29
_XTryShapeBitmapCursor@Base 3.5.0.29 #MISSING: 2:3.5.99.9# _XTryShapeBitmapCursor@Base 3.5.0.29
_XUnknownCopyEventCookie@Base 2:3.5.99.2 _XUnknownCopyEventCookie@Base 2:3.5.99.2
_XUnknownNativeEvent@Base 3.5.0.29 _XUnknownNativeEvent@Base 3.5.0.29
_XUnknownWireEvent@Base 3.5.0.29 _XUnknownWireEvent@Base 3.5.0.29
......
usr/lib/*/libNX_X11.so usr/lib/*/libNX_X11.so
usr/lib/*/libNX_X11.a
usr/include/*/nx-X11/ImUtil.h usr/include/*/nx-X11/ImUtil.h
usr/include/*/nx-X11/Xauth.h usr/include/*/nx-X11/Xauth.h
usr/include/*/nx-X11/XKBlib.h usr/include/*/nx-X11/XKBlib.h
...@@ -13,3 +14,4 @@ usr/include/*/nx-X11/Xutil.h ...@@ -13,3 +14,4 @@ usr/include/*/nx-X11/Xutil.h
usr/include/*/nx-X11/cursorfont.h usr/include/*/nx-X11/cursorfont.h
usr/include/*/nx-X11/misc.h usr/include/*/nx-X11/misc.h
usr/include/*/nx-X11/os.h usr/include/*/nx-X11/os.h
usr/lib/*/pkgconfig/nx-x11.pc
usr/share/nx/SecurityPolicy usr/share/nx/SecurityPolicy
usr/share/nx/XErrorDB usr/share/nx/X11/XErrorDB
usr/share/nx/Xcms.txt usr/share/nx/X11/Xcms.txt
...@@ -26,6 +26,7 @@ override_dh_install: ...@@ -26,6 +26,7 @@ override_dh_install:
# remove static libs # remove static libs
rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.la rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.la
rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.la rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.la
rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libNX_X11.la
# remove extras, GL, and other unneeded headers # remove extras, GL, and other unneeded headers
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/GL/ rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/GL/
......
...@@ -304,6 +304,53 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], ...@@ -304,6 +304,53 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
]) # NX_DEFAULT_OPTIONS ]) # NX_DEFAULT_OPTIONS
# NX_CHECK_MALLOC_ZERO
# ----------------------
# Minimum version: 1.0.0
#
# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
# malloc(0) returns NULL. Packages should add one of these cflags to
# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
AC_DEFUN([NX_CHECK_MALLOC_ZERO],[
AC_ARG_ENABLE(malloc0returnsnull,
AS_HELP_STRING([--enable-malloc0returnsnull],
[malloc(0) returns NULL (default: auto)]),
[MALLOC_ZERO_RETURNS_NULL=$enableval],
[MALLOC_ZERO_RETURNS_NULL=auto])
AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
],[
char *m0, *r0, *c0, *p;
m0 = malloc(0);
p = malloc(10);
r0 = realloc(p,0);
c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])],
[MALLOC_ZERO_RETURNS_NULL=yes],
[MALLOC_ZERO_RETURNS_NULL=no],
[MALLOC_ZERO_RETURNS_NULL=yes])
fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
else
MALLOC_ZERO_CFLAGS=""
XMALLOC_ZERO_CFLAGS=""
XTMALLOC_ZERO_CFLAGS=""
fi
AC_SUBST([MALLOC_ZERO_CFLAGS])
AC_SUBST([XMALLOC_ZERO_CFLAGS])
AC_SUBST([XTMALLOC_ZERO_CFLAGS])
]) # NX_CHECK_MALLOC_ZERO
dnl Check to see if we're running under Cygwin32. dnl Check to see if we're running under Cygwin32.
......
dnl
dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
dnl and/or sell copies of the Software, and to permit persons to whom the
dnl Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice (including the next
dnl paragraph) shall be included in all copies or substantial portions of the
dnl Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl
# NX_XTRANS_TCP_FLAGS()
# ------------------
# Find needed libraries for TCP sockets, and check for IPv6 support
AC_DEFUN([NX_XTRANS_TCP_FLAGS],[
# SVR4 hides these in libraries other than libc
AC_SEARCH_LIBS(socket, [socket])
AC_SEARCH_LIBS(gethostbyname, [nsl])
if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
AC_CHECK_LIB([ws2_32],[main])
fi
# Needs to come after above checks for libsocket & libnsl for SVR4 systems
AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
[IPV6CONN=$enableval],
[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
AC_MSG_CHECKING([if IPv6 support should be built])
if test "$IPV6CONN" = "yes"; then
AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
fi
AC_MSG_RESULT($IPV6CONN)
# 4.3BSD-Reno added a new member to struct sockaddr_in
AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
AC_DEFINE([BSD44SOCKETS],1,
[Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
# POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
AC_CHECK_TYPES([socklen_t], [], [], [
AC_INCLUDES_DEFAULT
#include <sys/socket.h>])
# XPG4v2/UNIX95 added msg_control - check to see if we need to define
# _XOPEN_SOURCE to get it (such as on Solaris)
AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
[
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
])
# First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
unset ac_cv_member_struct_msghdr_msg_control
AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
AC_CHECK_MEMBER([struct msghdr.msg_control],
[AC_DEFINE([_XOPEN_SOURCE], [600],
[Defined if needed to expose struct msghdr.msg_control])
], [], [
#define _XOPEN_SOURCE 600
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
])
fi
# If that didn't work, fall back to XPG5/UNIX98 with C89
if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
unset ac_cv_member_struct_msghdr_msg_control
AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
AC_CHECK_MEMBER([struct msghdr.msg_control],
[AC_DEFINE([_XOPEN_SOURCE], [500],
[Defined if needed to expose struct msghdr.msg_control])
], [], [
#define _XOPEN_SOURCE 500
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
])
fi
]) # NX_XTRANS_TCP_FLAGS
# NX_XTRANS_CONNECTION_FLAGS()
# -------------------------
# Standard checks for which Xtrans transports to use by the Xorg packages
# that use Xtrans functions
AC_DEFUN([NX_XTRANS_CONNECTION_FLAGS],[
AC_REQUIRE([AC_CANONICAL_HOST])
[case $host_os in
mingw*) unixdef="no" ;;
*) unixdef="yes" ;;
esac]
AC_ARG_ENABLE(unix-transport,
AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
if test "$UNIXCONN" = "yes"; then
AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
fi
AC_MSG_RESULT($UNIXCONN)
AC_ARG_ENABLE(tcp-transport,
AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
[TCPCONN=$enableval], [TCPCONN=yes])
AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
AC_MSG_RESULT($TCPCONN)
if test "$TCPCONN" = "yes"; then
AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
NX_XTRANS_TCP_FLAGS
fi
AC_ARG_ENABLE(nxcomp-transport,
AS_HELP_STRING([--enable-nxcomp-transport],[Enable nxcomp mediated transport]),
[NXCOMPCONN=$enableval], [NXCOMPCONN=yes])
AC_MSG_CHECKING([if Xtrans should support nxcomp mediated connections])
AC_MSG_RESULT($NXCOMPCONN)
if test "$NXCOMPCONN" = "yes"; then
AC_DEFINE(NX_TRANS_SOCKET,1,[Support nxcomp mediated socket connections])
AC_DEFINE(NX_TRANS_EXIT,1,[Support nxcomp NX_TRANS_EXIT feature])
NX_XTRANS_TCP_FLAGS
fi
]) # NX_XTRANS_CONNECTION_FLAGS
# NX_XTRANS_SECURE_RPC_FLAGS()
# -------------------------
# Check for Secure RPC functions - must come after NX_XTRANS_TCP_FLAGS
# so that any necessary networking libraries are already found
AC_DEFUN([NX_XTRANS_SECURE_RPC_FLAGS],
[AC_REQUIRE([NX_XTRANS_TCP_FLAGS])
AC_ARG_ENABLE(secure-rpc,
AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
[SECURE_RPC=$enableval], [SECURE_RPC="try"])
if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
FOUND_SECURE_RPC="no"
AC_CHECK_FUNCS([authdes_seccreate authdes_create],
[FOUND_SECURE_RPC="yes"])
if test "x$FOUND_SECURE_RPC" = "xno" ; then
if test "x$SECURE_RPC" = "xyes" ; then
AC_MSG_ERROR([Secure RPC requested, but required functions not found])
fi
SECURE_RPC="no"
else
dnl FreeBSD keeps getsecretkey in librpcsvc
AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
SECURE_RPC="yes"
fi
fi
AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
if test "x$SECURE_RPC" = "xyes" ; then
AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
fi
AC_MSG_RESULT($SECURE_RPC)
]) # NX_XTRANS_SECURE_RPC_FLAGS
...@@ -27,8 +27,7 @@ RELEASE = XOrgReleaseString ...@@ -27,8 +27,7 @@ RELEASE = XOrgReleaseString
#define OSName Unknown Operating System! #define OSName Unknown Operating System!
#endif #endif
SUBDIRS = include config lib programs SUBDIRS = include config programs
LNINSTALLDIRS = lib
#if HasParallelMake #if HasParallelMake
#ifdef ParallelDefines #ifdef ParallelDefines
...@@ -38,10 +37,6 @@ RELEASE = XOrgReleaseString ...@@ -38,10 +37,6 @@ RELEASE = XOrgReleaseString
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
MakeLintSubdirs($(LNINSTALLDIRS),install.ln,install.ln)
MakeLintSubdirs($(LNINSTALLDIRS),external.ln,lintlib)
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
#define IHaveSpecialMakefileTarget #define IHaveSpecialMakefileTarget
......
...@@ -24,8 +24,8 @@ MAKE_OPTS = -f xmakefile ...@@ -24,8 +24,8 @@ MAKE_OPTS = -f xmakefile
MAKE_CMD = $(MAKE) $(MAKE_OPTS) MAKE_CMD = $(MAKE) $(MAKE_OPTS)
all: all:
@${MAKE} ${MAKE_OPTS} xmakefile-exists || $(MAKE) all-initial @${MAKE_CMD} xmakefile-exists || $(MAKE) all-initial
@${MAKE} ${MAKE_OPTS} $@ @${MAKE_CMD} $@
all-initial: all-initial:
@echo Please use make World, or on NT use nmake World.Win32. @echo Please use make World, or on NT use nmake World.Win32.
...@@ -40,27 +40,32 @@ World: ...@@ -40,27 +40,32 @@ World:
@date @date
@echo "" @echo ""
if [ ! -f xmakefile ]; then ${MAKE} ${MFLAGS} BuildEnv; fi if [ ! -f xmakefile ]; then ${MAKE} ${MFLAGS} BuildEnv; fi
${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World ${MAKE_CMD} $(MFLAGS) $(WORLDOPTS) World
@echo "" @echo ""
@date @date
@echo "" @echo ""
@echo Full build of $(RELEASE) complete. @echo Full build of $(RELEASE) complete.
@echo "" @echo ""
BuildEnv: CleanEnv:
@if [ -f xmakefile ]; then \ @if [ -f xmakefile ]; then \
${MAKE} ${MAKE_OPTS} -k distclean || \ ${MAKE_CMD} -k distclean || \
${MAKE} ${MAKE_OPTS} -k clean || \ ${MAKE_CMD} -k clean || \
$(RM) xmakefile; \ $(RM) xmakefile; \
fi fi
@rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def; @rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def;
${MAKE} $(MFLAGS) xmakefile ${MAKE} $(MFLAGS) xmakefile
${MAKE} ${MAKE_OPTS} $(MFLAGS) VerifyOS ${MAKE_CMD} $(MFLAGS) VerifyOS
${MAKE} ${MAKE_OPTS} $(MFLAGS) Makefiles ${MAKE_CMD} $(MFLAGS) Makefiles
${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean ${MAKE_CMD} $(MFLAGS) BOOTSTRAPSUBDIRS= clean
${MAKE} ${MAKE_OPTS} $(MFLAGS) includes
${MAKE} ${MAKE_OPTS} $(MFLAGS) depend
BuildEnv: CleanEnv BuildIncludes BuildDependsOnly
BuildIncludes: CleanEnv
${MAKE_CMD} $(MFLAGS) includes
BuildDependsOnly:
${MAKE_CMD} $(MFLAGS) depend
.PRECIOUS: Makefile .PRECIOUS: Makefile
...@@ -86,37 +91,35 @@ xmakefile: Imakefile ...@@ -86,37 +91,35 @@ xmakefile: Imakefile
# a copy of every rule that might be invoked at top level # a copy of every rule that might be invoked at top level
clean: clean:
-${MAKE_CMD} ${MAKE_OPTS} $@ -${MAKE_CMD} $@
find config -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done find config lib programs include -type f -name Makefile | while read makefile; do rm -f $$makefile; done
find lib -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done
find programs -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done
find include -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done
dangerous_strip_clean: dangerous_strip_clean:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
distclean: distclean:
-${MAKE} ${MAKE_OPTS} $@ -${MAKE_CMD} $@
$(RM) xmakefile $(RM) xmakefile
depend: depend:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
Everything: Everything:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
external.ln: external.ln:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
includes: includes:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
install.sdk: install.sdk:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
install.ln: install.ln:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
install.man: install.man:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
install: install:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
Makefiles: Makefiles:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
man_keywords: man_keywords:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
tags: tags:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
VerifyOS: VerifyOS:
${MAKE} ${MAKE_OPTS} $@ ${MAKE_CMD} $@
#define IHaveSubdirs
#define PassCDebugFlags
NULL =
#if BuildX11Lib
X11LIBDIR = X11
#endif
LINTSUBDIRS = \
$(X11LIBDIR) \
$(NULL)
SUBDIRS = xtrans $(LINTSUBDIRS)
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
MakeLintLibSubdirs($(LINTSUBDIRS))
MakeLintSubdirs($(LINTSUBDIRS),install.ln,install.ln)
NULL =
SUBDIRS = modules src
pkgconfig_DATA = nx-x11.pc
MAINTAINERCLEANFILES = \
$(srcdir)/autom4te.cache/* \
$(srcdir)/build-aux/* \
$(srcdir)/Makefile.in \
$(srcdir)/src/Makefile.in \
$(srcdir)/src/xkb/Makefile.in \
$(srcdir)/src/util/Makefile.in \
$(srcdir)/src/xcms/Makefile.in \
$(srcdir)/src/xlibi18n/Makefile.in \
$(srcdir)/modules/om/generic/Makefile.in \
$(srcdir)/modules/om/Makefile.in \
$(srcdir)/modules/Makefile.in \
$(srcdir)/modules/im/ximcp/Makefile.in \
$(srcdir)/modules/im/Makefile.in \
$(srcdir)/modules/lc/Makefile.in \
$(srcdir)/modules/lc/gen/Makefile.in \
$(srcdir)/modules/lc/def/Makefile.in \
$(srcdir)/modules/lc/Utf8/Makefile.in \
$(srcdir)/include/Makefile.in \
$(srcdir)/aclocal.m4 \
$(srcdir)/src/config.h.in \
$(srcdir)/src/config.h.in~ \
$(srcdir)/configure \
$(srcdir)/m4/libtool.m4 \
$(srcdir)/m4/lt~obsolete.m4 \
$(srcdir)/m4/ltoptions.m4 \
$(srcdir)/m4/ltsugar.m4 \
$(srcdir)/m4/ltversion.m4 \
$(NULL)
DISTCLEANFILES=$(MAINTAINERCLEANFILES)
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XDrawText(
register Display *dpy,
Drawable d,
GC gc,
int x,
int y,
XTextItem *items,
int nitems)
{
register int i;
register XTextItem *item;
int length = 0;
register xPolyText8Req *req;
LockDisplay(dpy);
FlushGC(dpy, gc);
GetReq (PolyText8, req);
req->drawable = d;
req->gc = gc->gid;
req->x = x;
req->y = y;
item = items;
for (i=0; i < nitems; i++) {
if (item->font)
length += 5; /* a 255 byte, plus size of Font id */
if (item->delta)
{
if (item->delta > 0)
{
length += SIZEOF(xTextElt) * ((item->delta + 126) / 127);
}
else
{
length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128);
}
}
if (item->nchars > 0)
{
length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1);
if (!item->delta) length += SIZEOF(xTextElt);
length += item->nchars;
}
item++;
}
req->length += (length + 3)>>2; /* convert to number of 32-bit words */
/*
* If the entire request does not fit into the remaining space in the
* buffer, flush the buffer first. If the request does fit into the
* empty buffer, then we won't have to flush it at the end to keep
* the buffer 32-bit aligned.
*/
if (dpy->bufptr + length > dpy->bufmax)
_XFlush (dpy);
item = items;
for (i=0; i< nitems; i++) {
if (item->font) {
/* to mark a font shift, write a 255 byte followed by
the 4 bytes of font ID, big-end first */
register unsigned char *f;
BufAlloc (unsigned char *, f, 5);
f[0] = 255;
f[1] = (item->font & 0xff000000) >> 24;
f[2] = (item->font & 0x00ff0000) >> 16;
f[3] = (item->font & 0x0000ff00) >> 8;
f[4] = item->font & 0x000000ff;
/* update GC shadow */
gc->values.font = item->font;
}
{
int nbytes = SIZEOF(xTextElt);
int PartialNChars = item->nchars;
int PartialDelta = item->delta;
/* register xTextElt *elt; */
int FirstTimeThrough = True;
char *CharacterOffset = item->chars;
char *tbuf = NULL;
while((PartialDelta < -128) || (PartialDelta > 127))
{
int nb = SIZEOF(xTextElt);
BufAlloc (char *, tbuf, nb);
*tbuf = 0; /* elt->len */
if (PartialDelta > 0 )
{
*(tbuf+1) = 127; /* elt->delta */
PartialDelta = PartialDelta - 127;
}
else
{
/* -128 = 0x8, need to be careful of signed chars... */
*((unsigned char *)(tbuf+1)) = 0x80; /* elt->delta */
PartialDelta = PartialDelta + 128;
}
}
if (PartialDelta)
{
BufAlloc (char *, tbuf , nbytes);
*tbuf = 0; /* elt->len */
*(tbuf+1) = PartialDelta; /* elt->delta */
}
while(PartialNChars > 254)
{
nbytes = 254;
if (FirstTimeThrough)
{
FirstTimeThrough = False;
if (!item->delta)
{
nbytes += SIZEOF(xTextElt);
BufAlloc (char *, tbuf, nbytes);
*(tbuf+1) = 0; /* elt->delta */
}
else
{
char *DummyChar;
BufAlloc(char *, DummyChar, nbytes);
}
}
else
{
nbytes += SIZEOF(xTextElt);
BufAlloc (char *, tbuf, nbytes);
*(tbuf+1) = 0; /* elt->delta */
}
/* watch out for signs on chars */
*(unsigned char *)tbuf = 254; /* elt->len */
memcpy (tbuf+2 , CharacterOffset, 254);
PartialNChars = PartialNChars - 254;
CharacterOffset += 254;
}
if (PartialNChars)
{
nbytes = PartialNChars;
if (FirstTimeThrough)
{
FirstTimeThrough = False;
if (!item->delta)
{
nbytes += SIZEOF(xTextElt);
BufAlloc (char *, tbuf, nbytes);
*(tbuf+1) = 0; /* elt->delta */
}
else
{
char *DummyChar;
BufAlloc(char *, DummyChar, nbytes);
}
}
else
{
nbytes += SIZEOF(xTextElt);
BufAlloc (char *, tbuf, nbytes);
*(tbuf+1) = 0; /* elt->delta */
}
*tbuf = PartialNChars; /* elt->len */
memcpy (tbuf+2 , CharacterOffset, PartialNChars);
}
}
item++;
}
/* Pad request out to a 32-bit boundary */
if (length &= 3) {
char *pad;
/*
* BufAlloc is a macro that uses its last argument more than
* once, otherwise I'd write "BufAlloc (char *, pad, 4-length)"
*/
length = 4 - length;
BufAlloc (char *, pad, length);
/*
* if there are 3 bytes of padding, the first byte MUST be 0
* so the pad bytes aren't mistaken for a final xTextElt
*/
*pad = 0;
}
/*
* If the buffer pointer is not now pointing to a 32-bit boundary,
* we must flush the buffer so that it does point to a 32-bit boundary
* at the end of this routine.
*/
if ((dpy->bufptr - dpy->buffer) & 3)
_XFlush (dpy);
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XDrawText16(
register Display *dpy,
Drawable d,
GC gc,
int x,
int y,
XTextItem16 *items,
int nitems)
{
register int i;
register XTextItem16 *item;
int length = 0;
register xPolyText16Req *req;
LockDisplay(dpy);
FlushGC(dpy, gc);
GetReq (PolyText16, req);
req->drawable = d;
req->gc = gc->gid;
req->x = x;
req->y = y;
item = items;
for (i=0; i < nitems; i++) {
if (item->font)
length += 5; /* a 255 byte, plus size of Font id */
if (item->delta)
{
if (item->delta > 0)
{
length += SIZEOF(xTextElt) * ((item->delta + 126) / 127);
}
else
{
length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128);
}
}
if (item->nchars > 0)
{
length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1);
if (!item->delta) length += SIZEOF(xTextElt);
length += item->nchars << 1;
}
item++;
}
req->length += (length + 3)>>2; /* convert to number of 32-bit words */
/*
* If the entire request does not fit into the remaining space in the
* buffer, flush the buffer first. If the request does fit into the
* empty buffer, then we won't have to flush it at the end to keep
* the buffer 32-bit aligned.
*/
if (dpy->bufptr + length > dpy->bufmax)
_XFlush (dpy);
item = items;
for (i=0; i< nitems; i++) {
if (item->font) {
/* to mark a font shift, write a 255 byte followed by
the 4 bytes of font ID, big-end first */
register unsigned char *f;
BufAlloc (unsigned char *, f, 5);
f[0] = 255;
f[1] = (item->font & 0xff000000) >> 24;
f[2] = (item->font & 0x00ff0000) >> 16;
f[3] = (item->font & 0x0000ff00) >> 8;
f[4] = item->font & 0x000000ff;
/* update GC shadow */
gc->values.font = item->font;
}
{
int nbytes = SIZEOF(xTextElt);
int PartialNChars = item->nchars;
int PartialDelta = item->delta;
register xTextElt *elt = NULL;
int FirstTimeThrough = True;
XChar2b *CharacterOffset = item->chars;
while((PartialDelta < -128) || (PartialDelta > 127))
{
int nb = SIZEOF(xTextElt);
BufAlloc (xTextElt *, elt, nb);
elt->len = 0;
if (PartialDelta > 0 )
{
elt->delta = 127;
PartialDelta = PartialDelta - 127;
}
else
{
elt->delta = -128;
PartialDelta = PartialDelta + 128;
}
}
if (PartialDelta)
{
BufAlloc (xTextElt *, elt, nbytes);
elt->len = 0;
elt->delta = PartialDelta;
}
while(PartialNChars > 254)
{
nbytes = 254 * 2;
if (FirstTimeThrough)
{
FirstTimeThrough = False;
if (!item->delta)
{
nbytes += SIZEOF(xTextElt);
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
}
else
{
char *DummyChar;
BufAlloc(char *, DummyChar, nbytes);
#ifdef lint
DummyChar = DummyChar;
#endif
}
}
else
{
nbytes += SIZEOF(xTextElt);
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
}
elt->len = 254;
memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2);
PartialNChars = PartialNChars - 254;
CharacterOffset += 254;
}
if (PartialNChars)
{
nbytes = PartialNChars * 2;
if (FirstTimeThrough)
{
FirstTimeThrough = False;
if (!item->delta)
{
nbytes += SIZEOF(xTextElt);
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
}
else
{
char *DummyChar;
BufAlloc(char *, DummyChar, nbytes);
#ifdef lint
DummyChar = DummyChar;
#endif
}
}
else
{
nbytes += SIZEOF(xTextElt);
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
}
elt->len = PartialNChars;
memcpy ((char *) (elt + 1), (char *)CharacterOffset,
PartialNChars *
2);
}
}
item++;
}
/* Pad request out to a 32-bit boundary */
if (length &= 3) {
char *pad;
/*
* BufAlloc is a macro that uses its last argument more than
* once, otherwise I'd write "BufAlloc (char *, pad, 4-length)"
*/
length = 4 - length;
BufAlloc (char *, pad, length);
/*
* if there are 3 bytes of padding, the first byte MUST be 0
* so the pad bytes aren't mistaken for a final xTextElt
*/
*pad = 0;
}
/*
* If the buffer pointer is not now pointing to a 32-bit boundary,
* we must flush the buffer so that it does point to a 32-bit boundary
* at the end of this routine.
*/
if ((dpy->bufptr - dpy->buffer) & 3)
_XFlush (dpy);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsPrOfId.c
*
* DESCRIPTION
* Source for XcmsPrefixOfFormat()
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
/*
* NAME
* XcmsPrefixOfId
*
* SYNOPSIS
*/
char *
XcmsPrefixOfFormat(
XcmsColorFormat id)
/*
* DESCRIPTION
* Returns the color space prefix for the specified color
* space ID if the color space is found in the Color
* Conversion Context.
*
* RETURNS
* Returns a color space prefix.
*
* CAVEATS
* Space is allocated for the returned string, therefore,
* the application is responsible for freeing (using XFree)
* the space.
*
*/
{
XcmsColorSpace **papColorSpaces;
/*
* First try Device-Independent color spaces
*/
papColorSpaces = _XcmsDIColorSpaces;
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}
}
/*
* Next try Device-Dependent color spaces
*/
papColorSpaces = _XcmsDDColorSpaces;
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}
}
return(NULL);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
/* XPutBackEvent puts an event back at the head of the queue. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
_XPutBackEvent (
register Display *dpy,
register XEvent *event)
{
register _XQEvent *qelt;
XEvent store = *event;
if (!dpy->qfree) {
if ((dpy->qfree = Xmalloc (sizeof (_XQEvent))) == NULL) {
return 0;
}
dpy->qfree->next = NULL;
}
/* unclaimed cookie? */
if (_XIsEventCookie(dpy, event))
{
XEvent copy = {0};
/* if not claimed, then just fetch and store again */
if (!event->xcookie.data) {
_XFetchEventCookie(dpy, &event->xcookie);
store = *event;
} else { /* if claimed, copy, client must free */
_XCopyEventCookie(dpy, &event->xcookie, &copy.xcookie);
store = copy;
}
}
qelt = dpy->qfree;
dpy->qfree = qelt->next;
qelt->qserial_num = dpy->next_event_serial_num++;
qelt->next = dpy->head;
qelt->event = store;
dpy->head = qelt;
if (dpy->tail == NULL)
dpy->tail = qelt;
dpy->qlen++;
return 0;
}
int
XPutBackEvent (
register Display * dpy,
register XEvent *event)
{
int ret;
LockDisplay(dpy);
ret = _XPutBackEvent(dpy, event);
UnlockDisplay(dpy);
return ret;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQBlack.c - Query Black
*
* DESCRIPTION
* Routine to obtain a color specification for zero
* red, green, and blue intensities.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryBlack
*
* SYNOPSIS
*/
Status
XcmsQueryBlack(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
* zero intensity red, green, and blue.
*
* RETURNS
* Returns XcmsSuccess, if failed; otherwise XcmsFailure
*
*/
{
XcmsColor tmp;
tmp.format = XcmsRGBiFormat;
tmp.pixel = 0;
tmp.spec.RGBi.red = 0.0;
tmp.spec.RGBi.green = 0.0;
tmp.spec.RGBi.blue = 0.0;
if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) {
return(XcmsFailure);
}
memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQBlue.c - Query Blue
*
* DESCRIPTION
* Routine to obtain a color specification for full
* blue intensity and zero red and green intensities.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryBlue
*
* SYNOPSIS
*/
Status
XcmsQueryBlue(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
* full intensity blue and zero intensity red and green.
*
* RETURNS
* Returns XcmsSuccess, if failed; otherwise XcmsFailure
*
*/
{
XcmsColor tmp;
tmp.format = XcmsRGBiFormat;
tmp.pixel = 0;
tmp.spec.RGBi.red = 0.0;
tmp.spec.RGBi.green = 0.0;
tmp.spec.RGBi.blue = 1.0;
if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) {
return(XcmsFailure);
}
memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQGreen.c - Query Green
*
* DESCRIPTION
* Routine to obtain a color specification for full
* green intensity and zero red and blue intensities.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryGreen
*
* SYNOPSIS
*/
Status
XcmsQueryGreen(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
* full intensity green and zero intensity red and blue.
*
* RETURNS
* Returns XcmsSuccess, if failed; otherwise XcmsFailure
*
*/
{
XcmsColor tmp;
tmp.format = XcmsRGBiFormat;
tmp.pixel = 0;
tmp.spec.RGBi.red = 0.0;
tmp.spec.RGBi.green = 1.0;
tmp.spec.RGBi.blue = 0.0;
if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) {
return(XcmsFailure);
}
memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQRed.c - Query Red
*
* DESCRIPTION
* Routine to obtain a color specification for full
* red intensity and zero green and blue intensities.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryRed
*
* SYNOPSIS
*/
Status
XcmsQueryRed(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
* full intensity red and zero intensity green and blue.
*
* RETURNS
* Returns XcmsSuccess, if failed; otherwise XcmsFailure
*
*/
{
XcmsColor tmp;
tmp.format = XcmsRGBiFormat;
tmp.pixel = 0;
tmp.spec.RGBi.red = 1.0;
tmp.spec.RGBi.green = 0.0;
tmp.spec.RGBi.blue = 0.0;
if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) {
return(XcmsFailure);
}
memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQWhite.c - Query White
*
* DESCRIPTION
* Routine to obtain a color specification for full
* red, green, and blue intensities.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryWhite
*
* SYNOPSIS
*/
Status
XcmsQueryWhite(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
* full intensity red, green, and blue.
*
* RETURNS
* Returns XcmsSuccess, if failed; otherwise XcmsFailure
*
*/
{
XcmsColor tmp;
tmp.format = XcmsRGBiFormat;
tmp.pixel = 0;
tmp.spec.RGBi.red = 1.0;
tmp.spec.RGBi.green = 1.0;
tmp.spec.RGBi.blue = 1.0;
if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) {
return(XcmsFailure);
}
memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Status XQueryBestSize(
register Display *dpy,
int class,
Drawable drawable,
unsigned int width,
unsigned int height,
unsigned int *ret_width,
unsigned int *ret_height)
{
xQueryBestSizeReply rep;
register xQueryBestSizeReq *req;
LockDisplay(dpy);
GetReq(QueryBestSize, req);
req->class = class;
req->drawable = drawable;
req->width = width;
req->height = height;
if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*ret_width = rep.width;
*ret_height = rep.height;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQuCol.c
*
* DESCRIPTION
* Source for XcmsQueryColors
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
/************************************************************************
* *
* PUBLIC ROUTINES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryColor - Query Color
*
* SYNOPSIS
*/
Status
XcmsQueryColor(
Display *dpy,
Colormap colormap,
XcmsColor *pXcmsColor_in_out,
XcmsColorFormat result_format)
/*
* DESCRIPTION
* This routine uses XQueryColor to obtain the X RGB values
* stored in the specified colormap for the specified pixel.
* The X RGB values are then converted to the target format as
* specified by the format component of the XcmsColor structure.
*
* RETURNS
* XcmsFailure if failed;
* XcmsSuccess if it succeeded.
*
* Returns a color specification of the color stored in the
* specified pixel.
*/
{
return(_XcmsSetGetColor(XQueryColor, dpy, colormap,
pXcmsColor_in_out, result_format, (Bool *) NULL));
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XQueryColor(
register Display *dpy,
Colormap cmap,
XColor *def) /* RETURN */
{
xrgb color;
xQueryColorsReply rep;
register xQueryColorsReq *req;
unsigned long val = def->pixel; /* needed for macro below */
LockDisplay(dpy);
GetReqExtra(QueryColors, 4, req); /* a pixel (CARD32) is 4 bytes */
req->cmap = cmap;
OneDataCard32 (dpy, NEXTPTR(req,xQueryColorsReq), val);
if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
_XRead(dpy, (char *)&color, (long) SIZEOF(xrgb));
def->red = color.red;
def->blue = color.blue;
def->green = color.green;
def->flags = DoRed | DoGreen | DoBlue;
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
static void
_XQueryColors(
register Display *dpy,
Colormap cmap,
XColor *defs, /* RETURN */
int ncolors)
{
register int i;
xQueryColorsReply rep;
register xQueryColorsReq *req;
GetReq(QueryColors, req);
req->cmap = cmap;
SetReqLen(req, ncolors, ncolors); /* each pixel is a CARD32 */
for (i = 0; i < ncolors; i++)
Data32 (dpy, (long *)&defs[i].pixel, 4L);
/* XXX this isn't very efficient */
if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
unsigned long nbytes = (long) ncolors * SIZEOF(xrgb);
xrgb *color = Xmalloc(nbytes);
if (color != NULL) {
_XRead(dpy, (char *) color, nbytes);
for (i = 0; i < ncolors; i++) {
register XColor *def = &defs[i];
register xrgb *rgb = &color[i];
def->red = rgb->red;
def->green = rgb->green;
def->blue = rgb->blue;
def->flags = DoRed | DoGreen | DoBlue;
}
Xfree(color);
}
else
_XEatDataWords(dpy, rep.length);
}
}
int
XQueryColors(
register Display * const dpy,
const Colormap cmap,
XColor *defs, /* RETURN */
int ncolors)
{
int n;
if (dpy->bigreq_size > 0)
n = dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1;
else
n = dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2);
LockDisplay(dpy);
while (ncolors >= n) {
_XQueryColors(dpy, cmap, defs, n);
defs += n;
ncolors -= n;
}
if (ncolors > 0)
_XQueryColors(dpy, cmap, defs, ncolors);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsQuCol.c
*
* DESCRIPTION
* Source for XcmsQueryColors
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
/************************************************************************
* *
* PUBLIC ROUTINES *
* *
************************************************************************/
/*
* NAME
* XcmsQueryColors - Query Colors
*
* SYNOPSIS
*/
Status
XcmsQueryColors(
Display *dpy,
Colormap colormap,
XcmsColor *pXcmsColors_in_out,
unsigned int nColors,
XcmsColorFormat result_format)
/*
* DESCRIPTION
* This routine uses XQueryColors to obtain the X RGB values
* stored in the specified colormap for the specified pixels.
* The X RGB values are then converted to the target format as
* specified by the format component of the XcmsColor structure.
*
* RETURNS
* XcmsFailure if failed;
* XcmsSuccess if it succeeded.
*
* Returns the color specifications of the colors stored in the
* specified pixels.
*/
{
return(_XcmsSetGetColors(XQueryColors, dpy, colormap,
pXcmsColors_in_out, nColors, result_format, (Bool *) NULL));
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Status XQueryBestCursor(
register Display *dpy,
Drawable drawable,
unsigned int width,
unsigned int height,
unsigned int *ret_width,
unsigned int *ret_height)
{
xQueryBestSizeReply rep;
register xQueryBestSizeReq *req;
LockDisplay(dpy);
GetReq(QueryBestSize, req);
req->class = CursorShape;
req->drawable = drawable;
req->width = width;
req->height = height;
if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*ret_width = rep.width;
*ret_height = rep.height;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Bool
XQueryExtension(
register Display *dpy,
_Xconst char *name,
int *major_opcode, /* RETURN */
int *first_event, /* RETURN */
int *first_error) /* RETURN */
{
xQueryExtensionReply rep;
register xQueryExtensionReq *req;
LockDisplay(dpy);
GetReq(QueryExtension, req);
req->nbytes = name ? strlen(name) : 0;
req->length += (req->nbytes+(unsigned)3)>>2;
_XSend(dpy, name, (long)req->nbytes);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
*major_opcode = rep.major_opcode;
*first_event = rep.first_event;
*first_error = rep.first_error;
UnlockDisplay(dpy);
SyncHandle();
return (rep.present);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
struct kmap {
char map[32];
};
int
XQueryKeymap(
register Display *dpy,
char keys[32])
{
xQueryKeymapReply rep;
_X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(QueryKeymap, req);
(void) _XReply(dpy, (xReply *)&rep,
(SIZEOF(xQueryKeymapReply) - SIZEOF(xReply)) >> 2, xTrue);
*(struct kmap *) keys = *(struct kmap *)rep.map; /* faster than memcpy */
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Bool XQueryPointer(
register Display *dpy,
Window w,
Window *root,
Window *child,
int *root_x,
int *root_y,
int *win_x,
int *win_y,
unsigned int *mask)
{
xQueryPointerReply rep;
xResourceReq *req;
LockDisplay(dpy);
GetResReq(QueryPointer, w, req);
if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
UnlockDisplay(dpy);
SyncHandle();
return(False);
}
*root = rep.root;
*child = rep.child;
*root_x = cvtINT16toInt (rep.rootX);
*root_y = cvtINT16toInt (rep.rootY);
*win_x = cvtINT16toInt (rep.winX);
*win_y = cvtINT16toInt (rep.winY);
*mask = rep.mask;
UnlockDisplay(dpy);
SyncHandle();
return (rep.sameScreen);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Status XQueryBestStipple(
register Display *dpy,
Drawable drawable,
unsigned int width,
unsigned int height,
unsigned int *ret_width,
unsigned int *ret_height)
{
xQueryBestSizeReply rep;
register xQueryBestSizeReq *req;
LockDisplay(dpy);
GetReq(QueryBestSize, req);
req->class = StippleShape;
req->drawable = drawable;
req->width = width;
req->height = height;
if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*ret_width = rep.width;
*ret_height = rep.height;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XQueryTextExtents16 (
register Display *dpy,
Font fid,
_Xconst XChar2b *string,
register int nchars,
int *dir,
int *font_ascent,
int *font_descent,
register XCharStruct *overall)
{
register long i;
register unsigned char *ptr;
char *buf;
xQueryTextExtentsReply rep;
long nbytes;
register xQueryTextExtentsReq *req;
LockDisplay(dpy);
nbytes = nchars << 1;
GetReq(QueryTextExtents, req);
req->fid = fid;
if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) {
req->length += (nbytes + 3)>>2;
req->oddLength = nchars & 1;
for (ptr = (unsigned char *)buf, i = nchars; --i >= 0; string++) {
*ptr++ = string->byte1;
*ptr++ = string->byte2;
}
Data (dpy, buf, nbytes);
}
if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*dir = rep.drawDirection;
*font_ascent = cvtINT16toInt (rep.fontAscent);
*font_descent = cvtINT16toInt (rep.fontDescent);
overall->ascent = (short) cvtINT16toShort (rep.overallAscent);
overall->descent = (short) cvtINT16toShort (rep.overallDescent);
/* XXX bogus - we're throwing away information!!! */
overall->width = (short) cvtINT32toInt (rep.overallWidth);
overall->lbearing = (short) cvtINT32toInt (rep.overallLeft);
overall->rbearing = (short) cvtINT32toInt (rep.overallRight);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XQueryTextExtents (
register Display *dpy,
Font fid,
register _Xconst char *string,
register int nchars,
int *dir,
int *font_ascent,
int *font_descent,
register XCharStruct *overall)
{
register int i;
register char *ptr;
char *buf;
xQueryTextExtentsReply rep;
long nbytes;
register xQueryTextExtentsReq *req;
LockDisplay(dpy);
nbytes = nchars << 1;
GetReq(QueryTextExtents, req);
req->fid = fid;
if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) {
req->length += (nbytes + 3)>>2;
req->oddLength = nchars & 1;
for (ptr = buf, i = nchars; --i >= 0;) {
*ptr++ = 0;
*ptr++ = *string++;
}
Data (dpy, buf, nbytes);
}
if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*dir = rep.drawDirection;
*font_ascent = cvtINT16toInt (rep.fontAscent);
*font_descent = cvtINT16toInt (rep.fontDescent);
overall->ascent = (short) cvtINT16toShort (rep.overallAscent);
overall->descent = (short) cvtINT16toShort (rep.overallDescent);
/* XXX bogus - we're throwing away information!!! */
overall->width = (short) cvtINT32toInt (rep.overallWidth);
overall->lbearing = (short) cvtINT32toInt (rep.overallLeft);
overall->rbearing = (short) cvtINT32toInt (rep.overallRight);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Status XQueryBestTile(
register Display *dpy,
Drawable drawable,
unsigned int width,
unsigned int height,
unsigned int *ret_width,
unsigned int *ret_height)
{
xQueryBestSizeReply rep;
register xQueryBestSizeReq *req;
LockDisplay(dpy);
GetReq(QueryBestSize, req);
req->class = TileShape;
req->drawable = drawable;
req->width = width;
req->height = height;
if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
UnlockDisplay(dpy);
SyncHandle();
return(0);
}
*ret_width = rep.width;
*ret_height = rep.height;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
Status XQueryTree (
register Display *dpy,
Window w,
Window *root, /* RETURN */
Window *parent, /* RETURN */
Window **children, /* RETURN */
unsigned int *nchildren) /* RETURN */
{
unsigned long nbytes;
xQueryTreeReply rep;
register xResourceReq *req;
LockDisplay(dpy);
GetResReq(QueryTree, w, req);
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return (0);
}
*children = (Window *) NULL;
if (rep.nChildren != 0) {
nbytes = rep.nChildren * sizeof(Window);
*children = Xmalloc(nbytes);
if (! *children) {
_XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
return (0);
}
nbytes = rep.nChildren << 2;
_XRead32 (dpy, (long *) *children, nbytes);
}
*parent = rep.parent;
*root = rep.root;
*nchildren = rep.nChildren;
UnlockDisplay(dpy);
SyncHandle();
return (1);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XRaiseWindow (
register Display *dpy,
Window w)
{
register xConfigureWindowReq *req;
unsigned long val = Above; /* needed for macro below */
LockDisplay(dpy);
GetReqExtra(ConfigureWindow, 4, req);
req->window = w;
req->mask = CWStackMode;
OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
/*
* Code to read bitmaps from disk files. Interprets
* data from X10 and X11 bitmap files and creates
* Pixmap representations of files. Returns Pixmap
* ID and specifics about image.
*
* Modified for speedup by Jim Becker, changed image
* data parsing logic (removed some fscanf()s).
* Aug 5, 1988
*
* Note that this file and ../Xmu/RdBitF.c look very similar.... Keep them
* that way (but don't use common source code so that people can have one
* without the other).
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include <nx-X11/Xos.h>
#include "Xutil.h"
#include <stdio.h>
#include <ctype.h>
#define MAX_SIZE 255
/* shared data for the image read/parse logic */
static const short hexTable[256] = {
['0'] = 0, ['1'] = 1,
['2'] = 2, ['3'] = 3,
['4'] = 4, ['5'] = 5,
['6'] = 6, ['7'] = 7,
['8'] = 8, ['9'] = 9,
['A'] = 10, ['B'] = 11,
['C'] = 12, ['D'] = 13,
['E'] = 14, ['F'] = 15,
['a'] = 10, ['b'] = 11,
['c'] = 12, ['d'] = 13,
['e'] = 14, ['f'] = 15,
[' '] = -1, [','] = -1,
['}'] = -1, ['\n'] = -1,
['\t'] = -1
};
/*
* read next hex value in the input stream, return -1 if EOF
*/
static int
NextInt (
FILE *fstream)
{
int ch;
int value = 0;
int gotone = 0;
int done = 0;
/* loop, accumulate hex value until find delimiter */
/* skip any initial delimiters found in read stream */
while (!done) {
ch = getc(fstream);
if (ch == EOF) {
value = -1;
done++;
} else {
/* trim high bits, check type and accumulate */
ch &= 0xff;
if (isascii(ch) && isxdigit(ch)) {
value = (value << 4) + hexTable[ch];
gotone++;
} else if ((hexTable[ch]) < 0 && gotone)
done++;
}
}
return value;
}
int
XReadBitmapFileData (
_Xconst char *filename,
unsigned int *width, /* RETURNED */
unsigned int *height, /* RETURNED */
unsigned char **data, /* RETURNED */
int *x_hot, /* RETURNED */
int *y_hot) /* RETURNED */
{
FILE *fstream; /* handle on file */
unsigned char *bits = NULL; /* working variable */
char line[MAX_SIZE]; /* input line from file */
int size; /* number of bytes of data */
char name_and_type[MAX_SIZE]; /* an input line */
char *type; /* for parsing */
int value; /* from an input line */
int version10p; /* boolean, old format */
int padding; /* to handle alignment */
int bytes_per_line; /* per scanline of data */
unsigned int ww = 0; /* width */
unsigned int hh = 0; /* height */
int hx = -1; /* x hotspot */
int hy = -1; /* y hotspot */
if (!(fstream = fopen(filename, "r")))
return BitmapOpenFailed;
/* error cleanup and return macro */
#define RETURN(code) \
{ Xfree (bits); fclose (fstream); return code; }
while (fgets(line, MAX_SIZE, fstream)) {
if (strlen(line) == MAX_SIZE-1)
RETURN (BitmapFileInvalid);
if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) {
if (!(type = strrchr(name_and_type, '_')))
type = name_and_type;
else
type++;
if (!strcmp("width", type))
ww = (unsigned int) value;
if (!strcmp("height", type))
hh = (unsigned int) value;
if (!strcmp("hot", type)) {
if (type-- == name_and_type || type-- == name_and_type)
continue;
if (!strcmp("x_hot", type))
hx = value;
if (!strcmp("y_hot", type))
hy = value;
}
continue;
}
if (sscanf(line, "static short %s = {", name_and_type) == 1)
version10p = 1;
else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
version10p = 0;
else if (sscanf(line, "static char %s = {", name_and_type) == 1)
version10p = 0;
else
continue;
if (!(type = strrchr(name_and_type, '_')))
type = name_and_type;
else
type++;
if (strcmp("bits[]", type))
continue;
if (!ww || !hh)
RETURN (BitmapFileInvalid);
if ((ww % 16) && ((ww % 16) < 9) && version10p)
padding = 1;
else
padding = 0;
bytes_per_line = (ww+7)/8 + padding;
size = bytes_per_line * hh;
bits = Xmalloc (size);
if (!bits)
RETURN (BitmapNoMemory);
if (version10p) {
unsigned char *ptr;
int bytes;
for (bytes=0, ptr=bits; bytes<size; (bytes += 2)) {
if ((value = NextInt(fstream)) < 0)
RETURN (BitmapFileInvalid);
*(ptr++) = value;
if (!padding || ((bytes+2) % bytes_per_line))
*(ptr++) = value >> 8;
}
} else {
unsigned char *ptr;
int bytes;
for (bytes=0, ptr=bits; bytes<size; bytes++, ptr++) {
if ((value = NextInt(fstream)) < 0)
RETURN (BitmapFileInvalid);
*ptr=value;
}
}
/* If we got to this point, we read a full bitmap file. Break so we don't
* start reading another one from the same file and leak the memory
* allocated for the previous one. */
break;
} /* end while */
fclose(fstream);
if (!bits)
return (BitmapFileInvalid);
*data = bits;
*width = ww;
*height = hh;
if (x_hot) *x_hot = hx;
if (y_hot) *y_hot = hy;
return (BitmapSuccess);
}
int
XReadBitmapFile (
Display *display,
Drawable d,
_Xconst char *filename,
unsigned int *width, /* RETURNED */
unsigned int *height, /* RETURNED */
Pixmap *pixmap, /* RETURNED */
int *x_hot, /* RETURNED */
int *y_hot) /* RETURNED */
{
unsigned char *data;
int res;
res = XReadBitmapFileData(filename, width, height, &data, x_hot, y_hot);
if (res != BitmapSuccess)
return res;
*pixmap = XCreateBitmapFromData(display, d, (char *)data, *width, *height);
Xfree(data);
if (*pixmap == None)
return (BitmapNoMemory);
return (BitmapSuccess);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XRecolorCursor(
register Display *dpy,
Cursor cursor,
XColor *foreground,
XColor *background)
{
register xRecolorCursorReq *req;
LockDisplay(dpy);
GetReq(RecolorCursor, req);
req->cursor = cursor;
req->foreRed = foreground->red;
req->foreGreen = foreground->green;
req->foreBlue = foreground->blue;
req->backRed = background->red;
req->backGreen = background->green;
req->backBlue = background->blue;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\
CWBorderWidth|CWSibling|CWStackMode)
Status XReconfigureWMWindow (
register Display *dpy,
Window w,
int screen,
unsigned int mask,
XWindowChanges *changes)
{
Window root = RootWindow (dpy, screen);
_XAsyncHandler async;
_XAsyncErrorState async_state;
/*
* Only need to go through the trouble if we are actually changing the
* stacking mode.
*/
if (!(mask & CWStackMode)) {
XConfigureWindow (dpy, w, mask, changes);
return True;
}
/*
* We need to inline XConfigureWindow and XSync so that everything is done
* while the display is locked.
*/
LockDisplay(dpy);
/*
* XConfigureWindow (dpy, w, mask, changes);
*/
{
unsigned long values[7];
register unsigned long *value = values;
long nvalues;
register xConfigureWindowReq *req;
GetReq(ConfigureWindow, req);
async_state.min_sequence_number = dpy->request;
async_state.max_sequence_number = dpy->request;
async_state.error_code = BadMatch;
async_state.major_opcode = X_ConfigureWindow;
async_state.minor_opcode = 0;
async_state.error_count = 0;
async.next = dpy->async_handlers;
async.handler = _XAsyncErrorHandler;
async.data = (XPointer)&async_state;
dpy->async_handlers = &async;
req->window = w;
mask &= AllMaskBits;
req->mask = mask;
if (mask & CWX) *value++ = changes->x;
if (mask & CWY) *value++ = changes->y;
if (mask & CWWidth) *value++ = changes->width;
if (mask & CWHeight) *value++ = changes->height;
if (mask & CWBorderWidth) *value++ = changes->border_width;
if (mask & CWSibling) *value++ = changes->sibling;
if (mask & CWStackMode) *value++ = changes->stack_mode;
req->length += (nvalues = value - values);
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, nvalues);
}
/*
* XSync (dpy, 0)
*/
{
xGetInputFocusReply rep;
_X_UNUSED register xReq *req;
GetEmptyReq(GetInputFocus, req);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
}
DeqAsyncHandler(dpy, &async);
UnlockDisplay(dpy);
SyncHandle();
/*
* If the request succeeded, then everything is okay; otherwise, send event
*/
if (!async_state.error_count)
return True;
else {
XConfigureRequestEvent ev = {
.type = ConfigureRequest,
.window = w,
.parent = root,
.value_mask = (mask & AllMaskBits),
.x = changes->x,
.y = changes->y,
.width = changes->width,
.height = changes->height,
.border_width = changes->border_width,
.above = changes->sibling,
.detail = changes->stack_mode,
};
return (XSendEvent (dpy, root, False,
SubstructureRedirectMask|SubstructureNotifyMask,
(XEvent *)&ev));
}
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\
CWBorderWidth|CWSibling|CWStackMode)
int
XConfigureWindow(
register Display *dpy,
Window w,
unsigned int mask,
XWindowChanges *changes)
{
unsigned long values[7];
register unsigned long *value = values;
long nvalues;
register xConfigureWindowReq *req;
LockDisplay(dpy);
GetReq(ConfigureWindow, req);
req->window = w;
mask &= AllMaskBits;
req->mask = mask;
if (mask & CWX)
*value++ = changes->x;
if (mask & CWY)
*value++ = changes->y;
if (mask & CWWidth)
*value++ = changes->width;
if (mask & CWHeight)
*value++ = changes->height;
if (mask & CWBorderWidth)
*value++ = changes->border_width;
if (mask & CWSibling)
*value++ = changes->sibling;
if (mask & CWStackMode)
*value++ = changes->stack_mode;
req->length += (nvalues = value - values);
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, nvalues);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Copyright 1990, 1991 by OMRON Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name OMRON not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. OMRON makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Author: Seiji Kuwari OMRON Corporation
* kuwa@omron.co.jp
* kuwa%omron.co.jp@uunet.uu.net
*/
/*
Copyright 1990, 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xlcint.h"
static void
_XFreeIMFilters(
Display *display)
{
register XFilterEventList fl;
while ((fl = display->im_filters)) {
display->im_filters = fl->next;
Xfree(fl);
}
}
/*
* Register a filter with the filter machinery by event mask.
*/
void
_XRegisterFilterByMask(
Display *display,
Window window,
unsigned long event_mask,
Bool (*filter)(
Display*, Window, XEvent*, XPointer
),
XPointer client_data)
{
XFilterEventRec *rec;
rec = Xmalloc(sizeof(XFilterEventRec));
if (!rec)
return;
rec->window = window;
rec->event_mask = event_mask;
rec->start_type = 0;
rec->end_type = 0;
rec->filter = filter;
rec->client_data = client_data;
LockDisplay(display);
rec->next = display->im_filters;
display->im_filters = rec;
display->free_funcs->im_filters = _XFreeIMFilters;
UnlockDisplay(display);
}
/*
* Register a filter with the filter machinery by type code.
*/
void
_XRegisterFilterByType(
Display *display,
Window window,
int start_type,
int end_type,
Bool (*filter)(
Display*, Window, XEvent*, XPointer
),
XPointer client_data)
{
XFilterEventRec *rec;
rec = Xmalloc(sizeof(XFilterEventRec));
if (!rec)
return;
rec->window = window;
rec->event_mask = 0;
rec->start_type = start_type;
rec->end_type = end_type;
rec->filter = filter;
rec->client_data = client_data;
LockDisplay(display);
rec->next = display->im_filters;
display->im_filters = rec;
display->free_funcs->im_filters = _XFreeIMFilters;
UnlockDisplay(display);
}
void
_XUnregisterFilter(
Display *display,
Window window,
Bool (*filter)(
Display*, Window, XEvent*, XPointer
),
XPointer client_data)
{
register XFilterEventList *prev, fl;
for (prev = &display->im_filters; (fl = *prev); ) {
if (fl->window == window &&
fl->filter == filter && fl->client_data == client_data) {
*prev = fl->next;
Xfree(fl);
} else
prev = &fl->next;
}
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XReparentWindow(
register Display *dpy,
Window w,
Window p,
int x,
int y)
{
register xReparentWindowReq *req;
LockDisplay(dpy);
GetReq(ReparentWindow, req);
req->window = w;
req->parent = p;
req->x = x;
req->y = y;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XRestackWindows (
register Display *dpy,
register Window *windows,
int n)
{
int i = 0;
LockDisplay(dpy);
while (windows++, ++i < n) {
register xConfigureWindowReq *req;
GetReqExtra (ConfigureWindow, 8, req);
req->window = *windows;
req->mask = CWSibling | CWStackMode;
{
register CARD32 *values = (CARD32 *)
NEXTPTR(req,xConfigureWindowReq);
*values++ = *(windows-1);
*values = Below;
}
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XRotateWindowProperties(
register Display *dpy,
Window w,
Atom *properties,
register int nprops,
int npositions)
{
register long nbytes;
register xRotatePropertiesReq *req;
LockDisplay(dpy);
GetReq (RotateProperties, req);
req->window = w;
req->nAtoms = nprops;
req->nPositions = npositions;
req->length += nprops;
nbytes = nprops << 2;
/* XXX Cray needs packing here.... */
Data32 (dpy, (long *) properties, nbytes);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include <nx-X11/Xatom.h>
char *XScreenResourceString(Screen *screen)
{
Atom prop_name;
Atom actual_type;
int actual_format;
unsigned long nitems;
unsigned long leftover;
char *val = NULL;
prop_name = XInternAtom(screen->display, "SCREEN_RESOURCES", True);
if (prop_name &&
XGetWindowProperty(screen->display, screen->root, prop_name,
0L, 100000000L, False,
XA_STRING, &actual_type, &actual_format,
&nitems, &leftover,
(unsigned char **) &val) == Success) {
if ((actual_type == XA_STRING) && (actual_format == 8))
return val;
Xfree(val);
}
return (char *)NULL;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSelectInput (
register Display *dpy,
Window w,
long mask)
{
register xChangeWindowAttributesReq *req;
LockDisplay(dpy);
GetReqExtra (ChangeWindowAttributes, 4, req);
req->window = w;
req->valueMask = CWEventMask;
OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), mask);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
/*
* In order to avoid all images requiring _XEventToWire, we install the
* event converter here if it has never been installed.
*/
Status
XSendEvent(
register Display *dpy,
Window w,
Bool propagate,
long event_mask,
XEvent *event)
{
register xSendEventReq *req;
xEvent ev;
register Status (**fp)(
Display * /* dpy */,
XEvent * /* re */,
xEvent * /* event */);
Status status;
/* initialize all of the event's fields first, before setting
* the meaningful ones later.
*/
memset (&ev, 0, sizeof (ev));
LockDisplay (dpy);
/* call through display to find proper conversion routine */
fp = &dpy->wire_vec[event->type & 0177];
if (*fp == NULL) *fp = _XEventToWire;
status = (**fp)(dpy, event, &ev);
if (status) {
GetReq(SendEvent, req);
req->destination = w;
req->propagate = propagate;
req->eventMask = event_mask;
req->event = ev;
}
UnlockDisplay(dpy);
SyncHandle();
return(status);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetBackground (
register Display *dpy,
GC gc,
unsigned long background) /* CARD32 */
{
LockDisplay(dpy);
if (gc->values.background != background) {
gc->values.background = background;
gc->dirty |= GCBackground;
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsSetCCC.c - Color Conversion Context Setting Routines
*
* DESCRIPTION
* Routines to set components of a Color Conversion
* Context structure.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcms.h"
/************************************************************************
* *
* PUBLIC INTERFACES *
* *
************************************************************************/
/*
* NAME
* XcmsSetWhitePoint
*
* SYNOPSIS
*/
Status
XcmsSetWhitePoint(
XcmsCCC ccc,
XcmsColor *pColor)
/*
* DESCRIPTION
* Sets the Client White Point in the specified CCC.
*
* RETURNS
* Returns XcmsSuccess if succeeded; otherwise XcmsFailure.
*
*/
{
if (pColor == NULL || pColor->format == XcmsUndefinedFormat) {
ccc->clientWhitePt.format = XcmsUndefinedFormat;
} else if (pColor->format != XcmsCIEXYZFormat &&
pColor->format != XcmsCIEuvYFormat &&
pColor->format != XcmsCIExyYFormat) {
return(XcmsFailure);
} else {
memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor));
}
return(XcmsSuccess);
}
/*
* NAME
* XcmsSetCompressionProc
*
* SYNOPSIS
*/
XcmsCompressionProc
XcmsSetCompressionProc(
XcmsCCC ccc,
XcmsCompressionProc compression_proc,
XPointer client_data)
/*
* DESCRIPTION
* Set the specified CCC's compression function and client data.
*
* RETURNS
* Returns the old compression function.
*
*/
{
XcmsCompressionProc old = ccc->gamutCompProc;
ccc->gamutCompProc = compression_proc;
ccc->gamutCompClientData = client_data;
return(old);
}
/*
* NAME
* XcmsSetWhiteAdjustProc
*
* SYNOPSIS
*/
XcmsWhiteAdjustProc
XcmsSetWhiteAdjustProc(
XcmsCCC ccc,
XcmsWhiteAdjustProc white_adjust_proc,
XPointer client_data )
/*
* DESCRIPTION
* Set the specified CCC's white_adjust function and client data.
*
* RETURNS
* Returns the old white_adjust function.
*
*/
{
XcmsWhiteAdjustProc old = ccc->whitePtAdjProc;
ccc->whitePtAdjProc = white_adjust_proc;
ccc->whitePtAdjClientData = client_data;
return(old);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
/* can only call when display is locked. */
void _XSetClipRectangles (
register Display *dpy,
GC gc,
int clip_x_origin, int clip_y_origin,
XRectangle *rectangles,
int n,
int ordering)
{
register xSetClipRectanglesReq *req;
register long len;
unsigned long dirty;
register _XExtension *ext;
GetReq (SetClipRectangles, req);
req->gc = gc->gid;
req->xOrigin = gc->values.clip_x_origin = clip_x_origin;
req->yOrigin = gc->values.clip_y_origin = clip_y_origin;
req->ordering = ordering;
len = ((long)n) << 1;
SetReqLen(req, len, 1);
len <<= 2;
Data16 (dpy, (short *) rectangles, len);
gc->rects = 1;
dirty = gc->dirty & ~(GCClipMask | GCClipXOrigin | GCClipYOrigin);
gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin;
/* call out to any extensions interested */
for (ext = dpy->ext_procs; ext; ext = ext->next)
if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes);
gc->dirty = dirty;
}
int
XSetClipRectangles (
register Display *dpy,
GC gc,
int clip_x_origin,
int clip_y_origin,
XRectangle *rectangles,
int n,
int ordering)
{
LockDisplay(dpy);
_XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n,
ordering);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetClipMask (
register Display *dpy,
GC gc,
Pixmap mask)
{
LockDisplay(dpy);
/* always update, since client may have changed pixmap contents */
gc->values.clip_mask = mask;
gc->dirty |= GCClipMask;
gc->rects = 0;
_XFlushGCCache(dpy, gc);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetClipOrigin (
register Display *dpy,
GC gc,
int xorig,
int yorig)
{
XGCValues *gv = &gc->values;
LockDisplay(dpy);
if (xorig != gv->clip_x_origin) {
gv->clip_x_origin = xorig;
gc->dirty |= GCClipXOrigin;
}
if (yorig != gv->clip_y_origin) {
gv->clip_y_origin = yorig;
gc->dirty |= GCClipYOrigin;
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetDashes (
register Display *dpy,
GC gc,
int dash_offset,
_Xconst char *list,
int n)
{
register xSetDashesReq *req;
LockDisplay(dpy);
GetReq (SetDashes,req);
req->gc = gc->gid;
req->dashOffset = gc->values.dash_offset = dash_offset;
req->nDashes = n;
req->length += (n+3)>>2;
gc->dashes = 1;
gc->dirty &= ~(GCDashList | GCDashOffset);
Data (dpy, list, (long)n);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#define safestrlen(s) ((s) ? strlen(s) : 0)
int
XSetFontPath (
register Display *dpy,
char **directories,
int ndirs)
{
register int n = 0;
register int i;
register int nbytes;
char *p;
register xSetFontPathReq *req;
int retCode;
LockDisplay(dpy);
GetReq (SetFontPath, req);
req->nFonts = ndirs;
for (i = 0; i < ndirs; i++) {
n += safestrlen (directories[i]) + 1;
}
nbytes = (n + 3) & ~3;
req->length += nbytes >> 2;
if ((p = Xmalloc (nbytes))) {
/*
* pack into counted strings.
*/
char *tmp = p;
for (i = 0; i < ndirs; i++) {
register int length = safestrlen (directories[i]);
*p = length;
memcpy (p + 1, directories[i], length);
p += length + 1;
}
Data (dpy, tmp, nbytes);
Xfree (tmp);
retCode = 1;
}
else
retCode = 0;
UnlockDisplay(dpy);
SyncHandle();
return (retCode);
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetFont (
register Display *dpy,
GC gc,
Font font)
{
LockDisplay(dpy);
if (gc->values.font != font) {
gc->values.font = font;
gc->dirty |= GCFont;
_XFlushGCCache(dpy, gc);
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetForeground (
register Display *dpy,
GC gc,
unsigned long foreground) /* CARD32 */
{
LockDisplay(dpy);
if (gc->values.foreground != foreground) {
gc->values.foreground = foreground;
gc->dirty |= GCForeground;
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
Copyright 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
int
XSetFunction (
register Display *dpy,
GC gc,
int function)
{
LockDisplay(dpy);
if (gc->values.function != function) {
gc->values.function = function;
gc->dirty |= GCFunction;
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
*
* NAME
* XcmsSetGet.c
*
* DESCRIPTION
* Source for _XcmsSetGetColors()
*
*
*/
/*
* EXTERNAL INCLUDES
* Include files that must be exported to any package or
* program using this package.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
/************************************************************************
* *
* API PRIVATE ROUTINES *
* *
************************************************************************/
/*
* NAME
* XcmsSetColor -
*
* SYNOPSIS
*/
Status
_XcmsSetGetColor(
Status (*xColorProc)(
Display* /* display */,
Colormap /* colormap */,
XColor* /* screen_in_out */),
Display *dpy,
Colormap cmap,
XcmsColor *pColors_in_out,
XcmsColorFormat result_format,
Bool *pCompressed)
/*
* DESCRIPTION
* Routine containing code common to:
* XcmsAllocColor
* XcmsQueryColor
* XcmsStoreColor
*
* RETURNS
* XcmsFailure if failed;
* XcmsSuccess if it succeeded without gamut compression;
* XcmsSuccessWithCompression if it succeeded with gamut
* compression;
*/
{
XcmsCCC ccc;
XColor XColors_in_out;
Status retval = XcmsSuccess;
/*
* Argument Checking
* 1. Assume xColorProc is correct
* 2. Insure ccc not NULL
* 3. Assume cmap correct (should be checked by Server)
* 4. Insure pColors_in_out valid
* 5. Assume method_in is valid (should be checked by Server)
*/
if (dpy == NULL) {
return(XcmsFailure);
}
if (result_format == XcmsUndefinedFormat) {
return(XcmsFailure);
}
if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor)
|| (*xColorProc == XQueryColor)) ) {
return(XcmsFailure);
}
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) {
return(XcmsFailure);
}
if (*xColorProc == XQueryColor) {
goto Query;
}
/*
* Convert to RGB, adjusting for white point differences if necessary.
*/
if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat,
pCompressed)) == XcmsFailure) {
return(XcmsFailure);
}
Query:
/*
* Convert XcmsColor to XColor structures
*/
_XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1);
/*
* Now make appropriate X Call
*/
if (*xColorProc == XAllocColor) {
if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) {
return(XcmsFailure);
}
} else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) {
/* Note: XQueryColor and XStoreColor do not return any Status */
(*xColorProc)(ccc->dpy, cmap, &XColors_in_out);
} else {
return(XcmsFailure);
}
if ((*xColorProc == XStoreColor)) {
return(retval);
}
/*
* Now, convert the returned XColor (i.e., rgb) to XcmsColor structures
*/
_XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1);
/*
* Then, convert XcmsColor structures to the original specification
* format. Note that we must use NULL instead of passing
* pCompressed.
*/
if (result_format != XcmsRGBFormat) {
if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format,
(Bool *) NULL) == XcmsFailure) {
return(XcmsFailure);
}
}
return(retval);
}
/*
* NAME
* XcmsSetColors -
*
* SYNOPSIS
*/
Status
_XcmsSetGetColors(
Status (*xColorProc)(
Display* /* display */,
Colormap /* colormap */,
XColor* /* screen_in_out */,
int /* nColors */),
Display *dpy,
Colormap cmap,
XcmsColor *pColors_in_out,
int nColors,
XcmsColorFormat result_format,
Bool *pCompressed)
/*
* DESCRIPTION
* Routine containing code common to:
* XcmsQueryColors
* XcmsStoreColors
*
* RETURNS
* XcmsFailure if failed;
* XcmsSuccess if it succeeded without gamut compression;
* XcmsSuccessWithCompression if it succeeded with gamut
* compression;
*/
{
XcmsCCC ccc;
XColor *pXColors_in_out;
Status retval = XcmsSuccess;
/*
* Argument Checking
* 1. Assume xColorProc is correct
* 2. Insure ccc not NULL
* 3. Assume cmap correct (should be checked by Server)
* 4. Insure pColors_in_out valid
* 5. Assume method_in is valid (should be checked by Server)
* 6. Insure nColors > 0
*/
if (dpy == NULL) {
return(XcmsFailure);
}
if (nColors == 0) {
return(XcmsSuccess);
}
if (result_format == XcmsUndefinedFormat) {
return(XcmsFailure);
}
if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) {
return(XcmsFailure);
}
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) {
return(XcmsFailure);
}
/*
* Allocate space for XColors
*/
if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) ==
NULL) {
return(XcmsFailure);
}
if (*xColorProc == XQueryColors) {
goto Query;
}
/*
* Convert to RGB, adjusting for white point differences if necessary.
*/
if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat,
pCompressed)) == XcmsFailure) {
Xfree(pXColors_in_out);
return(XcmsFailure);
}
Query:
/*
* Convert XcmsColor to XColor structures
*/
_XcmsRGB_to_XColor(pColors_in_out, pXColors_in_out, nColors);
/*
* Now make appropriate X Call
*/
if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){
/* Note: XQueryColors and XStoreColors do not return any Status */
(*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors);
} else {
Xfree(pXColors_in_out);
return(XcmsFailure);
}
if (*xColorProc == XStoreColors) {
Xfree(pXColors_in_out);
return(retval);
}
/*
* Now, convert the returned XColor (i.e., rgb) to XcmsColor structures
*/
_XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors);
Xfree(pXColors_in_out);
/*
* Then, convert XcmsColor structures to the original specification
* format. Note that we must use NULL instead of passing
* pCompressed.
*/
if (result_format != XcmsRGBFormat) {
if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format,
(Bool *) NULL) == XcmsFailure) {
return(XcmsFailure);
}
}
return(retval);
}
/* ### EOF ### */
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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 name of The Open Group 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 Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xlibint.h>
#include <nx-X11/Xutil.h>
#include "Xatomtype.h"
#include <nx-X11/Xatom.h>
#include <nx-X11/Xos.h>
#define safestrlen(s) ((s) ? strlen(s) : 0)
int
XSetSizeHints( /* old routine */
Display *dpy,
Window w,
XSizeHints *hints,
Atom property)
{
xPropSizeHints prop;
memset(&prop, 0, sizeof(prop));
prop.flags = (hints->flags & (USPosition|USSize|PAllHints));
if (hints->flags & (USPosition|PPosition)) {
prop.x = hints->x;
prop.y = hints->y;
}
if (hints->flags & (USSize|PSize)) {
prop.width = hints->width;
prop.height = hints->height;
}
if (hints->flags & PMinSize) {
prop.minWidth = hints->min_width;
prop.minHeight = hints->min_height;
}
if (hints->flags & PMaxSize) {
prop.maxWidth = hints->max_width;
prop.maxHeight = hints->max_height;
}
if (hints->flags & PResizeInc) {
prop.widthInc = hints->width_inc;
prop.heightInc = hints->height_inc;
}
if (hints->flags & PAspect) {
prop.minAspectX = hints->min_aspect.x;
prop.minAspectY = hints->min_aspect.y;
prop.maxAspectX = hints->max_aspect.x;
prop.maxAspectY = hints->max_aspect.y;
}
return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32,
PropModeReplace, (unsigned char *) &prop,
OldNumPropSizeElements);
}
/*
* XSetWMHints sets the property
* WM_HINTS type: WM_HINTS format:32
*/
int
XSetWMHints (
Display *dpy,
Window w,
XWMHints *wmhints)
{
xPropWMHints prop;
memset(&prop, 0, sizeof(prop));
prop.flags = wmhints->flags;
if (wmhints->flags & InputHint)
prop.input = (wmhints->input == True ? 1 : 0);
if (wmhints->flags & StateHint)
prop.initialState = wmhints->initial_state;
if (wmhints->flags & IconPixmapHint)
prop.iconPixmap = wmhints->icon_pixmap;
if (wmhints->flags & IconWindowHint)
prop.iconWindow = wmhints->icon_window;
if (wmhints->flags & IconPositionHint) {
prop.iconX = wmhints->icon_x;
prop.iconY = wmhints->icon_y;
}
if (wmhints->flags & IconMaskHint)
prop.iconMask = wmhints->icon_mask;
if (wmhints->flags & WindowGroupHint)
prop.windowGroup = wmhints->window_group;
return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32,
PropModeReplace, (unsigned char *) &prop,
NumPropWMHintsElements);
}
/*
* XSetZoomHints sets the property
* WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32
*/
int
XSetZoomHints (
Display *dpy,
Window w,
XSizeHints *zhints)
{
return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS);
}
/*
* XSetNormalHints sets the property
* WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32
*/
int
XSetNormalHints ( /* old routine */
Display *dpy,
Window w,
XSizeHints *hints)
{
return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS);
}
/*
* Note, the following is one of the few cases were we really do want sizeof
* when examining a protocol structure. This is because the XChangeProperty
* routine will take care of converting to host to network data structures.
*/
int
XSetIconSizes (
Display *dpy,
Window w, /* typically, root */
XIconSize *list,
int count) /* number of items on the list */
{
register int i;
xPropIconSize *pp, *prop;
#define size_of_the_real_thing sizeof /* avoid grepping screwups */
unsigned nbytes = count * size_of_the_real_thing(xPropIconSize);
#undef size_of_the_real_thing
if ((prop = pp = Xmalloc (nbytes))) {
for (i = 0; i < count; i++) {
pp->minWidth = list->min_width;
pp->minHeight = list->min_height;
pp->maxWidth = list->max_width;
pp->maxHeight = list->max_height;
pp->widthInc = list->width_inc;
pp->heightInc = list->height_inc;
pp += 1;
list += 1;
}
XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32,
PropModeReplace, (unsigned char *) prop,
count * NumPropIconSizeElements);
Xfree (prop);
}
return 1;
}
int
XSetCommand (
Display *dpy,
Window w,
char **argv,
int argc)
{
register int i;
register int nbytes;
register char *buf, *bp;
for (i = 0, nbytes = 0; i < argc; i++) {
nbytes += safestrlen(argv[i]) + 1;
}
if ((bp = buf = Xmalloc(nbytes))) {
/* copy arguments into single buffer */
for (i = 0; i < argc; i++) {
if (argv[i]) {
(void) strcpy(bp, argv[i]);
bp += strlen(argv[i]) + 1;
}
else
*bp++ = '\0';
}
XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8,
PropModeReplace, (unsigned char *)buf, nbytes);
Xfree(buf);
}
return 1;
}
/*
* XSetStandardProperties sets the following properties:
* WM_NAME type: STRING format: 8
* WM_ICON_NAME type: STRING format: 8
* WM_HINTS type: WM_HINTS format: 32
* WM_COMMAND type: STRING
* WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32
*/
int
XSetStandardProperties (
Display *dpy,
Window w, /* window to decorate */
_Xconst char *name, /* name of application */
_Xconst char *icon_string,/* name string for icon */
Pixmap icon_pixmap, /* pixmap to use as icon, or None */
char **argv, /* command to be used to restart application */
int argc, /* count of arguments */
XSizeHints *hints) /* size hints for window in its normal state */
{
XWMHints phints;
phints.flags = 0;
if (name != NULL) XStoreName (dpy, w, name);
if (icon_string != NULL) {
XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8,
PropModeReplace,
(_Xconst unsigned char *)icon_string,
safestrlen(icon_string));
}
if (icon_pixmap != None) {
phints.icon_pixmap = icon_pixmap;
phints.flags |= IconPixmapHint;
}
if (argv != NULL) XSetCommand(dpy, w, argv, argc);
if (hints != NULL) XSetNormalHints(dpy, w, hints);
if (phints.flags != 0) XSetWMHints(dpy, w, &phints);
return 1;
}
int
XSetTransientForHint(
Display *dpy,
Window w,
Window propWindow)
{
return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32,
PropModeReplace, (unsigned char *) &propWindow, 1);
}
int
XSetClassHint(
Display *dpy,
Window w,
XClassHint *classhint)
{
char *class_string;
char *s;
int len_nm, len_cl;
len_nm = safestrlen(classhint->res_name);
len_cl = safestrlen(classhint->res_class);
if ((class_string = s = Xmalloc(len_nm + len_cl + 2))) {
if (len_nm) {
strcpy(s, classhint->res_name);
s += len_nm + 1;
}
else
*s++ = '\0';
if (len_cl)
strcpy(s, classhint->res_class);
else
*s = '\0';
XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8,
PropModeReplace, (unsigned char *) class_string,
len_nm+len_cl+2);
Xfree(class_string);
}
return 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment