Commit 1a74e032 authored by Reinhard Tartler's avatar Reinhard Tartler

Imported nxagent-3.3.0-10.tar.gz

Summary: Imported nxagent-3.3.0-10.tar.gz Keywords: Imported nxagent-3.3.0-10.tar.gz into Git repository
parent 97fe7650
...@@ -1140,13 +1140,13 @@ static void nxagentParseOptions(char *name, char *value) ...@@ -1140,13 +1140,13 @@ static void nxagentParseOptions(char *name, char *value)
} }
else if (!strcmp(name, "resize")) else if (!strcmp(name, "resize"))
{ {
if (!strcmp(value, "1")) if (nxagentOption(DesktopResize) == 0 || strcmp(value, "0") == 0)
{ {
nxagentResizeDesktopAtStartup = True; nxagentResizeDesktopAtStartup = 0;
} }
else if (!strcmp(value, "0")) else if (strcmp(value, "1") == 0)
{ {
nxagentResizeDesktopAtStartup = False; nxagentResizeDesktopAtStartup = 1;
} }
else else
{ {
...@@ -2080,8 +2080,8 @@ void nxagentSetDeferLevel() ...@@ -2080,8 +2080,8 @@ void nxagentSetDeferLevel()
deferTimeout = 200; deferTimeout = 200;
tileWidth = 65536; tileWidth = 4096;
tileHeight = 65536; tileHeight = 4096;
break; break;
} }
...@@ -2091,8 +2091,8 @@ void nxagentSetDeferLevel() ...@@ -2091,8 +2091,8 @@ void nxagentSetDeferLevel()
deferTimeout = 200; deferTimeout = 200;
tileWidth = 65536; tileWidth = 4096;
tileHeight = 65536; tileHeight = 4096;
break; break;
} }
...@@ -2103,8 +2103,8 @@ void nxagentSetDeferLevel() ...@@ -2103,8 +2103,8 @@ void nxagentSetDeferLevel()
deferTimeout = 200; deferTimeout = 200;
tileWidth = 65536; tileWidth = 4096;
tileHeight = 65536; tileHeight = 4096;
break; break;
} }
......
ChangeLog: ChangeLog:
nxagent-3.3.0-10
- Fixed TR12F02146. Compare the drawable and the bitmap data before
realizing the image update, in order to delay the data clean up that
caused the memcmp() failure.
- Fixed TR01G02156. Reduce the exposing area by subtracting the ex-
posed region.
- Fixed a compile warning in Drawable.c.
- Added detailed logs in the nxagentSynchronizeRegion() function if
the data memory allocation fails.
nxagent-3.3.0-9
- Added /usr/NX/share/base to alternate font paths. This would fix
TR11F02130 if fonts fixed and cursor are installed there.
- Changed Keyboard initialization and reset. This change should fix
TR11F02129, TR11F02131, TR11F02132.
nxagent-3.3.0-8
- Fixed TR12F02144. Image bits of render glyphs are copied before they
are cleaned. This will avoid a memory corruption.
- Fixed TR12F02145. When dispatching a MotionNotify event, check if a
top-level window has been entered before trying to show the pulldown
dialog.
nxagent-3.3.0-7
- Added debug code for pointer input.
nxagent-3.3.0-6
- Fixed compile warnings.
nxagent-3.3.0-5
- Disabled verbose logging in Rootless.c.
nxagent-3.3.0-4
- Fix the XKB map load in the case of 64 bit server.
nxagent-3.3.0-3
- Fixed TR10F02119. If the remote X display is using evdev keyboard
then copy maps from remote.
- Upgraded VERSION to 3.3.0.
nxagent-3.3.0-2
- Fixed TR10F02115. Painting errors occurred when screen areas beyond
the current viewport became viewable in the NX Client for Windows.
- Using a new struct type nxagentWMHints to avoid type mismatch on
64 bit platforms.
- Added debug utilities for pointer input.
nxagent-3.3.0-1
- Opened the 3.3.0 branch based on nxagent-3.2.0-12.
nxagent-3.2.0-12
- Ignore 'resize' option at reconnection if viewport mode is on.
- Fixed TR08E01814. Added shadow keymap initialization in order to
enable nxcompshad to translate keycodes across different layouts.
nxagent-3.2.0-11
- Fixed TR08F02098. Function splitting font names has to be instruct-
ed to handle the right number of fields.
nxagent-3.2.0-10
- Extended fix for TR07F02091 to include font names having zero in
fields RESOLUTION_X and RESOLUTION_Y.
nxagent-3.2.0-9
- Fixed TR07F02091. Scalable fonts were not correctly listed among
available fonts.
- Fixed TR06F02080. Use the corrupted area extents as maximum size of
the image data.
nxagent-3.2.0-8 nxagent-3.2.0-8
- Fixed TR07F02082. The agent server could be unable to init core - Fixed TR07F02082. The agent server could be unable to init core
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "Handlers.h" #include "Handlers.h"
#include "Pixels.h" #include "Pixels.h"
#include "Reconnect.h" #include "Reconnect.h"
#include "GCOps.h"
#include "NXlib.h" #include "NXlib.h"
...@@ -371,6 +372,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -371,6 +372,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
int nBox; int nBox;
int x, y; int x, y;
int w, h; int w, h;
int extentWidth, extentHeight;
int tileWidth, tileHeight; int tileWidth, tileHeight;
int length, format, leftPad; int length, format, leftPad;
int i; int i;
...@@ -417,13 +419,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -417,13 +419,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (useStoredBitmap != 0) if (useStoredBitmap != 0)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] has a synchronization bitmap " fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] has a synchronization bitmap at [%p] "
"[%d,%d,%d,%d] with [%ld] rects.\n", nxagentDrawableType(pDrawable), "[%d,%d,%d,%d] with [%ld] rects.\n", nxagentDrawableType(pDrawable),
(void *) pDrawable, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1, (void *) pDrawable, (void *) nxagentDrawableBitmap(pDrawable),
nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1,
nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1,
nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2,
REGION_NUM_RECTS(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)))); nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2,
REGION_NUM_RECTS(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))));
#endif #endif
clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height);
...@@ -580,8 +583,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -580,8 +583,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize [%ld] rects of [%s] at [%p].\n", fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize [%ld] rects of [%s] at [%p].\n",
REGION_NUM_RECTS(clipRegion), (pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window"), REGION_NUM_RECTS(clipRegion), nxagentDrawableType(pDrawable), (void *) pDrawable);
(void *) pDrawable);
fprintf(stderr, "nxagentSynchronizeRegion: Extents geometry [%d,%d,%d,%d].\n", fprintf(stderr, "nxagentSynchronizeRegion: Extents geometry [%d,%d,%d,%d].\n",
clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2);
...@@ -590,8 +592,20 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -590,8 +592,20 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
pDrawable -> x, pDrawable -> y, pDrawable -> width, pDrawable -> height); pDrawable -> x, pDrawable -> y, pDrawable -> width, pDrawable -> height);
#endif #endif
w = tileWidth = (nxagentOption(TileWidth) > pDrawable -> width ? pDrawable -> width : nxagentOption(TileWidth)); /*
h = tileHeight = (nxagentOption(TileHeight) > pDrawable -> height ? pDrawable -> height : nxagentOption(TileHeight)); * We are going to synchronize the corrupted
* area, so we use the corrupted extents as
* maximum size of the image data. It's im-
* portant to avoid using the drawable size,
* because in case of a huge window it had to
* result in a failed data memory allocation.
*/
extentWidth = clipRegion -> extents.x2 - clipRegion -> extents.x1;
extentHeight = clipRegion -> extents.y2 - clipRegion -> extents.y1;
w = tileWidth = (nxagentOption(TileWidth) > extentWidth ? extentWidth : nxagentOption(TileWidth));
h = tileHeight = (nxagentOption(TileHeight) > extentHeight ? extentHeight : nxagentOption(TileHeight));
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentSynchronizeRegion: Using tiles of size [%dx%d].\n", tileWidth, tileHeight); fprintf(stderr, "nxagentSynchronizeRegion: Using tiles of size [%dx%d].\n", tileWidth, tileHeight);
...@@ -602,7 +616,22 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -602,7 +616,22 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (data == NULL) if (data == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to allocate memory for synchronization.\n"); fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to allocate memory for synchronization.\n");
/*
* Print detailed informations if the
* image length is zero.
*/
if (length == 0)
{
fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%ld][%d,%d,%d,%d].\n",
nxagentDrawableType(pDrawable), (void *) pDrawable, REGION_NUM_RECTS(clipRegion),
clipRegion -> extents.x1, clipRegion -> extents.y1,
clipRegion -> extents.x2, clipRegion -> extents.y2);
}
#endif #endif
goto nxagentSynchronizeRegionFree; goto nxagentSynchronizeRegionFree;
...@@ -657,10 +686,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -657,10 +686,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (nxagentDrawableStatus(pDrawable) == Synchronized) if (nxagentDrawableStatus(pDrawable) == Synchronized)
{ {
#ifdef WARNING #ifdef WARNING
if (pDrawable -> type == DRAWABLE_WINDOW && pSrcDrawable != pDrawable) if (pDrawable -> type == DRAWABLE_WINDOW && pSrcDrawable != pDrawable)
{
fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Trying to synchronize " fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Trying to synchronize "
"the clean drawable type [%d] at [%p] with source at [%p].\n", "the clean drawable type [%d] at [%p] with source at [%p].\n",
pDrawable -> type, (void *) pDrawable, (void *) pSrcDrawable); pDrawable -> type, (void *) pDrawable, (void *) pSrcDrawable);
}
#endif #endif
goto nxagentSynchronizeRegionStop; goto nxagentSynchronizeRegionStop;
...@@ -735,9 +768,6 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -735,9 +768,6 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentGetImage(pSrcDrawable, x, y, w, h, format, AllPlanes, data); nxagentGetImage(pSrcDrawable, x, y, w, h, format, AllPlanes, data);
nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth,
x, y, w, h, leftPad, format, data);
/* /*
* Going to unmark the synchronized * Going to unmark the synchronized
* region. * region.
...@@ -792,6 +822,13 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -792,6 +822,13 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentUnmarkCorruptedRegion(pDrawable, &tileRegion); nxagentUnmarkCorruptedRegion(pDrawable, &tileRegion);
} }
#ifdef TEST
else
{
fprintf(stderr, "nxagentSynchronizeRegion: Tile [%d,%d,%d,%d] on drawable [%p] doesn't match.\n",
x, y, x + w, y + h, (void *) pDrawable);
}
#endif
} }
else else
{ {
...@@ -822,6 +859,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -822,6 +859,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
} }
} }
/*
* Realize the image after comparing the
* source data with the bitmap data.
*/
nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth,
x, y, w, h, leftPad, format, data);
REGION_UNINIT(pDrawable -> pScreen, &tileRegion); REGION_UNINIT(pDrawable -> pScreen, &tileRegion);
#if !defined(COLLECTED_UPDATES) #if !defined(COLLECTED_UPDATES)
...@@ -2542,16 +2587,13 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2542,16 +2587,13 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
GCPtr pGC = NULL; GCPtr pGC = NULL;
RegionPtr pClipRegion = NullRegion; RegionPtr pClipRegion = NullRegion;
char *data = NULL;
int x, y; int x, y;
int w, h; int w, h;
int length, format;
int saveTrap; int saveTrap;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for drawable at [%p].\n", fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for [%s] at [%p].\n",
(void *) pDrawable); nxagentDrawableType(pDrawable), (void *) pDrawable);
#endif #endif
/* /*
...@@ -2613,7 +2655,10 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2613,7 +2655,10 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
* FIXME: A better way it would be create the bitmap * FIXME: A better way it would be create the bitmap
* with the same extents of the clipRegion. This * with the same extents of the clipRegion. This
* requires to save the offset with respect to the * requires to save the offset with respect to the
* drawable origin like in the backing store. * drawable origin like in the backing store. This
* becomes particularly important when the drawable
* is a huge window, because the pixmap creation
* would fail.
*/ */
pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth); pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth);
...@@ -2636,24 +2681,8 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2636,24 +2681,8 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1; w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1;
h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1; h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1;
data = nxagentAllocateImageData(w, h, pDrawable -> depth, &length, &format); nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y);
if (data == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentCreateDrawableBitmap: Cannot allocate memory for the bitmap data.\n");
#endif
nxagentDestroyPixmap(pBitmap);
goto nxagentCreateDrawableBitmapEnd;
}
nxagentGetImage(pDrawable, x, y, w, h, format, AllPlanes, data);
nxagentPutImage((DrawablePtr) pBitmap, pGC, pBitmap -> drawable.depth, x, y, w, h,
0, format, data);
REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion((DrawablePtr) pBitmap), REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion((DrawablePtr) pBitmap),
nxagentCorruptedRegion((DrawablePtr) pBitmap), pClipRegion); nxagentCorruptedRegion((DrawablePtr) pBitmap), pClipRegion);
...@@ -2695,11 +2724,6 @@ nxagentCreateDrawableBitmapEnd: ...@@ -2695,11 +2724,6 @@ nxagentCreateDrawableBitmapEnd:
nxagentFreeRegion(pDrawable, pClipRegion); nxagentFreeRegion(pDrawable, pClipRegion);
} }
if (data != NULL)
{
xfree(data);
}
if (pGC != NULL) if (pGC != NULL)
{ {
FreeScratchGC(pGC); FreeScratchGC(pGC);
...@@ -3075,6 +3099,16 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt ...@@ -3075,6 +3099,16 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt
REGION_INTERSECT(pWin -> pScreen, &expose, &expose, &pWin -> clipList); REGION_INTERSECT(pWin -> pScreen, &expose, &expose, &pWin -> clipList);
/*
* Reduce the overall region to expose.
*/
REGION_TRANSLATE(pWin -> pScreen, &expose, -pWin -> drawable.x, -pWin -> drawable.y);
REGION_SUBTRACT(pWin -> pScreen, pExpose, pExpose, &expose);
REGION_TRANSLATE(pWin -> pScreen, &expose, pWin -> drawable.x, pWin -> drawable.y);
miWindowExposures(pWin, &expose, &expose); miWindowExposures(pWin, &expose, &expose);
nxagentSendBackgroundExposeEnd: nxagentSendBackgroundExposeEnd:
......
...@@ -63,7 +63,13 @@ ...@@ -63,7 +63,13 @@
#include "NXproto.h" #include "NXproto.h"
#include "xfixesproto.h" #include "xfixesproto.h"
#define Window XlibWindow
#define Atom XlibAtom
#define Time XlibXID
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
#undef Window
#undef Atom
#undef Time
#ifdef NXAGENT_FIXKEYS #ifdef NXAGENT_FIXKEYS
#include "inputstr.h" #include "inputstr.h"
...@@ -113,6 +119,10 @@ extern int nxagentSplashCount; ...@@ -113,6 +119,10 @@ extern int nxagentSplashCount;
extern int nxagentLastClipboardClient; extern int nxagentLastClipboardClient;
#ifdef NX_DEBUG_INPUT
int nxagentDebugInput = 0;
#endif
#ifdef DEBUG #ifdef DEBUG
extern Bool nxagentRootlessTreesMatch(void); extern Bool nxagentRootlessTreesMatch(void);
#endif #endif
...@@ -172,6 +182,8 @@ static Cursor viewportCursor; ...@@ -172,6 +182,8 @@ static Cursor viewportCursor;
static Mask defaultEventMask; static Mask defaultEventMask;
static int lastEventSerial = 0;
#define MAX_INC 200 #define MAX_INC 200
#define INC_STEP 5 #define INC_STEP 5
#define nextinc(x) ((x) < MAX_INC ? (x) += INC_STEP : (x)) #define nextinc(x) ((x) < MAX_INC ? (x) += INC_STEP : (x))
...@@ -252,6 +264,13 @@ void nxagentRemoveDuplicatedKeys(XEvent *X); ...@@ -252,6 +264,13 @@ void nxagentRemoveDuplicatedKeys(XEvent *X);
void ProcessInputEvents() void ProcessInputEvents()
{ {
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessInputEvents: Processing input.\n");
}
#endif
mieqProcessInputEvents(); mieqProcessInputEvents();
} }
...@@ -282,6 +301,11 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen) ...@@ -282,6 +301,11 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentRRSetScreenConfig(pScreen, nxagentOption(Width), nxagentOption(Height)); nxagentRRSetScreenConfig(pScreen, nxagentOption(Width), nxagentOption(Height));
if (nxagentOption(ClientOs) == ClientOsWinnt)
{
NXSetExposeParameters(nxagentDisplay, 0, 0, 0);
}
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
} }
...@@ -771,8 +795,9 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -771,8 +795,9 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
} }
x.u.u.type = KeyRelease; x.u.u.type = KeyRelease;
x.u.u.detail = X.xkey.keycode; x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime + (X.xkey.time - nxagentLastServerTime); x.u.keyButtonPointer.time = nxagentLastKeyPressTime +
(X.xkey.time - nxagentLastServerTime);
nxagentLastServerTime = X.xkey.time; nxagentLastServerTime = X.xkey.time;
...@@ -794,8 +819,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -794,8 +819,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
} }
case ButtonPress: case ButtonPress:
{ {
#ifdef TEST #ifdef NX_DEBUG_INPUT
fprintf(stderr, "nxagentDispatchEvents: Going to handle new ButtonPress event.\n"); if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Going to handle new ButtonPress event.\n");
}
#endif #endif
nxagentInputEvent = 1; nxagentInputEvent = 1;
...@@ -860,6 +888,13 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -860,6 +888,13 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY); x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY);
} }
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Adding ButtonPress event.\n");
}
#endif
mieqEnqueue(&x); mieqEnqueue(&x);
CriticalOutputPending = 1; CriticalOutputPending = 1;
...@@ -887,8 +922,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -887,8 +922,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
} }
case ButtonRelease: case ButtonRelease:
{ {
#ifdef TEST #ifdef NX_DEBUG_INPUT
fprintf(stderr, "nxagentDispatchEvents: Going to handle new ButtonRelease event.\n"); if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Going to handle new ButtonRelease event.\n");
}
#endif #endif
nxagentInputEvent = 1; nxagentInputEvent = 1;
...@@ -923,6 +961,13 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -923,6 +961,13 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY); x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY);
} }
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Adding ButtonRelease event.\n");
}
#endif
mieqEnqueue(&x); mieqEnqueue(&x);
CriticalOutputPending = 1; CriticalOutputPending = 1;
...@@ -956,12 +1001,15 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -956,12 +1001,15 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
fprintf(stderr, "nxagentDispatchEvents: Going to handle new MotionNotify event.\n"); fprintf(stderr, "nxagentDispatchEvents: Going to handle new MotionNotify event.\n");
#endif #endif
#ifdef TEST #ifdef NX_DEBUG_INPUT
fprintf(stderr, "nxagentDispatchEvents: Handling motion notify window [%ld] root [%ld] child [%ld].\n", if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Handling motion notify window [%ld] root [%ld] child [%ld].\n",
X.xmotion.window, X.xmotion.root, X.xmotion.subwindow); X.xmotion.window, X.xmotion.root, X.xmotion.subwindow);
fprintf(stderr, "nxagentDispatchEvents: Pointer at [%d][%d] relative root [%d][%d].\n", fprintf(stderr, "nxagentDispatchEvents: Pointer at [%d][%d] relative root [%d][%d].\n",
X.xmotion.x, X.xmotion.y, X.xmotion.x_root, X.xmotion.y_root); X.xmotion.x, X.xmotion.y, X.xmotion.x_root, X.xmotion.y_root);
}
#endif #endif
x.u.u.type = MotionNotify; x.u.u.type = MotionNotify;
...@@ -975,18 +1023,17 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -975,18 +1023,17 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
nxagentLastEnteredWindow = pWin; nxagentLastEnteredWindow = pWin;
} }
if (nxagentPulldownDialogPid == 0 && (X.xmotion.y_root < if (nxagentPulldownDialogPid == 0 && nxagentLastEnteredTopLevelWindow &&
nxagentLastEnteredTopLevelWindow -> drawable.y + 4)) (X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4))
{ {
if (pWin && nxagentLastEnteredTopLevelWindow && if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 &&
nxagentClientIsDialog(wClient(pWin)) == 0 && nxagentLastEnteredTopLevelWindow -> parent == WindowTable[0] &&
nxagentLastEnteredTopLevelWindow -> parent == WindowTable[0] && nxagentLastEnteredTopLevelWindow -> overrideRedirect == False &&
nxagentLastEnteredTopLevelWindow -> overrideRedirect == False && X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x +
X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) &&
(nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) && X.xmotion.x_root < (nxagentLastEnteredTopLevelWindow -> drawable.x +
X.xmotion.x_root < (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) + 50) &&
(nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) + 50) && nxagentOption(Menu) == 1)
nxagentOption(Menu) == 1)
{ {
nxagentPulldownDialog(nxagentLastEnteredTopLevelWindow -> drawable.id); nxagentPulldownDialog(nxagentLastEnteredTopLevelWindow -> drawable.id);
} }
...@@ -1008,6 +1055,14 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -1008,6 +1055,14 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
X.xmotion.window == nxagentDefaultWindows[pScreen -> myNum] X.xmotion.window == nxagentDefaultWindows[pScreen -> myNum]
&& X.xmotion.subwindow == None)) && X.xmotion.subwindow == None))
{ {
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "nxagentDispatchEvents: Adding motion event [%d, %d] to the queue.\n",
x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY);
}
#endif
mieqEnqueue(&x); mieqEnqueue(&x);
} }
...@@ -1644,6 +1699,21 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -1644,6 +1699,21 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
} /* End of switch (X.type) */ } /* End of switch (X.type) */
if (X.xany.serial < lastEventSerial)
{
/*
* Start over.
*/
nxagentDeleteStaticResizedWindow(0);
}
else
{
nxagentDeleteStaticResizedWindow(X.xany.serial - 1);
}
lastEventSerial = X.xany.serial;
} /* End of while (...) */ } /* End of while (...) */
/* /*
...@@ -1848,8 +1918,9 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) ...@@ -1848,8 +1918,9 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis(); nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
x.u.u.type = KeyPress; x.u.u.type = KeyPress;
x.u.u.detail = X -> xkey.keycode; x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime; x.u.keyButtonPointer.time = nxagentLastKeyPressTime;
nxagentLastServerTime = X -> xkey.time; nxagentLastServerTime = X -> xkey.time;
...@@ -1914,6 +1985,8 @@ int nxagentHandleExposeEvent(XEvent *X) ...@@ -1914,6 +1985,8 @@ int nxagentHandleExposeEvent(XEvent *X)
int index = 0; int index = 0;
int overlap = 0; int overlap = 0;
StaticResizedWindowStruct *resizedWinPtr = NULL;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentHandleExposeEvent: Checking remote expose events.\n"); fprintf(stderr, "nxagentHandleExposeEvent: Checking remote expose events.\n");
#endif #endif
...@@ -1944,6 +2017,19 @@ FIXME: This can be maybe optimized by consuming the ...@@ -1944,6 +2017,19 @@ FIXME: This can be maybe optimized by consuming the
box.x1 = pWin -> drawable.x + wBorderWidth(pWin) + X -> xexpose.x; box.x1 = pWin -> drawable.x + wBorderWidth(pWin) + X -> xexpose.x;
box.y1 = pWin -> drawable.y + wBorderWidth(pWin) + X -> xexpose.y; box.y1 = pWin -> drawable.y + wBorderWidth(pWin) + X -> xexpose.y;
resizedWinPtr = nxagentFindStaticResizedWindow(X -> xany.serial);
while (resizedWinPtr)
{
if (resizedWinPtr -> pWin == pWin)
{
box.x1 += resizedWinPtr -> offX;
box.y1 += resizedWinPtr -> offY;
}
resizedWinPtr = resizedWinPtr -> prev;
}
box.x2 = box.x1 + X -> xexpose.width; box.x2 = box.x1 + X -> xexpose.width;
box.y2 = box.y1 + X -> xexpose.height; box.y2 = box.y1 + X -> xexpose.height;
...@@ -3913,3 +3999,27 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm) ...@@ -3913,3 +3999,27 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm)
return 1; return 1;
} }
#ifdef NX_DEBUG_INPUT
void nxagentDumpInputInfo(void)
{
fprintf(stderr, "Dumping input info ON.\n");
}
void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data)
{
if (strcmp(validateString(NameForAtom(property)), "NX_DEBUG_INPUT") == 0)
{
if (*data != 0)
{
nxagentDebugInput = 1;
}
else
{
nxagentDebugInput = 0;
}
}
}
#endif
...@@ -65,26 +65,34 @@ is" without express or implied warranty. ...@@ -65,26 +65,34 @@ is" without express or implied warranty.
#define NXAGENT_ALTERNATE_FONT_DIR "/usr/share/X11/fonts" #define NXAGENT_ALTERNATE_FONT_DIR "/usr/share/X11/fonts"
#define NXAGENT_ALTERNATE_FONT_DIR_2 "/usr/share/fonts/X11" #define NXAGENT_ALTERNATE_FONT_DIR_2 "/usr/share/fonts/X11"
#define NXAGENT_ALTERNATE_FONT_DIR_3 "/usr/share/fonts" #define NXAGENT_ALTERNATE_FONT_DIR_3 "/usr/share/fonts"
#define NXAGENT_ALTERNATE_FONT_DIR_4 "/usr/NX/share/fonts"
#define NXAGENT_DEFAULT_FONT_PATH \ #define NXAGENT_DEFAULT_FONT_PATH \
"/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,\ "/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,\
/usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,\ /usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,\
/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/TTF/" /usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/TTF/,\
/usr/NX/share/fonts/base"
#define NXAGENT_ALTERNATE_FONT_PATH \ #define NXAGENT_ALTERNATE_FONT_PATH \
"/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Speedo/,\ "/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Speedo/,\
/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,\ /usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,\
/usr/share/X11/fonts/100dpi/,/usr/share/X11/fonts/TTF/" /usr/share/X11/fonts/100dpi/,/usr/share/X11/fonts/TTF/,\
/usr/NX/share/fonts/base"
#define NXAGENT_ALTERNATE_FONT_PATH_2 \ #define NXAGENT_ALTERNATE_FONT_PATH_2 \
"/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Speedo/,\ "/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Speedo/,\
/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,\ /usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,\
/usr/share/fonts/X11/100dpi/,/usr/share/fonts/X11/TTF/" /usr/share/fonts/X11/100dpi/,/usr/share/fonts/X11/TTF/,\
/usr/NX/share/fonts/base"
#define NXAGENT_ALTERNATE_FONT_PATH_3 \ #define NXAGENT_ALTERNATE_FONT_PATH_3 \
"/usr/share/fonts/misc/,/usr/share/fonts/Speedo/,\ "/usr/share/fonts/misc/,/usr/share/fonts/Speedo/,\
/usr/share/fonts/Type1/,/usr/share/fonts/75dpi/,\ /usr/share/fonts/Type1/,/usr/share/fonts/75dpi/,\
/usr/share/fonts/100dpi/,/usr/share/fonts/TTF/" /usr/share/fonts/100dpi/,/usr/share/fonts/TTF/,\
/usr/NX/share/fonts/base"
#define NXAGENT_ALTERNATE_FONT_PATH_4 \
"/usr/NX/share/fonts/base"
#undef NXAGENT_FONTCACHE_DEBUG #undef NXAGENT_FONTCACHE_DEBUG
#undef NXAGENT_RECONNECT_FONT_DEBUG #undef NXAGENT_RECONNECT_FONT_DEBUG
...@@ -101,6 +109,8 @@ static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName ...@@ -101,6 +109,8 @@ static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName
int nxagentFreeFont(XFontStruct *fs); int nxagentFreeFont(XFontStruct *fs);
static Bool nxagentGetFontServerPath(char * fontServerPath); static Bool nxagentGetFontServerPath(char * fontServerPath);
static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution);
RESTYPE RT_NX_FONT; RESTYPE RT_NX_FONT;
#ifdef NXAGENT_RECONNECT_FONT_DEBUG #ifdef NXAGENT_RECONNECT_FONT_DEBUG
...@@ -419,13 +429,59 @@ Bool nxagentFontFind(const char *name, int *pos) ...@@ -419,13 +429,59 @@ Bool nxagentFontFind(const char *name, int *pos)
Bool nxagentFontLookUp(const char *name) Bool nxagentFontLookUp(const char *name)
{ {
int i; int i;
if (name) int result;
if (!strlen(name))
return 0; char *scalable;
if (nxagentFontFind(name, &i))
return (nxagentRemoteFontList.list[i]->status > 0); if (name != NULL && strlen(name) == 0)
else {
return 0; return 0;
}
result = nxagentFontFind(name, &i);
scalable = NULL;
/*
* Let's try with the scalable font description.
*/
if (result == 0)
{
scalable = nxagentMakeScalableFontName(name, 0);
if (scalable != NULL)
{
result = nxagentFontFind(scalable, &i);
free(scalable);
}
}
/*
* Let's try again after replacing zero to xdpi and ydpi in the pattern.
*/
if (result == 0)
{
scalable = nxagentMakeScalableFontName(name, 1);
if (scalable != NULL)
{
result = nxagentFontFind(scalable, &i);
free(scalable);
}
}
if (result == 0)
{
return 0;
}
else
{
return (nxagentRemoteFontList.list[i]->status > 0);
}
} }
Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
...@@ -700,7 +756,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP ...@@ -700,7 +756,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
substFontBuf = (char *) xalloc(sizeof(char) * 512); substFontBuf = (char *) xalloc(sizeof(char) * 512);
numFontFields = nxagentSplitString(fontName, fontNameFields, FIELDS, "-"); numFontFields = nxagentSplitString(fontName, fontNameFields, FIELDS + 1, "-");
memcpy(substFontBuf, "fixed\0", strlen("fixed") + 1); memcpy(substFontBuf, "fixed\0", strlen("fixed") + 1);
...@@ -1505,6 +1561,31 @@ void nxagentVerifyDefaultFontPath(void) ...@@ -1505,6 +1561,31 @@ void nxagentVerifyDefaultFontPath(void)
strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_3); strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_3);
} }
if (stat(NXAGENT_ALTERNATE_FONT_DIR_4, &dirStat) == 0 &&
S_ISDIR(dirStat.st_mode) != 0)
{
/*
* Let's use the "/usr/NX/share/fonts" path.
*/
#ifdef TEST
fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n",
validateString(NXAGENT_ALTERNATE_FONT_DIR_4));
#endif
if (*fontPath != '\0')
{
fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_4) + 2);
strcat(fontPath, ",");
}
else
{
fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_4) + 1);
}
strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_4);
}
if (*fontPath == '\0') if (*fontPath == '\0')
{ {
#ifdef WARNING #ifdef WARNING
...@@ -1698,3 +1779,88 @@ int nxagentSplitString(char *string, char *fields[], int nfields, char *sep) ...@@ -1698,3 +1779,88 @@ int nxagentSplitString(char *string, char *fields[], int nfields, char *sep)
return i; return i;
} }
char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
{
char *scalableFontName;
const char *s;
int len;
int field;
len = strlen(fontName) + 1;
scalableFontName = malloc(len);
if (scalableFontName == NULL)
{
#ifdef PANIC
fprintf(stderr, "nxagentMakeScalableFontName: PANIC! malloc() failed.\n");
#endif
return NULL;
}
scalableFontName[0] = 0;
if (*fontName != '-')
{
goto MakeScalableFontNameError;
}
s = fontName;
field = 0;
while (s != NULL)
{
s = strchr(s + 1, '-');
if (s != NULL)
{
if (field == 6 || field == 7 || field == 11)
{
/*
* PIXEL_SIZE || POINT_SIZE || AVERAGE_WIDTH
*/
strcat(scalableFontName, "-0");
}
else if (scalableResolution == 1 && (field == 8 || field == 9))
{
/*
* RESOLUTION_X || RESOLUTION_Y
*/
strcat(scalableFontName, "-0");
}
else
{
strncat(scalableFontName, fontName, s - fontName);
}
fontName = s;
}
else
{
strcat(scalableFontName, fontName);
}
field++;
}
if (field != 14)
{
goto MakeScalableFontNameError;
}
return scalableFontName;
MakeScalableFontNameError:
free(scalableFontName);
#ifdef DEBUG
fprintf(stderr, "nxagentMakeScalableFontName: Invalid font name.\n");
#endif
return NULL;
}
...@@ -205,6 +205,7 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \ ...@@ -205,6 +205,7 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \
-DNXAGENT_ONSTART \ -DNXAGENT_ONSTART \
-DNXAGENT_SPLASH \ -DNXAGENT_SPLASH \
-DNXAGENT_ARTSD \ -DNXAGENT_ARTSD \
-UNX_DEBUG_INPUT \
-UPANORAMIX -UPANORAMIX
all:: $(OBJS) all:: $(OBJS)
......
...@@ -74,7 +74,7 @@ is" without express or implied warranty. ...@@ -74,7 +74,7 @@ is" without express or implied warranty.
#undef DEBUG #undef DEBUG
#undef DUMP #undef DUMP
#define NXAGENT_VERSION "3.2.0" #define NXAGENT_VERSION "3.3.0"
/* /*
* ProcVector array defined in tables.c. * ProcVector array defined in tables.c.
......
...@@ -109,6 +109,10 @@ void nxagentEnableXkbExtension(void); ...@@ -109,6 +109,10 @@ void nxagentEnableXkbExtension(void);
void nxagentTuneXkbWrapper(void); void nxagentTuneXkbWrapper(void);
void nxagentResetKeycodeConversion(void);
#endif #endif
CARD8 nxagentConvertKeycode(CARD8 k);
#endif /* __Keyboard_H__ */ #endif /* __Keyboard_H__ */
...@@ -547,28 +547,29 @@ Bool nxagentReconnectSession(void) ...@@ -547,28 +547,29 @@ Bool nxagentReconnectSession(void)
goto nxagentReconnectError; goto nxagentReconnectError;
} }
if (nxagentOption(ResetKeyboardAtResume)) if (nxagentOption(ResetKeyboardAtResume) == 1 &&
(nxagentKeyboard == NULL || nxagentOldKeyboard == NULL ||
strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
strcmp(nxagentKeyboard, "query") == 0))
{ {
if (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || if (nxagentResetKeyboard() == 0)
strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
strcmp(nxagentKeyboard, "query") == 0)
{ {
#ifdef WARNING
if (nxagentResetKeyboard() == 0) if (nxagentVerbose == 1)
{ {
#ifdef WARNING fprintf(stderr, "nxagentReconnect: Failed to reset keyboard device.\n");
if (nxagentVerbose == 1) }
{ #endif
fprintf(stderr, "nxagentReconnect: Failed to reset keyboard device.\n");
}
#endif
failedStep = WINDOW_STEP; failedStep = WINDOW_STEP;
goto nxagentReconnectError; goto nxagentReconnectError;
}
} }
} }
else
{
nxagentResetKeycodeConversion();
}
nxagentXkbState.Initialized = 0; nxagentXkbState.Initialized = 0;
......
...@@ -2270,8 +2270,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, ...@@ -2270,8 +2270,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
normalizedImages = NULL; normalizedImages = NULL;
if (glyphDepths[glyphSet -> fdepth] == 1 && if (sizeImages > 0)
nxagentServerOrder() != BitmapBitOrder(nxagentDisplay))
{ {
normalizedImages = xalloc(sizeImages); normalizedImages = xalloc(sizeImages);
...@@ -2279,7 +2278,11 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, ...@@ -2279,7 +2278,11 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
{ {
memcpy(normalizedImages, images, sizeImages); memcpy(normalizedImages, images, sizeImages);
BitOrderInvert ((unsigned char *) normalizedImages, sizeImages); if (glyphDepths[glyphSet -> fdepth] == 1 &&
nxagentServerOrder() != BitmapBitOrder(nxagentDisplay))
{
BitOrderInvert ((unsigned char *) normalizedImages, sizeImages);
}
} }
else else
{ {
......
...@@ -46,6 +46,20 @@ ...@@ -46,6 +46,20 @@
* initialized. * initialized.
*/ */
typedef struct
{
CARD32 flags;
CARD32 input;
CARD32 initial_state;
CARD32 icon_pixmap;
CARD32 icon_window;
INT32 icon_x;
INT32 icon_y;
CARD32 icon_mask;
CARD32 window_group;
}
nxagentWMHints;
WindowPtr nxagentRootlessWindow = NULL; WindowPtr nxagentRootlessWindow = NULL;
#define TOP_LEVEL_TABLE_UNIT 100 #define TOP_LEVEL_TABLE_UNIT 100
...@@ -414,7 +428,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -414,7 +428,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
char *propertyS, *typeS; char *propertyS, *typeS;
Atom propertyX, typeX; Atom propertyX, typeX;
char *output = NULL; char *output = NULL;
XWMHints wmHints; nxagentWMHints wmHints;
Bool export = False; Bool export = False;
Bool freeMem = False; Bool freeMem = False;
...@@ -470,7 +484,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -470,7 +484,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
else if (strcmp(typeS, "WM_HINTS") == 0) else if (strcmp(typeS, "WM_HINTS") == 0)
{ {
ClientPtr pClient = wClient(pWin); ClientPtr pClient = wClient(pWin);
wmHints = *(XWMHints*)value; wmHints = *(nxagentWMHints*)value;
wmHints.flags |= InputHint; wmHints.flags |= InputHint;
wmHints.input = True; wmHints.input = True;
...@@ -497,9 +511,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -497,9 +511,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
wmHints.flags &= ~IconPixmapHint; wmHints.flags &= ~IconPixmapHint;
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %lx from hint " fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %x from hint "
"exporting property %s type %s on window %p.\n", "exporting property %s type %s on window %p.\n",
wmHints.icon_pixmap, propertyS, typeS, (void*)pWin); (unsigned int) wmHints.icon_pixmap, propertyS, typeS,
(void*)pWin);
#endif #endif
} }
} }
...@@ -518,9 +533,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -518,9 +533,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
wmHints.flags &= ~IconWindowHint; wmHints.flags &= ~IconWindowHint;
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %lx from hint " fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %x from hint "
"exporting property %s type %s on window %p.\n", "exporting property %s type %s on window %p.\n",
wmHints.icon_window, propertyS, typeS, (void*)pWin); (unsigned int) wmHints.icon_window, propertyS, typeS,
(void*)pWin);
#endif #endif
} }
} }
...@@ -539,9 +555,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -539,9 +555,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
wmHints.flags &= ~IconMaskHint; wmHints.flags &= ~IconMaskHint;
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %lx from hint " fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %x from hint "
"exporting property %s type %s on window %p.\n", "exporting property %s type %s on window %p.\n",
wmHints.icon_mask, propertyS, typeS, (void*)pWin); (unsigned int) wmHints.icon_mask, propertyS, typeS,
(void*)pWin);
#endif #endif
} }
} }
...@@ -560,9 +577,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -560,9 +577,10 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
wmHints.flags &= ~WindowGroupHint; wmHints.flags &= ~WindowGroupHint;
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %lx from hint " fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %x from hint "
"exporting property %s type %s on window %p.\n", "exporting property %s type %s on window %p.\n",
wmHints.window_group, propertyS, typeS, (void*)pWin); (unsigned int) wmHints.window_group, propertyS, typeS,
(void*)pWin);
#endif #endif
} }
} }
...@@ -654,7 +672,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) ...@@ -654,7 +672,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty " fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty "
"on %swindow %lx property %s type %s nUnits %ld format %d\n", "on %swindow %x property %s type %s nUnits %ld format %d\n",
nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindowTopLevel(pWin) ? "toplevel " : "",
nxagentWindow(pWin), validateString(propertyS), validateString(typeS), nxagentWindow(pWin), validateString(propertyS), validateString(typeS),
nUnits, format); nUnits, format);
...@@ -683,7 +701,7 @@ void nxagentImportProperty(Window window, ...@@ -683,7 +701,7 @@ void nxagentImportProperty(Window window,
WindowPtr pWin; WindowPtr pWin;
Bool import = False; Bool import = False;
Bool freeMem = False; Bool freeMem = False;
XWMHints wmHints; nxagentWMHints wmHints;
typedef struct { typedef struct {
CARD32 state; CARD32 state;
...@@ -797,7 +815,7 @@ void nxagentImportProperty(Window window, ...@@ -797,7 +815,7 @@ void nxagentImportProperty(Window window,
} }
else if (strcmp(typeS, "WM_HINTS") == 0) else if (strcmp(typeS, "WM_HINTS") == 0)
{ {
wmHints = *(XWMHints*)buffer; wmHints = *(nxagentWMHints*)buffer;
output = (char*) &wmHints; output = (char*) &wmHints;
import = True; import = True;
...@@ -815,8 +833,9 @@ void nxagentImportProperty(Window window, ...@@ -815,8 +833,9 @@ void nxagentImportProperty(Window window,
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon " fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon "
"pixmap %ld from hint importing property [%ld] type %s on window %p.\n", "pixmap %d from hint importing property [%ld] type %s on window %p.\n",
wmHints.icon_pixmap, (long int) property, typeS, (void *) pWin); (unsigned int) wmHints.icon_pixmap, (long int) property,
typeS, (void *) pWin);
#endif #endif
} }
} }
...@@ -835,8 +854,9 @@ void nxagentImportProperty(Window window, ...@@ -835,8 +854,9 @@ void nxagentImportProperty(Window window,
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagenImportProperty: WARNING! Failed to look up remote icon " fprintf(stderr, "nxagenImportProperty: WARNING! Failed to look up remote icon "
"window %lx from hint importing property [%ld] type %s on window %p.\n", "window %x from hint importing property [%ld] type %s on window %p.\n",
wmHints.icon_window, (long int) property, typeS, (void *) pWin); (unsigned int) wmHints.icon_window,
(long int) property, typeS, (void *) pWin);
#endif #endif
} }
} }
...@@ -855,8 +875,8 @@ void nxagentImportProperty(Window window, ...@@ -855,8 +875,8 @@ void nxagentImportProperty(Window window,
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon " fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon "
"mask %lx from hint importing property [%ld] type %s on window %p.\n", "mask %x from hint importing property [%ld] type %s on window %p.\n",
wmHints.icon_mask, (long int) property, typeS, (void *) pWin); (unsigned int) wmHints.icon_mask, (long int) property, typeS, (void *) pWin);
#endif #endif
} }
} }
...@@ -875,8 +895,9 @@ void nxagentImportProperty(Window window, ...@@ -875,8 +895,9 @@ void nxagentImportProperty(Window window,
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window " fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window "
"group %lx from hint importing property [%ld] type %s on window %p.\n", "group %x from hint importing property [%ld] type %s on window %p.\n",
wmHints.window_group, (long int) property, typeS, (void *) pWin); (unsigned int) wmHints.window_group,
(long int) property, typeS, (void *) pWin);
#endif #endif
} }
} }
......
...@@ -958,7 +958,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, ...@@ -958,7 +958,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
nxagentChangeOption(Fullscreen, True); nxagentChangeOption(Fullscreen, True);
if (nxagentOption(ClientOs) == ClientOsWinnt) if (nxagentOption(ClientOs) == ClientOsWinnt &&
(nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup))
{ {
NXSetExposeParameters(nxagentDisplay, 0, 0, 0); NXSetExposeParameters(nxagentDisplay, 0, 0, 0);
} }
......
...@@ -1136,6 +1136,11 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1136,6 +1136,11 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
{ {
unsigned int valuemask; unsigned int valuemask;
XWindowChanges values; XWindowChanges values;
int offX, offY;
int i, j;
offX = nxagentWindowPriv(pWin)->x - pWin->origin.x;
offY = nxagentWindowPriv(pWin)->y - pWin->origin.y;
if (nxagentScreenTrap == 1) if (nxagentScreenTrap == 1)
{ {
...@@ -1221,6 +1226,29 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1221,6 +1226,29 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
(void *) pWin, nxagentWindow(pWin), valuemask); (void *) pWin, nxagentWindow(pWin), valuemask);
#endif #endif
if (pWin->bitGravity == StaticGravity &&
((mask & CWX) || (mask & CWY)) &&
((mask & CWWidth) || (mask & CWHeight)))
{
#ifdef TEST
fprintf(stderr, "nxagentConfigureWindow: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n",
offX, offY);
#endif
nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY);
for (j = 0; j < nxagentExposeQueue.length; j++)
{
i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
if (nxagentExposeQueue.exposures[i].pWindow == pWin &&
nxagentExposeQueue.exposures[i].remoteRegion != NullRegion)
{
REGION_TRANSLATE(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[i].remoteRegion, offX, offY);
}
}
}
XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), valuemask, &values); XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), valuemask, &values);
MAKE_SYNC_CONFIGURE_WINDOW; MAKE_SYNC_CONFIGURE_WINDOW;
...@@ -3424,6 +3452,105 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) ...@@ -3424,6 +3452,105 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
return; return;
} }
void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int offX, int offY)
{
if (nxagentStaticResizedWindowList == NULL)
{
nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct));
nxagentStaticResizedWindowList -> next = NULL;
nxagentStaticResizedWindowList -> prev = NULL;
}
else
{
StaticResizedWindowStruct *tmp;
tmp = malloc(sizeof(StaticResizedWindowStruct));
tmp -> next = nxagentStaticResizedWindowList;
nxagentStaticResizedWindowList -> prev = tmp;
tmp -> prev = NULL;
nxagentStaticResizedWindowList = tmp;
}
nxagentStaticResizedWindowList -> pWin = pWin;
nxagentStaticResizedWindowList -> sequence = sequence;
nxagentStaticResizedWindowList -> offX = offX;
nxagentStaticResizedWindowList -> offY = offY;
}
void nxagentDeleteStaticResizedWindow(unsigned long sequence)
{
StaticResizedWindowStruct *index, *previous, *tmp;
index = nxagentStaticResizedWindowList;
while (index)
{
if (index -> sequence <= sequence)
{
if (index -> prev == NULL && index -> next == NULL)
{
free(nxagentStaticResizedWindowList);
nxagentStaticResizedWindowList = NULL;
return;
}
else if (index -> prev == NULL)
{
tmp = nxagentStaticResizedWindowList;
index = nxagentStaticResizedWindowList = tmp -> next;
free(tmp);
nxagentStaticResizedWindowList -> prev = NULL;
continue;
}
else if (index -> next == NULL)
{
tmp = index;
index = index -> prev;
free(tmp);
index -> next = NULL;
return;
}
previous = index -> prev;
tmp = index;
index = index -> next;
previous -> next = index;
index -> prev = previous;
free(tmp);
continue;
}
index = index -> next;
}
return;
}
StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence)
{
StaticResizedWindowStruct *index;
StaticResizedWindowStruct *ret = NULL;
if (nxagentStaticResizedWindowList == NULL)
{
return NULL;
}
index = nxagentStaticResizedWindowList;
while (index && index -> sequence > sequence)
{
ret = index;
index = index -> next;
}
return ret;
}
void nxagentEmptyBackingStoreRegion(pointer param0, XID param1, pointer data_buffer) void nxagentEmptyBackingStoreRegion(pointer param0, XID param1, pointer data_buffer)
{ {
WindowPtr pWin = (WindowPtr) param0; WindowPtr pWin = (WindowPtr) param0;
......
...@@ -287,6 +287,18 @@ typedef struct _ConfiguredWindow ...@@ -287,6 +287,18 @@ typedef struct _ConfiguredWindow
ConfiguredWindowStruct *nxagentConfiguredWindowList; ConfiguredWindowStruct *nxagentConfiguredWindowList;
typedef struct _StaticResizedWindow
{
WindowPtr pWin;
struct _StaticResizedWindow *next;
struct _StaticResizedWindow *prev;
unsigned long sequence;
int offX;
int offY;
} StaticResizedWindowStruct;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
void nxagentFlushConfigureWindow(void); void nxagentFlushConfigureWindow(void);
...@@ -295,6 +307,12 @@ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask); ...@@ -295,6 +307,12 @@ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask);
void nxagentDeleteConfiguredWindow(WindowPtr pWin); void nxagentDeleteConfiguredWindow(WindowPtr pWin);
void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int offX, int offY);
void nxagentDeleteStaticResizedWindow(unsigned long sequence);
StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence);
void nxagentEmptyAllBackingStoreRegions(void); void nxagentEmptyAllBackingStoreRegions(void);
#endif /* __Window_H__ */ #endif /* __Window_H__ */
...@@ -189,6 +189,10 @@ xEvent *xeviexE; ...@@ -189,6 +189,10 @@ xEvent *xeviexE;
#include "Windows.h" #include "Windows.h"
#include "Args.h" #include "Args.h"
#ifdef NX_DEBUG_INPUT
extern int nxagentDebugInput;
#endif
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
extern WindowPtr nxagentLastEnteredWindow; extern WindowPtr nxagentLastEnteredWindow;
...@@ -1682,11 +1686,28 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1682,11 +1686,28 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
int i; int i;
int type; int type;
#ifdef DEBUG #ifdef NX_DEBUG_INPUT
if (grab && nxagentDebugInput && grab->window)
{
fprintf(stderr, "TryClientEvents: Grab window is [0x%x].\n",
(unsigned int)grab->window->drawable.id);
if (!SameClient(grab, client))
fprintf(stderr, "TryClientEvents: Events are going to be "
"discarded.\n");
}
#endif
#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, "Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, (unsigned int)mask,
client->index);
#else
if (debug_events) ErrorF( if (debug_events) ErrorF(
"Event([%d, %d], mask=0x%x), client=%d", "Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif #endif
#endif
if ((client) && (client != serverClient) && (!client->clientGone) && if ((client) && (client != serverClient) && (!client->clientGone) &&
((filter == CantBeFiltered) || (mask & filter))) ((filter == CantBeFiltered) || (mask & filter)))
{ {
...@@ -1700,10 +1721,17 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1700,10 +1721,17 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
if (WID(inputInfo.pointer->valuator->motionHintWindow) == if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event) pEvents->u.keyButtonPointer.event)
{ {
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr,"\nmotionHintWindow == keyButtonPointer.event\n");
}
#else
if (debug_events) ErrorF("\n"); if (debug_events) ErrorF("\n");
fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n"); fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#endif #endif
#endif
return 1; /* don't send, but pretend we did */ return 1; /* don't send, but pretend we did */
} }
pEvents->u.u.detail = NotifyHint; pEvents->u.u.detail = NotifyHint;
...@@ -1740,16 +1768,26 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1740,16 +1768,26 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
} }
WriteEventsToClient(client, count, pEvents); WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, " delivered\n");
#else
if (debug_events) ErrorF( " delivered\n"); if (debug_events) ErrorF( " delivered\n");
#endif #endif
#endif
return 1; return 1;
} }
else else
{ {
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, "\n");
#else
if (debug_events) ErrorF("\n"); if (debug_events) ErrorF("\n");
#endif #endif
#endif
return 0; return 0;
} }
} }
...@@ -3116,6 +3154,12 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3116,6 +3154,12 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
xevieEventSent = 0; xevieEventSent = 0;
else { else {
xeviemouse = mouse; xeviemouse = mouse;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to send XEVIE event.\n");
}
#endif
WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE); WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
return; return;
} }
...@@ -3170,14 +3214,38 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3170,14 +3214,38 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
#if !defined(XFree86Server) || !defined(XINPUT) #if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key]; xE->u.u.detail = butc->map[key];
#endif #endif
#ifdef NX_DEBUG_INPUT
if (xE->u.u.detail == 0)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
" for ButtonPress.\n");
}
return;
}
#else
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
return; return;
#endif
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
butc->state |= (Button1Mask >> 1) << xE->u.u.detail; butc->state |= (Button1Mask >> 1) << xE->u.u.detail;
filters[MotionNotify] = Motion_Filter(butc); filters[MotionNotify] = Motion_Filter(butc);
if (!grab) if (!grab)
#ifdef NX_DEBUG_INPUT
if (CheckDeviceGrabs(mouse, xE, 0, count))
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: CheckDeviceGrabs"
" returned True for ButtonPress.\n");
}
return;
}
#else
if (CheckDeviceGrabs(mouse, xE, 0, count)) if (CheckDeviceGrabs(mouse, xE, 0, count))
return; return;
#endif
break; break;
case ButtonRelease: case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow; mouse->valuator->motionHintWindow = NullWindow;
...@@ -3189,8 +3257,20 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3189,8 +3257,20 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
#if !defined(XFree86Server) || !defined(XINPUT) #if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key]; xE->u.u.detail = butc->map[key];
#endif #endif
#ifdef NX_DEBUG_INPUT
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
" for ButtonRelease.\n");
}
return; return;
}
#else
if (xE->u.u.detail == 0)
return;
#endif
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail); butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
filters[MotionNotify] = Motion_Filter(butc); filters[MotionNotify] = Motion_Filter(butc);
...@@ -3201,6 +3281,36 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3201,6 +3281,36 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
FatalError("bogus pointer event from ddx"); FatalError("bogus pointer event from ddx");
} }
} }
#ifdef NX_DEBUG_INPUT
else if (!CheckMotion(xE))
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: CheckMotion returned False"
" for MotionNotify.\n");
}
return;
}
if (grab)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to deliver grabbed "
"events (count = %d).\n", count);
}
DeliverGrabbedEvent(xE, mouse, deactivateGrab, count);
}
else
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to deliver device "
"events (count = %d).\n", count);
}
DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
mouse, count);
}
#else
else if (!CheckMotion(xE)) else if (!CheckMotion(xE))
return; return;
if (grab) if (grab)
...@@ -3208,6 +3318,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3208,6 +3318,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
else else
DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow, DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
mouse, count); mouse, count);
#endif
if (deactivateGrab) if (deactivateGrab)
(*mouse->DeactivateGrab)(mouse); (*mouse->DeactivateGrab)(mouse);
} }
......
...@@ -189,6 +189,10 @@ xEvent *xeviexE; ...@@ -189,6 +189,10 @@ xEvent *xeviexE;
#include "Windows.h" #include "Windows.h"
#include "Args.h" #include "Args.h"
#ifdef NX_DEBUG_INPUT
extern int nxagentDebugInput;
#endif
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
extern WindowPtr nxagentLastEnteredWindow; extern WindowPtr nxagentLastEnteredWindow;
...@@ -1682,11 +1686,28 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1682,11 +1686,28 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
int i; int i;
int type; int type;
#ifdef DEBUG #ifdef NX_DEBUG_INPUT
if (grab && nxagentDebugInput && grab->window)
{
fprintf(stderr, "TryClientEvents: Grab window is [0x%x].\n",
(unsigned int)grab->window->drawable.id);
if (!SameClient(grab, client))
fprintf(stderr, "TryClientEvents: Events are going to be "
"discarded.\n");
}
#endif
#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, "Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, (unsigned int)mask,
client->index);
#else
if (debug_events) ErrorF( if (debug_events) ErrorF(
"Event([%d, %d], mask=0x%x), client=%d", "Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif #endif
#endif
if ((client) && (client != serverClient) && (!client->clientGone) && if ((client) && (client != serverClient) && (!client->clientGone) &&
((filter == CantBeFiltered) || (mask & filter))) ((filter == CantBeFiltered) || (mask & filter)))
{ {
...@@ -1700,10 +1721,17 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1700,10 +1721,17 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
if (WID(inputInfo.pointer->valuator->motionHintWindow) == if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event) pEvents->u.keyButtonPointer.event)
{ {
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr,"\nmotionHintWindow == keyButtonPointer.event\n");
}
#else
if (debug_events) ErrorF("\n"); if (debug_events) ErrorF("\n");
fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n"); fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#endif #endif
#endif
return 1; /* don't send, but pretend we did */ return 1; /* don't send, but pretend we did */
} }
pEvents->u.u.detail = NotifyHint; pEvents->u.u.detail = NotifyHint;
...@@ -1740,16 +1768,26 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, ...@@ -1740,16 +1768,26 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
} }
WriteEventsToClient(client, count, pEvents); WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, " delivered\n");
#else
if (debug_events) ErrorF( " delivered\n"); if (debug_events) ErrorF( " delivered\n");
#endif #endif
#endif
return 1; return 1;
} }
else else
{ {
#ifdef DEBUG #if defined(DEBUG) || defined(NX_DEBUG_INPUT)
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
fprintf(stderr, "\n");
#else
if (debug_events) ErrorF("\n"); if (debug_events) ErrorF("\n");
#endif #endif
#endif
return 0; return 0;
} }
} }
...@@ -3116,6 +3154,12 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3116,6 +3154,12 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
xevieEventSent = 0; xevieEventSent = 0;
else { else {
xeviemouse = mouse; xeviemouse = mouse;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to send XEVIE event.\n");
}
#endif
WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE); WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
return; return;
} }
...@@ -3170,14 +3214,38 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3170,14 +3214,38 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
#if !defined(XFree86Server) || !defined(XINPUT) #if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key]; xE->u.u.detail = butc->map[key];
#endif #endif
#ifdef NX_DEBUG_INPUT
if (xE->u.u.detail == 0)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
" for ButtonPress.\n");
}
return;
}
#else
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
return; return;
#endif
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
butc->state |= (Button1Mask >> 1) << xE->u.u.detail; butc->state |= (Button1Mask >> 1) << xE->u.u.detail;
filters[MotionNotify] = Motion_Filter(butc); filters[MotionNotify] = Motion_Filter(butc);
if (!grab) if (!grab)
#ifdef NX_DEBUG_INPUT
if (CheckDeviceGrabs(mouse, xE, 0, count))
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: CheckDeviceGrabs"
" returned True for ButtonPress.\n");
}
return;
}
#else
if (CheckDeviceGrabs(mouse, xE, 0, count)) if (CheckDeviceGrabs(mouse, xE, 0, count))
return; return;
#endif
break; break;
case ButtonRelease: case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow; mouse->valuator->motionHintWindow = NullWindow;
...@@ -3189,8 +3257,20 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3189,8 +3257,20 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
#if !defined(XFree86Server) || !defined(XINPUT) #if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key]; xE->u.u.detail = butc->map[key];
#endif #endif
#ifdef NX_DEBUG_INPUT
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
" for ButtonRelease.\n");
}
return; return;
}
#else
if (xE->u.u.detail == 0)
return;
#endif
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail); butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
filters[MotionNotify] = Motion_Filter(butc); filters[MotionNotify] = Motion_Filter(butc);
...@@ -3201,6 +3281,36 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3201,6 +3281,36 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
FatalError("bogus pointer event from ddx"); FatalError("bogus pointer event from ddx");
} }
} }
#ifdef NX_DEBUG_INPUT
else if (!CheckMotion(xE))
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: CheckMotion returned False"
" for MotionNotify.\n");
}
return;
}
if (grab)
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to deliver grabbed "
"events (count = %d).\n", count);
}
DeliverGrabbedEvent(xE, mouse, deactivateGrab, count);
}
else
{
if (nxagentDebugInput == 1)
{
fprintf(stderr, "ProcessPointerEvent: Going to deliver device "
"events (count = %d).\n", count);
}
DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
mouse, count);
}
#else
else if (!CheckMotion(xE)) else if (!CheckMotion(xE))
return; return;
if (grab) if (grab)
...@@ -3208,6 +3318,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3208,6 +3318,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
else else
DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow, DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
mouse, count); mouse, count);
#endif
if (deactivateGrab) if (deactivateGrab)
(*mouse->DeactivateGrab)(mouse); (*mouse->DeactivateGrab)(mouse);
} }
......
...@@ -336,6 +336,10 @@ ProcChangeProperty(ClientPtr client) ...@@ -336,6 +336,10 @@ ProcChangeProperty(ClientPtr client)
nxagentGuessShadowHint(client, stuff->property); nxagentGuessShadowHint(client, stuff->property);
#ifdef NX_DEBUG_INPUT
nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]);
#endif
return client->noClientException; return client->noClientException;
} }
} }
......
...@@ -336,6 +336,10 @@ ProcChangeProperty(ClientPtr client) ...@@ -336,6 +336,10 @@ ProcChangeProperty(ClientPtr client)
nxagentGuessShadowHint(client, stuff->property); nxagentGuessShadowHint(client, stuff->property);
#ifdef NX_DEBUG_INPUT
nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]);
#endif
return client->noClientException; return client->noClientException;
} }
} }
......
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