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 _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_ */
...@@ -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);
......
...@@ -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;
......
...@@ -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;
}
...@@ -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.
......
...@@ -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;
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