Commit 9e337102 authored by Reinhard Tartler's avatar Reinhard Tartler

Imported nxagent-3.1.0-2.tar.gz

Summary: Imported nxagent-3.1.0-2.tar.gz Keywords: Imported nxagent-3.1.0-2.tar.gz into Git repository
parent edddbe87
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright (c) 1995 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.
*/
#ifndef __Agent_H__
#define __Agent_H__
/*
* Machines with a 64 bit library interface and a 32 bit
* server require name changes to protect the guilty.
*/
#ifdef _XSERVER64
#define _XSERVER64_tmp
#undef _XSERVER64
typedef unsigned long XID64;
typedef unsigned long Mask64;
typedef unsigned long Atom64;
typedef unsigned long VisualID64;
typedef unsigned long Time64;
#define XID XID64
#define Mask Mask64
#define Atom Atom64
#define VisualID VisualID64
#define Time Time64
typedef XID Window64;
typedef XID Drawable64;
typedef XID Font64;
typedef XID Pixmap64;
typedef XID Cursor64;
typedef XID Colormap64;
typedef XID GContext64;
typedef XID KeySym64;
#define Window Window64
#define Drawable Drawable64
#define Font Font64
#define Pixmap Pixmap64
#define Cursor Cursor64
#define Colormap Colormap64
#define GContext GContext64
#define KeySym KeySym64
#define XlibAtom Atom64
#define XlibWindow Window64
#define XlibPixmap Pixmap64
#define XlibFont Font64
#define XlibKeySym KeySym64
#define XlibXID XID64
#else /*_XSERVER64*/
#define XlibAtom Atom
#define XlibWindow Window
#define XlibPixmap Pixmap
#define XlibFont Font
#define XlibKeySym KeySym
#define XlibXID XID
#endif /*_XSERVER64*/
#define NX_TRANS_SOCKET
#define GC XlibGC
#include "Xlib.h"
#include "X11/extensions/shape.h"
#undef GC
#ifdef _XSERVER64_tmp
#define _XSERVER64
#undef _XSERVER64_tmp
#undef XID
#undef Mask
#undef Atom
#undef VisualID
#undef Time
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef KeySym
#endif /*_XSERVER64_tmp*/
#define validateString(string) ((string) ? (string) : "(null)")
#endif /* __Agent_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Args_H__
#define __Args_H__
#define MD5_LENGTH 16
struct UserGeometry{
int flag;
int X;
int Y;
unsigned int Width;
unsigned int Height;
};
extern Bool nxagentUseNXTrans;
extern char nxagentSessionId[];
extern char nxagentDisplayName[];
extern char nxagentShadowDisplayName[];
extern char nxagentWindowName[];
extern char nxagentDialogName[];
extern Bool nxagentFullGeneration;
extern int nxagentDefaultClass;
extern Bool nxagentUserDefaultClass;
extern int nxagentDefaultDepth;
extern Bool nxagentUserDefaultDepth;
extern int nxagentX;
extern int nxagentY;
extern unsigned int nxagentWidth;
extern unsigned int nxagentHeight;
extern struct UserGeometry nxagentUserGeometry;
extern Bool nxagentUserBorderWidth;
extern int nxagentNumScreens;
extern Bool nxagentDoDirectColormaps;
extern Window nxagentParentWindow;
extern int nxagentMaxAllowedReset;
extern Bool nxagentResizeDesktopAtStartup;
extern Bool nxagentIpaq;
extern int nxagentLockDeferLevel;
Bool nxagentPostProcessArgs(char *name, Display *dpy, Screen *scr);
void nxagentProcessOptionsFile(void);
void nxagentSetPackMethod(void);
void nxagentSetDeferLevel(void);
void nxagentSetBufferSize(void);
void nxagentSetScheduler(void);
void nxagentSetCoalescence(void);
extern int nxagentUserDefinedFontPath;
#endif /* __Args_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Atoms_H__
#define __Atoms_H__
#include "X.h"
#include "../../include/window.h"
#include "screenint.h"
#define NXAGENT_NUMBER_OF_ATOMS 13
extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
extern Bool nxagentWMIsRunning;
/*
* Create the required atoms internally
* to the agent server.
*/
int nxagentInitAtoms(WindowPtr pWin);
/*
* Query and create all the required atoms
* on the remote X server using a single
* round trip.
*/
int nxagentQueryAtoms(ScreenPtr pScreen);
/*
* Create the atoms on the remote X server
* and cache the couple local-remote atoms.
*/
Atom nxagentMakeAtom(char *, unsigned, Bool);
/*
* Converts local atoms in remote atoms and
* viceversa.
*/
Atom nxagentRemoteToLocalAtom(Atom);
Atom nxagentLocalToRemoteAtom(Atom);
void nxagentResetAtomMap(void);
void nxagentWMDetect(void);
#endif /* __Atoms_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "NX.h"
#include "Binder.h"
#include "Options.h"
/*
* Set here the required log level.
*/
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
int nxagentCheckBinder(int argc, char *argv[], int i)
{
if (++i < argc)
{
char *display;
char *found;
int port;
display = argv[i];
/*
* Check if a display specification follows
* the -B switch.
*/
found = rindex(display, ':');
if (found == NULL || *(found + 1) == '\0' ||
isdigit(*(found + 1)) == 0)
{
fprintf(stderr, "Error: Can't identify the display port in string '%s'.\n",
display);
return 0;
}
port = atoi(found + 1);
#ifdef TEST
fprintf(stderr, "nxagentCheckBinder: Identified agent display port [%d].\n",
port);
#endif
/*
* The NX options must be specified in the DISPLAY
* environment. Check if the display specified on
* the command line matches the NX virtual display.
*/
display = getenv("DISPLAY");
if (display == NULL || *display == '\0')
{
fprintf(stderr, "Error: No DISPLAY environment found.\n");
return 0;
}
found = rindex(display, ':');
if (found == NULL || *(found + 1) == '\0' ||
isdigit(*(found + 1)) == 0 || atoi(found + 1) != port)
{
fprintf(stderr, "Error: The NX display doesn't match the agent display :%d.\n",
port);
return 0;
}
#ifdef TEST
fprintf(stderr, "nxagentCheckBinder: Identified NX display port [%d].\n",
atoi(found + 1));
#endif
/*
* Save the proxy options. They will be later
* used to create the transport.
*/
nxagentChangeOption(Rootless, False);
nxagentChangeOption(Desktop, False);
nxagentChangeOption(Binder, True);
/*
* FIXME: This now points to the buffer that was
* returned by getenv(). It is to be decided how
* to handle the values of type string in the
* Options repository.
*/
nxagentChangeOption(BinderOptions, display);
return 2;
}
fprintf(stderr, "Error: No display port specified in command.\n");
return 0;
}
int nxagentBinderLoop()
{
struct timeval timeout;
char *options = nxagentOption(BinderOptions);
#ifdef TEST
fprintf(stderr, "nxagentBinderLoop: Creating the NX transport.\n");
#endif
if (NXTransCreate(NX_FD_ANY, NX_MODE_CLIENT, options) < 0)
{
#ifdef TEST
fprintf(stderr, "nxagentBinderLoop: PANIC! Error creating the NX transport.\n");
#endif
return -1;
}
#ifdef TEST
fprintf(stderr, "nxagentBinderLoop: Yielding control to the NX entry point.\n");
#endif
while (NXTransRunning(NX_FD_ANY))
{
#ifdef DEBUG
fprintf(stderr, "nxagentBinderLoop: Going to run a new NX proxy loop.\n");
#endif
timeout.tv_sec = 10;
timeout.tv_usec = 0;
NXTransContinue(&timeout);
#ifdef DEBUG
fprintf(stderr, "nxagentBinderLoop: Completed execution of the NX loop.\n");
#endif
}
#ifdef TEST
fprintf(stderr, "nxagentBinderLoop: Exiting the NX proxy binder loop.\n");
#endif
return 1;
}
void nxagentBinderExit(int code)
{
NXTransExit(code);
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Binder_H__
#define __Binder_H__
int nxagentCheckBinder(int argc, char *argv[], int i);
int nxagentBinderLoop(void);
void nxagentBinderExit(int code);
#endif /* __Binder_H__ */
This source diff could not be displayed because it is too large. You can view the blob instead.
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Client_H__
#define __Client_H__
#define MAX_CONNECTIONS 256
/*
* The master nxagent holds in nxagentShadowCounter
* the number of shadow nxagents connected to itself.
*/
extern int nxagentShadowCounter;
enum ClientHint
{
UNKNOWN = 0,
NXCLIENT_WINDOW,
NXCLIENT_DIALOG,
NXAGENT_SHADOW
};
typedef struct _PrivClientRec
{
int clientState;
long clientBytes;
enum ClientHint clientHint;
} PrivClientRec;
extern int nxagentClientPrivateIndex;
#define nxagentClientPriv(pClient) \
((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr))
void nxagentInitClientPrivates(ClientPtr);
#define nxagentClientAddBytes(pClient, size) \
(nxagentClientPriv(pClient) -> clientBytes += (size))
#define nxagentClientBytes(pClient) \
(nxagentClientPriv(pClient) -> clientBytes)
#define nxagentClientHint(pClient) \
(nxagentClientPriv(pClient) -> clientHint)
#define nxagentClientIsDialog(pClient) \
(nxagentClientHint(pClient) == NXCLIENT_DIALOG)
/*
* The actual reason why the client
* is sleeping.
*/
#define SleepingBySplit 1
#define nxagentNeedWakeup(client) \
((nxagentClientPriv(client) -> \
clientState) != 0)
#define nxagentNeedWakeupBySplit(client) \
(((nxagentClientPriv(client) -> \
clientState) & SleepingBySplit) != 0)
void nxagentGuessClientHint(ClientPtr, Atom, char*);
void nxagentGuessShadowHint(ClientPtr, Atom);
void nxagentCheckIfShadowAgent(ClientPtr);
/*
* Suspend or restart the agent's
* client.
*/
int nxagentSuspendBySplit(ClientPtr client);
int nxagentWakeupBySplit(ClientPtr client);
/*
* Wait until the given client is
* restarted.
*/
void nxagentWaitWakeupBySplit(ClientPtr client);
/*
FIXME: This must be moved to Drawable.h.
*/
void nxagentWaitDrawable(DrawablePtr pDrawable);
/*
* Wakeup all the sleeping clients.
*/
void nxagentWakeupByReconnect(void);
/*
* Reset the client state before
* closing it down.
*/
void nxagentWakeupByReset(ClientPtr client);
#endif /* __Client_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Clipboard_H__
#define __Clipboard_H__
/*
* Create the NX_CUT_BUFFER_CLIENT atom and
* initialize the required property to exchange
* data with the X server.
*/
extern int 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.
*/
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 nxagentNotifySelection();
#endif /* __Clipboard_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Color_H__
#define __Color_H__
#define DUMB_WINDOW_MANAGERS
#define MAXCMAPS 1
#define MINCMAPS 1
typedef struct {
Colormap colormap;
} nxagentPrivColormap;
typedef struct {
int numCmapIDs;
Colormap *cmapIDs;
int numWindows;
Window *windows;
int index;
} nxagentInstalledColormapWindows;
#define nxagentColormapPriv(pCmap) \
((nxagentPrivColormap *)((pCmap)->devPriv))
#define nxagentColormap(pCmap) (nxagentColormapPriv(pCmap)->colormap)
#define nxagentPixel(pixel) (pixel)
Bool nxagentCreateColormap(ColormapPtr pCmap);
void nxagentDestroyColormap(ColormapPtr pCmap);
void nxagentSetInstalledColormapWindows(ScreenPtr pScreen);
void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen);
void nxagentDirectInstallColormaps(ScreenPtr pScreen);
void nxagentDirectUninstallColormaps(ScreenPtr pScreen);
void nxagentInstallColormap(ColormapPtr pCmap);
void nxagentUninstallColormap(ColormapPtr pCmap);
int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds);
void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors);
void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen,
unsigned short *pBlue, VisualPtr pVisual);
Bool nxagentCreateDefaultColormap(ScreenPtr pScreen);
#endif /* __Color_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include "scrnintstr.h"
#include "windowstr.h"
#include "Agent.h"
#include "Screen.h"
#include "Display.h"
#include "Options.h"
#include "Windows.h"
#undef NXAGENT_UPGRADE
#ifndef NXAGENT_UPGRADE
#include "NXcomposite.h"
#else
#include "composite.h"
#endif
/*
* Set here the required log level.
*/
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
/*
* Set if the composite extension is supported
* by the remote display.
*/
int nxagentCompositeEnable = UNDEFINED;
void nxagentCompositeExtensionInit()
{
/*
* Set the flag only if the initialization
* completes.
*/
nxagentCompositeEnable = 0;
if (nxagentOption(Composite) == 1)
{
int eventBase, errorBase;
#ifdef TEST
fprintf(stderr, "nxagentCompositeExtensionInit: Checking if the composite extension is supported.\n");
#endif
if (XCompositeQueryExtension(nxagentDisplay, &eventBase, &errorBase) == 1)
{
/*
* At the moment we don't need to care
* the version of the extension.
*/
#ifdef TEST
int major = -1;
int minor = -1;
XCompositeQueryVersion(nxagentDisplay, &major, &minor);
fprintf(stderr, "nxagentCompositeExtensionInit: The remote display supports version [%d] "
"minor [%d].\n", major, minor);
if (major < 0 || minor < 2)
{
#ifdef WARNING
fprintf(stderr, "nxagentCompositeExtensionInit: WARNING! Potentially incompatible version "
"[%d] minor [%d] detected.\n", major, minor);
#endif
}
#endif
#ifdef TEST
fprintf(stderr, "nxagentCompositeExtensionInit: Enabling the use of the composite extension.\n");
#endif
nxagentCompositeEnable = 1;
}
#ifdef TEST
else
{
fprintf(stderr, "nxagentCompositeExtensionInit: Composite extension not supported on this display.\n");
}
#endif
}
#ifdef TEST
else
{
fprintf(stderr, "nxagentRenderExtensionInit: Use of the composite extension not enabled.\n");
}
#endif
}
void nxagentRedirectDefaultWindows()
{
int i;
if (nxagentOption(Rootless) == 1 ||
nxagentCompositeEnable == 0)
{
#ifdef TEST
fprintf(stderr, "nxagentRedirectDefaultWindows: Not redirecting default "
"windows with rootless mode [%d] and composite [%d].\n",
nxagentOption(Rootless), nxagentCompositeEnable);
#endif
return;
}
for (i = 0; i < screenInfo.numScreens; i++)
{
WindowPtr pWin = WindowTable[i];
ScreenPtr pScreen = pWin -> drawable.pScreen;
#ifdef TEST
fprintf(stderr, "nxagentRedirectDefaultWindows: WARNING! Redirecting default window id [%ld] "
"to off-screen memory.\n", (long int)nxagentDefaultWindows[pScreen->myNum]);
#endif
/*
* When trying to redirect only the top level window,
* and not the subwindows, we incur in a strange be-
* haviour. The top level is unmapped, mapped, unmap-
* ped and then reparented. This at first makes the
* agent think that the window manager is gone, then
* the agent window disappears. To make thinks even
* more weird, this happens only at reconnection.
*/
XCompositeRedirectSubwindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
CompositeRedirectAutomatic);
}
}
void nxagentRedirectWindow(WindowPtr pWin)
{
if (nxagentOption(Rootless) == 0 ||
nxagentCompositeEnable == 0)
{
#ifdef TEST
fprintf(stderr, "nxagentRedirectWindow: Not redirecting window id [%ld] "
"to off-screen memory with rootless mode [%d] and composite [%d].\n",
nxagentWindow(pWin), nxagentOption(Rootless),
nxagentCompositeEnable);
#endif
return;
}
#ifdef TEST
fprintf(stderr, "nxagentRedirectWindow: WARNING! Redirecting window id [%ld] "
"to off-screen memory.\n", (long int)nxagentWindow(pWin));
#endif
XCompositeRedirectWindow(nxagentDisplay, nxagentWindow(pWin),
CompositeRedirectAutomatic);
nxagentWindowPriv(pWin) -> isRedirected = 1;
}
void nxagentUnredirectWindow(WindowPtr pWin)
{
if (nxagentWindowPriv(pWin) -> isRedirected == 1)
{
#ifdef TEST
fprintf(stderr, "nxagentRedirectWindow: Disabling redirection of window id [%ld] "
"to off-screen memory.\n", nxagentWindow(pWin));
#endif
XCompositeUnredirectWindow(nxagentDisplay, nxagentWindow(pWin),
CompositeRedirectAutomatic);
nxagentWindowPriv(pWin) -> isRedirected = 0;
}
#ifdef WARNING
else
{
fprintf(stderr, "nxagentUnredirectWindow: WARNING! The window id [%ld] "
"was not redirected.\n", (long int)nxagentWindow(pWin));
}
#endif
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Composite_H__
#define __Composite_H__
/*
* Set if the extension is present and
* its use is enabled.
*/
extern int nxagentCompositeEnable;
/*
* Query the composite extension on the
* remote display and set the flag if
* it is supported.
*/
void nxagentCompositeExtensionInit(void);
/*
* Let the X server redirect the window
* on the off-screen memory.
*/
void nxagentRedirectDefaultWindows(void);
/*
* Enable or disabel the redirection of
* the given window.
*/
void nxagentRedirectWindow(WindowPtr pWin);
void nxagentUnredirectWindow(WindowPtr pWin);
#endif /* __Composite_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Cursor_H__
#define __Cursor_H__
#include "cursorstr.h"
#include "picturestr.h"
typedef struct {
Cursor cursor;
PicturePtr picture;
int uses_render;
int x;
int y;
} nxagentPrivCursor;
/*
* _AnimCurElt and _AnimCur already defined in animcur.c.
*/
typedef struct _AnimCurElt {
CursorPtr pCursor;
CARD32 delay;
} AnimCurElt;
typedef struct _AnimCur {
int nelt;
AnimCurElt *elts;
} AnimCurRec, *AnimCurPtr;
CursorBitsPtr nxagentAnimCursorBits;
#define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits)
#define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1))
#define nxagentCursorPriv(pCursor, pScreen) \
((nxagentPrivCursor *)((pCursor)->devPriv[pScreen->myNum]))
#define nxagentCursor(pCursor, pScreen) \
(nxagentCursorPriv(pCursor, pScreen)->cursor)
#define nxagentCursorPicture(pCursor, pScreen) \
(nxagentCursorPriv(pCursor, pScreen)->picture)
#define nxagentCursorUsesRender(pCursor, pScreen) \
(nxagentCursorPriv(pCursor, pScreen)->uses_render)
#define nxagentCursorXOffset(pCursor, pScreen) \
(nxagentCursorPriv(pCursor, pScreen)->x)
#define nxagentCursorYOffset(pCursor, pScreen) \
(nxagentCursorPriv(pCursor, pScreen)->y)
void nxagentConstrainCursor(ScreenPtr pScreen, BoxPtr pBox);
void nxagentCursorLimits(ScreenPtr pScreen, CursorPtr pCursor,
BoxPtr pHotBox, BoxPtr pTopLeftBox);
Bool nxagentDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool nxagentUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
void nxagentRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor,
Bool displayed);
Bool nxagentSetCursorPosition(ScreenPtr pScreen, int x, int y,
Bool generateEvent);
void nxagentDisconnectCursor(pointer p0, XID x1, pointer p2);
void nxagentReconnectCursor(pointer p0, XID x1, pointer p2);
void nxagentReDisplayCurrentCursor(void);
Bool nxagentReconnectAllCursor(void *p0);
Bool nxagentDisconnectAllCursor(void);
#endif /* __Cursor_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Dialog_H__
#define __Dialog_H__
#include "X11/X.h"
typedef enum
{
DIALOG_FIRST_TAG,
DIALOG_KILL_SESSION = DIALOG_FIRST_TAG,
DIALOG_SUSPEND_SESSION,
DIALOG_ROOTLESS,
DIALOG_PULLDOWN,
DIALOG_FONT_REPLACEMENT,
DIALOG_ENABLE_DESKTOP_RESIZE_MODE,
DIALOG_DISABLE_DESKTOP_RESIZE_MODE,
DIALOG_FAILED_RECONNECTION,
DIALOG_ENABLE_DEFER_MODE,
DIALOG_DISABLE_DEFER_MODE,
DIALOG_DISABLE_XKB,
DIALOG_LAST_TAG
} DialogType;
extern int nxagentKillDialogPid;
extern int nxagentSuspendDialogPid;
extern int nxagentRootlessDialogPid;
extern int nxagentPulldownDialogPid;
extern int nxagentFontsReplacement;
extern int nxagentEnableRandRModeDialogPid;
extern int nxagentDisableRandRModeDialogPid;
extern int nxagentEnableDeferModePid;
extern int nxagentDisableDeferModePid;
extern int nxagentDisableXkbPid;
extern char nxagentFailedReconnectionMessage[];
extern char nxagentPulldownWindow[];
extern void nxagentLaunchDialog(DialogType type);
extern void nxagentResetDialog(int pid);
extern void nxagentTerminateDialog(DialogType type);
extern void nxagentFailedReconnectionDialog(int alert, char *error);
extern void nxagentPulldownDialog(Window);
extern void nxagentTerminateDialogs(void);
#define nxagentNoDialogIsRunning \
(nxagentSuspendDialogPid == 0 && \
nxagentKillDialogPid == 0 && \
nxagentEnableRandRModeDialogPid == 0 && \
nxagentDisableRandRModeDialogPid == 0 && \
nxagentEnableDeferModePid == 0 && \
nxagentDisableDeferModePid == 0 && \
nxagentDisableXkbPid == 0)
#define DECODE_DIALOG_TYPE(type) \
((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \
(type) == DIALOG_SUSPEND_SESSION ? "DIALOG_SUSPEND_SESSION" : \
(type) == DIALOG_ROOTLESS ? "DIALOG_ROOTLESS" : \
(type) == DIALOG_PULLDOWN ? "DIALOG_PULLDOWN" : \
(type) == DIALOG_FONT_REPLACEMENT ? "DIALOG_FONT_REPLACEMENT" : \
(type) == DIALOG_ENABLE_DESKTOP_RESIZE_MODE ? "DIALOG_ENABLE_DESKTOP_RESIZE_MODE" :\
(type) == DIALOG_DISABLE_DESKTOP_RESIZE_MODE ? "DIALOG_DISABLE_DESKTOP_RESIZE_MODE" :\
(type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \
(type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \
(type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \
(type) == DIALOG_DISABLE_XKB ? "DIALOG_DISABLE_XKB" : \
"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.
*/
#define DIALOG_KILL_SESSION_MESSAGE \
\
"\
Do you really want to close the session?\
"
#define DIALOG_KILL_SESSION_TYPE "yesno"
#define DIALOG_KILL_SESSION_LOCAL 0
#define DIALOG_SUSPEND_SESSION_MESSAGE \
\
"\
Press the disconnect button to disconnect the running session.\n\
You will be able to resume the session at later time. Press the\n\
terminate button to exit the session and close all the running\n\
programs.\
"
#define DIALOG_SUSPEND_SESSION_TYPE "yesnosuspend"
#define DIALOG_SUSPEND_SESSION_LOCAL 0
#define DIALOG_ROOTLESS_MESSAGE \
\
"\
All remote applications have been terminated.\n\
Do you want to close the session?\
"
#define DIALOG_ROOTLESS_TYPE "yesno"
#define DIALOG_ROOTLESS_LOCAL 0
#define DIALOG_PULLDOWN_MESSAGE \
\
nxagentPulldownWindow
#define DIALOG_PULLDOWN_TYPE "pulldown"
#define DIALOG_PULLDOWN_LOCAL 0
#define DIALOG_FONT_REPLACEMENT_MESSAGE \
\
"\
Unable to retrieve all the fonts currently in use. \n\
Missing fonts have been replaced.\
"
#define DIALOG_FONT_REPLACEMENT_TYPE "ok"
#define DIALOG_FONT_REPLACEMENT_LOCAL 0
#define DIALOG_FAILED_RECONNECTION_MESSAGE \
\
nxagentFailedReconnectionMessage
#define DIALOG_FAILED_RECONNECTION_TYPE "ok"
#define DIALOG_FAILED_RECONNECTION_LOCAL 0
#define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_MESSAGE \
\
"\
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\
again to disable this option.\
"
#define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE "ok"
#define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL 0
#define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_MESSAGE \
\
"\
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.\
"
#define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE "ok"
#define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL 0
#define DIALOG_ENABLE_DEFER_MODE_MESSAGE \
\
"\
Deferred screen updates are now enabled. You can press\n\
Ctrl+Alt+E again to disable this option.\
"
#define DIALOG_ENABLE_DEFER_MODE_TYPE "ok"
#define DIALOG_ENABLE_DEFER_MODE_LOCAL 0
#define DIALOG_DISABLE_DEFER_MODE_MESSAGE \
\
"\
Deferred screen updates are now disabled. You can press\n\
Ctrl+Alt+E to enable it again.\
"
#define DIALOG_DISABLE_DEFER_MODE_TYPE "ok"
#define DIALOG_DISABLE_DEFER_MODE_LOCAL 0
#define DIALOG_DISABLE_XKB_MESSAGE \
\
"\
Changing layout is not allowed with your current display.\
"
#define DIALOG_DISABLE_XKB_TYPE "ok"
#define DIALOG_DISABLE_XKB_LOCAL 0
#endif /* __Dialog_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Display_H__
#define __Display_H__
#define MAXDEPTH 32
#define MAXVISUALSPERDEPTH 256
extern Display *nxagentDisplay;
extern Display *nxagentShadowDisplay;
extern XVisualInfo *nxagentVisuals;
extern int nxagentNumVisuals;
extern int nxagentDefaultVisualIndex;
extern Colormap *nxagentDefaultColormaps;
extern int nxagentNumDefaultColormaps;
extern int *nxagentDepths;
extern int nxagentNumDepths;
extern XPixmapFormatValues *nxagentPixmapFormats;
extern int nxagentNumPixmapFormats;
extern Pixel nxagentBlackPixel;
extern Pixel nxagentWhitePixel;
extern Drawable nxagentDefaultDrawables[MAXDEPTH + 1];
extern Pixmap nxagentScreenSaverPixmap;
/*
* The "confine" window is used in nxagentConstrainCursor().
* We are currently overriding the original Xnest behaviour
* and just skip the "constrain" stuff.
*/
extern Window nxagentConfineWindow;
/*
* Keyboard and pointer are handled as they were hardware
* devices, that is we translate the key codes according to
* our own transcripts. We inherit this behaviour from Xnest.
* The following mask will contain the event mask selected
* for the root window. All the keyboard and pointer events
* are enqueued to the mi that translates and posts them to
* managed clients.
*/
extern unsigned long nxagentEventMask;
void nxagentOpenDisplay(int argc, char *argv[]);
void nxagentWaitDisplay(void);
void nxagentCloseDisplay(void);
void nxagentAbortDisplay(void);
void nxagentAddXConnection(void);
void nxagentRemoveXConnection(void);
Bool nxagentXServerGeometryChanged(void);
/*
* Create the default drawables.
*/
void nxagentGetDepthsAndPixmapFormats(void);
void nxagentSetDefaultDrawables(void);
extern Bool nxagentTrue24;
void nxagentBackupDisplayInfo(void);
void nxagentCleanupBackupDisplayInfo(void);
void nxagentInstallDisplayHandlers(void);
void nxagentPostInstallDisplayHandlers(void);
void nxagentResetDisplayHandlers(void);
void nxagentInstallSignalHandlers(void);
void nxagentPostInstallSignalHandlers(void);
void nxagentResetSignalHandlers(void);
void nxagentDisconnectDisplay(void);
Bool nxagentReconnectDisplay(void *p0);
/*
* Deal with the smart scheduler.
*/
#ifdef SMART_SCHEDULE
#define nxagentInitTimer() \
\
SmartScheduleInit();
#define nxagentStopTimer() \
\
if (SmartScheduleTimerStopped == 0) \
{ \
SmartScheduleStopTimer(); \
} \
\
SmartScheduleIdle = 1;
#define nxagentStartTimer() \
\
if (SmartScheduleTimerStopped == 1) \
{ \
SmartScheduleStartTimer(); \
} \
\
SmartScheduleIdle = 0;
#define nxagentDisableTimer() \
\
if (SmartScheduleTimerStopped == 0) \
{ \
SmartScheduleStopTimer(); \
} \
\
SmartScheduleDisable = 1;
#endif /* #ifdef SMART_SCHEDULE */
/*
* File descriptor currently used by
* Xlib for the agent display.
*/
extern int nxagentXConnectionNumber;
/*
* File descriptor currently used by
* Xlib for the agent shadow display.
*/
extern int nxagentShadowXConnectionNumber;
int nxagentServerOrder(void);
#define nxagentClientOrder(client) \
((client)->swapped ? !nxagentServerOrder() : nxagentServerOrder())
/*
* Terminate the agent after the next
* dispatch loop.
*/
#define nxagentTerminateSession() \
do \
{ \
dispatchException |= DE_TERMINATE; \
\
isItTimeToYield = TRUE; \
} \
while (0)
#endif /* __Display_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Drawable_H__
#define __Drawable_H__
#include "resource.h"
#include "Windows.h"
#include "Pixmaps.h"
/*
* Structures and macros used to manage the Lazy encoding.
*/
typedef struct
{
DrawablePtr pDrawable;
int drawableType;
int abort;
int windowBitmaps;
int pixmapBitmaps;
int backgroundBitmaps;
} _nxagentSynchronizationRec;
extern _nxagentSynchronizationRec nxagentSynchronization;
enum DrawableStatus
{
Synchronized,
NotSynchronized
};
enum SynchronizationPredicate
{
Needed,
NotNeeded,
Delayed
};
/*
* Shall the synchronization wait for the
* drawable wakening?
*/
#define DONT_WAIT 0
#define DO_WAIT 1
/*
* How the synchronization loop can be
* interrupted? A 0 mask means that the
* loop can't be stopped.
*/
#define EVENT_BREAK (1 << 0)
#define CONGESTION_BREAK (1 << 1)
#define BLOCKING_BREAK (1 << 2)
#define NEVER_BREAK 0
#define ALWAYS_BREAK (EVENT_BREAK | \
CONGESTION_BREAK | \
BLOCKING_BREAK)
/*
* Minimum value of usage counter which
* a pixmap should have to be synchronized.
*/
#define MINIMUM_PIXMAP_USAGE_COUNTER 2
/*
* This is the macro used to get the external XID
* from a generic pointer to a drawable.
*/
#define nxagentDrawable(pDrawable) \
((pDrawable)->type == DRAWABLE_WINDOW ? \
nxagentWindow((WindowPtr)pDrawable) : \
nxagentPixmap((PixmapPtr)pDrawable))
#define nxagentVirtualDrawable(pDrawable) \
(DrawablePtr)((pDrawable)->type == DRAWABLE_WINDOW ? \
NULL : nxagentVirtualPixmap((PixmapPtr)pDrawable))
#define nxagentDrawablePicture(pDrawable) \
((DrawablePtr)((pDrawable)->type == DRAWABLE_WINDOW ? \
nxagentWindowPriv((WindowPtr)pDrawable) -> pPicture : \
nxagentPixmapPriv((PixmapPtr)pDrawable) -> pPicture))
#define nxagentCorruptedRegion(pDrawable) \
((pDrawable) -> type == DRAWABLE_PIXMAP ? \
nxagentPixmapCorruptedRegion((PixmapPtr) pDrawable) : \
nxagentWindowCorruptedRegion((WindowPtr) pDrawable))
#define nxagentDrawableStatus(pDrawable) \
(REGION_NIL(nxagentCorruptedRegion(pDrawable)) ? \
Synchronized : NotSynchronized)
#define nxagentDrawableContainGlyphs(pDrawable) \
((pDrawable) -> type == DRAWABLE_PIXMAP ? \
nxagentPixmapContainGlyphs((PixmapPtr) (pDrawable)) : \
nxagentWindowContainGlyphs((WindowPtr) (pDrawable)))
#define nxagentSetDrawableContainGlyphs(pDrawable, value) \
do \
{ \
if ((pDrawable) -> type == DRAWABLE_PIXMAP) \
{ \
nxagentPixmapContainGlyphs(nxagentRealPixmap((PixmapPtr) (pDrawable))) = (value); \
} \
else \
{ \
nxagentWindowContainGlyphs((WindowPtr) (pDrawable)) = (value); \
} \
} while (0)
#define nxagentDrawableBitmap(pDrawable) \
((pDrawable) -> type == DRAWABLE_PIXMAP ? \
nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) (pDrawable))) -> synchronizationBitmap : \
nxagentWindowPriv((WindowPtr) (pDrawable)) -> synchronizationBitmap)
#define nxagentDrawableTimestamp(pDrawable) \
((pDrawable) -> type == DRAWABLE_PIXMAP ? \
nxagentPixmapTimestamp((PixmapPtr) pDrawable) : \
nxagentWindowTimestamp((WindowPtr) pDrawable))
#define nxagentDrawableType(pDrawable) \
((pDrawable) -> type == DRAWABLE_PIXMAP ? "pixmap" : "window")
extern RESTYPE RT_NX_CORR_BACKGROUND;
extern RESTYPE RT_NX_CORR_WINDOW;
extern RESTYPE RT_NX_CORR_PIXMAP;
extern int nxagentCorruptedPixmaps;
extern int nxagentCorruptedWindows;
extern int nxagentCorruptedBackgrounds;
extern int nxagentForceSynchronization;
extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
int width, int height);
#define nxagentFreeRegion(pDrawable, pRegion) \
REGION_DESTROY((pDrawable) -> pScreen, pRegion);
extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask);
extern void nxagentIncreasePixmapUsageCounter(PixmapPtr pPixmap);
extern int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int breakMask, WindowPtr owner);
extern void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int breakMask);
extern int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner);
extern int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner);
extern void nxagentSynchronizationLoop(unsigned int mask);
extern int nxagentSynchronizationPredicate(void);
extern BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion);
extern void nxagentCleanCorruptedDrawable(DrawablePtr pDrawable);
extern void nxagentUnmarkExposedRegion(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOther);
extern void nxagentSendDeferredBackgroundExposures(void);
extern void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion);
extern void nxagentAllocateCorruptedResource(DrawablePtr pDrawable, RESTYPE type);
extern void nxagentDestroyCorruptedResource(DrawablePtr pDrawable, RESTYPE type);
extern int nxagentDestroyCorruptedBackgroundResource(pointer p, XID id);
extern int nxagentDestroyCorruptedWindowResource(pointer p, XID id);
extern int nxagentDestroyCorruptedPixmapResource(pointer p, XID id);
extern void nxagentCreateDrawableBitmap(DrawablePtr pDrawable);
extern void nxagentDestroyDrawableBitmap(DrawablePtr pDrawable);
extern void nxagentRegionsOnScreen(void);
#define PRINT_REGION_BOXES(pRegion, strRegion) \
do \
{ \
int i; \
int numRects; \
BoxPtr pBox; \
\
if (pRegion == NullRegion) \
{ \
fprintf(stderr, "printRegionBoxes:: Region " strRegion " is null.\n"); \
break; \
} \
\
numRects = REGION_NUM_RECTS(pRegion); \
pBox = REGION_RECTS(pRegion); \
\
fprintf(stderr, "printRegionBoxes:: Region " strRegion " at [%p] has [%d] boxes:\n", \
(void *) (pRegion), numRects); \
\
for (i = 0; i < numRects; i++) \
{ \
fprintf(stderr, "[%d] [%d,%d,%d,%d]\n", \
i, pBox[i].x1, pBox[i].y1, pBox[i].x2, pBox[i].y2); \
} \
\
} while (0)
#endif /* __Drawable_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Error_H__
#define __Error_H__
/*
* Clients log file name.
*/
extern char nxagentClientsLogName[];
extern char nxagentVerbose;
int nxagentErrorHandler(Display *dpy, XErrorEvent *event);
int nxagentExitHandler(const char *message);
void nxagentStartRedirectToClientsLog(void);
void nxagentEndRedirectToClientsLog(void);
#endif /* __Error_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Events_H__
#define __Events_H__
#include <X11/Xmd.h>
#define ProcessedExpose (LASTEvent + 1)
#define ProcessedNotify (LASTEvent + 2)
#define EXPOSED_SIZE 256
enum HandleEventResult
{
doNothing = 0,
doMinimize,
doCloseSession,
doStartKbd,
doSwitchFullscreen,
doViewportLeft,
doViewportUp,
doViewportRight,
doViewportDown,
doSwitchResizeMode,
doSwitchDeferMode
};
extern CARD32 nxagentLastEventTime;
/*
* Manage incoming events.
*/
typedef Bool (*PredicateFuncPtr)(Display*, XEvent*, XPointer);
extern void nxagentDispatchEvents(PredicateFuncPtr);
typedef int (*GetResourceFuncPtr)(Display*);
int nxagentWaitForResource(GetResourceFuncPtr, PredicateFuncPtr);
Bool nxagentCollectGrabPointerPredicate(Display *display, XEvent *X, XPointer ptr);
int nxagentInputEventPredicate(Display *display, XEvent *event, XPointer parameter);
/*
* Enable and disable notification of
* remote X server events.
*/
extern void nxagentEnableKeyboardEvents(void);
extern void nxagentEnablePointerEvents(void);
extern void nxagentDisableKeyboardEvents(void);
extern void nxagentDisablePointerEvents(void);
/*
* Manage default event mask.
*/
extern void nxagentInitDefaultEventMask(void);
extern void nxagentGetDefaultEventMask(Mask *mask_return);
extern void nxagentSetDefaultEventMask(Mask mask);
extern void nxagentGetEventMask(WindowPtr pWin, Mask *mask_return);
/*
* 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.
*/
extern int nxagentInitKeyboardState(void);
/*
* Update the keyboard state according
* to focus and XKB events received
* from the remote X server.
*/
extern int nxagentHandleKeyboardEvent(XEvent *X);
/*
* 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.
*/
extern int nxagentHandleExposeEvent(XEvent *X);
extern int nxagentHandleGraphicsExposeEvent(XEvent *X);
extern int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*);
extern int nxagentHandlePropertyNotify(XEvent *X);
extern int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*);
extern int nxagentHandleReparentNotify(XEvent *X);
extern int nxagentHandleConfigureNotify(XEvent *X);
/*
* 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.
*/
extern void nxagentGrabPointerAndKeyboard(XEvent *X);
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.
*/
typedef struct _ExposuresRec
{
WindowPtr pWindow;
RegionPtr localRegion;
RegionPtr remoteRegion;
Bool remoteRegionIsCompleted;
int serial;
int synchronize;
} ExposuresRec;
extern RegionPtr nxagentRemoteExposeRegion;
typedef struct _ExposeQueue
{
unsigned int start;
int length;
ExposuresRec exposures[EXPOSED_SIZE];
} ExposeQueue;
extern void nxagentSynchronizeExpose(void);
extern int nxagentLookupByWindow(WindowPtr pWin);
extern void nxagentUpdateExposeArray(void);
extern ExposeQueue nxagentExposeQueue;
/*
* Handle the split related notifications.
*/
int nxagentWaitSplitEvent(int resource);
void nxagentHandleNoSplitEvent(int resource);
void nxagentHandleStartSplitEvent(int resource);
void nxagentHandleCommitSplitEvent(int resource, int request, int position);
void nxagentHandleEndSplitEvent(int resource);
void nxagentHandleEmptySplitEvent(void);
void nxagentInitRemoteExposeRegion(void);
void nxagentAddRectToRemoteExposeRegion(BoxPtr);
extern int nxagentUserInput(void *p);
/*
* We have to check these before launching the terminate
* dialog in rootless mode.
*/
extern Bool nxagentLastWindowDestroyed;
extern Time nxagentLastWindowDestroyedTime;
/*
* Set this flag if an user input event is received.
*/
extern int nxagentInputEvent;
/*
* Event-handling utilities.
*/
Bool nxagentPendingEvents(Display *dpy);
#define nxagentQueuedEvents(display) \
XQLength((display))
#define nxagentReadEvents(display) \
XEventsQueued((display), QueuedAfterReading)
#define nxagentCheckEvents(display, event, predicate, argument) \
XCheckIfEventNoFlush((display), (event), (predicate), (argument))
int nxagentWaitEvents(Display *, struct timeval *);
#endif /* __Events_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include "micmap.h"
#include "scrnintstr.h"
#include "../../randr/randrstr.h"
#include "Agent.h"
#include "Display.h"
#include "Screen.h"
#include "Extensions.h"
void GlxExtensionInit(void);
void GlxWrapInitVisuals(void *procPtr);
#ifdef __DARWIN__
void DarwinHandleGUI(int argc, char *argv[])
{
}
void DarwinGlxExtensionInit()
{
GlxExtensionInit();
}
void DarwinGlxWrapInitVisuals(void *procPtr)
{
GlxWrapInitVisuals(procPtr);
}
#endif
void nxagentInitGlxExtension(VisualPtr *visuals, DepthPtr *depths,
int *numVisuals, int *numDepths, int *rootDepth,
VisualID *defaultVisual)
{
miInitVisualsProcPtr initVisuals;
/*
* Initialize the visuals to use the GLX extension.
*/
initVisuals = NULL;
GlxWrapInitVisuals(&initVisuals);
if (initVisuals(visuals, depths, numVisuals, numDepths,
rootDepth, defaultVisual, 0, 0, 0) == 0)
{
fprintf(stderr, "Warning: Failed to initialize the GLX extension.\n");
}
}
void nxagentInitRandRExtension(ScreenPtr pScreen)
{
rrScrPrivPtr pRandRScrPriv;
if (RRScreenInit(pScreen) == 0)
{
fprintf(stderr, "Warning: Failed to initialize the RandR extension.\n");
}
/*
* RRScreenInit sets these pointers to NULL,
* so requiring the server to set up its own
* replacements.
*/
pRandRScrPriv = rrGetScrPriv(pScreen);
pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo;
pRandRScrPriv -> rrSetConfig = nxagentRandRSetConfig;
}
int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
RRScreenSizePtr pSize;
int width;
int height;
int maxWidth;
int maxHeight;
int w[] = {0, 160, 320, 640, 800, 1024, 0, 0};
int h[] = {0, 120, 240, 480, 600, 768, 0, 0};
int i;
int nSizes;
int mmWidth;
int mmHeight;
/*
* Rotation is not supported.
*/
*pRotations = RR_Rotate_0;
/*
* Register all the supported sizes. The third
* parameter is the refresh rate.
*/
maxWidth = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
maxHeight = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
nSizes = sizeof w / sizeof(int);
/*
* Add current and max sizes.
*/
w[nSizes - 1] = pScreen -> width;
h[nSizes - 1] = pScreen -> height;
w[nSizes - 2] = maxWidth;
h[nSizes - 2] = maxHeight;
/*
* Compute default size.
*/
w[0] = w[2];
h[0] = h[2];
for (i = 3; i < nSizes - 1; i++)
{
if ((w[i] <= maxWidth * 3 / 4) &&
(h[i] <= maxHeight * 3 / 4) &&
(w[i] >= w[0]) &&
(h[i] >= h[0]))
{
w[0] = w[i];
h[0] = h[i];
}
}
for (i = 0; i < nSizes; i++)
{
width = w[i];
height = h[i];
mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10);
if (mmWidth < 1)
{
mmWidth = 1;
}
mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10);
if (mmHeight < 1)
{
mmHeight = 1;
}
pSize = RRRegisterSize(pScreen, width, height, mmWidth, mmHeight);
if (pSize == NULL)
{
return 0;
}
RRRegisterRate (pScreen, pSize, 60);
}
RRSetCurrentConfig(pScreen, RR_Rotate_0, 60, pSize);
return 1;
}
int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
int rate, RRScreenSizePtr pSize)
{
/*
* Whatever size is OK for us.
*/
return nxagentResizeScreen(pScreen, pSize -> width, pSize -> height,
pSize -> mmWidth, pSize -> mmHeight);
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* Initialize the additional extensions.
*/
void nxagentInitGlxExtension(VisualPtr *visuals, DepthPtr *depths,
int *numVisuals, int *numDepths, int *rootDepth,
VisualID *defaultVisual);
void nxagentInitRandRExtension(ScreenPtr pScreen);
/*
* Basic interface to the RandR extension.
*/
int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations);
int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
int rate, RRScreenSizePtr pSize);
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Font_H__
#define __Font_H__
#include "fontstruct.h"
#include "resource.h"
extern RESTYPE RT_NX_FONT;
extern int nxagentFontPrivateIndex;
typedef struct
{
XFontStruct *font_struct;
char fontName[256];
XID mirrorID;
} nxagentPrivFont;
extern const int nxagentMaxFontNames;
#define nxagentFontPriv(pFont) \
((nxagentPrivFont *)FontGetPrivate(pFont, nxagentFontPrivateIndex))
#define nxagentFontStruct(pFont) (nxagentFontPriv(pFont)->font_struct)
#define nxagentFont(pFont) (nxagentFontStruct(pFont)->fid)
Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont);
Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
void nxagentFreeFontCache(void);
void nxagentListRemoteFonts(const char *searchPattern, const int maxNames);
int nxagentFontLookUp(const char *name);
Bool nxagentFontFind(const char *name, int *pos);
void nxagentListRemoteAddName(const char *name, int status);
int nxagentDestroyNewFontResourceType(pointer p, XID id);
Bool nxagentDisconnectAllFonts(void);
Bool nxagentReconnectAllFonts(void *p0);
void nxagentVerifyDefaultFontPath(void);
int nxagentSplitString(char *string, char *fields[], int nfields, char *sep);
#endif /* __Font_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __GCOps_H__
#define __GCOps_H__
/*
* Graphic operations.
*/
void nxagentFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
xPoint *pPoints, int *pWidths, int fSorted);
void nxagentSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
xPoint *pPoints, int *pWidths, int nSpans, int fSorted);
void nxagentGetSpans(DrawablePtr pDrawable, int maxWidth, xPoint *pPoints,
int *pWidths, int nSpans, char *pBuffer);
RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, int srcx, int srcy, int width,
int height, int dstx, int dsty);
RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, int srcx, int srcy, int width, int height,
int dstx, int dsty, unsigned long plane);
void nxagentQueryBestSize(int class, unsigned short *pwidth,
unsigned short *pheight, ScreenPtr pScreen);
void nxagentPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int nPoints, xPoint *pPoints);
void nxagentPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int nPoints, xPoint *pPoints);
void nxagentPolySegment(DrawablePtr pDrawable, GCPtr pGC,
int nSegments, xSegment *pSegments);
void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
int nRectangles, xRectangle *pRectangles);
void nxagentPolyArc(DrawablePtr pDrawable, GCPtr pGC,
int nArcs, xArc *pArcs);
void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
int mode, int nPoints, xPoint *pPoints);
void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
int nRectangles, xRectangle *pRectangles);
void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
int nArcs, xArc *pArcs);
int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x,
int y, int count, char *string);
int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x,
int y, int count, unsigned short *string);
void nxagentImageText8(DrawablePtr pDrawable, GCPtr pGC, int x,
int y, int count, char *string);
void nxagentImageText16(DrawablePtr pDrawable, GCPtr pGC, int x,
int y, int count, unsigned short *string);
void nxagentImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
unsigned int nGlyphs, CharInfoPtr *pCharInfo, pointer pGlyphBase);
void nxagentPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
unsigned int nGlyphs, CharInfoPtr *pCharInfo, pointer pGlyphBase);
void nxagentPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
int width, int height, int x, int y);
#endif /* __GCOps_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __GC_H__
#define __GC_H__
extern RESTYPE RT_NX_GC;
/* This file uses the GC definition form Xlib.h as XlibGC. */
typedef struct {
XlibGC gc;
int nClipRects;
XGCValues lastServerValues;
XID mid;
PixmapPtr pPixmap;
} nxagentPrivGC;
extern int nxagentGCPrivateIndex;
typedef struct _nxagentGraphicContextsRec
{
int depth;
GCPtr pGC;
int dirty;
} nxagentGraphicContextsRec;
typedef nxagentGraphicContextsRec *nxagentGraphicContextsPtr;
extern nxagentGraphicContextsPtr nxagentGraphicContexts;
extern int nxagentGraphicContextsSize;
#define nxagentGCPriv(pGC) \
((nxagentPrivGC *)((pGC) -> devPrivates[nxagentGCPrivateIndex].ptr))
#define nxagentGC(pGC) (nxagentGCPriv(pGC) -> gc)
#define nxagentCopyGCPriv(valueMask, valueField, src, mask, dst) \
\
if (mask & valueMask) \
{ \
nxagentGCPriv(dst) -> lastServerValues.valueField = \
nxagentGCPriv(src) -> lastServerValues.valueField; \
}
#define nxagentTestGC(newValue, pvalue) \
\
((nxagentGCPriv(pGC) -> lastServerValues.pvalue == newValue) ? 0 : 1); \
\
nxagentGCPriv(pGC) -> lastServerValues.pvalue = newValue
Bool nxagentCreateGC(GCPtr pGC);
void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
void nxagentChangeGC(GCPtr pGC, unsigned long mask);
void nxagentCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
void nxagentDestroyGC(GCPtr pGC);
void nxagentChangeClip(GCPtr pGC, int type, pointer pValue, int nRects);
void nxagentDestroyClip(GCPtr pGC);
void nxagentDestroyClipHelper(GCPtr pGC);
void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
void nxagentDisconnectGC(pointer p0, XID x1, pointer p2);
Bool nxagentDisconnectAllGCs(void);
Bool nxagentReconnectAllGCs(void *p0);
int nxagentDestroyNewGCResourceType(pointer p, XID id);
void nxagentFreeGCList(void);
void nxagentInitGCSafeVector(void);
GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen);
void nxagentFreeScratchGC(GCPtr pGC);
GCPtr nxagentGetGraphicContext(DrawablePtr pDrawable);
void nxagentAllocateGraphicContexts(void);
#endif /* __GC_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Handlers_H__
#define __Handlers_H__
/*
* Current size of the display buffer.
*/
extern int nxagentBuffer;
/*
* Set if we had to block waiting for
* the display to become writable.
*/
extern int nxagentBlocking;
/*
* Current congestion level based on
* the sync requests awaited or the
* proxy tokens.
*/
extern int nxagentCongestion;
/*
* Bytes read from the agent's clients
* and written to the display socket.
*/
extern double nxagentBytesIn;
extern double nxagentBytesOut;
/*
* Total number of descriptors ready
* as reported by the wakeup handler.
*/
extern int nxagentReady;
/*
* Timestamp of the last write to the
* remote display.
*/
extern int nxagentFlush;
/*
* Let the dispatch loop yield control to
* a different client after a fair amount
* of time or after enough data has been
* processed.
*/
struct _DispatchRec
{
int client;
double in;
double out;
unsigned long start;
};
extern struct _DispatchRec nxagentDispatch;
/*
* Ensure that we synchronize with the X
* server after a given amount of output
* is produced.
*/
struct _TokensRec
{
int soft;
int hard;
int pending;
};
extern struct _TokensRec nxagentTokens;
/*
* The agent's block and wakeup handlers.
*/
void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask);
void nxagentWakeupHandler(pointer data, int count, pointer mask);
/*
* Executed after each request processed.
*/
void nxagentDispatchHandler(ClientPtr client, int in, int out);
void nxagentShadowBlockHandler(pointer data, struct timeval **timeout, pointer mask);
void nxagentShadowWakeupHandler(pointer data, int count, pointer mask);
extern GCPtr nxagentShadowGCPtr;
extern unsigned char nxagentShadowDepth;
extern int nxagentShadowWidth;
extern int nxagentShadowHeight;
extern char *nxagentShadowBuffer;
#endif /* __Handlers_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include <signal.h>
#include <stdio.h>
#ifdef _XSERVER64
#include "scrnintstr.h"
#include "Agent.h"
#define GC XlibGC
#define PIXEL_ALREADY_TYPEDEFED
#endif /* _XSERVER64 */
#include "pixmapstr.h"
#include "regionstr.h"
#include "resource.h"
#include "../../include/gc.h"
#include "../../include/window.h"
#include "xpm.h"
#include "Agent.h"
#include "Pixmaps.h"
#include "Display.h"
#include "Holder.h"
#include "Icons.h"
#include NXAGENT_PLACEHOLDER_NAME
#define MAXDEPTH 32
#define PLACEHOLDER_WIDTH 14
#define PLACEHOLDER_HEIGHT 16
#define PLACEHOLDER_BORDER_COLOR_DARK 0x000000
#define PLACEHOLDER_BORDER_COLOR_LIGHT 0xB2B2B2
/*
* Set here the required log level.
*/
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
#undef DUMP
static Pixmap nxagentPlaceholderPixmaps[MAXDEPTH + 1];
void nxagentMarkPlaceholderNotLoaded(int depth)
{
nxagentPlaceholderPixmaps[depth] = 0;
}
void nxagentInitPlaceholder(int depth)
{
int status;
XpmAttributes attributes;
attributes.valuemask = XpmDepth | XpmSize;
attributes.depth = depth;
status = XpmCreatePixmapFromData(nxagentDisplay, DefaultRootWindow(nxagentDisplay),
placeholderXpm, nxagentPlaceholderPixmaps + depth, NULL, &attributes);
if (status != Success)
{
FatalError("Error: Failed to create the placeholder pixmap.\n");
}
#ifdef TEST
fprintf(stderr, "nxagentInitPlaceholder: Created pixmap [0x%lx] with geometry [%d,%d] for depth [%d].\n",
nxagentPlaceholderPixmaps[depth], attributes.width, attributes.height, depth);
#endif
}
void nxagentApplyPlaceholder(Drawable drawable, int x, int y,
int w, int h, int depth)
{
/*
* Instead of the image, a white rectangle that
* covers the pixmap area is drawn, alongside
* with a black and grey line that outlines the
* boundaries of the affected area.
*/
GC gc;
XGCValues value;
XPoint points[3];
value.foreground = 0xffffffff;
value.background = 0x00000000;
value.plane_mask = 0xffffffff;
value.fill_style = FillSolid;
/*
* FIXME: Should we use a gc cache to save
* some bandwidth?
*/
gc = XCreateGC(nxagentDisplay, drawable, GCBackground |
GCForeground | GCFillStyle | GCPlaneMask, &value);
XFillRectangle(nxagentDisplay, drawable, gc, x, y, w, h);
if (depth == 1)
{
return;
}
value.foreground = PLACEHOLDER_BORDER_COLOR_DARK;
value.line_style = LineSolid;
value.line_width = 1;
points[0].x = x;
points[0].y = y + h - 1;
points[1].x = x;
points[1].y = y;
points[2].x = x + w - 1;
points[2].y = y;
XChangeGC(nxagentDisplay, gc, GCForeground | GCLineWidth | GCLineStyle, &value);
XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin);
value.foreground = PLACEHOLDER_BORDER_COLOR_LIGHT;
value.line_style = LineSolid;
value.line_width = 1;
points[0].x = x;
points[0].y = y + h - 1;
points[1].x = x + w - 1;
points[1].y = y + h - 1;
points[2].x = x + w - 1;
points[2].y = y;
XChangeGC(nxagentDisplay, gc, GCForeground | GCLineWidth | GCLineStyle, &value);
XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin);
/*
* We are going to apply place holder only if on region
* we have enough space for the placeholder plus three
* pixel for spacing and one for region border.
*/
if ((w >= PLACEHOLDER_WIDTH + 8) && (h >= PLACEHOLDER_HEIGHT + 8))
{
#ifdef TEST
fprintf(stderr, "nxagentApplyPlaceholder: drawable %lx placeholder %lx from %d %d pixmap size is %d %d "
"depth %d\n", drawable, nxagentPlaceholderPixmaps[depth], x, y, w, h, depth);
#endif
if (nxagentPlaceholderPixmaps[depth] == 0)
{
nxagentInitPlaceholder(depth);
}
XCopyArea(nxagentDisplay, nxagentPlaceholderPixmaps[depth],
drawable, gc, 0, 0, PLACEHOLDER_WIDTH, PLACEHOLDER_HEIGHT, x + 4, y + 4);
}
XFreeGC(nxagentDisplay, gc);
return;
}
#ifdef DUMP
static char hexdigit(char c)
{
char map[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '?'};
return map[c];
}
/*
FIXME: Please, check the implementation of the same
function in nxcomp.
*/
char *nxagentChecksum(char *string, int length)
{
static char md5_output[MD5_DIGEST_LENGTH * 2 + 1];
static char md5[MD5_DIGEST_LENGTH];
char * ret;
int i;
memset(md5, 0, sizeof(md5));
memset(md5_output, 0, sizeof(md5_output));
ret = MD5(string, length, md5);
for (i = 0; i < MD5_DIGEST_LENGTH; i++)
{
char c = md5[i];
md5_output[i * 2 + 0] = hexdigit((c >> 0) & 0xF);
md5_output[i * 2 + 1] = hexdigit((c >> 4) & 0xF);
}
return md5_output;
}
#else
const char *nxagentChecksum(char *data, int size)
{
return "";
}
#endif
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Holder_H__
#define __Holder_H__
void nxagentMarkPlaceholderNotLoaded(int depth);
void nxagentInitPlaceholder(int depth);
void nxagentApplyPlaceholder(Drawable drawable, int x, int y, int w, int h, int depth);
const char *nxagentChecksum(char *data, int size);
#endif /* __Holder_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Icons_H__
#define __Icons_H__
#define Pixel XpmPixel
#include <X11/xpm.h>
#undef Pixel
#define NXAGENT_ICON_NAME "nxagent.xpm"
#define NXAGENT_PLACEHOLDER_NAME "nxmissing.xpm"
#endif /* __Icons_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Image_H__
#define __Image_H__
/*
* Graphic operations.
*/
void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int dstX, int dstY, int dstWidth, int dstHeight,
int leftPad, int format, char *data);
void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad,
int format, char *data);
void nxagentPutSubImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *data, Visual *pVisual);
void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *data);
/*
* Pack and split parameters we get
* from the NX transport.
*/
extern int nxagentPackLossless;
extern int nxagentPackMethod;
extern int nxagentPackQuality;
extern int nxagentSplitThreshold;
/*
* Set if images can use the alpha
* channel and if the alpha channel
* can be sent in compressed form.
*/
extern int nxagentAlphaEnabled;
extern int nxagentAlphaCompat;
/*
* Reset the visual and alpha cache
* before closing the screen or con-
* necting to a different display.
*/
void nxagentResetVisualCache(void);
void nxagentResetAlphaCache(void);
/*
* Always use the default visual for the
* image related functions.
*/
#define nxagentImageVisual(pDrawable, depth) \
((depth) == 32 ? &nxagentAlphaVisual : \
nxagentDefaultVisual(((pDrawable) -> pScreen)))
/*
* Byte swap the image if the display
* uses a different endianess.
*/
#define nxagentImageNormalize(image) \
((image) -> byte_order != IMAGE_BYTE_ORDER || \
(image) -> bitmap_bit_order != BITMAP_BIT_ORDER ? \
nxagentImageReformat((image) -> data, (image) -> bytes_per_line * \
(image) -> height * ((image) -> format == XYPixmap ? (image) -> depth : 1), \
((image) -> format == ZPixmap ? \
BitsPerPixel((image) -> depth) : 1), \
(image) -> byte_order) : 0)
/*
* Other image related functions.
*/
int nxagentImageLength(int width, int height, int format, int leftPad, int depth);
int nxagentImagePad(int width, int format, int leftPad, int depth);
int nxagentImageReformat(char *base, int nbytes, int bpp, int order);
void nxagentImageStatisticsHandler(char **buffer, int type);
int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, XImage **pImage, int *scaledx, int *scaledy);
char *nxagentAllocateImageData(int width, int height, int depth, int *length, int *format);
#endif /* __Image_H__ */
# XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:28 cpqbld Exp $
#include <Server.tmpl>
#ifdef OS2Architecture
SRCS1 = os2Stub.c
OBJS1 = os2Stub.o
#endif
SRCS = NXrandr.c \
NXwindow.c \
NXevents.c \
NXproperty.c \
NXdixfonts.c \
NXglyphcurs.c \
NXdispatch.c \
NXrender.c \
NXglyph.c \
NXpicture.c \
NXextension.c \
NXshm.c \
NXglxext.c \
NXxvdisp.c \
NXmiglyph.c \
NXmiexpose.c \
NXresource.c \
NXmiwindow.c \
NXxrandr.c \
NXdamage.c \
NXmitrap.c \
Args.c \
Binder.c \
Colormap.c \
Cursor.c \
Dialog.c \
Display.c \
Events.c \
Font.c \
GC.c \
GCOps.c \
Millis.c \
Handlers.c \
Init.c \
Keyboard.c \
Keystroke.c \
Pointer.c \
Screen.c \
TestExt.c \
Visual.c \
Drawable.c \
Window.c \
Pixmap.c \
Render.c \
Client.c \
Rootless.c \
Extensions.c \
Options.c \
Clipboard.c \
Splash.c \
Split.c \
Holder.c \
Reconnect.c \
Error.c \
Atoms.c \
Trap.c \
Image.c \
Composite.c \
Pixels.c \
stubs.c \
miinitext.c \
$(SRCS1)
OBJS = NXrandr.o \
NXwindow.o \
NXevents.o \
NXproperty.o \
NXdixfonts.o \
NXglyphcurs.o \
NXdispatch.o \
NXrender.o \
NXglyph.o \
NXpicture.o \
NXextension.o \
NXshm.o \
NXglxext.o \
NXxvdisp.o \
NXmiglyph.o \
NXmiexpose.o \
NXresource.o \
NXmiwindow.o \
NXxrandr.o \
NXdamage.o \
NXmitrap.o \
Args.o \
Binder.o \
Colormap.o \
Cursor.o \
Dialog.o \
Display.o \
Events.o \
Font.o \
GC.o \
GCOps.o \
Millis.o \
Handlers.o \
Init.o \
Keyboard.o \
Keystroke.o \
Pointer.o \
Screen.o \
TestExt.o \
Visual.o \
Drawable.o \
Window.o \
Pixmap.o \
Render.o \
Client.o \
Rootless.o \
Extensions.o \
Options.o \
Clipboard.o \
Splash.o \
Split.o \
Holder.o \
Reconnect.o \
Error.o \
Atoms.o \
Trap.o \
Image.o \
Composite.o \
Pixels.o \
stubs.o \
miinitext.o \
$(OBJS1)
VFBINCLUDES = -I../../fb -I../../mfb -I../../render
NXFONTINCLUDES = -I../../../../lib/font/include
LIBXRANDRINCLUDES= -I../../../../lib/Xrandr
INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \
-I../../../../extras/Mesa/include \
-I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I../../mi -I../../include -I../../os \
-I../../miext/damage -I../../miext/cw \
-I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \
-I$(EXTINCSRC) -I$(XINCLUDESRC) \
$(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES)
#ifdef SunArchitecture
INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \
-I../../../../extras/Mesa/include \
-I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I/usr/sfw/include \
-I../../mi -I../../include -I../../os \
-I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \
-I../../miext/damage -I../../miext/cw \
-I$(EXTINCSRC) -I$(XINCLUDESRC) \
$(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES)
#else
#ifdef cygwinArchitecture
INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I../../mi -I../../include -I../../os \
-I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \
-I../../miext/damage -I../../miext/cw \
-I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \
-I../../../../extras/Mesa/include \
-I$(EXTINCSRC) -I$(XINCLUDESRC) \
$(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES)
#endif
#endif
### NXAGENT Defines:
#
# NXAGENT_FONTCACHE_SIZE Number of cache slots
# NXAGENT_SHAPE Old shape code
# NXAGENT_GLYPHCACHE
# NXAGENT_GLYPHCACHE_SIZE Slots for glyph cache
# NXAGENT_SHAPE2 New shape code
# NXAGENT_FIXKEYS Force the release of pressed key when loosing focus
# NXAGENT_EXPOSURES Manage expose events
# NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers.
# NXAGENT_FONTEXCLUDE Exclude some specific font names (only "-ult1mo" at this moment).
# NXAGENT FULLSCREEN Fullscreen mode
#
#if NXUpgradeAgentServer
UPG_DEFINES=-DNXAGENT_UPGRADE
#else
UPG_DEFINES=
#endif
DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \
-UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER \
-DNXAGENT_SERVER \
-DNXAGENT_CONSTRAINCURSOR \
-DNXAGENT_FONTCACHE_SIZE=50 \
-DNXAGENT_GLYPHCACHE -DNXAGENT_GLYPHCACHE_SIZE=50 \
-DNXAGENT_SHAPE2 \
-DNXAGENT_FIXKEYS \
-DNXAGENT_CLIPBOARD \
-DNXAGENT_EXPOSURES \
-DNXAGENT_FONTEXCLUDE \
-DNXAGENT_PACKEDIMAGES \
-DNXAGENT_VISIBILITY \
-DNXAGENT_WAKEUP=1000 \
-DNXAGENT_ONSTART \
-DNXAGENT_SPLASH \
-DNXAGENT_ARTSD \
-UPANORAMIX
all:: $(OBJS)
LinkSourceFile(stubs.c,$(SERVERSRC)/Xi)
SpecialCObjectRule(Init,$(ICONFIGFILES),$(_NOOP_))
LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_))
NormalLibraryObjectRule()
NormalLibraryTarget(nxagent,$(OBJS))
DependTarget()
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Init_H__
#define __Init_H__
extern int nxagentDoFullGeneration;
extern int nxagentBackingStore;
extern int nxagentSaveUnder;
#endif /* __Init_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef __Keyboard_H__
#define __Keyboard_H__
#define NXAGENT_KEYBOARD_EVENT_MASK \
(KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask)
#define NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK \
(XkbStateNotifyMask)
/*
* Queried at XKB initialization.
*/
typedef struct _XkbAgentInfo
{
int Opcode;
int EventBase;
int ErrorBase;
int MajorVersion;
int MinorVersion;
} XkbAgentInfoRec;
extern XkbAgentInfoRec nxagentXkbInfo;
typedef struct _XkbAgentState
{
int Locked;
int Caps;
int Num;
int Focus;
int Initialized;
} XkbAgentStateRec;
extern XkbAgentStateRec nxagentXkbState;
/*
* Info for enabling/disabling Xkb.
*/
typedef struct _XkbWrapper
{
int base;
int eventBase;
int errorBase;
int (* ProcXkbDispatchBackup)(ClientPtr);
int (* SProcXkbDispatchBackup)(ClientPtr);
} XkbWrapperRec;
extern XkbWrapperRec nxagentXkbWrapper;
extern char *nxagentKeyboard;
/*
* Keyboard device procedure
* and utility functions.
*/
void nxagentBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls);
int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff);
void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl);
void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode);
int nxagentResetKeyboard(void);
#ifdef XKB
void nxagentInitXkbWrapper(void);
void nxagentDisableXkbExtension(void);
void nxagentEnableXkbExtension(void);
void nxagentTuneXkbWrapper(void);
#endif
#endif /* __Keyboard_H__ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include "X.h"
#include "keysym.h"
#include "screenint.h"
#include "scrnintstr.h"
#include "Agent.h"
#include "Display.h"
#include "Events.h"
#include "Options.h"
#include "Keystroke.h"
#include "Drawable.h"
extern Bool nxagentWMIsRunning;
extern Bool nxagentIpaq;
/*
* Set here the required log level.
*/
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
#undef DUMP
int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
{
KeySym sym;
int index = 0;
*result = doNothing;
/*
* I don't know how much hard work is doing this operation.
* Do we need a cache ?
*/
sym = XKeycodeToKeysym(nxagentDisplay, X -> keycode, index);
if (sym == XK_VoidSymbol || sym == NoSymbol)
{
return 0;
}
#ifdef TEST
fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - sym %lx\n",
X -> keycode, X -> state, sym);
#endif
/*
* Check special keys.
*/
/*
* FIXME: We should use the keysym instead that the keycode
* here.
*/
if (X -> keycode == 130 && nxagentIpaq)
{
*result = doStartKbd;
return 1;
}
if ((X -> state & nxagentAltMetaMask) &&
((X -> state & (ControlMask | ShiftMask)) == ControlMask))
{
switch (sym)
{
case XK_t:
case XK_T:
{
*result = doCloseSession;
break;
}
case XK_f:
case XK_F:
{
if (nxagentOption(Rootless) == False)
{
*result = doSwitchFullscreen;
}
break;
}
case XK_m:
case XK_M:
{
if (nxagentOption(Rootless) == False)
{
*result = doMinimize;
}
break;
}
case XK_Left:
case XK_KP_Left:
{
if (nxagentOption(Rootless) == False &&
nxagentOption(DesktopResize) == False)
{
*result = doViewportLeft;
}
break;
}
case XK_Up:
case XK_KP_Up:
{
if (nxagentOption(Rootless) == False &&
nxagentOption(DesktopResize) == False)
{
*result = doViewportUp;
}
break;
}
case XK_Right:
case XK_KP_Right:
{
if (nxagentOption(Rootless) == False &&
nxagentOption(DesktopResize) == False)
{
*result = doViewportRight;
}
break;
}
case XK_Down:
case XK_KP_Down:
{
if (nxagentOption(Rootless) == 0 &&
nxagentOption(DesktopResize) == 0)
{
*result = doViewportDown;
}
break;
}
case XK_R:
case XK_r:
{
if (nxagentOption(Rootless) == 0)
{
*result = doSwitchResizeMode;
}
break;
}
case XK_E:
case XK_e:
{
*result = doSwitchDeferMode;
break;
}
case XK_BackSpace:
case XK_Terminate_Server:
{
/*
* Discard Ctrl-Alt-BackSpace key.
*/
return 1;
break;
}
case XK_J:
case XK_j:
{
nxagentForceSynchronization = 1;
return 1;
}
#ifdef DUMP
case XK_A:
case XK_a:
{
/*
* Used to test the lazy encoding.
*/
nxagentRegionsOnScreen();
return 1;
}
#endif
}
}
return (*result == doNothing) ? 0 : 1;
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Keystroke_H__
#define __Keystroke_H__
#include "Events.h"
extern int nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*);
unsigned int nxagentAltMetaMask;
#endif /* __Keystroke_H__ */
Copyright (C) 2001, 2007 NoMachine - http://www.nomachine.com/.
NXAGENT and NX extensions to X are copyright of NoMachine.
Redistribution and use of this software is allowed according to the
following terms:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License Version 2, and
not any other version, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA-
BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, you can request a copy to NoMachine
or write to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA
Parts of this software are derived from XFree86 and X.org projects.
Other copyrights and the MIT/X11 license applies to different sources.
Please check the applicable copyrights in each file or subdirectory.
All rights reserved.
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* Simple table used to translate a request
* opcode to the name of the X request.
*/
static char *nxagentRequestLiteral[] =
{
"None",
"CreateWindow",
"ChangeWindowAttributes",
"GetWindowAttributes",
"DestroyWindow",
"DestroySubwindows",
"ChangeSaveSet",
"ReparentWindow",
"MapWindow",
"MapSubwindows",
"UnmapWindow",
"UnmapSubwindows",
"ConfigureWindow",
"CirculateWindow",
"GetGeometry",
"QueryTree",
"InternAtom",
"GetAtomName",
"ChangeProperty",
"DeleteProperty",
"GetProperty",
"ListProperties",
"SetSelectionOwner",
"GetSelectionOwner",
"ConvertSelection",
"SendEvent",
"GrabPointer",
"UngrabPointer",
"GrabButton",
"UngrabButton",
"ChangeActivePointerGrab",
"GrabKeyboard",
"UngrabKeyboard",
"GrabKey",
"UngrabKey",
"AllowEvents",
"GrabServer",
"UngrabServer",
"QueryPointer",
"GetMotionEvents",
"TranslateCoords",
"WarpPointer",
"SetInputFocus",
"GetInputFocus",
"QueryKeymap",
"OpenFont",
"CloseFont",
"QueryFont",
"QueryTextExtents",
"ListFonts",
"ListFontsWithInfo",
"SetFontPath",
"GetFontPath",
"CreatePixmap",
"FreePixmap",
"CreateGC",
"ChangeGC",
"CopyGC",
"SetDashes",
"SetClipRectangles",
"FreeGC",
"ClearArea",
"CopyArea",
"CopyPlane",
"PolyPoint",
"PolyLine",
"PolySegment",
"PolyRectangle",
"PolyArc",
"FillPoly",
"PolyFillRectangle",
"PolyFillArc",
"PutImage",
"GetImage",
"PolyText8",
"PolyText16",
"ImageText8",
"ImageText16",
"CreateColormap",
"FreeColormap",
"CopyColormapAndFree",
"InstallColormap",
"UninstallColormap",
"ListInstalledColormaps",
"AllocColor",
"AllocNamedColor",
"AllocColorCells",
"AllocColorPlanes",
"FreeColors",
"StoreColors",
"StoreNamedColor",
"QueryColors",
"LookupColor",
"CreateCursor",
"CreateGlyphCursor",
"FreeCursor",
"RecolorCursor",
"QueryBestSize",
"QueryExtension",
"ListExtensions",
"ChangeKeyboardMapping",
"GetKeyboardMapping",
"ChangeKeyboardControl",
"GetKeyboardControl",
"Bell",
"ChangePointerControl",
"GetPointerControl",
"SetScreenSaver",
"GetScreenSaver",
"ChangeHosts",
"ListHosts",
"SetAccessControl",
"SetCloseDownMode",
"KillClient",
"RotateProperties",
"ForceScreenSaver",
"SetPointerMapping",
"GetPointerMapping",
"SetModifierMapping",
"GetModifierMapping",
"NoOperation"
};
static char *nxagentRenderRequestLiteral[] =
{
"RenderQueryVersion",
"RenderQueryPictFormats",
"RenderQueryPictIndexValues",
"RenderQueryDithers",
"RenderCreatePicture",
"RenderChangePicture",
"RenderSetPictureClipRectangles",
"RenderFreePicture",
"RenderComposite",
"RenderScale",
"RenderTrapezoids",
"RenderTriangles",
"RenderTriStrip",
"RenderTriFan",
"RenderColorTrapezoids",
"RenderColorTriangles",
"RenderTransform",
"RenderCreateGlyphSet",
"RenderReferenceGlyphSet",
"RenderFreeGlyphSet",
"RenderAddGlyphs",
"RenderAddGlyphsFromPicture",
"RenderFreeGlyphs",
"RenderCompositeGlyphs",
"RenderCompositeGlyphs",
"RenderCompositeGlyphs",
"RenderFillRectangles",
"RenderCreateCursor",
"RenderSetPictureTransform",
"RenderQueryFilters",
"RenderSetPictureFilter",
"RenderCreateAnimCursor",
"RenderAddTraps",
"RenderCreateSolidFill",
"RenderCreateLinearGradient",
"RenderCreateRadialGradient",
"RenderCreateConicalGradient"
};
static char *nxagentShmRequestLiteral[] =
{
"ShmQueryVersion",
"ShmAttach",
"ShmDetach",
"ShmPutImage",
"ShmGetImage",
"ShmCreatePixmap"
};
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#include <time.h>
#include <stdio.h>
#include "Xos.h"
#include "Millis.h"
#ifdef DDXTIME
CARD32 GetTimeInMillis()
{
struct timeval ts;
X_GETTIMEOFDAY(&ts);
return(ts.tv_sec * 1000) + (ts.tv_usec / 1000);
}
#endif
const char *GetTimeAsString()
{
char *value;
struct timeval ts;
X_GETTIMEOFDAY(&ts);
value = ctime((time_t *) &ts.tv_sec);
*(value + strlen(value) - 1) = '\0';
return value;
}
const char *GetTimeInMillisAsString()
{
char *value;
char tb[25];
struct timeval ts;
X_GETTIMEOFDAY(&ts);
value = ctime((time_t *) &ts.tv_sec);
sprintf(tb, "%.8s:%3.3f", value + 11,
(float) ts.tv_usec / 1000);
strncpy(value, tb, 24);
return value;
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Millis_H__
#define __Millis_H__
#include "Xmd.h"
CARD32 GetTimeInMillis(void);
const char *GetTimeInMillisAsString(void);
const char *GetTimeAsString(void);
#endif /* __Millis_H__ */
#ifndef NXAGENT_UPGRADE
/*
* $Id: Xcomposite.c,v 1.2 2005/07/03 07:00:56 daniels Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef NXAGENT_SERVER
#include "NXcompositeint.h"
#else
#include "compositeint.h"
#endif
XCompositeExtInfo XCompositeExtensionInfo;
const char XCompositeExtensionName[] = COMPOSITE_NAME;
/*
* XCompositeExtRemoveDisplay - remove the indicated display from the
* extension object. (Replaces XextRemoveDisplay.)
*/
static int
XCompositeExtRemoveDisplay (XCompositeExtInfo *extinfo, Display *dpy)
{
XCompositeExtDisplayInfo *info, *prev;
/*
* locate this display and its back link so that it can be removed
*/
_XLockMutex(_Xglobal_lock);
prev = NULL;
for (info = extinfo->head; info; info = info->next) {
if (info->display == dpy) break;
prev = info;
}
if (!info) {
_XUnlockMutex(_Xglobal_lock);
return 0; /* hmm, actually an error */
}
/*
* remove the display from the list; handles going to zero
*/
if (prev)
prev->next = info->next;
else
extinfo->head = info->next;
extinfo->ndisplays--;
if (info == extinfo->cur) extinfo->cur = NULL; /* flush cache */
_XUnlockMutex(_Xglobal_lock);
Xfree ((char *) info);
return 1;
}
static int
XCompositeCloseDisplay (Display *dpy, XExtCodes *codes)
{
return XCompositeExtRemoveDisplay (&XCompositeExtensionInfo, dpy);
}
/*
* XCompositeExtAddDisplay - add a display to this extension. (Replaces
* XextAddDisplay)
*/
static XCompositeExtDisplayInfo *
XCompositeExtAddDisplay (XCompositeExtInfo *extinfo,
Display *dpy,
const char *ext_name)
{
XCompositeExtDisplayInfo *info;
#ifndef NXAGENT_SERVER
int ev;
#endif
info = (XCompositeExtDisplayInfo *) Xmalloc (sizeof (XCompositeExtDisplayInfo));
if (!info) return NULL;
info->display = dpy;
info->codes = XInitExtension (dpy, ext_name);
/*
* if the server has the extension, then we can initialize the
* appropriate function vectors
*/
if (info->codes) {
xCompositeQueryVersionReply rep;
xCompositeQueryVersionReq *req;
XESetCloseDisplay (dpy, info->codes->extension,
XCompositeCloseDisplay);
/*
* Get the version info
*/
LockDisplay (dpy);
GetReq (CompositeQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeQueryVersion;
req->majorVersion = COMPOSITE_MAJOR;
req->minorVersion = COMPOSITE_MINOR;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
{
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
info->major_version = rep.majorVersion;
info->minor_version = rep.minorVersion;
UnlockDisplay (dpy);
} else {
/* The server doesn't have this extension.
* Use a private Xlib-internal extension to hang the close_display
* hook on so that the "cache" (extinfo->cur) is properly cleaned.
* (XBUG 7955)
*/
XExtCodes *codes = XAddExtension(dpy);
if (!codes) {
XFree(info);
return NULL;
}
XESetCloseDisplay (dpy, codes->extension, XCompositeCloseDisplay);
}
/*
* now, chain it onto the list
*/
_XLockMutex(_Xglobal_lock);
info->next = extinfo->head;
extinfo->head = info;
extinfo->cur = info;
extinfo->ndisplays++;
_XUnlockMutex(_Xglobal_lock);
return info;
}
/*
* XCompositeExtFindDisplay - look for a display in this extension; keeps a
* cache of the most-recently used for efficiency. (Replaces
* XextFindDisplay.)
*/
static XCompositeExtDisplayInfo *
XCompositeExtFindDisplay (XCompositeExtInfo *extinfo,
Display *dpy)
{
XCompositeExtDisplayInfo *info;
/*
* see if this was the most recently accessed display
*/
if ((info = extinfo->cur) && info->display == dpy)
return info;
/*
* look for display in list
*/
_XLockMutex(_Xglobal_lock);
for (info = extinfo->head; info; info = info->next) {
if (info->display == dpy) {
extinfo->cur = info; /* cache most recently used */
_XUnlockMutex(_Xglobal_lock);
return info;
}
}
_XUnlockMutex(_Xglobal_lock);
return NULL;
}
XCompositeExtDisplayInfo *
XCompositeFindDisplay (Display *dpy)
{
XCompositeExtDisplayInfo *info;
info = XCompositeExtFindDisplay (&XCompositeExtensionInfo, dpy);
if (!info)
info = XCompositeExtAddDisplay (&XCompositeExtensionInfo, dpy,
XCompositeExtensionName);
return info;
}
Bool
XCompositeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
if (XCompositeHasExtension(info))
{
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
}
else
return False;
}
Status
XCompositeQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
XCompositeCheckExtension (dpy, info, 0);
*major_versionp = info->major_version;
*minor_versionp = info->minor_version;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
int
XCompositeVersion (void)
{
return XCOMPOSITE_VERSION;
}
void
XCompositeRedirectWindow (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeRedirectWindowReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeRedirectWindow, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeRedirectWindow;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeRedirectSubwindows (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeRedirectSubwindowsReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeRedirectSubwindows, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeRedirectSubwindows;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeUnredirectWindow (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeUnredirectWindowReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeUnredirectWindow, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeUnredirectWindow;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeUnredirectSubwindows (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeUnredirectSubwindowsReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeUnredirectSubwindows, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeUnredirectSubwindows;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
XserverRegion
XCompositeCreateRegionFromBorderClip (Display *dpy, Window window)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeCreateRegionFromBorderClipReq *req;
XserverRegion region;
XCompositeCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (CompositeCreateRegionFromBorderClip, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeCreateRegionFromBorderClip;
req->window = window;
region = req->region = XAllocID (dpy);
UnlockDisplay (dpy);
SyncHandle ();
#ifdef NXAGENT_SERVER
return region;
#else
return region;
#endif
}
Pixmap
XCompositeNameWindowPixmap (Display *dpy, Window window)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeNameWindowPixmapReq *req;
Pixmap pixmap;
XCompositeCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (CompositeNameWindowPixmap, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeNameWindowPixmap;
req->window = window;
pixmap = req->pixmap = XAllocID (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return pixmap;
}
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: Xcomposite.h,v 1.3 2005/07/03 07:00:56 daniels Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _XCOMPOSITE_H_
#define _XCOMPOSITE_H_
#ifdef NXAGENT_SERVER
#define XserverRegion XID
#include "NXcompositeext.h"
#else
#include <X11/extensions/composite.h>
#include <X11/extensions/Xfixes.h>
#endif
#include <X11/Xfuncproto.h>
/*
* This revision number also appears in configure.ac, they have
* to be manually synchronized
*/
#define XCOMPOSITE_MAJOR COMPOSITE_MAJOR
#define XCOMPOSITE_MINOR COMPOSITE_MINOR
#define XCOMPOSITE_REVISION 0
#define XCOMPOSITE_VERSION ((XCOMPOSITE_MAJOR * 10000) + (XCOMPOSITE_MINOR * 100) + (XCOMPOSITE_REVISION))
_XFUNCPROTOBEGIN
Bool XCompositeQueryExtension (Display *dpy, int *event_basep, int *error_basep);
Status XCompositeQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp);
int XCompositeVersion (void);
void
XCompositeRedirectWindow (Display *dpy, Window window, int update);
void
XCompositeRedirectSubwindows (Display *dpy, Window window, int update);
void
XCompositeUnredirectWindow (Display *dpy, Window window, int update);
void
XCompositeUnredirectSubwindows (Display *dpy, Window window, int update);
XserverRegion
XCompositeCreateRegionFromBorderClip (Display *dpy, Window window);
Pixmap
XCompositeNameWindowPixmap (Display *dpy, Window window);
_XFUNCPROTOEND
#endif /* _XCOMPOSITE_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: composite.h,v 1.4 2004/07/08 07:20:55 keithp Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _COMPOSITE_H_
#define _COMPOSITE_H_
#ifndef NXAGENT_SERVER
#include <X11/extensions/xfixeswire.h>
#endif
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 2
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
#define X_CompositeQueryVersion 0
#define X_CompositeRedirectWindow 1
#define X_CompositeRedirectSubwindows 2
#define X_CompositeUnredirectWindow 3
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#endif /* _COMPOSITE_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: xcompositeint.h,v 1.3 2005/07/12 03:10:35 keithp Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _XDAMAGEINT_H_
#define _XDAMAGEINT_H_
#define NEED_EVENTS
#define NEED_REPLIES
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#ifdef NXAGENT_SERVER
#include "NXcompositeproto.h"
#include "NXcomposite.h"
#else
#include <X11/extensions/compositeproto.h>
#include <X11/extensions/Xcomposite.h>
#endif
typedef struct _XCompositeExtDisplayInfo {
struct _XCompositeExtDisplayInfo *next; /* keep a linked list */
Display *display; /* which display this is */
XExtCodes *codes; /* the extension protocol codes */
int major_version; /* -1 means we don't know */
int minor_version; /* -1 means we don't know */
} XCompositeExtDisplayInfo;
/* replaces XExtensionInfo */
typedef struct _XCompositeExtInfo {
XCompositeExtDisplayInfo *head; /* start of the list */
XCompositeExtDisplayInfo *cur; /* most recently used */
int ndisplays; /* number of displays */
} XCompositeExtInfo;
extern XCompositeExtInfo XCompositeExtensionInfo;
extern const char XCompositeExtensionName[];
XCompositeExtDisplayInfo *
XCompositeFindDisplay (Display *dpy);
#define XCompositeHasExtension(i) ((i) && ((i)->codes))
#define XCompositeCheckExtension(dpy,i,val) \
if (!XCompositeHasExtension(i)) { return val; }
#define XCompositeSimpleCheckExtension(dpy,i) \
if (!XCompositeHasExtension(i)) { return; }
#endif /* _XDAMAGEINT_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: compositeproto.h,v 1.4 2004/07/08 07:20:55 keithp Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _COMPOSITEPROTO_H_
#define _COMPOSITEPROTO_H_
#include <X11/Xmd.h>
#ifdef NXAGENT_SERVER
#include "NXcomposite.h"
#else
#include <X11/extensions/composite.h>
#endif
#define Window CARD32
#define Region CARD32
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} xCompositeQueryVersionReq;
#define sz_xCompositeQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xCompositeQueryVersionReply;
#define sz_xCompositeQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeRedirectWindowReq;
#define sz_xCompositeRedirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeRedirectSubwindowsReq;
#define sz_xCompositeRedirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeUnredirectWindowReq;
#define sz_xCompositeUnredirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeUnredirectSubwindowsReq;
#define sz_xCompositeUnredirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Region region B32;
Window window B32;
} xCompositeCreateRegionFromBorderClipReq;
#define sz_xCompositeCreateRegionFromBorderClipReq 12
/* Version 0.2 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window B32;
Pixmap pixmap B32;
} xCompositeNameWindowPixmapReq;
#define sz_xCompositeNameWindowPixmapReq 12
#undef Window
#undef Region
#endif /* _COMPOSITEPROTO_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXdamage.c"
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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