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:
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
phases for the upcoming two years (06/2015 - 06/2017).
phases for the upcoming two years.
## 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:
* CVE security audit (complete)
......@@ -56,8 +54,6 @@ Release goals (phase 1) for nx-libs release series 3.6.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):
* rebase Xserver code against latest X.Org server (work in progress)
......
......@@ -713,9 +713,7 @@ Copyright: 1999-2001, Brian Paul
2005, Brian Paul
License: Expat
Files: nx-X11/include/XWDFile.h
nx-X11/include/Xalloca.h
nx-X11/include/Xauth.h
Files: nx-X11/include/Xauth.h
nx-X11/include/Xfuncproto.h
nx-X11/include/Xfuncs.h
nx-X11/include/Xos.h
......@@ -1337,7 +1335,6 @@ Files: nx-X11/include/DECkeysym.h
nx-X11/programs/Xserver/include/region.h
nx-X11/programs/Xserver/include/regionstr.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/scrnintstr.h
nx-X11/programs/Xserver/include/selection.h
......@@ -1478,10 +1475,8 @@ License: MIT~X11
Files: nx-X11/include/extensions/XKB.h
nx-X11/include/extensions/XKBconfig.h
nx-X11/include/extensions/XKBfile.h
nx-X11/include/extensions/XKBgeom.h
nx-X11/include/extensions/XKBproto.h
nx-X11/include/extensions/XKBrules.h
nx-X11/include/extensions/XKBsrv.h
nx-X11/include/extensions/XKBstr.h
nx-X11/include/extensions/XKM.h
......@@ -2187,7 +2182,6 @@ License: Expat
Files: nx-X11/include/extensions/saver.h
nx-X11/include/extensions/saverproto.h
nx-X11/include/extensions/scrnsaver.h
nx-X11/programs/Xserver/Xext/saver.c
Copyright: 1992, X Consortium
License: Expat~NoAdvert
......
......@@ -7,8 +7,6 @@ Disclaimer: Autogenerated by CDBS
Files: nx-X11/include/DECkeysym.h
nx-X11/include/HPkeysym.h
nx-X11/include/X.h
nx-X11/include/XWDFile.h
nx-X11/include/Xalloca.h
nx-X11/include/Xauth.h
nx-X11/include/Xfuncproto.h
nx-X11/include/Xfuncs.h
......@@ -381,7 +379,6 @@ Files: nx-X11/include/DECkeysym.h
nx-X11/programs/Xserver/include/region.h
nx-X11/programs/Xserver/include/regionstr.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/scrnintstr.h
nx-X11/programs/Xserver/include/selection.h
......@@ -1517,10 +1514,8 @@ License: NTP (legal disclaimer)
Files: nx-X11/include/extensions/XKB.h
nx-X11/include/extensions/XKBconfig.h
nx-X11/include/extensions/XKBfile.h
nx-X11/include/extensions/XKBgeom.h
nx-X11/include/extensions/XKBproto.h
nx-X11/include/extensions/XKBrules.h
nx-X11/include/extensions/XKBsrv.h
nx-X11/include/extensions/XKBstr.h
nx-X11/include/extensions/XKM.h
......@@ -2116,7 +2111,6 @@ License: GENERATED FILE
Files: nx-X11/include/extensions/saver.h
nx-X11/include/extensions/saverproto.h
nx-X11/include/extensions/scrnsaver.h
nx-X11/programs/Xserver/Xext/saver.c
Copyright: 1992, X Consortium
License: MIT/X11 (BSD like)
......
......@@ -3,8 +3,6 @@ usr/include/*/nx-X11/HPkeysym.h
usr/include/*/nx-X11/Sunkeysym.h
usr/include/*/nx-X11/X.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/Xatom.h
usr/include/*/nx-X11/Xdefs.h
......
usr/include/*/nx-X11/extensions/saver.h
usr/include/*/nx-X11/extensions/saverproto.h
usr/include/*/nx-X11/extensions/scrnsaver.h
......@@ -23,8 +23,6 @@ HEADERS = \
Sunkeysym.h \
X.h \
XF86keysym.h \
XWDFile.h \
Xalloca.h \
Xarch.h \
Xatom.h \
Xdefs.h \
......@@ -59,7 +57,6 @@ MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
InstallDriverSDKNonExecFile(X.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xalloca.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xarch.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR))
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 =
#if BuildScreenSaverExt
SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h
SCREENSAVERHEADERS = saver.h saverproto.h
#endif
#if BuildXF86BigfontExt
......@@ -33,7 +33,7 @@ DAMAGEHEADERS = damagewire.h damageproto.h
XRESHEADERS = XResproto.h
#endif
XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h XKBfile.h XKBrules.h
XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h
EXTRAHEADERS = \
$(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.
#include <nx-X11/extensions/XKBproto.h>
#include "inputstr.h"
#ifdef NXAGENT_SERVER
extern char *_NXGetXkbBasePath(const char *path);
extern char *_NXGetXkbCompPath(const char *path);
#endif
typedef struct _XkbInterest {
DeviceIntPtr dev;
ClientPtr client;
......@@ -1111,91 +1106,6 @@ extern void XkbSendNewKeyboardNotify(
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
#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
PNRXINCLUDES = -I../mi -I../render
#endif
#if BuildDPMS
DPMSSRCS = dpms.c
DPMSOBJS = dpms.o
DPMSSRCS = dpms.c dpmsstubs.c
DPMSOBJS = dpms.o dpmsstubs.o
#endif
SRCS = shape.c $(SHMSRCS) xcmisc.c\
......
......@@ -148,7 +148,7 @@ static int ScreenSaverFreeSuspend(
* 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;
......@@ -256,7 +256,7 @@ ScreenSaverExtensionInit(void)
ScreenPtr pScreen;
AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
EventType = CreateNewResourceType(ScreenSaverFreeEvents);
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents);
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
......@@ -265,7 +265,7 @@ ScreenSaverExtensionInit(void)
pScreen = screenInfo.screens[i];
SetScreenPrivate (pScreen, NULL);
}
if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 &&
if (AttrType && SaverEventType && SuspendType && ScreenPrivateIndex != -1 &&
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
ScreenSaverResetProc, StandardMinorOpcode)))
......@@ -360,7 +360,7 @@ setEventMask (pScreen, client, mask)
break;
if (mask == 0)
{
FreeResource (pEv->resource, EventType);
FreeResource (pEv->resource, SaverEventType);
*pPrev = pEv->next;
free (pEv);
CheckScreenPrivate (pScreen);
......@@ -380,7 +380,7 @@ setEventMask (pScreen, client, mask)
pEv->client = client;
pEv->screen = pScreen;
pEv->resource = FakeClientID (client->index);
if (!AddResource (pEv->resource, EventType, (void *) pEv))
if (!AddResource (pEv->resource, SaverEventType, (void *) pEv))
return FALSE;
}
pEv->mask = mask;
......@@ -642,10 +642,10 @@ CreateSaverWindow (pScreen)
FreeResource (pWin->drawable.id, RT_NONE);
return FALSE;
}
pAttr->pCursor->refcnt++;
if (pWin->optional->cursor)
FreeCursor (pWin->optional->cursor, (Cursor)0);
pWin->optional->cursor = pAttr->pCursor;
pAttr->pCursor->refcnt++;
pWin->cursorIsNone = FALSE;
CheckWindowOptionalNeed (pWin);
mask |= CWCursor;
......
......@@ -36,6 +36,7 @@ SRCS = \
devices.c \
dixutils.c \
extension.c \
ffs.c \
gc.c \
globals.c \
grabs.c \
......@@ -58,6 +59,7 @@ OBJS = \
devices.o \
dixutils.o \
extension.o \
ffs.o \
gc.o \
globals.o \
grabs.o \
......
......@@ -209,7 +209,7 @@ UpdateCurrentTimeIf()
systime.milliseconds = GetTimeInMillis();
if (systime.milliseconds < currentTime.milliseconds)
systime.months++;
if (*checkForInput[0] == *checkForInput[1])
if (CompareTimeStamps(systime, currentTime) == LATER)
currentTime = systime;
}
......@@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv)
}
int
#ifdef NXAGENT_SERVER
xorg_InitClientPrivates(ClientPtr client)
#else
InitClientPrivates(ClientPtr client)
#endif
{
register char *ptr;
DevUnion *ppriv;
......@@ -3960,7 +3956,12 @@ DeleteClientFromAnySelections(ClientPtr client)
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
#ifdef NXAGENT_SERVER
/* bugfix missing in upstream before introduction of selection.c */
info.kind = SelectionClientClose;
#else
info.kind = SelectionWindowDestroy;
#endif
CallCallbacks(&SelectionCallback, &info);
}
CurrentSelections[i].pWin = (WindowPtr)NULL;
......
......@@ -1958,9 +1958,12 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
return err;
}
#ifndef NXAGENT_SERVER
int
#ifdef NXAGENT_SERVER
xorg_SetDefaultFontPath(char *path)
#else
SetDefaultFontPath(char *path)
#endif
{
char *temp_path,
*start,
......@@ -2027,7 +2030,6 @@ SetDefaultFontPath(char *path)
return err;
}
#endif /* NXAGENT_SERVER */
unsigned char *
GetFontPath(int *count, int *length)
......
......@@ -257,7 +257,7 @@ ProcChangeProperty(ClientPtr client)
int
#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,
Bool sendevent)
#else
......
......@@ -37,22 +37,22 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
extern Bool nxagentWMIsRunning;
/*
* Create the required atoms internally
* to the agent server.
* Create the required atoms internally to the agent server.
*/
void nxagentInitAtoms();
/*
* Query and create all the required atoms
* on the remote X server using a single
* round trip.
* Query and create all the required atoms on the remote X server
* using a single round trip.
*/
int nxagentQueryAtoms(ScreenPtr pScreen);
void nxagentResetAtomMap(void);
void nxagentFreeAtomMap(void);
void nxagentWMDetect(void);
#ifdef XlibAtom
......@@ -71,8 +71,7 @@ void nxagentWMDetect(void);
XlibAtom nxagentMakeAtom(char *, unsigned, Bool);
/*
* Converts local atoms in remote atoms and
* viceversa.
* Converts local atoms in remote atoms and viceversa.
*/
Atom nxagentRemoteToLocalAtom(XlibAtom);
......
......@@ -52,6 +52,7 @@
#include "Events.h"
#include "Drawable.h"
#include "Utils.h"
#include "Clipboard.h"
/*
* Need to include this after the stub definition of GC in Agent.h.
......@@ -68,6 +69,11 @@
#undef TEST
#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.
*/
......@@ -106,13 +112,139 @@ int nxagentClientPrivateIndex;
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))
{
nxagentClientPriv(client) -> clientState = 0;
#ifdef COUNT_CLIENT_BYTES
nxagentClientPriv(client) -> clientBytes = 0;
#endif
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)
client -> index, validateString(NameForAtom(property)), validateString(data));
#endif
if (nxagentClientPriv(client) -> clientHint == UNKNOWN)
if (nxagentClientHint(client) == UNKNOWN)
{
if (property == XA_WM_CLASS)
{
......@@ -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) &&
strncmp(data, "msgBox", 6) == 0)
......@@ -173,7 +305,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
validateString(NameForAtom(property)));
#endif
if (nxagentClientPriv(client) -> clientHint == UNKNOWN)
if (nxagentClientHint(client) == UNKNOWN)
{
if (strcmp(validateString(NameForAtom(property)), "_NX_SHADOW") == 0)
{
......@@ -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
fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n",
......@@ -284,6 +416,7 @@ void nxagentWakeupByReset(ClientPtr client)
}
}
#ifdef COUNT_CLIENT_BYTES
if (client -> index < MAX_CONNECTIONS)
{
#ifdef TEST
......@@ -293,6 +426,7 @@ void nxagentWakeupByReset(ClientPtr client)
nxagentClientBytes(client) = 0;
}
#endif
}
/*
......
......@@ -49,7 +49,7 @@ typedef struct _PrivClientRec
int clientState;
long clientBytes;
enum ClientHint clientHint;
char *clientInfoString;
} PrivClientRec;
extern int nxagentClientPrivateIndex;
......@@ -57,13 +57,17 @@ extern int nxagentClientPrivateIndex;
#define nxagentClientPriv(pClient) \
((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) \
(nxagentClientPriv(pClient) -> clientBytes += (size))
#define nxagentClientBytes(pClient) \
(nxagentClientPriv(pClient) -> clientBytes)
#endif
#define nxagentClientHint(pClient) \
(nxagentClientPriv(pClient) -> clientHint)
......@@ -71,9 +75,11 @@ void nxagentInitClientPrivates(ClientPtr);
#define nxagentClientIsDialog(pClient) \
(nxagentClientHint(pClient) == NXCLIENT_DIALOG)
#define nxagentClientInfoString(pClient) \
(nxagentClientPriv(pClient) -> clientInfoString)
/*
* The actual reason why the client
* is sleeping.
* The actual reason why the client is sleeping.
*/
#define SleepingBySplit 1
......@@ -90,19 +96,15 @@ void nxagentGuessClientHint(ClientPtr, Atom, char*);
void nxagentGuessShadowHint(ClientPtr, Atom);
void nxagentCheckIfShadowAgent(ClientPtr);
/*
* Suspend or restart the agent's
* client.
* Suspend or restart the agent's client.
*/
int nxagentSuspendBySplit(ClientPtr client);
int nxagentWakeupBySplit(ClientPtr client);
/*
* Wait until the given client is
* restarted.
* Wait until the given client is restarted.
*/
void nxagentWaitWakeupBySplit(ClientPtr client);
......@@ -119,8 +121,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable);
void nxagentWakeupByReconnect(void);
/*
* Reset the client state before
* closing it down.
* Reset the client state before closing it down.
*/
void nxagentWakeupByReset(ClientPtr client);
......
......@@ -41,29 +41,41 @@ typedef struct _XFixesAgentInfo
extern XFixesAgentInfoRec nxagentXFixesInfo;
/*
* Create the NX_SELTRANS_FROM_AGENT atom and
* initialize the required property to exchange
* data with the X server.
* Create the NX_SELTRANS_FROM_AGENT atom and initialize the required
* property to exchange data with the X server.
*/
extern Bool nxagentInitClipboard(WindowPtr pWindow);
/*
* Called whenever a client or a window is
* destroyed to let the clipboard code to
* release any pointer to the referenced
* structures.
* Called whenever a client or a window is destroyed to let the
* clipboard code to release any pointer to the referenced structures.
*/
extern void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow);
extern void nxagentSetSelectionOwner(Selection *pSelection);
extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
Window requestor, Atom property, Atom target, Time time);
void nxagentClearSelection();
void nxagentRequestSelection();
void nxagentHandleSelectionNotifyFromXServer();
#ifdef XEvent
extern void nxagentHandleSelectionClearFromXServer(XEvent *X);
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__ */
......@@ -77,6 +77,8 @@ is" without express or implied warranty.
#undef TEST
#undef DEBUG
CursorBitsPtr nxagentAnimCursorBits;
/*
* Defined in Display.c. There are huge problems mixing the GC
* definition in Xlib with the server code. This must be reworked.
......
......@@ -65,7 +65,7 @@ typedef struct _AnimCur {
AnimCurElt *elts;
} AnimCurRec, *AnimCurPtr;
CursorBitsPtr nxagentAnimCursorBits;
extern CursorBitsPtr nxagentAnimCursorBits;
#define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits)
#define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1))
......
......@@ -41,6 +41,7 @@
#include "Display.h"
#include "Dialog.h"
#include "Utils.h"
#include "Keystroke.h"
#include <nx/NX.h>
#include "compext/Compext.h"
......@@ -187,6 +188,7 @@ void nxagentLaunchDialog(DialogType dialogType)
int *pid;
char *type;
char *message;
char *strings[2] = {NULL}; /* don't forget to add free() calls if you change the number */
int local;
const char *window = NULL;
......@@ -247,6 +249,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE;
local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL;
pid = &nxagentEnableRandRModeDialogPid;
strings[0] = nxagentFindFirstKeystroke("resize");
break;
}
case DIALOG_DISABLE_DESKTOP_RESIZE_MODE:
......@@ -255,6 +258,8 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE;
local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL;
pid = &nxagentDisableRandRModeDialogPid;
strings[0] = nxagentFindFirstKeystroke("resize");
strings[1] = nxagentFindMatchingKeystrokes("viewport_");
break;
}
case DIALOG_ENABLE_DEFER_MODE:
......@@ -263,6 +268,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_DEFER_MODE_TYPE;
local = DIALOG_ENABLE_DEFER_MODE_LOCAL;
pid = &nxagentEnableDeferModePid;
strings[0] = nxagentFindFirstKeystroke("defer");
break;
}
case DIALOG_DISABLE_DEFER_MODE:
......@@ -271,6 +277,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_DEFER_MODE_TYPE;
local = DIALOG_DISABLE_DEFER_MODE_LOCAL;
pid = &nxagentDisableDeferModePid;
strings[0] = nxagentFindFirstKeystroke("defer");
break;
}
case DIALOG_ENABLE_AUTOGRAB_MODE:
......@@ -279,6 +286,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentEnableAutograbModePid;
strings[0] = nxagentFindFirstKeystroke("autograb");
break;
}
case DIALOG_DISABLE_AUTOGRAB_MODE:
......@@ -287,6 +295,7 @@ void nxagentLaunchDialog(DialogType dialogType)
type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentDisableAutograbModePid;
strings[0] = nxagentFindFirstKeystroke("autograb");
break;
}
default:
......@@ -321,6 +330,17 @@ void nxagentLaunchDialog(DialogType dialogType)
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.
*/
......@@ -331,9 +351,13 @@ void nxagentLaunchDialog(DialogType dialogType)
sigprocmask(SIG_BLOCK, &set, &oldSet);
*pid = NXTransDialog(nxagentDialogName, message, window,
*pid = NXTransDialog(nxagentDialogName, msg, window,
type, local, dialogDisplay);
SAFE_free(strings[0]);
SAFE_free(strings[1]);
SAFE_free(msg);
#ifdef TEST
fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n",
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
......
......@@ -78,7 +78,9 @@ extern void nxagentTerminateDialogs(void);
nxagentEnableRandRModeDialogPid == 0 && \
nxagentDisableRandRModeDialogPid == 0 && \
nxagentEnableDeferModePid == 0 && \
nxagentDisableDeferModePid == 0)
nxagentDisableDeferModePid == 0 && \
nxagentEnableAutograbModePid == 0 && \
nxagentDisableAutograbModePid == 0)
#define DECODE_DIALOG_TYPE(type) \
((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \
......@@ -96,10 +98,9 @@ extern void nxagentTerminateDialogs(void);
"UNKNOWN_DIALOG")
/*
* Message to be showed to users when the close
* button is pressed. The right message is chosen
* according if session does or does not run in
* persistent mode.
* Message to be shown to users when the close button is pressed. The
* right message is chosen according if session does or does not run
* in persistent mode.
*/
#define DIALOG_KILL_SESSION_MESSAGE \
......@@ -174,7 +175,7 @@ nxagentFailedReconnectionMessage
"\
The session is now running in desktop resize mode.\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.\
"
......@@ -187,9 +188,12 @@ again to disable this option.\
"\
The session is now running in viewport mode. You can\n\
navigate across different areas of the desktop window\n\
by dragging the desktop with the mouse or by using the\n\
arrows keys while pressing Ctrl+Alt. Press Ctrl+Alt+R\n\
again to return to the desktop resize mode.\
by dragging the desktop with the mouse while pressing\n\
Ctrl+Alt or use the keystrokes listed below. Press\n\
%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"
......@@ -201,7 +205,7 @@ again to return to the desktop resize mode.\
\
"\
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"
......@@ -213,7 +217,7 @@ Ctrl+Alt+E again to disable this option.\
\
"\
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"
......@@ -225,7 +229,7 @@ Ctrl+Alt+E to enable it again.\
\
"\
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"
......@@ -237,7 +241,7 @@ Ctrl+Alt+G again to disable auto-grabbing.\
\
"\
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"
......
......@@ -86,6 +86,7 @@ is" without express or implied warranty.
#include "Splash.h"
#include "Screen.h"
#include "Handlers.h"
#include "Split.h"
#include <nx/NX.h>
#include "compext/Compext.h"
......@@ -1494,8 +1495,13 @@ void nxagentInitVisuals(void)
if (nxagentVisuals != NULL)
{
nxagentVisuals = (XVisualInfo *) realloc(nxagentVisuals,
nxagentNumVisuals * sizeof(XVisualInfo));
XVisualInfo *new = (XVisualInfo *) realloc(nxagentVisuals,
nxagentNumVisuals * sizeof(XVisualInfo));
/* nxagentVisuals being NULL is covered below */
if (new)
nxagentVisuals = new;
else
SAFE_free(nxagentVisuals);
}
SAFE_XFree(viList);
......@@ -1547,6 +1553,7 @@ void nxagentInitPixmapFormats(void)
*/
nxagentNumPixmapFormats = 0;
nxagentRemoteNumPixmapFormats = 0;
/*
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).
*/
if (nxagentRemotePixmapFormats == NULL)
int tmpnum = 0;
XPixmapFormatValues *tmp = XListPixmapFormats(nxagentDisplay, &tmpnum);
if (tmp == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentInitPixmapFormats: WARNING! Failed to get available remote pixmap formats.\n");
#endif
nxagentRemotePixmapFormats = NULL;
}
#ifdef TEST
else
{
#ifdef TEST
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++)
{
fprintf(stderr, "nxagentInitPixmapFormats: Remote pixmap format [%d]: depth [%d] "
"bits_per_pixel [%d] scanline_pad [%d].\n", i, nxagentRemotePixmapFormats[i].depth,
nxagentRemotePixmapFormats[i].bits_per_pixel, nxagentRemotePixmapFormats[i].scanline_pad);
}
#endif
}
#endif
}
void nxagentSetDefaultDrawables(void)
......
......@@ -162,8 +162,7 @@ extern int nxagentForceSynchronization;
extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
int width, int height);
#define nxagentFreeRegion(pDrawable, pRegion) \
RegionDestroy(pRegion);
#define nxagentFreeRegion(pRegion) RegionDestroy(pRegion);
extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
......
......@@ -545,19 +545,15 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
void nxagentInternalWindowsTree(WindowPtr pWin, int indent)
{
while (pWin)
for (; pWin; pWin = pWin -> nextSib)
{
WindowPtr pChild = pWin -> firstChild;
fprintf(stderr, "%*s", indent, "");
nxagentInternalWindowInfo(pWin, indent, TRUE);
fprintf(stderr, "\n");
nxagentInternalWindowsTree(pChild, indent + 4);
pWin = pWin -> nextSib;
nxagentInternalWindowsTree(pWin -> firstChild, indent + 4);
}
}
......@@ -897,7 +893,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__);
#endif
nxagentClearSelection(&X);
nxagentHandleSelectionClearFromXServer(&X);
break;
}
......@@ -907,7 +903,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__);
#endif
nxagentRequestSelection(&X);
nxagentHandleSelectionRequestFromXServer(&X);
break;
}
......@@ -1146,17 +1142,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
{
if (X.xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
nxagentXkbCapsTrap = True;
}
else if (X.xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
nxagentXkbNumTrap = True;
}
nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0;
nxagentXkbNumTrap = 0;
nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = False;
}
/* 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
Mask mask = CWX | CWY;
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
if (nxagentOption(Fullscreen) == 1 &&
......@@ -2010,11 +2006,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
{
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
UnmapWindow(pWin, False);
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
}
......@@ -2041,11 +2037,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
{
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
MapWindow(pWin, wClient(pWin));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
if (pWin != NULL)
......@@ -2266,17 +2262,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
{
if (X -> xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
nxagentXkbCapsTrap = True;
}
else if (X -> xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
nxagentXkbNumTrap = True;
}
nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0;
nxagentXkbNumTrap = 0;
nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = False;
}
if (nxagentCheckSpecialKeystroke(&X -> xkey, result))
......@@ -2633,7 +2629,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
#ifdef WARNING
if (message_type != MakeAtom("_NET_ACTIVE_WINDOW", strlen("_NET_ACTIVE_WINDOW"), False))
{
fprintf(stderr, "WARNING: Invalid window in ClientMessage xclient.window [0x%lx].\n", X->xclient.window);
fprintf(stderr, "WARNING: Invalid window in ClientMessage xclient.window [0x%lx].\n", X->xclient.window);
}
#endif
......@@ -2872,7 +2868,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
#endif
#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 selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp);
fprintf(stderr, "%s: Event selection window [0x%lx]\n", __func__, xfixesEvent->xfixesselection.window);
......@@ -2904,9 +2900,9 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
* identify that situation during Callback processing we could
* get rid of the Trap...
*/
nxagentExternalClipboardEventTrap = 1;
nxagentExternalClipboardEventTrap = True;
CallCallbacks(&SelectionCallback, &info);
nxagentExternalClipboardEventTrap = 0;
nxagentExternalClipboardEventTrap = False;
}
}
return 1;
......@@ -3203,11 +3199,11 @@ int nxagentHandleConfigureNotify(XEvent* X)
* nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height;
*/
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
nxagentCheckWindowConfiguration((XConfigureEvent*)X);
......
......@@ -73,8 +73,7 @@ Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr);
int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter);
/*
* Enable and disable notification of
* remote X server events.
* Enable and disable notification of remote X server events.
*/
extern void nxagentEnableKeyboardEvents(void);
......@@ -93,33 +92,30 @@ extern void nxagentSetDefaultEventMask(Mask mask);
extern Mask nxagentGetEventMask(WindowPtr pWin);
/*
* Bring keyboard device in known state. It needs
* a round-trip so it only gets called if a pre-
* vious XKB event did not implicitly initialized
* the internal state. This is unlikely to happen.
* Bring keyboard device in known state. It needs a round-trip so it
* only gets called if a previous XKB event did not implicitly
* initialized the internal state. This is unlikely to happen.
*/
extern int nxagentInitXkbKeyboardState(void);
/*
* Update the keyboard state according
* to focus and XKB events received
* from the remote X server.
* Update the keyboard state according to focus and XKB events
* received from the remote X server.
*/
extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X);
/*
* Handle sync and karma messages and
* other notification event coming
* Handle sync and karma messages and other notification event coming
* from proxy.
*/
extern int nxagentHandleProxyEvent(XEvent *X);
/*
* Other functions providing the ad-hoc
* handling of the remote X events.
* Other functions providing the ad-hoc handling of the remote X
* events.
*/
extern int nxagentHandleExposeEvent(XEvent *X);
......@@ -132,16 +128,14 @@ extern int nxagentHandleConfigureNotify(XEvent *X);
extern int nxagentHandleXFixesSelectionNotify(XEvent *X);
/*
* Send a fake keystroke to the remote
* X server.
* Send a fake keystroke to the remote X server.
*/
extern void nxagentSendFakeKey(int key);
/*
* Called to manage grab of pointer and
* keyboard when running in fullscreen
* mode.
* Called to manage grab of pointer and keyboard when running in
* fullscreen mode.
*/
extern void nxagentGrabPointerAndKeyboard(XEvent *X);
......@@ -150,15 +144,7 @@ extern void nxagentUngrabPointerAndKeyboard(XEvent *X);
extern void nxagentDeactivatePointerGrab(void);
/*
* Handle the selection property received
* in the event loop.
*/
void nxagentCollectPropertyEvent(int resource);
/*
* Synchronize expose events between agent and
* the real X server.
* Synchronize expose events between agent and the real X server.
*/
typedef struct _ExposuresRec
......@@ -205,8 +191,8 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr);
extern int nxagentUserInput(void *p);
/*
* We have to check these before launching the terminate
* dialog in rootless mode.
* We have to check these before launching the terminate dialog in
* rootless mode.
*/
extern Bool nxagentLastWindowDestroyed;
......
......@@ -82,4 +82,5 @@ void nxagentVerifyDefaultFontPath(void);
int nxagentSplitString(char *string, char *fields[], int nfields, char *sep);
void nxagentFreeFontData(void);
#endif /* __Font_H__ */
......@@ -1264,7 +1264,7 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen)
int nxagentSaveGCTrap = nxagentGCTrap;
nxagentGCTrap = 0;
nxagentGCTrap = False;
GCPtr pGC = GetScratchGC(depth, pScreen);
......
......@@ -80,7 +80,7 @@ static int nxagentSaveGCTrap;
{ \
nxagentSaveGCTrap = nxagentGCTrap;\
\
nxagentGCTrap = 1; \
nxagentGCTrap = True; \
}
#define RESET_GC_TRAP() \
......@@ -313,7 +313,7 @@ FIXME: The popup could be synchronized with one single put image,
RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion);
nxagentFreeRegion(pSrcRegion);
if (nxagentDrawableStatus(pSrcDrawable) == Synchronized)
{
......@@ -511,7 +511,7 @@ FIXME: The popup could be synchronized with one single put image,
if (pClipRegionFree == True)
{
nxagentFreeRegion(pSrcDrawable, pClipRegion);
nxagentFreeRegion(pClipRegion);
}
FreeScratchGC(targetGC);
......@@ -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.
*/
nxagentFreeRegion(pSrcDrawable, pClipRegion);
nxagentFreeRegion(pClipRegion);
}
nxagentFreeRegion(pSrcDrawable, pCorruptedRegion);
nxagentFreeRegion(pCorruptedRegion);
return 1;
}
......@@ -562,7 +562,7 @@ FIXME: The popup could be synchronized with one single put image,
RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion);
nxagentFreeRegion(pSrcRegion);
}
return 0;
......@@ -800,7 +800,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstRegion);
}
}
......@@ -981,7 +981,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstRegion);
skip = 1;
}
......@@ -1009,12 +1009,12 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstDrawable, pDstRegion);
nxagentFreeRegion(pDstRegion);
}
RegionUninit(&corruptedRegion);
nxagentFreeRegion(pSrcDrawable, pSrcRegion);
nxagentFreeRegion(pSrcRegion);
}
}
#ifdef TEST
......
......@@ -36,7 +36,7 @@
#include "Reconnect.h"
#include "Dialog.h"
#include "Drawable.h"
#include "Splash.h"
#include "Xdmcp.h"
#include "Screen.h"
#include "Millis.h"
......@@ -573,7 +573,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
if (!SmartScheduleSignalEnable)
{
#ifdef DEBUG
fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n");
#endif
......@@ -582,7 +581,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
nxagentDispatch.in = nxagentBytesIn;
nxagentDispatch.out = nxagentBytesOut;
}
/*
......@@ -638,12 +636,10 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
nxagentReady = count;
#ifdef TEST
if (nxagentReady == 0)
{
fprintf(stderr, "nxagentWakeupHandler: No X clients found to be processed.\n");
}
#endif
/*
......@@ -714,17 +710,17 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0)
{
#ifdef TEST
#ifdef TEST
fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n",
nxagentOption(SleepTime));
#endif
#endif
usleep(nxagentOption(SleepTime) * 1000);
}
#ifdef TEST
#ifdef TEST
else if (0 == nxagentOption(SleepTime)) {
fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n");
}
#endif
#endif
if (nxagentReadEvents(nxagentDisplay) > 0 ||
nxagentReadEvents(nxagentShadowDisplay) > 0)
......@@ -1003,7 +999,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
if (!SmartScheduleSignalEnable)
{
/*
* Pay attention to the next client if this client produced
* enough output.
......@@ -1032,9 +1027,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client);
}
#endif
}
return;
}
else if (in > 0)
......@@ -1048,6 +1041,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
in, client -> index);
#endif
#ifdef COUNT_CLIENT_BYTES
/*
* This is presently unused.
*
......@@ -1059,6 +1053,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
* #endif
*
*/
#endif
nxagentBytesIn += in;
......@@ -1077,7 +1072,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
if (!SmartScheduleSignalEnable)
{
if (client -> index != nxagentDispatch.client)
{
#ifdef DEBUG
......@@ -1122,9 +1116,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
}
#endif
}
}
}
/*
......@@ -1168,12 +1160,10 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
*/
#ifdef TEST
if (nxagentTokens.pending == TOKENS_PENDING_LIMIT)
{
fprintf(stderr, "nxagentDispatchHandler: WARNING! Waiting for the synchronization reply.\n");
}
#endif
while (nxagentTokens.pending == TOKENS_PENDING_LIMIT)
......
......@@ -864,7 +864,7 @@ nxagentPutImageEnd:
if (pRegion != NullRegion)
{
nxagentFreeRegion(pDrawable, pRegion);
nxagentFreeRegion(pRegion);
}
}
......@@ -992,7 +992,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
if (clipRegion != NullRegion)
{
nxagentFreeRegion(pDrawable, clipRegion);
nxagentFreeRegion(clipRegion);
}
y += h;
......
......@@ -190,34 +190,35 @@ INCLUDES = \
#endif
#endif
### NXAGENT Defines:
### list of existing NXAGENT macros:
#
# NXAGENT_SHAPE Old shape code
# NXAGENT_SHAPE2 New shape code
# NXAGENT_FIXKEYS Force the release of pressed key when losing focus
# 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_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:
#
# NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
# NXAGENT_RENDER_CLEANUP
# NXAGENT_WAKEUP=<milliseconds>
# NXAGENT_ONSTART
# NXAGENT_SPLASH
# NXAGENT_ARTSD
#
### Debug macros:
#
# DEBUG_COLORMAP
# DEBUG_TREE
# NXAGENT_DEBUG
# DEBUG_TREE Include code that activates the keystroke to print the current window tree
# NXAGENT_FIXKEYS_DEBUG
# NXAGENT_FONTCACHE_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_CURSOR_DEBUG
# NXAGENT_RECONNECT_DEBUG
......@@ -228,7 +229,9 @@ INCLUDES = \
# NXAGENT_RECONNECT_SCREEN_DEBUG
# NXAGENT_RECONNECT_WINDOW_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
NX_DEFINES = \
......
......@@ -54,6 +54,7 @@ is" without express or implied warranty.
#include "mi.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "dixstruct.h"
#include "Agent.h"
#include "Display.h"
......@@ -74,6 +75,7 @@ is" without express or implied warranty.
#include "Error.h"
#include "Keystroke.h"
#include "Atoms.h"
#include "Client.h"
#include <nx/NX.h>
#include "compext/Compext.h"
......@@ -98,15 +100,6 @@ extern int (*ProcVector[256])(ClientPtr);
*/
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.
*/
......@@ -395,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably
nxagentInitKeystrokes(False);
#ifdef NXAGENT_CLIPBOARD
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL);
#endif
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback(&ClientStateCallback, nxagentClientStateCallback, NULL);
nxagentInitAtoms();
}
......@@ -625,19 +622,3 @@ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data,
nxagentGrabServerInfo.client = grab->client;
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.
#include <errno.h>
static void nxagentXkbGetNames(void);
static void nxagentXkbGetRemoteNames(void);
static void nxagentXkbClearRemoteNames(void);
void nxagentKeycodeConversionSetup(void);
......@@ -696,6 +697,9 @@ XkbError:
}
#endif
/* we don't need the remote keyboard information anymore */
nxagentXkbClearRemoteNames();
xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
if (xkb && xkb->geom)
......@@ -1341,7 +1345,7 @@ void nxagentTuneXkbWrapper(void)
}
}
void nxagentXkbClearNames(void)
void nxagentXkbClearRemoteNames(void)
{
SAFE_free(nxagentRemoteRules);
SAFE_free(nxagentRemoteModel);
......@@ -1350,7 +1354,7 @@ void nxagentXkbClearNames(void)
SAFE_free(nxagentRemoteOptions);
}
static void nxagentXkbGetNames(void)
static void nxagentXkbGetRemoteNames(void)
{
if (nxagentRemoteRules)
return;
......@@ -1554,7 +1558,7 @@ void nxagentKeycodeConversionSetup(void)
Bool nxagentGetRemoteXkbExtension(void)
{
nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1;
nxagentXkbClearNames();
nxagentXkbClearRemoteNames();
Bool result = XkbQueryExtension(nxagentDisplay,
&nxagentXkbInfo.Opcode,
......@@ -1565,7 +1569,7 @@ Bool nxagentGetRemoteXkbExtension(void)
if (result)
{
nxagentXkbGetNames();
nxagentXkbGetRemoteNames();
}
#ifdef WARNING
else
......
......@@ -428,35 +428,117 @@ void nxagentInitKeystrokes(Bool force)
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;
for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++)
maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i]));
fprintf(stderr, "Currently known keystrokes:\n");
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) {
unsigned int mask = cur->modifierMask;
fprintf(stderr, " %-*s ", maxlen, nxagentSpecialKeystrokeNames[cur->stroke]);
if (mask & ControlMask) {fprintf(stderr, "Ctrl+"); mask &= ~ControlMask;}
if (mask & ShiftMask) {fprintf(stderr, "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) {fprintf(stderr, "Alt+"); mask &= ~(cur->modifierAltMeta);}
if (mask & nxagentCapsMask) {fprintf(stderr, "CapsLock+"); mask &= ~nxagentCapsMask;}
if (mask & nxagentNumlockMask) {fprintf(stderr, "NumLock+"); mask &= ~nxagentNumlockMask;}
if (mask & Mod1Mask) {fprintf(stderr, "Mod1+"); mask &= ~Mod1Mask;}
if (mask & Mod2Mask) {fprintf(stderr, "Mod2+"); mask &= ~Mod2Mask;}
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));
char * res = strdup(""); /* let the caller free the string */
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++)
{
if (nxagentSpecialKeystrokeNames[cur->stroke] &&
strncmp(nxagentSpecialKeystrokeNames[cur->stroke], name, strlen(name)) == 0)
{
char *tmp;
char *tmp1 = nxagentGetSingleKeystrokeString(cur);
if (-1 == asprintf(&tmp, "%s %-*s : %s\n", res, maxlen,
nxagentSpecialKeystrokeNames[cur->stroke],
tmp1))
{
SAFE_free(tmp1);
#ifdef TEST
fprintf(stderr, "%s: returning incomplete result:\n%s", __func__, res);
#endif
return res;
}
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)
......@@ -465,7 +547,6 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X)
KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0);
#ifdef DEBUG
fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym);
#endif
......@@ -495,10 +576,10 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
#ifdef TEST
if (stroke != KEYSTROKE_NOTHING && stroke != KEYSTROKE_END_MARKER)
fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (%s)\n",
X -> keycode, X -> state, stroke, nxagentSpecialKeystrokeNames[stroke]);
X -> keycode, X -> state, stroke, nxagentSpecialKeystrokeNames[stroke]);
else
fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (unused)\n",
X -> keycode, X -> state, stroke);
X -> keycode, X -> state, stroke);
#endif
if (stroke == KEYSTROKE_NOTHING)
......@@ -566,7 +647,7 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
break;
case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB:
if (X->type == KeyPress) {
nxagentDeactivateInputDevicesGrab();
nxagentDeactivateInputDevicesGrabs();
}
return True;
break;
......@@ -623,13 +704,13 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
break;
case KEYSTROKE_REREAD_KEYSTROKES:
/* two reasons to check on KeyRelease:
- this code is called for KeyPress and KeyRelease, so we
would read the keystroke file twice
- if the keystroke file changes settings for this key this
- this code is called for KeyPress and KeyRelease, so we
would read the keystroke file twice
- if the keystroke file changes settings for this key this
might lead to unexpected behaviour
*/
if (X->type == KeyRelease)
nxagentInitKeystrokes(True);
nxagentInitKeystrokes(True);
break;
case KEYSTROKE_AUTOGRAB:
*result = doAutoGrab;
......
......@@ -32,6 +32,9 @@ extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*);
extern void nxagentDumpKeystrokes(void);
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
* that KEYSTROKE_MAX may be used in a malloc */
......
......@@ -23,6 +23,7 @@
/* */
/**************************************************************************/
#ifdef TEST
/*
* Simple table used to translate a request
* opcode to the name of the X request.
......@@ -210,4 +211,4 @@ static char *nxagentShmRequestLiteral[] =
"ShmGetImage",
"ShmCreatePixmap"
};
#endif /* TEST */
......@@ -117,6 +117,7 @@ Equipment Corporation.
#include "Atoms.h"
#include "Splash.h"
#include "Xdmcp.h"
#include "Client.h"
#include "Clipboard.h"
#include "Reconnect.h"
......@@ -161,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int);
#include "unistd.h"
#endif
#ifdef TEST
#include "Literals.h"
#endif
#ifdef VIEWPORT_FRAME
......@@ -330,7 +329,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
clientReady[0] = 0;
if (nxagentSplashWindow != None || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0))
if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0))
{
#ifdef TEST
fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n",
......@@ -346,7 +345,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
(nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1))
{
#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());
#else
fprintf(stderr, "Session: Session started at '%s'.\n",
......@@ -418,7 +417,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
isItTimeToYield = FALSE;
#ifdef NXAGENT_SERVER
nxagentRequestingClient = client;
nxagentRequestingClient = client;
#endif
start_tick = SmartScheduleTime;
while (!isItTimeToYield)
......@@ -580,6 +579,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
NXShadowDestroy();
}
saveAgentState("TERMINATED");
nxagentFreeAtomMap();
nxagentFreeFontData();
#endif /* NXAGENT_SERVER */
KillAllClients();
......@@ -744,7 +746,7 @@ ProcConvertSelection(register ClientPtr client)
#ifdef NXAGENT_SERVER
(CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient)
#else
(CurrentSelections[i].window != None))
(CurrentSelections[i].window != None)
#endif
#ifdef XCSECURITY
&& (!client->CheckAccess ||
......@@ -799,12 +801,12 @@ ProcOpenFont(register ClientPtr client)
#ifdef NXAGENT_SERVER
char fontReq[256];
memcpy(fontReq,(char *)&stuff[1],(stuff->nbytes<256)?stuff->nbytes:255);
fontReq[stuff->nbytes]=0;
if (strchr(fontReq,'*') || strchr(fontReq,'?'))
memcpy(fontReq,(char *)&stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
fontReq[stuff->nbytes] = '\0';
if (strchr(fontReq, '*') || strchr(fontReq, '?'))
{
#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
nxagentListRemoteFonts(fontReq, nxagentMaxFontNames);
err = nxOpenFont(client, stuff->fid, (Mask) 0,
......@@ -836,10 +838,9 @@ ProcCloseFont(register ClientPtr client)
#ifdef NXAGENT_SERVER
/*
* When a client closes a font the resource
* should not be lost if the reference counter
* is not 0, otherwise the server will not be
* able to find this font looping through the
* When a client closes a font the resource should not be lost
* if the reference counter is not 0, otherwise the server
* will not be able to find this font looping through the
* resources.
*/
......@@ -848,7 +849,7 @@ ProcCloseFont(register ClientPtr client)
if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0)
{
#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);
#endif
......@@ -860,8 +861,8 @@ ProcCloseFont(register ClientPtr client)
#ifdef TEST
else
{
fprintf(stderr, "ProcCloseFont: Found duplicated font at [%p], "
"resource switching skipped.\n", (void *) pFont);
fprintf(stderr, "%s: Found duplicated font at [%p], "
"resource switching skipped.\n", __func__, (void *) pFont);
}
#endif
}
......@@ -888,11 +889,11 @@ ProcListFonts(register ClientPtr client)
#ifdef NXAGENT_SERVER
char tmp[256];
memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255);
tmp[stuff->nbytes]=0;
memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
tmp[stuff->nbytes] = '\0';
#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
nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames);
#endif
......@@ -910,12 +911,12 @@ ProcListFontsWithInfo(register ClientPtr client)
#ifdef NXAGENT_SERVER
char tmp[256];
memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255);
tmp[stuff->nbytes]=0;
memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255);
tmp[stuff->nbytes] = '\0';
#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
nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames :stuff->maxNames);
nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames);
#endif
return StartListFontsWithInfo(client, stuff->nbytes,
......@@ -937,11 +938,10 @@ ProcFreePixmap(register ClientPtr client)
#ifdef NXAGENT_SERVER
/*
* When a client releases a pixmap the resource
* should not be lost if the reference counter
* is not 0, otherwise the server will not be
* able to find this pixmap looping through the
* resources.
* When a client releases a pixmap the resource should not be
* lost if the reference counter is not 0, otherwise the
* server will not be able to find this pixmap looping through
* the resources.
*/
if (pMap -> refcnt > 0)
......@@ -960,8 +960,8 @@ ProcFreePixmap(register ClientPtr client)
#ifdef TEST
else
{
fprintf(stderr, "ProcFreePixmap: Found duplicated pixmap at [%p], "
"resource switching skipped.\n", (void *) pMap);
fprintf(stderr, "%s: Found duplicated pixmap at [%p], "
"resource switching skipped.\n", __func__, (void *) pMap);
}
#endif
}
......@@ -990,49 +990,12 @@ CloseDownClient(register ClientPtr client)
{
#ifdef NXAGENT_SERVER
/*
* There must be a better way to hook a
* call-back function to be called any
* 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.
* Need to reset the karma counter and get rid of the pending sync
* replies.
*/
nxagentWakeupByReset(client);
/*
* Check if the client
* is a shadow nxagent.
*/
nxagentCheckIfShadowAgent(client);
#endif
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.
#include "Events.h"
#include "Windows.h"
#include "Args.h"
#include "Clipboard.h"
extern Display *nxagentDisplay;
......@@ -153,11 +154,6 @@ extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr);
#endif
extern int nxagentShadowInit(ScreenPtr, WindowPtr);
#ifdef NXAGENT_CLIPBOARD
extern int nxagentSendNotify(xEvent*);
#endif
void
ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
TimeStamp time, Bool autoGrab)
......
......@@ -64,7 +64,7 @@ static int __glXDispatch(ClientPtr client)
* dispatching a GLX operation.
*/
nxagentGlxTrap = 1;
nxagentGlxTrap = True;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
......@@ -73,7 +73,7 @@ static int __glXDispatch(ClientPtr client)
retval = xorg__glXDispatch(client);
nxagentGlxTrap = 0;
nxagentGlxTrap = False;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
......
......@@ -76,6 +76,7 @@ SOFTWARE.
#include "Rootless.h"
#include "Client.h"
#include "Windows.h"
#include "Clipboard.h"
extern Atom clientCutProperty;
......@@ -93,14 +94,14 @@ nxagentWMStateRec;
#undef TEST
#undef DEBUG
#ifdef NXAGENT_CLIPBOARD
extern WindowPtr nxagentGetClipboardWindow(Atom);
#endif
#ifdef NXAGENT_ARTSD
extern Atom mcop_local_atom;
#endif
#ifdef NX_DEBUG_INPUT
extern void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data);
#endif
int
ProcChangeProperty(ClientPtr client)
{
......@@ -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)
#ifdef NXAGENT_CLIPBOARD
/* 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
dix */
int
......@@ -502,7 +503,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
pProp = pProp->next;
}
if (!pProp)
{
#ifdef DEBUG
......
......@@ -65,9 +65,7 @@
#undef TEST
#undef DEBUG
#ifdef TEST
#include "Literals.h"
#endif
/*
* From NXglyph.c.
......@@ -1768,11 +1766,11 @@ ProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c.
*/
nxagentGCTrap = 1;
nxagentGCTrap = True;
int result = xorg_ProcRenderDispatch(client);
nxagentGCTrap = 0;
nxagentGCTrap = False;
return result;
}
......@@ -1795,11 +1793,11 @@ SProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c.
*/
nxagentGCTrap = 1;
nxagentGCTrap = True;
int result = xorg_SProcRenderDispatch(client);
nxagentGCTrap = 0;
nxagentGCTrap = False;
return result;
}
......@@ -142,16 +142,11 @@ static int nxagentResChangedFlag = 0;
#ifdef NXAGENT_SERVER
int nxagentFindClientResource(int client, RESTYPE type, void * value)
{
ResourcePtr pResource;
ResourcePtr *resources;
int i;
for (i = 0; i < clientTable[client].buckets; i++)
for (int 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)
{
......@@ -171,13 +166,8 @@ int nxagentFindClientResource(int client, RESTYPE type, void * value)
int nxagentSwitchResourceType(int client, RESTYPE type, void * value)
{
ResourcePtr pResource;
ResourcePtr *resources;
RESTYPE internalType = 0;
int i;
if (type == RT_PIXMAP)
{
internalType = RT_NX_PIXMAP;
......@@ -205,11 +195,11 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value)
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 &&
pResource -> value == value)
......@@ -248,14 +238,12 @@ AddResource(XID id, RESTYPE type, void * value)
}
#ifdef NXAGENT_SERVER
nxagentSwitchResourceType(client, type, value);
#ifdef TEST
fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n",
client, (unsigned long) type, (void *) value, (unsigned long) id);
#endif
#endif
if ((rrec->elements >= 4*rrec->buckets) &&
......@@ -274,9 +262,9 @@ AddResource(XID id, RESTYPE type, void * value)
res->value = value;
*head = res;
rrec->elements++;
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1;
#endif
#endif
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1;
return TRUE;
......@@ -289,15 +277,13 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
register ResourcePtr res;
register ResourcePtr *prev, *head;
register int *eltptr;
int elements;
int elements = 0;
Bool gotOne = FALSE;
#ifdef NXAGENT_SERVER
#ifdef TEST
fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id);
#endif
#endif
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
......@@ -313,9 +299,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
RESTYPE rtype = res->type;
*prev = res->next;
elements = --*eltptr;
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1;
#endif
#endif
if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
free(res);
......@@ -349,9 +335,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
if (res->id == id && res->type == type)
{
*prev = res->next;
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1;
#endif
#endif
if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id);
free(res);
......@@ -381,28 +367,21 @@ FindClientResourcesByType(
int i, elements;
register int *eltptr;
#ifdef NXAGENT_SERVER
register ResourcePtr **resptr;
#endif
if (!client)
client = serverClient;
#ifdef NXAGENT_SERVER
/*
* If func triggers a resource table
* rebuild then restart the loop.
*/
register ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop:
resptr = &clientTable[client->index].resources;
#endif
resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++)
{
......@@ -412,17 +391,16 @@ RestartLoop:
if (!type || this->type == type) {
elements = *eltptr;
#ifdef NXAGENT_SERVER
/*
* FIXME:
* It is not safe to let a function change the resource
* table we are reading!
*/
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 0;
#endif
#endif
(*func)(this->value, this->id, cdata);
#ifdef NXAGENT_SERVER
/*
* Avoid that a call to RebuildTable() could invalidate the
* pointer. This is safe enough, because in RebuildTable()
......@@ -430,10 +408,8 @@ RestartLoop:
* freed, so it can't point to the same address.
*/
#ifdef NXAGENT_SERVER
if (*resptr != resources)
goto RestartLoop;
#endif
/*
* It's not enough to check if the number of elements has
......@@ -444,11 +420,10 @@ RestartLoop:
* added or freed.
*/
#ifdef NXAGENT_SERVER
if (*eltptr != elements || nxagentResChangedFlag)
#else
#else
if (*eltptr != elements)
#endif
#endif
next = resources[i]; /* start over */
}
}
......@@ -466,28 +441,21 @@ FindAllClientResources(
int i, elements;
register int *eltptr;
#ifdef NXAGENT_SERVER
register ResourcePtr **resptr;
#endif
if (!client)
client = serverClient;
#ifdef NXAGENT_SERVER
/*
* If func triggers a resource table
* rebuild then restart the loop.
*/
register ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop:
resptr = &clientTable[client->index].resources;
#endif
resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++)
{
......@@ -496,17 +464,18 @@ RestartLoop:
next = this->next;
elements = *eltptr;
#ifdef NXAGENT_SERVER
/*
* FIXME:
* It is not safe to let a function change the resource
* table we are reading!
*/
#ifdef NXAGENT_SERVER
nxagentResChangedFlag = 0;
#endif
#endif
(*func)(this->value, this->id, this->type, cdata);
#ifdef NXAGENT_SERVER
/*
* Avoid that a call to RebuildTable() could invalidate the
* pointer. This is safe enough, because in RebuildTable()
......@@ -514,10 +483,8 @@ RestartLoop:
* freed, so it can't point to the same address.
*/
#ifdef NXAGENT_SERVER
if (*resptr != resources)
goto RestartLoop;
#endif
/*
* It's not enough to check if the number of elements has
......@@ -528,11 +495,10 @@ RestartLoop:
* added or freed.
*/
#ifdef NXAGENT_SERVER
if (*eltptr != elements || nxagentResChangedFlag)
#else
#else
if (*eltptr != elements)
#endif
#endif
next = resources[i]; /* start over */
}
}
......@@ -550,44 +516,36 @@ LookupClientResourceComplex(
ResourcePtr this;
int i;
#ifdef NXAGENT_SERVER
ResourcePtr **resptr;
Bool res;
#endif
if (!client)
client = serverClient;
#ifdef NXAGENT_SERVER
/*
* If func triggers a resource table
* rebuild then restart the loop.
*/
ResourcePtr **resptr;
#ifdef NXAGENT_SERVER
RestartLoop:
resptr = &clientTable[client->index].resources;
#endif
resources = clientTable[client->index].resources;
#ifdef NXAGENT_SERVER
resptr = &clientTable[client->index].resources;
#endif
for (i = 0; i < clientTable[client->index].buckets; i++) {
for (this = resources[i]; this; this = this->next) {
if (!type || this->type == type) {
#ifdef NXAGENT_SERVER
res = (*func)(this->value, this->id, cdata);
#ifdef NXAGENT_SERVER
Bool res = (*func)(this->value, this->id, cdata);
if (*resptr != resources)
goto RestartLoop;
if (res)
return this->value;
#else
#else
if((*func)(this->value, this->id, cdata))
return this->value;
#endif
#endif
}
}
}
......
......@@ -70,9 +70,7 @@ in this Software without prior written authorization from The Open Group.
#undef TEST
#undef DEBUG
#ifdef TEST
#include "Literals.h"
#endif
extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h,
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)
{
/* 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);
nxagentShmTrap = 1;
nxagentShmTrap = True;
return;
}
......@@ -192,9 +190,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
char *data;
{
#ifdef NXAGENT_SERVER
int length;
char *newdata;
#ifdef TEST
fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n",
(void *) dst, (void *) pGC, (void *) data);
......@@ -229,9 +224,9 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
sx, sy, sw, sh, dx);
#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);
(*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
......@@ -394,7 +389,7 @@ ProcShmPutImage(client)
return (client->noClientException);
}
/* derived from Xext/shm.c */
static PixmapPtr
nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr)
ScreenPtr pScreen;
......@@ -405,29 +400,22 @@ nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr)
{
register PixmapPtr pPixmap;
#ifdef NXAGENT_SERVER
pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0);
#else
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
#endif
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,
BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr))
{
#if defined(NXAGENT_SERVER) && defined(WARNING)
fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n");
#endif
(*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap;
(*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap;
}
return pPixmap;
}
......@@ -439,39 +427,44 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
int depth;
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 = True;
nxagentShmPixmapTrap = 1;
PixmapPtr result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr);
result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr);
nxagentShmPixmapTrap = False;
nxagentShmPixmapTrap = 0;
#ifdef WARNING
if (result == NullPixmap)
{
fprintf(stderr, "%s: Return Null Pixmap.\n", __func__);
}
#endif
return result;
}
/* A wrapper that handles the trap. This construct is used
to keep the derived code closer to the original
*/
static int
ProcShmDispatch (register ClientPtr client)
{
int result;
#ifdef TEST
REQUEST(xReq);
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);
}
#endif
nxagentShmTrap = 1;
nxagentShmTrap = True;
result = xorg_ProcShmDispatch(client);
int result = xorg_ProcShmDispatch(client);
nxagentShmTrap = 0;
nxagentShmTrap = False;
return result;
}
......@@ -479,22 +472,20 @@ ProcShmDispatch (register ClientPtr client)
static int
SProcShmDispatch (register ClientPtr client)
{
int result;
#ifdef TEST
REQUEST(xReq);
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);
}
#endif
nxagentShmTrap = 1;
nxagentShmTrap = True;
result = xorg_SProcShmDispatch(client);
int result = xorg_SProcShmDispatch(client);
nxagentShmTrap = 0;
nxagentShmTrap = False;
return result;
}
......@@ -79,11 +79,11 @@ ProcXvDispatch(ClientPtr client)
stuff->data, client -> index);
#endif
nxagentXvTrap = 1;
nxagentXvTrap = True;
result = xorg_ProcXvDispatch(client);
nxagentXvTrap = 0;
nxagentXvTrap = False;
#ifdef TEST
fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
......@@ -108,11 +108,11 @@ SProcXvDispatch(ClientPtr client)
stuff->data, client -> index);
#endif
nxagentXvTrap = 1;
nxagentXvTrap = True;
result = xorg_SProcXvDispatch(client);
nxagentXvTrap = 0;
nxagentXvTrap = False;
#ifdef TEST
fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
......
......@@ -71,9 +71,6 @@ RESTYPE RT_NX_PIXMAP;
int nxagentPixmapPrivateIndex;
int nxagentCorruptedPixmaps;
int nxagentCorruptedBackgrounds;
/*
* Force deallocation of the virtual pixmap.
*/
......@@ -157,7 +154,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* synchronized with the remote X Server.
*/
if (pPixmapPriv -> isShared == 1)
if (pPixmapPriv -> isShared)
{
BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height };
......@@ -773,11 +770,11 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
return;
}
nxagentSplitTrap = 1;
nxagentSplitTrap = True;
*pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL);
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
if (!*pBool)
{
......@@ -1095,13 +1092,13 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
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);
......@@ -1124,9 +1121,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
nxagentGCTrap = saveTrap;
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
nxagentFBTrap = 0;
nxagentFBTrap = False;
nxagentFreeScratchGC(pGC);
}
......
......@@ -146,13 +146,12 @@ void setStatePath(char* path)
void saveAgentState(char* state)
{
FILE* fptr;
if(strlen(stateFile))
if (strlen(stateFile))
{
fptr=fopen(stateFile, "w");
if(!fptr)
FILE* fptr = fopen(stateFile, "w");
if (!fptr)
return;
fprintf(fptr,"%s", state);
fprintf(fptr, "%s", state);
fclose(fptr);
}
}
......@@ -237,8 +236,7 @@ int nxagentHandleConnectionStates(void)
fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error in the exception flags.\n");
#endif
/*
TODO: This should be reset only when
the state became SESSION_DOWN.
TODO: This should be reset only when the state became SESSION_DOWN.
*/
nxagentException.ioError = 0;
......@@ -301,7 +299,7 @@ TODO: This should be reset only when
if ((dispatchException & DE_TERMINATE) == 0)
{
#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
fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString());
#endif
......@@ -340,7 +338,7 @@ void nxagentInitializeRecLossyLevel(void)
void nxagentInitReconnector(void)
{
nxagentReconnectTrap = 0;
nxagentReconnectTrap = False;
reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int));
reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int));
......@@ -365,8 +363,7 @@ void nxagentDisconnectSession(void)
nxagentFreeTimeoutTimer();
/*
* Force an I/O error on the display
* and wait until the NX transport
* Force an I/O error on the display and wait until the NX transport
* is gone.
*/
......@@ -427,16 +424,15 @@ Bool nxagentReconnectSession(void)
nxagentChangeOption(DeviceControl, nxagentOption(DeviceControlUserDefined));
/*
* We need to zero out every new XID
* created by the disconnected display.
* We need to zero out every new XID created by the disconnected
* display.
*/
nxagentDisconnectSession();
/*
* Set this in order to let the screen
* function to behave differently at
* reconnection time.
* Set this in order to let the screen function to behave
* differently at reconnection time.
*/
nxagentReconnectTrap = True;
......@@ -464,19 +460,17 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectDisplay(reconnectLossyLevel[DISPLAY_STEP]) == 0)
{
failedStep = DISPLAY_STEP;
#ifdef TEST
fprintf(stderr, "nxagentReconnectSession: WARNING! Failed display reconnection.\n");
#endif
failedStep = DISPLAY_STEP;
goto nxagentReconnectError;
}
if (nxagentReconnectScreen(reconnectLossyLevel[SCREEN_STEP]) == 0)
{
failedStep = SCREEN_STEP;
goto nxagentReconnectError;
}
......@@ -489,7 +483,6 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0)
{
failedStep = FONT_STEP;
goto nxagentReconnectError;
}
else
......@@ -504,16 +497,15 @@ Bool nxagentReconnectSession(void)
}
/*
* Map the main window and send a
* SetSelectionOwner request to
* Map the main window and send a SetSelectionOwner request to
* notify of the agent start.
*/
nxagentMapDefaultWindows();
/*
* Ensure that the SetSelectionOwner
* request is sent through the link.
* Ensure that the SetSelectionOwner request is sent through the
* link.
*/
XFlush(nxagentDisplay);
......@@ -533,21 +525,18 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllGCs(reconnectLossyLevel[GC_STEP]) == 0)
{
failedStep = GC_STEP;
goto nxagentReconnectError;
}
if (nxagentReconnectAllColormap(reconnectLossyLevel[COLORMAP_STEP]) == 0)
{
failedStep = COLORMAP_STEP;
goto nxagentReconnectError;
}
if (nxagentReconnectAllWindows(reconnectLossyLevel[WINDOW_STEP]) == 0)
{
failedStep = WINDOW_STEP;
goto nxagentReconnectError;
}
......@@ -556,21 +545,18 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllGlyphSet(reconnectLossyLevel[GLYPHSET_STEP]) == 0)
{
failedStep = GLYPHSET_STEP;
goto nxagentReconnectError;
}
if (nxagentReconnectAllPictFormat(reconnectLossyLevel[PICTFORMAT_STEP]) == 0)
{
failedStep = PICTFORMAT_STEP;
goto nxagentReconnectError;
}
if (nxagentReconnectAllPicture(reconnectLossyLevel[PICTURE_STEP]) == 0)
{
failedStep = PICTURE_STEP;
goto nxagentReconnectError;
}
}
......@@ -578,14 +564,12 @@ Bool nxagentReconnectSession(void)
if (nxagentReconnectAllCursor(reconnectLossyLevel[CURSOR_STEP]) == 0)
{
failedStep = CURSOR_STEP;
goto nxagentReconnectError;
}
if (nxagentSetWindowCursors(reconnectLossyLevel[WINDOW_STEP]) == 0)
{
failedStep = WINDOW_STEP;
goto nxagentReconnectError;
}
......@@ -621,7 +605,6 @@ Bool nxagentReconnectSession(void)
#endif
failedStep = WINDOW_STEP;
goto nxagentReconnectError;
}
}
......@@ -674,7 +657,7 @@ Bool nxagentReconnectSession(void)
nxagentInitKeystrokes(True);
#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
fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString());
#endif
......@@ -683,10 +666,9 @@ Bool nxagentReconnectSession(void)
nxagentRemoveSplashWindow();
/*
* We let the proxy flush the link on our behalf
* after having opened the display. We are now
* entering again the dispatcher so can flush
* the link explicitly.
* We let the proxy flush the link on our behalf after having opened
* the display. We are now entering again the dispatcher so can
* flush the link explicitly.
*/
#ifdef TEST
......@@ -799,9 +781,8 @@ void nxagentSetReconnectError(int id, char *format, ...)
else
{
/*
* The vsnprintf() in glibc 2.0.6 would return
* -1 when the output was truncated. See section
* NOTES on printf(3).
* The vsnprintf() in glibc 2.0.6 would return -1 when the
* output was truncated. See section NOTES on printf(3).
*/
size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE);
......@@ -863,4 +844,3 @@ void nxagentHandleConnectionChanges(void)
}
}
}
......@@ -186,6 +186,7 @@ Bool nxagentDisconnectAllPicture(void);
#define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3))
/* Clean the padding bytes of data section of request.*/
void
nxagentCleanGlyphs(xGlyphInfo *gi,
int nglyphs,
......@@ -360,19 +361,15 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
if (bytesToClean > 0)
{
while (height > 0)
for (; height > 0; height--)
{
int count = bytesToClean;
while (count > 0)
for (int i = bytesToClean; i > 0; i--)
{
*(images + (bytesPerLine - count)) = 0;
*(images + (bytesPerLine - i)) = 0;
#ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n");
#endif
count--;
}
#ifdef DUMP
......@@ -385,8 +382,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#endif
images += bytesPerLine;
height--;
}
}
......@@ -537,11 +532,11 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
* if the cursor was already encoded with the best quality.
*/
nxagentLosslessTrap = 1;
nxagentLosslessTrap = True;
nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
nxagentLosslessTrap = 0;
nxagentLosslessTrap = False;
nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y);
}
......@@ -1157,7 +1152,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDstRegion);
return;
}
......@@ -1326,12 +1321,12 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
(void *) pDst -> pDrawable);
#endif
nxagentFreeRegion(pDst -> pDrawable, pRegion);
nxagentFreeRegion(pRegion);
return;
}
nxagentFreeRegion(pDst -> pDrawable, pRegion);
nxagentFreeRegion(pRegion);
}
/*
......@@ -1817,7 +1812,7 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDst -> pDrawable, pDstRegion);
nxagentFreeRegion(pDstRegion);
if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP)
{
......
......@@ -39,6 +39,7 @@
#include "Atoms.h"
#include "Trap.h"
#include "Utils.h"
#include "Atoms.h"
#include "compext/Compext.h"
......@@ -151,10 +152,9 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
if (topLevelParentMap.next == topLevelParentMap.size)
{
TopLevelParentRec *ptr = topLevelParentMap.elt;
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)
{
......@@ -332,18 +332,18 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
WindowPtr pWin = screenInfo.screens[0]->root -> firstChild;
XID values[2] = {0, (XID) Above};
for (int i = ntoplevel; i-- && pWin; pWin = toplevel[i] -> nextSib)
{
XID values[2] = {0, (XID) Above};
if (toplevel[i] != pWin)
{
Mask mask = CWSibling | CWStackMode;
values[0] = pWin -> drawable.id;
ClientPtr pClient = wClient(toplevel[i]);
nxagentScreenTrap = 1;
ConfigureWindow(toplevel[i], mask, (XID *) values, pClient);
nxagentScreenTrap = 0;
nxagentScreenTrap = True;
ConfigureWindow(toplevel[i], mask, values, pClient);
nxagentScreenTrap = False;
#ifdef TEST
fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]);
......@@ -418,6 +418,11 @@ int nxagentExportAllProperty(WindowPtr pWin)
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,
Atom property,
Atom type,
......@@ -720,7 +725,7 @@ int nxagentExportProperty(WindowPtr pWin,
else
{
#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);
#endif
......@@ -793,6 +798,11 @@ int nxagentExportProperty(WindowPtr pWin,
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,
XlibAtom property,
XlibAtom type,
......@@ -817,7 +827,7 @@ void nxagentImportProperty(Window window,
if (pWin == NULL)
{
#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);
#endif
......@@ -829,29 +839,34 @@ void nxagentImportProperty(Window window,
if (!ValidAtom(propertyL))
{
#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
return;
}
#ifdef TEST
fprintf(stderr, "%s: Window [0x%x] property [%d]: [%s]\n", __func__,
window, property, validateString(NameForAtom(propertyL)));
fprintf(stderr, "%s: Window [0x%x] property: remote [%ld][%s] local [%d]\n", __func__,
window, property, validateString(NameForAtom(propertyL)), propertyL);
#endif
/*
* We settle a property size limit of 256K beyond which we simply
* ignore them.
* FIXME: where's this checked/set/enforced/whatever?
*/
Atom typeL = nxagentRemoteToLocalAtom(type);
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))
{
#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);
#endif
}
......@@ -864,7 +879,7 @@ void nxagentImportProperty(Window window,
else if (!ValidAtom(typeL))
{
#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);
#endif
}
......@@ -876,6 +891,41 @@ void nxagentImportProperty(Window window,
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 ||
strcmp(typeS, "UTF8_STRING") == 0 ||
strcmp(typeS, "CARDINAL") == 0 ||
......@@ -1069,7 +1119,7 @@ void nxagentImportProperty(Window window,
if (import)
{
#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__,
window, property, typeS, nitems, format);
#endif
......@@ -1080,7 +1130,7 @@ void nxagentImportProperty(Window window,
else
{
#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__,
window, property, validateString(typeS), nitems, format);
#endif
......@@ -1126,7 +1176,7 @@ void nxagentRemovePropertyFromList(void)
struct nxagentPropertyRec *tmp = nxagentPropertyList.first;
#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.size);
#endif
......@@ -1162,7 +1212,7 @@ void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin)
}
#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,
nxagentPropertyList.size);
#endif
......@@ -1208,7 +1258,7 @@ Bool nxagentNotifyMatchChangeProperty(void *p)
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);
}
else
......
......@@ -151,12 +151,9 @@ int nxagentArgc = 0;
char **nxagentArgv = NULL;
#ifdef NXAGENT_ARTSD
char mcop_atom[] = "MCOPGLOBALS";
Atom mcop_local_atom = None;
unsigned char fromHexNibble(char c);
void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
#endif
Window nxagentIconWindow = None;
......@@ -3289,11 +3286,11 @@ FIXME: The port information is not used at the moment and produces a
{
local_buf[in] = pszReturnData[i];
if(pszReturnData[i] == ':')
if (pszReturnData[i] == ':')
{
i++;
while(pszReturnData[i] != '\n')
while (pszReturnData[i] != '\n')
{
unsigned char h = fromHexNibble(pszReturnData[i]);
i++;
......@@ -3302,7 +3299,8 @@ FIXME: The port information is not used at the moment and produces a
unsigned char l = fromHexNibble(pszReturnData[i]);
i++;
if(h >= 16 || l >= 16) continue;
if (h >= 16 || l >= 16)
continue;
/*
* 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
/*
FIXME: The port information is not used at the moment and produces a
warning on recent gcc versions. Do we need such information
to run the audio forawrding?
to run the audio forwarding?
chport = &port[0];
......@@ -3349,7 +3347,7 @@ FIXME: The port information is not used at the moment and produces a
strcat(local_buf,"00");
in += 2;
while(pszReturnData[i] != '\n')
while (pszReturnData[i] != '\n')
{
i++;
}
......@@ -3920,7 +3918,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
output = pScrPriv->outputs[i];
}
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name);
fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", output->name);
#endif
RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1);
/* FIXME: Isn't there a function for setting this? */
......@@ -4011,9 +4009,9 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
distinguish between pre-existing modes which should stay
and our own modes that should be removed after use. */
char name[100];
sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h);
sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h);
const int refresh = 60;
const int refresh = 60;
xRRModeInfo modeInfo = {
.width = new_w,
......@@ -4022,7 +4020,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
.vTotal = new_h,
.dotClock = ((CARD32) new_w * (CARD32) new_h * (CARD32) refresh),
.nameLength = strlen(name)
};
};
RRModePtr mymode = RRModeGet(&modeInfo, name);
......@@ -4081,7 +4079,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free(screeninfo);
#ifdef DEBUG
for (i = 0; i < pScrPriv->numCrtcs; i++)
for (int i = 0; i < pScrPriv->numCrtcs; i++)
{
RRModePtr mode = pScrPriv->crtcs[i]->mode;
if (mode) {
......@@ -4093,7 +4091,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
}
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);
}
#endif
......
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