Unverified Commit e91d08cb authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/various4' into 3.6.x

parents 424c0e8e c69d2ad0
...@@ -28,12 +28,10 @@ This source tree is maintained on Github: ...@@ -28,12 +28,10 @@ This source tree is maintained on Github:
https://github.com/ArcticaProject/nx-libs (3.6.x branch) https://github.com/ArcticaProject/nx-libs (3.6.x branch)
For the the post-NoMachine era of nx-libs, we will focus on two release For the the post-NoMachine era of nx-libs, we will focus on two release
phases for the upcoming two years (06/2015 - 06/2017). phases for the upcoming two years.
## Release series 3.6.0.x ## Release series 3.6.0.x
Scheduled for end of Q2/2016.
Release goals (phase 1) for nx-libs release series 3.6.0.x: Release goals (phase 1) for nx-libs release series 3.6.0.x:
* CVE security audit (complete) * CVE security audit (complete)
...@@ -56,8 +54,6 @@ Release goals (phase 1) for nx-libs release series 3.6.0.x: ...@@ -56,8 +54,6 @@ Release goals (phase 1) for nx-libs release series 3.6.0.x:
## Release series 3.7.0.x ## Release series 3.7.0.x
Scheduled for end of Q2/2017.
Release goals (phase 2) for nx-libs release series 3.7.0.x (not branched-off, yet): Release goals (phase 2) for nx-libs release series 3.7.0.x (not branched-off, yet):
* rebase Xserver code against latest X.Org server (work in progress) * rebase Xserver code against latest X.Org server (work in progress)
......
...@@ -713,9 +713,7 @@ Copyright: 1999-2001, Brian Paul ...@@ -713,9 +713,7 @@ Copyright: 1999-2001, Brian Paul
2005, Brian Paul 2005, Brian Paul
License: Expat License: Expat
Files: nx-X11/include/XWDFile.h Files: nx-X11/include/Xauth.h
nx-X11/include/Xalloca.h
nx-X11/include/Xauth.h
nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncproto.h
nx-X11/include/Xfuncs.h nx-X11/include/Xfuncs.h
nx-X11/include/Xos.h nx-X11/include/Xos.h
...@@ -1337,7 +1335,6 @@ Files: nx-X11/include/DECkeysym.h ...@@ -1337,7 +1335,6 @@ Files: nx-X11/include/DECkeysym.h
nx-X11/programs/Xserver/include/region.h nx-X11/programs/Xserver/include/region.h
nx-X11/programs/Xserver/include/regionstr.h nx-X11/programs/Xserver/include/regionstr.h
nx-X11/programs/Xserver/include/resource.h nx-X11/programs/Xserver/include/resource.h
nx-X11/programs/Xserver/include/rgb.h
nx-X11/programs/Xserver/include/screenint.h nx-X11/programs/Xserver/include/screenint.h
nx-X11/programs/Xserver/include/scrnintstr.h nx-X11/programs/Xserver/include/scrnintstr.h
nx-X11/programs/Xserver/include/selection.h nx-X11/programs/Xserver/include/selection.h
...@@ -1478,10 +1475,8 @@ License: MIT~X11 ...@@ -1478,10 +1475,8 @@ License: MIT~X11
Files: nx-X11/include/extensions/XKB.h Files: nx-X11/include/extensions/XKB.h
nx-X11/include/extensions/XKBconfig.h nx-X11/include/extensions/XKBconfig.h
nx-X11/include/extensions/XKBfile.h
nx-X11/include/extensions/XKBgeom.h nx-X11/include/extensions/XKBgeom.h
nx-X11/include/extensions/XKBproto.h nx-X11/include/extensions/XKBproto.h
nx-X11/include/extensions/XKBrules.h
nx-X11/include/extensions/XKBsrv.h nx-X11/include/extensions/XKBsrv.h
nx-X11/include/extensions/XKBstr.h nx-X11/include/extensions/XKBstr.h
nx-X11/include/extensions/XKM.h nx-X11/include/extensions/XKM.h
...@@ -2187,7 +2182,6 @@ License: Expat ...@@ -2187,7 +2182,6 @@ License: Expat
Files: nx-X11/include/extensions/saver.h Files: nx-X11/include/extensions/saver.h
nx-X11/include/extensions/saverproto.h nx-X11/include/extensions/saverproto.h
nx-X11/include/extensions/scrnsaver.h
nx-X11/programs/Xserver/Xext/saver.c nx-X11/programs/Xserver/Xext/saver.c
Copyright: 1992, X Consortium Copyright: 1992, X Consortium
License: Expat~NoAdvert License: Expat~NoAdvert
......
...@@ -7,8 +7,6 @@ Disclaimer: Autogenerated by CDBS ...@@ -7,8 +7,6 @@ Disclaimer: Autogenerated by CDBS
Files: nx-X11/include/DECkeysym.h Files: nx-X11/include/DECkeysym.h
nx-X11/include/HPkeysym.h nx-X11/include/HPkeysym.h
nx-X11/include/X.h nx-X11/include/X.h
nx-X11/include/XWDFile.h
nx-X11/include/Xalloca.h
nx-X11/include/Xauth.h nx-X11/include/Xauth.h
nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncproto.h
nx-X11/include/Xfuncs.h nx-X11/include/Xfuncs.h
...@@ -381,7 +379,6 @@ Files: nx-X11/include/DECkeysym.h ...@@ -381,7 +379,6 @@ Files: nx-X11/include/DECkeysym.h
nx-X11/programs/Xserver/include/region.h nx-X11/programs/Xserver/include/region.h
nx-X11/programs/Xserver/include/regionstr.h nx-X11/programs/Xserver/include/regionstr.h
nx-X11/programs/Xserver/include/resource.h nx-X11/programs/Xserver/include/resource.h
nx-X11/programs/Xserver/include/rgb.h
nx-X11/programs/Xserver/include/screenint.h nx-X11/programs/Xserver/include/screenint.h
nx-X11/programs/Xserver/include/scrnintstr.h nx-X11/programs/Xserver/include/scrnintstr.h
nx-X11/programs/Xserver/include/selection.h nx-X11/programs/Xserver/include/selection.h
...@@ -1517,10 +1514,8 @@ License: NTP (legal disclaimer) ...@@ -1517,10 +1514,8 @@ License: NTP (legal disclaimer)
Files: nx-X11/include/extensions/XKB.h Files: nx-X11/include/extensions/XKB.h
nx-X11/include/extensions/XKBconfig.h nx-X11/include/extensions/XKBconfig.h
nx-X11/include/extensions/XKBfile.h
nx-X11/include/extensions/XKBgeom.h nx-X11/include/extensions/XKBgeom.h
nx-X11/include/extensions/XKBproto.h nx-X11/include/extensions/XKBproto.h
nx-X11/include/extensions/XKBrules.h
nx-X11/include/extensions/XKBsrv.h nx-X11/include/extensions/XKBsrv.h
nx-X11/include/extensions/XKBstr.h nx-X11/include/extensions/XKBstr.h
nx-X11/include/extensions/XKM.h nx-X11/include/extensions/XKM.h
...@@ -2116,7 +2111,6 @@ License: GENERATED FILE ...@@ -2116,7 +2111,6 @@ License: GENERATED FILE
Files: nx-X11/include/extensions/saver.h Files: nx-X11/include/extensions/saver.h
nx-X11/include/extensions/saverproto.h nx-X11/include/extensions/saverproto.h
nx-X11/include/extensions/scrnsaver.h
nx-X11/programs/Xserver/Xext/saver.c nx-X11/programs/Xserver/Xext/saver.c
Copyright: 1992, X Consortium Copyright: 1992, X Consortium
License: MIT/X11 (BSD like) License: MIT/X11 (BSD like)
......
...@@ -3,8 +3,6 @@ usr/include/*/nx-X11/HPkeysym.h ...@@ -3,8 +3,6 @@ usr/include/*/nx-X11/HPkeysym.h
usr/include/*/nx-X11/Sunkeysym.h usr/include/*/nx-X11/Sunkeysym.h
usr/include/*/nx-X11/X.h usr/include/*/nx-X11/X.h
usr/include/*/nx-X11/XF86keysym.h usr/include/*/nx-X11/XF86keysym.h
usr/include/*/nx-X11/XWDFile.h
usr/include/*/nx-X11/Xalloca.h
usr/include/*/nx-X11/Xarch.h usr/include/*/nx-X11/Xarch.h
usr/include/*/nx-X11/Xatom.h usr/include/*/nx-X11/Xatom.h
usr/include/*/nx-X11/Xdefs.h usr/include/*/nx-X11/Xdefs.h
......
usr/include/*/nx-X11/extensions/saver.h usr/include/*/nx-X11/extensions/saver.h
usr/include/*/nx-X11/extensions/saverproto.h usr/include/*/nx-X11/extensions/saverproto.h
usr/include/*/nx-X11/extensions/scrnsaver.h
...@@ -23,8 +23,6 @@ HEADERS = \ ...@@ -23,8 +23,6 @@ HEADERS = \
Sunkeysym.h \ Sunkeysym.h \
X.h \ X.h \
XF86keysym.h \ XF86keysym.h \
XWDFile.h \
Xalloca.h \
Xarch.h \ Xarch.h \
Xatom.h \ Xatom.h \
Xdefs.h \ Xdefs.h \
...@@ -59,7 +57,6 @@ MakeSubdirs($(SUBDIRS)) ...@@ -59,7 +57,6 @@ MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
InstallDriverSDKNonExecFile(X.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(X.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xalloca.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xarch.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xarch.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)/X11) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)/X11)
......
/*
Copyright 1985, 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.
*/
/*
* XWDFile.h MIT Project Athena, X Window system window raster
* image dumper, dump file format header file.
*
* Author: Tony Della Fera, DEC
* 27-Jun-85
*
* Modifier: William F. Wyatt, SAO
* 18-Nov-86 - version 6 for saving/restoring color maps
*/
#ifndef XWDFILE_H
#define XWDFILE_H
#include <nx-X11/Xmd.h>
#define XWD_FILE_VERSION 7
#define sz_XWDheader 100
#define sz_XWDColor 12
typedef CARD32 xwdval; /* for old broken programs */
/* Values in the file are most significant byte first. */
typedef struct _xwd_file_header {
/* header_size = SIZEOF(XWDheader) + length of null-terminated
* window name. */
CARD32 header_size B32;
CARD32 file_version B32; /* = XWD_FILE_VERSION above */
CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */
CARD32 pixmap_depth B32; /* Pixmap depth */
CARD32 pixmap_width B32; /* Pixmap width */
CARD32 pixmap_height B32; /* Pixmap height */
CARD32 xoffset B32; /* Bitmap x offset, normally 0 */
CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */
/* bitmap_unit applies to bitmaps (depth 1 format XY) only.
* It is the number of bits that each scanline is padded to. */
CARD32 bitmap_unit B32;
CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */
/* bitmap_pad applies to pixmaps (non-bitmaps) only.
* It is the number of bits that each scanline is padded to. */
CARD32 bitmap_pad B32;
CARD32 bits_per_pixel B32; /* Bits per pixel */
/* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps)
* or bitmap_pad (pixmaps). It is the delta (in bytes) to get
* to the same x position on an adjacent row. */
CARD32 bytes_per_line B32;
CARD32 visual_class B32; /* Class of colormap */
CARD32 red_mask B32; /* Z red mask */
CARD32 green_mask B32; /* Z green mask */
CARD32 blue_mask B32; /* Z blue mask */
CARD32 bits_per_rgb B32; /* Log2 of distinct color values */
CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */
CARD32 ncolors B32; /* Number of XWDColor structures */
CARD32 window_width B32; /* Window width */
CARD32 window_height B32; /* Window height */
CARD32 window_x B32; /* Window upper left X coordinate */
CARD32 window_y B32; /* Window upper left Y coordinate */
CARD32 window_bdrwidth B32; /* Window border width */
} XWDFileHeader;
/* Null-terminated window name follows the above structure. */
/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in
* the file. XWDFileHeader.ncolors tells how many XWDColor structures
* there are.
*/
typedef struct {
CARD32 pixel B32;
CARD16 red B16;
CARD16 green B16;
CARD16 blue B16;
CARD8 flags;
CARD8 pad;
} XWDColor;
/* Last comes the image data in the format described by XWDFileHeader. */
#endif /* XWDFILE_H */
/*
Copyright 1995, 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.
*/
/*
* The purpose of this header is to define the macros ALLOCATE_LOCAL and
* DEALLOCATE_LOCAL appropriately for the platform being compiled on.
* These macros are used to make fast, function-local memory allocations.
* Their characteristics are as follows:
*
* void *ALLOCATE_LOCAL(int size)
* Returns a pointer to size bytes of memory, or NULL if the allocation
* failed. The memory must be freed with DEALLOCATE_LOCAL before the
* function that made the allocation returns. You should not ask for
* large blocks of memory with this function, since on many platforms
* the memory comes from the stack, which may have limited size.
*
* void DEALLOCATE_LOCAL(void *)
* Frees the memory allocated by ALLOCATE_LOCAL. Omission of this
* step may be harmless on some platforms, but will result in
* memory leaks or worse on others.
*
* Before including this file, you should define two macros,
* ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the
* same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The
* header uses the fallbacks if it doesn't know a "better" way to define
* ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be:
*
* #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size)
* #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr)
* #include "Xalloca.h"
*/
#ifndef XALLOCA_H
#define XALLOCA_H 1
#ifndef INCLUDE_ALLOCA_H
# if defined(__SUNPRO_C) /* Need to add more here to match Imake *.cf's */
# define INCLUDE_ALLOCA_H
# endif
#endif
#ifdef INCLUDE_ALLOCA_H
# include <alloca.h>
#endif
#ifndef NO_ALLOCA
/*
* os-dependent definition of local allocation and deallocation
* If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK
* for ALLOCATE/DEALLOCATE_LOCAL then you add that in here.
*/
# if defined(__HIGHC__)
# ifndef NCR
extern char *alloca();
# if HCVERSION < 21003
# define ALLOCATE_LOCAL(size) alloca((int)(size))
pragma on(alloca);
# else /* HCVERSION >= 21003 */
# define ALLOCATE_LOCAL(size) _Alloca((int)(size))
# endif /* HCVERSION < 21003 */
# else /* NCR */
# define ALLOCATE_LOCAL(size) alloca(size)
# endif
# endif /* defined(__HIGHC__) */
# ifdef __GNUC__
# ifndef alloca
# define alloca __builtin_alloca
# endif /* !alloca */
# define ALLOCATE_LOCAL(size) alloca((int)(size))
# else /* ! __GNUC__ */
/*
* warning: old mips alloca (pre 2.10) is unusable, new one is built in
* Test is easy, the new one is named __builtin_alloca and comes
* from alloca.h which #defines alloca.
*/
# ifndef NCR
# if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(alloca)
/*
* Some System V boxes extract alloca.o from /lib/libPW.a; if you
* decide that you don't want to use alloca, you might want to fix it here.
*/
/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
# define __Xnullarg /* as nothing */
# ifndef X_NOT_STDC_ENV
extern void *alloca(__Xnullarg);
# else
extern char *alloca(__Xnullarg);
# endif
# define ALLOCATE_LOCAL(size) alloca((int)(size))
# endif /* who does alloca */
# endif /* NCR */
# endif /* __GNUC__ */
#endif /* NO_ALLOCA */
#if !defined(ALLOCATE_LOCAL)
# if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK)
# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size)
# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr)
# else /* no fallbacks supplied; error */
# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined!
# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined!
# endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */
#else
# if !defined(DEALLOCATE_LOCAL)
# define DEALLOCATE_LOCAL(_ptr) do {} while(0)
# endif
#endif /* defined(ALLOCATE_LOCAL) */
#endif /* XALLOCA_H */
NULL = NULL =
#if BuildScreenSaverExt #if BuildScreenSaverExt
SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h SCREENSAVERHEADERS = saver.h saverproto.h
#endif #endif
#if BuildXF86BigfontExt #if BuildXF86BigfontExt
...@@ -33,7 +33,7 @@ DAMAGEHEADERS = damagewire.h damageproto.h ...@@ -33,7 +33,7 @@ DAMAGEHEADERS = damagewire.h damageproto.h
XRESHEADERS = XResproto.h XRESHEADERS = XResproto.h
#endif #endif
XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h XKBfile.h XKBrules.h XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h
EXTRAHEADERS = \ EXTRAHEADERS = \
$(SCREENSAVERHEADERS) \ $(SCREENSAVERHEADERS) \
......
#ifndef _XKBFILE_H_
#define _XKBFILE_H_ 1
/************************************************************
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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.
********************************************************/
/***====================================================================***/
#define XkbXKMFile 0
#define XkbCFile 1
#define XkbXKBFile 2
#define XkbMessage 3
#define XkbMapDefined (1<<0)
#define XkbStateDefined (1<<1)
typedef struct _XkbFileInfo {
unsigned type;
unsigned defined;
XkbDescPtr xkb;
} XkbFileInfo,*XkbFileInfoPtr;
typedef void (*XkbFileAddOnFunc)(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
int /* fileSection */,
void * /* priv */
);
/***====================================================================***/
#define _XkbSuccess 0
#define _XkbErrMissingNames 1
#define _XkbErrMissingTypes 2
#define _XkbErrMissingReqTypes 3
#define _XkbErrMissingSymbols 4
#define _XkbErrMissingVMods 5
#define _XkbErrMissingIndicators 6
#define _XkbErrMissingCompatMap 7
#define _XkbErrMissingSymInterps 8
#define _XkbErrMissingGeometry 9
#define _XkbErrIllegalDoodad 10
#define _XkbErrIllegalTOCType 11
#define _XkbErrIllegalContents 12
#define _XkbErrEmptyFile 13
#define _XkbErrFileNotFound 14
#define _XkbErrFileCannotOpen 15
#define _XkbErrBadValue 16
#define _XkbErrBadMatch 17
#define _XkbErrBadTypeName 18
#define _XkbErrBadTypeWidth 19
#define _XkbErrBadFileType 20
#define _XkbErrBadFileVersion 21
#define _XkbErrBadFileFormat 22
#define _XkbErrBadAlloc 23
#define _XkbErrBadLength 24
#define _XkbErrXReqFailure 25
#define _XkbErrBadImplementation 26
extern char * _XkbErrMessages[];
extern unsigned _XkbErrCode;
extern char * _XkbErrLocation;
extern unsigned _XkbErrData;
/***====================================================================***/
_XFUNCPROTOBEGIN
extern char * XkbIndentText(
unsigned /* size */
);
extern char * XkbAtomText(
Display * /* dpy */,
Atom /* atm */,
unsigned /* format */
);
extern char * XkbKeysymText(
KeySym /* sym */,
unsigned /* format */
);
extern char * XkbStringText(
char * /* str */,
unsigned /* format */
);
extern char * XkbKeyNameText(
char * /* name */,
unsigned /* format */
);
extern char *
XkbModIndexText(
unsigned /* ndx */,
unsigned /* format */
);
extern char *
XkbModMaskText(
unsigned /* mask */,
unsigned /* format */
);
extern char * XkbVModIndexText(
Display * /* dpy */,
XkbDescPtr /* xkb */,
unsigned /* ndx */,
unsigned /* format */
);
extern char * XkbVModMaskText(
Display * /* dpy */,
XkbDescPtr /* xkb */,
unsigned /* modMask */,
unsigned /* mask */,
unsigned /* format */
);
extern char * XkbConfigText(
unsigned /* config */,
unsigned /* format */
);
extern char * XkbSIMatchText(
unsigned /* type */,
unsigned /* format */
);
extern char * XkbIMWhichStateMaskText(
unsigned /* use_which */,
unsigned /* format */
);
extern char * XkbAccessXDetailText(
unsigned /* state */,
unsigned /* format */
);
extern char * XkbNKNDetailMaskText(
unsigned /* detail */,
unsigned /* format */
);
extern char * XkbControlsMaskText(
unsigned /* ctrls */,
unsigned /* format */
);
extern char * XkbGeomFPText(
int /* val */,
unsigned /* format */
);
extern char * XkbDoodadTypeText(
unsigned /* type */,
unsigned /* format */
);
extern char * XkbActionTypeText(
unsigned /* type */,
unsigned /* format */
);
extern char * XkbActionText(
Display * /* dpy */,
XkbDescPtr /* xkb */,
XkbAction * /* action */,
unsigned /* format */
);
extern char * XkbBehaviorText(
XkbDescPtr /* xkb */,
XkbBehavior * /* behavior */,
unsigned /* format */
);
/***====================================================================***/
#define _XkbKSLower (1<<0)
#define _XkbKSUpper (1<<1)
#define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower)
#define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper)
#define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal))
#define XkbKSIsDeadKey(k) \
(((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound))
extern unsigned _XkbKSCheckCase(
KeySym /* sym */
);
extern int XkbFindKeycodeByName(
XkbDescPtr /* xkb */,
char * /* name */,
Bool /* use_aliases */
);
extern Bool XkbLookupGroupAndLevel(
XkbDescPtr /* xkb */,
int /* key */,
int * /* mods_inout */,
int * /* grp_inout */,
int * /* lvl_rtrn */
);
/***====================================================================***/
#ifndef XKB_IN_SERVER
extern Bool XkbLookupCanonicalRGBColor(
char * /* def */,
XColor * /* color */
);
#endif
/***====================================================================***/
extern char * XkbAtomGetString(
Display * /* dpy */,
Atom /* atm */
);
extern Atom XkbInternAtom(
Display * /* dpy */,
char * /* name */,
Bool /* onlyIfExists */
);
extern Status XkbChangeKbdDisplay(
Display * /* newDpy */,
XkbFileInfo * /* result */
);
extern Atom XkbChangeAtomDisplay(
Display * /* oldDpy */,
Display * /* newDpy */,
Atom /* atm */
);
extern void XkbInitAtoms(
Display * /* dpy */
);
/***====================================================================***/
#ifdef _XKBGEOM_H_
#define XkbDW_Unknown 0
#define XkbDW_Doodad 1
#define XkbDW_Section 2
typedef struct _XkbDrawable {
int type;
int priority;
union {
XkbDoodadPtr doodad;
XkbSectionPtr section;
} u;
struct _XkbDrawable * next;
} XkbDrawableRec,*XkbDrawablePtr;
extern XkbDrawablePtr
XkbGetOrderedDrawables(
XkbGeometryPtr /* geom */,
XkbSectionPtr /* section */
);
extern void
XkbFreeOrderedDrawables(
XkbDrawablePtr /* draw */
);
#endif
/***====================================================================***/
extern unsigned XkbConvertGetByNameComponents(
Bool /* toXkm */,
unsigned /* orig */
);
extern unsigned XkbConvertXkbComponents(
Bool /* toXkm */,
unsigned /* orig */
);
extern Bool XkbDetermineFileType(
XkbFileInfo * /* xkb */,
int /* format */,
int * /* opts_missing */
);
extern Bool XkbNameMatchesPattern(
char * /* name */,
char * /* pattern */
);
/***====================================================================***/
extern Bool XkbWriteXKBKeycodes(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBKeyTypes(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBCompatMap(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBSymbols(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBGeometry(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBSemantics(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBLayout(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBKeymap(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* topLevel */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteXKBFile(
FILE * /* file */,
XkbFileInfo * /* result */,
Bool /* showImplicit */,
XkbFileAddOnFunc /* addOn */,
void * /* priv */
);
extern Bool XkbWriteCFile(
FILE * /* file */,
char * /* name */,
XkbFileInfo * /* info */
);
extern Bool XkbWriteXKMFile(
FILE * /* file */,
XkbFileInfo * /* result */
);
extern Bool XkbWriteToServer(
XkbFileInfo * /* result */
);
extern void XkbEnsureSafeMapName(
char * /* name */
);
extern Bool XkbWriteXKBKeymapForNames(
FILE * /* file */,
XkbComponentNamesPtr /* names */,
Display * /* dpy */,
XkbDescPtr /* xkb */,
unsigned /* want */,
unsigned /* need */
);
extern Status XkbMergeFile(
XkbDescPtr /* xkb */,
XkbFileInfo /* finfo */
);
/***====================================================================***/
extern Bool XkmProbe(
FILE * /* file */
);
extern unsigned XkbReadFromServer(
Display * /* dpy */,
unsigned /* need */,
unsigned /* want */,
XkbFileInfo * /* result */
);
extern unsigned XkmReadFile(
FILE * /* file */,
unsigned /* need */,
unsigned /* want */,
XkbFileInfo * /* result */
);
#ifdef _XKMFORMAT_H_
extern Bool XkmReadTOC(
FILE * /* file */,
xkmFileInfo * /* file_info */,
int /* max_toc */,
xkmSectionInfo * /* toc */
);
extern xkmSectionInfo *XkmFindTOCEntry(
xkmFileInfo * /* finfo */,
xkmSectionInfo * /* toc */,
unsigned /* type */
);
extern Bool XkmReadFileSection(
FILE * /* file */,
xkmSectionInfo * /* toc */,
XkbFileInfo * /* result */,
unsigned * /* loaded_rtrn */
);
extern char * XkmReadFileSectionName(
FILE * /* file */,
xkmSectionInfo * /* toc */
);
#endif /* _XKMFORMAT_H */
_XFUNCPROTOEND
#endif /* _XKBFILE_H_ */
#ifndef _XKBRULES_H_
#define _XKBRULES_H_ 1
/************************************************************
Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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.
********************************************************/
/***====================================================================***/
typedef struct _XkbRF_VarDefs {
char * model;
char * layout;
char * variant;
char * options;
unsigned short sz_extra;
unsigned short num_extra;
char * extra_names;
char ** extra_values;
} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr;
typedef struct _XkbRF_VarDesc {
char * name;
char * desc;
} XkbRF_VarDescRec, *XkbRF_VarDescPtr;
typedef struct _XkbRF_DescribeVars {
int sz_desc;
int num_desc;
XkbRF_VarDescPtr desc;
} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr;
typedef struct _XkbRF_Rule {
int number;
int layout_num;
int variant_num;
char * model;
char * layout;
char * variant;
char * option;
/* yields */
char * keycodes;
char * symbols;
char * types;
char * compat;
char * geometry;
char * keymap;
unsigned flags;
} XkbRF_RuleRec,*XkbRF_RulePtr;
typedef struct _XkbRF_Group {
int number;
char * name;
char * words;
} XkbRF_GroupRec, *XkbRF_GroupPtr;
#define XkbRF_PendingMatch (1L<<1)
#define XkbRF_Option (1L<<2)
#define XkbRF_Append (1L<<3)
#define XkbRF_Normal (1L<<4)
#define XkbRF_Invalid (1L<<5)
typedef struct _XkbRF_Rules {
XkbRF_DescribeVarsRec models;
XkbRF_DescribeVarsRec layouts;
XkbRF_DescribeVarsRec variants;
XkbRF_DescribeVarsRec options;
unsigned short sz_extra;
unsigned short num_extra;
char ** extra_names;
XkbRF_DescribeVarsPtr extra;
unsigned short sz_rules;
unsigned short num_rules;
XkbRF_RulePtr rules;
unsigned short sz_groups;
unsigned short num_groups;
XkbRF_GroupPtr groups;
} XkbRF_RulesRec, *XkbRF_RulesPtr;
/***====================================================================***/
_XFUNCPROTOBEGIN
extern Bool XkbRF_GetComponents(
XkbRF_RulesPtr /* rules */,
XkbRF_VarDefsPtr /* var_defs */,
XkbComponentNamesPtr /* names */
);
extern XkbRF_RulePtr XkbRF_AddRule(
XkbRF_RulesPtr /* rules */
);
extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules);
extern Bool XkbRF_LoadRules(
FILE * /* file */,
XkbRF_RulesPtr /* rules */
);
extern Bool XkbRF_LoadRulesByName(
char * /* base */,
char * /* locale */,
XkbRF_RulesPtr /* rules */
);
/***====================================================================***/
extern XkbRF_VarDescPtr XkbRF_AddVarDesc(
XkbRF_DescribeVarsPtr /* vars */
);
extern XkbRF_VarDescPtr XkbRF_AddVarDescCopy(
XkbRF_DescribeVarsPtr /* vars */,
XkbRF_VarDescPtr /* copy_from */
);
extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe(
XkbRF_RulesPtr /* rules */,
char * /* name */
);
extern Bool XkbRF_LoadDescriptions(
FILE * /* file */,
XkbRF_RulesPtr /* rules */
);
extern Bool XkbRF_LoadDescriptionsByName(
char * /* base */,
char * /* locale */,
XkbRF_RulesPtr /* rules */
);
extern XkbRF_RulesPtr XkbRF_Load(
char * /* base */,
char * /* locale */,
Bool /* wantDesc */,
Bool /* wantRules */
);
extern XkbRF_RulesPtr XkbRF_Create(
int /* sz_rules */,
int /* sz_extra */
);
/***====================================================================***/
extern void XkbRF_Free(
XkbRF_RulesPtr /* rules */,
Bool /* freeRules */
);
/***====================================================================***/
#define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES"
#define _XKB_RF_NAMES_PROP_MAXLEN 1024
#ifndef XKB_IN_SERVER
extern Bool XkbRF_GetNamesProp(
Display * /* dpy */,
char ** /* rules_file_rtrn */,
XkbRF_VarDefsPtr /* var_defs_rtrn */
);
extern Bool XkbRF_SetNamesProp(
Display * /* dpy */,
char * /* rules_file */,
XkbRF_VarDefsPtr /* var_defs */
);
#endif
_XFUNCPROTOEND
#endif /* _XKBRULES_H_ */
...@@ -70,11 +70,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -70,11 +70,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <nx-X11/extensions/XKBproto.h> #include <nx-X11/extensions/XKBproto.h>
#include "inputstr.h" #include "inputstr.h"
#ifdef NXAGENT_SERVER
extern char *_NXGetXkbBasePath(const char *path);
extern char *_NXGetXkbCompPath(const char *path);
#endif
typedef struct _XkbInterest { typedef struct _XkbInterest {
DeviceIntPtr dev; DeviceIntPtr dev;
ClientPtr client; ClientPtr client;
...@@ -1111,91 +1106,6 @@ extern void XkbSendNewKeyboardNotify( ...@@ -1111,91 +1106,6 @@ extern void XkbSendNewKeyboardNotify(
xkbNewKeyboardNotify * /* pNKN */ xkbNewKeyboardNotify * /* pNKN */
); );
#ifdef XKBSRV_NEED_FILE_FUNCS
#include <nx-X11/extensions/XKMformat.h>
#include <nx-X11/extensions/XKBfile.h>
#include <nx-X11/extensions/XKBrules.h>
#define _XkbListKeymaps 0
#define _XkbListKeycodes 1
#define _XkbListTypes 2
#define _XkbListCompat 3
#define _XkbListSymbols 4
#define _XkbListGeometry 5
#define _XkbListNumComponents 6
typedef struct _XkbSrvListInfo {
int szPool;
int nPool;
char * pool;
int maxRtrn;
int nTotal;
char * pattern[_XkbListNumComponents];
int nFound[_XkbListNumComponents];
} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
char *
XkbGetRulesDflts(
XkbRF_VarDefsPtr /* defs */
);
extern void XkbSetRulesUsed(
XkbRF_VarDefsPtr /* defs */
);
extern Status XkbDDXList(
DeviceIntPtr /* dev */,
XkbSrvListInfoPtr /* listing */,
ClientPtr /* client */
);
extern unsigned int XkbDDXLoadKeymapByNames(
DeviceIntPtr /* keybd */,
XkbComponentNamesPtr /* names */,
unsigned int /* want */,
unsigned int /* need */,
XkbFileInfoPtr /* finfoRtrn */,
char * /* keymapNameRtrn */,
int /* keymapNameRtrnLen */
);
extern Bool XkbDDXNamesFromRules(
DeviceIntPtr /* keybd */,
char * /* rules */,
XkbRF_VarDefsPtr /* defs */,
XkbComponentNamesPtr /* names */
);
extern FILE *XkbDDXOpenConfigFile(
char * /* mapName */,
char * /* fileNameRtrn */,
int /* fileNameRtrnLen */
);
extern Bool XkbDDXApplyConfig(
XPointer /* cfg_in */,
XkbSrvInfoPtr /* xkbi */
);
extern XPointer XkbDDXPreloadConfig(
char ** /* rulesFileRtrn */,
XkbRF_VarDefsPtr /* defs */,
XkbComponentNamesPtr /* names */,
DeviceIntPtr /* dev */
);
extern int _XkbStrCaseCmp(
char * /* str1 */,
char * /* str2 */
);
#endif /* XKBSRV_NEED_FILE_FUNCS */
_XFUNCPROTOEND _XFUNCPROTOEND
#define XkbAtomGetString(d,s) NameForAtom(s) #define XkbAtomGetString(d,s) NameForAtom(s)
......
/*
* $XConsortium: scrnsaver.h,v 1.6 94/04/17 20:59:34 keith Exp $
*
Copyright (c) 1992 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM 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 X Consortium 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 X Consortium.
*
* Author: Keith Packard, MIT X Consortium
*/
/* $XFree86$ */
#ifndef _SCRNSAVER_H_
#define _SCRNSAVER_H_
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/Xlib.h>
#include <nx-X11/extensions/saver.h>
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* screen saver window */
Window root; /* root window of event screen */
int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverCycle*/
int kind; /* ScreenSaverBlanked, ...Internal, ...External */
Bool forced; /* extents of new region */
Time time; /* event timestamp */
} XScreenSaverNotifyEvent;
typedef struct {
Window window; /* screen saver window - may not exist */
int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled*/
int kind; /* ScreenSaverBlanked, ...Internal, ...External */
unsigned long til_or_since; /* time til or since screen saver */
unsigned long idle; /* total time since last user input */
unsigned long eventMask; /* currently selected events for this client */
} XScreenSaverInfo;
_XFUNCPROTOBEGIN
extern Bool XScreenSaverQueryExtension (
Display* /* display */,
int* /* event_base */,
int* /* error_base */
);
extern Status XScreenSaverQueryVersion (
Display* /* display */,
int* /* major_version */,
int* /* minor_version */
);
extern XScreenSaverInfo *XScreenSaverAllocInfo (
void
);
extern Status XScreenSaverQueryInfo (
Display* /* display */,
Drawable /* drawable */,
XScreenSaverInfo* /* info */
);
extern void XScreenSaverSelectInput (
Display* /* display */,
Drawable /* drawable */,
unsigned long /* eventMask */
);
extern void XScreenSaverSetAttributes (
Display* /* display */,
Drawable /* drawable */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
int /* depth */,
unsigned int /* class */,
Visual * /* visual */,
unsigned long /* valuemask */,
XSetWindowAttributes * /* attributes */
);
extern void XScreenSaverUnsetAttributes (
Display* /* display */,
Drawable /* drawable */
);
extern Status XScreenSaverRegister (
Display* /* display */,
int /* screen */,
XID /* xid */,
Atom /* type */
);
extern Status XScreenSaverUnregister (
Display* /* display */,
int /* screen */
);
extern Status XScreenSaverGetRegistered (
Display* /* display */,
int /* screen */,
XID* /* xid */,
Atom* /* type */
);
_XFUNCPROTOEND
#endif /* _SCRNSAVER_H_ */
...@@ -128,20 +128,29 @@ xthread_t (*_Xthread_self_fn)(void) = NULL; ...@@ -128,20 +128,29 @@ xthread_t (*_Xthread_self_fn)(void) = NULL;
static struct timeval retry; static struct timeval retry;
/* /*
* From Xtranssock.c. Presently the congestion state * From Xtranssock.c. Presently the congestion state is reported by
* is reported by the proxy to the application, by * the proxy to the application, by invoking the callback
* invoking the callback directly. The function will * directly. The function will be possibly used in the future, to be
* be possibly used in the future, to be able to track * able to track the bandwidth usage even when the NX transport is not
* the bandwidth usage even when the NX transport is * running. Note that in this sample implementation the congestion
* not running. Note that in this sample implementation * state is checked very often and can be surely optimized.
* the congestion state is checked very often and can
* be surely optimized.
*/ */
#ifdef NX_TRANS_CHANGE #ifdef NX_TRANS_CHANGE
extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); extern int _X11TransSocketCongestionChange(XtransConnInfo, int *);
#endif #endif
#else
/*
* unifdef to simplify subsequent checks. IF NX_TRANS_CHANGE is set it
* is safe to assume NX_TRANS_SOCKET is also set. Same for NX_TRANS_DEBUG.
*/
# ifdef NX_TRANS_CHANGE
# undef NX_TRANS_CHANGE
# endif
# ifdef NX_TRANS_DEBUG
# undef NX_TRANS_DEBUG
# endif
#endif /* #ifdef NX_TRANS_SOCKET */ #endif /* #ifdef NX_TRANS_SOCKET */
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
...@@ -254,28 +263,22 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, ...@@ -254,28 +263,22 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds,
fd_set t_readfds, t_writefds; fd_set t_readfds, t_writefds;
struct timeval t_timeout; struct timeval t_timeout;
int n, r, e;
#ifdef NX_TRANS_TEST #ifdef NX_TRANS_TEST
if (exceptfds != NULL) if (exceptfds != NULL)
{ {
fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n");
} }
#endif #endif
if (readfds == NULL) if (readfds == NULL)
{ {
FD_ZERO(&t_readfds); FD_ZERO(&t_readfds);
readfds = &t_readfds; readfds = &t_readfds;
} }
if (writefds == NULL) if (writefds == NULL)
{ {
FD_ZERO(&t_writefds); FD_ZERO(&t_writefds);
writefds = &t_writefds; writefds = &t_writefds;
} }
...@@ -283,11 +286,10 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, ...@@ -283,11 +286,10 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds,
{ {
t_timeout.tv_sec = 10; t_timeout.tv_sec = 10;
t_timeout.tv_usec = 0; t_timeout.tv_usec = 0;
timeout = &t_timeout; timeout = &t_timeout;
} }
n = maxfds; int n = maxfds;
/* /*
* If the transport is gone avoid * If the transport is gone avoid
...@@ -296,10 +298,10 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, ...@@ -296,10 +298,10 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds,
if (NXTransPrepare(&n, readfds, writefds, timeout) != 0) if (NXTransPrepare(&n, readfds, writefds, timeout) != 0)
{ {
NXTransSelect(&r, &e, &n, readfds, writefds, timeout); int r, e;
NXTransSelect(&r, &e, &n, readfds, writefds, timeout);
NXTransExecute(&r, &e, &n, readfds, writefds, timeout); NXTransExecute(&r, &e, &n, readfds, writefds, timeout);
errno = e; errno = e;
return r; return r;
...@@ -434,15 +436,15 @@ _XWaitForWritable( ...@@ -434,15 +436,15 @@ _XWaitForWritable(
#endif /* #ifdef NX_TRANS_SOCKET */ #endif /* #ifdef NX_TRANS_SOCKET */
UnlockDisplay(dpy); UnlockDisplay(dpy);
#ifdef USE_POLL #ifdef USE_POLL
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); fprintf(stderr, "_XWaitForWritable: Calling poll().\n");
#endif #endif
nfound = poll (&filedes, 1, -1); nfound = poll (&filedes, 1, -1);
#else /* USE_POLL */ #else /* USE_POLL */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n",
NXTransTime()); NXTransTime());
#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ #endif /* ifdef NX_TRANS_DEBUG */
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
/* /*
* Give a chance to the callback to detect * Give a chance to the callback to detect
...@@ -460,7 +462,7 @@ _XWaitForWritable( ...@@ -460,7 +462,7 @@ _XWaitForWritable(
#else /* NX_TRANS_SOCKET */ #else /* NX_TRANS_SOCKET */
nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL);
#endif /* NX_TRANS_SOCKET */ #endif /* NX_TRANS_SOCKET */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n",
nfound, NXTransTime()); nfound, NXTransTime());
...@@ -479,16 +481,16 @@ _XWaitForWritable( ...@@ -479,16 +481,16 @@ _XWaitForWritable(
fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n",
dpy->fd); dpy->fd);
} }
#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ #endif /* ifdef NX_TRANS_DEBUG */
#endif /* USE_POLL */ #endif /* USE_POLL */
InternalLockDisplay(dpy, cv != NULL); InternalLockDisplay(dpy, cv != NULL);
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
if (_NXDisplayCongestionFunction != NULL && if (_NXDisplayCongestionFunction != NULL &&
_X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) {
(*_NXDisplayCongestionFunction)(dpy, congestion); (*_NXDisplayCongestionFunction)(dpy, congestion);
} }
#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ #endif /* ifdef NX_TRANS_CHANGE */
if (nfound <= 0) { if (nfound <= 0) {
if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) ||
(_NXDisplayErrorFunction != NULL && (_NXDisplayErrorFunction != NULL &&
...@@ -521,7 +523,6 @@ _XWaitForWritable( ...@@ -521,7 +523,6 @@ _XWaitForWritable(
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
{ {
_XIOError(dpy); _XIOError(dpy);
return; return;
} }
#else /* NX_TRANS_SOCKET */ #else /* NX_TRANS_SOCKET */
...@@ -681,7 +682,7 @@ _XWaitForReadable( ...@@ -681,7 +682,7 @@ _XWaitForReadable(
int highest_fd = fd; int highest_fd = fd;
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
int congestion; int congestion;
#endif #endif
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
...@@ -721,14 +722,14 @@ _XWaitForReadable( ...@@ -721,14 +722,14 @@ _XWaitForReadable(
#endif /* USE_POLL */ #endif /* USE_POLL */
UnlockDisplay(dpy); UnlockDisplay(dpy);
#ifdef USE_POLL #ifdef USE_POLL
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForReadable: Calling poll().\n"); fprintf(stderr, "_XWaitForReadable: Calling poll().\n");
#endif #endif
result = poll(filedes, result = poll(filedes,
(dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length,
-1); -1);
#else /* USE_POLL */ #else /* USE_POLL */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForReadable: Calling select().\n"); fprintf(stderr, "_XWaitForReadable: Calling select().\n");
#endif #endif
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
...@@ -757,12 +758,12 @@ _XWaitForReadable( ...@@ -757,12 +758,12 @@ _XWaitForReadable(
result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL);
#endif /* NX_TRANS_SOCKET */ #endif /* NX_TRANS_SOCKET */
#endif /* USE_POLL */ #endif /* USE_POLL */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n", fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n",
result, (result < 0 ? errno : 0)); result, (result < 0 ? errno : 0));
#endif #endif
InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply);
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
if (_NXDisplayCongestionFunction != NULL && if (_NXDisplayCongestionFunction != NULL &&
_X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) {
(*_NXDisplayCongestionFunction)(dpy, congestion); (*_NXDisplayCongestionFunction)(dpy, congestion);
...@@ -971,11 +972,11 @@ static void _XFlushInt( ...@@ -971,11 +972,11 @@ static void _XFlushInt(
register int write_stat; register int write_stat;
register char *bufindex; register char *bufindex;
_XExtension *ext; _XExtension *ext;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
int congestion; int congestion;
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n",
(dpy->bufptr - dpy->buffer)); (dpy->bufptr - dpy->buffer));
#endif #endif
...@@ -986,7 +987,7 @@ static void _XFlushInt( ...@@ -986,7 +987,7 @@ static void _XFlushInt(
*/ */
if (dpy->flags & XlibDisplayIOError) if (dpy->flags & XlibDisplayIOError)
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n");
#endif #endif
dpy->bufptr = dpy->buffer; dpy->bufptr = dpy->buffer;
...@@ -1124,7 +1125,7 @@ _XEventsQueued( ...@@ -1124,7 +1125,7 @@ _XEventsQueued(
if (dpy->qlen) if (dpy->qlen)
return(dpy->qlen); return(dpy->qlen);
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
if (dpy->flags & XlibDisplayIOError) { if (dpy->flags & XlibDisplayIOError) {
fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n",
dpy->qlen); dpy->qlen);
...@@ -1170,14 +1171,13 @@ _XEventsQueued( ...@@ -1170,14 +1171,13 @@ _XEventsQueued(
} }
#endif /* XTHREADS*/ #endif /* XTHREADS*/
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n");
#endif #endif
if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
{ {
_XIOError(dpy); _XIOError(dpy);
return (dpy->qlen); return (dpy->qlen);
} }
#else #else
...@@ -1199,14 +1199,14 @@ _XEventsQueued( ...@@ -1199,14 +1199,14 @@ _XEventsQueued(
dpy->conn_checker = 0; dpy->conn_checker = 0;
#ifdef USE_POLL #ifdef USE_POLL
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XEventsQueued: Calling poll().\n"); fprintf(stderr, "_XEventsQueued: Calling poll().\n");
#endif #endif
filedes.fd = dpy->fd; filedes.fd = dpy->fd;
filedes.events = POLLIN; filedes.events = POLLIN;
if ((result = poll(&filedes, 1, 0))) if ((result = poll(&filedes, 1, 0)))
#else #else
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XEventsQueued: Calling select().\n"); fprintf(stderr, "_XEventsQueued: Calling select().\n");
#endif #endif
FD_ZERO(&r_mask); FD_ZERO(&r_mask);
...@@ -1220,7 +1220,6 @@ _XEventsQueued( ...@@ -1220,7 +1220,6 @@ _XEventsQueued(
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
{ {
_XIOError(dpy); _XIOError(dpy);
return (dpy->qlen); return (dpy->qlen);
} }
#else #else
...@@ -1254,7 +1253,7 @@ _XEventsQueued( ...@@ -1254,7 +1253,7 @@ _XEventsQueued(
{ {
UnlockNextEventReader(dpy); UnlockNextEventReader(dpy);
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen);
#endif #endif
return(dpy->qlen); return(dpy->qlen);
...@@ -1450,7 +1449,7 @@ void _XReadEvents( ...@@ -1450,7 +1449,7 @@ void _XReadEvents(
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
if (dpy->flags & XlibDisplayIOError) if (dpy->flags & XlibDisplayIOError)
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n");
#endif #endif
return; return;
...@@ -1536,14 +1535,14 @@ int _XRead( ...@@ -1536,14 +1535,14 @@ int _XRead(
#ifdef XTHREADS #ifdef XTHREADS
int original_size = size; int original_size = size;
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
int congestion; int congestion;
#endif #endif
if ((dpy->flags & XlibDisplayIOError) || size == 0) if ((dpy->flags & XlibDisplayIOError) || size == 0)
return 0; return 0;
ESET(0); ESET(0);
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
while (1) { while (1) {
/* /*
* Need to check the congestion state * Need to check the congestion state
...@@ -1582,12 +1581,10 @@ int _XRead( ...@@ -1582,12 +1581,10 @@ int _XRead(
else if (bytes_read == 0) { else if (bytes_read == 0) {
/* Read failed because of end of file! */ /* Read failed because of end of file! */
ESET(EPIPE); ESET(EPIPE);
#ifdef NX_TRANS_SOCKET
_XIOError(dpy);
return -1;
#else
_XIOError(dpy); _XIOError(dpy);
#ifdef NX_TRANS_SOCKET
return -1;
#endif #endif
} }
...@@ -1664,7 +1661,7 @@ void _XReadPad( ...@@ -1664,7 +1661,7 @@ void _XReadPad(
#ifdef XTHREADS #ifdef XTHREADS
int original_size; int original_size;
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
int congestion; int congestion;
#endif #endif
...@@ -1684,7 +1681,7 @@ void _XReadPad( ...@@ -1684,7 +1681,7 @@ void _XReadPad(
original_size = size; original_size = size;
#endif #endif
ESET(0); ESET(0);
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
while (1) { while (1) {
bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2);
if (_NXDisplayCongestionFunction != NULL && if (_NXDisplayCongestionFunction != NULL &&
...@@ -1782,12 +1779,12 @@ _XSend ( ...@@ -1782,12 +1779,12 @@ _XSend (
long skip, dbufsize, padsize, total, todo; long skip, dbufsize, padsize, total, todo;
_XExtension *ext; _XExtension *ext;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) #ifdef NX_TRANS_CHANGE
int congestion; int congestion;
#endif #endif
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n",
(dpy->bufptr - dpy->buffer)); (dpy->bufptr - dpy->buffer));
#endif #endif
...@@ -1795,7 +1792,7 @@ _XSend ( ...@@ -1795,7 +1792,7 @@ _XSend (
{ {
if (dpy->flags & XlibDisplayIOError) if (dpy->flags & XlibDisplayIOError)
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); fprintf(stderr, "_XSend: Returning with I/O error detected.\n");
#endif #endif
dpy->bufptr = dpy->buffer; dpy->bufptr = dpy->buffer;
...@@ -2145,7 +2142,7 @@ _XReply ( ...@@ -2145,7 +2142,7 @@ _XReply (
#ifdef XTHREADS #ifdef XTHREADS
struct _XCVList *cvl; struct _XCVList *cvl;
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); fprintf(stderr, "_XReply: Going to wait for an X reply.\n");
#endif #endif
...@@ -2176,7 +2173,7 @@ _XReply ( ...@@ -2176,7 +2173,7 @@ _XReply (
XThread_Self(), cvl); XThread_Self(), cvl);
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); fprintf(stderr, "_XReply: Going to flush the display buffer.\n");
#endif #endif
_XFlushInt(dpy, cvl ? cvl->cv : NULL); _XFlushInt(dpy, cvl ? cvl->cv : NULL);
...@@ -2196,9 +2193,8 @@ _XReply ( ...@@ -2196,9 +2193,8 @@ _XReply (
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
/* /*
* We are going to block waiting for the remote * We are going to block waiting for the remote X server. Be sure
* X server. Be sure that the proxy has flushed * that the proxy has flushed all the data.
* all the data.
*/ */
#ifdef NX_TRANS_TEST #ifdef NX_TRANS_TEST
...@@ -2272,8 +2268,8 @@ _XReply ( ...@@ -2272,8 +2268,8 @@ _XReply (
UnlockNextReplyReader(dpy); UnlockNextReplyReader(dpy);
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
/* /*
* The original code has provision * The original code has provision for returning
* for returning already. * already.
*/ */
#endif #endif
_XIOError (dpy); _XIOError (dpy);
...@@ -2402,8 +2398,7 @@ _XAsyncReply( ...@@ -2402,8 +2398,7 @@ _XAsyncReply(
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
/* /*
* The original code has provision * The original code has provision for returning already.
* for returning already.
*/ */
#endif #endif
...@@ -2476,7 +2471,7 @@ _XRegisterInternalConnection( ...@@ -2476,7 +2471,7 @@ _XRegisterInternalConnection(
struct _XConnWatchInfo *watchers; struct _XConnWatchInfo *watchers;
XPointer *wd; XPointer *wd;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); fprintf(stderr, "_XRegisterInternalConnection: Got called.\n");
#endif #endif
new_conni = Xmalloc(sizeof(struct _XConnectionInfo)); new_conni = Xmalloc(sizeof(struct _XConnectionInfo));
...@@ -2526,7 +2521,7 @@ _XUnregisterInternalConnection( ...@@ -2526,7 +2521,7 @@ _XUnregisterInternalConnection(
struct _XConnWatchInfo *watch; struct _XConnWatchInfo *watch;
XPointer *wd; XPointer *wd;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n");
#endif #endif
for (prev = &dpy->im_fd_info; (info_list = *prev); for (prev = &dpy->im_fd_info; (info_list = *prev);
...@@ -2567,7 +2562,7 @@ XInternalConnectionNumbers( ...@@ -2567,7 +2562,7 @@ XInternalConnectionNumbers(
struct _XConnectionInfo *info_list; struct _XConnectionInfo *info_list;
int *fd_list; int *fd_list;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); fprintf(stderr, "XInternalConnectionNumbers: Got called.\n");
#endif #endif
LockDisplay(dpy); LockDisplay(dpy);
...@@ -2628,7 +2623,7 @@ XProcessInternalConnection( ...@@ -2628,7 +2623,7 @@ XProcessInternalConnection(
{ {
struct _XConnectionInfo *info_list; struct _XConnectionInfo *info_list;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "XProcessInternalConnection: Got called.\n"); fprintf(stderr, "XProcessInternalConnection: Got called.\n");
#endif #endif
...@@ -2660,7 +2655,7 @@ XAddConnectionWatch( ...@@ -2660,7 +2655,7 @@ XAddConnectionWatch(
struct _XConnectionInfo *info_list; struct _XConnectionInfo *info_list;
XPointer *wd_array; XPointer *wd_array;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "XAddConnectionWatch: Got called.\n"); fprintf(stderr, "XAddConnectionWatch: Got called.\n");
#endif #endif
LockDisplay(dpy); LockDisplay(dpy);
...@@ -2719,7 +2714,7 @@ XRemoveConnectionWatch( ...@@ -2719,7 +2714,7 @@ XRemoveConnectionWatch(
struct _XConnectionInfo *conni; struct _XConnectionInfo *conni;
int counter = 0; int counter = 0;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); fprintf(stderr, "XRemoveConnectionWatch: Got called.\n");
#endif #endif
LockDisplay(dpy); LockDisplay(dpy);
...@@ -2760,7 +2755,7 @@ void _XEatData( ...@@ -2760,7 +2755,7 @@ void _XEatData(
#define SCRATCHSIZE 2048 #define SCRATCHSIZE 2048
char buf[SCRATCHSIZE]; char buf[SCRATCHSIZE];
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n",
n, dpy->fd); n, dpy->fd);
#endif #endif
...@@ -3715,11 +3710,10 @@ _XIOError ( ...@@ -3715,11 +3710,10 @@ _XIOError (
_XDefaultIOError(dpy); _XDefaultIOError(dpy);
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
/* /*
* Check if we are supposed to return in the case * Check if we are supposed to return in the case of a display
* of a display failure. The client which originated * failure. The client which originated the X operation will have
* the X operation will have to check the value of * to check the value of the XlibDisplayIOError flag and handle
* the XlibDisplayIOError flag and handle appropria- * appropriately the display disconnection.
* tely the display disconnection.
*/ */
if (_NXHandleDisplayError == 0) if (_NXHandleDisplayError == 0)
......
...@@ -65,8 +65,8 @@ XF86BIGFOBJS = xf86bigfont.o ...@@ -65,8 +65,8 @@ XF86BIGFOBJS = xf86bigfont.o
PNRXINCLUDES = -I../mi -I../render PNRXINCLUDES = -I../mi -I../render
#endif #endif
#if BuildDPMS #if BuildDPMS
DPMSSRCS = dpms.c DPMSSRCS = dpms.c dpmsstubs.c
DPMSOBJS = dpms.o DPMSOBJS = dpms.o dpmsstubs.o
#endif #endif
SRCS = shape.c $(SHMSRCS) xcmisc.c\ SRCS = shape.c $(SHMSRCS) xcmisc.c\
......
...@@ -148,7 +148,7 @@ static int ScreenSaverFreeSuspend( ...@@ -148,7 +148,7 @@ static int ScreenSaverFreeSuspend(
* entry from the per-screen queue. * entry from the per-screen queue.
*/ */
static RESTYPE EventType; /* resource type for event masks */ static RESTYPE SaverEventType; /* resource type for event masks */
typedef struct _ScreenSaverEvent *ScreenSaverEventPtr; typedef struct _ScreenSaverEvent *ScreenSaverEventPtr;
...@@ -256,7 +256,7 @@ ScreenSaverExtensionInit(void) ...@@ -256,7 +256,7 @@ ScreenSaverExtensionInit(void)
ScreenPtr pScreen; ScreenPtr pScreen;
AttrType = CreateNewResourceType(ScreenSaverFreeAttr); AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
EventType = CreateNewResourceType(ScreenSaverFreeEvents); SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents);
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend); SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
ScreenPrivateIndex = AllocateScreenPrivateIndex (); ScreenPrivateIndex = AllocateScreenPrivateIndex ();
...@@ -265,7 +265,7 @@ ScreenSaverExtensionInit(void) ...@@ -265,7 +265,7 @@ ScreenSaverExtensionInit(void)
pScreen = screenInfo.screens[i]; pScreen = screenInfo.screens[i];
SetScreenPrivate (pScreen, NULL); SetScreenPrivate (pScreen, NULL);
} }
if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 && if (AttrType && SaverEventType && SuspendType && ScreenPrivateIndex != -1 &&
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
ProcScreenSaverDispatch, SProcScreenSaverDispatch, ProcScreenSaverDispatch, SProcScreenSaverDispatch,
ScreenSaverResetProc, StandardMinorOpcode))) ScreenSaverResetProc, StandardMinorOpcode)))
...@@ -360,7 +360,7 @@ setEventMask (pScreen, client, mask) ...@@ -360,7 +360,7 @@ setEventMask (pScreen, client, mask)
break; break;
if (mask == 0) if (mask == 0)
{ {
FreeResource (pEv->resource, EventType); FreeResource (pEv->resource, SaverEventType);
*pPrev = pEv->next; *pPrev = pEv->next;
free (pEv); free (pEv);
CheckScreenPrivate (pScreen); CheckScreenPrivate (pScreen);
...@@ -380,7 +380,7 @@ setEventMask (pScreen, client, mask) ...@@ -380,7 +380,7 @@ setEventMask (pScreen, client, mask)
pEv->client = client; pEv->client = client;
pEv->screen = pScreen; pEv->screen = pScreen;
pEv->resource = FakeClientID (client->index); pEv->resource = FakeClientID (client->index);
if (!AddResource (pEv->resource, EventType, (void *) pEv)) if (!AddResource (pEv->resource, SaverEventType, (void *) pEv))
return FALSE; return FALSE;
} }
pEv->mask = mask; pEv->mask = mask;
...@@ -642,10 +642,10 @@ CreateSaverWindow (pScreen) ...@@ -642,10 +642,10 @@ CreateSaverWindow (pScreen)
FreeResource (pWin->drawable.id, RT_NONE); FreeResource (pWin->drawable.id, RT_NONE);
return FALSE; return FALSE;
} }
pAttr->pCursor->refcnt++;
if (pWin->optional->cursor) if (pWin->optional->cursor)
FreeCursor (pWin->optional->cursor, (Cursor)0); FreeCursor (pWin->optional->cursor, (Cursor)0);
pWin->optional->cursor = pAttr->pCursor; pWin->optional->cursor = pAttr->pCursor;
pAttr->pCursor->refcnt++;
pWin->cursorIsNone = FALSE; pWin->cursorIsNone = FALSE;
CheckWindowOptionalNeed (pWin); CheckWindowOptionalNeed (pWin);
mask |= CWCursor; mask |= CWCursor;
......
...@@ -36,6 +36,7 @@ SRCS = \ ...@@ -36,6 +36,7 @@ SRCS = \
devices.c \ devices.c \
dixutils.c \ dixutils.c \
extension.c \ extension.c \
ffs.c \
gc.c \ gc.c \
globals.c \ globals.c \
grabs.c \ grabs.c \
...@@ -58,6 +59,7 @@ OBJS = \ ...@@ -58,6 +59,7 @@ OBJS = \
devices.o \ devices.o \
dixutils.o \ dixutils.o \
extension.o \ extension.o \
ffs.o \
gc.o \ gc.o \
globals.o \ globals.o \
grabs.o \ grabs.o \
......
...@@ -209,7 +209,7 @@ UpdateCurrentTimeIf() ...@@ -209,7 +209,7 @@ UpdateCurrentTimeIf()
systime.milliseconds = GetTimeInMillis(); systime.milliseconds = GetTimeInMillis();
if (systime.milliseconds < currentTime.milliseconds) if (systime.milliseconds < currentTime.milliseconds)
systime.months++; systime.months++;
if (*checkForInput[0] == *checkForInput[1]) if (CompareTimeStamps(systime, currentTime) == LATER)
currentTime = systime; currentTime = systime;
} }
...@@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv) ...@@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv)
} }
int int
#ifdef NXAGENT_SERVER
xorg_InitClientPrivates(ClientPtr client)
#else
InitClientPrivates(ClientPtr client) InitClientPrivates(ClientPtr client)
#endif
{ {
register char *ptr; register char *ptr;
DevUnion *ppriv; DevUnion *ppriv;
...@@ -3960,7 +3956,12 @@ DeleteClientFromAnySelections(ClientPtr client) ...@@ -3960,7 +3956,12 @@ DeleteClientFromAnySelections(ClientPtr client)
SelectionInfoRec info; SelectionInfoRec info;
info.selection = &CurrentSelections[i]; info.selection = &CurrentSelections[i];
#ifdef NXAGENT_SERVER
/* bugfix missing in upstream before introduction of selection.c */
info.kind = SelectionClientClose;
#else
info.kind = SelectionWindowDestroy; info.kind = SelectionWindowDestroy;
#endif
CallCallbacks(&SelectionCallback, &info); CallCallbacks(&SelectionCallback, &info);
} }
CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].pWin = (WindowPtr)NULL;
......
...@@ -1958,9 +1958,12 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths) ...@@ -1958,9 +1958,12 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
return err; return err;
} }
#ifndef NXAGENT_SERVER
int int
#ifdef NXAGENT_SERVER
xorg_SetDefaultFontPath(char *path)
#else
SetDefaultFontPath(char *path) SetDefaultFontPath(char *path)
#endif
{ {
char *temp_path, char *temp_path,
*start, *start,
...@@ -2027,7 +2030,6 @@ SetDefaultFontPath(char *path) ...@@ -2027,7 +2030,6 @@ SetDefaultFontPath(char *path)
return err; return err;
} }
#endif /* NXAGENT_SERVER */
unsigned char * unsigned char *
GetFontPath(int *count, int *length) GetFontPath(int *count, int *length)
......
...@@ -257,7 +257,7 @@ ProcChangeProperty(ClientPtr client) ...@@ -257,7 +257,7 @@ ProcChangeProperty(ClientPtr client)
int int
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
Xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value, int mode, unsigned long len, void * value,
Bool sendevent) Bool sendevent)
#else #else
......
...@@ -63,7 +63,7 @@ Bool nxagentWMIsRunning; ...@@ -63,7 +63,7 @@ Bool nxagentWMIsRunning;
static void startWMDetection(void); static void startWMDetection(void);
static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet); static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet);
#ifdef DEBUG #ifdef DEBUG
static void nxagentPrintAtomMapInfo(char *message); static void nxagentPrintAtomMapInfo(char *message);
...@@ -73,6 +73,10 @@ static void nxagentPrintAtomMapInfo(char *message); ...@@ -73,6 +73,10 @@ static void nxagentPrintAtomMapInfo(char *message);
Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
/*
* Careful! Do not change indices here! Some of those are referenced
* at other places via nxagentAtoms[index].
*/
static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
{ {
"NX_IDENTITY", /* 0 */ "NX_IDENTITY", /* 0 */
...@@ -95,9 +99,8 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = ...@@ -95,9 +99,8 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
content from clients of the real X server to nxagent's clients content from clients of the real X server to nxagent's clients
Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT
because nomachine's nxclient is depending on this because nomachine's nxclient and nxwin are using this
selection */ Atom/selection for communication with the nxagent Atom. */
"TARGETS", /* 6 */ "TARGETS", /* 6 */
/* used to request a list of supported data formats from the /* used to request a list of supported data formats from the
selection owner. Standard ICCCM Atom */ selection owner. Standard ICCCM Atom */
...@@ -365,7 +368,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen) ...@@ -365,7 +368,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen)
typedef struct { typedef struct {
Atom local; Atom local;
XlibAtom remote; XlibAtom remote;
const char *string; char *string;
int length; int length;
} AtomMap; } AtomMap;
...@@ -374,7 +377,7 @@ static unsigned int privAtomMapSize = 0; ...@@ -374,7 +377,7 @@ static unsigned int privAtomMapSize = 0;
static unsigned int privLastAtom = 0; static unsigned int privLastAtom = 0;
static void nxagentExpandCache(void); static void nxagentExpandCache(void);
static void nxagentWriteAtom(Atom, XlibAtom, const char*, Bool); static void nxagentWriteAtom(Atom, XlibAtom, const char*);
static AtomMap* nxagentFindAtomByRemoteValue(XlibAtom); static AtomMap* nxagentFindAtomByRemoteValue(XlibAtom);
static AtomMap* nxagentFindAtomByLocalValue(Atom); static AtomMap* nxagentFindAtomByLocalValue(Atom);
static AtomMap* nxagentFindAtomByName(char*, unsigned); static AtomMap* nxagentFindAtomByName(char*, unsigned);
...@@ -396,19 +399,9 @@ static void nxagentExpandCache(void) ...@@ -396,19 +399,9 @@ static void nxagentExpandCache(void)
* consequent allocation, then cache the atom-couple. * consequent allocation, then cache the atom-couple.
*/ */
static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bool duplicate) static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string)
{ {
const char *s; char *s = strdup(string);
/*
* We could remove this string duplication if we knew for sure that
* the server will not reset, since only at reset the dix layer
* frees all the atom names.
*/
if (duplicate)
{
s = strdup(string);
#ifdef WARNING #ifdef WARNING
if (s == NULL) if (s == NULL)
...@@ -416,11 +409,6 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bo ...@@ -416,11 +409,6 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bo
fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n"); fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n");
} }
#endif #endif
}
else
{
s = string;
}
if (privLastAtom == privAtomMapSize) if (privLastAtom == privAtomMapSize)
{ {
...@@ -436,11 +424,10 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bo ...@@ -436,11 +424,10 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bo
} }
/* /*
* FIXME: We should clean up the atom map at nxagent reset, in order * Clean up the atom map at nxagent reset, in order to cancel all the
* to cancel all the local atoms but still maintaining the Xserver * local atoms but still maintaining the Xserver values and the atom
* values and the atom names. * names. This is called from Dispatch()
*/ */
void nxagentResetAtomMap(void) void nxagentResetAtomMap(void)
{ {
nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering"); nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering");
...@@ -453,14 +440,24 @@ void nxagentResetAtomMap(void) ...@@ -453,14 +440,24 @@ void nxagentResetAtomMap(void)
nxagentPrintAtomMapInfo("nxagentResetAtomMap: Exiting"); nxagentPrintAtomMapInfo("nxagentResetAtomMap: Exiting");
} }
void nxagentFreeAtomMap(void)
{
for (unsigned int i = 0; i < privLastAtom; i++)
{
SAFE_free(privAtomMap[i].string);
}
SAFE_free(privAtomMap);
privLastAtom = privAtomMapSize = 0;
}
/* /*
* Init map. * Init map.
* Initializing the atomNameList all in one. * Initializing the atomNameList all in one.
*/ */
static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
{ {
unsigned int i;
int list_size = count + privLastAtom; int list_size = count + privLastAtom;
nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering"); nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering");
...@@ -470,16 +467,18 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) ...@@ -470,16 +467,18 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
if ((atom_list == NULL) || (name_list == NULL)) if ((atom_list == NULL) || (name_list == NULL))
{ {
SAFE_free(atom_list);
SAFE_free(name_list);
FatalError("nxagentInitAtomMap: malloc failed\n"); FatalError("nxagentInitAtomMap: malloc failed\n");
} }
for (i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
name_list[i] = atomNameList[i]; name_list[i] = atomNameList[i];
atom_list[i] = None; atom_list[i] = None;
} }
for (i = 0; i < privLastAtom; i++) for (unsigned int i = 0; i < privLastAtom; i++)
{ {
name_list[count + i] = (char *)privAtomMap[i].string; name_list[count + i] = (char *)privAtomMap[i].string;
atom_list[count + i] = None; atom_list[count + i] = None;
...@@ -501,10 +500,10 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) ...@@ -501,10 +500,10 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
SAFE_free(atom_list); SAFE_free(atom_list);
SAFE_free(name_list); SAFE_free(name_list);
return 0; return;
} }
for (i = 0; i < list_size; i++) for (unsigned int i = 0; i < list_size; i++)
{ {
AtomMap *aMap = nxagentFindAtomByName(name_list[i], strlen(name_list[i])); AtomMap *aMap = nxagentFindAtomByName(name_list[i], strlen(name_list[i]));
...@@ -514,7 +513,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) ...@@ -514,7 +513,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
if (ValidAtom(local)) if (ValidAtom(local))
{ {
nxagentWriteAtom(local, atom_list[i], name_list[i], False); nxagentWriteAtom(local, atom_list[i], name_list[i]);
} }
else else
{ {
...@@ -544,7 +543,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) ...@@ -544,7 +543,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting"); nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting");
return 1; return;
} }
/* /*
...@@ -609,17 +608,14 @@ static AtomMap* nxagentFindAtomByName(char *string, unsigned int length) ...@@ -609,17 +608,14 @@ static AtomMap* nxagentFindAtomByName(char *string, unsigned int length)
* really asking to X-server and caching them. * really asking to X-server and caching them.
* FIXME: I don't really know if is better to allocate * FIXME: I don't really know if is better to allocate
* an automatic variable like ret_value and write it, instead of make all * an automatic variable like ret_value and write it, instead of make all
* these return!, perhaps this way the code is a little bit easyer to read. * these return!, perhaps this way the code is a little bit easier to read.
* I think this and the 2 .*Find.* are the only functions to look for performances. * I think this and the 2 .*Find.* are the only functions to look for performances.
*/ */
XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
{ {
AtomMap *current;
/* /*
* Surely MakeAtom is faster than * Surely MakeAtom is faster than our nxagentFindAtomByName.
* our nxagentFindAtomByName.
*/ */
Atom local = MakeAtom(string, length, Makeit); Atom local = MakeAtom(string, length, Makeit);
...@@ -634,6 +630,8 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) ...@@ -634,6 +630,8 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
return local; return local;
} }
AtomMap *current;
if ((current = nxagentFindAtomByLocalValue(local))) if ((current = nxagentFindAtomByLocalValue(local)))
{ {
/* /*
...@@ -642,8 +640,7 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) ...@@ -642,8 +640,7 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
return current->remote; return current->remote;
} }
else if ((current = nxagentFindAtomByName(string, length)))
if ((current = nxagentFindAtomByName(string, length)))
{ {
/* /*
* Found cached by name. * Found cached by name.
...@@ -655,27 +652,30 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) ...@@ -655,27 +652,30 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
return current->remote; return current->remote;
} }
else
{
/* /*
* We really have to ask the Xserver for it. * We really have to ask the Xserver for it.
*/ */
{ /* FIXME: why is Makeit inverted here? */
XlibAtom remote = XInternAtom(nxagentDisplay, string, !Makeit); XlibAtom remote = XInternAtom(nxagentDisplay, string, !Makeit);
if (remote == None) if (remote == None)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom failed.\n"); fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom(.., %s, ..) failed.\n", string);
#endif #endif
return None; return None;
} }
else
nxagentWriteAtom(local, remote, string, True); {
nxagentWriteAtom(local, remote, string);
return remote; return remote;
} }
}
} }
XlibAtom nxagentLocalToRemoteAtom(Atom local) XlibAtom nxagentLocalToRemoteAtom(Atom local)
...@@ -692,6 +692,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) ...@@ -692,6 +692,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local)
return None; return None;
} }
/* no mapping required for built-in atoms */
if (local <= XA_LAST_PREDEFINED) if (local <= XA_LAST_PREDEFINED)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -704,14 +705,20 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) ...@@ -704,14 +705,20 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local)
if (current) if (current)
{ {
#ifdef TEST #ifdef DEBUG
if (current->string)
fprintf(stderr, "%s: local [%d] -> remote [%d (%s)]\n", __func__, local, current->remote, current->string);
else
fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote); fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote);
#endif #endif
return current->remote; return current->remote;
} }
else
{
const char *string = NameForAtom(local); const char *string = NameForAtom(local);
/* FIXME: why False? */
XlibAtom remote = XInternAtom(nxagentDisplay, string, False); XlibAtom remote = XInternAtom(nxagentDisplay, string, False);
if (remote == None) if (remote == None)
...@@ -723,13 +730,14 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) ...@@ -723,13 +730,14 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local)
return None; return None;
} }
nxagentWriteAtom(local, remote, string, True); nxagentWriteAtom(local, remote, string);
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: local [%d] -> remote [%d (%s)]\n", __func__, local, remote, string); fprintf(stderr, "%s: local [%d (%s)] -> remote [%d]\n", __func__, local, string, remote);
#endif #endif
return remote; return remote;
}
} }
Atom nxagentRemoteToLocalAtom(XlibAtom remote) Atom nxagentRemoteToLocalAtom(XlibAtom remote)
...@@ -742,6 +750,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) ...@@ -742,6 +750,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote)
return None; return None;
} }
/* no mapping required for built-in atoms */
if (remote <= XA_LAST_PREDEFINED) if (remote <= XA_LAST_PREDEFINED)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -773,11 +782,16 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) ...@@ -773,11 +782,16 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote)
} }
#ifdef DEBUG #ifdef DEBUG
if (current->string)
fprintf(stderr, "%s: remote [%d] -> local [%d (%s)]\n", __func__, remote, current->local, current->string);
else
fprintf(stderr, "%s: remote [%d] -> local [%d]\n", __func__, remote, current->local); fprintf(stderr, "%s: remote [%d] -> local [%d]\n", __func__, remote, current->local);
#endif #endif
return current->local; return current->local;
} }
else
{
char *string = XGetAtomName(nxagentDisplay, remote); char *string = XGetAtomName(nxagentDisplay, remote);
if (string) if (string)
...@@ -793,7 +807,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) ...@@ -793,7 +807,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote)
local = None; local = None;
} }
nxagentWriteAtom(local, remote, string, True); nxagentWriteAtom(local, remote, string);
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local);
...@@ -808,6 +822,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) ...@@ -808,6 +822,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote)
#endif #endif
return None; return None;
}
} }
#ifdef DEBUG #ifdef DEBUG
......
...@@ -37,22 +37,22 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; ...@@ -37,22 +37,22 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
extern Bool nxagentWMIsRunning; extern Bool nxagentWMIsRunning;
/* /*
* Create the required atoms internally * Create the required atoms internally to the agent server.
* to the agent server.
*/ */
void nxagentInitAtoms(); void nxagentInitAtoms();
/* /*
* Query and create all the required atoms * Query and create all the required atoms on the remote X server
* on the remote X server using a single * using a single round trip.
* round trip.
*/ */
int nxagentQueryAtoms(ScreenPtr pScreen); int nxagentQueryAtoms(ScreenPtr pScreen);
void nxagentResetAtomMap(void); void nxagentResetAtomMap(void);
void nxagentFreeAtomMap(void);
void nxagentWMDetect(void); void nxagentWMDetect(void);
#ifdef XlibAtom #ifdef XlibAtom
...@@ -71,8 +71,7 @@ void nxagentWMDetect(void); ...@@ -71,8 +71,7 @@ void nxagentWMDetect(void);
XlibAtom nxagentMakeAtom(char *, unsigned, Bool); XlibAtom nxagentMakeAtom(char *, unsigned, Bool);
/* /*
* Converts local atoms in remote atoms and * Converts local atoms in remote atoms and viceversa.
* viceversa.
*/ */
Atom nxagentRemoteToLocalAtom(XlibAtom); Atom nxagentRemoteToLocalAtom(XlibAtom);
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "Events.h" #include "Events.h"
#include "Drawable.h" #include "Drawable.h"
#include "Utils.h" #include "Utils.h"
#include "Clipboard.h"
/* /*
* Need to include this after the stub definition of GC in Agent.h. * Need to include this after the stub definition of GC in Agent.h.
...@@ -68,6 +69,11 @@ ...@@ -68,6 +69,11 @@
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args);
static void initClientPrivates(ClientPtr client);
static void freeClientPrivates(ClientPtr client);
static void checkIfShadowAgent(ClientPtr client);
/* /*
* Returns the last signal delivered to the process. * Returns the last signal delivered to the process.
*/ */
...@@ -106,13 +112,139 @@ int nxagentClientPrivateIndex; ...@@ -106,13 +112,139 @@ int nxagentClientPrivateIndex;
int nxagentShadowCounter = 0; int nxagentShadowCounter = 0;
void nxagentInitClientPrivates(ClientPtr client) /*
* For the serverclient the ClientStateCallback will not be called on
* shutdown resulting in memory allocated during initClientPrivates can
* not be freed automatically. So instead of allocating some memory we
* create a static string for the serverclient.
*/
static char *serverclientInfoString = "[0] (serverclient)";
/*
* called whenever the client state changes. See dixstruct.h for a
* list of known states.
*/
#ifdef DEBUG
const char * getClientStateString(int state)
{
switch (state)
{
case ClientStateInitial: { return "Initial"; break; };
case ClientStateAuthenticating: { return "Authenticating"; break; };
case ClientStateRunning: { return "Running"; break; };
case ClientStateRetained: { return "Retained"; break; };
case ClientStateGone: { return "Gone"; break; };
case ClientStateCheckingSecurity: { return "CheckingSecurity"; break; };
case ClientStateCheckedSecurity: { return "CheckedSecurity"; break; };
default: { return "UNKNOWN"; break; };
}
}
#endif
void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args)
{
ClientPtr client = ((NewClientInfoRec *)args)->client;
#ifdef DEBUG
fprintf(stderr, "%s: client [%d] clientState [%s]\n", __func__, client->index,
getClientStateString(client->clientState));
#endif
switch(client->clientState)
{
case ClientStateInitial:
{
initClientPrivates(client);
break;
}
case ClientStateGone:
{
nxagentClearClipboard(client, NULL);
/*
* Check if the client is a shadow nxagent.
*/
checkIfShadowAgent(client);
freeClientPrivates(client);
break;
}
default:
{
break;
}
}
}
static void initClientPrivates(ClientPtr client)
{
#ifdef DEBUG
fprintf(stderr, "%s: called\n", __func__);
#endif
if (nxagentClientPriv(client))
{
nxagentClientPriv(client) -> clientState = 0;
#ifdef COUNT_CLIENT_BYTES
nxagentClientPriv(client) -> clientBytes = 0;
#endif
nxagentClientPriv(client) -> clientHint = UNKNOWN;
nxagentClientPriv(client) -> clientInfoString = NULL;
char *s = NULL;
int size = 0;
if (client->index == 0)
{
s = serverclientInfoString;
}
else
{
#ifdef CLIENTIDS
size = asprintf(&s, "[%d] (addr [%p] PID [%d] Cmd [%s])",
client->index, (void *)client,
GetClientPid(client),
GetClientCmdName(client));
#else
size = asprintf(&s, "[%d] (addr [%p])",
client->index, (void *)client);
#endif
}
if (size != -1)
{
#ifdef DEBUG
fprintf(stderr, "%s: clientInfoString: \"%s\"\n", __func__, s);
#endif
nxagentClientPriv(client) -> clientInfoString = s;
}
else
{
#ifdef DEBUG
fprintf(stderr, "%s: could not alloc clientInfoString\n", __func__);
#endif
}
}
}
static void freeClientPrivates(ClientPtr client)
{ {
#ifdef DEBUG
fprintf(stderr, "%s: called\n", __func__);
#endif
if (nxagentClientPriv(client)) if (nxagentClientPriv(client))
{ {
nxagentClientPriv(client) -> clientState = 0; nxagentClientPriv(client) -> clientState = 0;
#ifdef COUNT_CLIENT_BYTES
nxagentClientPriv(client) -> clientBytes = 0; nxagentClientPriv(client) -> clientBytes = 0;
#endif
nxagentClientPriv(client) -> clientHint = UNKNOWN; nxagentClientPriv(client) -> clientHint = UNKNOWN;
if (client->index != 0)
SAFE_free(nxagentClientPriv(client) -> clientInfoString);
} }
} }
...@@ -128,7 +260,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) ...@@ -128,7 +260,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data)
client -> index, validateString(NameForAtom(property)), validateString(data)); client -> index, validateString(NameForAtom(property)), validateString(data));
#endif #endif
if (nxagentClientPriv(client) -> clientHint == UNKNOWN) if (nxagentClientHint(client) == UNKNOWN)
{ {
if (property == XA_WM_CLASS) if (property == XA_WM_CLASS)
{ {
...@@ -151,7 +283,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) ...@@ -151,7 +283,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data)
} }
} }
if (nxagentClientPriv(client) -> clientHint == NXCLIENT_WINDOW) if (nxagentClientHint(client) == NXCLIENT_WINDOW)
{ {
if (property == MakeAtom("WM_WINDOW_ROLE", 14, True) && if (property == MakeAtom("WM_WINDOW_ROLE", 14, True) &&
strncmp(data, "msgBox", 6) == 0) strncmp(data, "msgBox", 6) == 0)
...@@ -173,7 +305,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) ...@@ -173,7 +305,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
validateString(NameForAtom(property))); validateString(NameForAtom(property)));
#endif #endif
if (nxagentClientPriv(client) -> clientHint == UNKNOWN) if (nxagentClientHint(client) == UNKNOWN)
{ {
if (strcmp(validateString(NameForAtom(property)), "_NX_SHADOW") == 0) if (strcmp(validateString(NameForAtom(property)), "_NX_SHADOW") == 0)
{ {
...@@ -205,9 +337,9 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) ...@@ -205,9 +337,9 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
} }
} }
void nxagentCheckIfShadowAgent(ClientPtr client) static void checkIfShadowAgent(ClientPtr client)
{ {
if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW) if (nxagentClientHint(client) == NXAGENT_SHADOW)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n", fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n",
...@@ -284,6 +416,7 @@ void nxagentWakeupByReset(ClientPtr client) ...@@ -284,6 +416,7 @@ void nxagentWakeupByReset(ClientPtr client)
} }
} }
#ifdef COUNT_CLIENT_BYTES
if (client -> index < MAX_CONNECTIONS) if (client -> index < MAX_CONNECTIONS)
{ {
#ifdef TEST #ifdef TEST
...@@ -293,6 +426,7 @@ void nxagentWakeupByReset(ClientPtr client) ...@@ -293,6 +426,7 @@ void nxagentWakeupByReset(ClientPtr client)
nxagentClientBytes(client) = 0; nxagentClientBytes(client) = 0;
} }
#endif
} }
/* /*
......
...@@ -49,7 +49,7 @@ typedef struct _PrivClientRec ...@@ -49,7 +49,7 @@ typedef struct _PrivClientRec
int clientState; int clientState;
long clientBytes; long clientBytes;
enum ClientHint clientHint; enum ClientHint clientHint;
char *clientInfoString;
} PrivClientRec; } PrivClientRec;
extern int nxagentClientPrivateIndex; extern int nxagentClientPrivateIndex;
...@@ -57,13 +57,17 @@ extern int nxagentClientPrivateIndex; ...@@ -57,13 +57,17 @@ extern int nxagentClientPrivateIndex;
#define nxagentClientPriv(pClient) \ #define nxagentClientPriv(pClient) \
((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr)) ((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr))
void nxagentInitClientPrivates(ClientPtr); extern void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args);
#undef COUNT_CLIENT_BYTES
#ifdef COUNT_CLIENT_BYTES
#define nxagentClientAddBytes(pClient, size) \ #define nxagentClientAddBytes(pClient, size) \
(nxagentClientPriv(pClient) -> clientBytes += (size)) (nxagentClientPriv(pClient) -> clientBytes += (size))
#define nxagentClientBytes(pClient) \ #define nxagentClientBytes(pClient) \
(nxagentClientPriv(pClient) -> clientBytes) (nxagentClientPriv(pClient) -> clientBytes)
#endif
#define nxagentClientHint(pClient) \ #define nxagentClientHint(pClient) \
(nxagentClientPriv(pClient) -> clientHint) (nxagentClientPriv(pClient) -> clientHint)
...@@ -71,9 +75,11 @@ void nxagentInitClientPrivates(ClientPtr); ...@@ -71,9 +75,11 @@ void nxagentInitClientPrivates(ClientPtr);
#define nxagentClientIsDialog(pClient) \ #define nxagentClientIsDialog(pClient) \
(nxagentClientHint(pClient) == NXCLIENT_DIALOG) (nxagentClientHint(pClient) == NXCLIENT_DIALOG)
#define nxagentClientInfoString(pClient) \
(nxagentClientPriv(pClient) -> clientInfoString)
/* /*
* The actual reason why the client * The actual reason why the client is sleeping.
* is sleeping.
*/ */
#define SleepingBySplit 1 #define SleepingBySplit 1
...@@ -90,19 +96,15 @@ void nxagentGuessClientHint(ClientPtr, Atom, char*); ...@@ -90,19 +96,15 @@ void nxagentGuessClientHint(ClientPtr, Atom, char*);
void nxagentGuessShadowHint(ClientPtr, Atom); void nxagentGuessShadowHint(ClientPtr, Atom);
void nxagentCheckIfShadowAgent(ClientPtr);
/* /*
* Suspend or restart the agent's * Suspend or restart the agent's client.
* client.
*/ */
int nxagentSuspendBySplit(ClientPtr client); int nxagentSuspendBySplit(ClientPtr client);
int nxagentWakeupBySplit(ClientPtr client); int nxagentWakeupBySplit(ClientPtr client);
/* /*
* Wait until the given client is * Wait until the given client is restarted.
* restarted.
*/ */
void nxagentWaitWakeupBySplit(ClientPtr client); void nxagentWaitWakeupBySplit(ClientPtr client);
...@@ -119,8 +121,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable); ...@@ -119,8 +121,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable);
void nxagentWakeupByReconnect(void); void nxagentWakeupByReconnect(void);
/* /*
* Reset the client state before * Reset the client state before closing it down.
* closing it down.
*/ */
void nxagentWakeupByReset(ClientPtr client); void nxagentWakeupByReset(ClientPtr client);
......
...@@ -96,7 +96,7 @@ typedef struct _SelectionOwner ...@@ -96,7 +96,7 @@ typedef struct _SelectionOwner
* external atom of the selection * external atom of the selection
*/ */
static SelectionOwner *lastSelectionOwner; static SelectionOwner *lastSelectionOwner;
static XlibAtom nxagentLastRequestedSelection; static XlibAtom serverLastRequestedSelection;
#define IS_INTERNAL_OWNER(lsoindex) (lastSelectionOwner[lsoindex].client != NULL) #define IS_INTERNAL_OWNER(lsoindex) (lastSelectionOwner[lsoindex].client != NULL)
...@@ -169,7 +169,7 @@ static char szAgentCLIPBOARD[] = "CLIPBOARD"; ...@@ -169,7 +169,7 @@ static char szAgentCLIPBOARD[] = "CLIPBOARD";
*/ */
#ifdef DEBUG #ifdef DEBUG
const char * GetClientSelectionStageString(int stage) static const char * getClientSelectionStageString(int stage)
{ {
switch(stage) switch(stage)
{ {
...@@ -181,21 +181,23 @@ const char * GetClientSelectionStageString(int stage) ...@@ -181,21 +181,23 @@ const char * GetClientSelectionStageString(int stage)
default: return("UNKNOWN!"); break;; default: return("UNKNOWN!"); break;;
} }
} }
#define SetClientSelectionStage(stage) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, GetClientSelectionStageString(lastClientStage), GetClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0) #define setClientSelectionStage(stage) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, getClientSelectionStageString(lastClientStage), getClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0)
#define PrintClientSelectionStage() do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, GetClientSelectionStageString(lastClientStage));} while (0) #define printClientSelectionStage() do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, getClientSelectionStageString(lastClientStage));} while (0)
#define WINDOWID(ptr) (ptr) ? (ptr->drawable.id) : 0 #define WINDOWID(ptr) (ptr) ? (ptr->drawable.id) : 0
#define CLINDEX(clientptr) (clientptr) ? (clientptr->index) : -1 #define CLINDEX(clientptr) (clientptr) ? (clientptr->index) : -1
#else #else
#define SetClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0) #define setClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0)
#define PrintClientSelectionStage() #define printClientSelectionStage()
#endif
#ifdef DEBUG
/* /*
* see also nx-X11/lib/src/ErrDes.c * see also nx-X11/lib/src/ErrDes.c
* *
* We use our own version to avoid Xlib doing expensive calls. * We use our own version to avoid Xlib doing expensive calls.
* FIXME: Must check if XGetErrorText() is really causing traffic over the wire. * FIXME: Must check if XGetErrorText() is really causing traffic over the wire.
*/ */
const char * GetXErrorString(int code) const char * getXErrorString(int code)
{ {
switch(code) switch(code)
{ {
...@@ -230,17 +232,34 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 }; ...@@ -230,17 +232,34 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 };
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
Bool nxagentValidServerTargets(XlibAtom target); static Bool validServerTargets(XlibAtom target);
static void endTransfer(Bool success); static void endTransfer(Bool success);
#define SELECTION_SUCCESS True #define SELECTION_SUCCESS True
#define SELECTION_FAULT False #define SELECTION_FAULT False
void nxagentTransferSelection(int resource); static void transferSelection(int resource);
void nxagentCollectPropertyEvent(int resource); #if 0
void nxagentResetSelectionOwner(void); static void resetSelectionOwner(void);
WindowPtr nxagentGetClipboardWindow(Atom property); #endif
void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, static void initSelectionOwner(int index, Atom selection);
static void clearSelectionOwner(int index);
static void storeSelectionOwner(int index, Selection *sel);
static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow);
static void notifyConvertFailure(ClientPtr client, Window requestor,
Atom selection, Atom target, Time time); Atom selection, Atom target, Time time);
int nxagentSendNotify(xEvent *event); static void setSelectionOwner(Selection *pSelection);
static int sendEventToClient(ClientPtr client, xEvent *pEvents);
static int sendSelectionNotifyEventToClient(ClientPtr client,
Time time,
Window requestor,
Atom selection,
Atom target,
Atom property);
static Status sendSelectionNotifyEventToServer(XSelectionEvent *event_to_send);
#ifdef DEBUG
static void printSelectionStat(int sel);
#endif
static void replyRequestSelection(XEvent *X, Bool success);
void nxagentPrintClipboardStat(char *); void nxagentPrintClipboardStat(char *);
...@@ -249,12 +268,13 @@ extern unsigned long startTime; ...@@ -249,12 +268,13 @@ extern unsigned long startTime;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
void nxagentPrintSelectionStat(int sel) static void printSelectionStat(int sel)
{ {
SelectionOwner lOwner = lastSelectionOwner[sel]; SelectionOwner lOwner = lastSelectionOwner[sel];
Selection curSel = CurrentSelections[sel]; Selection curSel = CurrentSelections[sel];
char *s = NULL; char *s = NULL;
fprintf(stderr, " owner is inside nxagent? %s\n", IS_INTERNAL_OWNER(sel) ? "yes" : "no");
#ifdef CLIENTIDS #ifdef CLIENTIDS
fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n", fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n",
(void *)lOwner.client, (void *)lOwner.client,
...@@ -274,18 +294,11 @@ void nxagentPrintSelectionStat(int sel) ...@@ -274,18 +294,11 @@ void nxagentPrintSelectionStat(int sel)
fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lOwner.lastTimeChanged); fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lOwner.lastTimeChanged);
/* /*
print the selection name. print the selection name. selection is _always_ a a remote Atom!
*/ */
if (lOwner.client)
{
fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (local)\n", lOwner.selection, NameForAtom(lOwner.selection));
}
else
{
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection);
fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (remote)\n", lOwner.selection, validateString(s)); fprintf(stderr, " lastSelectionOwner[].selection [% 4ld][%s] (%s)\n", lOwner.selection, validateString(s), lOwner.client ? "inside nxagent" : "remote X server");
SAFE_XFree(s); SAFE_XFree(s);
}
#ifdef CLIENTIDS #ifdef CLIENTIDS
fprintf(stderr, " CurrentSelections[].client [%p] index [%d] PID [%d] Cmd [%s]\n", fprintf(stderr, " CurrentSelections[].client [%p] index [%d] PID [%d] Cmd [%s]\n",
(void *)curSel.client, (void *)curSel.client,
...@@ -331,9 +344,9 @@ void nxagentPrintClipboardStat(char *header) ...@@ -331,9 +344,9 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, "lastServer\n"); fprintf(stderr, "lastServer\n");
fprintf(stderr, " lastServerRequestor (Window) [0x%x]\n", lastServerRequestor); fprintf(stderr, " lastServerRequestor (Window) [0x%x]\n", lastServerRequestor);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerProperty); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerProperty);
fprintf(stderr, " lastServerProperty (Atom) [% 4d][%s]\n", lastServerProperty, s); fprintf(stderr, " lastServerProperty (Atom) [% 4ld][%s]\n", lastServerProperty, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerTarget); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerTarget);
fprintf(stderr, " lastServerTarget (Atom) [% 4d][%s]\n", lastServerTarget, s); fprintf(stderr, " lastServerTarget (Atom) [% 4ld][%s]\n", lastServerTarget, validateString(s));
fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime); fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime);
fprintf(stderr, "lastClient\n"); fprintf(stderr, "lastClient\n");
...@@ -349,29 +362,30 @@ void nxagentPrintClipboardStat(char *header) ...@@ -349,29 +362,30 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, " lastClientTime (Time) [%u]\n", lastClientTime); fprintf(stderr, " lastClientTime (Time) [%u]\n", lastClientTime);
fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastClientReqTime); fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastClientReqTime);
fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize); fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize);
fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage)); fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, getClientSelectionStageString(lastClientStage));
fprintf(stderr, "PRIMARY\n"); fprintf(stderr, "PRIMARY\n");
nxagentPrintSelectionStat(nxagentPrimarySelection); printSelectionStat(nxagentPrimarySelection);
fprintf(stderr, "CLIPBOARD\n"); fprintf(stderr, "CLIPBOARD\n");
nxagentPrintSelectionStat(nxagentClipboardSelection); printSelectionStat(nxagentClipboardSelection);
fprintf(stderr, "Atoms (server side)\n"); fprintf(stderr, "Atoms (remote X server)\n");
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS);
fprintf(stderr, " serverTARGETS [% 4d][%s]\n", serverTARGETS, validateString(s)); fprintf(stderr, " serverTARGETS [% 4ld][%s]\n", serverTARGETS, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP);
fprintf(stderr, " serverTIMESTAMP [% 4ld][%s]\n", serverTIMESTAMP, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT);
fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, s); fprintf(stderr, " serverTEXT [% 4ld][%s]\n", serverTEXT, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCOMPOUND_TEXT); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCOMPOUND_TEXT);
fprintf(stderr, " serverCOMPOUND_TEXT [% d][%s]\n", serverCOMPOUND_TEXT, s); fprintf(stderr, " serverCOMPOUND_TEXT [% 4ld][%s]\n", serverCOMPOUND_TEXT, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING);
fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s); fprintf(stderr, " serverUTF8_STRING [% 4ld][%s]\n", serverUTF8_STRING, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty);
fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, s); fprintf(stderr, " serverTransToAgentProperty [% 4ld][%s]\n", serverTransFromAgentProperty, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty);
fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, s); fprintf(stderr, " serverTransFromAgentProperty [% 4ld][%s]\n", serverTransToAgentProperty, validateString(s));
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverLastRequestedSelection);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); fprintf(stderr, " serverLastRequestedSelection [% 4ld][%s]\n", serverLastRequestedSelection, validateString(s));
fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s);
fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, "Atoms (inside nxagent)\n");
fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS));
...@@ -381,7 +395,6 @@ void nxagentPrintClipboardStat(char *header) ...@@ -381,7 +395,6 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, " clientUTF8_STRING [% 4d][%s]\n", clientUTF8_STRING, NameForAtom(clientUTF8_STRING)); fprintf(stderr, " clientUTF8_STRING [% 4d][%s]\n", clientUTF8_STRING, NameForAtom(clientUTF8_STRING));
fprintf(stderr, " clientCLIPBOARD [% 4d][%s]\n", clientCLIPBOARD, NameForAtom(clientCLIPBOARD)); fprintf(stderr, " clientCLIPBOARD [% 4d][%s]\n", clientCLIPBOARD, NameForAtom(clientCLIPBOARD));
fprintf(stderr, " clientCutProperty [% 4d][%s]\n", clientCutProperty, NameForAtom(clientCutProperty)); fprintf(stderr, " clientCutProperty [% 4d][%s]\n", clientCutProperty, NameForAtom(clientCutProperty));
fprintf(stderr, " nxagentLastRequestedSelection [% 4d][%s]\n", nxagentLastRequestedSelection, NameForAtom(nxagentLastRequestedSelection));
fprintf(stderr, "\\------------------------------------------------------------------------------\n"); fprintf(stderr, "\\------------------------------------------------------------------------------\n");
...@@ -402,7 +415,7 @@ int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset, long longL ...@@ -402,7 +415,7 @@ int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset, long longL
* Send a SelectionNotify event to the real X server and do some error * Send a SelectionNotify event to the real X server and do some error
* handling (in DEBUG mode) * handling (in DEBUG mode)
*/ */
Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) static Status sendSelectionNotifyEventToServer(XSelectionEvent *event_to_send)
{ {
Window w = event_to_send->requestor; Window w = event_to_send->requestor;
...@@ -426,7 +439,7 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) ...@@ -426,7 +439,7 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send)
{ {
if (result == BadValue || result == BadWindow) if (result == BadValue || result == BadWindow)
{ {
fprintf(stderr, "%s: WARNING! XSendEvent to [0x%x] failed: %s\n", __func__, w, GetXErrorString(result)); fprintf(stderr, "%s: WARNING! XSendEvent to [0x%x] failed: %s\n", __func__, w, getXErrorString(result));
} }
else else
{ {
...@@ -440,12 +453,12 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) ...@@ -440,12 +453,12 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send)
return result; return result;
} }
int SendEventToClient(ClientPtr client, xEvent *pEvents) static int sendEventToClient(ClientPtr client, xEvent *pEvents)
{ {
return TryClientEvents (client, pEvents, 1, NoEventMask, NoEventMask, NullGrab); return TryClientEvents(client, pEvents, 1, NoEventMask, NoEventMask, NullGrab);
} }
int SendSelectionNotifyEventToClient(ClientPtr client, static int sendSelectionNotifyEventToClient(ClientPtr client,
Time time, Time time,
Window requestor, Window requestor,
Atom selection, Atom selection,
...@@ -469,7 +482,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client, ...@@ -469,7 +482,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client,
CLINDEX(client)); CLINDEX(client));
#endif #endif
return SendEventToClient(client, &x); return sendEventToClient(client, &x);
} }
/* /*
...@@ -477,7 +490,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client, ...@@ -477,7 +490,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client,
* server, like .e.g XA_STRING or UTF8_STRING. Other, non content type * server, like .e.g XA_STRING or UTF8_STRING. Other, non content type
* targets like "TARGETS" or "TIMESTAMP" will return false. * targets like "TARGETS" or "TIMESTAMP" will return false.
*/ */
Bool nxagentValidServerTargets(XlibAtom target) static Bool validServerTargets(XlibAtom target)
{ {
if (target == XA_STRING) if (target == XA_STRING)
{ {
...@@ -524,12 +537,12 @@ Bool nxagentValidServerTargets(XlibAtom target) ...@@ -524,12 +537,12 @@ Bool nxagentValidServerTargets(XlibAtom target)
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: invalid target [%u].\n", __func__, target); fprintf(stderr, "%s: invalid target [%lu].\n", __func__, target);
#endif #endif
return False; return False;
} }
void nxagentInitSelectionOwner(int index, Atom selection) static void initSelectionOwner(int index, Atom selection)
{ {
lastSelectionOwner[index].selection = selection; lastSelectionOwner[index].selection = selection;
lastSelectionOwner[index].client = NullClient; lastSelectionOwner[index].client = NullClient;
...@@ -539,15 +552,15 @@ void nxagentInitSelectionOwner(int index, Atom selection) ...@@ -539,15 +552,15 @@ void nxagentInitSelectionOwner(int index, Atom selection)
} }
/* there's no owner on nxagent side anymore */ /* there's no owner on nxagent side anymore */
void nxagentClearSelectionOwner(int index) static void clearSelectionOwner(int index)
{ {
lastSelectionOwner[index].client = NULL; lastSelectionOwner[index].client = NULL;
lastSelectionOwner[index].window = None; lastSelectionOwner[index].window = None;
lastSelectionOwner[index].windowPtr = NULL;
lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
/* FIXME: why is windowPtr not cleared in the function? */
} }
void nxagentStoreSelectionOwner(int index, Selection *sel) static void storeSelectionOwner(int index, Selection *sel)
{ {
lastSelectionOwner[index].client = sel->client; lastSelectionOwner[index].client = sel->client;
lastSelectionOwner[index].window = sel->window; lastSelectionOwner[index].window = sel->window;
...@@ -555,7 +568,7 @@ void nxagentStoreSelectionOwner(int index, Selection *sel) ...@@ -555,7 +568,7 @@ void nxagentStoreSelectionOwner(int index, Selection *sel)
lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
} }
Bool nxagentMatchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow) static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow)
{ {
return ((pClient && lastSelectionOwner[index].client == pClient) || return ((pClient && lastSelectionOwner[index].client == pClient) ||
(pWindow && lastSelectionOwner[index].windowPtr == pWindow)); (pWindow && lastSelectionOwner[index].windowPtr == pWindow));
...@@ -576,19 +589,17 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) ...@@ -576,19 +589,17 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
for (int i = 0; i < nxagentMaxSelections; i++) for (int i = 0; i < nxagentMaxSelections; i++)
{ {
if (nxagentMatchSelectionOwner(i, pClient, pWindow)) if (matchSelectionOwner(i, pClient, pWindow))
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__, fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__,
(void *) pClient, (void *) pWindow); (void *) pClient, (void *) pWindow);
#endif #endif
/* FIXME: why is windowPtr not cleared in the function? */ clearSelectionOwner(i);
nxagentClearSelectionOwner(i);
lastSelectionOwner[i].windowPtr = NULL;
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
lastServerRequestor = None; lastServerRequestor = None;
} }
...@@ -597,7 +608,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) ...@@ -597,7 +608,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
if (pWindow && pWindow == lastClientWindowPtr) if (pWindow && pWindow == lastClientWindowPtr)
{ {
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
} }
nxagentPrintClipboardStat("after nxagentClearClipboard"); nxagentPrintClipboardStat("after nxagentClearClipboard");
...@@ -638,13 +649,13 @@ int nxagentFindCurrentSelectionIndex(Atom sel) ...@@ -638,13 +649,13 @@ int nxagentFindCurrentSelectionIndex(Atom sel)
* SelectionClear event. We receive this event if someone on the real * SelectionClear event. We receive this event if someone on the real
* X server claims the selection ownership. * X server claims the selection ownership.
*/ */
void nxagentClearSelection(XEvent *X) void nxagentHandleSelectionClearFromXServer(XEvent *X)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: SelectionClear event for selection [%lu].\n", __func__, X->xselectionclear.selection); fprintf(stderr, "%s: SelectionClear event for selection [%lu].\n", __func__, X->xselectionclear.selection);
#endif #endif
nxagentPrintClipboardStat("before nxagentClearSelection"); nxagentPrintClipboardStat("before nxagentHandleSelectionClearFromXServer");
if (!agentClipboardInitialized) if (!agentClipboardInitialized)
{ {
...@@ -674,7 +685,7 @@ void nxagentClearSelection(XEvent *X) ...@@ -674,7 +685,7 @@ void nxagentClearSelection(XEvent *X)
x.u.selectionClear.window = lastSelectionOwner[i].window; x.u.selectionClear.window = lastSelectionOwner[i].window;
x.u.selectionClear.atom = CurrentSelections[i].selection; x.u.selectionClear.atom = CurrentSelections[i].selection;
SendEventToClient(lastSelectionOwner[i].client, &x); sendEventToClient(lastSelectionOwner[i].client, &x);
} }
/* /*
...@@ -685,12 +696,12 @@ void nxagentClearSelection(XEvent *X) ...@@ -685,12 +696,12 @@ void nxagentClearSelection(XEvent *X)
CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[i].client = NullClient; CurrentSelections[i].client = NullClient;
nxagentClearSelectionOwner(i); clearSelectionOwner(i);
} }
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
nxagentPrintClipboardStat("after nxagentClearSelection"); nxagentPrintClipboardStat("after nxagentHandleSelectionClearFromXServer");
} }
/* /*
...@@ -698,7 +709,7 @@ void nxagentClearSelection(XEvent *X) ...@@ -698,7 +709,7 @@ void nxagentClearSelection(XEvent *X)
* event X. If success is True take the property from the event, else * event X. If success is True take the property from the event, else
* take None (which reports "failed/denied" to the requestor). * take None (which reports "failed/denied" to the requestor).
*/ */
void nxagentReplyRequestSelection(XEvent *X, Bool success) static void replyRequestSelection(XEvent *X, Bool success)
{ {
XSelectionEvent eventSelection = { XSelectionEvent eventSelection = {
.requestor = X->xselectionrequest.requestor, .requestor = X->xselectionrequest.requestor,
...@@ -716,7 +727,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) ...@@ -716,7 +727,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success)
eventSelection.property = None; eventSelection.property = None;
} }
SendSelectionNotifyEventToServer(&eventSelection); sendSelectionNotifyEventToServer(&eventSelection);
} }
/* /*
...@@ -726,7 +737,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) ...@@ -726,7 +737,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success)
* as selection owner. But in reality one of our windows is the owner, * as selection owner. But in reality one of our windows is the owner,
* so we must pass the request on to the real owner. * so we must pass the request on to the real owner.
*/ */
void nxagentRequestSelection(XEvent *X) void nxagentHandleSelectionRequestFromXServer(XEvent *X)
{ {
#ifdef DEBUG #ifdef DEBUG
{ {
...@@ -749,7 +760,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -749,7 +760,7 @@ void nxagentRequestSelection(XEvent *X)
} }
#endif #endif
nxagentPrintClipboardStat("before nxagentRequestSelection"); nxagentPrintClipboardStat("before nxagentHandleSelectionRequestFromXServer");
if (!agentClipboardInitialized) if (!agentClipboardInitialized)
{ {
...@@ -766,7 +777,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -766,7 +777,7 @@ void nxagentRequestSelection(XEvent *X)
fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__); fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__);
#endif #endif
nxagentReplyRequestSelection(X, False); replyRequestSelection(X, False);
return; return;
} }
...@@ -779,13 +790,13 @@ void nxagentRequestSelection(XEvent *X) ...@@ -779,13 +790,13 @@ void nxagentRequestSelection(XEvent *X)
fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection); fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection);
#endif #endif
nxagentReplyRequestSelection(X, False); replyRequestSelection(X, False);
return; return;
} }
} }
/* this is a special request like TARGETS or TIMESTAMP */ /* this is a special request like TARGETS or TIMESTAMP */
if (!nxagentValidServerTargets(X->xselectionrequest.target)) if (!validServerTargets(X->xselectionrequest.target))
{ {
if (X->xselectionrequest.target == serverTARGETS) if (X->xselectionrequest.target == serverTARGETS)
{ {
...@@ -800,7 +811,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -800,7 +811,7 @@ void nxagentRequestSelection(XEvent *X)
* *
* FIXME: the perfect solution should not just answer with * FIXME: the perfect solution should not just answer with
* XA_STRING but ask the real owner what format it supports. The * XA_STRING but ask the real owner what format it supports. The
* should then be sent to the original requestor. * result should then be sent to the original requestor.
*/ */
long targets[] = {XA_STRING, serverUTF8_STRING, serverTEXT, serverCOMPOUND_TEXT, serverTARGETS, serverTIMESTAMP}; long targets[] = {XA_STRING, serverUTF8_STRING, serverTEXT, serverCOMPOUND_TEXT, serverTARGETS, serverTIMESTAMP};
...@@ -832,7 +843,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -832,7 +843,7 @@ void nxagentRequestSelection(XEvent *X)
(unsigned char*)&targets, (unsigned char*)&targets,
numTargets); numTargets);
nxagentReplyRequestSelection(X, True); replyRequestSelection(X, True);
} }
else if (X->xselectionrequest.target == serverTIMESTAMP) else if (X->xselectionrequest.target == serverTIMESTAMP)
{ {
...@@ -861,19 +872,19 @@ void nxagentRequestSelection(XEvent *X) ...@@ -861,19 +872,19 @@ void nxagentRequestSelection(XEvent *X)
PropModeReplace, PropModeReplace,
(unsigned char *) &lastSelectionOwner[i].lastTimeChanged, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged,
1); 1);
nxagentReplyRequestSelection(X, True); replyRequestSelection(X, True);
} }
} }
else else
{ {
/* /*
* unknown special request - probably bug! Check if this code handles all cases * unknown special request - probably bug! Check if this code handles all cases
* that are handled in nxagentValidServerTargets! * that are handled in validServerTargets!
*/ */
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: unknown special target [%ld] - denying request.\n", __func__, X->xselectionrequest.target); fprintf(stderr, "%s: unknown special target [%ld] - denying request.\n", __func__, X->xselectionrequest.target);
#endif #endif
nxagentReplyRequestSelection(X, False); replyRequestSelection(X, False);
} }
return; return;
} }
...@@ -886,7 +897,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -886,7 +897,7 @@ void nxagentRequestSelection(XEvent *X)
/* /*
* This is required for nxagentGetClipboardWindow. * This is required for nxagentGetClipboardWindow.
*/ */
nxagentLastRequestedSelection = X->xselectionrequest.selection; serverLastRequestedSelection = X->xselectionrequest.selection;
/* find the index of the requested selection */ /* find the index of the requested selection */
int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection); int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection);
...@@ -955,7 +966,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -955,7 +966,7 @@ void nxagentRequestSelection(XEvent *X)
else else
x.u.selectionRequest.target = XA_STRING; x.u.selectionRequest.target = XA_STRING;
SendEventToClient(lastSelectionOwner[i].client, &x); sendEventToClient(lastSelectionOwner[i].client, &x);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: sent SelectionRequest event to client [%d] property [%d][%s]" \ fprintf(stderr, "%s: sent SelectionRequest event to client [%d] property [%d][%s]" \
...@@ -969,11 +980,11 @@ void nxagentRequestSelection(XEvent *X) ...@@ -969,11 +980,11 @@ void nxagentRequestSelection(XEvent *X)
else else
{ {
/* deny the request */ /* deny the request */
nxagentReplyRequestSelection(X, False); replyRequestSelection(X, False);
} }
} }
} }
nxagentPrintClipboardStat("after nxagentRequestSelection"); nxagentPrintClipboardStat("after nxagentHandleSelectionRequestFromXServer");
} }
/* /*
...@@ -1002,7 +1013,7 @@ static void endTransfer(Bool success) ...@@ -1002,7 +1013,7 @@ static void endTransfer(Bool success)
CLINDEX(lastClientClientPtr)); CLINDEX(lastClientClientPtr));
#endif #endif
SendSelectionNotifyEventToClient(lastClientClientPtr, sendSelectionNotifyEventToClient(lastClientClientPtr,
lastClientTime, lastClientTime,
lastClientRequestor, lastClientRequestor,
lastClientSelection, lastClientSelection,
...@@ -1013,10 +1024,10 @@ static void endTransfer(Bool success) ...@@ -1013,10 +1024,10 @@ static void endTransfer(Bool success)
* Enable further requests from clients. * Enable further requests from clients.
*/ */
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
} }
void nxagentTransferSelection(int resource) static void transferSelection(int resource)
{ {
if (lastClientClientPtr -> index != resource) if (lastClientClientPtr -> index != resource)
{ {
...@@ -1036,7 +1047,7 @@ void nxagentTransferSelection(int resource) ...@@ -1036,7 +1047,7 @@ void nxagentTransferSelection(int resource)
{ {
int result; int result;
PrintClientSelectionStage(); printClientSelectionStage();
/* /*
* Don't get data yet, just get size. We skip this stage in * Don't get data yet, just get size. We skip this stage in
...@@ -1077,7 +1088,7 @@ void nxagentTransferSelection(int resource) ...@@ -1077,7 +1088,7 @@ void nxagentTransferSelection(int resource)
return; return;
} }
SetClientSelectionStage(WaitSize); setClientSelectionStage(WaitSize);
NXFlushDisplay(nxagentDisplay, NXFlushLink); NXFlushDisplay(nxagentDisplay, NXFlushLink);
...@@ -1087,7 +1098,7 @@ void nxagentTransferSelection(int resource) ...@@ -1087,7 +1098,7 @@ void nxagentTransferSelection(int resource)
{ {
int result; int result;
PrintClientSelectionStage(); printClientSelectionStage();
/* /*
* Request the selection data now. * Request the selection data now.
...@@ -1131,7 +1142,7 @@ void nxagentTransferSelection(int resource) ...@@ -1131,7 +1142,7 @@ void nxagentTransferSelection(int resource)
return; return;
} }
SetClientSelectionStage(WaitData); setClientSelectionStage(WaitData);
/* we've seen situations where you had to move the mouse or press a /* we've seen situations where you had to move the mouse or press a
key to let the transfer complete. Flushing here fixed it */ key to let the transfer complete. Flushing here fixed it */
...@@ -1143,7 +1154,7 @@ void nxagentTransferSelection(int resource) ...@@ -1143,7 +1154,7 @@ void nxagentTransferSelection(int resource)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__,
GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); getClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr));
#endif #endif
break; break;
...@@ -1204,7 +1215,7 @@ void nxagentCollectPropertyEvent(int resource) ...@@ -1204,7 +1215,7 @@ void nxagentCollectPropertyEvent(int resource)
{ {
case SelectionStageWaitSize: case SelectionStageWaitSize:
{ {
PrintClientSelectionStage(); printClientSelectionStage();
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "%s: Got size notify event for client [%d].\n", __func__, fprintf (stderr, "%s: Got size notify event for client [%d].\n", __func__,
CLINDEX(lastClientClientPtr)); CLINDEX(lastClientClientPtr));
...@@ -1228,15 +1239,15 @@ void nxagentCollectPropertyEvent(int resource) ...@@ -1228,15 +1239,15 @@ void nxagentCollectPropertyEvent(int resource)
* Request the selection data now. * Request the selection data now.
*/ */
lastClientPropertySize = ulReturnBytesLeft; lastClientPropertySize = ulReturnBytesLeft;
SetClientSelectionStage(QueryData); setClientSelectionStage(QueryData);
nxagentTransferSelection(resource); transferSelection(resource);
} }
break; break;
} }
case SelectionStageWaitData: case SelectionStageWaitData:
{ {
PrintClientSelectionStage(); printClientSelectionStage();
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "%s: Got data notify event for client [%d].\n", __func__, fprintf (stderr, "%s: Got data notify event for client [%d].\n", __func__,
CLINDEX(lastClientClientPtr)); CLINDEX(lastClientClientPtr));
...@@ -1278,7 +1289,7 @@ void nxagentCollectPropertyEvent(int resource) ...@@ -1278,7 +1289,7 @@ void nxagentCollectPropertyEvent(int resource)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__,
GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); getClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr));
#endif #endif
break; break;
} }
...@@ -1316,7 +1327,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1316,7 +1327,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
} }
#endif #endif
PrintClientSelectionStage(); printClientSelectionStage();
if (lastClientWindowPtr != NULL) if (lastClientWindowPtr != NULL)
{ {
...@@ -1347,10 +1358,10 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1347,10 +1358,10 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
* tions. * tions.
*/ */
SetClientSelectionStage(QueryData); setClientSelectionStage(QueryData);
lastClientPropertySize = 262144; lastClientPropertySize = 262144;
nxagentTransferSelection(lastClientClientPtr -> index); transferSelection(lastClientClientPtr -> index);
} }
else else
{ {
...@@ -1388,7 +1399,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1388,7 +1399,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__,
lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); lastSelectionOwner[i].window, clientCutProperty, getXErrorString(result));
#endif #endif
if (result == BadAlloc || result == BadAtom || if (result == BadAlloc || result == BadAtom ||
result == BadWindow || result == BadValue) result == BadWindow || result == BadValue)
...@@ -1404,7 +1415,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1404,7 +1415,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
&pszReturnData); &pszReturnData);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__,
lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); lastSelectionOwner[i].window, clientCutProperty, getXErrorString(result));
#endif #endif
if (result == BadAlloc || result == BadAtom || if (result == BadAlloc || result == BadAtom ||
...@@ -1430,7 +1441,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1430,7 +1441,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
#ifdef DEBUG #ifdef DEBUG
{ {
char *s = XGetAtomName(nxagentDisplay, lastServerProperty); char *s = XGetAtomName(nxagentDisplay, lastServerProperty);
fprintf(stderr, "%s: XChangeProperty sent to window [0x%x] for property [%d][%s] value [\"%*.*s\"...]\n", fprintf(stderr, "%s: XChangeProperty sent to window [0x%x] for property [%ld][%s] value [\"%*.*s\"...]\n",
__func__, __func__,
lastServerRequestor, lastServerRequestor,
lastServerProperty, lastServerProperty,
...@@ -1471,7 +1482,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1471,7 +1482,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
(void *)eventSelection.requestor); (void *)eventSelection.requestor);
#endif #endif
SendSelectionNotifyEventToServer(&eventSelection); sendSelectionNotifyEventToServer(&eventSelection);
lastServerRequestor = None; /* allow further request */ lastServerRequestor = None; /* allow further request */
} }
...@@ -1479,12 +1490,14 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1479,12 +1490,14 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
} }
} }
#if 0
/* FIXME: currently unused */
/* /*
* Let nxagent's serverWindow acquire the selection. All requests from * Let nxagent's serverWindow acquire the selection. All requests from
* the real X server (or its clients) will be sent to this window. The * the real X server (or its clients) will be sent to this window. The
* real X server never communicates with our windows directly. * real X server never communicates with our windows directly.
*/ */
void nxagentResetSelectionOwner(void) static void resetSelectionOwner(void)
{ {
if (lastServerRequestor != None) if (lastServerRequestor != None)
{ {
...@@ -1513,16 +1526,16 @@ void nxagentResetSelectionOwner(void) ...@@ -1513,16 +1526,16 @@ void nxagentResetSelectionOwner(void)
fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i); fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i);
#endif #endif
nxagentClearSelectionOwner(i); clearSelectionOwner(i);
lastSelectionOwner[i].windowPtr = NULL;
} }
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
/* Hmm, this is already None when reaching this */ /* Hmm, this is already None when reaching this */
lastServerRequestor = None; lastServerRequestor = None;
} }
#endif
#ifdef NXAGENT_CLIPBOARD #ifdef NXAGENT_CLIPBOARD
...@@ -1558,7 +1571,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, ...@@ -1558,7 +1571,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
Selection * pCurSel = (Selection *)info->selection; Selection * pCurSel = (Selection *)info->selection;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: pCurSel->lastTimeChanged [%d]\n", __func__, pCurSel->lastTimeChanged.milliseconds); fprintf(stderr, "%s: pCurSel->lastTimeChanged [%u]\n", __func__, pCurSel->lastTimeChanged.milliseconds);
#endif #endif
if (info->kind == SelectionSetOwner) if (info->kind == SelectionSetOwner)
...@@ -1575,9 +1588,9 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, ...@@ -1575,9 +1588,9 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
pCurSel->selection == clientCLIPBOARD)) pCurSel->selection == clientCLIPBOARD))
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: calling nxagentSetSelectionOwner\n", __func__); fprintf(stderr, "%s: calling setSelectionOwner\n", __func__);
#endif #endif
nxagentSetSelectionOwner(pCurSel); setSelectionOwner(pCurSel);
} }
} }
else if (info->kind == SelectionWindowDestroy) else if (info->kind == SelectionWindowDestroy)
...@@ -1605,7 +1618,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, ...@@ -1605,7 +1618,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
* This is called from the nxagentSetSelectionCallback, so it is using * This is called from the nxagentSetSelectionCallback, so it is using
* internal Atoms * internal Atoms
*/ */
void nxagentSetSelectionOwner(Selection *pSelection) static void setSelectionOwner(Selection *pSelection)
{ {
if (!agentClipboardInitialized) if (!agentClipboardInitialized)
{ {
...@@ -1660,11 +1673,11 @@ void nxagentSetSelectionOwner(Selection *pSelection) ...@@ -1660,11 +1673,11 @@ void nxagentSetSelectionOwner(Selection *pSelection)
* points to the struct that contains all information about the * points to the struct that contains all information about the
* owner window. * owner window.
*/ */
nxagentStoreSelectionOwner(i, pSelection); storeSelectionOwner(i, pSelection);
} }
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
lastServerRequestor = None; lastServerRequestor = None;
...@@ -1681,7 +1694,7 @@ FIXME ...@@ -1681,7 +1694,7 @@ FIXME
lastSelectionOwnerWindowPtr = pSelection->pWin; lastSelectionOwnerWindowPtr = pSelection->pWin;
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
lastServerRequestor = None; lastServerRequestor = None;
} }
...@@ -1689,7 +1702,7 @@ FIXME ...@@ -1689,7 +1702,7 @@ FIXME
*/ */
} }
void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, static void notifyConvertFailure(ClientPtr client, Window requestor,
Atom selection, Atom target, Time time) Atom selection, Atom target, Time time)
{ {
/* /*
...@@ -1704,7 +1717,7 @@ void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, ...@@ -1704,7 +1717,7 @@ void nxagentNotifyConvertFailure(ClientPtr client, Window requestor,
return; return;
} }
SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None);
} }
/* /*
...@@ -1763,11 +1776,11 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1763,11 +1776,11 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
"notifying failure to client\n", __func__); "notifying failure to client\n", __func__);
#endif #endif
nxagentNotifyConvertFailure(lastClientClientPtr, lastClientRequestor, notifyConvertFailure(lastClientClientPtr, lastClientRequestor,
lastClientSelection, lastClientTarget, lastClientTime); lastClientSelection, lastClientTarget, lastClientTime);
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
} }
else else
{ {
...@@ -1781,7 +1794,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1781,7 +1794,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
"before timeout expired on last request, notifying failure to client\n", __func__); "before timeout expired on last request, notifying failure to client\n", __func__);
#endif #endif
nxagentNotifyConvertFailure(client, requestor, selection, target, time); notifyConvertFailure(client, requestor, selection, target, time);
return 1; return 1;
} }
...@@ -1809,7 +1822,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1809,7 +1822,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
* The selection request target is TARGETS. The requestor is asking * The selection request target is TARGETS. The requestor is asking
* for a list of supported data formats. * for a list of supported data formats.
* *
* The list is aligned with the one in nxagentRequestSelection. * The list is aligned with the one in nxagentHandleSelectionRequestFromXServer.
*/ */
if (target == clientTARGETS) if (target == clientTARGETS)
{ {
...@@ -1832,7 +1845,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1832,7 +1845,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
&targets, &targets,
1); 1);
SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); sendSelectionNotifyEventToClient(client, time, requestor, selection, target, property);
return 1; return 1;
} }
...@@ -1868,7 +1881,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1868,7 +1881,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
(unsigned char *) &lastSelectionOwner[i].lastTimeChanged, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged,
1); 1);
SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); sendSelectionNotifyEventToClient(client, time, requestor, selection, target, property);
return 1; return 1;
} }
...@@ -1906,7 +1919,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1906,7 +1919,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
target == clientUTF8_STRING) target == clientUTF8_STRING)
{ {
lastClientWindowPtr = pWin; lastClientWindowPtr = pWin;
SetClientSelectionStage(None); setClientSelectionStage(None);
/* /*
* store the original requestor, we need that later after * store the original requestor, we need that later after
* serverTransToAgentProperty contains the desired selection content * serverTransToAgentProperty contains the desired selection content
...@@ -1934,7 +1947,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1934,7 +1947,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
if (target == clientUTF8_STRING) if (target == clientUTF8_STRING)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, fprintf(stderr, "%s: Sending XConvertSelection with target [%ld][%s], property [%ld][%s]\n", __func__,
serverUTF8_STRING, szAgentUTF8_STRING, serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); serverUTF8_STRING, szAgentUTF8_STRING, serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER");
#endif #endif
XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverTransToAgentProperty, XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverTransToAgentProperty,
...@@ -1943,7 +1956,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1943,7 +1956,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
else else
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%ld][%s]\n", __func__,
XA_STRING, validateString(NameForAtom(XA_STRING)), serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); XA_STRING, validateString(NameForAtom(XA_STRING)), serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER");
#endif #endif
...@@ -1967,7 +1980,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1967,7 +1980,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
fprintf(stderr, "%s: Unsupported target [%d][%s] - denying request\n", __func__, target, fprintf(stderr, "%s: Unsupported target [%d][%s] - denying request\n", __func__, target,
validateString(NameForAtom(target))); validateString(NameForAtom(target)));
#endif #endif
SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None);
return 1; return 1;
} }
...@@ -2098,7 +2111,7 @@ int nxagentSendNotify(xEvent *event) ...@@ -2098,7 +2111,7 @@ int nxagentSendNotify(xEvent *event)
NameForAtom(event->u.selectionNotify.property)); NameForAtom(event->u.selectionNotify.property));
#endif #endif
SendSelectionNotifyEventToServer(&eventSelection); sendSelectionNotifyEventToServer(&eventSelection);
return 1; return 1;
} }
...@@ -2111,13 +2124,13 @@ int nxagentSendNotify(xEvent *event) ...@@ -2111,13 +2124,13 @@ int nxagentSendNotify(xEvent *event)
*/ */
WindowPtr nxagentGetClipboardWindow(Atom property) WindowPtr nxagentGetClipboardWindow(Atom property)
{ {
int i = nxagentFindLastSelectionOwnerIndex(nxagentLastRequestedSelection); int i = nxagentFindLastSelectionOwnerIndex(serverLastRequestedSelection);
if (i < nxagentMaxSelections && if (i < nxagentMaxSelections &&
property == clientCutProperty && property == clientCutProperty &&
lastSelectionOwner[i].windowPtr != NULL) lastSelectionOwner[i].windowPtr != NULL)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Returning last [%d] selection owner window [%p] (0x%x).\n", __func__, fprintf(stderr, "%s: Returning last [%ld] selection owner window [%p] (0x%x).\n", __func__,
lastSelectionOwner[i].selection, lastSelectionOwner[i].selection,
(void *)lastSelectionOwner[i].windowPtr, WINDOWID(lastSelectionOwner[i].windowPtr)); (void *)lastSelectionOwner[i].windowPtr, WINDOWID(lastSelectionOwner[i].windowPtr));
#endif #endif
...@@ -2160,8 +2173,8 @@ Bool nxagentInitClipboard(WindowPtr pWin) ...@@ -2160,8 +2173,8 @@ Bool nxagentInitClipboard(WindowPtr pWin)
{ {
FatalError("nxagentInitClipboard: Failed to allocate memory for the clipboard selections.\n"); FatalError("nxagentInitClipboard: Failed to allocate memory for the clipboard selections.\n");
} }
nxagentInitSelectionOwner(nxagentPrimarySelection, XA_PRIMARY); initSelectionOwner(nxagentPrimarySelection, XA_PRIMARY);
nxagentInitSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */ initSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */
} }
else else
{ {
...@@ -2271,13 +2284,13 @@ Bool nxagentInitClipboard(WindowPtr pWin) ...@@ -2271,13 +2284,13 @@ Bool nxagentInitClipboard(WindowPtr pWin)
{ {
for (int i = 0; i < nxagentMaxSelections; i++) for (int i = 0; i < nxagentMaxSelections; i++)
{ {
nxagentClearSelectionOwner(i); clearSelectionOwner(i);
} }
lastServerRequestor = None; lastServerRequestor = None;
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); setClientSelectionStage(None);
lastClientReqTime = GetTimeInMillis(); lastClientReqTime = GetTimeInMillis();
clientTARGETS = MakeAtom(szAgentTARGETS, strlen(szAgentTARGETS), True); clientTARGETS = MakeAtom(szAgentTARGETS, strlen(szAgentTARGETS), True);
......
...@@ -41,29 +41,41 @@ typedef struct _XFixesAgentInfo ...@@ -41,29 +41,41 @@ typedef struct _XFixesAgentInfo
extern XFixesAgentInfoRec nxagentXFixesInfo; extern XFixesAgentInfoRec nxagentXFixesInfo;
/* /*
* Create the NX_SELTRANS_FROM_AGENT atom and * Create the NX_SELTRANS_FROM_AGENT atom and initialize the required
* initialize the required property to exchange * property to exchange data with the X server.
* data with the X server.
*/ */
extern Bool nxagentInitClipboard(WindowPtr pWindow); extern Bool nxagentInitClipboard(WindowPtr pWindow);
/* /*
* Called whenever a client or a window is * Called whenever a client or a window is destroyed to let the
* destroyed to let the clipboard code to * clipboard code to release any pointer to the referenced structures.
* release any pointer to the referenced
* structures.
*/ */
extern void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow); extern void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow);
extern void nxagentSetSelectionOwner(Selection *pSelection);
extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
Window requestor, Atom property, Atom target, Time time); Window requestor, Atom property, Atom target, Time time);
void nxagentClearSelection(); #ifdef XEvent
void nxagentRequestSelection(); extern void nxagentHandleSelectionClearFromXServer(XEvent *X);
void nxagentHandleSelectionNotifyFromXServer(); extern void nxagentHandleSelectionRequestFromXServer(XEvent *X);
extern void nxagentHandleSelectionNotifyFromXServer(XEvent *X);
#else
extern void nxagentHandleSelectionClearFromXServer();
extern void nxagentHandleSelectionRequestFromXServer();
extern void nxagentHandleSelectionNotifyFromXServer();
#endif
extern int nxagentFindCurrentSelectionIndex(Atom sel);
/*
* Handle the selection property received in the event loop in
* Events.c.
*/
extern void nxagentCollectPropertyEvent(int resource);
extern WindowPtr nxagentGetClipboardWindow(Atom property);
extern int nxagentSendNotify(xEvent *event);
int nxagentFindCurrentSelectionIndex(Atom sel);
#endif /* __Clipboard_H__ */ #endif /* __Clipboard_H__ */
...@@ -77,6 +77,8 @@ is" without express or implied warranty. ...@@ -77,6 +77,8 @@ is" without express or implied warranty.
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
CursorBitsPtr nxagentAnimCursorBits;
/* /*
* Defined in Display.c. There are huge problems mixing the GC * Defined in Display.c. There are huge problems mixing the GC
* definition in Xlib with the server code. This must be reworked. * definition in Xlib with the server code. This must be reworked.
......
...@@ -65,7 +65,7 @@ typedef struct _AnimCur { ...@@ -65,7 +65,7 @@ typedef struct _AnimCur {
AnimCurElt *elts; AnimCurElt *elts;
} AnimCurRec, *AnimCurPtr; } AnimCurRec, *AnimCurPtr;
CursorBitsPtr nxagentAnimCursorBits; extern CursorBitsPtr nxagentAnimCursorBits;
#define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits) #define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits)
#define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1)) #define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1))
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "Display.h" #include "Display.h"
#include "Dialog.h" #include "Dialog.h"
#include "Utils.h" #include "Utils.h"
#include "Keystroke.h"
#include <nx/NX.h> #include <nx/NX.h>
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -187,6 +188,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -187,6 +188,7 @@ void nxagentLaunchDialog(DialogType dialogType)
int *pid; int *pid;
char *type; char *type;
char *message; char *message;
char *strings[2] = {NULL}; /* don't forget to add free() calls if you change the number */
int local; int local;
const char *window = NULL; const char *window = NULL;
...@@ -247,6 +249,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -247,6 +249,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE; type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE;
local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL; local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL;
pid = &nxagentEnableRandRModeDialogPid; pid = &nxagentEnableRandRModeDialogPid;
strings[0] = nxagentFindFirstKeystroke("resize");
break; break;
} }
case DIALOG_DISABLE_DESKTOP_RESIZE_MODE: case DIALOG_DISABLE_DESKTOP_RESIZE_MODE:
...@@ -255,6 +258,8 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -255,6 +258,8 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE; type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE;
local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL; local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL;
pid = &nxagentDisableRandRModeDialogPid; pid = &nxagentDisableRandRModeDialogPid;
strings[0] = nxagentFindFirstKeystroke("resize");
strings[1] = nxagentFindMatchingKeystrokes("viewport_");
break; break;
} }
case DIALOG_ENABLE_DEFER_MODE: case DIALOG_ENABLE_DEFER_MODE:
...@@ -263,6 +268,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -263,6 +268,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_DEFER_MODE_TYPE; type = DIALOG_ENABLE_DEFER_MODE_TYPE;
local = DIALOG_ENABLE_DEFER_MODE_LOCAL; local = DIALOG_ENABLE_DEFER_MODE_LOCAL;
pid = &nxagentEnableDeferModePid; pid = &nxagentEnableDeferModePid;
strings[0] = nxagentFindFirstKeystroke("defer");
break; break;
} }
case DIALOG_DISABLE_DEFER_MODE: case DIALOG_DISABLE_DEFER_MODE:
...@@ -271,6 +277,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -271,6 +277,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_DEFER_MODE_TYPE; type = DIALOG_DISABLE_DEFER_MODE_TYPE;
local = DIALOG_DISABLE_DEFER_MODE_LOCAL; local = DIALOG_DISABLE_DEFER_MODE_LOCAL;
pid = &nxagentDisableDeferModePid; pid = &nxagentDisableDeferModePid;
strings[0] = nxagentFindFirstKeystroke("defer");
break; break;
} }
case DIALOG_ENABLE_AUTOGRAB_MODE: case DIALOG_ENABLE_AUTOGRAB_MODE:
...@@ -279,6 +286,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -279,6 +286,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE; type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL; local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentEnableAutograbModePid; pid = &nxagentEnableAutograbModePid;
strings[0] = nxagentFindFirstKeystroke("autograb");
break; break;
} }
case DIALOG_DISABLE_AUTOGRAB_MODE: case DIALOG_DISABLE_AUTOGRAB_MODE:
...@@ -287,6 +295,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -287,6 +295,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE; type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL; local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentDisableAutograbModePid; pid = &nxagentDisableAutograbModePid;
strings[0] = nxagentFindFirstKeystroke("autograb");
break; break;
} }
default: default:
...@@ -321,6 +330,17 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -321,6 +330,17 @@ void nxagentLaunchDialog(DialogType dialogType)
return; return;
} }
char *msg = NULL;
if (-1 == asprintf(&msg, message, strings[0], strings[1]))
{
#ifdef DEBUG
fprintf(stderr, "%s: could not allocate message string.\n", __func__);
#endif
SAFE_free(strings[0]);
SAFE_free(strings[1]);
return;
}
/* /*
* We don't want to receive SIGCHLD before we store the child pid. * We don't want to receive SIGCHLD before we store the child pid.
*/ */
...@@ -331,9 +351,13 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -331,9 +351,13 @@ void nxagentLaunchDialog(DialogType dialogType)
sigprocmask(SIG_BLOCK, &set, &oldSet); sigprocmask(SIG_BLOCK, &set, &oldSet);
*pid = NXTransDialog(nxagentDialogName, message, window, *pid = NXTransDialog(nxagentDialogName, msg, window,
type, local, dialogDisplay); type, local, dialogDisplay);
SAFE_free(strings[0]);
SAFE_free(strings[1]);
SAFE_free(msg);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n", fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n",
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay); DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
......
...@@ -78,7 +78,9 @@ extern void nxagentTerminateDialogs(void); ...@@ -78,7 +78,9 @@ extern void nxagentTerminateDialogs(void);
nxagentEnableRandRModeDialogPid == 0 && \ nxagentEnableRandRModeDialogPid == 0 && \
nxagentDisableRandRModeDialogPid == 0 && \ nxagentDisableRandRModeDialogPid == 0 && \
nxagentEnableDeferModePid == 0 && \ nxagentEnableDeferModePid == 0 && \
nxagentDisableDeferModePid == 0) nxagentDisableDeferModePid == 0 && \
nxagentEnableAutograbModePid == 0 && \
nxagentDisableAutograbModePid == 0)
#define DECODE_DIALOG_TYPE(type) \ #define DECODE_DIALOG_TYPE(type) \
((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \ ((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \
...@@ -96,10 +98,9 @@ extern void nxagentTerminateDialogs(void); ...@@ -96,10 +98,9 @@ extern void nxagentTerminateDialogs(void);
"UNKNOWN_DIALOG") "UNKNOWN_DIALOG")
/* /*
* Message to be showed to users when the close * Message to be shown to users when the close button is pressed. The
* button is pressed. The right message is chosen * right message is chosen according if session does or does not run
* according if session does or does not run in * in persistent mode.
* persistent mode.
*/ */
#define DIALOG_KILL_SESSION_MESSAGE \ #define DIALOG_KILL_SESSION_MESSAGE \
...@@ -174,7 +175,7 @@ nxagentFailedReconnectionMessage ...@@ -174,7 +175,7 @@ nxagentFailedReconnectionMessage
"\ "\
The session is now running in desktop resize mode.\n\ The session is now running in desktop resize mode.\n\
You can resize the desktop by simply dragging the\n\ You can resize the desktop by simply dragging the\n\
desktop window's border. You can press Ctrl+Alt+R\n\ desktop window's border. You can press %s\n\
again to disable this option.\ again to disable this option.\
" "
...@@ -187,9 +188,12 @@ again to disable this option.\ ...@@ -187,9 +188,12 @@ again to disable this option.\
"\ "\
The session is now running in viewport mode. You can\n\ The session is now running in viewport mode. You can\n\
navigate across different areas of the desktop window\n\ navigate across different areas of the desktop window\n\
by dragging the desktop with the mouse or by using the\n\ by dragging the desktop with the mouse while pressing\n\
arrows keys while pressing Ctrl+Alt. Press Ctrl+Alt+R\n\ Ctrl+Alt or use the keystrokes listed below. Press\n\
again to return to the desktop resize mode.\ %s again to return to the desktop resize mode.\n\
\n\
Use these keystrokes to navigate:\n\
%s\
" "
#define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE "ok" #define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE "ok"
...@@ -201,7 +205,7 @@ again to return to the desktop resize mode.\ ...@@ -201,7 +205,7 @@ again to return to the desktop resize mode.\
\ \
"\ "\
Deferred screen updates are now enabled. You can press\n\ Deferred screen updates are now enabled. You can press\n\
Ctrl+Alt+E again to disable this option.\ %s again to disable this option.\
" "
#define DIALOG_ENABLE_DEFER_MODE_TYPE "ok" #define DIALOG_ENABLE_DEFER_MODE_TYPE "ok"
...@@ -213,7 +217,7 @@ Ctrl+Alt+E again to disable this option.\ ...@@ -213,7 +217,7 @@ Ctrl+Alt+E again to disable this option.\
\ \
"\ "\
Deferred screen updates are now disabled. You can press\n\ Deferred screen updates are now disabled. You can press\n\
Ctrl+Alt+E to enable it again.\ %s to enable it again.\
" "
#define DIALOG_DISABLE_DEFER_MODE_TYPE "ok" #define DIALOG_DISABLE_DEFER_MODE_TYPE "ok"
...@@ -225,7 +229,7 @@ Ctrl+Alt+E to enable it again.\ ...@@ -225,7 +229,7 @@ Ctrl+Alt+E to enable it again.\
\ \
"\ "\
Keyboard auto-grabbing mode is now enabled. You can press\n\ Keyboard auto-grabbing mode is now enabled. You can press\n\
Ctrl+Alt+G again to disable auto-grabbing.\ %s again to disable auto-grabbing.\
" "
#define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok" #define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok"
...@@ -237,7 +241,7 @@ Ctrl+Alt+G again to disable auto-grabbing.\ ...@@ -237,7 +241,7 @@ Ctrl+Alt+G again to disable auto-grabbing.\
\ \
"\ "\
Keyboard auto-grabbing mode is now disabled. You can press\n\ Keyboard auto-grabbing mode is now disabled. You can press\n\
Ctrl+Alt+G again to re-enable auto-grabbing.\ %s again to re-enable auto-grabbing.\
" "
#define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok" #define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok"
......
...@@ -86,6 +86,7 @@ is" without express or implied warranty. ...@@ -86,6 +86,7 @@ is" without express or implied warranty.
#include "Splash.h" #include "Splash.h"
#include "Screen.h" #include "Screen.h"
#include "Handlers.h" #include "Handlers.h"
#include "Split.h"
#include <nx/NX.h> #include <nx/NX.h>
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -1494,8 +1495,13 @@ void nxagentInitVisuals(void) ...@@ -1494,8 +1495,13 @@ void nxagentInitVisuals(void)
if (nxagentVisuals != NULL) if (nxagentVisuals != NULL)
{ {
nxagentVisuals = (XVisualInfo *) realloc(nxagentVisuals, XVisualInfo *new = (XVisualInfo *) realloc(nxagentVisuals,
nxagentNumVisuals * sizeof(XVisualInfo)); nxagentNumVisuals * sizeof(XVisualInfo));
/* nxagentVisuals being NULL is covered below */
if (new)
nxagentVisuals = new;
else
SAFE_free(nxagentVisuals);
} }
SAFE_XFree(viList); SAFE_XFree(viList);
...@@ -1547,6 +1553,7 @@ void nxagentInitPixmapFormats(void) ...@@ -1547,6 +1553,7 @@ void nxagentInitPixmapFormats(void)
*/ */
nxagentNumPixmapFormats = 0; nxagentNumPixmapFormats = 0;
nxagentRemoteNumPixmapFormats = 0;
/* /*
XXX: Some X server doesn't list 1 among available depths... XXX: Some X server doesn't list 1 among available depths...
...@@ -1596,28 +1603,97 @@ XXX: Some X server doesn't list 1 among available depths... ...@@ -1596,28 +1603,97 @@ XXX: Some X server doesn't list 1 among available depths...
} }
} }
nxagentRemotePixmapFormats = XListPixmapFormats(nxagentDisplay, &nxagentRemoteNumPixmapFormats); /*
* we need to filter the list of remote pixmap formats by our
* supported depths, just like above. If we do not perform this step
* nxagentCheckForPixmapFormatsCompatibility will fail when
* tolerance is "strict" (the default). This becomes evident when
* Xephyr or Xnest are used as the real X server. They normally show
* only two supported depths but 7 supported pixmap formats (which
* could be a bug there).
*/
int tmpnum = 0;
XPixmapFormatValues *tmp = XListPixmapFormats(nxagentDisplay, &tmpnum);
if (nxagentRemotePixmapFormats == NULL) if (tmp == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentInitPixmapFormats: WARNING! Failed to get available remote pixmap formats.\n"); fprintf(stderr, "nxagentInitPixmapFormats: WARNING! Failed to get available remote pixmap formats.\n");
#endif #endif
nxagentRemotePixmapFormats = NULL;
} }
#ifdef TEST
else else
{ {
#ifdef TEST
fprintf(stderr, "nxagentInitPixmapFormats: Got [%d] available remote pixmap formats:\n", fprintf(stderr, "nxagentInitPixmapFormats: Got [%d] available remote pixmap formats:\n",
nxagentRemoteNumPixmapFormats); tmpnum);
for (int i = 0; i < tmpnum; i++)
{
fprintf(stderr, "nxagentInitPixmapFormats: Found remote pixmap format [%d]: depth [%d] "
"bits_per_pixel [%d] scanline_pad [%d].\n", i, tmp[i].depth,
tmp[i].bits_per_pixel, tmp[i].scanline_pad);
}
#endif
SAFE_XFree(tmp);
nxagentRemotePixmapFormats = malloc((nxagentNumDepths + 1) * sizeof(XPixmapFormatValues));
for (int i = 1; i <= MAXDEPTH; i++)
{
int depth = 0;
if (i == 1)
{
depth = 1;
}
else
{
for (int j = 0; j < nxagentNumDepths; j++)
{
if (nxagentDepths[j] == i)
{
depth = i;
break;
}
}
}
if (depth != 0)
{
if (nxagentRemoteNumPixmapFormats >= MAXFORMATS)
{
FatalError("nxagentInitPixmapFormats: MAXFORMATS is too small for this remote server.\n");
}
nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].depth = depth;
nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].bits_per_pixel = nxagentBitsPerPixel(depth);
nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].scanline_pad = BITMAP_SCANLINE_PAD;
#ifdef TEST
fprintf(stderr, "nxagentInitPixmapFormats: Suitable remote format [%d] to depth [%d] "
"bits per pixel [%d] scanline pad [%d].\n", nxagentRemoteNumPixmapFormats,
depth, nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].bits_per_pixel,
BITMAP_SCANLINE_PAD);
#endif
nxagentRemoteNumPixmapFormats++;
}
}
#ifdef TEST
for (int i = 0; i < nxagentRemoteNumPixmapFormats; i++) for (int i = 0; i < nxagentRemoteNumPixmapFormats; i++)
{ {
fprintf(stderr, "nxagentInitPixmapFormats: Remote pixmap format [%d]: depth [%d] " fprintf(stderr, "nxagentInitPixmapFormats: Remote pixmap format [%d]: depth [%d] "
"bits_per_pixel [%d] scanline_pad [%d].\n", i, nxagentRemotePixmapFormats[i].depth, "bits_per_pixel [%d] scanline_pad [%d].\n", i, nxagentRemotePixmapFormats[i].depth,
nxagentRemotePixmapFormats[i].bits_per_pixel, nxagentRemotePixmapFormats[i].scanline_pad); nxagentRemotePixmapFormats[i].bits_per_pixel, nxagentRemotePixmapFormats[i].scanline_pad);
} }
}
#endif #endif
}
} }
void nxagentSetDefaultDrawables(void) void nxagentSetDefaultDrawables(void)
......
...@@ -91,6 +91,11 @@ RESTYPE RT_NX_CORR_WINDOW; ...@@ -91,6 +91,11 @@ RESTYPE RT_NX_CORR_WINDOW;
RESTYPE RT_NX_CORR_PIXMAP; RESTYPE RT_NX_CORR_PIXMAP;
int nxagentCorruptedPixmaps = 0; int nxagentCorruptedPixmaps = 0;
/*
* Number of windows which need synchronization.
*/
int nxagentCorruptedWindows = 0; int nxagentCorruptedWindows = 0;
int nxagentCorruptedBackgrounds = 0; int nxagentCorruptedBackgrounds = 0;
...@@ -160,15 +165,15 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -160,15 +165,15 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
* so that the image will be transferred in a single operation. * so that the image will be transferred in a single operation.
*/ */
nxagentFBTrap = 1; nxagentFBTrap = True;
nxagentSplitTrap = 1; nxagentSplitTrap = True;
int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner); int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner);
nxagentSplitTrap = 0; nxagentSplitTrap = False;
nxagentFBTrap = 0; nxagentFBTrap = False;
if (wait == DO_WAIT && nxagentSplitResource(pDrawable) != NULL) if (wait == DO_WAIT && nxagentSplitResource(pDrawable) != NULL)
{ {
...@@ -191,45 +196,62 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -191,45 +196,62 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
return result; return result;
} }
int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) static int reallySynchronizeDrawableData(DrawablePtr pDrawable)
{ {
char *data = NULL; GCPtr pGC = nxagentGetGraphicContext(pDrawable);
int success;
if (pDrawable -> type == DRAWABLE_PIXMAP) if (pGC == NULL)
{ {
GCPtr pGC; #ifdef WARNING
fprintf(stderr, "%s: WARNING! Failed to get the temporary GC.\n", __func__);
#endif
unsigned int leftPad = 0; return 0;
}
DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ?
((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) :
pDrawable);
int width = pDrawable -> width; int width = pDrawable -> width;
int height = pDrawable -> height; int height = pDrawable -> height;
int depth = pDrawable -> depth; int depth = pDrawable -> depth;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeDrawableData: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n", fprintf(stderr, "%s: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n",
nxagentDrawableType(pDrawable), width, height, depth); __func__, nxagentDrawableType(pDrawable), width, height, depth);
#endif #endif
unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap;
int length = nxagentImageLength(width, height, format, leftPad, depth); int length = nxagentImageLength(width, height, format, 0, depth);
if ((data = malloc(length)) == NULL) char *data = malloc(length);
if (data == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to allocate memory for the operation.\n"); fprintf(stderr, "%s: WARNING! Failed to allocate memory for the operation.\n", __func__);
#endif #endif
success = 0; return 0;
goto nxagentSynchronizeDrawableDataEnd;
} }
DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? ValidateGC(pDrawable, pGC);
((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) :
pDrawable); fbGetImage(pSrcDrawable, 0, 0, width, height, format, AllPlanes, data);
nxagentPutImage(pDrawable, pGC, depth, 0, 0,
width, height, 0, format, data);
SAFE_free(data);
return 1;
}
int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner)
{
if (pDrawable -> type == DRAWABLE_PIXMAP)
{
/* /*
* Synchronize the whole pixmap if we need to download a fresh * Synchronize the whole pixmap if we need to download a fresh
* copy with lossless compression turned off. * copy with lossless compression turned off.
...@@ -237,35 +259,12 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask ...@@ -237,35 +259,12 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
if (nxagentLosslessTrap == 1) if (nxagentLosslessTrap == 1)
{ {
pGC = nxagentGetGraphicContext(pDrawable);
if (pGC == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to get the temporary GC.\n");
#endif
success = 0;
goto nxagentSynchronizeDrawableDataEnd;
}
ValidateGC(pDrawable, pGC);
fbGetImage(pSrcDrawable, 0, 0,
width, height, format, AllPlanes, data);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeDrawableData: Forcing synchronization of " fprintf(stderr, "%s: Forcing synchronization of pixmap at [%p] with lossless compression.\n",
"pixmap at [%p] with lossless compression.\n", (void *) pDrawable); __func__, (void *) pDrawable);
#endif #endif
nxagentPutImage(pDrawable, pGC, depth, 0, 0, return reallySynchronizeDrawableData(pDrawable);
width, height, leftPad, format, data);
success = 1;
goto nxagentSynchronizeDrawableDataEnd;
} }
else if (nxagentReconnectTrap == 1) else if (nxagentReconnectTrap == 1)
{ {
...@@ -278,7 +277,6 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask ...@@ -278,7 +277,6 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
if (pDrawable -> depth == 1) if (pDrawable -> depth == 1)
{ {
#ifdef TEST #ifdef TEST
if (nxagentReconnectTrap == 1) if (nxagentReconnectTrap == 1)
{ {
static int totalLength; static int totalLength;
...@@ -287,51 +285,25 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask ...@@ -287,51 +285,25 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
totalLength += length; totalLength += length;
totalReconnectedPixmaps++; totalReconnectedPixmaps++;
fprintf(stderr, "nxagentSynchronizeDrawableData: Reconnecting pixmap at [%p] [%dx%d] " fprintf(stderr, "%s: Reconnecting pixmap at [%p] [%dx%d] "
"Depth [%d] Size [%d]. Total size [%d]. Total reconnected pixmaps [%d].\n", "Depth [%d] Size [%d]. Total size [%d]. Total reconnected pixmaps [%d].\n",
(void *) pDrawable, width, height, depth, length, __func__, (void *) pDrawable, width, height, depth, length,
totalLength, totalReconnectedPixmaps); totalLength, totalReconnectedPixmaps);
} }
#endif #endif
pGC = nxagentGetGraphicContext(pDrawable); return reallySynchronizeDrawableData(pDrawable);
if (pGC == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to create the temporary GC.\n");
#endif
success = 0;
goto nxagentSynchronizeDrawableDataEnd;
}
ValidateGC(pDrawable, pGC);
fbGetImage(pSrcDrawable, 0, 0,
width, height, format, AllPlanes, data);
nxagentPutImage(pDrawable, pGC, depth, 0, 0,
width, height, leftPad, format, data);
success = 1;
goto nxagentSynchronizeDrawableDataEnd;
} }
else else
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeDrawableData: Skipping synchronization of " fprintf(stderr, "%s: Skipping synchronization of pixmap at [%p][%p] during reconnection.\n",
"pixmap at [%p][%p] during reconnection.\n", (void *) pDrawable, (void*) nxagentVirtualPixmap((PixmapPtr)pDrawable)); __func__, (void *) pDrawable, (void*) nxagentVirtualPixmap((PixmapPtr)pDrawable));
#endif #endif
nxagentMarkCorruptedRegion(pDrawable, NullRegion); nxagentMarkCorruptedRegion(pDrawable, NullRegion);
success = 1; return 1;
goto nxagentSynchronizeDrawableDataEnd;
} }
} }
} }
...@@ -342,12 +314,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask ...@@ -342,12 +314,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
* the drawable. * the drawable.
*/ */
success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); return nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner);
nxagentSynchronizeDrawableDataEnd:
SAFE_free(data);
return success;
} }
/* /*
...@@ -533,11 +500,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -533,11 +500,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
int saveTrap = nxagentGCTrap; int saveTrap = nxagentGCTrap;
nxagentGCTrap = 0; nxagentGCTrap = False;
nxagentFBTrap = 1; nxagentFBTrap = True;
nxagentSplitTrap = 1; nxagentSplitTrap = True;
pGC = nxagentGetGraphicContext(pDrawable); pGC = nxagentGetGraphicContext(pDrawable);
...@@ -877,9 +844,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -877,9 +844,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentSynchronizeRegionStop: nxagentSynchronizeRegionStop:
nxagentSplitTrap = 0; nxagentSplitTrap = False;
nxagentFBTrap = 0; nxagentFBTrap = False;
nxagentGCTrap = saveTrap; nxagentGCTrap = saveTrap;
...@@ -979,7 +946,7 @@ nxagentSynchronizeRegionFree: ...@@ -979,7 +946,7 @@ nxagentSynchronizeRegionFree:
if (clipRegion != NullRegion) if (clipRegion != NullRegion)
{ {
nxagentFreeRegion(pDrawable, clipRegion); nxagentFreeRegion(clipRegion);
} }
SAFE_free(data); SAFE_free(data);
...@@ -1034,7 +1001,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea ...@@ -1034,7 +1001,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea
pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2);
#endif #endif
nxagentFreeRegion(pDrawable, pRegion); nxagentFreeRegion(pRegion);
return; return;
} }
...@@ -1047,7 +1014,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea ...@@ -1047,7 +1014,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea
nxagentSynchronizeRegion(pDrawable, pRegion, breakMask, NULL); nxagentSynchronizeRegion(pDrawable, pRegion, breakMask, NULL);
nxagentFreeRegion(pDrawable, pRegion); nxagentFreeRegion(pRegion);
} }
} }
...@@ -1558,7 +1525,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -1558,7 +1525,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
RegionUnion(nxagentCorruptedRegion(pDrawable), RegionUnion(nxagentCorruptedRegion(pDrawable),
nxagentCorruptedRegion(pDrawable), pRegion); nxagentCorruptedRegion(pDrawable), pRegion);
nxagentFreeRegion(pDrawable, pRegion); nxagentFreeRegion(pRegion);
} }
else else
{ {
...@@ -2359,7 +2326,7 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) ...@@ -2359,7 +2326,7 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2)
RegionIntersect(&visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); RegionIntersect(&visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin));
nxagentFreeRegion(pWin -> drawable.pScreen, clipRegion); nxagentFreeRegion(clipRegion);
if (RegionNil(&visRegion) == 1) if (RegionNil(&visRegion) == 1)
{ {
...@@ -2450,7 +2417,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2450,7 +2417,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
int saveTrap = nxagentGCTrap; int saveTrap = nxagentGCTrap;
nxagentGCTrap = 1; nxagentGCTrap = True;
if (nxagentDrawableStatus(pDrawable) == Synchronized) if (nxagentDrawableStatus(pDrawable) == Synchronized)
{ {
...@@ -2566,7 +2533,7 @@ nxagentCreateDrawableBitmapEnd: ...@@ -2566,7 +2533,7 @@ nxagentCreateDrawableBitmapEnd:
if (pClipRegion != NullRegion) if (pClipRegion != NullRegion)
{ {
nxagentFreeRegion(pDrawable, pClipRegion); nxagentFreeRegion(pClipRegion);
} }
if (pGC != NULL) if (pGC != NULL)
......
...@@ -162,8 +162,7 @@ extern int nxagentForceSynchronization; ...@@ -162,8 +162,7 @@ extern int nxagentForceSynchronization;
extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
int width, int height); int width, int height);
#define nxagentFreeRegion(pDrawable, pRegion) \ #define nxagentFreeRegion(pRegion) RegionDestroy(pRegion);
RegionDestroy(pRegion);
extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
......
...@@ -545,19 +545,15 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) ...@@ -545,19 +545,15 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
void nxagentInternalWindowsTree(WindowPtr pWin, int indent) void nxagentInternalWindowsTree(WindowPtr pWin, int indent)
{ {
while (pWin) for (; pWin; pWin = pWin -> nextSib)
{ {
WindowPtr pChild = pWin -> firstChild;
fprintf(stderr, "%*s", indent, ""); fprintf(stderr, "%*s", indent, "");
nxagentInternalWindowInfo(pWin, indent, TRUE); nxagentInternalWindowInfo(pWin, indent, TRUE);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
nxagentInternalWindowsTree(pChild, indent + 4); nxagentInternalWindowsTree(pWin -> firstChild, indent + 4);
pWin = pWin -> nextSib;
} }
} }
...@@ -897,7 +893,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -897,7 +893,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__); fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__);
#endif #endif
nxagentClearSelection(&X); nxagentHandleSelectionClearFromXServer(&X);
break; break;
} }
...@@ -907,7 +903,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -907,7 +903,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__); fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__);
#endif #endif
nxagentRequestSelection(&X); nxagentHandleSelectionRequestFromXServer(&X);
break; break;
} }
...@@ -1146,17 +1142,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1146,17 +1142,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
{ {
if (X.xkey.keycode == nxagentCapsLockKeycode) if (X.xkey.keycode == nxagentCapsLockKeycode)
{ {
nxagentXkbCapsTrap = 1; nxagentXkbCapsTrap = True;
} }
else if (X.xkey.keycode == nxagentNumLockKeycode) else if (X.xkey.keycode == nxagentNumLockKeycode)
{ {
nxagentXkbNumTrap = 1; nxagentXkbNumTrap = True;
} }
nxagentInitXkbKeyboardState(); nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0; nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = 0; nxagentXkbNumTrap = False;
} }
/* Calculate the time elapsed between this and the last event /* Calculate the time elapsed between this and the last event
...@@ -1716,11 +1712,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1716,11 +1712,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
Mask mask = CWX | CWY; Mask mask = CWX | CWY;
nxagentScreenTrap = 1; nxagentScreenTrap = True;
ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin)); ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin));
nxagentScreenTrap = 0; nxagentScreenTrap = False;
} }
if (nxagentOption(Fullscreen) == 1 && if (nxagentOption(Fullscreen) == 1 &&
...@@ -2010,11 +2006,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2010,11 +2006,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL && ((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1)) nxagentWindowTopLevel(pWin) == 1))
{ {
nxagentScreenTrap = 1; nxagentScreenTrap = True;
UnmapWindow(pWin, False); UnmapWindow(pWin, False);
nxagentScreenTrap = 0; nxagentScreenTrap = False;
} }
} }
...@@ -2041,11 +2037,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2041,11 +2037,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xmap.window)) != NULL && ((pWin = nxagentWindowPtr(X.xmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1)) nxagentWindowTopLevel(pWin) == 1))
{ {
nxagentScreenTrap = 1; nxagentScreenTrap = True;
MapWindow(pWin, wClient(pWin)); MapWindow(pWin, wClient(pWin));
nxagentScreenTrap = 0; nxagentScreenTrap = False;
} }
if (pWin != NULL) if (pWin != NULL)
...@@ -2266,17 +2262,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) ...@@ -2266,17 +2262,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
{ {
if (X -> xkey.keycode == nxagentCapsLockKeycode) if (X -> xkey.keycode == nxagentCapsLockKeycode)
{ {
nxagentXkbCapsTrap = 1; nxagentXkbCapsTrap = True;
} }
else if (X -> xkey.keycode == nxagentNumLockKeycode) else if (X -> xkey.keycode == nxagentNumLockKeycode)
{ {
nxagentXkbNumTrap = 1; nxagentXkbNumTrap = True;
} }
nxagentInitXkbKeyboardState(); nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0; nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = 0; nxagentXkbNumTrap = False;
} }
if (nxagentCheckSpecialKeystroke(&X -> xkey, result)) if (nxagentCheckSpecialKeystroke(&X -> xkey, result))
...@@ -2872,7 +2868,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) ...@@ -2872,7 +2868,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
#endif #endif
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: CurrentSelections[i].lastTimeChanged [%d]\n", __func__, CurrentSelections[i].lastTimeChanged.milliseconds); fprintf(stderr, "%s: CurrentSelections[%d].lastTimeChanged [%u]\n", __func__, i, CurrentSelections[i].lastTimeChanged.milliseconds);
fprintf(stderr, "%s: Event timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.timestamp); fprintf(stderr, "%s: Event timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.timestamp);
fprintf(stderr, "%s: Event selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp); fprintf(stderr, "%s: Event selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp);
fprintf(stderr, "%s: Event selection window [0x%lx]\n", __func__, xfixesEvent->xfixesselection.window); fprintf(stderr, "%s: Event selection window [0x%lx]\n", __func__, xfixesEvent->xfixesselection.window);
...@@ -2904,9 +2900,9 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) ...@@ -2904,9 +2900,9 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
* identify that situation during Callback processing we could * identify that situation during Callback processing we could
* get rid of the Trap... * get rid of the Trap...
*/ */
nxagentExternalClipboardEventTrap = 1; nxagentExternalClipboardEventTrap = True;
CallCallbacks(&SelectionCallback, &info); CallCallbacks(&SelectionCallback, &info);
nxagentExternalClipboardEventTrap = 0; nxagentExternalClipboardEventTrap = False;
} }
} }
return 1; return 1;
...@@ -3203,11 +3199,11 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3203,11 +3199,11 @@ int nxagentHandleConfigureNotify(XEvent* X)
* nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height; * nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height;
*/ */
nxagentScreenTrap = 1; nxagentScreenTrap = True;
ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow)); ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow));
nxagentScreenTrap = 0; nxagentScreenTrap = False;
nxagentCheckWindowConfiguration((XConfigureEvent*)X); nxagentCheckWindowConfiguration((XConfigureEvent*)X);
......
...@@ -73,8 +73,7 @@ Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr); ...@@ -73,8 +73,7 @@ Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr);
int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter); int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter);
/* /*
* Enable and disable notification of * Enable and disable notification of remote X server events.
* remote X server events.
*/ */
extern void nxagentEnableKeyboardEvents(void); extern void nxagentEnableKeyboardEvents(void);
...@@ -93,33 +92,30 @@ extern void nxagentSetDefaultEventMask(Mask mask); ...@@ -93,33 +92,30 @@ extern void nxagentSetDefaultEventMask(Mask mask);
extern Mask nxagentGetEventMask(WindowPtr pWin); extern Mask nxagentGetEventMask(WindowPtr pWin);
/* /*
* Bring keyboard device in known state. It needs * Bring keyboard device in known state. It needs a round-trip so it
* a round-trip so it only gets called if a pre- * only gets called if a previous XKB event did not implicitly
* vious XKB event did not implicitly initialized * initialized the internal state. This is unlikely to happen.
* the internal state. This is unlikely to happen.
*/ */
extern int nxagentInitXkbKeyboardState(void); extern int nxagentInitXkbKeyboardState(void);
/* /*
* Update the keyboard state according * Update the keyboard state according to focus and XKB events
* to focus and XKB events received * received from the remote X server.
* from the remote X server.
*/ */
extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X); extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X);
/* /*
* Handle sync and karma messages and * Handle sync and karma messages and other notification event coming
* other notification event coming
* from proxy. * from proxy.
*/ */
extern int nxagentHandleProxyEvent(XEvent *X); extern int nxagentHandleProxyEvent(XEvent *X);
/* /*
* Other functions providing the ad-hoc * Other functions providing the ad-hoc handling of the remote X
* handling of the remote X events. * events.
*/ */
extern int nxagentHandleExposeEvent(XEvent *X); extern int nxagentHandleExposeEvent(XEvent *X);
...@@ -132,16 +128,14 @@ extern int nxagentHandleConfigureNotify(XEvent *X); ...@@ -132,16 +128,14 @@ extern int nxagentHandleConfigureNotify(XEvent *X);
extern int nxagentHandleXFixesSelectionNotify(XEvent *X); extern int nxagentHandleXFixesSelectionNotify(XEvent *X);
/* /*
* Send a fake keystroke to the remote * Send a fake keystroke to the remote X server.
* X server.
*/ */
extern void nxagentSendFakeKey(int key); extern void nxagentSendFakeKey(int key);
/* /*
* Called to manage grab of pointer and * Called to manage grab of pointer and keyboard when running in
* keyboard when running in fullscreen * fullscreen mode.
* mode.
*/ */
extern void nxagentGrabPointerAndKeyboard(XEvent *X); extern void nxagentGrabPointerAndKeyboard(XEvent *X);
...@@ -150,15 +144,7 @@ extern void nxagentUngrabPointerAndKeyboard(XEvent *X); ...@@ -150,15 +144,7 @@ extern void nxagentUngrabPointerAndKeyboard(XEvent *X);
extern void nxagentDeactivatePointerGrab(void); extern void nxagentDeactivatePointerGrab(void);
/* /*
* Handle the selection property received * Synchronize expose events between agent and the real X server.
* in the event loop.
*/
void nxagentCollectPropertyEvent(int resource);
/*
* Synchronize expose events between agent and
* the real X server.
*/ */
typedef struct _ExposuresRec typedef struct _ExposuresRec
...@@ -205,8 +191,8 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr); ...@@ -205,8 +191,8 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr);
extern int nxagentUserInput(void *p); extern int nxagentUserInput(void *p);
/* /*
* We have to check these before launching the terminate * We have to check these before launching the terminate dialog in
* dialog in rootless mode. * rootless mode.
*/ */
extern Bool nxagentLastWindowDestroyed; extern Bool nxagentLastWindowDestroyed;
......
...@@ -102,7 +102,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP ...@@ -102,7 +102,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName , FontPtr pFont); static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName , FontPtr pFont);
int nxagentFreeFont(XFontStruct *fs); int nxagentFreeFont(XFontStruct *fs);
static Bool nxagentGetFontServerPath(char * fontServerPath, int size); static Bool nxagentGetFontServerPath(char * fontServerPath, int size);
static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution); static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution);
RESTYPE RT_NX_FONT; RESTYPE RT_NX_FONT;
...@@ -158,6 +157,14 @@ static struct _nxagentFailedToReconnectFonts ...@@ -158,6 +157,14 @@ static struct _nxagentFailedToReconnectFonts
int index; int index;
} nxagentFailedToReconnectFonts = {NULL, NULL, 0, 0}; } nxagentFailedToReconnectFonts = {NULL, NULL, 0, 0};
static void nxagentFreeRemoteFontList(nxagentFontList *listRec);
void nxagentFreeFontData(void)
{
nxagentFreeFontCache();
nxagentFreeRemoteFontList(&nxagentRemoteFontList);
}
/* /*
* This is used if nxagentFullGeneration is true in CloseDisplay(). * This is used if nxagentFullGeneration is true in CloseDisplay().
*/ */
...@@ -192,7 +199,6 @@ void nxagentFreeFontCache(void) ...@@ -192,7 +199,6 @@ void nxagentFreeFontCache(void)
} }
SAFE_free(CACHE_ENTRY_PTR); SAFE_free(CACHE_ENTRY_PTR);
CACHE_ENTRY_PTR = NULL;
CACHE_INDEX = 0; CACHE_INDEX = 0;
CACHE_SIZE = 0; CACHE_SIZE = 0;
...@@ -205,12 +211,6 @@ void nxagentFreeFontCache(void) ...@@ -205,12 +211,6 @@ void nxagentFreeFontCache(void)
void nxagentListRemoteFonts(const char *searchPattern, const int maxNames) void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
{ {
char **xList;
int xLen = 0;
const char *patterns[] = {"*", "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"};
int patternsQt = 2;
if (NXDisplayError(nxagentDisplay) == 1) if (NXDisplayError(nxagentDisplay) == 1)
{ {
return; return;
...@@ -233,9 +233,13 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames) ...@@ -233,9 +233,13 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
* select the 'real' fonts. * select the 'real' fonts.
*/ */
for (int p = 0; p < patternsQt; p++) const char *patterns[] = {"*", "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"};
const int numPatterns = 2;
for (int p = 0; p < numPatterns; p++)
{ {
xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); int xLen = 0;
char **xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen);
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "nxagentListRemoteFonts: NXagent remote list [%s] has %d elements.\n", patterns[p], xLen); fprintf(stderr, "nxagentListRemoteFonts: NXagent remote list [%s] has %d elements.\n", patterns[p], xLen);
...@@ -282,7 +286,8 @@ void nxagentListRemoteAddName(const char *name, int status) ...@@ -282,7 +286,8 @@ void nxagentListRemoteAddName(const char *name, int status)
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "Font: Font# %d, [%s] change status to %s\n", fprintf(stderr, "Font: Font# %d, [%s] change status to %s\n",
pos, nxagentRemoteFontList.list[pos]->name,nxagentRemoteFontList.list[pos]->status?"OK":"deleted"); pos, nxagentRemoteFontList.list[pos]->name,
nxagentRemoteFontList.list[pos]->status ? "OK" : "deleted");
#endif #endif
} }
return; return;
...@@ -290,15 +295,16 @@ void nxagentListRemoteAddName(const char *name, int status) ...@@ -290,15 +295,16 @@ void nxagentListRemoteAddName(const char *name, int status)
if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize) if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize)
{ {
nxagentRemoteFontList.list = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) int num = nxagentRemoteFontList.listSize + 1000;
* (nxagentRemoteFontList.listSize + 1000)); nxagentFontRecPtr *tmp1 = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) * num);
if (nxagentRemoteFontList.list == NULL) if (tmp1 == NULL)
{ {
FatalError("Font: remote list memory re-allocation failed!.\n"); FatalError("Font: remote list memory re-allocation failed!.\n");
} }
nxagentRemoteFontList.listSize += 1000; nxagentRemoteFontList.list = tmp1;
nxagentRemoteFontList.listSize = num;
} }
if (pos < nxagentRemoteFontList.length) if (pos < nxagentRemoteFontList.length)
...@@ -365,6 +371,7 @@ Bool nxagentFontFind(const char *name, int *pos) ...@@ -365,6 +371,7 @@ Bool nxagentFontFind(const char *name, int *pos)
*pos=0; *pos=0;
return False; return False;
} }
int low = 0; int low = 0;
int high = nxagentRemoteFontList.length - 1; int high = nxagentRemoteFontList.length - 1;
int iter = 0; int iter = 0;
...@@ -389,7 +396,7 @@ Bool nxagentFontFind(const char *name, int *pos) ...@@ -389,7 +396,7 @@ Bool nxagentFontFind(const char *name, int *pos)
} }
break; break;
} }
*pos = (res == 0)?*pos:lpos; *pos = (res == 0) ? *pos : lpos;
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
if (res == 0) if (res == 0)
...@@ -399,14 +406,13 @@ Bool nxagentFontFind(const char *name, int *pos) ...@@ -399,14 +406,13 @@ Bool nxagentFontFind(const char *name, int *pos)
#endif #endif
return (res == 0); return (res == 0);
} }
Bool nxagentFontLookUp(const char *name) Bool nxagentFontLookUp(const char *name)
{ {
int i; int i;
if (name != NULL && strlen(name) == 0) if (name && strlen(name) == 0)
{ {
return 0; return 0;
} }
...@@ -453,51 +459,53 @@ Bool nxagentFontLookUp(const char *name) ...@@ -453,51 +459,53 @@ Bool nxagentFontLookUp(const char *name)
} }
} }
/*
* NXAGENT uses useless screen pointer to pass the original font name
* to realizeFont, could be a source of problems in the future.
*/
Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
{ {
void * priv;
Atom name_atom, value_atom;
int nprops;
FontPropPtr props;
int i;
const char *name;
char *origName = (char*) pScreen;
#ifdef HAS_XFONT2 #ifdef HAS_XFONT2
xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL);
#else #else
FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL);
#endif /* HAS_XFONT2 */ #endif /* HAS_XFONT2 */
name_atom = MakeAtom("FONT", 4, True); Atom name_atom = MakeAtom("FONT", 4, True);
value_atom = 0L; Atom value_atom = 0L;
nprops = pFont->info.nprops; int nprops = pFont->info.nprops;
props = pFont->info.props; FontPropPtr props = pFont->info.props;
for (i = 0; i < nprops; i++) for (int i = 0; i < nprops; i++)
if ((Atom)props[i].name == name_atom) { {
if ((Atom)props[i].name == name_atom)
{
value_atom = props[i].value; value_atom = props[i].value;
break; break;
} }
}
if (!value_atom) return False; if (!value_atom)
return False;
name = NameForAtom(value_atom); const char *name = NameForAtom(value_atom);
#ifdef NXAGENT_FONTCACHE_DEBUG #ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "Font: nxagentRealizeFont, realizing font: %s\n", validateString(name)); fprintf(stderr, "Font: nxagentRealizeFont, realizing font: %s\n", validateString(name));
fprintf(stderr, " atom: %ld\n", value_atom); fprintf(stderr, " atom: %ld\n", value_atom);
fprintf(stderr, "Font: Cache dump:\n"); fprintf(stderr, "Font: Cache dump:\n");
for (i = 0; i < CACHE_INDEX; i++) for (int i = 0; i < CACHE_INDEX; i++)
{ {
fprintf(stderr, "nxagentFontCache.entry[%d]->name: %s font_struct at %p\n", fprintf(stderr, "nxagentFontCache.entry[%d]->name: %s font_struct at %p\n",
i, CACHE_NAME(i), CACHE_FSTRUCT(i)); i, CACHE_NAME(i), CACHE_FSTRUCT(i));
} }
#endif #endif
if (!name) return False; if (!name)
return False;
char *origName = (char*) pScreen;
if ((strcasecmp(origName, name) != 0) && !strchr(origName,'*')) if ((strcasecmp(origName, name) != 0) && !strchr(origName,'*'))
{ {
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
...@@ -508,7 +516,7 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -508,7 +516,7 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
name = origName; name = origName;
} }
priv = (void *)malloc(sizeof(nxagentPrivFont)); void *priv = (void *)malloc(sizeof(nxagentPrivFont));
#ifdef HAS_XFONT2 #ifdef HAS_XFONT2
xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv); xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv);
#else #else
...@@ -517,22 +525,23 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -517,22 +525,23 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
nxagentFontPriv(pFont) -> mirrorID = 0; nxagentFontPriv(pFont) -> mirrorID = 0;
for (i = 0; i < nxagentFontCache.index; i++) int fci;
for (fci = 0; fci < nxagentFontCache.index; fci++)
{ {
/* if (value_atom == CACHE_ATOM(i))*/ /* if (value_atom == CACHE_ATOM(i))*/
if (strcasecmp(CACHE_NAME(i), name) == 0) if (strcasecmp(CACHE_NAME(fci), name) == 0)
{ {
#ifdef NXAGENT_FONTCACHE_DEBUG #ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "Font: nxagentFontCache hit [%s] = [%s]!\n", CACHE_NAME(i), validateString(name)); fprintf(stderr, "Font: nxagentFontCache hit [%s] = [%s]!\n", CACHE_NAME(fci), validateString(name));
#endif #endif
break; break;
} }
} }
if (i < CACHE_INDEX) if (fci < CACHE_INDEX)
{ {
nxagentFontPriv(pFont)->font_struct = CACHE_FSTRUCT(i); nxagentFontPriv(pFont)->font_struct = CACHE_FSTRUCT(fci);
strcpy(nxagentFontPriv(pFont)->fontName, name); strcpy(nxagentFontPriv(pFont)->fontName, name);
} }
else else
...@@ -543,14 +552,18 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -543,14 +552,18 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
if (CACHE_INDEX == CACHE_SIZE) if (CACHE_INDEX == CACHE_SIZE)
{ {
CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (CACHE_SIZE + 100)); int num = CACHE_SIZE + 100;
nxCacheFontEntryRecPtr *tmp1 = realloc(CACHE_ENTRY_PTR,
sizeof(nxCacheFontEntryRecPtr) * num);
if (CACHE_ENTRY_PTR == NULL) if (tmp1 == NULL)
{ {
FatalError("Font: Cache list memory re-allocation failed.\n"); FatalError("Font: Cache list memory re-allocation failed.\n");
} }
CACHE_SIZE += 100; CACHE_ENTRY_PTR = tmp1;
CACHE_SIZE = num;
} }
CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec)); CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec));
...@@ -580,9 +593,9 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -580,9 +593,9 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
strcpy(nxagentFontPriv(pFont)->fontName, name); strcpy(nxagentFontPriv(pFont)->fontName, name);
if (nxagentFontPriv(pFont)->font_struct != NULL) if (nxagentFontPriv(pFont)->font_struct != NULL)
{ {
CACHE_ATOM(i) = value_atom; CACHE_ATOM(fci) = value_atom;
strcpy(CACHE_NAME(i), name); strcpy(CACHE_NAME(fci), name);
CACHE_FSTRUCT(i) = nxagentFontPriv(pFont)->font_struct; CACHE_FSTRUCT(fci) = nxagentFontPriv(pFont)->font_struct;
CACHE_INDEX++; CACHE_INDEX++;
nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index); nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index);
...@@ -611,8 +624,10 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -611,8 +624,10 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
} }
} }
else else
{
fprintf(stderr, "Font: nxagentRealizeFont OK realizing font Font=%s\n", fprintf(stderr, "Font: nxagentRealizeFont OK realizing font Font=%s\n",
validateString(name)); validateString(name));
}
#endif #endif
...@@ -627,11 +642,11 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -627,11 +642,11 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
{ {
if (nxagentFontStruct(pFont)) if (nxagentFontStruct(pFont))
{ {
int i; int fci;
for (i = 0; i < CACHE_INDEX; i++) for (fci = 0; fci < CACHE_INDEX; fci++)
{ {
if (CACHE_FSTRUCT(i) == nxagentFontStruct(pFont)) if (CACHE_FSTRUCT(fci) == nxagentFontStruct(pFont))
{ {
#ifdef NXAGENT_FONTCACHE_DEBUG #ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "nxagentUnrealizeFont: Not freeing the font in cache.\n"); fprintf(stderr, "nxagentUnrealizeFont: Not freeing the font in cache.\n");
...@@ -641,7 +656,7 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -641,7 +656,7 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
} }
} }
if (i == CACHE_INDEX) if (fci == CACHE_INDEX)
{ {
/* /*
* This font is not in the cache. * This font is not in the cache.
...@@ -649,7 +664,7 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -649,7 +664,7 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
#ifdef NXAGENT_FONTCACHE_DEBUG #ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "nxagentUnrealizeFont: Freeing font not found in cache '%d'\n", fprintf(stderr, "nxagentUnrealizeFont: Freeing font not found in cache '%d'\n",
CACHE_ATOM(i)); CACHE_ATOM(fci));
#endif #endif
XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); XFreeFont(nxagentDisplay, nxagentFontStruct(pFont));
...@@ -737,7 +752,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP ...@@ -737,7 +752,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
#ifdef WARNING #ifdef WARNING
if (nxagentVerbose == 1) if (nxagentVerbose == 1)
{ {
fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Font name in non standard format. \n"); fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Font name in non standard format.\n");
} }
#endif #endif
} }
...@@ -765,7 +780,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP ...@@ -765,7 +780,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
if (numSearchFields > FIELDS) if (numSearchFields > FIELDS)
{ {
tempWeight = 0; tempWeight = 0;
for (int j = 0; j < FIELDS; j++) for (int j = 0; j < FIELDS; j++)
...@@ -781,7 +795,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP ...@@ -781,7 +795,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
tempWeight <<= 1; tempWeight <<= 1;
} }
} }
if (tempWeight > weight) if (tempWeight > weight)
...@@ -870,7 +883,8 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id) ...@@ -870,7 +883,8 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
nxagentFailedToReconnectFonts.font = malloc(nxagentFailedToReconnectFonts.size * nxagentFailedToReconnectFonts.font = malloc(nxagentFailedToReconnectFonts.size *
sizeof(FontPtr)); sizeof(FontPtr));
nxagentFailedToReconnectFonts.id = malloc(nxagentFailedToReconnectFonts.size * sizeof(XID)); nxagentFailedToReconnectFonts.id = malloc(nxagentFailedToReconnectFonts.size *
sizeof(XID));
if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL)
{ {
...@@ -887,21 +901,23 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id) ...@@ -887,21 +901,23 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
} }
else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1) else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1)
{ {
nxagentFailedToReconnectFonts.size *= 2; int num = 2 * nxagentFailedToReconnectFonts.size;
nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, FontPtr *tmp1 = realloc(nxagentFailedToReconnectFonts.font, num * sizeof(FontPtr));
nxagentFailedToReconnectFonts.size * XID *tmp2 = realloc(nxagentFailedToReconnectFonts.id, num * sizeof(XID));
sizeof(FontPtr));
nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, if (tmp1 == NULL || tmp2 == NULL)
nxagentFailedToReconnectFonts.size *
sizeof(XID));
if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL)
{ {
SAFE_free(tmp1);
SAFE_free(tmp2);
FatalError("Font: font not reconnected memory re-allocation failed!.\n"); FatalError("Font: font not reconnected memory re-allocation failed!.\n");
} }
nxagentFailedToReconnectFonts.size = num;
nxagentFailedToReconnectFonts.font = tmp1;
nxagentFailedToReconnectFonts.id = tmp2;
#ifdef NXAGENT_RECONNECT_FONT_DEBUG #ifdef NXAGENT_RECONNECT_FONT_DEBUG
fprintf(stderr,"nxagentCollectFailedFont: reallocated memory.\n "); fprintf(stderr,"nxagentCollectFailedFont: reallocated memory.\n ");
#endif #endif
...@@ -1029,7 +1045,7 @@ static void nxagentCleanCacheAfterReconnect(void) ...@@ -1029,7 +1045,7 @@ static void nxagentCleanCacheAfterReconnect(void)
for (int i = 0; i < CACHE_INDEX; i++) for (int i = 0; i < CACHE_INDEX; i++)
{ {
if(CACHE_FSTRUCT(i) == NULL) if (CACHE_FSTRUCT(i) == NULL)
{ {
SAFE_XFree(CACHE_NAME(i)); SAFE_XFree(CACHE_NAME(i));
real_size--; real_size--;
...@@ -1042,7 +1058,8 @@ static void nxagentCleanCacheAfterReconnect(void) ...@@ -1042,7 +1058,8 @@ static void nxagentCleanCacheAfterReconnect(void)
nxCacheFontEntryRecPtr swapEntryPtr; nxCacheFontEntryRecPtr swapEntryPtr;
/* Find - first bad occurrence if exist. */ /* Find - first bad occurrence if exist. */
while ((i < real_size) && CACHE_FSTRUCT(i)) i++; while ((i < real_size) && CACHE_FSTRUCT(i))
i++;
/* Really nothing more to do. */ /* Really nothing more to do. */
if (i == real_size) if (i == real_size)
...@@ -1123,13 +1140,12 @@ Bool nxagentReconnectAllFonts(void *p0) ...@@ -1123,13 +1140,12 @@ Bool nxagentReconnectAllFonts(void *p0)
static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2) static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2)
{ {
int i; int i;
nxagentPrivFont *privFont;
Bool *pBool = (Bool*)param2; Bool *pBool = (Bool*)param2;
if (pFont == NULL) if (pFont == NULL)
return; return;
privFont = nxagentFontPriv(pFont); nxagentPrivFont *privFont = nxagentFontPriv(pFont);
#ifdef NXAGENT_RECONNECT_FONT_DEBUG #ifdef NXAGENT_RECONNECT_FONT_DEBUG
fprintf(stderr, "nxagentFailedFontReconnect: pFont %p - XID %lx - name %s\n", fprintf(stderr, "nxagentFailedFontReconnect: pFont %p - XID %lx - name %s\n",
...@@ -1211,15 +1227,7 @@ static void nxagentFreeFailedToReconnectFonts(void) ...@@ -1211,15 +1227,7 @@ static void nxagentFreeFailedToReconnectFonts(void)
Bool nxagentReconnectFailedFonts(void *p0) Bool nxagentReconnectFailedFonts(void *p0)
{ {
int attempt = 1;
const int maxAttempt = 5;
char **fontPaths, **localFontPaths, **newFontPaths;
char fontServerPath[256] = ""; char fontServerPath[256] = "";
int nPaths = 0;
Bool repeat = True;
Bool fontSuccess = True;
reconnectFlexibility = *((int *) p0); reconnectFlexibility = *((int *) p0);
...@@ -1239,20 +1247,25 @@ Bool nxagentReconnectFailedFonts(void *p0) ...@@ -1239,20 +1247,25 @@ Bool nxagentReconnectFailedFonts(void *p0)
fprintf(stderr, "nxagentReconnectFailedFonts: font server path [%s]\n", fontServerPath); fprintf(stderr, "nxagentReconnectFailedFonts: font server path [%s]\n", fontServerPath);
#endif #endif
fontPaths = XGetFontPath(nxagentDisplay, &nPaths); int nPaths = 0;
char **fontPaths = XGetFontPath(nxagentDisplay, &nPaths);
char **newFontPaths = malloc((nPaths + 1) * sizeof(char *));
if ((newFontPaths = malloc((nPaths + 1) * sizeof(char *))) == NULL) if (newFontPaths == NULL)
{ {
FatalError("nxagentReconnectFailedFonts: malloc failed."); FatalError("nxagentReconnectFailedFonts: malloc failed.");
} }
memcpy(newFontPaths, fontPaths, nPaths * sizeof(char*)); memcpy(newFontPaths, fontPaths, nPaths * sizeof(char*));
localFontPaths = newFontPaths; char **localFontPaths = newFontPaths;
localFontPaths += nPaths; localFontPaths += nPaths;
*localFontPaths = fontServerPath; *localFontPaths = fontServerPath;
while(repeat) int attempt = 1;
const int maxAttempt = 5;
Bool repeat = True;
while (repeat)
{ {
#ifdef NXAGENT_RECONNECT_FONT_DEBUG #ifdef NXAGENT_RECONNECT_FONT_DEBUG
fprintf(stderr, "nxagentReconnectFailedFonts: attempt [%d].\n", attempt); fprintf(stderr, "nxagentReconnectFailedFonts: attempt [%d].\n", attempt);
...@@ -1264,11 +1277,11 @@ Bool nxagentReconnectFailedFonts(void *p0) ...@@ -1264,11 +1277,11 @@ Bool nxagentReconnectFailedFonts(void *p0)
nxagentFreeRemoteFontList(&nxagentRemoteFontList); nxagentFreeRemoteFontList(&nxagentRemoteFontList);
nxagentListRemoteFonts("*", nxagentMaxFontNames); nxagentListRemoteFonts("*", nxagentMaxFontNames);
for(int i = 0; i < nxagentFailedToReconnectFonts.index; i++) for (int i = 0; i < nxagentFailedToReconnectFonts.index; i++)
{ {
fontSuccess = True; Bool fontSuccess = True;
if(nxagentFailedToReconnectFonts.font[i]) if (nxagentFailedToReconnectFonts.font[i])
{ {
nxagentFailedFontReconnect(nxagentFailedToReconnectFonts.font[i], nxagentFailedFontReconnect(nxagentFailedToReconnectFonts.font[i],
nxagentFailedToReconnectFonts.id[i], nxagentFailedToReconnectFonts.id[i],
...@@ -1282,7 +1295,6 @@ Bool nxagentReconnectFailedFonts(void *p0) ...@@ -1282,7 +1295,6 @@ Bool nxagentReconnectFailedFonts(void *p0)
{ {
repeat = True; repeat = True;
} }
} }
} }
...@@ -1334,9 +1346,9 @@ Bool nxagentDisconnectAllFonts(void) ...@@ -1334,9 +1346,9 @@ Bool nxagentDisconnectAllFonts(void)
FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT,
(FindResType) nxagentFontDisconnect, &fontSuccess); (FindResType) nxagentFontDisconnect, &fontSuccess);
for(int cid = 0; cid < MAXCLIENTS; cid++) for (int cid = 0; cid < MAXCLIENTS; cid++)
{ {
if( clients[cid] && fontSuccess ) if (clients[cid] && fontSuccess)
{ {
FindClientResourcesByType(clients[cid], RT_FONT, FindClientResourcesByType(clients[cid], RT_FONT,
(FindResType) nxagentFontDisconnect, &fontSuccess); (FindResType) nxagentFontDisconnect, &fontSuccess);
...@@ -1505,10 +1517,7 @@ void nxagentVerifyDefaultFontPath(void) ...@@ -1505,10 +1517,7 @@ void nxagentVerifyDefaultFontPath(void)
XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFont) XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFont)
{ {
XFontStruct* fs; XFontStruct* fs = (XFontStruct *) malloc (sizeof (XFontStruct));
xCharInfo *xcip;
fs = (XFontStruct *) malloc (sizeof (XFontStruct));
if (fs == NULL) if (fs == NULL)
{ {
...@@ -1552,7 +1561,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo ...@@ -1552,7 +1561,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
if (fs -> n_properties > 0) if (fs -> n_properties > 0)
{ {
register long nbytes; long nbytes;
nbytes = pFont -> info.nprops * sizeof(XFontProp); nbytes = pFont -> info.nprops * sizeof(XFontProp);
fs -> properties = (XFontProp *) malloc((unsigned) nbytes); fs -> properties = (XFontProp *) malloc((unsigned) nbytes);
...@@ -1570,7 +1579,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo ...@@ -1570,7 +1579,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
memmove(fs -> properties, pFont -> info.props, nbytes); memmove(fs -> properties, pFont -> info.props, nbytes);
} }
xcip = (xCharInfo *) &pFont -> info.ink_minbounds; xCharInfo *xcip = (xCharInfo *) &pFont -> info.ink_minbounds;
fs -> min_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); fs -> min_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing);
fs -> min_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); fs -> min_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing);
......
...@@ -82,4 +82,5 @@ void nxagentVerifyDefaultFontPath(void); ...@@ -82,4 +82,5 @@ void nxagentVerifyDefaultFontPath(void);
int nxagentSplitString(char *string, char *fields[], int nfields, char *sep); int nxagentSplitString(char *string, char *fields[], int nfields, char *sep);
void nxagentFreeFontData(void);
#endif /* __Font_H__ */ #endif /* __Font_H__ */
...@@ -1264,7 +1264,7 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen) ...@@ -1264,7 +1264,7 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen)
int nxagentSaveGCTrap = nxagentGCTrap; int nxagentSaveGCTrap = nxagentGCTrap;
nxagentGCTrap = 0; nxagentGCTrap = False;
GCPtr pGC = GetScratchGC(depth, pScreen); GCPtr pGC = GetScratchGC(depth, pScreen);
......
...@@ -80,7 +80,7 @@ static int nxagentSaveGCTrap; ...@@ -80,7 +80,7 @@ static int nxagentSaveGCTrap;
{ \ { \
nxagentSaveGCTrap = nxagentGCTrap;\ nxagentSaveGCTrap = nxagentGCTrap;\
\ \
nxagentGCTrap = 1; \ nxagentGCTrap = True; \
} }
#define RESET_GC_TRAP() \ #define RESET_GC_TRAP() \
...@@ -313,7 +313,7 @@ FIXME: The popup could be synchronized with one single put image, ...@@ -313,7 +313,7 @@ FIXME: The popup could be synchronized with one single put image,
RegionUninit(&corruptedRegion); RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion); nxagentFreeRegion(pSrcRegion);
if (nxagentDrawableStatus(pSrcDrawable) == Synchronized) if (nxagentDrawableStatus(pSrcDrawable) == Synchronized)
{ {
...@@ -511,7 +511,7 @@ FIXME: The popup could be synchronized with one single put image, ...@@ -511,7 +511,7 @@ FIXME: The popup could be synchronized with one single put image,
if (pClipRegionFree == True) if (pClipRegionFree == True)
{ {
nxagentFreeRegion(pSrcDrawable, pClipRegion); nxagentFreeRegion(pClipRegion);
} }
FreeScratchGC(targetGC); FreeScratchGC(targetGC);
...@@ -527,10 +527,10 @@ FIXME: The popup could be synchronized with one single put image, ...@@ -527,10 +527,10 @@ FIXME: The popup could be synchronized with one single put image,
* we deallocate it explicitly only if we don't change the clip. * we deallocate it explicitly only if we don't change the clip.
*/ */
nxagentFreeRegion(pSrcDrawable, pClipRegion); nxagentFreeRegion(pClipRegion);
} }
nxagentFreeRegion(pSrcDrawable, pCorruptedRegion); nxagentFreeRegion(pCorruptedRegion);
return 1; return 1;
} }
...@@ -562,7 +562,7 @@ FIXME: The popup could be synchronized with one single put image, ...@@ -562,7 +562,7 @@ FIXME: The popup could be synchronized with one single put image,
RegionUninit(&corruptedRegion); RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion); nxagentFreeRegion(pSrcRegion);
} }
return 0; return 0;
...@@ -800,7 +800,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, ...@@ -800,7 +800,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstRegion);
} }
} }
...@@ -981,7 +981,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, ...@@ -981,7 +981,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstRegion);
skip = 1; skip = 1;
} }
...@@ -1009,12 +1009,12 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, ...@@ -1009,12 +1009,12 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstRegion);
} }
RegionUninit(&corruptedRegion); RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion); nxagentFreeRegion(pSrcRegion);
} }
} }
#ifdef TEST #ifdef TEST
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "Reconnect.h" #include "Reconnect.h"
#include "Dialog.h" #include "Dialog.h"
#include "Drawable.h" #include "Drawable.h"
#include "Splash.h" #include "Xdmcp.h"
#include "Screen.h" #include "Screen.h"
#include "Millis.h" #include "Millis.h"
...@@ -573,7 +573,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask) ...@@ -573,7 +573,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
if (!SmartScheduleSignalEnable) if (!SmartScheduleSignalEnable)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n"); fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n");
#endif #endif
...@@ -582,7 +581,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask) ...@@ -582,7 +581,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.in = nxagentBytesIn;
nxagentDispatch.out = nxagentBytesOut; nxagentDispatch.out = nxagentBytesOut;
} }
/* /*
...@@ -638,12 +636,10 @@ void nxagentWakeupHandler(void * data, int count, void * mask) ...@@ -638,12 +636,10 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
nxagentReady = count; nxagentReady = count;
#ifdef TEST #ifdef TEST
if (nxagentReady == 0) if (nxagentReady == 0)
{ {
fprintf(stderr, "nxagentWakeupHandler: No X clients found to be processed.\n"); fprintf(stderr, "nxagentWakeupHandler: No X clients found to be processed.\n");
} }
#endif #endif
/* /*
...@@ -714,17 +710,17 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas ...@@ -714,17 +710,17 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0) if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n", fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n",
nxagentOption(SleepTime)); nxagentOption(SleepTime));
#endif #endif
usleep(nxagentOption(SleepTime) * 1000); usleep(nxagentOption(SleepTime) * 1000);
} }
#ifdef TEST #ifdef TEST
else if (0 == nxagentOption(SleepTime)) { else if (0 == nxagentOption(SleepTime)) {
fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n"); fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n");
} }
#endif #endif
if (nxagentReadEvents(nxagentDisplay) > 0 || if (nxagentReadEvents(nxagentDisplay) > 0 ||
nxagentReadEvents(nxagentShadowDisplay) > 0) nxagentReadEvents(nxagentShadowDisplay) > 0)
...@@ -1003,7 +999,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1003,7 +999,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
if (!SmartScheduleSignalEnable) if (!SmartScheduleSignalEnable)
{ {
/* /*
* Pay attention to the next client if this client produced * Pay attention to the next client if this client produced
* enough output. * enough output.
...@@ -1032,9 +1027,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1032,9 +1027,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client);
} }
#endif #endif
} }
return; return;
} }
else if (in > 0) else if (in > 0)
...@@ -1048,6 +1041,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1048,6 +1041,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
in, client -> index); in, client -> index);
#endif #endif
#ifdef COUNT_CLIENT_BYTES
/* /*
* This is presently unused. * This is presently unused.
* *
...@@ -1059,6 +1053,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1059,6 +1053,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
* #endif * #endif
* *
*/ */
#endif
nxagentBytesIn += in; nxagentBytesIn += in;
...@@ -1077,7 +1072,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1077,7 +1072,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
if (!SmartScheduleSignalEnable) if (!SmartScheduleSignalEnable)
{ {
if (client -> index != nxagentDispatch.client) if (client -> index != nxagentDispatch.client)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -1122,9 +1116,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1122,9 +1116,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
} }
#endif #endif
} }
} }
} }
/* /*
...@@ -1168,12 +1160,10 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) ...@@ -1168,12 +1160,10 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
*/ */
#ifdef TEST #ifdef TEST
if (nxagentTokens.pending == TOKENS_PENDING_LIMIT) if (nxagentTokens.pending == TOKENS_PENDING_LIMIT)
{ {
fprintf(stderr, "nxagentDispatchHandler: WARNING! Waiting for the synchronization reply.\n"); fprintf(stderr, "nxagentDispatchHandler: WARNING! Waiting for the synchronization reply.\n");
} }
#endif #endif
while (nxagentTokens.pending == TOKENS_PENDING_LIMIT) while (nxagentTokens.pending == TOKENS_PENDING_LIMIT)
......
...@@ -864,7 +864,7 @@ nxagentPutImageEnd: ...@@ -864,7 +864,7 @@ nxagentPutImageEnd:
if (pRegion != NullRegion) if (pRegion != NullRegion)
{ {
nxagentFreeRegion(pDrawable, pRegion); nxagentFreeRegion(pRegion);
} }
} }
...@@ -992,7 +992,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, ...@@ -992,7 +992,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
if (clipRegion != NullRegion) if (clipRegion != NullRegion)
{ {
nxagentFreeRegion(pDrawable, clipRegion); nxagentFreeRegion(clipRegion);
} }
y += h; y += h;
......
...@@ -190,34 +190,35 @@ INCLUDES = \ ...@@ -190,34 +190,35 @@ INCLUDES = \
#endif #endif
#endif #endif
### NXAGENT Defines: ### list of existing NXAGENT macros:
# #
# NXAGENT_SHAPE Old shape code # NXAGENT_SHAPE Old shape code
# NXAGENT_SHAPE2 New shape code # NXAGENT_SHAPE2 New shape code
# NXAGENT_FIXKEYS Force the release of pressed key when losing focus # NXAGENT_FIXKEYS Force the release of pressed key when losing focus
# NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers. # NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers.
# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR modes (i.e., nx_<x>x<y>) (default: nx_) # NXAGENT_RANDR_MODE_PREFIX Prefix for RandR display modes (i.e., nx_<x>x<y>) (default: nx_)
# NXAGENT_RANDR_XINERAMA_CLIPPING cut off invisible window parts in xinerama mode (you probably do not want this) # NXAGENT_RANDR_XINERAMA_CLIPPING cut off invisible window parts in xinerama mode (you probably do not want this)
# NXAGENT_TIMESTAMP print duration for some routines # NXAGENT_TIMESTAMP print duration for some routines
# NXAGENT_ONSTART communicate about startup phase to the original nxclient by NoMachine via selections
# NXAGENT_WAKEUP=<milliseconds> Specifies a timeout that makes WaitForSomething() return earlier than normal which
# enables nxagent to close the splash window at the right time and/or improve connection
# handling for the xdmcp option.
# This only has an effect if NX_TRANS_WAKEUP is also set for os/WaitFor.c
# NXAGENT_ARTSD enable special handling of MCOPGLOBALS property used by artsd.
# NXAGENT_RENDER_CLEANUP cleanup padding bits/bytes of glyphs to possibly increase compression rate
# #
### macros not investigated yet: ### macros not investigated yet:
# #
# NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL # NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
# NXAGENT_RENDER_CLEANUP
# NXAGENT_WAKEUP=<milliseconds>
# NXAGENT_ONSTART
# NXAGENT_SPLASH
# NXAGENT_ARTSD
# #
### Debug macros: ### Debug macros:
# #
# DEBUG_COLORMAP # DEBUG_COLORMAP
# DEBUG_TREE # DEBUG_TREE Include code that activates the keystroke to print the current window tree
# NXAGENT_DEBUG
# NXAGENT_FIXKEYS_DEBUG # NXAGENT_FIXKEYS_DEBUG
# NXAGENT_FONTCACHE_DEBUG # NXAGENT_FONTCACHE_DEBUG
# NXAGENT_FONTMATCH_DEBUG # NXAGENT_FONTMATCH_DEBUG
# NXAGENT_LOGO_DEBUG # NXAGENT_LOGO_DEBUG print details about splash logo creating and paint some helper lines
# NXAGENT_RECONNECT_COLORMAP_DEBUG # NXAGENT_RECONNECT_COLORMAP_DEBUG
# NXAGENT_RECONNECT_CURSOR_DEBUG # NXAGENT_RECONNECT_CURSOR_DEBUG
# NXAGENT_RECONNECT_DEBUG # NXAGENT_RECONNECT_DEBUG
...@@ -228,7 +229,9 @@ INCLUDES = \ ...@@ -228,7 +229,9 @@ INCLUDES = \
# NXAGENT_RECONNECT_SCREEN_DEBUG # NXAGENT_RECONNECT_SCREEN_DEBUG
# NXAGENT_RECONNECT_WINDOW_DEBUG # NXAGENT_RECONNECT_WINDOW_DEBUG
# NXAGENT_XKBD_DEBUG # NXAGENT_XKBD_DEBUG
# NX_DEBUG_INPUT # NX_DEBUG_INPUT include input debugging code. Can then by controlled at runtime by
# xprop -root -f NX_DEBUG_INPUT 8b -set NX_DEBUG_INPUT "True" or
# xprop -root -f NX_DEBUG_INPUT 8b -set NX_DEBUG_INPUT "False"
#if nxVersion #if nxVersion
NX_DEFINES = \ NX_DEFINES = \
......
...@@ -54,6 +54,7 @@ is" without express or implied warranty. ...@@ -54,6 +54,7 @@ is" without express or implied warranty.
#include "mi.h" #include "mi.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#include "dixfontstr.h" #include "dixfontstr.h"
#include "dixstruct.h"
#include "Agent.h" #include "Agent.h"
#include "Display.h" #include "Display.h"
...@@ -74,6 +75,7 @@ is" without express or implied warranty. ...@@ -74,6 +75,7 @@ is" without express or implied warranty.
#include "Error.h" #include "Error.h"
#include "Keystroke.h" #include "Keystroke.h"
#include "Atoms.h" #include "Atoms.h"
#include "Client.h"
#include <nx/NX.h> #include <nx/NX.h>
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -98,15 +100,6 @@ extern int (*ProcVector[256])(ClientPtr); ...@@ -98,15 +100,6 @@ extern int (*ProcVector[256])(ClientPtr);
*/ */
extern int fbGCPrivateIndex; extern int fbGCPrivateIndex;
#ifdef DPMSExtension
/*
* Stubs for the DPMS extension.
*/
void DPMSSet(int level);
int DPMSGet(int *level);
Bool DPMSSupported(void);
#endif
/* /*
* Our error logging function. * Our error logging function.
*/ */
...@@ -395,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably ...@@ -395,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably
nxagentInitKeystrokes(False); nxagentInitKeystrokes(False);
#ifdef NXAGENT_CLIPBOARD #ifdef NXAGENT_CLIPBOARD
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL); AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL);
#endif #endif
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback(&ClientStateCallback, nxagentClientStateCallback, NULL);
nxagentInitAtoms(); nxagentInitAtoms();
} }
...@@ -625,19 +622,3 @@ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data, ...@@ -625,19 +622,3 @@ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data,
nxagentGrabServerInfo.client = grab->client; nxagentGrabServerInfo.client = grab->client;
nxagentGrabServerInfo.grabstate = grab->grabstate; nxagentGrabServerInfo.grabstate = grab->grabstate;
} }
#ifdef DPMSExtension
void DPMSSet(int level)
{
}
int DPMSGet(int *level)
{
return -1;
}
Bool DPMSSupported(void)
{
return 0;
}
#endif
...@@ -80,7 +80,8 @@ is" without express or implied warranty. ...@@ -80,7 +80,8 @@ is" without express or implied warranty.
#include <errno.h> #include <errno.h>
static void nxagentXkbGetNames(void); static void nxagentXkbGetRemoteNames(void);
static void nxagentXkbClearRemoteNames(void);
void nxagentKeycodeConversionSetup(void); void nxagentKeycodeConversionSetup(void);
...@@ -696,6 +697,9 @@ XkbError: ...@@ -696,6 +697,9 @@ XkbError:
} }
#endif #endif
/* we don't need the remote keyboard information anymore */
nxagentXkbClearRemoteNames();
xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
if (xkb && xkb->geom) if (xkb && xkb->geom)
...@@ -1341,7 +1345,7 @@ void nxagentTuneXkbWrapper(void) ...@@ -1341,7 +1345,7 @@ void nxagentTuneXkbWrapper(void)
} }
} }
void nxagentXkbClearNames(void) void nxagentXkbClearRemoteNames(void)
{ {
SAFE_free(nxagentRemoteRules); SAFE_free(nxagentRemoteRules);
SAFE_free(nxagentRemoteModel); SAFE_free(nxagentRemoteModel);
...@@ -1350,7 +1354,7 @@ void nxagentXkbClearNames(void) ...@@ -1350,7 +1354,7 @@ void nxagentXkbClearNames(void)
SAFE_free(nxagentRemoteOptions); SAFE_free(nxagentRemoteOptions);
} }
static void nxagentXkbGetNames(void) static void nxagentXkbGetRemoteNames(void)
{ {
if (nxagentRemoteRules) if (nxagentRemoteRules)
return; return;
...@@ -1554,7 +1558,7 @@ void nxagentKeycodeConversionSetup(void) ...@@ -1554,7 +1558,7 @@ void nxagentKeycodeConversionSetup(void)
Bool nxagentGetRemoteXkbExtension(void) Bool nxagentGetRemoteXkbExtension(void)
{ {
nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1; nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1;
nxagentXkbClearNames(); nxagentXkbClearRemoteNames();
Bool result = XkbQueryExtension(nxagentDisplay, Bool result = XkbQueryExtension(nxagentDisplay,
&nxagentXkbInfo.Opcode, &nxagentXkbInfo.Opcode,
...@@ -1565,7 +1569,7 @@ Bool nxagentGetRemoteXkbExtension(void) ...@@ -1565,7 +1569,7 @@ Bool nxagentGetRemoteXkbExtension(void)
if (result) if (result)
{ {
nxagentXkbGetNames(); nxagentXkbGetRemoteNames();
} }
#ifdef WARNING #ifdef WARNING
else else
......
...@@ -428,35 +428,117 @@ void nxagentInitKeystrokes(Bool force) ...@@ -428,35 +428,117 @@ void nxagentInitKeystrokes(Bool force)
nxagentDumpKeystrokes(); nxagentDumpKeystrokes();
} }
void nxagentDumpKeystrokes(void) static char *nxagentGetSingleKeystrokeString(struct nxagentSpecialKeystrokeMap *cur)
{
if (!cur)
return strdup(""); /* caller is expected to free the returned string */
char *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10, *s11;
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = "";
unsigned int mask = cur->modifierMask;
if (mask & ControlMask) {s1 = "Ctrl+"; mask &= ~ControlMask;}
if (mask & ShiftMask) {s2 = "Shift+"; mask &= ~ShiftMask;}
/* these are only here for better readable modifier names. Normally
they are covered by the Mod<n> and Lock lines below */
if (cur->modifierAltMeta) {s3 = "Alt+"; mask &= ~(cur->modifierAltMeta);}
if (mask & nxagentCapsMask) {s4 = "CapsLock+"; mask &= ~nxagentCapsMask;}
if (mask & nxagentNumlockMask) {s5 = "NumLock+"; mask &= ~nxagentNumlockMask;}
if (mask & Mod1Mask) {s6 = "Mod1+"; mask &= ~Mod1Mask;}
if (mask & Mod2Mask) {s7 = "Mod2+"; mask &= ~Mod2Mask;}
if (mask & Mod3Mask) {s8 = "Mod3+"; mask &= ~Mod3Mask;}
if (mask & Mod4Mask) {s9 = "Mod4+"; mask &= ~Mod4Mask;}
if (mask & Mod5Mask) {s10 = "Mod5+"; mask &= ~Mod5Mask;}
if (mask & LockMask) {s11 = "Lock+"; mask &= ~LockMask;}
char *ret = NULL;
asprintf(&ret, "%s%s%s%s%s%s%s%s%s%s%s%s", s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, XKeysymToString(cur->keysym));
return ret;
}
/*
* return the _first_ keystroke for the passed keystroke name
*
* e.g. nxagentFindFirstKeystroke("resize") -> "Ctrl+Alt+r"
*
* result must be free()d after use.
*/
char *nxagentFindFirstKeystroke(char *name)
{
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++)
{
if (nxagentSpecialKeystrokeNames[cur->stroke] &&
strcmp(nxagentSpecialKeystrokeNames[cur->stroke], name) == 0)
{
return nxagentGetSingleKeystrokeString(cur);
}
}
return NULL;
}
/*
* return a string with linefeeds of all keystrokes who's name starts
* with the the passed string,
*
* e.g. nxagentFindKeystrokeString("viewport_scroll_")
* ->
* " viewport_scroll_left : Ctrl+Alt+Left
* viewport_scroll_left : Ctrl+Alt+KP_Left
* viewport_scroll_up : Ctrl+Alt+Up
* viewport_scroll_up : Ctrl+Alt+KP_Up
* viewport_scroll_right : Ctrl+Alt+Right
* viewport_scroll_right : Ctrl+Alt+KP_Right
* viewport_scroll_down : Ctrl+Alt+Down
* viewport_scroll_down : Ctrl+Alt+KP_Down
* "
* result must be free()d after use.
*/
char *nxagentFindMatchingKeystrokes(char *name)
{ {
int maxlen = 0; int maxlen = 0;
for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++) for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++)
maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i]));
fprintf(stderr, "Currently known keystrokes:\n"); char * res = strdup(""); /* let the caller free the string */
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++)
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { {
unsigned int mask = cur->modifierMask; if (nxagentSpecialKeystrokeNames[cur->stroke] &&
fprintf(stderr, " %-*s ", maxlen, nxagentSpecialKeystrokeNames[cur->stroke]); strncmp(nxagentSpecialKeystrokeNames[cur->stroke], name, strlen(name)) == 0)
if (mask & ControlMask) {fprintf(stderr, "Ctrl+"); mask &= ~ControlMask;} {
if (mask & ShiftMask) {fprintf(stderr, "Shift+"); mask &= ~ShiftMask;} char *tmp;
char *tmp1 = nxagentGetSingleKeystrokeString(cur);
/* these are only here for better readable modifier if (-1 == asprintf(&tmp, "%s %-*s : %s\n", res, maxlen,
names. Normally they are covered by the Mod<n> and Lock lines nxagentSpecialKeystrokeNames[cur->stroke],
below */ tmp1))
if (cur->modifierAltMeta) {fprintf(stderr, "Alt+"); mask &= ~(cur->modifierAltMeta);} {
if (mask & nxagentCapsMask) {fprintf(stderr, "CapsLock+"); mask &= ~nxagentCapsMask;} SAFE_free(tmp1);
if (mask & nxagentNumlockMask) {fprintf(stderr, "NumLock+"); mask &= ~nxagentNumlockMask;} #ifdef TEST
fprintf(stderr, "%s: returning incomplete result:\n%s", __func__, res);
if (mask & Mod1Mask) {fprintf(stderr, "Mod1+"); mask &= ~Mod1Mask;} #endif
if (mask & Mod2Mask) {fprintf(stderr, "Mod2+"); mask &= ~Mod2Mask;} return res;
if (mask & Mod3Mask) {fprintf(stderr, "Mod3+"); mask &= ~Mod3Mask;}
if (mask & Mod4Mask) {fprintf(stderr, "Mod4+"); mask &= ~Mod4Mask;}
if (mask & Mod5Mask) {fprintf(stderr, "Mod5+"); mask &= ~Mod5Mask;}
if (mask & LockMask) {fprintf(stderr, "Lock+"); mask &= ~LockMask;}
fprintf(stderr, "%s\n", XKeysymToString(cur->keysym));
} }
else
{
SAFE_free(tmp1);
free(res);
res = tmp;
}
}
}
#ifdef TEST
fprintf(stderr, "%s: returning result:\n%s", __func__, res);
#endif
return res;
}
void nxagentDumpKeystrokes(void)
{
char *s = nxagentFindMatchingKeystrokes("");
fprintf(stderr, "Currently known keystrokes:\n%s", s);
SAFE_free(s);
} }
static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X)
...@@ -465,7 +547,6 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) ...@@ -465,7 +547,6 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X)
KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym); fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym);
#endif #endif
...@@ -566,7 +647,7 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) ...@@ -566,7 +647,7 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
break; break;
case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB: case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB:
if (X->type == KeyPress) { if (X->type == KeyPress) {
nxagentDeactivateInputDevicesGrab(); nxagentDeactivateInputDevicesGrabs();
} }
return True; return True;
break; break;
......
...@@ -32,6 +32,9 @@ extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); ...@@ -32,6 +32,9 @@ extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*);
extern void nxagentDumpKeystrokes(void); extern void nxagentDumpKeystrokes(void);
extern void nxagentInitKeystrokes(Bool force); extern void nxagentInitKeystrokes(Bool force);
char *nxagentFindFirstKeystroke(char *name);
char *nxagentFindMatchingKeystrokes(char *name);
/* keep this sorted, do not rely on any numerical value in this enum, and be aware /* keep this sorted, do not rely on any numerical value in this enum, and be aware
* that KEYSTROKE_MAX may be used in a malloc */ * that KEYSTROKE_MAX may be used in a malloc */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
/* */ /* */
/**************************************************************************/ /**************************************************************************/
#ifdef TEST
/* /*
* Simple table used to translate a request * Simple table used to translate a request
* opcode to the name of the X request. * opcode to the name of the X request.
...@@ -210,4 +211,4 @@ static char *nxagentShmRequestLiteral[] = ...@@ -210,4 +211,4 @@ static char *nxagentShmRequestLiteral[] =
"ShmGetImage", "ShmGetImage",
"ShmCreatePixmap" "ShmCreatePixmap"
}; };
#endif /* TEST */
...@@ -117,6 +117,7 @@ Equipment Corporation. ...@@ -117,6 +117,7 @@ Equipment Corporation.
#include "Atoms.h" #include "Atoms.h"
#include "Splash.h" #include "Splash.h"
#include "Xdmcp.h"
#include "Client.h" #include "Client.h"
#include "Clipboard.h" #include "Clipboard.h"
#include "Reconnect.h" #include "Reconnect.h"
...@@ -161,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int); ...@@ -161,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int);
#include "unistd.h" #include "unistd.h"
#endif #endif
#ifdef TEST
#include "Literals.h" #include "Literals.h"
#endif
#ifdef VIEWPORT_FRAME #ifdef VIEWPORT_FRAME
...@@ -330,7 +329,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio ...@@ -330,7 +329,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
clientReady[0] = 0; clientReady[0] = 0;
if (nxagentSplashWindow != None || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0))
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n", fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n",
...@@ -346,7 +345,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio ...@@ -346,7 +345,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
(nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1)) (nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1))
{ {
#ifdef NX_DEBUG_INPUT #ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", fprintf(stderr, "Session: Session started at '%s' timestamp [%u].\n",
GetTimeAsString(), GetTimeInMillis()); GetTimeAsString(), GetTimeInMillis());
#else #else
fprintf(stderr, "Session: Session started at '%s'.\n", fprintf(stderr, "Session: Session started at '%s'.\n",
...@@ -580,6 +579,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio ...@@ -580,6 +579,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
NXShadowDestroy(); NXShadowDestroy();
} }
saveAgentState("TERMINATED"); saveAgentState("TERMINATED");
nxagentFreeAtomMap();
nxagentFreeFontData();
#endif /* NXAGENT_SERVER */ #endif /* NXAGENT_SERVER */
KillAllClients(); KillAllClients();
...@@ -744,7 +746,7 @@ ProcConvertSelection(register ClientPtr client) ...@@ -744,7 +746,7 @@ ProcConvertSelection(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
(CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient) (CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient)
#else #else
(CurrentSelections[i].window != None)) (CurrentSelections[i].window != None)
#endif #endif
#ifdef XCSECURITY #ifdef XCSECURITY
&& (!client->CheckAccess || && (!client->CheckAccess ||
...@@ -799,12 +801,12 @@ ProcOpenFont(register ClientPtr client) ...@@ -799,12 +801,12 @@ ProcOpenFont(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
char fontReq[256]; char fontReq[256];
memcpy(fontReq,(char *)&stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); memcpy(fontReq,(char *)&stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
fontReq[stuff->nbytes]=0; fontReq[stuff->nbytes] = '\0';
if (strchr(fontReq,'*') || strchr(fontReq,'?')) if (strchr(fontReq, '*') || strchr(fontReq, '?'))
{ {
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq); fprintf(stderr, "%s: try to find a common font with font pattern [%s]\n", __func__, fontReq);
#endif #endif
nxagentListRemoteFonts(fontReq, nxagentMaxFontNames); nxagentListRemoteFonts(fontReq, nxagentMaxFontNames);
err = nxOpenFont(client, stuff->fid, (Mask) 0, err = nxOpenFont(client, stuff->fid, (Mask) 0,
...@@ -836,10 +838,9 @@ ProcCloseFont(register ClientPtr client) ...@@ -836,10 +838,9 @@ ProcCloseFont(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
/* /*
* When a client closes a font the resource * When a client closes a font the resource should not be lost
* should not be lost if the reference counter * if the reference counter is not 0, otherwise the server
* is not 0, otherwise the server will not be * will not be able to find this font looping through the
* able to find this font looping through the
* resources. * resources.
*/ */
...@@ -848,7 +849,7 @@ ProcCloseFont(register ClientPtr client) ...@@ -848,7 +849,7 @@ ProcCloseFont(register ClientPtr client)
if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0) if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "ProcCloseFont: Switching resource for font at [%p].\n", fprintf(stderr, "%s: Switching resource for font at [%p].\n", __func__,
(void *) pFont); (void *) pFont);
#endif #endif
...@@ -860,8 +861,8 @@ ProcCloseFont(register ClientPtr client) ...@@ -860,8 +861,8 @@ ProcCloseFont(register ClientPtr client)
#ifdef TEST #ifdef TEST
else else
{ {
fprintf(stderr, "ProcCloseFont: Found duplicated font at [%p], " fprintf(stderr, "%s: Found duplicated font at [%p], "
"resource switching skipped.\n", (void *) pFont); "resource switching skipped.\n", __func__, (void *) pFont);
} }
#endif #endif
} }
...@@ -888,11 +889,11 @@ ProcListFonts(register ClientPtr client) ...@@ -888,11 +889,11 @@ ProcListFonts(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
char tmp[256]; char tmp[256];
memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
tmp[stuff->nbytes]=0; tmp[stuff->nbytes] = '\0';
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "Dispatch: ListFont request with pattern %s max_names=%d\n",tmp,stuff->maxNames); fprintf(stderr, "%s: ListFont request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames);
#endif #endif
nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames);
#endif #endif
...@@ -910,12 +911,12 @@ ProcListFontsWithInfo(register ClientPtr client) ...@@ -910,12 +911,12 @@ ProcListFontsWithInfo(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
char tmp[256]; char tmp[256];
memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
tmp[stuff->nbytes]=0; tmp[stuff->nbytes] = '\0';
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "Dispatch: ListFont with info request with pattern %s max_names=%d\n",tmp,stuff->maxNames); fprintf(stderr, "%s: ListFont with info request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames);
#endif #endif
nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames :stuff->maxNames); nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames);
#endif #endif
return StartListFontsWithInfo(client, stuff->nbytes, return StartListFontsWithInfo(client, stuff->nbytes,
...@@ -937,11 +938,10 @@ ProcFreePixmap(register ClientPtr client) ...@@ -937,11 +938,10 @@ ProcFreePixmap(register ClientPtr client)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
/* /*
* When a client releases a pixmap the resource * When a client releases a pixmap the resource should not be
* should not be lost if the reference counter * lost if the reference counter is not 0, otherwise the
* is not 0, otherwise the server will not be * server will not be able to find this pixmap looping through
* able to find this pixmap looping through the * the resources.
* resources.
*/ */
if (pMap -> refcnt > 0) if (pMap -> refcnt > 0)
...@@ -960,8 +960,8 @@ ProcFreePixmap(register ClientPtr client) ...@@ -960,8 +960,8 @@ ProcFreePixmap(register ClientPtr client)
#ifdef TEST #ifdef TEST
else else
{ {
fprintf(stderr, "ProcFreePixmap: Found duplicated pixmap at [%p], " fprintf(stderr, "%s: Found duplicated pixmap at [%p], "
"resource switching skipped.\n", (void *) pMap); "resource switching skipped.\n", __func__, (void *) pMap);
} }
#endif #endif
} }
...@@ -990,49 +990,12 @@ CloseDownClient(register ClientPtr client) ...@@ -990,49 +990,12 @@ CloseDownClient(register ClientPtr client)
{ {
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
/* /*
* There must be a better way to hook a * Need to reset the karma counter and get rid of the pending sync
* call-back function to be called any * replies.
* time a client is going to be closed.
*/
nxagentClearClipboard(client, NULL);
/*
* Need to reset the karma counter and
* get rid of the pending sync replies.
*/ */
nxagentWakeupByReset(client); nxagentWakeupByReset(client);
/*
* Check if the client
* is a shadow nxagent.
*/
nxagentCheckIfShadowAgent(client);
#endif #endif
xorg_CloseDownClient(client); xorg_CloseDownClient(client);
} }
/* FIXME: Instead of having a own function use the provided Callback
mechanism */
int
InitClientPrivates(ClientPtr client)
{
int ret = xorg_InitClientPrivates(client);
#ifdef NXAGENT_SERVER
if (ret == 1)
{
/*
* Initialize the private members.
*/
nxagentInitClientPrivates(client);
}
#endif
return ret;
}
...@@ -81,15 +81,16 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c); ...@@ -81,15 +81,16 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c);
#include "../../dix/dixfonts.c" #include "../../dix/dixfonts.c"
/*
#define NXAGENT_DEBUG
*/
#include "Agent.h" #include "Agent.h"
#include "Font.h" #include "Font.h"
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
#define NXFONTPATHLENGTH 1024 #define NXFONTPATHLENGTH 1024
char _NXFontPath[NXFONTPATHLENGTH]; char _NXFontPath[NXFONTPATHLENGTH];
...@@ -99,7 +100,7 @@ char _NXFontPath[NXFONTPATHLENGTH]; ...@@ -99,7 +100,7 @@ char _NXFontPath[NXFONTPATHLENGTH];
* the NX_FONT environment. * the NX_FONT environment.
*/ */
static const char *_NXGetFontPath(const char *path) static char *_NXGetFontPath(const char *path)
{ {
/* /*
* Check the environment only once. * Check the environment only once.
...@@ -116,17 +117,17 @@ static const char *_NXGetFontPath(const char *path) ...@@ -116,17 +117,17 @@ static const char *_NXGetFontPath(const char *path)
{ {
if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH) if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n"); fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
#endif #endif
goto _NXGetFontPathError; goto _NXGetFontPathError;
} }
snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv); snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv);
#ifdef TEST #ifdef TEST
fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath); fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
#endif #endif
return _NXFontPath; return _NXFontPath;
} }
...@@ -135,9 +136,9 @@ _NXGetFontPathError: ...@@ -135,9 +136,9 @@ _NXGetFontPathError:
snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path); snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path);
#ifdef TEST #ifdef TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath); fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
#endif #endif
return _NXFontPath; return _NXFontPath;
} }
...@@ -156,8 +157,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -156,8 +157,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
*newname; *newname;
int newlen; int newlen;
int aliascount = 20; int aliascount = 20;
#ifdef NXAGENT_SERVER
char nxagentOrigFontName[256]; char nxagentOrigFontName[256];
int nxagentOrigFontNameLen; int nxagentOrigFontNameLen;
#endif
/* /*
* Decide at runtime what FontFormat to use. * Decide at runtime what FontFormat to use.
...@@ -190,13 +193,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -190,13 +193,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
BitmapFormatScanlineUnit8; BitmapFormatScanlineUnit8;
#ifdef NXAGENT_SERVER
nxagentOrigFontNameLen = (c -> origFontNameLen < sizeof(nxagentOrigFontName) ? c -> origFontNameLen : sizeof(nxagentOrigFontName) - 1); nxagentOrigFontNameLen = (c -> origFontNameLen < sizeof(nxagentOrigFontName) ? c -> origFontNameLen : sizeof(nxagentOrigFontName) - 1);
memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen); memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen);
nxagentOrigFontName[nxagentOrigFontNameLen] = 0; nxagentOrigFontName[nxagentOrigFontNameLen] = 0;
#endif
if (client->clientGone) if (client->clientGone)
{ {
if (c->current_fpe < c->num_fpes) if (c->current_fpe < c->num_fpes)
...@@ -253,8 +256,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -253,8 +256,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
if (!c->slept) { if (!c->slept) {
c->slept = TRUE; c->slept = TRUE;
ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c);
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client);
#endif
#endif #endif
} }
return TRUE; return TRUE;
...@@ -284,15 +289,23 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -284,15 +289,23 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
pScr = screenInfo.screens[i]; pScr = screenInfo.screens[i];
if (pScr->RealizeFont) if (pScr->RealizeFont)
{ {
#ifdef NXAGENT_SERVER
/* NXAGENT uses useless screen pointer to pass the original font name /*
* NXAGENT uses useless screen pointer to pass the original font name
* to realizeFont, could be a source of problems in the future. * to realizeFont, could be a source of problems in the future.
*/ */
if (!(*pScr->RealizeFont) ((ScreenPtr)nxagentOrigFontName, pfont)) if (!(*pScr->RealizeFont) ((ScreenPtr)nxagentOrigFontName, pfont))
#else
if (!(*pScr->RealizeFont) (pScr, pfont))
#endif
{ {
CloseFont (pfont, (Font) 0); CloseFont (pfont, (Font) 0);
err=BadFontName; #ifdef NXAGENT_SERVER
err = BadFontName;
#else
err = AllocError;
#endif
goto bail; goto bail;
} }
} }
...@@ -302,6 +315,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -302,6 +315,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
err = AllocError; err = AllocError;
goto bail; goto bail;
} }
#ifdef NXAGENT_SERVER
if( nxagentFontPriv(pfont) -> mirrorID == 0 ) if( nxagentFontPriv(pfont) -> mirrorID == 0 )
{ {
extern RESTYPE RT_NX_FONT; extern RESTYPE RT_NX_FONT;
...@@ -313,12 +327,21 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -313,12 +327,21 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
goto bail; goto bail;
} }
} }
#endif
if (patternCache && pfont != c->non_cachable_font) if (patternCache && pfont != c->non_cachable_font)
#ifdef HAS_XFONT2 #ifdef NXAGENT_SERVER
#ifdef HAS_XFONT2
xfont2_cache_font_pattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, xfont2_cache_font_pattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen,
#else #else
CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen,
#endif /* HAS_XFONT2 */ #endif /* HAS_XFONT2 */
#else
#ifdef HAS_XFONT2
xfont2_cache_font_pattern(patternCache, c->origFontName, c->origFontNameLen,
#else
CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
#endif /* HAS_XFONT2 */
#endif
pfont); pfont);
bail: bail:
if (err != Successful && c->client != serverClient) { if (err != Successful && c->client != serverClient) {
...@@ -326,12 +349,16 @@ bail: ...@@ -326,12 +349,16 @@ bail:
c->fontid, FontToXError(err)); c->fontid, FontToXError(err));
} }
if (c->slept) if (c->slept)
#ifdef NXAGENT_SERVER
{ {
ClientWakeup(c->client); ClientWakeup(c->client);
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client); fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client);
#endif #endif
} }
#else
ClientWakeup(c->client);
#endif
for (i = 0; i < c->num_fpes; i++) { for (i = 0; i < c->num_fpes; i++) {
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
} }
...@@ -353,7 +380,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -353,7 +380,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
int nnames; int nnames;
int stringLens; int stringLens;
int i; int i;
xListFontsReply reply = {0}; xListFontsReply reply;
char *bufptr; char *bufptr;
char *bufferStart; char *bufferStart;
int aliascount = 0; int aliascount = 0;
...@@ -403,8 +430,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -403,8 +430,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
ClientSleep(client, ClientSleep(client,
(ClientSleepProcPtr)doListFontsAndAliases, (ClientSleepProcPtr)doListFontsAndAliases,
(void *) c); (void *) c);
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client);
#endif
#endif #endif
} }
return TRUE; return TRUE;
...@@ -438,6 +467,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -438,6 +467,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
(ClientSleepProcPtr)doListFontsAndAliases, (ClientSleepProcPtr)doListFontsAndAliases,
(void *) c); (void *) c);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client);
#endif
#endif
} }
return TRUE; return TRUE;
} }
...@@ -460,11 +494,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -460,11 +494,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
(ClientSleepProcPtr)doListFontsAndAliases, (ClientSleepProcPtr)doListFontsAndAliases,
(void *) c); (void *) c);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); #ifdef DEBUG
#endif
#ifdef NXAGENT_DEBUG
fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client);
#endif
#endif #endif
} }
return TRUE; return TRUE;
...@@ -593,13 +626,17 @@ finish: ...@@ -593,13 +626,17 @@ finish:
for (i = 0; i < nnames; i++) for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0; stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (stringLens + nnames + 3) >> 2; reply.length = (stringLens + nnames + 3) >> 2;
reply.nFonts = nnames; reply.nFonts = nnames;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
#ifdef NXAGENT_SERVER
bufptr = bufferStart = (char *) calloc(1, reply.length << 2); bufptr = bufferStart = (char *) calloc(1, reply.length << 2);
#else
bufptr = bufferStart = (char *) malloc(reply.length << 2);
#endif
if (!bufptr && reply.length) { if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
goto bail; goto bail;
...@@ -613,6 +650,7 @@ finish: ...@@ -613,6 +650,7 @@ finish:
reply.nFonts--; reply.nFonts--;
else else
{ {
#ifdef NXAGENT_SERVER
{ {
/* dirty hack: don't list to client fonts not existing on the remote side */ /* dirty hack: don't list to client fonts not existing on the remote side */
char tmp[256]; char tmp[256];
...@@ -631,6 +669,7 @@ finish: ...@@ -631,6 +669,7 @@ finish:
continue; continue;
} }
} }
#endif
*bufptr++ = names->length[i]; *bufptr++ = names->length[i];
memmove( bufptr, names->names[i], names->length[i]); memmove( bufptr, names->names[i], names->length[i]);
bufptr += names->length[i]; bufptr += names->length[i];
...@@ -647,8 +686,10 @@ bail: ...@@ -647,8 +686,10 @@ bail:
if (c->slept) if (c->slept)
{ {
ClientWakeup(client); ClientWakeup(client);
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client);
#endif
#endif #endif
} }
for (i = 0; i < c->num_fpes; i++) for (i = 0; i < c->num_fpes; i++)
...@@ -689,11 +730,19 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, ...@@ -689,11 +730,19 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
free(c); free(c);
return BadAlloc; return BadAlloc;
} }
#ifdef HAS_XFONT2 #ifdef NXAGENT_SERVER
#ifdef HAS_XFONT2
c->names = xfont2_make_font_names_record(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); c->names = xfont2_make_font_names_record(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames);
#else #else
c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames);
#endif /* HAS_XFONT2 */ #endif /* HAS_XFONT2 */
#else
#ifdef HAS_XFONT2
c->names = xfont2_make_font_names_record(max_names < 100 ? max_names : 100);
#else
c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
#endif /* HAS_XFONT2 */
#endif
if (!c->names) if (!c->names)
{ {
free(c->fpe_list); free(c->fpe_list);
...@@ -734,7 +783,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -734,7 +783,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
xFontProp *pFP; xFontProp *pFP;
int i; int i;
int aliascount = 0; int aliascount = 0;
xListFontsWithInfoReply finalReply = {0}; xListFontsWithInfoReply finalReply;
if (client->clientGone) if (client->clientGone)
{ {
...@@ -772,8 +821,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -772,8 +821,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
{ {
ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client);
#endif
#endif #endif
} }
return TRUE; return TRUE;
...@@ -800,8 +851,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -800,8 +851,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
(ClientSleepProcPtr)doListFontsWithInfo, (ClientSleepProcPtr)doListFontsWithInfo,
c); c);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_DEBUG #ifdef NXAGENT_SERVER
#ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client);
#endif
#endif #endif
} }
return TRUE; return TRUE;
...@@ -887,7 +940,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -887,7 +940,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
} }
else if (err == Successful) else if (err == Successful)
{ {
#ifdef NXAGENT_SERVER
if (c->haveSaved) if (c->haveSaved)
{ {
numFonts = c->savedNumFonts; numFonts = c->savedNumFonts;
...@@ -903,7 +956,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -903,7 +956,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
#endif #endif
continue; continue;
} }
#endif
length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
reply = c->reply; reply = c->reply;
if (c->length < length) if (c->length < length)
...@@ -918,6 +971,14 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -918,6 +971,14 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
c->reply = reply; c->reply = reply;
c->length = length; c->length = length;
} }
#ifndef NXAGENT_SERVER
if (c->haveSaved)
{
numFonts = c->savedNumFonts;
name = c->savedName;
namelen = strlen(name);
}
#endif
reply->type = X_Reply; reply->type = X_Reply;
reply->length = (sizeof *reply - sizeof(xGenericReply) + reply->length = (sizeof *reply - sizeof(xGenericReply) +
pFontInfo->nprops * sizeof(xFontProp) + pFontInfo->nprops * sizeof(xFontProp) +
...@@ -956,6 +1017,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -956,6 +1017,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
} }
finish: finish:
length = sizeof(xListFontsWithInfoReply); length = sizeof(xListFontsWithInfoReply);
bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply));
finalReply.type = X_Reply; finalReply.type = X_Reply;
finalReply.sequenceNumber = client->sequence; finalReply.sequenceNumber = client->sequence;
finalReply.length = (sizeof(xListFontsWithInfoReply) finalReply.length = (sizeof(xListFontsWithInfoReply)
...@@ -963,12 +1025,16 @@ finish: ...@@ -963,12 +1025,16 @@ finish:
WriteSwappedDataToClient(client, length, &finalReply); WriteSwappedDataToClient(client, length, &finalReply);
bail: bail:
if (c->slept) if (c->slept)
#ifdef NXAGENT_SERVER
{ {
ClientWakeup(client); ClientWakeup(client);
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client); fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client);
#endif #endif
} }
#else
ClientWakeup(client);
#endif
for (i = 0; i < c->num_fpes; i++) for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
free(c->reply); free(c->reply);
...@@ -982,95 +1048,21 @@ bail: ...@@ -982,95 +1048,21 @@ bail:
int int
SetDefaultFontPath(char *path) SetDefaultFontPath(char *path)
{ {
char *temp_path, return xorg_SetDefaultFontPath(_NXGetFontPath(path));
*start,
*end;
unsigned char *cp,
*pp,
*nump,
*newpath;
int num = 1,
len,
err,
size = 0,
bad;
#ifdef NXAGENT_SERVER
path = (char *) _NXGetFontPath(path);
#endif /* NXAGENT_SERVER */
start = path;
/* ensure temp_path contains "built-ins" */
while (1) {
start = strstr(start, "built-ins");
if (start == NULL)
break;
end = start + strlen("built-ins");
if ((start == path || start[-1] == ',') && (!*end || *end == ','))
break;
start = end;
}
if (!start) {
if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
== -1)
temp_path = NULL;
}
else {
temp_path = strdup(path);
}
if (!temp_path)
return BadAlloc;
/* get enough for string, plus values -- use up commas */
len = strlen(temp_path) + 1;
nump = cp = newpath = (unsigned char *) malloc(len);
if (!newpath) {
free(temp_path);
return BadAlloc;
}
pp = (unsigned char *) temp_path;
cp++;
while (*pp) {
if (*pp == ',') {
*nump = (unsigned char) size;
nump = cp++;
pp++;
num++;
size = 0;
} else {
*cp++ = *pp++;
size++;
}
}
*nump = (unsigned char) size;
err = SetFontPathElements(num, newpath, &bad, TRUE);
free(newpath);
free(temp_path);
return err;
} }
typedef struct typedef struct
{ {
LFclosurePtr c; LFclosurePtr c;
OFclosurePtr oc; OFclosurePtr oc;
} nxFs,*nxFsPtr; } nxFs,*nxFsPtr;
/* this is derived from doListFontsAndAliases above */
static Bool static Bool
#if NeedFunctionPrototypes
nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss) nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss)
#else
nxdoListFontsAndAliases(client, fss)
ClientPtr client;
nxFsPtr fss;
#endif
{ {
LFclosurePtr c=fss->c; LFclosurePtr c = fss->c;
OFclosurePtr oc=fss->oc; OFclosurePtr oc = fss->oc;
FontPathElementPtr fpe; FontPathElementPtr fpe;
int err = Successful; int err = Successful;
char *name, *resolved=NULL; char *name, *resolved=NULL;
...@@ -1078,7 +1070,7 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1078,7 +1070,7 @@ nxdoListFontsAndAliases(client, fss)
int i; int i;
int aliascount = 0; int aliascount = 0;
char tmp[256]; char tmp[256];
tmp[0]=0; tmp[0] = 0;
if (client->clientGone) if (client->clientGone)
{ {
if (c->current.current_fpe < c->num_fpes) if (c->current.current_fpe < c->num_fpes)
...@@ -1124,9 +1116,9 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1124,9 +1116,9 @@ nxdoListFontsAndAliases(client, fss)
ClientSleep(client, ClientSleep(client,
(ClientSleepProcPtr)nxdoListFontsAndAliases, (ClientSleepProcPtr)nxdoListFontsAndAliases,
(void *) fss); (void *) fss);
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: nxdoListFont (1): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: nxdoListFont (1): client [%lx] sleeping.\n", client);
#endif #endif
} }
return TRUE; return TRUE;
} }
...@@ -1159,9 +1151,9 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1159,9 +1151,9 @@ nxdoListFontsAndAliases(client, fss)
(ClientSleepProcPtr)nxdoListFontsAndAliases, (ClientSleepProcPtr)nxdoListFontsAndAliases,
(void *) fss); (void *) fss);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: nxdoListFont (2): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: nxdoListFont (2): client [%lx] sleeping.\n", client);
#endif #endif
} }
return TRUE; return TRUE;
} }
...@@ -1184,9 +1176,9 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1184,9 +1176,9 @@ nxdoListFontsAndAliases(client, fss)
(ClientSleepProcPtr)nxdoListFontsAndAliases, (ClientSleepProcPtr)nxdoListFontsAndAliases,
(void *) fss); (void *) fss);
c->slept = TRUE; c->slept = TRUE;
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: nxdoListFont (3): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: nxdoListFont (3): client [%lx] sleeping.\n", client);
#endif #endif
} }
return TRUE; return TRUE;
} }
...@@ -1207,20 +1199,20 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1207,20 +1199,20 @@ nxdoListFontsAndAliases(client, fss)
{ {
if (c->savedName) if (c->savedName)
{ {
memcpy(tmp,c->savedName,c->savedNameLen>255?255:c->savedNameLen); memcpy(tmp, c->savedName, c->savedNameLen > 255 ? 255 : c->savedNameLen);
tmp[c->savedNameLen>255?255:c->savedNameLen]=0; tmp[c->savedNameLen >255 ? 255 : c->savedNameLen] = 0;
if (nxagentFontLookUp(tmp)) if (nxagentFontLookUp(tmp))
break; break;
else tmp[0]=0; else tmp[0] = 0;
} }
} }
else else
{ {
memcpy(tmp,name,namelen>255?255:namelen); memcpy(tmp, name, namelen > 255 ? 255 : namelen);
tmp[namelen>255?255:namelen]=0; tmp[namelen > 255 ? 255 : namelen] = 0;
if (nxagentFontLookUp(tmp)) if (nxagentFontLookUp(tmp))
break; break;
else tmp[0]=0; else tmp[0] = 0;
} }
} }
...@@ -1314,14 +1306,13 @@ finish: ...@@ -1314,14 +1306,13 @@ finish:
if (strlen(tmp)) if (strlen(tmp))
{ {
#ifdef NXAGENT_FONTMATCH_DEBUG #ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "nxListFont changed (0) font to %s\n",tmp); fprintf(stderr, "nxListFont changed (0) font to %s\n", tmp);
#endif #endif
memcpy(oc->fontname, tmp, strlen(tmp)); memcpy(oc->fontname, tmp, strlen(tmp));
oc->fnamelen = strlen(tmp); oc->fnamelen = strlen(tmp);
oc->origFontName = oc->fontname; oc->origFontName = oc->fontname;
oc->origFontNameLen = oc->fnamelen; oc->origFontNameLen = oc->fnamelen;
} }
else else
{ {
...@@ -1352,9 +1343,9 @@ finish: ...@@ -1352,9 +1343,9 @@ finish:
if (c->slept) if (c->slept)
{ {
ClientWakeup(client); ClientWakeup(client);
#ifdef NXAGENT_DEBUG #ifdef DEBUG
fprintf(stderr, " NXdixfonts: nxdoListFont: client [%lx] wakeup.\n", client); fprintf(stderr, " NXdixfonts: nxdoListFont: client [%lx] wakeup.\n", client);
#endif #endif
} }
for (i = 0; i < c->num_fpes; i++) for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
...@@ -1372,17 +1363,14 @@ finish: ...@@ -1372,17 +1363,14 @@ finish:
return doOpenFont(client, oc); return doOpenFont(client, oc);
} }
/* this is derived from dix/dixfonts.c:OpenFont() */
int int
nxOpenFont(client, fid, flags, lenfname, pfontname) nxOpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname)
ClientPtr client;
XID fid;
Mask flags;
unsigned lenfname;
char *pfontname;
{ {
nxFsPtr fss; nxFsPtr fss; /* NX Font Struct Ptr */
LFclosurePtr c; LFclosurePtr c; /* ListFont closure Ptr */
OFclosurePtr oc; OFclosurePtr oc; /* OpenFont closure Ptr */
int i; int i;
FontPtr cached = (FontPtr)0; FontPtr cached = (FontPtr)0;
...@@ -1437,6 +1425,7 @@ nxOpenFont(client, fid, flags, lenfname, pfontname) ...@@ -1437,6 +1425,7 @@ nxOpenFont(client, fid, flags, lenfname, pfontname)
free(fss); free(fss);
return BadAlloc; return BadAlloc;
} }
c->fpe_list = (FontPathElementPtr *) c->fpe_list = (FontPathElementPtr *)
malloc(sizeof(FontPathElementPtr) * num_fpes); malloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) { if (!c->fpe_list) {
......
...@@ -143,6 +143,7 @@ of the copyright holder. ...@@ -143,6 +143,7 @@ of the copyright holder.
#include "Events.h" #include "Events.h"
#include "Windows.h" #include "Windows.h"
#include "Args.h" #include "Args.h"
#include "Clipboard.h"
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
...@@ -153,11 +154,6 @@ extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr); ...@@ -153,11 +154,6 @@ extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr);
#endif #endif
extern int nxagentShadowInit(ScreenPtr, WindowPtr); extern int nxagentShadowInit(ScreenPtr, WindowPtr);
#ifdef NXAGENT_CLIPBOARD
extern int nxagentSendNotify(xEvent*);
#endif
void void
ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
TimeStamp time, Bool autoGrab) TimeStamp time, Bool autoGrab)
......
...@@ -64,7 +64,7 @@ static int __glXDispatch(ClientPtr client) ...@@ -64,7 +64,7 @@ static int __glXDispatch(ClientPtr client)
* dispatching a GLX operation. * dispatching a GLX operation.
*/ */
nxagentGlxTrap = 1; nxagentGlxTrap = True;
#ifdef TEST #ifdef TEST
fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n", fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
...@@ -73,7 +73,7 @@ static int __glXDispatch(ClientPtr client) ...@@ -73,7 +73,7 @@ static int __glXDispatch(ClientPtr client)
retval = xorg__glXDispatch(client); retval = xorg__glXDispatch(client);
nxagentGlxTrap = 0; nxagentGlxTrap = False;
#ifdef TEST #ifdef TEST
fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n", fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
......
...@@ -76,6 +76,7 @@ SOFTWARE. ...@@ -76,6 +76,7 @@ SOFTWARE.
#include "Rootless.h" #include "Rootless.h"
#include "Client.h" #include "Client.h"
#include "Windows.h" #include "Windows.h"
#include "Clipboard.h"
extern Atom clientCutProperty; extern Atom clientCutProperty;
...@@ -93,14 +94,14 @@ nxagentWMStateRec; ...@@ -93,14 +94,14 @@ nxagentWMStateRec;
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
#ifdef NXAGENT_CLIPBOARD
extern WindowPtr nxagentGetClipboardWindow(Atom);
#endif
#ifdef NXAGENT_ARTSD #ifdef NXAGENT_ARTSD
extern Atom mcop_local_atom; extern Atom mcop_local_atom;
#endif #endif
#ifdef NX_DEBUG_INPUT
extern void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data);
#endif
int int
ProcChangeProperty(ClientPtr client) ProcChangeProperty(ClientPtr client)
{ {
...@@ -229,7 +230,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, ...@@ -229,7 +230,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
} }
} }
return Xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent); return xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent);
} }
/***************** /*****************
...@@ -447,7 +448,7 @@ ProcGetProperty(ClientPtr client) ...@@ -447,7 +448,7 @@ ProcGetProperty(ClientPtr client)
#ifdef NXAGENT_CLIPBOARD #ifdef NXAGENT_CLIPBOARD
/* GetWindowProperty clipboard use only */ /* GetWindowProperty clipboard use only */
/* FIXME: that's wrong, it is also called in Window.c and Events. */ /* FIXME: that's wrong, it is also called in Window.c and Events.c */
/* FIXME: should be moved to a different file, is not derived from /* FIXME: should be moved to a different file, is not derived from
dix */ dix */
int int
...@@ -502,7 +503,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, ...@@ -502,7 +503,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
pProp = pProp->next; pProp = pProp->next;
} }
if (!pProp) if (!pProp)
{ {
#ifdef DEBUG #ifdef DEBUG
......
...@@ -65,9 +65,7 @@ ...@@ -65,9 +65,7 @@
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
#ifdef TEST
#include "Literals.h" #include "Literals.h"
#endif
/* /*
* From NXglyph.c. * From NXglyph.c.
...@@ -1768,11 +1766,11 @@ ProcRenderDispatch (ClientPtr client) ...@@ -1768,11 +1766,11 @@ ProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c. * operation to avoid reentrancy in GCOps.c.
*/ */
nxagentGCTrap = 1; nxagentGCTrap = True;
int result = xorg_ProcRenderDispatch(client); int result = xorg_ProcRenderDispatch(client);
nxagentGCTrap = 0; nxagentGCTrap = False;
return result; return result;
} }
...@@ -1795,11 +1793,11 @@ SProcRenderDispatch (ClientPtr client) ...@@ -1795,11 +1793,11 @@ SProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c. * operation to avoid reentrancy in GCOps.c.
*/ */
nxagentGCTrap = 1; nxagentGCTrap = True;
int result = xorg_SProcRenderDispatch(client); int result = xorg_SProcRenderDispatch(client);
nxagentGCTrap = 0; nxagentGCTrap = False;
return result; return result;
} }
...@@ -142,16 +142,11 @@ static int nxagentResChangedFlag = 0; ...@@ -142,16 +142,11 @@ static int nxagentResChangedFlag = 0;
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
int nxagentFindClientResource(int client, RESTYPE type, void * value) int nxagentFindClientResource(int client, RESTYPE type, void * value)
{ {
ResourcePtr pResource; for (int i = 0; i < clientTable[client].buckets; i++)
ResourcePtr *resources;
int i;
for (i = 0; i < clientTable[client].buckets; i++)
{ {
resources = clientTable[client].resources; ResourcePtr *resources = clientTable[client].resources;
for (pResource = resources[i]; pResource; pResource = pResource -> next) for (ResourcePtr pResource = resources[i]; pResource; pResource = pResource -> next)
{ {
if (pResource -> type == type && pResource -> value == value) if (pResource -> type == type && pResource -> value == value)
{ {
...@@ -171,13 +166,8 @@ int nxagentFindClientResource(int client, RESTYPE type, void * value) ...@@ -171,13 +166,8 @@ int nxagentFindClientResource(int client, RESTYPE type, void * value)
int nxagentSwitchResourceType(int client, RESTYPE type, void * value) int nxagentSwitchResourceType(int client, RESTYPE type, void * value)
{ {
ResourcePtr pResource;
ResourcePtr *resources;
RESTYPE internalType = 0; RESTYPE internalType = 0;
int i;
if (type == RT_PIXMAP) if (type == RT_PIXMAP)
{ {
internalType = RT_NX_PIXMAP; internalType = RT_NX_PIXMAP;
...@@ -205,11 +195,11 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value) ...@@ -205,11 +195,11 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value)
return 0; return 0;
} }
for (i = 0; i < clientTable[serverClient -> index].buckets; i++) for (int i = 0; i < clientTable[serverClient -> index].buckets; i++)
{ {
resources = clientTable[serverClient -> index].resources; ResourcePtr *resources = clientTable[serverClient -> index].resources;
for (pResource = resources[i]; pResource; pResource = pResource -> next) for (ResourcePtr pResource = resources[i]; pResource; pResource = pResource -> next)
{ {
if (pResource -> type == internalType && if (pResource -> type == internalType &&
pResource -> value == value) pResource -> value == value)
...@@ -248,14 +238,12 @@ AddResource(XID id, RESTYPE type, void * value) ...@@ -248,14 +238,12 @@ AddResource(XID id, RESTYPE type, void * value)
} }
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentSwitchResourceType(client, type, value); nxagentSwitchResourceType(client, type, value);
#ifdef TEST #ifdef TEST
fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n", fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n",
client, (unsigned long) type, (void *) value, (unsigned long) id); client, (unsigned long) type, (void *) value, (unsigned long) id);
#endif #endif
#endif #endif
if ((rrec->elements >= 4*rrec->buckets) && if ((rrec->elements >= 4*rrec->buckets) &&
...@@ -274,9 +262,9 @@ AddResource(XID id, RESTYPE type, void * value) ...@@ -274,9 +262,9 @@ AddResource(XID id, RESTYPE type, void * value)
res->value = value; res->value = value;
*head = res; *head = res;
rrec->elements++; rrec->elements++;
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1; nxagentResChangedFlag = 1;
#endif #endif
if (!(id & SERVER_BIT) && (id >= rrec->expectID)) if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1; rrec->expectID = id + 1;
return TRUE; return TRUE;
...@@ -289,15 +277,13 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -289,15 +277,13 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
register ResourcePtr res; register ResourcePtr res;
register ResourcePtr *prev, *head; register ResourcePtr *prev, *head;
register int *eltptr; register int *eltptr;
int elements; int elements = 0;
Bool gotOne = FALSE; Bool gotOne = FALSE;
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
#ifdef TEST #ifdef TEST
fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id); fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id);
#endif #endif
#endif #endif
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
...@@ -313,9 +299,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -313,9 +299,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
RESTYPE rtype = res->type; RESTYPE rtype = res->type;
*prev = res->next; *prev = res->next;
elements = --*eltptr; elements = --*eltptr;
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1; nxagentResChangedFlag = 1;
#endif #endif
if (rtype != skipDeleteFuncType) if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id); (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
free(res); free(res);
...@@ -349,9 +335,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) ...@@ -349,9 +335,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
if (res->id == id && res->type == type) if (res->id == id && res->type == type)
{ {
*prev = res->next; *prev = res->next;
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1; nxagentResChangedFlag = 1;
#endif #endif
if (!skipFree) if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id); (*DeleteFuncs[type & TypeMask])(res->value, res->id);
free(res); free(res);
...@@ -381,28 +367,21 @@ FindClientResourcesByType( ...@@ -381,28 +367,21 @@ FindClientResourcesByType(
int i, elements; int i, elements;
register int *eltptr; register int *eltptr;
#ifdef NXAGENT_SERVER
register ResourcePtr **resptr;
#endif
if (!client) if (!client)
client = serverClient; client = serverClient;
#ifdef NXAGENT_SERVER
/* /*
* If func triggers a resource table * If func triggers a resource table
* rebuild then restart the loop. * rebuild then restart the loop.
*/ */
register ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop: RestartLoop:
resptr = &clientTable[client->index].resources;
#endif #endif
resources = clientTable[client->index].resources; resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
eltptr = &clientTable[client->index].elements; eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++) for (i = 0; i < clientTable[client->index].buckets; i++)
{ {
...@@ -412,17 +391,16 @@ RestartLoop: ...@@ -412,17 +391,16 @@ RestartLoop:
if (!type || this->type == type) { if (!type || this->type == type) {
elements = *eltptr; elements = *eltptr;
#ifdef NXAGENT_SERVER
/* /*
* FIXME: * FIXME:
* It is not safe to let a function change the resource * It is not safe to let a function change the resource
* table we are reading! * table we are reading!
*/ */
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 0; nxagentResChangedFlag = 0;
#endif #endif
(*func)(this->value, this->id, cdata); (*func)(this->value, this->id, cdata);
#ifdef NXAGENT_SERVER
/* /*
* Avoid that a call to RebuildTable() could invalidate the * Avoid that a call to RebuildTable() could invalidate the
* pointer. This is safe enough, because in RebuildTable() * pointer. This is safe enough, because in RebuildTable()
...@@ -430,10 +408,8 @@ RestartLoop: ...@@ -430,10 +408,8 @@ RestartLoop:
* freed, so it can't point to the same address. * freed, so it can't point to the same address.
*/ */
#ifdef NXAGENT_SERVER
if (*resptr != resources) if (*resptr != resources)
goto RestartLoop; goto RestartLoop;
#endif
/* /*
* It's not enough to check if the number of elements has * It's not enough to check if the number of elements has
...@@ -444,11 +420,10 @@ RestartLoop: ...@@ -444,11 +420,10 @@ RestartLoop:
* added or freed. * added or freed.
*/ */
#ifdef NXAGENT_SERVER
if (*eltptr != elements || nxagentResChangedFlag) if (*eltptr != elements || nxagentResChangedFlag)
#else #else
if (*eltptr != elements) if (*eltptr != elements)
#endif #endif
next = resources[i]; /* start over */ next = resources[i]; /* start over */
} }
} }
...@@ -466,28 +441,21 @@ FindAllClientResources( ...@@ -466,28 +441,21 @@ FindAllClientResources(
int i, elements; int i, elements;
register int *eltptr; register int *eltptr;
#ifdef NXAGENT_SERVER
register ResourcePtr **resptr;
#endif
if (!client) if (!client)
client = serverClient; client = serverClient;
#ifdef NXAGENT_SERVER
/* /*
* If func triggers a resource table * If func triggers a resource table
* rebuild then restart the loop. * rebuild then restart the loop.
*/ */
register ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop: RestartLoop:
resptr = &clientTable[client->index].resources;
#endif #endif
resources = clientTable[client->index].resources; resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
eltptr = &clientTable[client->index].elements; eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++) for (i = 0; i < clientTable[client->index].buckets; i++)
{ {
...@@ -496,17 +464,18 @@ RestartLoop: ...@@ -496,17 +464,18 @@ RestartLoop:
next = this->next; next = this->next;
elements = *eltptr; elements = *eltptr;
#ifdef NXAGENT_SERVER
/* /*
* FIXME: * FIXME:
* It is not safe to let a function change the resource * It is not safe to let a function change the resource
* table we are reading! * table we are reading!
*/ */
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 0; nxagentResChangedFlag = 0;
#endif #endif
(*func)(this->value, this->id, this->type, cdata); (*func)(this->value, this->id, this->type, cdata);
#ifdef NXAGENT_SERVER
/* /*
* Avoid that a call to RebuildTable() could invalidate the * Avoid that a call to RebuildTable() could invalidate the
* pointer. This is safe enough, because in RebuildTable() * pointer. This is safe enough, because in RebuildTable()
...@@ -514,10 +483,8 @@ RestartLoop: ...@@ -514,10 +483,8 @@ RestartLoop:
* freed, so it can't point to the same address. * freed, so it can't point to the same address.
*/ */
#ifdef NXAGENT_SERVER
if (*resptr != resources) if (*resptr != resources)
goto RestartLoop; goto RestartLoop;
#endif
/* /*
* It's not enough to check if the number of elements has * It's not enough to check if the number of elements has
...@@ -528,11 +495,10 @@ RestartLoop: ...@@ -528,11 +495,10 @@ RestartLoop:
* added or freed. * added or freed.
*/ */
#ifdef NXAGENT_SERVER
if (*eltptr != elements || nxagentResChangedFlag) if (*eltptr != elements || nxagentResChangedFlag)
#else #else
if (*eltptr != elements) if (*eltptr != elements)
#endif #endif
next = resources[i]; /* start over */ next = resources[i]; /* start over */
} }
} }
...@@ -550,44 +516,36 @@ LookupClientResourceComplex( ...@@ -550,44 +516,36 @@ LookupClientResourceComplex(
ResourcePtr this; ResourcePtr this;
int i; int i;
#ifdef NXAGENT_SERVER
ResourcePtr **resptr;
Bool res;
#endif
if (!client) if (!client)
client = serverClient; client = serverClient;
#ifdef NXAGENT_SERVER
/* /*
* If func triggers a resource table * If func triggers a resource table
* rebuild then restart the loop. * rebuild then restart the loop.
*/ */
ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop: RestartLoop:
resptr = &clientTable[client->index].resources;
#endif #endif
resources = clientTable[client->index].resources; resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
for (i = 0; i < clientTable[client->index].buckets; i++) { for (i = 0; i < clientTable[client->index].buckets; i++) {
for (this = resources[i]; this; this = this->next) { for (this = resources[i]; this; this = this->next) {
if (!type || this->type == type) { if (!type || this->type == type) {
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
res = (*func)(this->value, this->id, cdata); Bool res = (*func)(this->value, this->id, cdata);
if (*resptr != resources) if (*resptr != resources)
goto RestartLoop; goto RestartLoop;
if (res) if (res)
return this->value; return this->value;
#else #else
if((*func)(this->value, this->id, cdata)) if((*func)(this->value, this->id, cdata))
return this->value; return this->value;
#endif #endif
} }
} }
} }
......
...@@ -70,9 +70,7 @@ in this Software without prior written authorization from The Open Group. ...@@ -70,9 +70,7 @@ in this Software without prior written authorization from The Open Group.
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
#ifdef TEST
#include "Literals.h" #include "Literals.h"
#endif
extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h, extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d); unsigned int format, unsigned long planeMask, char *d);
...@@ -173,11 +171,11 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -173,11 +171,11 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
{ {
/* Careful! This wrapper DEACTIVATES the trap! */ /* Careful! This wrapper DEACTIVATES the trap! */
nxagentShmTrap = 0; nxagentShmTrap = False;
xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data);
nxagentShmTrap = 1; nxagentShmTrap = True;
return; return;
} }
...@@ -192,9 +190,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -192,9 +190,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
char *data; char *data;
{ {
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
int length;
char *newdata;
#ifdef TEST #ifdef TEST
fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n", fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n",
(void *) dst, (void *) pGC, (void *) data); (void *) dst, (void *) pGC, (void *) data);
...@@ -229,9 +224,9 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -229,9 +224,9 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
sx, sy, sw, sh, dx); sx, sy, sw, sh, dx);
#endif #endif
length = nxagentImageLength(sw, sh, format, 0, depth); char *newdata = calloc(1, nxagentImageLength(sw, sh, format, 0, depth));
if ((newdata = calloc(1, length)) != NULL) if (newdata != NULL)
{ {
fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata); fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata);
(*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata); (*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
...@@ -394,7 +389,7 @@ ProcShmPutImage(client) ...@@ -394,7 +389,7 @@ ProcShmPutImage(client)
return (client->noClientException); return (client->noClientException);
} }
/* derived from Xext/shm.c */
static PixmapPtr static PixmapPtr
nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr)
ScreenPtr pScreen; ScreenPtr pScreen;
...@@ -405,29 +400,22 @@ nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) ...@@ -405,29 +400,22 @@ nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr)
{ {
register PixmapPtr pPixmap; register PixmapPtr pPixmap;
#ifdef NXAGENT_SERVER
pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0); pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0);
#else
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
#endif
if (!pPixmap) if (!pPixmap)
{ {
return NullPixmap; return NullPixmap;
} }
#if defined(NXAGENT_SERVER) && defined(TEST)
fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", width, height, depth, 0);
#endif
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr)) BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr))
{ {
#if defined(NXAGENT_SERVER) && defined(WARNING)
fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n");
#endif
(*pScreen->DestroyPixmap)(pPixmap); (*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap; return NullPixmap;
} }
return pPixmap; return pPixmap;
} }
...@@ -439,39 +427,44 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) ...@@ -439,39 +427,44 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
int depth; int depth;
char *addr; char *addr;
{ {
PixmapPtr result; #ifdef TEST
fprintf(stderr, "%s: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", __func__,
width, height, depth, 0);
#endif
nxagentShmPixmapTrap = 1; nxagentShmPixmapTrap = True;
result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); PixmapPtr result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr);
nxagentShmPixmapTrap = 0; nxagentShmPixmapTrap = False;
#ifdef WARNING
if (result == NullPixmap)
{
fprintf(stderr, "%s: Return Null Pixmap.\n", __func__);
}
#endif
return result; return result;
} }
/* A wrapper that handles the trap. This construct is used
to keep the derived code closer to the original
*/
static int static int
ProcShmDispatch (register ClientPtr client) ProcShmDispatch (register ClientPtr client)
{ {
int result;
#ifdef TEST #ifdef TEST
REQUEST(xReq); REQUEST(xReq);
if (stuff->data <= X_ShmCreatePixmap) if (stuff->data <= X_ShmCreatePixmap)
{ {
fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", fprintf(stderr, "%s: Request [%s] OPCODE [%d] for client [%d].\n", __func__,
nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); nxagentShmRequestLiteral[stuff->data], stuff->data, client->index);
} }
#endif #endif
nxagentShmTrap = 1; nxagentShmTrap = True;
result = xorg_ProcShmDispatch(client); int result = xorg_ProcShmDispatch(client);
nxagentShmTrap = 0; nxagentShmTrap = False;
return result; return result;
} }
...@@ -479,22 +472,20 @@ ProcShmDispatch (register ClientPtr client) ...@@ -479,22 +472,20 @@ ProcShmDispatch (register ClientPtr client)
static int static int
SProcShmDispatch (register ClientPtr client) SProcShmDispatch (register ClientPtr client)
{ {
int result;
#ifdef TEST #ifdef TEST
REQUEST(xReq); REQUEST(xReq);
if (stuff->data <= X_ShmCreatePixmap) if (stuff->data <= X_ShmCreatePixmap)
{ {
fprintf(stderr, "SProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", fprintf(stderr, "%s: Request [%s] OPCODE [%d] for client [%d].\n", __func__,
nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); nxagentShmRequestLiteral[stuff->data], stuff->data, client->index);
} }
#endif #endif
nxagentShmTrap = 1; nxagentShmTrap = True;
result = xorg_SProcShmDispatch(client); int result = xorg_SProcShmDispatch(client);
nxagentShmTrap = 0; nxagentShmTrap = False;
return result; return result;
} }
...@@ -79,11 +79,11 @@ ProcXvDispatch(ClientPtr client) ...@@ -79,11 +79,11 @@ ProcXvDispatch(ClientPtr client)
stuff->data, client -> index); stuff->data, client -> index);
#endif #endif
nxagentXvTrap = 1; nxagentXvTrap = True;
result = xorg_ProcXvDispatch(client); result = xorg_ProcXvDispatch(client);
nxagentXvTrap = 0; nxagentXvTrap = False;
#ifdef TEST #ifdef TEST
fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
...@@ -108,11 +108,11 @@ SProcXvDispatch(ClientPtr client) ...@@ -108,11 +108,11 @@ SProcXvDispatch(ClientPtr client)
stuff->data, client -> index); stuff->data, client -> index);
#endif #endif
nxagentXvTrap = 1; nxagentXvTrap = True;
result = xorg_SProcXvDispatch(client); result = xorg_SProcXvDispatch(client);
nxagentXvTrap = 0; nxagentXvTrap = False;
#ifdef TEST #ifdef TEST
fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
......
...@@ -71,9 +71,6 @@ RESTYPE RT_NX_PIXMAP; ...@@ -71,9 +71,6 @@ RESTYPE RT_NX_PIXMAP;
int nxagentPixmapPrivateIndex; int nxagentPixmapPrivateIndex;
int nxagentCorruptedPixmaps;
int nxagentCorruptedBackgrounds;
/* /*
* Force deallocation of the virtual pixmap. * Force deallocation of the virtual pixmap.
*/ */
...@@ -157,7 +154,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -157,7 +154,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* synchronized with the remote X Server. * synchronized with the remote X Server.
*/ */
if (pPixmapPriv -> isShared == 1) if (pPixmapPriv -> isShared)
{ {
BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height }; BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height };
...@@ -773,11 +770,11 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2) ...@@ -773,11 +770,11 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
return; return;
} }
nxagentSplitTrap = 1; nxagentSplitTrap = True;
*pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL); *pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL);
nxagentSplitTrap = 0; nxagentSplitTrap = False;
if (!*pBool) if (!*pBool)
{ {
...@@ -1095,13 +1092,13 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, ...@@ -1095,13 +1092,13 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
int length = nxagentImageLength(width, height, format, 0, depth); int length = nxagentImageLength(width, height, format, 0, depth);
int saveTrap = nxagentGCTrap; Bool saveTrap = nxagentGCTrap;
nxagentGCTrap = 0; nxagentGCTrap = False;
nxagentSplitTrap = 1; nxagentSplitTrap = True;
nxagentFBTrap = 1; nxagentFBTrap = True;
char *data = malloc(length); char *data = malloc(length);
...@@ -1124,9 +1121,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, ...@@ -1124,9 +1121,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
nxagentGCTrap = saveTrap; nxagentGCTrap = saveTrap;
nxagentSplitTrap = 0; nxagentSplitTrap = False;
nxagentFBTrap = 0; nxagentFBTrap = False;
nxagentFreeScratchGC(pGC); nxagentFreeScratchGC(pGC);
} }
......
...@@ -146,13 +146,12 @@ void setStatePath(char* path) ...@@ -146,13 +146,12 @@ void setStatePath(char* path)
void saveAgentState(char* state) void saveAgentState(char* state)
{ {
FILE* fptr; if (strlen(stateFile))
if(strlen(stateFile))
{ {
fptr=fopen(stateFile, "w"); FILE* fptr = fopen(stateFile, "w");
if(!fptr) if (!fptr)
return; return;
fprintf(fptr,"%s", state); fprintf(fptr, "%s", state);
fclose(fptr); fclose(fptr);
} }
} }
...@@ -237,8 +236,7 @@ int nxagentHandleConnectionStates(void) ...@@ -237,8 +236,7 @@ int nxagentHandleConnectionStates(void)
fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error in the exception flags.\n"); fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error in the exception flags.\n");
#endif #endif
/* /*
TODO: This should be reset only when TODO: This should be reset only when the state became SESSION_DOWN.
the state became SESSION_DOWN.
*/ */
nxagentException.ioError = 0; nxagentException.ioError = 0;
...@@ -301,7 +299,7 @@ TODO: This should be reset only when ...@@ -301,7 +299,7 @@ TODO: This should be reset only when
if ((dispatchException & DE_TERMINATE) == 0) if ((dispatchException & DE_TERMINATE) == 0)
{ {
#ifdef NX_DEBUG_INPUT #ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); fprintf(stderr, "Session: Session suspended at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis());
#else #else
fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString());
#endif #endif
...@@ -340,7 +338,7 @@ void nxagentInitializeRecLossyLevel(void) ...@@ -340,7 +338,7 @@ void nxagentInitializeRecLossyLevel(void)
void nxagentInitReconnector(void) void nxagentInitReconnector(void)
{ {
nxagentReconnectTrap = 0; nxagentReconnectTrap = False;
reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int)); reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int));
reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int)); reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int));
...@@ -365,8 +363,7 @@ void nxagentDisconnectSession(void) ...@@ -365,8 +363,7 @@ void nxagentDisconnectSession(void)
nxagentFreeTimeoutTimer(); nxagentFreeTimeoutTimer();
/* /*
* Force an I/O error on the display * Force an I/O error on the display and wait until the NX transport
* and wait until the NX transport
* is gone. * is gone.
*/ */
...@@ -427,16 +424,15 @@ Bool nxagentReconnectSession(void) ...@@ -427,16 +424,15 @@ Bool nxagentReconnectSession(void)
nxagentChangeOption(DeviceControl, nxagentOption(DeviceControlUserDefined)); nxagentChangeOption(DeviceControl, nxagentOption(DeviceControlUserDefined));
/* /*
* We need to zero out every new XID * We need to zero out every new XID created by the disconnected
* created by the disconnected display. * display.
*/ */
nxagentDisconnectSession(); nxagentDisconnectSession();
/* /*
* Set this in order to let the screen * Set this in order to let the screen function to behave
* function to behave differently at * differently at reconnection time.
* reconnection time.
*/ */
nxagentReconnectTrap = True; nxagentReconnectTrap = True;
...@@ -464,19 +460,17 @@ Bool nxagentReconnectSession(void) ...@@ -464,19 +460,17 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectDisplay(reconnectLossyLevel[DISPLAY_STEP]) == 0) if (nxagentReconnectDisplay(reconnectLossyLevel[DISPLAY_STEP]) == 0)
{ {
failedStep = DISPLAY_STEP;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentReconnectSession: WARNING! Failed display reconnection.\n"); fprintf(stderr, "nxagentReconnectSession: WARNING! Failed display reconnection.\n");
#endif #endif
failedStep = DISPLAY_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentReconnectScreen(reconnectLossyLevel[SCREEN_STEP]) == 0) if (nxagentReconnectScreen(reconnectLossyLevel[SCREEN_STEP]) == 0)
{ {
failedStep = SCREEN_STEP; failedStep = SCREEN_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
...@@ -489,7 +483,6 @@ Bool nxagentReconnectSession(void) ...@@ -489,7 +483,6 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0) if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0)
{ {
failedStep = FONT_STEP; failedStep = FONT_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
else else
...@@ -504,16 +497,15 @@ Bool nxagentReconnectSession(void) ...@@ -504,16 +497,15 @@ Bool nxagentReconnectSession(void)
} }
/* /*
* Map the main window and send a * Map the main window and send a SetSelectionOwner request to
* SetSelectionOwner request to
* notify of the agent start. * notify of the agent start.
*/ */
nxagentMapDefaultWindows(); nxagentMapDefaultWindows();
/* /*
* Ensure that the SetSelectionOwner * Ensure that the SetSelectionOwner request is sent through the
* request is sent through the link. * link.
*/ */
XFlush(nxagentDisplay); XFlush(nxagentDisplay);
...@@ -533,21 +525,18 @@ Bool nxagentReconnectSession(void) ...@@ -533,21 +525,18 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllGCs(reconnectLossyLevel[GC_STEP]) == 0) if (nxagentReconnectAllGCs(reconnectLossyLevel[GC_STEP]) == 0)
{ {
failedStep = GC_STEP; failedStep = GC_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentReconnectAllColormap(reconnectLossyLevel[COLORMAP_STEP]) == 0) if (nxagentReconnectAllColormap(reconnectLossyLevel[COLORMAP_STEP]) == 0)
{ {
failedStep = COLORMAP_STEP; failedStep = COLORMAP_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentReconnectAllWindows(reconnectLossyLevel[WINDOW_STEP]) == 0) if (nxagentReconnectAllWindows(reconnectLossyLevel[WINDOW_STEP]) == 0)
{ {
failedStep = WINDOW_STEP; failedStep = WINDOW_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
...@@ -556,21 +545,18 @@ Bool nxagentReconnectSession(void) ...@@ -556,21 +545,18 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllGlyphSet(reconnectLossyLevel[GLYPHSET_STEP]) == 0) if (nxagentReconnectAllGlyphSet(reconnectLossyLevel[GLYPHSET_STEP]) == 0)
{ {
failedStep = GLYPHSET_STEP; failedStep = GLYPHSET_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentReconnectAllPictFormat(reconnectLossyLevel[PICTFORMAT_STEP]) == 0) if (nxagentReconnectAllPictFormat(reconnectLossyLevel[PICTFORMAT_STEP]) == 0)
{ {
failedStep = PICTFORMAT_STEP; failedStep = PICTFORMAT_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentReconnectAllPicture(reconnectLossyLevel[PICTURE_STEP]) == 0) if (nxagentReconnectAllPicture(reconnectLossyLevel[PICTURE_STEP]) == 0)
{ {
failedStep = PICTURE_STEP; failedStep = PICTURE_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
} }
...@@ -578,14 +564,12 @@ Bool nxagentReconnectSession(void) ...@@ -578,14 +564,12 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllCursor(reconnectLossyLevel[CURSOR_STEP]) == 0) if (nxagentReconnectAllCursor(reconnectLossyLevel[CURSOR_STEP]) == 0)
{ {
failedStep = CURSOR_STEP; failedStep = CURSOR_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentSetWindowCursors(reconnectLossyLevel[WINDOW_STEP]) == 0) if (nxagentSetWindowCursors(reconnectLossyLevel[WINDOW_STEP]) == 0)
{ {
failedStep = WINDOW_STEP; failedStep = WINDOW_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
...@@ -621,7 +605,6 @@ Bool nxagentReconnectSession(void) ...@@ -621,7 +605,6 @@ Bool nxagentReconnectSession(void)
#endif #endif
failedStep = WINDOW_STEP; failedStep = WINDOW_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
} }
} }
...@@ -674,7 +657,7 @@ Bool nxagentReconnectSession(void) ...@@ -674,7 +657,7 @@ Bool nxagentReconnectSession(void)
nxagentInitKeystrokes(True); nxagentInitKeystrokes(True);
#ifdef NX_DEBUG_INPUT #ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); fprintf(stderr, "Session: Session resumed at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis());
#else #else
fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString());
#endif #endif
...@@ -683,10 +666,9 @@ Bool nxagentReconnectSession(void) ...@@ -683,10 +666,9 @@ Bool nxagentReconnectSession(void)
nxagentRemoveSplashWindow(); nxagentRemoveSplashWindow();
/* /*
* We let the proxy flush the link on our behalf * We let the proxy flush the link on our behalf after having opened
* after having opened the display. We are now * the display. We are now entering again the dispatcher so can
* entering again the dispatcher so can flush * flush the link explicitly.
* the link explicitly.
*/ */
#ifdef TEST #ifdef TEST
...@@ -799,9 +781,8 @@ void nxagentSetReconnectError(int id, char *format, ...) ...@@ -799,9 +781,8 @@ void nxagentSetReconnectError(int id, char *format, ...)
else else
{ {
/* /*
* The vsnprintf() in glibc 2.0.6 would return * The vsnprintf() in glibc 2.0.6 would return -1 when the
* -1 when the output was truncated. See section * output was truncated. See section NOTES on printf(3).
* NOTES on printf(3).
*/ */
size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE); size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE);
...@@ -863,4 +844,3 @@ void nxagentHandleConnectionChanges(void) ...@@ -863,4 +844,3 @@ void nxagentHandleConnectionChanges(void)
} }
} }
} }
...@@ -186,6 +186,7 @@ Bool nxagentDisconnectAllPicture(void); ...@@ -186,6 +186,7 @@ Bool nxagentDisconnectAllPicture(void);
#define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3)) #define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3))
/* Clean the padding bytes of data section of request.*/
void void
nxagentCleanGlyphs(xGlyphInfo *gi, nxagentCleanGlyphs(xGlyphInfo *gi,
int nglyphs, int nglyphs,
...@@ -360,19 +361,15 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -360,19 +361,15 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
if (bytesToClean > 0) if (bytesToClean > 0)
{ {
while (height > 0) for (; height > 0; height--)
{ {
int count = bytesToClean; for (int i = bytesToClean; i > 0; i--)
while (count > 0)
{ {
*(images + (bytesPerLine - count)) = 0; *(images + (bytesPerLine - i)) = 0;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n");
#endif #endif
count--;
} }
#ifdef DUMP #ifdef DUMP
...@@ -385,8 +382,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -385,8 +382,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#endif #endif
images += bytesPerLine; images += bytesPerLine;
height--;
} }
} }
...@@ -537,11 +532,11 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) ...@@ -537,11 +532,11 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
* if the cursor was already encoded with the best quality. * if the cursor was already encoded with the best quality.
*/ */
nxagentLosslessTrap = 1; nxagentLosslessTrap = True;
nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
nxagentLosslessTrap = 0; nxagentLosslessTrap = False;
nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y);
} }
...@@ -1157,7 +1152,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD ...@@ -1157,7 +1152,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDst -> pDrawable, pDstRegion); nxagentFreeRegion(pDstRegion);
return; return;
} }
...@@ -1326,12 +1321,12 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, ...@@ -1326,12 +1321,12 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
(void *) pDst -> pDrawable); (void *) pDst -> pDrawable);
#endif #endif
nxagentFreeRegion(pDst -> pDrawable, pRegion); nxagentFreeRegion(pRegion);
return; return;
} }
nxagentFreeRegion(pDst -> pDrawable, pRegion); nxagentFreeRegion(pRegion);
} }
/* /*
...@@ -1817,7 +1812,7 @@ FIXME: Is this useful or just a waste of bandwidth? ...@@ -1817,7 +1812,7 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDst -> pDrawable, pDstRegion); nxagentFreeRegion(pDstRegion);
if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP) if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP)
{ {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "Atoms.h" #include "Atoms.h"
#include "Trap.h" #include "Trap.h"
#include "Utils.h" #include "Utils.h"
#include "Atoms.h"
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -151,10 +152,9 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w) ...@@ -151,10 +152,9 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
if (topLevelParentMap.next == topLevelParentMap.size) if (topLevelParentMap.next == topLevelParentMap.size)
{ {
TopLevelParentRec *ptr = topLevelParentMap.elt;
size_t size = (topLevelParentMap.size += TOP_LEVEL_TABLE_UNIT); size_t size = (topLevelParentMap.size += TOP_LEVEL_TABLE_UNIT);
ptr = realloc(ptr, size * sizeof(TopLevelParentRec)); TopLevelParentRec *ptr = realloc(topLevelParentMap.elt, size * sizeof(TopLevelParentRec));
if (ptr == NULL) if (ptr == NULL)
{ {
...@@ -332,18 +332,18 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) ...@@ -332,18 +332,18 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; WindowPtr pWin = screenInfo.screens[0]->root -> firstChild;
for (int i = ntoplevel; i-- && pWin; pWin = toplevel[i] -> nextSib)
{
XID values[2] = {0, (XID) Above}; XID values[2] = {0, (XID) Above};
for (int i = ntoplevel; i-- && pWin; pWin = toplevel[i] -> nextSib)
{
if (toplevel[i] != pWin) if (toplevel[i] != pWin)
{ {
Mask mask = CWSibling | CWStackMode; Mask mask = CWSibling | CWStackMode;
values[0] = pWin -> drawable.id; values[0] = pWin -> drawable.id;
ClientPtr pClient = wClient(toplevel[i]); ClientPtr pClient = wClient(toplevel[i]);
nxagentScreenTrap = 1; nxagentScreenTrap = True;
ConfigureWindow(toplevel[i], mask, (XID *) values, pClient); ConfigureWindow(toplevel[i], mask, values, pClient);
nxagentScreenTrap = 0; nxagentScreenTrap = False;
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]); fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]);
...@@ -418,6 +418,11 @@ int nxagentExportAllProperty(WindowPtr pWin) ...@@ -418,6 +418,11 @@ int nxagentExportAllProperty(WindowPtr pWin)
return total; return total;
} }
/*
* Export a property from an agent window to the corresponding window
* on the real X server This is e.g. called if a client changes a
* property.
*/
int nxagentExportProperty(WindowPtr pWin, int nxagentExportProperty(WindowPtr pWin,
Atom property, Atom property,
Atom type, Atom type,
...@@ -720,7 +725,7 @@ int nxagentExportProperty(WindowPtr pWin, ...@@ -720,7 +725,7 @@ int nxagentExportProperty(WindowPtr pWin,
else else
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Property [%u] format [%i] units [%lu].\n", __func__, fprintf(stderr, "%s: Property [%lu] format [%i] units [%lu].\n", __func__,
propertyX, format, nUnits); propertyX, format, nUnits);
#endif #endif
...@@ -793,6 +798,11 @@ int nxagentExportProperty(WindowPtr pWin, ...@@ -793,6 +798,11 @@ int nxagentExportProperty(WindowPtr pWin,
return export; return export;
} }
/*
* Import a property from the proxy window on the real X server into
* the agent's corresponding window. This is e.g. called on reception
* of a property change event on the real X server.
*/
void nxagentImportProperty(Window window, void nxagentImportProperty(Window window,
XlibAtom property, XlibAtom property,
XlibAtom type, XlibAtom type,
...@@ -817,7 +827,7 @@ void nxagentImportProperty(Window window, ...@@ -817,7 +827,7 @@ void nxagentImportProperty(Window window,
if (pWin == NULL) if (pWin == NULL)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Failed to look up remote window [0x%x] property [%d] exiting.\n", fprintf(stderr, "%s: Failed to look up remote window [0x%x] property [%ld] exiting.\n",
__func__, window, property); __func__, window, property);
#endif #endif
...@@ -829,29 +839,34 @@ void nxagentImportProperty(Window window, ...@@ -829,29 +839,34 @@ void nxagentImportProperty(Window window,
if (!ValidAtom(propertyL)) if (!ValidAtom(propertyL))
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Failed to convert remote property atom.\n", __func__); fprintf(stderr, "%s: Failed to convert remote property atom [%ld].\n", __func__, property);
#endif #endif
return; return;
} }
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Window [0x%x] property [%d]: [%s]\n", __func__, fprintf(stderr, "%s: Window [0x%x] property: remote [%ld][%s] local [%d]\n", __func__,
window, property, validateString(NameForAtom(propertyL))); window, property, validateString(NameForAtom(propertyL)), propertyL);
#endif #endif
/* /*
* We settle a property size limit of 256K beyond which we simply * We settle a property size limit of 256K beyond which we simply
* ignore them. * ignore them.
* FIXME: where's this checked/set/enforced/whatever?
*/ */
Atom typeL = nxagentRemoteToLocalAtom(type); Atom typeL = nxagentRemoteToLocalAtom(type);
const char *typeS = NameForAtom(typeL); const char *typeS = NameForAtom(typeL);
#ifdef TEST
fprintf(stderr, "%s: type: remote [%ld] local [%d][%s].\n", __func__, type, typeL, validateString(typeS));
#endif
if (buffer == NULL && (nitems > 0)) if (buffer == NULL && (nitems > 0))
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "%s: Failed to retrieve remote property [%ld] [%s] on Window [%ld]\n", __func__, fprintf(stderr, "%s: Failed to retrieve remote property [%ld] [%s] on window [%ld]\n", __func__,
(long int) property, validateString(NameForAtom(propertyL)), (long int) window); (long int) property, validateString(NameForAtom(propertyL)), (long int) window);
#endif #endif
} }
...@@ -864,7 +879,7 @@ void nxagentImportProperty(Window window, ...@@ -864,7 +879,7 @@ void nxagentImportProperty(Window window,
else if (!ValidAtom(typeL)) else if (!ValidAtom(typeL))
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "%s: Failed to convert remote atoms [%ld].\n", __func__, fprintf(stderr, "%s: Failed to convert remote atom [%ld].\n", __func__,
(long int) type); (long int) type);
#endif #endif
} }
...@@ -876,6 +891,41 @@ void nxagentImportProperty(Window window, ...@@ -876,6 +891,41 @@ void nxagentImportProperty(Window window,
import = True; import = True;
} }
else if (property == nxagentAtoms[0]) /* NX_IDENTITY */
{
#ifdef WARNING
fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__,
(long int) property);
#endif
}
else if (property == nxagentAtoms[5]) /* NX_CUT_BUFFER_SERVER */
{
#ifdef WARNING
fprintf(stderr, "%s: not importing private [%ld][NX_CUT_BUFFER_SERVER].\n", __func__,
(long int) property);
#endif
}
else if (property == nxagentAtoms[8]) /* NX_AGENT_SIGNATURE */
{
#ifdef WARNING
fprintf(stderr, "%s: not importing private [%ld][NX_AGENT_SIGNATURE].\n", __func__,
(long int) property);
#endif
}
else if (property == nxagentAtoms[9]) /* NXDARWIN */
{
#ifdef TEST
fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__,
(long int) property);
#endif
}
else if (property == nxagentAtoms[15]) /* NX_SELTRANS_FROM_AGENT */
{
#ifdef TEST
fprintf(stderr, "%s: not importing private [%ld][NX_SELTRANS_FROM_AGENT].\n", __func__,
(long int) property);
#endif
}
else if (strcmp(typeS, "STRING") == 0 || else if (strcmp(typeS, "STRING") == 0 ||
strcmp(typeS, "UTF8_STRING") == 0 || strcmp(typeS, "UTF8_STRING") == 0 ||
strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "CARDINAL") == 0 ||
...@@ -1069,7 +1119,7 @@ void nxagentImportProperty(Window window, ...@@ -1069,7 +1119,7 @@ void nxagentImportProperty(Window window,
if (import) if (import)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: ChangeProperty on window [0x%x] property [%d] type [%s]" fprintf(stderr, "%s: ChangeProperty on window [0x%x] property [%ld] type [%s]"
" nitems [%ld] format [%d]\n", __func__, " nitems [%ld] format [%d]\n", __func__,
window, property, typeS, nitems, format); window, property, typeS, nitems, format);
#endif #endif
...@@ -1080,7 +1130,7 @@ void nxagentImportProperty(Window window, ...@@ -1080,7 +1130,7 @@ void nxagentImportProperty(Window window,
else else
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on window [0x%x] property [%d] type [%s]" fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on window [0x%x] property [%ld] type [%s]"
" ntems [%ld] format [%d]\n", __func__, " ntems [%ld] format [%d]\n", __func__,
window, property, validateString(typeS), nitems, format); window, property, validateString(typeS), nitems, format);
#endif #endif
...@@ -1126,7 +1176,7 @@ void nxagentRemovePropertyFromList(void) ...@@ -1126,7 +1176,7 @@ void nxagentRemovePropertyFromList(void)
struct nxagentPropertyRec *tmp = nxagentPropertyList.first; struct nxagentPropertyRec *tmp = nxagentPropertyList.first;
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Property [%d] on Window [0x%x] to list, list size is [%d].\n", __func__, fprintf(stderr, "%s: Property [%ld] on Window [0x%x] to list, list size is [%d].\n", __func__,
nxagentPropertyList.first -> property, nxagentPropertyList.first -> window, nxagentPropertyList.first -> property, nxagentPropertyList.first -> window,
nxagentPropertyList.size); nxagentPropertyList.size);
#endif #endif
...@@ -1162,7 +1212,7 @@ void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin) ...@@ -1162,7 +1212,7 @@ void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin)
} }
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Adding record Property [%d] - Window [0x%x][%p] to list, list" fprintf(stderr, "%s: Adding record Property [%ld] - Window [0x%x][%p] to list, list"
" size is [%d].\n", __func__, property, nxagentWindow(pWin), (void*) pWin, " size is [%d].\n", __func__, property, nxagentWindow(pWin), (void*) pWin,
nxagentPropertyList.size); nxagentPropertyList.size);
#endif #endif
...@@ -1208,7 +1258,7 @@ Bool nxagentNotifyMatchChangeProperty(void *p) ...@@ -1208,7 +1258,7 @@ Bool nxagentNotifyMatchChangeProperty(void *p)
if (first) if (first)
{ {
fprintf(stderr, "%s: First element on list is window [0x%x] property [%d] list size is [%d].\n", __func__, fprintf(stderr, "%s: First element on list is window [0x%x] property [%ld] list size is [%d].\n", __func__,
first -> window, first -> property, nxagentPropertyList.size); first -> window, first -> property, nxagentPropertyList.size);
} }
else else
......
...@@ -151,12 +151,9 @@ int nxagentArgc = 0; ...@@ -151,12 +151,9 @@ int nxagentArgc = 0;
char **nxagentArgv = NULL; char **nxagentArgv = NULL;
#ifdef NXAGENT_ARTSD #ifdef NXAGENT_ARTSD
char mcop_atom[] = "MCOPGLOBALS"; char mcop_atom[] = "MCOPGLOBALS";
Atom mcop_local_atom = None; Atom mcop_local_atom = None;
unsigned char fromHexNibble(char c); unsigned char fromHexNibble(char c);
void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
#endif #endif
Window nxagentIconWindow = None; Window nxagentIconWindow = None;
...@@ -3289,11 +3286,11 @@ FIXME: The port information is not used at the moment and produces a ...@@ -3289,11 +3286,11 @@ FIXME: The port information is not used at the moment and produces a
{ {
local_buf[in] = pszReturnData[i]; local_buf[in] = pszReturnData[i];
if(pszReturnData[i] == ':') if (pszReturnData[i] == ':')
{ {
i++; i++;
while(pszReturnData[i] != '\n') while (pszReturnData[i] != '\n')
{ {
unsigned char h = fromHexNibble(pszReturnData[i]); unsigned char h = fromHexNibble(pszReturnData[i]);
i++; i++;
...@@ -3302,7 +3299,8 @@ FIXME: The port information is not used at the moment and produces a ...@@ -3302,7 +3299,8 @@ FIXME: The port information is not used at the moment and produces a
unsigned char l = fromHexNibble(pszReturnData[i]); unsigned char l = fromHexNibble(pszReturnData[i]);
i++; i++;
if(h >= 16 || l >= 16) continue; if (h >= 16 || l >= 16)
continue;
/* /*
* FIXME: The array tchar[] was used uninitialized. It's * FIXME: The array tchar[] was used uninitialized. It's
...@@ -3333,7 +3331,7 @@ FIXME: The port information is not used at the moment and produces a ...@@ -3333,7 +3331,7 @@ FIXME: The port information is not used at the moment and produces a
/* /*
FIXME: The port information is not used at the moment and produces a FIXME: The port information is not used at the moment and produces a
warning on recent gcc versions. Do we need such information warning on recent gcc versions. Do we need such information
to run the audio forawrding? to run the audio forwarding?
chport = &port[0]; chport = &port[0];
...@@ -3349,7 +3347,7 @@ FIXME: The port information is not used at the moment and produces a ...@@ -3349,7 +3347,7 @@ FIXME: The port information is not used at the moment and produces a
strcat(local_buf,"00"); strcat(local_buf,"00");
in += 2; in += 2;
while(pszReturnData[i] != '\n') while (pszReturnData[i] != '\n')
{ {
i++; i++;
} }
...@@ -3920,7 +3918,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3920,7 +3918,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
output = pScrPriv->outputs[i]; output = pScrPriv->outputs[i];
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name); fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", output->name);
#endif #endif
RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1); RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1);
/* FIXME: Isn't there a function for setting this? */ /* FIXME: Isn't there a function for setting this? */
...@@ -4081,7 +4079,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -4081,7 +4079,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free(screeninfo); SAFE_free(screeninfo);
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < pScrPriv->numCrtcs; i++) for (int i = 0; i < pScrPriv->numCrtcs; i++)
{ {
RRModePtr mode = pScrPriv->crtcs[i]->mode; RRModePtr mode = pScrPriv->crtcs[i]->mode;
if (mode) { if (mode) {
...@@ -4093,7 +4091,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -4093,7 +4091,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
} }
if (pScrPriv->crtcs[i]->numOutputs > 0) if (pScrPriv->crtcs[i]->numOutputs > 0)
for (int j=0; j < pScrPriv->crtcs[i]->numOutputs; j++) for (int j = 0; j < pScrPriv->crtcs[i]->numOutputs; j++)
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc); fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc);
} }
#endif #endif
......
...@@ -59,8 +59,6 @@ extern int nxagentClients; ...@@ -59,8 +59,6 @@ extern int nxagentClients;
extern ScreenPtr nxagentDefaultScreen; extern ScreenPtr nxagentDefaultScreen;
extern Pixmap nxagentPixmapLogo;
extern Window nxagentIconWindow; extern Window nxagentIconWindow;
extern Window nxagentFullscreenWindow; extern Window nxagentFullscreenWindow;
...@@ -140,7 +138,9 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int); ...@@ -140,7 +138,9 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int);
void nxagentShadowSetRatio(float, float); void nxagentShadowSetRatio(float, float);
#ifdef NXAGENT_ARTSD
void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
#endif
/* /*
* Change window settings to adapt to a ratio. * Change window settings to adapt to a ratio.
......
...@@ -52,23 +52,19 @@ ...@@ -52,23 +52,19 @@
* Colors used to paint the splash screen. * Colors used to paint the splash screen.
*/ */
#define nxagentLogoWhite 0xffffff #define LOGOWHITE 0xffffff
#define nxagentLogoBlack 0x000000 #define LOGOBLACK 0x000000
#define nxagentLogoDarkGray 0x222222 #define LOGODARKGRAY 0x222222
#define nxagentLogoLightGray 0xbbbbbb #define LOGOLIGHTGRAY 0xbbbbbb
Pixmap nxagentPixmapLogo; static XlibPixmap nxagentPixmapLogo;
Window nxagentSplashWindow = None; static XlibWindow nxagentSplashWindow = None;
Bool nxagentWMPassed = False; static Bool nxagentWMPassed = False;
static void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height); static void nxagentPaintLogo(XlibWindow win, int scale, int width, int height);
void nxagentShowSplashWindow(Window parentWindow) void nxagentShowSplashWindow(XlibWindow parentWindow)
{ {
XWindowAttributes getAttributes;
XWindowChanges values;
XSetWindowAttributes attributes;
/* /*
* Show splash window only when running as X2Go Agent * Show splash window only when running as X2Go Agent
*/ */
...@@ -94,19 +90,19 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -94,19 +90,19 @@ void nxagentShowSplashWindow(Window parentWindow)
nxagentWMPassed = False; nxagentWMPassed = False;
XWindowAttributes getAttributes;
/* /*
* This would cause a GetWindowAttributes and a * This would cause a GetWindowAttributes and a GetGeometry
* GetGeometry (asynchronous) reply. We use instead * (asynchronous) reply. We use instead the geometry requested by
* the geometry requested by the user for the agent * the user for the agent window.
* window.
* *
* XGetWindowAttributes(nxagentDisplay, parentWindow, &getAttributes); * XGetWindowAttributes(nxagentDisplay, parentWindow, &getAttributes);
*/ */
/* /*
* During reconnection we draw the splash over * During reconnection we draw the splash over the default window
* the default window and not over the root * and not over the root window because it would be hidden by other
* window because it would be hidden by other
* windows. * windows.
*/ */
...@@ -128,28 +124,40 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -128,28 +124,40 @@ void nxagentShowSplashWindow(Window parentWindow)
fprintf(stderr, "%s: Going to create new splash window.\n", __func__); fprintf(stderr, "%s: Going to create new splash window.\n", __func__);
#endif #endif
XSetWindowAttributes attributes = {
.override_redirect = True,
.border_pixel = WhitePixel (nxagentDisplay, 0),
.background_pixel = BlackPixel (nxagentDisplay, 0)
};
nxagentSplashWindow = nxagentSplashWindow =
XCreateSimpleWindow(nxagentDisplay, XCreateWindow(nxagentDisplay,
parentWindow, parentWindow,
getAttributes.x, getAttributes.y, getAttributes.x, getAttributes.y,
getAttributes.width, getAttributes.height, getAttributes.width, getAttributes.height,
0, 0,
WhitePixel (nxagentDisplay, 0), CopyFromParent, CopyFromParent, CopyFromParent,
BlackPixel (nxagentDisplay, 0)); CWOverrideRedirect | CWBorderPixel | CWBackPixel,
&attributes);
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__, fprintf(stderr, "%s: Created new splash window with id [0x%lx].\n", __func__,
nxagentSplashWindow); nxagentSplashWindow);
#endif #endif
XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); nxagentPaintLogo(nxagentSplashWindow, 1, getAttributes.width, getAttributes.height);
nxagentPaintLogo(nxagentSplashWindow, gc, 1, getAttributes.width, getAttributes.height); XMapRaised(nxagentDisplay, nxagentSplashWindow);
XMapRaised (nxagentDisplay, nxagentSplashWindow); #if 0
values.stack_mode = Above; /*
* should not be required since XMapRaised takes care of that:
* "The XMapRaised function essentially is similar to XMapWindow in
* that it maps the window and all of its subwindows that have had
* map requests. However, it also raises the specified window to
* the top of the stack."
*/
XWindowChanges values = {.stack_mode = Above};
XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values);
attributes.override_redirect = True; #endif
XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes);
XFreeGC(nxagentDisplay, gc);
#ifdef NXAGENT_TIMESTAMP #ifdef NXAGENT_TIMESTAMP
{ {
...@@ -160,8 +168,15 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -160,8 +168,15 @@ void nxagentShowSplashWindow(Window parentWindow)
#endif #endif
} }
void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) Bool nxagentHaveSplashWindow(void)
{
return (nxagentSplashWindow != None);
}
void nxagentPaintLogo(XlibWindow win, int scale, int width, int height)
{ {
XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL);
int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay));
#ifdef DEBUG #ifdef DEBUG
...@@ -178,9 +193,6 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) ...@@ -178,9 +193,6 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height)
int w = width/scale; int w = width/scale;
int h = height/scale; int h = height/scale;
int w2 = w/2;
int h2 = h/2;
int c; int c;
if (height > width) if (height > width)
{ {
...@@ -202,173 +214,107 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) ...@@ -202,173 +214,107 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height)
if (blackRoot) if (blackRoot)
{ {
XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); XSetForeground(nxagentDisplay, gc, LOGOBLACK);
XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); XSetBackground(nxagentDisplay, gc, LOGOWHITE);
} }
else else
{ {
XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); XSetForeground(nxagentDisplay, gc, LOGOWHITE);
XSetBackground(nxagentDisplay, gc, nxagentLogoBlack); XSetBackground(nxagentDisplay, gc, LOGOBLACK);
} }
XPoint rect[4]; XPoint rect[15];
rect[0].x = 0; rect[0].y = 0; rect[0].x = 0; rect[0].y = 0;
rect[1].x = 0; rect[1].y = h; rect[1].x = 0; rect[1].y = height;
rect[2].x = w; rect[2].y = h; rect[2].x = width; rect[2].y = height;
rect[3].x = w; rect[3].y = 0; rect[3].x = width; rect[3].y = 0;
/* paint background */ /* paint background */
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
#ifdef NXAGENT_LOGO_DEBUG #ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "%s: filled first poly\n", __func__); fprintf(stderr, "%s: filled background\n", __func__);
#endif #endif
/*
* Draw X2GO Logo
*/
if (blackRoot) if (blackRoot)
XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); XSetForeground(nxagentDisplay, gc, LOGODARKGRAY);
else else
XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); XSetForeground(nxagentDisplay, gc, LOGOLIGHTGRAY);
/*
* Start 'X'.
*/
rect[0].x = w2-7*c; rect[0].y = h2-5*c;
rect[1].x = w2-8*c; rect[1].y = h2-5*c;
rect[2].x = w2-4*c; rect[2].y = h2+3*c;
rect[3].x = w2-3*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2-4*c; rect[0].y = h2-5*c;
rect[1].x = w2-3*c; rect[1].y = h2-5*c;
rect[2].x = w2-7*c; rect[2].y = h2+3*c;
rect[3].x = w2-8*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
/* #ifdef NXAGENT_LOGO_DEBUG
* End 'X'. /* mark center */
*/ XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, 0, h/2, w, h/2);
XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, w/2, 0, w/2, h);
#endif
/* /*
* Start '2'. * Draw X2GO Logo
*/ */
rect[0].x = w2-2*c; rect[0].y = h2-5*c; #define WX 5 /* width of "X" */
rect[1].x = w2-1*c; rect[1].y = h2-5*c; #define W2 4 /* width of "2" */
rect[2].x = w2-1*c; rect[2].y = h2-3*c; #define WG 4 /* width of "G" */
rect[3].x = w2-2*c; rect[3].y = h2-3*c; #define WO 4 /* width of "O" */
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #define SPC 1 /* width of space between letters */
#define H 8 /* height of letters */
rect[0].x = w2-2*c; rect[0].y = h2-5*c; #define TOTALW (WX + SPC + W2 + SPC + WG + SPC + WO) /* total width of logo */
rect[1].x = w2+2*c; rect[1].y = h2-5*c; #define XSTART ((w - (TOTALW * c)) / 2) /* x position of whole logo */
rect[2].x = w2+2*c; rect[2].y = h2-4*c; #define YSTART ((h - (H * c)) / 2) /* y position whole logo */
rect[3].x = w2-2*c; rect[3].y = h2-4*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+1*c; rect[0].y = h2-5*c; #define X(offset) (XSTART + (offset) * c)
rect[1].x = w2+2*c; rect[1].y = h2-5*c; #define Y(offset) (YSTART + (offset) * c)
rect[2].x = w2+2*c; rect[2].y = h2-2*c;
rect[3].x = w2+1*c; rect[3].y = h2-2*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+2*c; rect[0].y = h2-2*c; #define XY(xx,yy) {rect[cnt].x = X(xx); rect[cnt++].y = Y(yy);}
rect[1].x = w2+1*c; rect[1].y = h2-2*c;
rect[2].x = w2-2*c; rect[2].y = h2+2*c;
rect[3].x = w2-1*c; rect[3].y = h2+2*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
int cnt;
rect[0].x = w2-2*c; rect[0].y = h2+2*c;
rect[1].x = w2+2*c; rect[1].y = h2+2*c;
rect[2].x = w2+2*c; rect[2].y = h2+3*c;
rect[3].x = w2-2*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
/* /*
* End '2'. * Paint 'X'.
*/ */
/* cnt = 0; XY(1,0); XY(0,0); XY(4,8); XY(5,8);
* Start 'G'. XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Convex, CoordModeOrigin);
*/
rect[0].x = w2+3*c; rect[0].y = h2-5*c; cnt = 0; XY(4,0); XY(5,0); XY(1,8); XY(0,8);
rect[1].x = w2+7*c; rect[1].y = h2-5*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Convex, CoordModeOrigin);
rect[2].x = w2+7*c; rect[2].y = h2-4*c;
rect[3].x = w2+3*c; rect[3].y = h2-4*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+3*c; rect[0].y = h2-5*c;
rect[1].x = w2+4*c; rect[1].y = h2-5*c;
rect[2].x = w2+4*c; rect[2].y = h2+3*c;
rect[3].x = w2+3*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+3*c; rect[0].y = h2+2*c;
rect[1].x = w2+7*c; rect[1].y = h2+2*c;
rect[2].x = w2+7*c; rect[2].y = h2+3*c;
rect[3].x = w2+3*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+6*c; rect[0].y = h2-5*c;
rect[1].x = w2+7*c; rect[1].y = h2-5*c;
rect[2].x = w2+7*c; rect[2].y = h2-3*c;
rect[3].x = w2+6*c; rect[3].y = h2-3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+6*c; rect[0].y = h2-0*c;
rect[1].x = w2+7*c; rect[1].y = h2-0*c;
rect[2].x = w2+7*c; rect[2].y = h2+3*c;
rect[3].x = w2+6*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+5*c; rect[0].y = h2-1*c;
rect[1].x = w2+7*c; rect[1].y = h2-1*c;
rect[2].x = w2+7*c; rect[2].y = h2+0*c;
rect[3].x = w2+5*c; rect[3].y = h2+0*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
/* /*
* End 'G'. * Paint '2'.
*/ */
/* #undef X
* Start 'O'. #define X(offset) (XSTART + (SPC + WX + offset) * c)
*/
rect[0].x = w2+8*c; rect[0].y = h2-5*c; cnt = 0; XY(0,0); XY(4,0); XY(4,3); XY(1,7); XY(4,7); XY(4,8); XY(0,8); XY(0,7); XY(3,3); XY(3,1); XY(1,1); XY(1,2); XY(0,2); XY(0,0);
rect[1].x = w2+12*c; rect[1].y = h2-5*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin);
rect[2].x = w2+12*c; rect[2].y = h2-4*c;
rect[3].x = w2+8*c; rect[3].y = h2-4*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+8*c; rect[0].y = h2+3*c; /*
rect[1].x = w2+12*c; rect[1].y = h2+3*c; * Paint 'G'.
rect[2].x = w2+12*c; rect[2].y = h2+2*c; */
rect[3].x = w2+8*c; rect[3].y = h2+2*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+8*c; rect[0].y = h2-5*c; #undef X
rect[1].x = w2+9*c; rect[1].y = h2-5*c; #define X(offset) (XSTART + (SPC + WX + SPC + W2 + offset) * c)
rect[2].x = w2+9*c; rect[2].y = h2+3*c;
rect[3].x = w2+8*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
rect[0].x = w2+11*c; rect[0].y = h2-5*c; cnt = 0; XY(0,0); XY(4,0); XY(4,2); XY(3,2); XY(3,1); XY(1,1);XY(1,7);
rect[1].x = w2+12*c; rect[1].y = h2-5*c; XY(3,7); XY(3,5); XY(2,5); XY(2,4); XY(4,4); XY(4,8); XY(0,8); XY(0,0);
rect[2].x = w2+12*c; rect[2].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin);
rect[3].x = w2+11*c; rect[3].y = h2+3*c;
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
/* /*
* End 'O'. * Paint 'O'.
*/ */
#undef X
#define X(offset) (XSTART + (SPC + WX + SPC + W2 + SPC + WG + offset) * c)
cnt = 0; XY(0,0); XY(4,0); XY(4,8); XY(0,8); XY(0,1); XY(1,1); XY(1,7); XY(3,7); XY(3,1); XY(0,1); XY(0,0);
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin);
XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo);
XFreeGC(nxagentDisplay, gc);
#ifdef NXAGENT_LOGO_DEBUG #ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "%s: end\n", __func__); fprintf(stderr, "%s: end\n", __func__);
#endif #endif
...@@ -404,7 +350,7 @@ void nxagentRemoveSplashWindow(void) ...@@ -404,7 +350,7 @@ void nxagentRemoveSplashWindow(void)
nxagentRefreshWindows(screenInfo.screens[0]->root); nxagentRefreshWindows(screenInfo.screens[0]->root);
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ fprintf(stderr, "%s: setting the ownership of %s (%d) on window [0x%lx]\n", __func__,
"NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root)); "NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root));
#endif #endif
...@@ -415,6 +361,6 @@ void nxagentRemoveSplashWindow(void) ...@@ -415,6 +361,6 @@ void nxagentRemoveSplashWindow(void)
if (nxagentPixmapLogo) if (nxagentPixmapLogo)
{ {
XFreePixmap(nxagentDisplay, nxagentPixmapLogo); XFreePixmap(nxagentDisplay, nxagentPixmapLogo);
nxagentPixmapLogo = (Pixmap) 0; nxagentPixmapLogo = (XlibPixmap) 0;
} }
} }
...@@ -26,20 +26,9 @@ ...@@ -26,20 +26,9 @@
#ifndef __Splash_H__ #ifndef __Splash_H__
#define __Splash_H__ #define __Splash_H__
#include "Windows.h" #ifdef XlibWindow
#include "X11/Xdmcp.h" extern void nxagentShowSplashWindow(XlibWindow);
#include <nx/NXalert.h> #endif
extern void nxagentRemoveSplashWindow(void);
#define XDM_TIMEOUT 20000 extern Bool nxagentHaveSplashWindow(void);
extern xdmcp_states XdmcpState;
extern int XdmcpTimeOutRtx;
extern int XdmcpStartTime;
extern int nxagentXdmcpUp;
extern Window nxagentSplashWindow;
extern void nxagentShowSplashWindow(Window);
extern void nxagentRemoveSplashWindow();
#endif /* __Splash_H__ */ #endif /* __Splash_H__ */
...@@ -25,94 +25,84 @@ ...@@ -25,94 +25,84 @@
#include "Trap.h" #include "Trap.h"
#include <nx-X11/Xdefs.h>
/* /*
* Set if we are dispatching a render * Set if we are dispatching a render extension request. Used to avoid
* extension request. Used to avoid
* reentrancy in GC operations. * reentrancy in GC operations.
*/ */
int nxagentGCTrap = 0; Bool nxagentGCTrap = False;
/* /*
* Set if we are enqueing an internal * Set if we are enqueing an internal operation, CreateWindow and
* operation, CreateWindow and Reparent- * Reparent- Window. Used to remove any screen operation.
* Window. Used to remove any screen operation.
*/ */
int nxagentScreenTrap = 0; Bool nxagentScreenTrap = False;
/* /*
* Set if we are executing a GC operation * Set if we are executing a GC operation only on the X side. Used to
* only on the X side. Used to avoid * avoid reentrancy in FB layer.
* reentrancy in FB layer.
*/ */
int nxagentFBTrap = 0; Bool nxagentFBTrap = False;
/* /*
* Set if we are dispatching a shared * Set if we are dispatching a shared memory extension request.
* memory extension request.
*/ */
int nxagentShmTrap = 0; Bool nxagentShmTrap = False;
/* /*
* Set if a shared pixmap operation is * Set if a shared pixmap operation is requested by the client.
* requested by the client.
*/ */
int nxagentShmPixmapTrap = 0; Bool nxagentShmPixmapTrap = False;
/* /*
* Set if we are dispatching a XVideo * Set if we are dispatching a XVideo extension request.
* extension request.
*/ */
int nxagentXvTrap = 0; Bool nxagentXvTrap = False;
/* /*
* Set if we are dispatching a GLX * Set if we are dispatching a GLX extension request.
* extension request.
*/ */
int nxagentGlxTrap = 0; Bool nxagentGlxTrap = False;
/* /*
* Set while we are resuming the session. * Set while we are resuming the session.
*/ */
int nxagentReconnectTrap = 0; Bool nxagentReconnectTrap = False;
/* /*
* Set if we need to realize a drawable * Set if we need to realize a drawable by using a lossless encoding.
* by using a lossless encoding.
*/ */
int nxagentLosslessTrap = 0; Bool nxagentLosslessTrap = False;
/* /*
* Set to force the synchronization of * Set to force the synchronization of a drawable.
* a drawable.
*/ */
int nxagentSplitTrap = 0; Bool nxagentSplitTrap = False;
/* /*
* Set to avoid CapsLock synchronization * Set to avoid CapsLock synchronization problems when CapsLock is the
* problems when CapsLock is the first * first key to be pressed in the session.
* key to be pressed in the session.
*/ */
int nxagentXkbCapsTrap = 0; Bool nxagentXkbCapsTrap = False;
/* /*
* Set to avoid NumLock synchronization * Set to avoid NumLock synchronization problems when NumLock is the
* problems when NumLock is the first * first key to be pressed in the session.
* key to be pressed in the session.
*/ */
int nxagentXkbNumTrap = 0; Bool nxagentXkbNumTrap = False;
/* /*
* Set to indicate we are processing a clipboard event triggered by * Set to indicate we are processing a clipboard event triggered by
...@@ -120,4 +110,4 @@ int nxagentXkbNumTrap = 0; ...@@ -120,4 +110,4 @@ int nxagentXkbNumTrap = 0;
* would trigger another event by the real X server * would trigger another event by the real X server
*/ */
int nxagentExternalClipboardEventTrap = 0; Bool nxagentExternalClipboardEventTrap = False;
...@@ -26,6 +26,14 @@ ...@@ -26,6 +26,14 @@
#ifndef __Traps_H__ #ifndef __Traps_H__
#define __Traps_H__ #define __Traps_H__
#ifndef False
#define False 0
#endif
#ifndef True
#define True 1
#endif
/* /*
* Set if we are dispatching a render extension request. Used to avoid * Set if we are dispatching a render extension request. Used to avoid
* reentrancy in GC operations. * reentrancy in GC operations.
......
...@@ -74,7 +74,7 @@ Colormap nxagentDefaultVisualColormap(Visual *visual); ...@@ -74,7 +74,7 @@ Colormap nxagentDefaultVisualColormap(Visual *visual);
(v1).blue_mask == (v2).red_mask) && \ (v1).blue_mask == (v2).red_mask) && \
(v1).colormap_size == (v2).colormap_size) (v1).colormap_size == (v2).colormap_size)
Visual nxagentAlphaVisual; extern Visual nxagentAlphaVisual;
void nxagentInitAlphaVisual(); void nxagentInitAlphaVisual();
......
...@@ -76,12 +76,6 @@ ...@@ -76,12 +76,6 @@
int nxagentWindowPrivateIndex; int nxagentWindowPrivateIndex;
/* /*
* Number of windows which need synchronization.
*/
int nxagentCorruptedWindows;
/*
* Used to track nxagent window's visibility. * Used to track nxagent window's visibility.
*/ */
...@@ -89,6 +83,9 @@ int nxagentVisibility = VisibilityUnobscured; ...@@ -89,6 +83,9 @@ int nxagentVisibility = VisibilityUnobscured;
unsigned long nxagentVisibilityTimeout = 0; unsigned long nxagentVisibilityTimeout = 0;
Bool nxagentVisibilityStop = False; Bool nxagentVisibilityStop = False;
ConfiguredWindowStruct *nxagentConfiguredWindowList;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
/* /*
* Set here the required log level. * Set here the required log level.
*/ */
...@@ -99,8 +96,7 @@ Bool nxagentVisibilityStop = False; ...@@ -99,8 +96,7 @@ Bool nxagentVisibilityStop = False;
#undef DEBUG #undef DEBUG
/* /*
* Useful to test the window configuration * Useful to test the window configuration failures.
* failures.
*/ */
#ifdef TEST #ifdef TEST
...@@ -128,8 +124,7 @@ static int nxagentExposeSerial = 0; ...@@ -128,8 +124,7 @@ static int nxagentExposeSerial = 0;
StoringPixmapPtr nxagentBSPixmapList[BSPIXMAPLIMIT]; StoringPixmapPtr nxagentBSPixmapList[BSPIXMAPLIMIT];
/* /*
* Used to walk through the window hierarchy * Used to walk through the window hierarchy to find a window
* to find a window
*/ */
typedef struct _WindowMatch typedef struct _WindowMatch
...@@ -337,9 +332,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -337,9 +332,8 @@ Bool nxagentCreateWindow(WindowPtr pWin)
#endif #endif
/* /*
* Select the event mask if window is a top level * Select the event mask if window is a top level window. This at
* window. This at least makes the keyboard barely * least makes the keyboard barely work.
* work.
*/ */
#ifdef TEST #ifdef TEST
...@@ -415,9 +409,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -415,9 +409,8 @@ Bool nxagentCreateWindow(WindowPtr pWin)
#endif #endif
/* /*
* Set the WM_DELETE_WINDOW protocols on every * Set the WM_DELETE_WINDOW protocols on every top level
* top level window. Also redirect the window * window. Also redirect the window if it is a top level.
* if it is a top level.
*/ */
if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin))
...@@ -430,9 +423,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -430,9 +423,8 @@ Bool nxagentCreateWindow(WindowPtr pWin)
nxagentAddPropertyToList(prop, pWin); nxagentAddPropertyToList(prop, pWin);
/* /*
* Redirect the window to the off-screen * Redirect the window to the off-screen memory, if the composite
* memory, if the composite extension is * extension is supported on the display.
* supported on the display.
*/ */
/* /*
FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) FIXME: Do all the windows for which nxagentWindowTopLevel(pWin)
...@@ -483,8 +475,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -483,8 +475,7 @@ Bool nxagentCreateWindow(WindowPtr pWin)
fbCreateWindow(pWin); fbCreateWindow(pWin);
/* /*
* Only the root window will have * Only the root window will have the right colormap.
* the right colormap.
*/ */
if (!pWin->parent) if (!pWin->parent)
...@@ -707,10 +698,9 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) ...@@ -707,10 +698,9 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn)
nxagentWMDetect(); nxagentWMDetect();
/* /*
* The smart scheduler could be stopped while * The smart scheduler could be stopped while waiting for the
* waiting for the reply. In this case we need * reply. In this case we need to yield explicitly to avoid to be
* to yield explicitly to avoid to be stuck in * stuck in the dispatch loop forever.
* the dispatch loop forever.
*/ */
isItTimeToYield = 1; isItTimeToYield = 1;
...@@ -764,10 +754,6 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) ...@@ -764,10 +754,6 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn)
void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
{ {
Window w;
XSetWindowAttributes attributes;
unsigned long valuemask;
if (nxagentOption(Rootless)) if (nxagentOption(Rootless))
{ {
return; return;
...@@ -787,14 +773,16 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) ...@@ -787,14 +773,16 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
} }
} }
w = nxagentDefaultWindows[pScreen -> myNum]; Window w = nxagentDefaultWindows[pScreen -> myNum];
/* /*
* override_redirect makes the window manager ignore the window and * override_redirect makes the window manager ignore the window and
* not add decorations, see ICCCM) * not add decorations, see ICCCM)
*/ */
attributes.override_redirect = switchOn; XSetWindowAttributes attributes = {
valuemask = CWOverrideRedirect; .override_redirect = switchOn
};
unsigned long valuemask = CWOverrideRedirect;
XUnmapWindow(nxagentDisplay, w); XUnmapWindow(nxagentDisplay, w);
XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes);
...@@ -836,8 +824,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) ...@@ -836,8 +824,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (i < 100) if (i < 100)
{ {
/* /*
* The window manager has done with the reparent * The window manager has done with the reparent operation. We
* operation. We can resize and map the window. * can resize and map the window.
*/ */
nxagentChangeOption(Fullscreen, True); nxagentChangeOption(Fullscreen, True);
...@@ -881,8 +869,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) ...@@ -881,8 +869,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
nxagentOption(RootX), nxagentOption(RootY)); nxagentOption(RootX), nxagentOption(RootY));
/* /*
* We disable the screensaver when changing * We disable the screensaver on the real Xserver when changing mode to
* mode to fullscreen. Is it really needed? * fullscreen. Is it really needed?
*/ */
XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking);
...@@ -1167,11 +1155,10 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) ...@@ -1167,11 +1155,10 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift)
if (nxagentOption(ClientOs) == ClientOsWinnt) if (nxagentOption(ClientOs) == ClientOsWinnt)
{ {
/* /*
* If doMove is True we add exposed rectangles * If doMove is True we add exposed rectangles to the remote
* to the remote expose region. This is done to * expose region. This is done to refresh the areas showed newly
* refresh the areas showed newly in the viewport. * in the viewport. We create two rectangles, one for
* We create two rectangles, one for horizontal * horizontal pan and one for vertical pan.
* pan and one for vertical pan.
*/ */
BoxRec hRect = {.x1 = -newX, .y1 = -newY}; BoxRec hRect = {.x1 = -newX, .y1 = -newY};
...@@ -1411,9 +1398,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1411,9 +1398,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
Window parent_return; Window parent_return;
Window *children_return = NULL; Window *children_return = NULL;
unsigned int nchildren_return; unsigned int nchildren_return;
Status result;
result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Status result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay),
&root_return, &parent_return, &children_return, &nchildren_return); &root_return, &parent_return, &children_return, &nchildren_return);
if (result) if (result)
...@@ -1447,7 +1433,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1447,7 +1433,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
* *
* else if (mask & CWStackMode) * else if (mask & CWStackMode)
* { * {
* if (nxagentSplashWindow) * if (nxagentHaveSplashWindow())
* { * {
* valuemask = CWStackMode; * valuemask = CWStackMode;
* *
...@@ -1622,16 +1608,14 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1622,16 +1608,14 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
case ParentRelative: case ParentRelative:
{ {
attributes.background_pixmap = ParentRelative; attributes.background_pixmap = ParentRelative;
break; break;
} }
case BackgroundPixmap: case BackgroundPixmap:
{ {
/* /*
* If a window background is corrupted, we grant * If a window background is corrupted, we grant its usability
* its usability by clearing it with a solid co- * by clearing it with a solid color. When the pixmap will be
* lor. When the pixmap will be fully synchroni- * fully synchronized, an expose will be sent to the window's
* zed, an expose will be sent to the window's
* hierarchy. * hierarchy.
*/ */
...@@ -1649,8 +1633,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1649,8 +1633,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
nxagentAllocateCorruptedResource((DrawablePtr) pWin -> background.pixmap, RT_NX_CORR_BACKGROUND); nxagentAllocateCorruptedResource((DrawablePtr) pWin -> background.pixmap, RT_NX_CORR_BACKGROUND);
/* /*
* Clearing the remote background to * Clearing the remote background to make it usable.
* make it usable.
*/ */
nxagentFillRemoteRegion((DrawablePtr) pWin -> background.pixmap, nxagentFillRemoteRegion((DrawablePtr) pWin -> background.pixmap,
...@@ -1665,7 +1648,6 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1665,7 +1648,6 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
case BackgroundPixel: case BackgroundPixel:
{ {
mask &= ~CWBackPixmap; mask &= ~CWBackPixmap;
break; break;
} }
} }
...@@ -1713,9 +1695,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1713,9 +1695,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
} }
/* /*
* As we set this bit, we must change dix in * As we set this bit, we must change dix in order not to perform
* order not to perform PositionWindow and let * PositionWindow and let X move children windows for us.
* X move children windows for us.
*/ */
if (mask & CWWinGravity) if (mask & CWWinGravity)
...@@ -1724,8 +1705,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1724,8 +1705,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
} }
/* /*
FIXME: Do we need to set the attribute on the FIXME: Do we need to set the attribute on the remote display?
remote display?
*/ */
if (mask & CWBackingStore) if (mask & CWBackingStore)
{ {
...@@ -1767,8 +1747,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1767,8 +1747,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
} }
/* /*
FIXME: Do we need to set the attribute on the FIXME: Do we need to set the attribute on the remote display?
remote display?
*/ */
if (mask & CWSaveUnder) if (mask & CWSaveUnder)
{ {
...@@ -1794,9 +1773,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ...@@ -1794,9 +1773,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
ColormapPtr pCmap = (ColormapPtr) LookupIDByType(wColormap(pWin), RT_COLORMAP); ColormapPtr pCmap = (ColormapPtr) LookupIDByType(wColormap(pWin), RT_COLORMAP);
/* /*
FIXME: When the caller is nxagentReconfigureWindow FIXME: When the caller is nxagentReconfigureWindow sometimes
sometimes wColormap(pWin) is 0. Could a window wColormap(pWin) is 0. Could a window have no colormap?
have no colormap?
*/ */
if (pCmap != NULL) if (pCmap != NULL)
{ {
...@@ -1987,8 +1965,6 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) ...@@ -1987,8 +1965,6 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{ {
RegionRec temp;
if (pWin -> realized) if (pWin -> realized)
{ {
BoxPtr pBox = RegionRects(pRegion); BoxPtr pBox = RegionRects(pRegion);
...@@ -2012,11 +1988,11 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) ...@@ -2012,11 +1988,11 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
#endif #endif
/* /*
* The framebuffer operations don't take care of * The framebuffer operations don't take care of clipping to the
* clipping to the actual area of the framebuffer * actual area of the framebuffer so we need to clip ourselves.
* so we need to clip ourselves.
*/ */
RegionRec temp;
RegionInit(&temp, NullBox, 1); RegionInit(&temp, NullBox, 1);
RegionIntersect(&temp, pRegion, &pWin -> clipList); RegionIntersect(&temp, pRegion, &pWin -> clipList);
nxagentFrameBufferPaintWindow(pWin, &temp, what); nxagentFrameBufferPaintWindow(pWin, &temp, what);
...@@ -2025,14 +2001,12 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) ...@@ -2025,14 +2001,12 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
{ {
RegionRec temp;
/* /*
* The framebuffer operations don't take care of * The framebuffer operations don't take care of clipping to the
* clipping to the actual area of the framebuffer * actual area of the framebuffer so we need to clip ourselves.
* so we need to clip ourselves.
*/ */
RegionRec temp;
RegionInit(&temp, NullBox, 1); RegionInit(&temp, NullBox, 1);
RegionIntersect(&temp, pRegion, &pWin -> borderClip); RegionIntersect(&temp, pRegion, &pWin -> borderClip);
nxagentFrameBufferPaintWindow(pWin, &temp, what); nxagentFrameBufferPaintWindow(pWin, &temp, what);
...@@ -2148,8 +2122,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2148,8 +2122,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
* final region by referring to the first element of the vector. * final region by referring to the first element of the vector.
*/ */
RegionRec temp;
BoxRec box;
if (nxagentSessionState != SESSION_DOWN) if (nxagentSessionState != SESSION_DOWN)
{ {
...@@ -2181,13 +2153,14 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2181,13 +2153,14 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
nxagentExposeArrayIsInitialized = 1; nxagentExposeArrayIsInitialized = 1;
} }
RegionRec temp;
RegionInit(&temp, (BoxRec *) NULL, 1); RegionInit(&temp, (BoxRec *) NULL, 1);
if (pRgn != NULL) if (pRgn != NULL)
{ {
if (RegionNumRects(pRgn) > RECTLIMIT) if (RegionNumRects(pRgn) > RECTLIMIT)
{ {
box = *RegionExtents(pRgn); BoxRec box = *RegionExtents(pRgn);
RegionEmpty(pRgn); RegionEmpty(pRgn);
RegionInit(pRgn, &box, 1); RegionInit(pRgn, &box, 1);
...@@ -2247,8 +2220,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2247,8 +2220,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
#endif #endif
/* /*
* Mark this region for sending a synchro, * Mark this region for sending a synchro, in
* in nxagentFlushConfigureWindow(). * nxagentFlushConfigureWindow().
*/ */
nxagentExposeQueue.exposures[index].synchronize = 1; nxagentExposeQueue.exposures[index].synchronize = 1;
...@@ -2300,9 +2273,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2300,9 +2273,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
#ifdef SHAPE #ifdef SHAPE
static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
{ {
BoxPtr pBox1, pBox2;
unsigned int n1, n2;
if (pReg1 == pReg2) if (pReg1 == pReg2)
{ {
return True; return True;
...@@ -2313,11 +2283,11 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) ...@@ -2313,11 +2283,11 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
return False; return False;
} }
pBox1 = RegionRects(pReg1); BoxPtr pBox1 = RegionRects(pReg1);
n1 = RegionNumRects(pReg1); int n1 = RegionNumRects(pReg1);
pBox2 = RegionRects(pReg2); BoxPtr pBox2 = RegionRects(pReg2);
n2 = RegionNumRects(pReg2); int n2 = RegionNumRects(pReg2);
if (n1 != n2) if (n1 != n2)
{ {
...@@ -2339,9 +2309,6 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) ...@@ -2339,9 +2309,6 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
void nxagentShapeWindow(WindowPtr pWin) void nxagentShapeWindow(WindowPtr pWin)
{ {
Region reg;
BoxPtr pBox;
if (NXDisplayError(nxagentDisplay) == 1) if (NXDisplayError(nxagentDisplay) == 1)
{ {
return; return;
...@@ -2379,8 +2346,8 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2379,8 +2346,8 @@ void nxagentShapeWindow(WindowPtr pWin)
RegionCopy(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin)); RegionCopy(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin));
reg = XCreateRegion(); Region reg = XCreateRegion();
pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); BoxPtr pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape);
for (int i = 0; for (int i = 0;
i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape); i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape);
i++) i++)
...@@ -2438,8 +2405,8 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2438,8 +2405,8 @@ void nxagentShapeWindow(WindowPtr pWin)
RegionCopy(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin)); RegionCopy(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin));
reg = XCreateRegion(); Region reg = XCreateRegion();
pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); BoxPtr pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape);
for (int i = 0; for (int i = 0;
i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape); i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape);
i++) i++)
...@@ -2581,9 +2548,8 @@ void nxagentMapDefaultWindows(void) ...@@ -2581,9 +2548,8 @@ void nxagentMapDefaultWindows(void)
XMapWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); XMapWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]);
/* /*
* At reconnection the Input Window is * At reconnection the Input Window is raised in
* raised in nxagentReconnectAllWindows, * nxagentReconnectAllWindows, after the Root Window is mapped.
* after the Root Window is mapped.
*/ */
if (nxagentReconnectTrap == 0) if (nxagentReconnectTrap == 0)
...@@ -2593,8 +2559,7 @@ void nxagentMapDefaultWindows(void) ...@@ -2593,8 +2559,7 @@ void nxagentMapDefaultWindows(void)
} }
/* /*
* Send a SetSelectionOwner request * Send a SetSelectionOwner request to notify of the agent start.
* to notify of the agent start.
*/ */
XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty,
...@@ -2640,8 +2605,7 @@ Bool nxagentDisconnectAllWindows(void) ...@@ -2640,8 +2605,7 @@ Bool nxagentDisconnectAllWindows(void)
for (int i = 0; i < screenInfo.numScreens; i++) for (int i = 0; i < screenInfo.numScreens; i++)
{ {
WindowPtr pWin = screenInfo.screens[i]->root; nxagentTraverseWindow(screenInfo.screens[i]->root, nxagentDisconnectWindow, &succeeded);
nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded);
nxagentDefaultWindows[i] = None; nxagentDefaultWindows[i] = None;
} }
...@@ -2771,9 +2735,8 @@ Bool nxagentReconnectAllWindows(void *p0) ...@@ -2771,9 +2735,8 @@ Bool nxagentReconnectAllWindows(void *p0)
} }
/* /*
* After the Root Window has * After the Root Window has been mapped, the Input Windows is
* been mapped, the Input * raised.
* Windows is raised.
*/ */
if (nxagentOption(Rootless) == 0) if (nxagentOption(Rootless) == 0)
...@@ -2990,14 +2953,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -2990,14 +2953,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
#endif #endif
/* /*
* FIXME: This quick hack is intended to solve a * FIXME: This quick hack is intended to solve a problem of NXWin X
* problem of NXWin X server for windows. * server for windows. The NXWin minimize the windows moving
* The NXWin minimize the windows moving them * them out of the screen area, this behaviour can cause
* out of the screen area, this behaviour * problem when a rootless session is disconnected and an
* can cause problem when a rootless session * apps is minimized. It will be solved with new Xorg
* is disconnected and an apps is minimized. * version of the NXWin server.
* It will be solved with new Xorg version of
* the NXWin server.
*/ */
if (nxagentOption(Rootless)) if (nxagentOption(Rootless))
...@@ -3040,9 +3001,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3040,9 +3001,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
#endif #endif
/* /*
* We have to set the WM_DELETE_WINDOW protocols * We have to set the WM_DELETE_WINDOW protocols on every top level
* on every top level window, because we don't know * window, because we don't know if a client handles this.
* if a client handles this.
*/ */
if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root)) if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root))
...@@ -3061,7 +3021,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3061,7 +3021,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
if (nxagentWindowTopLevel(pWin)) if (nxagentWindowTopLevel(pWin))
{ {
int ret;
Atom type; Atom type;
int format; int format;
unsigned long nItems, bytesLeft; unsigned long nItems, bytesLeft;
...@@ -3071,15 +3030,15 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3071,15 +3030,15 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
unsigned char *data64 = NULL; unsigned char *data64 = NULL;
#endif #endif
ret = GetWindowProperty(pWin, int ret = GetWindowProperty(pWin,
XA_WM_NORMAL_HINTS, XA_WM_NORMAL_HINTS,
0, sizeof(XSizeHints), 0, sizeof(XSizeHints),
False, XA_WM_SIZE_HINTS, False, XA_WM_SIZE_HINTS,
&type, &format, &nItems, &bytesLeft, &data); &type, &format, &nItems, &bytesLeft, &data);
/* /*
* 72 is the number of bytes returned by * 72 is the number of bytes returned by sizeof(XSizeHints) on
* sizeof(XSizeHints) on 32 bit platforms. * 32 bit platforms.
*/ */
if (ret == Success && if (ret == Success &&
...@@ -3087,7 +3046,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3087,7 +3046,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
bytesLeft == 0 && bytesLeft == 0 &&
type == XA_WM_SIZE_HINTS) type == XA_WM_SIZE_HINTS)
{ {
XSizeHints *props;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n",
(void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin));
...@@ -3108,9 +3066,9 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3108,9 +3066,9 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
*(data64 + i) = *(data + i - 4); *(data64 + i) = *(data + i - 4);
} }
props = (XSizeHints *) data64; XSizeHints *props = (XSizeHints *) data64;
#else #else
props = (XSizeHints *) data; XSizeHints *props = (XSizeHints *) data;
#endif /* _XSERVER64 */ #endif /* _XSERVER64 */
hints = *props; hints = *props;
...@@ -3165,14 +3123,13 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat ...@@ -3165,14 +3123,13 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat
WindowPtr pWin = (WindowPtr)param0; WindowPtr pWin = (WindowPtr)param0;
Bool *pBool = (Bool*)data_buffer; Bool *pBool = (Bool*)data_buffer;
CursorPtr pCursor; CursorPtr pCursor;
ScreenPtr pScreen;
if (!pWin || !*pBool || !(pCursor = wCursor(pWin))) if (!pWin || !*pBool || !(pCursor = wCursor(pWin)))
{ {
return; return;
} }
pScreen = pWin -> drawable.pScreen; ScreenPtr pScreen = pWin -> drawable.pScreen;
if (!(nxagentCursorPriv(pCursor, pScreen))) if (!(nxagentCursorPriv(pCursor, pScreen)))
{ {
...@@ -3308,27 +3265,23 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) ...@@ -3308,27 +3265,23 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask)
Bool nxagentCheckWindowIntegrity(WindowPtr pWin) Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
{ {
Bool integrity = True; Bool integrity = True;
XImage *image;
char *data;
int format;
unsigned long plane_mask = AllPlanes;
unsigned int width, height, length, depth;
width = pWin -> drawable.width; unsigned int width = pWin -> drawable.width;
height = pWin -> drawable.height; unsigned int height = pWin -> drawable.height;
depth = pWin -> drawable.depth; unsigned int depth = pWin -> drawable.depth;
format = (depth == 1) ? XYPixmap : ZPixmap; int format = (depth == 1) ? XYPixmap : ZPixmap;
if (width && height) if (width && height)
{ {
length = nxagentImageLength(width, height, format, 0, depth); unsigned int length = nxagentImageLength(width, height, format, 0, depth);
data = calloc(1, length); char *data = calloc(1, length);
if (data == NULL) if (data == NULL)
{ {
FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length); FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length);
} }
image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0, unsigned long plane_mask = AllPlanes;
XImage *image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0,
width, height, plane_mask, format); width, height, plane_mask, format);
if (image == NULL) if (image == NULL)
{ {
...@@ -3396,7 +3349,6 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) ...@@ -3396,7 +3349,6 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
Bool nxagentIsIconic(WindowPtr pWin) Bool nxagentIsIconic(WindowPtr pWin)
{ {
int iReturn;
unsigned long ulReturnItems; unsigned long ulReturnItems;
unsigned long ulReturnBytesLeft; unsigned long ulReturnBytesLeft;
Atom atomReturnType; Atom atomReturnType;
...@@ -3408,7 +3360,7 @@ Bool nxagentIsIconic(WindowPtr pWin) ...@@ -3408,7 +3360,7 @@ Bool nxagentIsIconic(WindowPtr pWin)
return 0; return 0;
} }
iReturn = GetWindowProperty(pWin, MakeAtom("WM_STATE", 8, False), 0, sizeof(CARD32), False, int iReturn = GetWindowProperty(pWin, MakeAtom("WM_STATE", 8, False), 0, sizeof(CARD32), False,
AnyPropertyType, &atomReturnType, &iReturnFormat, AnyPropertyType, &atomReturnType, &iReturnFormat,
&ulReturnItems, &ulReturnBytesLeft, &pszReturnData); &ulReturnItems, &ulReturnBytesLeft, &pszReturnData);
...@@ -3734,7 +3686,6 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) ...@@ -3734,7 +3686,6 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence) StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence)
{ {
StaticResizedWindowStruct *index;
StaticResizedWindowStruct *ret = NULL; StaticResizedWindowStruct *ret = NULL;
if (nxagentStaticResizedWindowList == NULL) if (nxagentStaticResizedWindowList == NULL)
...@@ -3742,7 +3693,7 @@ StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence ...@@ -3742,7 +3693,7 @@ StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence
return NULL; return NULL;
} }
index = nxagentStaticResizedWindowList; StaticResizedWindowStruct *index = nxagentStaticResizedWindowList;
while (index && index -> sequence > sequence) while (index && index -> sequence > sequence)
{ {
......
...@@ -50,16 +50,14 @@ typedef struct ...@@ -50,16 +50,14 @@ typedef struct
void *pPicture; void *pPicture;
/* /*
* Set if the window is mapped * Set if the window is mapped on the remote server.
* on the remote server.
*/ */
int isMapped; int isMapped;
/* /*
* Set if the window on the remote * Set if the window on the remote server is redirected by using the
* server is redirected by using * composite extension.
* the composite extension.
*/ */
int isRedirected; int isRedirected;
...@@ -116,9 +114,8 @@ extern int nxagentWindowPrivateIndex; ...@@ -116,9 +114,8 @@ extern int nxagentWindowPrivateIndex;
#define nxagentWindow(pWin) (nxagentWindowPriv(pWin)->window) #define nxagentWindow(pWin) (nxagentWindowPriv(pWin)->window)
/* /*
* Window is either a child of our root * Window is either a child of our root or a child of the root of the
* or a child of the root of the real X * real X server.
* server.
*/ */
#define nxagentWindowParent(pWin) \ #define nxagentWindowParent(pWin) \
...@@ -165,8 +162,7 @@ extern int nxagentWindowPrivateIndex; ...@@ -165,8 +162,7 @@ extern int nxagentWindowPrivateIndex;
#define CW_RootlessRestack (1 << 18) #define CW_RootlessRestack (1 << 18)
/* /*
* This force the agent to send exposures * This force the agent to send exposures for all windows.
* for all windows.
*/ */
#define nxagentRefreshScreen() \ #define nxagentRefreshScreen() \
...@@ -182,17 +178,16 @@ extern XlibAtom serverTransToAgentProperty; ...@@ -182,17 +178,16 @@ extern XlibAtom serverTransToAgentProperty;
#endif #endif
/* /*
* If the rectangles in an exposed region exceed * If the rectangles in an exposed region exceed the number of 4, we
* the number of 4, we let the function decide if * let the function decide if it is better to send the window extents
* it is better to send the window extents rather * rather than the rectangles in the region.
* than the rectangles in the region.
*/ */
int nxagentExtentsPredicate(int total); int nxagentExtentsPredicate(int total);
/* /*
* Agent's nested window procedures. Look also * Agent's nested window procedures. Look also at Rootless.h for the
* at Rootless.h for the rootless counterparts. * rootless counterparts.
*/ */
Bool nxagentCreateWindow(WindowPtr pWin); Bool nxagentCreateWindow(WindowPtr pWin);
...@@ -250,8 +245,8 @@ void nxagentMapDefaultWindows(void); ...@@ -250,8 +245,8 @@ void nxagentMapDefaultWindows(void);
Bool nxagentSetWindowCursors(void *p0); Bool nxagentSetWindowCursors(void *p0);
/* /*
* The ConfigureWindow procedure has not * The ConfigureWindow procedure has not a pointer in the screen
* a pointer in the screen structure. * structure.
*/ */
void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask); void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask);
...@@ -265,10 +260,9 @@ extern unsigned long nxagentVisibilityTimeout; ...@@ -265,10 +260,9 @@ extern unsigned long nxagentVisibilityTimeout;
extern Bool nxagentVisibilityStop; extern Bool nxagentVisibilityStop;
/* /*
* Return the pointer to the window given the * Return the pointer to the window given the remote id. It tries to
* remote id. It tries to match the id from * match the id from the last matched window before iterating through
* the last matched window before iterating * the hierarchy.
* through the hierarchy.
*/ */
WindowPtr nxagentGetWindowFromID(Window id); WindowPtr nxagentGetWindowFromID(Window id);
...@@ -294,7 +288,6 @@ typedef struct _ConfiguredWindow ...@@ -294,7 +288,6 @@ typedef struct _ConfiguredWindow
unsigned int valuemask; unsigned int valuemask;
} ConfiguredWindowStruct; } ConfiguredWindowStruct;
ConfiguredWindowStruct *nxagentConfiguredWindowList;
typedef struct _StaticResizedWindow typedef struct _StaticResizedWindow
{ {
...@@ -306,8 +299,6 @@ typedef struct _StaticResizedWindow ...@@ -306,8 +299,6 @@ typedef struct _StaticResizedWindow
int offY; int offY;
} StaticResizedWindowStruct; } StaticResizedWindowStruct;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
void nxagentFlushConfigureWindow(void); void nxagentFlushConfigureWindow(void);
......
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of the aforementioned persons and companies. */
/* */
/* Redistribution and use of the present software is allowed according */
/* to terms specified in the file LICENSE which comes in the source */
/* distribution. */
/* */
/* All rights reserved. */
/* */
/* NOTE: This software has received contributions from various other */
/* contributors, only the core maintainers and supporters are listed as */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well. */
/* */
/**************************************************************************/
#ifndef __Xdmcp_H__
#define __Xdmcp_H__
#include "Windows.h"
#include "X11/Xdmcp.h"
#include <nx/NXalert.h>
#define XDM_TIMEOUT 20000
/* these are defined in os/xdmcp.h */
extern xdmcp_states XdmcpState;
extern int XdmcpTimeOutRtx;
extern int XdmcpStartTime;
extern int nxagentXdmcpUp;
#endif /* __Xdmcp_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of the aforementioned persons and companies. */
/* */
/* Redistribution and use of the present software is allowed according */
/* to terms specified in the file LICENSE which comes in the source */
/* distribution. */
/* */
/* All rights reserved. */
/* */
/* NOTE: This software has received contributions from various other */
/* contributors, only the core maintainers and supporters are listed as */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well. */
/* */
/**************************************************************************/
#define screensaver_width 256
#define screensaver_height 256
static unsigned char screensaver_bits[] = {
0xa8, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x40, 0x55,
0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50,
0x55, 0x05, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00,
0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0xa0,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0xaa,
0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0xa0,
0xaa, 0x0a, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00,
0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x50,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xaa, 0x2a, 0x80, 0x02, 0x80, 0xaa, 0xaa, 0x82, 0x0a, 0xa8, 0x28, 0x80,
0x8a, 0x80, 0x2a, 0x80, 0x80, 0x8a, 0xa2, 0x82, 0x0a, 0xaa, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x80, 0x82, 0x41, 0x40, 0x00, 0x50,
0x55, 0x41, 0x00, 0x00, 0x04, 0x00, 0x54, 0x40, 0x10, 0x00, 0x40, 0x00,
0x51, 0x55, 0x00, 0x15, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x41, 0x00, 0x10, 0x14, 0x00, 0x00, 0x00, 0xa8, 0x8a, 0x02, 0x00, 0x02,
0x00, 0x20, 0xa2, 0x00, 0x80, 0x00, 0x08, 0x00, 0xaa, 0x2a, 0x00, 0x2a,
0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80,
0x01, 0x00, 0x01, 0x50, 0x45, 0x05, 0x00, 0x01, 0x10, 0x10, 0x40, 0x11,
0x40, 0x00, 0x44, 0x00, 0x50, 0x15, 0x01, 0x15, 0x04, 0x00, 0x40, 0x00,
0x05, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0xa2,
0xaa, 0x2a, 0x00, 0x00, 0x02, 0x00, 0xa0, 0x08, 0x00, 0x00, 0x00, 0x00,
0xa2, 0xaa, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x01, 0x40, 0x44, 0x15, 0x10, 0x01,
0x10, 0x10, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x54, 0x55, 0x41, 0x45,
0x04, 0x00, 0x40, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x54,
0x20, 0x80, 0x00, 0x82, 0xaa, 0x0a, 0x00, 0x00, 0x22, 0x00, 0x80, 0x0a,
0x00, 0x00, 0x82, 0x00, 0xa0, 0x8a, 0x22, 0x02, 0x00, 0x08, 0x20, 0x00,
0xa8, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x2a, 0x10, 0x40, 0x00, 0x01,
0x54, 0x45, 0x10, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00,
0x50, 0x45, 0x05, 0x41, 0x00, 0x04, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x15, 0x00, 0x28, 0x00, 0xaa, 0xaa, 0x0a, 0x0a, 0x00,
0x20, 0x08, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x22, 0x2a,
0x00, 0x00, 0x0a, 0x00, 0xa8, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a,
0x50, 0x05, 0x00, 0x01, 0x55, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40,
0x01, 0x00, 0x00, 0x00, 0x40, 0x55, 0x11, 0x00, 0x00, 0x54, 0x01, 0x00,
0x44, 0x01, 0x00, 0x00, 0x05, 0x40, 0x00, 0x05, 0x00, 0x08, 0x00, 0x80,
0xaa, 0xaa, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x80, 0x00,
0x80, 0xaa, 0x28, 0x20, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00,
0x28, 0x00, 0x80, 0x02, 0x10, 0x10, 0x00, 0x01, 0x54, 0x45, 0x01, 0x00,
0x41, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x10, 0x55, 0x14, 0x00,
0x00, 0x04, 0x04, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x40, 0x40, 0x01,
0x08, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00,
0x20, 0xa0, 0xaa, 0x00, 0x80, 0x28, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00,
0x80, 0x02, 0x00, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x10, 0x14, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x40, 0x00, 0x00, 0x08, 0x20, 0x80, 0x00, 0x08, 0x08, 0x80, 0x80,
0x80, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x8a, 0x00,
0x02, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01,
0x10, 0x10, 0x00, 0x01, 0x10, 0x45, 0x55, 0x01, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00,
0x20, 0xa2, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x00, 0x80, 0x00, 0x02, 0x04, 0x00, 0x40, 0x00, 0x04, 0x04, 0x40, 0x40,
0x00, 0x01, 0x00, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x51, 0x45, 0x05,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x45, 0x01,
0x2a, 0x80, 0xaa, 0xaa, 0x82, 0xaa, 0x2a, 0xa0, 0x02, 0x02, 0x80, 0xa8,
0x00, 0x2a, 0xa0, 0x02, 0x80, 0xa2, 0x00, 0xa0, 0xa0, 0x0a, 0xa0, 0x00,
0x00, 0x00, 0x80, 0x88, 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x50, 0x41, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0xaa, 0x0a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2a, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8,
0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x55, 0x55,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x05, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x15, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa8, 0xaa,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x2a, 0x20, 0x00, 0x00, 0x41, 0x05, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14,
0x40, 0x10, 0x44, 0x15, 0x15, 0x00, 0x00, 0x50, 0x01, 0x00, 0x50, 0x55,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x10, 0x50, 0x40,
0x82, 0x08, 0x02, 0x08, 0x20, 0x08, 0x00, 0x22, 0xa0, 0x20, 0x88, 0x00,
0x22, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x80, 0x02,
0x00, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x88, 0x20, 0x44, 0x10, 0x01, 0x04,
0x50, 0x04, 0x00, 0x41, 0x10, 0x11, 0x44, 0x00, 0x41, 0x00, 0x00, 0x54,
0x41, 0x00, 0x40, 0x55, 0x15, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00,
0x54, 0x11, 0x04, 0x11, 0x80, 0x20, 0x02, 0x08, 0xa0, 0x08, 0x00, 0x02,
0x88, 0x20, 0x88, 0x00, 0x82, 0x00, 0x00, 0x2a, 0x22, 0x00, 0x80, 0xaa,
0x2a, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x08, 0x20,
0x40, 0x10, 0x01, 0x04, 0x50, 0x04, 0x00, 0x01, 0x04, 0x41, 0x44, 0x00,
0x41, 0x00, 0x00, 0x15, 0x05, 0x14, 0x15, 0x50, 0x10, 0x05, 0x40, 0x41,
0x41, 0x10, 0x45, 0x05, 0x50, 0x04, 0x04, 0x10, 0x80, 0x20, 0x02, 0x08,
0xa0, 0x08, 0x00, 0x02, 0x08, 0x22, 0x82, 0x00, 0x82, 0x00, 0x00, 0x0a,
0x2a, 0x22, 0x8a, 0x22, 0x22, 0x08, 0x80, 0x22, 0x22, 0x88, 0x88, 0x02,
0x28, 0x02, 0x08, 0x20, 0x40, 0x10, 0x15, 0x54, 0x10, 0x05, 0x00, 0x14,
0x04, 0x41, 0x44, 0x05, 0x41, 0x00, 0x00, 0x05, 0x50, 0x01, 0x41, 0x04,
0x05, 0x11, 0x00, 0x05, 0x44, 0x44, 0x50, 0x00, 0x10, 0x05, 0x50, 0x10,
0x80, 0x0a, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x20, 0xa8, 0x82, 0x82, 0x00,
0x2a, 0x00, 0x80, 0x02, 0x22, 0x02, 0x82, 0x20, 0x20, 0x08, 0x20, 0x88,
0x82, 0x88, 0x8a, 0x00, 0x88, 0x0a, 0x80, 0x20, 0x40, 0x04, 0x01, 0x04,
0x10, 0x05, 0x00, 0x40, 0x04, 0x41, 0x41, 0x00, 0x11, 0x00, 0x40, 0x01,
0x41, 0x41, 0x41, 0x14, 0x15, 0x11, 0x40, 0x44, 0x04, 0x44, 0x40, 0x00,
0x44, 0x15, 0x00, 0x11, 0x80, 0x08, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x80,
0x08, 0x82, 0x82, 0x00, 0x22, 0x00, 0xa0, 0x00, 0x22, 0x22, 0x82, 0x20,
0x22, 0x0a, 0x20, 0x28, 0x82, 0x82, 0x88, 0x00, 0x88, 0x2a, 0x00, 0x22,
0x44, 0x10, 0x01, 0x04, 0x10, 0x04, 0x00, 0x41, 0x04, 0x01, 0x41, 0x00,
0x41, 0x00, 0x50, 0x01, 0x14, 0x14, 0x01, 0x55, 0x10, 0x15, 0x40, 0x45,
0x05, 0x01, 0x45, 0x00, 0x04, 0x55, 0x04, 0x11, 0x82, 0x20, 0x02, 0x08,
0x20, 0x08, 0x00, 0x22, 0x08, 0x82, 0x80, 0x00, 0x82, 0x00, 0xa8, 0x00,
0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0xaa, 0x88, 0x20, 0x41, 0x10, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14,
0x04, 0x01, 0x41, 0x15, 0x41, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40,
0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x54, 0x51, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x15, 0x00,
0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02,
0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xa8, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00,
0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15,
0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x15, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00,
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00,
0x05, 0x14, 0x40, 0x01, 0x41, 0x40, 0x01, 0x14, 0x10, 0x01, 0x00, 0x40,
0x01, 0x04, 0x14, 0x14, 0x14, 0x10, 0x04, 0x00, 0xa0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xaa, 0x00, 0x00, 0x00, 0x80, 0x82, 0xa0, 0x20, 0x82,
0xa2, 0x20, 0x02, 0x22, 0x28, 0x02, 0x00, 0x08, 0x8a, 0x22, 0x08, 0x08,
0x22, 0x28, 0x0a, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x54,
0x01, 0x00, 0x00, 0x40, 0x41, 0x40, 0x10, 0x04, 0x11, 0x11, 0x04, 0x41,
0x10, 0x04, 0x00, 0x04, 0x04, 0x40, 0x10, 0x00, 0x41, 0x10, 0x11, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xaa, 0x02, 0x00, 0x00, 0xa0,
0x82, 0x80, 0x08, 0x08, 0x02, 0x08, 0x88, 0x80, 0x08, 0x08, 0x00, 0x08,
0x08, 0x20, 0x20, 0x80, 0x80, 0x20, 0x00, 0x00, 0x10, 0x50, 0x14, 0x14,
0x45, 0x05, 0x40, 0x05, 0x41, 0x14, 0x15, 0x50, 0x41, 0x01, 0x04, 0x00,
0x01, 0x04, 0x50, 0x00, 0x11, 0x04, 0x00, 0x14, 0x00, 0x40, 0x10, 0x44,
0x00, 0x11, 0x00, 0x00, 0xa0, 0x88, 0x22, 0xa2, 0x88, 0x08, 0x00, 0x2a,
0x82, 0x22, 0x22, 0xa8, 0x80, 0x0a, 0x08, 0x00, 0x02, 0xa8, 0x8a, 0xaa,
0x08, 0x08, 0x00, 0xa8, 0x00, 0x2a, 0x20, 0x80, 0xaa, 0x20, 0x00, 0x00,
0x00, 0x05, 0x04, 0x15, 0x55, 0x04, 0x40, 0x04, 0x50, 0x54, 0x01, 0x54,
0x00, 0x54, 0x04, 0x00, 0x01, 0x04, 0x40, 0x00, 0x10, 0x04, 0x00, 0x40,
0x05, 0x41, 0x40, 0x40, 0x00, 0x10, 0x00, 0x00, 0x80, 0x08, 0x02, 0x82,
0x80, 0x08, 0x80, 0x20, 0x02, 0x02, 0x02, 0x2a, 0x00, 0xa0, 0x08, 0x00,
0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, 0x8a, 0x20, 0x20, 0x82,
0x00, 0x20, 0x00, 0x00, 0x10, 0x45, 0x04, 0x11, 0x51, 0x04, 0x50, 0x44,
0x44, 0x44, 0x01, 0x15, 0x00, 0x40, 0x05, 0x00, 0x01, 0x04, 0x40, 0x00,
0x10, 0x04, 0x00, 0x00, 0x54, 0x40, 0x40, 0x41, 0x00, 0x10, 0x00, 0x00,
0xa0, 0x28, 0x02, 0x0a, 0x8a, 0x08, 0x20, 0x0a, 0x0a, 0x28, 0x02, 0x0a,
0x00, 0x80, 0x08, 0x00, 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00,
0x88, 0x20, 0x80, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x05, 0x40, 0x00, 0x11, 0x00,
0x01, 0x10, 0x10, 0x01, 0x11, 0x04, 0x00, 0x04, 0x50, 0x40, 0x41, 0x01,
0x01, 0x11, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa,
0xaa, 0x00, 0x80, 0x02, 0x80, 0x80, 0x20, 0x02, 0x02, 0x20, 0x08, 0x82,
0x08, 0x08, 0x00, 0x08, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x00, 0x00,
0x00, 0x40, 0x01, 0x10, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x40, 0x01,
0x40, 0x14, 0x40, 0x41, 0x05, 0x40, 0x01, 0x14, 0x14, 0x14, 0x00, 0x44,
0x01, 0x45, 0x00, 0x00, 0x14, 0x54, 0x00, 0x00, 0x00, 0x80, 0x02, 0x08,
0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x50,
0x55, 0x05, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0xa8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01,
0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0,
0xaa, 0x0a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x15, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x8a, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01,
0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00,
0xa8, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x05, 0x50, 0x00, 0x50, 0x40, 0x45, 0x11, 0x00, 0x50,
0x40, 0x41, 0x01, 0x00, 0x14, 0x00, 0x51, 0x40, 0x40, 0x00, 0x05, 0x14,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a,
0x88, 0x02, 0xaa, 0xa8, 0x80, 0x00, 0x00, 0xaa, 0xa8, 0xa2, 0x02, 0x00,
0xa2, 0xa0, 0x22, 0xa8, 0xa0, 0xa0, 0x8a, 0x2a, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x04, 0x01, 0x45, 0x51,
0x04, 0x40, 0x00, 0x45, 0x41, 0x51, 0x01, 0x00, 0x41, 0x50, 0x54, 0x50,
0x50, 0x50, 0x14, 0x14, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x82, 0xa2, 0xa0, 0x02, 0xa0, 0x88, 0x82,
0xa0, 0x88, 0x02, 0x80, 0x82, 0x28, 0x28, 0xa0, 0x20, 0x28, 0x08, 0x8a,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x45, 0x54, 0x00,
0x14, 0x40, 0x41, 0x50, 0x05, 0x51, 0x10, 0x41, 0x41, 0x41, 0x01, 0x00,
0x05, 0x14, 0x10, 0x50, 0x40, 0x10, 0x14, 0x54, 0x04, 0x00, 0x41, 0x55,
0x04, 0x45, 0x01, 0x04, 0x20, 0x02, 0x08, 0x00, 0x2a, 0xa0, 0x00, 0xa0,
0x8a, 0x20, 0xa8, 0xa2, 0xa0, 0xa0, 0x00, 0x80, 0x0a, 0x28, 0x28, 0xa0,
0x20, 0x28, 0x0a, 0x2a, 0x00, 0x00, 0x22, 0x0a, 0x80, 0x88, 0x02, 0x88,
0x04, 0x50, 0x01, 0x00, 0x54, 0x40, 0x01, 0x50, 0x15, 0x10, 0x14, 0x51,
0x40, 0x41, 0x01, 0x00, 0x15, 0x14, 0x14, 0x40, 0x11, 0x14, 0x05, 0x14,
0x00, 0x40, 0x10, 0x00, 0x15, 0x45, 0x04, 0x01, 0x00, 0x00, 0x08, 0x00,
0xa8, 0xa0, 0x00, 0x28, 0x8a, 0x08, 0x0a, 0x28, 0xa0, 0xa0, 0x00, 0x00,
0x2a, 0x0a, 0x28, 0xa0, 0x08, 0x8a, 0x02, 0x0a, 0x00, 0x80, 0x00, 0x08,
0x80, 0x00, 0x00, 0x82, 0x44, 0x11, 0x00, 0x00, 0x50, 0x50, 0x00, 0x10,
0x05, 0x40, 0x15, 0x05, 0x50, 0x50, 0x00, 0x00, 0x14, 0x14, 0x14, 0x40,
0x11, 0x54, 0x00, 0x05, 0x00, 0x00, 0x11, 0x00, 0x01, 0x40, 0x04, 0x44,
0x80, 0x20, 0x0a, 0x00, 0xa0, 0xa0, 0x00, 0x88, 0x82, 0xa8, 0x0a, 0x00,
0xa0, 0xa0, 0x00, 0x00, 0x28, 0x0a, 0x0a, 0xa0, 0x08, 0x0a, 0x00, 0x0a,
0x00, 0x00, 0x22, 0x0a, 0xa2, 0x00, 0x00, 0x88, 0x01, 0x40, 0x15, 0x00,
0x50, 0x51, 0x40, 0x00, 0x01, 0x51, 0x15, 0x00, 0x50, 0x50, 0x00, 0x00,
0x54, 0x14, 0x54, 0x40, 0x05, 0x14, 0x00, 0x05, 0x00, 0x40, 0x41, 0x15,
0x14, 0x45, 0x04, 0x05, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xa0, 0x20, 0x88,
0x80, 0xaa, 0x08, 0x82, 0x28, 0x28, 0x02, 0x20, 0x28, 0x0a, 0x2a, 0xa0,
0x02, 0x0a, 0x88, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x11, 0x44, 0x00, 0x55, 0x14, 0x44,
0x50, 0x50, 0x01, 0x40, 0x10, 0x54, 0x15, 0x40, 0x01, 0x14, 0x04, 0x45,
0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x22, 0xa0, 0x0a, 0x00, 0x00, 0x0a, 0x2a, 0x20, 0x28, 0xa8, 0x00, 0xa0,
0x08, 0xa8, 0x08, 0xa0, 0x00, 0xa8, 0x82, 0x82, 0x02, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, 0x00,
0x00, 0x54, 0x55, 0x10, 0x50, 0x50, 0x00, 0x00, 0x05, 0x50, 0x04, 0x40,
0x00, 0x50, 0x40, 0x05, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x80, 0xaa, 0x2a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a,
0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x55, 0x55,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01,
0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa8, 0xaa,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x50, 0x55,
0x05, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x28,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x80, 0xaa,
0x2a, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x50, 0x15,
0x55, 0x11, 0x55, 0x00, 0x15, 0x00, 0x54, 0x01, 0x00, 0x54, 0x01, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x50, 0x00, 0x20, 0x82, 0x20, 0x08, 0x82, 0x00, 0x22, 0x80,
0x08, 0x08, 0x28, 0xa2, 0x28, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa2,
0x00, 0x04, 0x41, 0x10, 0x04, 0x11, 0x00, 0x40, 0x10, 0x14, 0x10, 0x54,
0x54, 0x11, 0x10, 0x00, 0x01, 0x00, 0x50, 0x14, 0x15, 0x05, 0x45, 0x01,
0x50, 0x50, 0x44, 0x14, 0x05, 0x00, 0x04, 0x40, 0x20, 0x02, 0x22, 0x02,
0x22, 0x08, 0x20, 0x20, 0x00, 0x08, 0x20, 0xa8, 0x28, 0x22, 0x08, 0x80,
0x02, 0x00, 0x88, 0x22, 0xa2, 0x88, 0x28, 0x02, 0x88, 0x80, 0x22, 0xa2,
0x08, 0x00, 0x08, 0x22, 0x00, 0x04, 0x41, 0x00, 0x04, 0x00, 0x01, 0x40,
0x00, 0x10, 0x40, 0x04, 0x11, 0x10, 0x04, 0x10, 0x05, 0x00, 0x10, 0x04,
0x01, 0x55, 0x45, 0x04, 0x10, 0x50, 0x44, 0x15, 0x01, 0x00, 0x14, 0x10,
0x00, 0x2a, 0xa0, 0x02, 0x2a, 0x20, 0x22, 0x80, 0x02, 0x22, 0x20, 0x02,
0x0a, 0xa0, 0x02, 0x08, 0x0a, 0x00, 0x20, 0x02, 0x82, 0x80, 0x20, 0x02,
0x80, 0x88, 0x28, 0x82, 0x00, 0x00, 0xa8, 0x20, 0x00, 0x44, 0x40, 0x01,
0x14, 0x00, 0x04, 0x00, 0x05, 0x10, 0x40, 0x00, 0x11, 0x10, 0x05, 0x04,
0x14, 0x00, 0x44, 0x44, 0x01, 0x51, 0x44, 0x04, 0x10, 0x45, 0x14, 0x11,
0x01, 0x00, 0x50, 0x11, 0x00, 0x82, 0x20, 0x02, 0x22, 0x20, 0x28, 0x20,
0x08, 0x2a, 0x80, 0x02, 0x02, 0x20, 0x08, 0x00, 0x00, 0x00, 0x28, 0x28,
0x02, 0x8a, 0x22, 0x02, 0xa0, 0xa8, 0x08, 0x8a, 0x00, 0x00, 0x80, 0x22,
0x00, 0x04, 0x41, 0x10, 0x04, 0x01, 0x10, 0x00, 0x10, 0x41, 0x40, 0x01,
0x11, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x51, 0x20, 0x82, 0x20, 0x00,
0x02, 0x20, 0x28, 0x20, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x22, 0x10, 0x04, 0x45, 0x10, 0x04, 0x01, 0x10, 0x40,
0x04, 0x40, 0x00, 0x00, 0x41, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41,
0x8a, 0x0a, 0xaa, 0x8a, 0xaa, 0xa8, 0x20, 0xa0, 0x82, 0xa2, 0x80, 0x80,
0xaa, 0xa8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x15, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54,
0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa0, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x10, 0x50,
0x41, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x15, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa0, 0x80, 0x02, 0xa8, 0x28,
0x0a, 0xa0, 0x02, 0xa8, 0x00, 0x8a, 0x02, 0x28, 0x00, 0x00, 0x00, 0x0a,
0x28, 0x80, 0x2a, 0x80, 0x22, 0x80, 0x0a, 0x00, 0xa8, 0x00, 0x28, 0x2a,
0x00, 0x05, 0x00, 0x50, 0x00, 0x00, 0x55, 0x51, 0x14, 0x14, 0x54, 0x54,
0x01, 0x54, 0x01, 0x50, 0x50, 0x05, 0x00, 0x05, 0x00, 0x50, 0x55, 0x40,
0x51, 0x50, 0x15, 0x00, 0x54, 0x05, 0x14, 0x55, 0x00, 0x0a, 0x00, 0xa0,
0x00, 0x80, 0xaa, 0x2a, 0x2a, 0x08, 0x2a, 0xa8, 0x02, 0xaa, 0x02, 0xa0,
0xa0, 0x02, 0x00, 0x0a, 0x00, 0xa8, 0xaa, 0x80, 0x2a, 0xa8, 0x2a, 0x80,
0xaa, 0x0a, 0xa8, 0xaa, 0x01, 0x05, 0x00, 0x50, 0x05, 0x40, 0x55, 0x55,
0x14, 0x00, 0x14, 0x50, 0x05, 0x54, 0x01, 0x40, 0x51, 0x01, 0x00, 0x55,
0x00, 0x54, 0x55, 0x41, 0x15, 0x54, 0x55, 0x40, 0x55, 0x15, 0x54, 0x55,
0x02, 0x0a, 0x00, 0xa0, 0x0a, 0xa0, 0x02, 0x2a, 0x2a, 0x00, 0x0a, 0x88,
0x0a, 0x2a, 0x00, 0x80, 0xaa, 0x00, 0x00, 0xaa, 0x00, 0xaa, 0xa0, 0xa2,
0x0a, 0x2a, 0xa8, 0xa0, 0x0a, 0x0a, 0xaa, 0xa0, 0x01, 0x14, 0x01, 0x40,
0x55, 0x50, 0x01, 0x14, 0x14, 0x00, 0x05, 0x04, 0x15, 0x15, 0x00, 0x00,
0x51, 0x00, 0x00, 0x54, 0x05, 0x14, 0x40, 0x45, 0x05, 0x15, 0x50, 0x41,
0x01, 0x14, 0x54, 0x40, 0x02, 0xa8, 0x00, 0x80, 0xaa, 0xa8, 0x00, 0x2a,
0x28, 0x88, 0x02, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8,
0x0a, 0x0a, 0xa0, 0xa2, 0x82, 0x0a, 0xa0, 0xa0, 0x00, 0x28, 0x2a, 0xa0,
0x01, 0x50, 0x00, 0x00, 0x55, 0x50, 0x00, 0x14, 0x54, 0x54, 0x05, 0x15,
0x14, 0x15, 0x00, 0x00, 0x11, 0x00, 0x00, 0x50, 0x05, 0x15, 0x00, 0x40,
0x01, 0x05, 0x40, 0x51, 0x00, 0x14, 0x14, 0x40, 0x00, 0xa8, 0x00, 0x00,
0xa8, 0x28, 0x00, 0x28, 0x28, 0xa8, 0x02, 0x80, 0x0a, 0x0a, 0x00, 0x80,
0x08, 0x00, 0x00, 0x80, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0xaa, 0xaa, 0xa8,
0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x44, 0x01, 0x00, 0x50, 0x55, 0x00, 0x14,
0x50, 0x14, 0x01, 0x00, 0x15, 0x05, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00,
0x15, 0x05, 0x00, 0x50, 0x41, 0x55, 0x55, 0x51, 0x55, 0x15, 0x15, 0x40,
0x00, 0x80, 0x02, 0x00, 0xa0, 0x28, 0x00, 0x0a, 0x28, 0x0a, 0x02, 0x00,
0x8a, 0x0a, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x8a, 0x0a, 0x00, 0xa0,
0x80, 0xaa, 0xaa, 0xa8, 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x40, 0x01, 0x00,
0x50, 0x55, 0x00, 0x14, 0x50, 0x05, 0x00, 0x00, 0x14, 0x05, 0x00, 0x50,
0x50, 0x00, 0x00, 0x00, 0x15, 0x05, 0x00, 0x50, 0x40, 0x55, 0x55, 0x51,
0x55, 0x15, 0x05, 0x50, 0x00, 0x80, 0x02, 0x2a, 0xa8, 0x28, 0x00, 0x0a,
0xa8, 0x0a, 0x80, 0xaa, 0x82, 0x02, 0x00, 0x20, 0xa0, 0x00, 0xa0, 0x82,
0x8a, 0x0a, 0x00, 0xa0, 0x80, 0x02, 0x00, 0x28, 0x00, 0x00, 0x0a, 0xa0,
0x00, 0x00, 0x05, 0x14, 0x50, 0x54, 0x00, 0x15, 0x50, 0x05, 0x40, 0x55,
0x01, 0x05, 0x00, 0x10, 0x40, 0x01, 0x40, 0x01, 0x05, 0x15, 0x50, 0x51,
0x40, 0x01, 0x00, 0x50, 0x00, 0x00, 0x05, 0x50, 0x00, 0x00, 0x0a, 0x2a,
0xa8, 0xa8, 0x80, 0x0a, 0xa0, 0x02, 0x80, 0x0a, 0x80, 0x02, 0x00, 0x08,
0x80, 0x02, 0xa0, 0x82, 0x0a, 0x2a, 0xa8, 0xa0, 0x80, 0x02, 0x2a, 0xa8,
0x80, 0x8a, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x55, 0x50, 0x55, 0x05,
0x50, 0x01, 0x00, 0x00, 0x44, 0x05, 0x00, 0x04, 0x00, 0x05, 0x40, 0x55,
0x05, 0x54, 0x55, 0x50, 0x00, 0x55, 0x15, 0x50, 0x55, 0x05, 0x05, 0x50,
0x00, 0x00, 0x00, 0xa8, 0x2a, 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x08, 0x00,
0x8a, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x80, 0xaa, 0x02, 0xaa, 0x2a, 0x28,
0x80, 0xaa, 0x0a, 0xa0, 0xaa, 0x82, 0x02, 0x28, 0x00, 0x00, 0x00, 0x50,
0x15, 0x40, 0x55, 0x05, 0x40, 0x01, 0x10, 0x00, 0x55, 0x01, 0x00, 0x05,
0x00, 0x00, 0x00, 0x55, 0x01, 0x54, 0x15, 0x50, 0x00, 0x55, 0x05, 0x40,
0x55, 0x01, 0x05, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x80, 0x0a, 0x0a,
0xa0, 0x00, 0x00, 0xa0, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x2a,
0x00, 0xa0, 0x0a, 0x28, 0x00, 0xa8, 0x00, 0x80, 0x2a, 0x80, 0x02, 0x28,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
0x55, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0xa0, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa,
0xaa, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x50, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x55, 0x05, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x45, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0xa0, 0x22, 0xa8, 0x0a, 0xa8, 0x00,
0xa8, 0xa0, 0x28, 0x80, 0xaa, 0x22, 0x28, 0xa0, 0x02, 0x2a, 0x2a, 0xa0,
0x02, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x15, 0x50, 0x15, 0x54, 0x15, 0x54, 0x01, 0x55, 0x41, 0x55, 0x00,
0x55, 0x11, 0x54, 0x50, 0x05, 0x54, 0x54, 0x54, 0x05, 0x54, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x08, 0x08,
0x20, 0x08, 0x02, 0x82, 0x82, 0x82, 0x82, 0x00, 0xaa, 0x08, 0x20, 0x20,
0x08, 0x08, 0x08, 0x0a, 0x0a, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x04, 0x10, 0x10, 0x00, 0x01, 0x04,
0x01, 0x01, 0x01, 0x01, 0x54, 0x14, 0x11, 0x00, 0x10, 0x10, 0x04, 0x04,
0x04, 0x10, 0x00, 0x14, 0x51, 0x10, 0x44, 0x01, 0x50, 0x44, 0x44, 0x14,
0xa0, 0x00, 0x02, 0x08, 0x08, 0x80, 0x00, 0x82, 0x00, 0x82, 0x80, 0x00,
0xa8, 0x28, 0x00, 0xa0, 0x0a, 0x20, 0x08, 0x02, 0x08, 0x08, 0x00, 0x00,
0x20, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x05, 0x04, 0x00,
0x10, 0x00, 0x55, 0x45, 0x55, 0x41, 0x40, 0x00, 0x54, 0x54, 0x00, 0x50,
0x05, 0x10, 0x04, 0x55, 0x05, 0x04, 0x00, 0x44, 0x10, 0x14, 0x45, 0x04,
0x10, 0x54, 0x54, 0x04, 0x00, 0x0a, 0x02, 0x00, 0x08, 0x80, 0xaa, 0x82,
0xaa, 0x82, 0x80, 0x00, 0x2a, 0xaa, 0x00, 0x08, 0x08, 0x20, 0x02, 0xaa,
0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
0x10, 0x14, 0x04, 0x00, 0x04, 0x00, 0x01, 0x40, 0x00, 0x40, 0x40, 0x00,
0x15, 0x45, 0x15, 0x04, 0x04, 0x10, 0x01, 0x01, 0x00, 0x04, 0x00, 0x05,
0x15, 0x10, 0x44, 0x04, 0x14, 0x14, 0x41, 0x04, 0x08, 0x08, 0x0a, 0x08,
0x08, 0x80, 0x02, 0x82, 0x80, 0x20, 0x20, 0x80, 0x8a, 0x8a, 0x22, 0x02,
0x02, 0xa0, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x05, 0x54, 0x15, 0x55, 0x01, 0x55, 0x01,
0x55, 0x51, 0x51, 0x01, 0x45, 0x05, 0x00, 0x54, 0x15, 0x40, 0x00, 0x54,
0x45, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa8, 0x02, 0xa8, 0x82, 0xaa, 0x00, 0xaa, 0x00, 0x2a, 0xa8, 0xa8, 0x80,
0x82, 0x22, 0x20, 0xa8, 0x0a, 0x20, 0x00, 0xa8, 0x80, 0xaa, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x55, 0x55, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa0, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0xa8, 0xaa, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x2a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x55, 0x01, 0x00, 0x40, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a,
0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x50, 0x55, 0x05,
0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x54, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x0a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x0a, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05,
0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0xaa, 0x2a,
0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa8, 0x02, 0x08, 0x00, 0x10, 0x50, 0x50, 0x50, 0x40, 0x10, 0x00, 0x00,
0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x50, 0x00,
0x50, 0x00, 0x05, 0x04, 0x01, 0x05, 0x50, 0x40, 0x54, 0x05, 0x04, 0x05,
0x8a, 0x20, 0x20, 0x88, 0xa0, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x20, 0x00, 0x82, 0x82, 0x08, 0x8a,
0x82, 0x08, 0x88, 0xa0, 0xa8, 0x0a, 0x22, 0x28, 0x00, 0x41, 0x00, 0x04,
0x41, 0x44, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x55, 0x55,
0x00, 0x00, 0x10, 0x00, 0x01, 0x41, 0x10, 0x44, 0x44, 0x10, 0x04, 0x41,
0x50, 0x15, 0x11, 0x10, 0x80, 0x80, 0x00, 0x02, 0x82, 0x00, 0x00, 0x00,
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x80, 0x00,
0x02, 0x22, 0x20, 0x08, 0x20, 0x20, 0x02, 0x22, 0xa0, 0x2a, 0x22, 0x20,
0x00, 0x41, 0x10, 0x01, 0x44, 0x00, 0x00, 0x40, 0x41, 0x51, 0x04, 0x14,
0x15, 0x00, 0x11, 0x44, 0x50, 0x54, 0x40, 0x01, 0x05, 0x10, 0x00, 0x04,
0x10, 0x40, 0x01, 0x44, 0x10, 0x15, 0x51, 0x00, 0xa8, 0x80, 0x00, 0xaa,
0x82, 0x00, 0x00, 0x20, 0x22, 0x8a, 0xa2, 0x22, 0x22, 0x80, 0xa0, 0x88,
0x88, 0x88, 0x88, 0x02, 0x2a, 0x20, 0x00, 0x08, 0xa0, 0x2a, 0xaa, 0x22,
0x20, 0x8a, 0xa0, 0x02, 0x04, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x40,
0x10, 0x10, 0x41, 0x54, 0x11, 0x00, 0x11, 0x40, 0x54, 0x05, 0x04, 0x05,
0x50, 0x11, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, 0x10, 0x45, 0x00, 0x15,
0x82, 0x80, 0x08, 0x02, 0x80, 0x00, 0x00, 0x00, 0x22, 0x88, 0x02, 0x02,
0x22, 0x00, 0x82, 0x08, 0x02, 0x08, 0x02, 0x0a, 0x80, 0x22, 0x00, 0x08,
0x20, 0x00, 0x02, 0x20, 0x20, 0xa2, 0x00, 0x28, 0x01, 0x01, 0x05, 0x01,
0x40, 0x00, 0x00, 0x40, 0x14, 0x51, 0x41, 0x44, 0x11, 0x40, 0x04, 0x11,
0x04, 0x05, 0x01, 0x14, 0x00, 0x15, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40,
0x10, 0x51, 0x01, 0x50, 0x82, 0x00, 0x02, 0x02, 0x80, 0x00, 0x00, 0x80,
0xa2, 0x88, 0x2a, 0x28, 0x22, 0x80, 0x02, 0x28, 0x8a, 0x88, 0x00, 0x28,
0x00, 0x22, 0x00, 0x08, 0x20, 0x00, 0x02, 0x20, 0xa0, 0xa8, 0x02, 0x20,
0x01, 0x05, 0x05, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00,
0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00, 0x04,
0x40, 0x40, 0x04, 0x44, 0x10, 0x51, 0x15, 0x40, 0x82, 0x00, 0x02, 0x08,
0x82, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa,
0x2a, 0x00, 0x00, 0x00, 0x02, 0x82, 0x08, 0x08, 0x80, 0x20, 0x08, 0x22,
0xa0, 0xa0, 0x2a, 0x20, 0x14, 0x01, 0x00, 0x50, 0x50, 0x01, 0x00, 0x00,
0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00,
0x51, 0x00, 0x05, 0x15, 0x00, 0x05, 0x50, 0x50, 0x50, 0x40, 0x15, 0x05,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x2a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xa0, 0x0a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x50, 0x55, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa,
0x15, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x10, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x2a, 0x00, 0x00, 0x00,
0x00, 0xa0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0xaa, 0x15, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00,
0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55,
0xa2, 0x00, 0x80, 0x02, 0x0a, 0xa2, 0x82, 0x02, 0x0a, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xa8, 0xa0, 0x80, 0x82, 0xa0, 0x11, 0x01, 0x00, 0x04,
0x11, 0x50, 0x41, 0x04, 0x11, 0x10, 0x00, 0x14, 0x44, 0x40, 0x00, 0x41,
0x11, 0x00, 0x14, 0x00, 0x44, 0x05, 0x05, 0x04, 0x45, 0x00, 0x10, 0x44,
0x11, 0x11, 0x04, 0x44, 0xa2, 0x02, 0x20, 0x80, 0x20, 0x28, 0x20, 0x08,
0x02, 0x20, 0x80, 0x22, 0xa8, 0xa8, 0xa0, 0x82, 0x28, 0x00, 0x28, 0x80,
0x22, 0x08, 0x82, 0x0a, 0x22, 0x80, 0x00, 0x82, 0x20, 0x00, 0x88, 0x8a,
0x51, 0x05, 0x50, 0x00, 0x10, 0x11, 0x11, 0x10, 0x01, 0x50, 0x40, 0x10,
0x54, 0x04, 0x11, 0x04, 0x41, 0x00, 0x50, 0x40, 0x10, 0x04, 0x44, 0x10,
0x44, 0x40, 0x01, 0x01, 0x10, 0x10, 0x44, 0x14, 0xa2, 0x00, 0xa0, 0x00,
0xa8, 0x02, 0xa0, 0x0a, 0x02, 0xa0, 0xa0, 0x00, 0x0a, 0x82, 0x08, 0x82,
0x20, 0x00, 0xa0, 0x20, 0x20, 0x08, 0x22, 0x08, 0x02, 0x80, 0x02, 0x02,
0x20, 0xa8, 0x8a, 0x82, 0x51, 0x01, 0x40, 0x01, 0x55, 0x01, 0x10, 0x00,
0x01, 0x40, 0x41, 0x00, 0x04, 0x54, 0x50, 0x41, 0x40, 0x00, 0x40, 0x10,
0x10, 0x04, 0x41, 0x05, 0x01, 0x00, 0x05, 0x01, 0x10, 0x10, 0x40, 0x50,
0xa2, 0x08, 0x80, 0x82, 0xa0, 0x8a, 0x20, 0x00, 0x02, 0x80, 0x22, 0x00,
0x02, 0x0a, 0x28, 0x80, 0x20, 0x00, 0x80, 0x20, 0x08, 0x88, 0xa0, 0x00,
0x02, 0x00, 0x0a, 0x02, 0x20, 0x08, 0x80, 0xa0, 0x51, 0x01, 0x00, 0x44,
0x50, 0x11, 0x10, 0x00, 0x01, 0x00, 0x11, 0x00, 0x01, 0x01, 0x04, 0x40,
0x10, 0x00, 0x40, 0x11, 0x10, 0x10, 0x11, 0x00, 0x01, 0x00, 0x10, 0x01,
0x10, 0x10, 0x40, 0x50, 0xa2, 0x08, 0x00, 0x88, 0x80, 0x08, 0x20, 0x00,
0x02, 0x02, 0x22, 0x00, 0x02, 0x02, 0x08, 0x20, 0x20, 0x00, 0x80, 0x08,
0x08, 0x88, 0x20, 0x80, 0x00, 0x00, 0x20, 0x02, 0x20, 0x28, 0x80, 0xa0,
0x51, 0x11, 0x10, 0x44, 0x40, 0x50, 0x40, 0x10, 0x01, 0x00, 0x11, 0x00,
0x01, 0x01, 0x04, 0x40, 0x10, 0x00, 0x01, 0x11, 0x04, 0x50, 0x10, 0x00,
0x01, 0x40, 0x10, 0x04, 0x11, 0x50, 0x00, 0x01, 0xa2, 0x28, 0x20, 0x82,
0x0a, 0x20, 0xa0, 0x0a, 0x02, 0x02, 0x22, 0x88, 0x00, 0x82, 0x08, 0x22,
0x08, 0x80, 0x80, 0x28, 0x08, 0x28, 0x20, 0x88, 0x00, 0x80, 0x08, 0xaa,
0x20, 0xa0, 0x82, 0xaa, 0x41, 0x50, 0x50, 0x01, 0x55, 0x00, 0x00, 0x05,
0x05, 0x05, 0x51, 0x04, 0x01, 0x45, 0x14, 0x11, 0x50, 0x00, 0x41, 0x50,
0x04, 0x10, 0x50, 0x44, 0x00, 0x40, 0x05, 0x50, 0x50, 0x40, 0x01, 0x14,
0xaa, 0xaa, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0x82,
0x00, 0x2a, 0xa8, 0x20, 0x28, 0x80, 0x2a, 0x20, 0x08, 0x08, 0xa0, 0x82,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00,
0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x54, 0x55, 0x01, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x40, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x50,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x28, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x55, 0x55, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2a, 0x2a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x45,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0xa2, 0x22, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x88, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x0a, 0x08,
0x02, 0x22, 0xa0, 0x80, 0x08, 0x00, 0xa0, 0x00, 0x20, 0xa0, 0xa0, 0xa0,
0x41, 0x01, 0x51, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01,
0x00, 0x00, 0x55, 0x55, 0x14, 0x00, 0x11, 0x14, 0x05, 0x45, 0x10, 0x41,
0x11, 0x00, 0x40, 0x01, 0x14, 0x41, 0x40, 0x10, 0x82, 0x28, 0xa2, 0xaa,
0x80, 0xa2, 0xa2, 0xa0, 0xa8, 0x00, 0x28, 0x28, 0x08, 0xa2, 0x02, 0xaa,
0xa8, 0x80, 0x20, 0x88, 0x88, 0x0a, 0x08, 0x82, 0x20, 0x00, 0x80, 0x0a,
0x00, 0x82, 0x00, 0x08, 0x04, 0x51, 0x51, 0x55, 0x45, 0x44, 0x11, 0x11,
0x11, 0x01, 0x50, 0x44, 0x04, 0x11, 0x05, 0x55, 0x41, 0x41, 0x40, 0x10,
0x40, 0x55, 0x04, 0x44, 0x40, 0x00, 0x00, 0x14, 0x00, 0x01, 0x01, 0x04,
0x88, 0xa8, 0xa8, 0x2a, 0x2a, 0x20, 0x08, 0x0a, 0x0a, 0x02, 0xa0, 0x80,
0x88, 0x08, 0xa2, 0xaa, 0x02, 0x22, 0x00, 0x08, 0xa0, 0x8a, 0x02, 0x88,
0x20, 0x00, 0x00, 0x20, 0x00, 0x82, 0x20, 0x02, 0x05, 0x55, 0x54, 0x55,
0x44, 0x40, 0x50, 0x51, 0x11, 0x01, 0x04, 0x51, 0x10, 0x51, 0x41, 0x55,
0x05, 0x44, 0x00, 0x10, 0x00, 0x50, 0x54, 0x45, 0x40, 0x00, 0x00, 0x40,
0x50, 0x01, 0x01, 0x54, 0x80, 0x2a, 0xaa, 0x0a, 0x28, 0x28, 0x08, 0x08,
0x08, 0x02, 0x88, 0x88, 0x80, 0x08, 0xa8, 0xaa, 0x0a, 0x28, 0x00, 0x08,
0xa0, 0x02, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, 0x08, 0x02, 0x02, 0x02,
0x00, 0x15, 0x55, 0x15, 0x44, 0x44, 0x10, 0x11, 0x11, 0x01, 0x04, 0x45,
0x50, 0x10, 0x51, 0x55, 0x15, 0x44, 0x00, 0x10, 0x00, 0x01, 0x04, 0x40,
0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x11, 0x04, 0x80, 0x0a, 0xaa, 0x2a,
0x82, 0x22, 0xa0, 0xa0, 0x08, 0x02, 0xa8, 0xa8, 0x20, 0xa0, 0xa8, 0xaa,
0x0a, 0x28, 0x00, 0x08, 0x80, 0x00, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80,
0x02, 0x02, 0x0a, 0x02, 0x00, 0x04, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x44, 0x00, 0x10,
0x10, 0x00, 0x04, 0x40, 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x04, 0x04,
0x08, 0x02, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0xaa, 0x28, 0x82, 0x00, 0x08, 0xa8, 0x80, 0x08, 0x88,
0x20, 0x00, 0x20, 0x20, 0x02, 0x0a, 0x0a, 0x08, 0x44, 0x00, 0x50, 0x55,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
0x51, 0x01, 0x11, 0x10, 0x54, 0x41, 0x10, 0x44, 0x40, 0x00, 0x40, 0x10,
0x04, 0x01, 0x04, 0x10, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00,
0x00, 0xa0, 0x00, 0x08, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x00, 0x0a, 0x2a,
0x2a, 0x0a, 0xa0, 0xa0, 0xa0, 0x00, 0x20, 0x0a, 0x28, 0x02, 0x00, 0xa0,
0x50, 0x01, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00,
0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
...@@ -40,7 +40,7 @@ SOFTWARE. ...@@ -40,7 +40,7 @@ SOFTWARE.
typedef struct _DIXFontProp *DIXFontPropPtr; typedef struct _DIXFontProp *DIXFontPropPtr;
#ifdef HAS_XFONT2 #ifdef HAS_XFONT2
xfont2_fpe_funcs_rec const **fpe_functions; extern xfont2_fpe_funcs_rec const **fpe_functions;
#else #else
extern FPEFunctions *fpe_functions; extern FPEFunctions *fpe_functions;
#endif /* HAS_XFONT2 */ #endif /* HAS_XFONT2 */
......
/***********************************************************
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.
******************************************************************/
#ifndef RGB_H
#define RGB_H
typedef struct _RGB {
unsigned short red, green, blue;
} RGB;
#endif /* RGB_H */
...@@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \ ...@@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \
-DNX_TRANS_FOPEN \ -DNX_TRANS_FOPEN \
-DNX_TRANS_SLEEP \ -DNX_TRANS_SLEEP \
-DNX_TRANS_EXIT \ -DNX_TRANS_EXIT \
-DNX_TRANS_WAKEUP=1000 \ -DNX_TRANS_WAKEUP \
-DNXAGENT_SERVER \ -DNXAGENT_SERVER \
$(NULL) $(NULL)
......
...@@ -96,16 +96,29 @@ SOFTWARE. ...@@ -96,16 +96,29 @@ SOFTWARE.
#include "dpmsproc.h" #include "dpmsproc.h"
#endif #endif
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) /*
* unset defines without NX_TRANS_SOCKET. This allows for shorter
* ifdefs below
*/
#ifndef NX_TRANS_SOCKET
#ifdef NX_TRANS_DEBUG
#undef NX_TRANS_DEBUG
#endif
#ifdef NX_TRANS_WAKEUP
#undef NX_TRANS_WAKEUP
#endif
#endif
#ifdef NX_TRANS_WAKEUP
static unsigned long startTimeInMillis; static unsigned long startTimeInMillis;
#endif #endif
/* This is just a fallback to errno to hide the differences between unix and /* This is just a fallback to errno to hide the differences between unix and
Windows in the code */ Windows in the code */
#define GetErrno() errno #define GetErrno() errno
/* like ffs, but uses fd_mask instead of int as argument, so it works
when fd_mask is longer than an int, such as common 64-bit platforms */
/* modifications by raphael */ /* modifications by raphael */
int int
mffs(fd_mask mask) mffs(fd_mask mask)
...@@ -169,17 +182,15 @@ WaitForSomething(int *pClientsReady) ...@@ -169,17 +182,15 @@ WaitForSomething(int *pClientsReady)
Bool someReady = FALSE; Bool someReady = FALSE;
Bool someNotifyWriteReady = FALSE; Bool someNotifyWriteReady = FALSE;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Got called.\n"); fprintf(stderr, "WaitForSomething: Got called.\n");
#endif #endif
FD_ZERO(&clientsReadable); FD_ZERO(&clientsReadable);
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) #ifdef NX_TRANS_WAKEUP
startTimeInMillis = GetTimeInMillis(); startTimeInMillis = GetTimeInMillis();
#endif
#endif
/* We need a while loop here to handle /* We need a while loop here to handle
crashed connections and the screen saver timeout */ crashed connections and the screen saver timeout */
...@@ -222,44 +233,46 @@ WaitForSomething(int *pClientsReady) ...@@ -222,44 +233,46 @@ WaitForSomething(int *pClientsReady)
if (NewOutputPending) if (NewOutputPending)
FlushAllOutput(); FlushAllOutput();
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) #ifdef NX_TRANS_WAKEUP
/* /*
* If caller has marked the first element of pClientsReady[], * If caller has marked the first element of pClientsReady[],
* bail out of select after a short timeout. We need this to * bail out of select after the timeout given in the second
* let the NX agent remove the splash screen when the timeout * element. We need this to let the NX agent remove the splash
* is expired. A better option would be to use the existing * screen when the timeout is expired even if there's no
* screen-saver timeout but it can be modified by clients, so * client. Otherwise WaitForSomething would block. A better
* we would need a special handling. This hack is trivial and * option would be to use the existing screen-saver timeout
* keeps WaitForSomething() backward compatible with the exis- * but it can be modified by clients, so we would need a
* ting servers. * special handling. This hack is trivial and keeps
* WaitForSomething() backward compatible with the existing
* servers.
*/ */
if (pClientsReady[0] == -1) if (pClientsReady[0] == -1)
{ {
unsigned long timeoutInMillis; unsigned long timeoutInMillis;
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: pClientsReady[0] is [%d], pClientsReady[1] is [%d].\n", fprintf(stderr, "WaitForSomething: pClientsReady[0] is [%d], pClientsReady[1] is [%d].\n",
pClientsReady[0], pClientsReady[1]); pClientsReady[0], pClientsReady[1]);
#endif #endif
timeoutInMillis = GetTimeInMillis(); timeoutInMillis = GetTimeInMillis();
if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) if (timeoutInMillis - startTimeInMillis >= pClientsReady[1])
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n");
#endif #endif
return 0; return 0;
} }
timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); timeoutInMillis = pClientsReady[1] - (timeoutInMillis - startTimeInMillis);
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n",
timeoutInMillis); timeoutInMillis);
#endif #endif
if (wt == NULL || (wt -> tv_sec * MILLI_PER_SECOND + if (wt == NULL || (wt -> tv_sec * MILLI_PER_SECOND +
wt -> tv_usec / MILLI_PER_SECOND) > timeoutInMillis) wt -> tv_usec / MILLI_PER_SECOND) > timeoutInMillis)
{ {
...@@ -272,38 +285,33 @@ WaitForSomething(int *pClientsReady) ...@@ -272,38 +285,33 @@ WaitForSomething(int *pClientsReady)
wt = &waittime; wt = &waittime;
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Next wakeup timeout set to %ld milliseconds.\n", fprintf(stderr, "WaitForSomething: Next wakeup timeout set to %ld milliseconds.\n",
(waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_sec * MILLI_PER_SECOND) +
(waittime.tv_usec / MILLI_PER_SECOND)); (waittime.tv_usec / MILLI_PER_SECOND));
#endif #endif
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
else else
{ {
fprintf(stderr, "WaitForSomething: Using existing timeout of %ld milliseconds.\n", fprintf(stderr, "WaitForSomething: Using existing timeout of %ld milliseconds.\n",
(waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_sec * MILLI_PER_SECOND) +
(waittime.tv_usec / MILLI_PER_SECOND)); (waittime.tv_usec / MILLI_PER_SECOND));
} }
#endif #endif
} }
#endif #endif /* defined(NX_TRANS_WAKEUP) */
/* keep this check close to select() call to minimize race */ /* keep this check close to select() call to minimize race */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
if (dispatchException) if (dispatchException)
{
i = -1;
fprintf(stderr, "WaitForSomething: Value of dispatchException is true. Set i = -1.\n"); fprintf(stderr, "WaitForSomething: Value of dispatchException is true. Set i = -1.\n");
} #endif
#else
if (dispatchException) if (dispatchException)
i = -1; i = -1;
#endif
else if (AnyWritesPending) else if (AnyWritesPending)
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
if (wt == NULL) if (wt == NULL)
{ {
fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and " fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and "
...@@ -315,14 +323,14 @@ WaitForSomething(int *pClientsReady) ...@@ -315,14 +323,14 @@ WaitForSomething(int *pClientsReady)
"clientsWritable, %ld secs and %ld usecs.\n", "clientsWritable, %ld secs and %ld usecs.\n",
wt -> tv_sec, wt -> tv_usec); wt -> tv_sec, wt -> tv_usec);
} }
#endif #endif
XFD_COPYSET(&ClientsWriteBlocked, &LastSelectWriteMask); XFD_COPYSET(&ClientsWriteBlocked, &LastSelectWriteMask);
XFD_ORSET(&LastSelectWriteMask, &NotifyWriteFds, &LastSelectWriteMask); XFD_ORSET(&LastSelectWriteMask, &NotifyWriteFds, &LastSelectWriteMask);
i = Select(MaxClients, &LastSelectMask, &LastSelectWriteMask, NULL, wt); i = Select(MaxClients, &LastSelectMask, &LastSelectWriteMask, NULL, wt);
} }
else else
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
if (wt == NULL) if (wt == NULL)
{ {
fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and null timeout.\n"); fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and null timeout.\n");
...@@ -332,17 +340,16 @@ WaitForSomething(int *pClientsReady) ...@@ -332,17 +340,16 @@ WaitForSomething(int *pClientsReady)
fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, %ld secs and %ld usecs.\n", fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, %ld secs and %ld usecs.\n",
wt -> tv_sec, wt -> tv_usec); wt -> tv_sec, wt -> tv_usec);
} }
#endif #endif
i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Bailed out with i = [%d] and errno = [%d].\n", i, errno); fprintf(stderr, "WaitForSomething: Bailed out with i = [%d] and errno = [%d].\n", i, errno);
if (i < 0) if (i < 0)
{ {
fprintf(stderr, "WaitForSomething: Error is [%s].\n", strerror(errno)); fprintf(stderr, "WaitForSomething: Error is [%s].\n", strerror(errno));
} }
#endif #endif
selecterr = GetErrno(); selecterr = GetErrno();
WakeupHandler(i, (void *)&LastSelectMask); WakeupHandler(i, (void *)&LastSelectMask);
...@@ -350,31 +357,29 @@ WaitForSomething(int *pClientsReady) ...@@ -350,31 +357,29 @@ WaitForSomething(int *pClientsReady)
if (i <= 0) /* An error or timeout occurred */ if (i <= 0) /* An error or timeout occurred */
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
if (dispatchException) if (dispatchException)
{ {
fprintf(stderr, "WaitForSomething: Returning 0 because of (dispatchException).\n"); fprintf(stderr, "WaitForSomething: Returning 0 because of (dispatchException).\n");
return 0;
} }
#else #endif
if (dispatchException) if (dispatchException)
return 0; return 0;
#endif
if (i < 0) if (i < 0)
{ {
if (selecterr == EBADF) /* Some client disconnected */ if (selecterr == EBADF) /* Some client disconnected */
{ {
CheckConnections (); CheckConnections ();
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
#ifdef NX_TRANS_DEBUG
if (! XFD_ANYSET (&AllClients)) if (! XFD_ANYSET (&AllClients))
{ {
fprintf(stderr, "WaitForSomething: Returning 0 because of (! XFD_ANYSET (&AllClients)).\n"); fprintf(stderr, "WaitForSomething: Returning 0 because of (! XFD_ANYSET (&AllClients)).\n");
return 0;
} }
#else #endif
if (! XFD_ANYSET (&AllClients)) if (! XFD_ANYSET (&AllClients))
return 0; return 0;
#endif
} }
else if (selecterr == EINVAL) else if (selecterr == EINVAL)
{ {
...@@ -396,18 +401,14 @@ WaitForSomething(int *pClientsReady) ...@@ -396,18 +401,14 @@ WaitForSomething(int *pClientsReady)
XFD_COPYSET(&ClientsWithInput, &clientsReadable); XFD_COPYSET(&ClientsWithInput, &clientsReadable);
break; break;
} }
#if defined(NX_TRANS_SOCKET) #ifdef NX_TRANS_DEBUG
if (*checkForInput[0] != *checkForInput[1]) if (*checkForInput[0] != *checkForInput[1])
{ {
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n"); fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n");
#endif
return 0;
} }
#else #endif
if (*checkForInput[0] != *checkForInput[1]) if (*checkForInput[0] != *checkForInput[1])
return 0; return 0;
#endif
if (timers) if (timers)
{ {
...@@ -480,7 +481,7 @@ WaitForSomething(int *pClientsReady) ...@@ -480,7 +481,7 @@ WaitForSomething(int *pClientsReady)
{ {
int client_index; int client_index;
curclient = ffs (clientsReadable.fds_bits[i]) - 1; curclient = mffs (clientsReadable.fds_bits[i]) - 1;
client_index = /* raphael: modified */ client_index = /* raphael: modified */
ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
pClientsReady[nready++] = client_index; pClientsReady[nready++] = client_index;
...@@ -488,9 +489,9 @@ WaitForSomething(int *pClientsReady) ...@@ -488,9 +489,9 @@ WaitForSomething(int *pClientsReady)
} }
} }
} }
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Returning nready.\n"); fprintf(stderr, "WaitForSomething: Returning nready.\n");
#endif #endif
return nready; return nready;
} }
......
...@@ -185,8 +185,6 @@ InitConnectionLimits(void) ...@@ -185,8 +185,6 @@ InitConnectionLimits(void)
{ {
lastfdesc = -1; lastfdesc = -1;
#ifndef __CYGWIN__
#if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX)
lastfdesc = sysconf(_SC_OPEN_MAX) - 1; lastfdesc = sysconf(_SC_OPEN_MAX) - 1;
#endif #endif
...@@ -201,8 +199,6 @@ InitConnectionLimits(void) ...@@ -201,8 +199,6 @@ InitConnectionLimits(void)
lastfdesc = _NFILE - 1; lastfdesc = _NFILE - 1;
#endif #endif
#endif /* __CYGWIN__ */
/* This is the fallback */ /* This is the fallback */
if (lastfdesc < 0) if (lastfdesc < 0)
lastfdesc = MAXSOCKS; lastfdesc = MAXSOCKS;
...@@ -912,7 +908,7 @@ CheckConnections(void) ...@@ -912,7 +908,7 @@ CheckConnections(void)
mask = AllClients.fds_bits[i]; mask = AllClients.fds_bits[i];
while (mask) while (mask)
{ {
curoff = ffs (mask) - 1; curoff = mffs (mask) - 1;
curclient = curoff + (i * (sizeof(fd_mask)*8)); curclient = curoff + (i * (sizeof(fd_mask)*8));
FD_ZERO(&tmask); FD_ZERO(&tmask);
FD_SET(curclient, &tmask); FD_SET(curclient, &tmask);
......
...@@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput; ...@@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput;
extern WorkQueuePtr workQueue; extern WorkQueuePtr workQueue;
/* added by raphael */ /* in WaitFor.c */
#define ffs mffs #define ffs mffs
extern int mffs(fd_mask); extern int mffs(fd_mask);
......
...@@ -101,11 +101,8 @@ OsInit(void) ...@@ -101,11 +101,8 @@ OsInit(void)
InitNotifyFds(); InitNotifyFds();
#if !defined(__CYGWIN__)
fclose(stdin); fclose(stdin);
fclose(stdout); fclose(stdout);
#endif
/* /*
* If a write of zero bytes to stderr returns non-zero, i.e. -1, * If a write of zero bytes to stderr returns non-zero, i.e. -1,
...@@ -131,7 +128,7 @@ OsInit(void) ...@@ -131,7 +128,7 @@ OsInit(void)
dup2 (fileno (err), 2); dup2 (fileno (err), 2);
fclose (err); fclose (err);
} }
#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__) #if defined(SYSV) || defined(SVR4)
{ {
static char buf[BUFSIZ]; static char buf[BUFSIZ];
setvbuf (stderr, buf, _IOLBF, BUFSIZ); setvbuf (stderr, buf, _IOLBF, BUFSIZ);
......
...@@ -78,11 +78,6 @@ OR PERFORMANCE OF THIS SOFTWARE. ...@@ -78,11 +78,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#ifdef __CYGWIN__
#include <stdlib.h>
#include <signal.h>
#endif
#include <nx-X11/Xos.h> #include <nx-X11/Xos.h>
#include <stdio.h> #include <stdio.h>
#include "misc.h" #include "misc.h"
...@@ -903,11 +898,9 @@ ProcessCommandLine(int argc, char *argv[]) ...@@ -903,11 +898,9 @@ ProcessCommandLine(int argc, char *argv[])
#ifdef SERVER_LOCK #ifdef SERVER_LOCK
else if ( strcmp ( argv[i], "-nolock") == 0) else if ( strcmp ( argv[i], "-nolock") == 0)
{ {
#if !defined(__CYGWIN__)
if (getuid() != 0) if (getuid() != 0)
ErrorF("Warning: the -nolock option can only be used by root\n"); ErrorF("Warning: the -nolock option can only be used by root\n");
else else
#endif
nolock = TRUE; nolock = TRUE;
} }
#endif #endif
......
...@@ -676,7 +676,11 @@ unsigned act; ...@@ -676,7 +676,11 @@ unsigned act;
} }
else { else {
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
/* we have seen division by zero here */ /*
* we have seen division by zero here - see
* https://github.com/ArcticaProject/nx-libs/issues/808 for
* details and xorg upstream bug report
*/
if (ctrls->num_groups != 0) if (ctrls->num_groups != 0)
#endif #endif
group%= ctrls->num_groups; group%= ctrls->num_groups;
......
...@@ -553,8 +553,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1* ...@@ -553,8 +553,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1*
%{_includedir}/nx-X11/Sunkeysym.h %{_includedir}/nx-X11/Sunkeysym.h
%{_includedir}/nx-X11/X.h %{_includedir}/nx-X11/X.h
%{_includedir}/nx-X11/XF86keysym.h %{_includedir}/nx-X11/XF86keysym.h
%{_includedir}/nx-X11/XWDFile.h
%{_includedir}/nx-X11/Xalloca.h
%{_includedir}/nx-X11/Xarch.h %{_includedir}/nx-X11/Xarch.h
%{_includedir}/nx-X11/Xatom.h %{_includedir}/nx-X11/Xatom.h
%{_includedir}/nx-X11/Xdefs.h %{_includedir}/nx-X11/Xdefs.h
...@@ -586,7 +584,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1* ...@@ -586,7 +584,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1*
%{_includedir}/nx-X11/extensions/renderproto.h %{_includedir}/nx-X11/extensions/renderproto.h
%{_includedir}/nx-X11/extensions/saver.h %{_includedir}/nx-X11/extensions/saver.h
%{_includedir}/nx-X11/extensions/saverproto.h %{_includedir}/nx-X11/extensions/saverproto.h
%{_includedir}/nx-X11/extensions/scrnsaver.h
%{_includedir}/nx-X11/extensions/security.h %{_includedir}/nx-X11/extensions/security.h
%{_includedir}/nx-X11/extensions/securstr.h %{_includedir}/nx-X11/extensions/securstr.h
%{_includedir}/nx-X11/extensions/shapeconst.h %{_includedir}/nx-X11/extensions/shapeconst.h
......
...@@ -341,6 +341,9 @@ extern int NXTransFlush(int fd); ...@@ -341,6 +341,9 @@ extern int NXTransFlush(int fd);
* NX_CHANNEL_FONT: The channel will forward a X font server * NX_CHANNEL_FONT: The channel will forward a X font server
* connection. * connection.
* *
* NX_CHANNEL_SLAVE: The channel will forward data to a remote slave
* command (see NX_SLAVE_CMD envrionment variable)
*
* Only a proxy running at the NX server/X client side will be able * Only a proxy running at the NX server/X client side will be able
* to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running
* at the NX client/X server side can create font server connections. * at the NX client/X server side can create font server connections.
......
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