Commit c29053f8 authored by Mike Gabriel's avatar Mike Gabriel

Imported nxagent-3.5.0-7.tar.gz

Summary: Imported nxagent-3.5.0-7.tar.gz Keywords: Imported nxagent-3.5.0-7.tar.gz into Git repository
parent e01b9177
ChangeLog:
nxagent-3.5.0-7
- Fixed TR10I02622. Corrected function searching for icon file.
nxagent-3.5.0-6
- Fixed TR10I02621. Avoided explicit call to XMapWindow() at recon-
nection stage.
- Fixed TR10I02620. Solved error in default visual set up.
- Fixed TR10H02390. Get the actual remote key code for CapsLock and
NumLock.
nxagent-3.5.0-5
- The NX agent failed to resize its own window to fit the desktop size
......
......@@ -69,8 +69,9 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
Visual *visual;
int class;
#ifdef TEST
fprintf(stderr, "nxagentCreateColormap: Going to create new colormap.\n");
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "nxagentCreateColormap: Going to create new colormap with "
" visual [%lu].\n", pCmap->pVisual);
#endif
pVisual = pCmap->pVisual;
......@@ -511,6 +512,11 @@ Bool nxagentCreateDefaultColormap(ScreenPtr pScreen)
unsigned short zero = 0, ones = 0xFFFF;
Pixel wp, bp;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Searching for the root visual [%lu].\n",
pScreen->rootVisual);
#endif
for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual;
pVisual++);
......
......@@ -1482,6 +1482,10 @@ void nxagentSetDefaultVisual(void)
int i;
nxagentDefaultVisualIndex = 3;
return;
if (nxagentUserDefaultClass || nxagentUserDefaultDepth)
{
nxagentDefaultVisualIndex = UNDEFINED;
......@@ -1840,62 +1844,92 @@ FIXME: Is this needed?
nxagentDisplay = NULL;
}
static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
char *return_path)
{
char *path;
char *end;
char singlePath[PATH_MAX];
int breakLoop;
FILE *fptr = NULL;
#ifdef WIN32
const char separator = ';';
const char *slash = "\\";
#else
const char separator = ':';
const char *slash = "/";
#endif
if ((path = getenv("PATH")) == NULL)
{
return NULL;
}
for(breakLoop = 0; breakLoop == 0 && fptr == NULL; )
{
end = strchr(path, separator);
if (end != NULL)
{
strncpy(singlePath, path, (unsigned long)(end - path));
singlePath[(unsigned long)(end - path)] = 0;
path = end + 1;
}
else
{
strcpy(singlePath, path);
breakLoop = 1;
}
if (singlePath[strlen(singlePath)- 1] == slash[0])
{
singlePath[strlen(singlePath)- 1] = 0;
}
if (strlen(singlePath) + strlen(iconName) + 1 < PATH_MAX)
{
strncat(singlePath, slash, 1);
strcat(singlePath, iconName);
if ((fptr = fopen(singlePath, permission)) != NULL)
{
strcpy(return_path, singlePath);
}
}
else
{
fprintf(stderr, "Error: Path too long.\n");
}
}
return fptr;
}
Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
{
char *env_path = getenv("PATH");
int lenght_env_path = 0;
char icon_filename [256];
char default_path [256];
char *icon_path = malloc( strlen(env_path) + sizeof(icon_filename) );
char default_path [PATH_MAX];
char icon_path [PATH_MAX];
FILE *icon_fp;
int status;
Bool success = False;
XlibPixmap IconPixmap;
XlibPixmap IconShape;
if (env_path == NULL)
lenght_env_path = 0;
else
lenght_env_path = strlen(env_path) + 1;
strncpy(icon_filename, "", 255);
strncpy(default_path, "", 255);
strcat(icon_filename, NXAGENT_ICON_NAME);
strcat(default_path,"/usr/NX/share/images/");
strcat(default_path,icon_filename);
snprintf(default_path, PATH_MAX-1, "/usr/NX/share/images/%s", NXAGENT_ICON_NAME);
if ((icon_fp = fopen(default_path, "r")) == NULL)
{
char *s;
char *temp_path = malloc(lenght_env_path + strlen(icon_filename) );
char *temp_path1 = malloc(lenght_env_path + strlen(icon_filename) );
icon_fp = nxagentLookForIconFile(NXAGENT_ICON_NAME, "r", icon_path);
strncpy(temp_path, env_path, strlen(env_path));
strncpy(temp_path1, "", lenght_env_path + strlen(icon_filename) );
while (strlen(temp_path) > 0)
{
s = strpbrk (temp_path, ":");
if (s == NULL) break;
strncpy (temp_path1, temp_path , strlen(temp_path) - strlen(s) );
strncat (temp_path1, "/", 1);
strncat (temp_path1, icon_filename, strlen(icon_filename));
if ((icon_fp = fopen(temp_path1, "r")) != NULL)
if (icon_fp != NULL)
{
fclose (icon_fp);
success = True;
strcpy(icon_path,temp_path1);
break;
}
strncpy(temp_path1, "", lenght_env_path + strlen(icon_filename) );
strncpy(temp_path1, s + 1, strlen(s)-1);
strncpy(temp_path, "", lenght_env_path + strlen(icon_filename) );
strcpy(temp_path, temp_path1 );
strncpy(temp_path1, "", lenght_env_path + strlen(icon_filename) );
}
free(temp_path);
free(temp_path1);
}
else
{
......@@ -1948,7 +1982,6 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
}
}
free(icon_path);
*nxIcon = IconPixmap;
*nxMask = IconShape;
......
......@@ -395,8 +395,10 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
"override_redirect=%s\n", attributes.x, attributes.y,
attributes.width, attributes.height, (attributes.class == 0) ?
"InputOutput" : "InputOnly", (attributes.map_state == 0) ?
attributes.width, attributes.height,
(attributes.class == 0) ? "CopyFromParent" :
((attributes.class == 1) ? "InputOutput" : "InputOnly"),
(attributes.map_state == 0) ?
"IsUnmapped" : (attributes.map_state == 1 ?
"IsUnviewable" : "IsViewable"),
(attributes.override_redirect == 0) ?
......@@ -415,9 +417,9 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
void nxagentRemoteWindowsTree(Window window, int level)
{
int i, j;
Window rootWin, parentWin;
unsigned long rootWin, parentWin;
unsigned int numChildren;
Window *childList;
unsigned long *childList;
if (!XQueryTree(nxagentDisplay, window, &rootWin, &parentWin, &childList,
&numChildren))
......@@ -517,9 +519,11 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
"override_redirect=%s", pWin -> drawable.x, pWin -> drawable.y,
pWin -> drawable.width, pWin -> drawable.height,
(pWin -> drawable.class == 0) ? "InputOutput" :
"InputOnly", (pWin -> mapped == 0) ?
"IsUnmapped" : (pWin -> mapped == 1 ?
(pWin -> drawable.class == 0) ? "CopyFromParent" :
((pWin -> drawable.class == 1) ? "InputOutput" :
"InputOnly"),
(pWin -> mapped == 0) ?
"IsUnmapped" : (pWin -> realized == 0 ?
"IsUnviewable" : "IsViewable"),
(pWin -> overrideRedirect == 0) ?
"No" : "Yes");
......@@ -1142,11 +1146,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (nxagentXkbState.Initialized == 0)
{
if (X.xkey.keycode == 66)
if (X.xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
}
else if (X.xkey.keycode == 77)
else if (X.xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
}
......@@ -2292,11 +2296,11 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
if (nxagentXkbState.Initialized == 0)
{
if (X -> xkey.keycode == 66)
if (X -> xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
}
else if (X -> xkey.keycode == 77)
else if (X -> xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
}
......@@ -2312,11 +2316,11 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
return 1;
}
if (X -> xkey.keycode == 66)
if (X -> xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbState.Caps = (~nxagentXkbState.Caps & 1);
}
else if (X -> xkey.keycode == 77)
else if (X -> xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbState.Num = (~nxagentXkbState.Num & 1);
}
......
......@@ -189,7 +189,12 @@ static char *nxagentXkbGetRules(void);
unsigned int nxagentAltMetaMask;
void nxagentCheckAltMetaKeys(CARD8, int);
static void nxagentCheckAltMetaKeys(CARD8, int);
CARD8 nxagentCapsLockKeycode = 66;
CARD8 nxagentNumLockKeycode = 77;
static void nxagentCheckRemoteKeycodes(void);
static CARD8 nxagentConvertedKeycodes[] =
{
......@@ -784,6 +789,8 @@ N/A
}
XFreeModifiermap(modifier_keymap);
nxagentCheckRemoteKeycodes();
keySyms.minKeyCode = min_keycode;
keySyms.maxKeyCode = max_keycode;
keySyms.mapWidth = mapWidth;
......@@ -1366,6 +1373,19 @@ void nxagentCheckAltMetaKeys(CARD8 keycode, int j)
}
}
void nxagentCheckRemoteKeycodes()
{
nxagentCapsLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Caps_Lock);
nxagentNumLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Num_Lock);
#ifdef DEBUG
fprintf(stderr, "nxagentCheckRemoteKeycodes: Remote CapsLock keycode "
"is [%d] NumLock [%d].\n", nxagentCapsLockKeycode,
nxagentNumLockKeycode);
#endif
}
static int nxagentSaveKeyboardDeviceData(DeviceIntPtr dev, DeviceIntPtr devBackup)
{
if (devBackup == NULL)
......
......@@ -115,4 +115,7 @@ void nxagentResetKeycodeConversion(void);
CARD8 nxagentConvertKeycode(CARD8 k);
extern CARD8 nxagentCapsLockKeycode;
extern CARD8 nxagentNumLockKeycode;
#endif /* __Keyboard_H__ */
......@@ -839,6 +839,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
int bitsPerPixel;
int sizeInBytes;
int defaultVisualIndex = 0;
#ifdef TEST
fprintf(stderr, "nxagentOpenScreen: Called for screen index [%d].\n",
index);
......@@ -1163,6 +1165,11 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
* Initialize the visuals.
*/
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Setting up visuals. Original array has size "
"[%d].\n", nxagentNumVisuals);
#endif
numVisuals = 0;
numDepths = nxagentNumDepths;
......@@ -1186,11 +1193,24 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
* Check for and remove the duplicates.
*/
if (i == nxagentDefaultVisualIndex)
{
defaultVisualIndex = numVisuals;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Set default visual index [%d].\n" ,
defaultVisualIndex);
#endif
}
else
{
for (j = 0; j < numVisuals; j++)
{
if (visuals[numVisuals].class == visuals[j].class &&
visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
visuals[numVisuals].bitsPerRGBValue ==
visuals[j].bitsPerRGBValue &&
visuals[numVisuals].ColormapEntries ==
visuals[j].ColormapEntries &&
visuals[numVisuals].nplanes == visuals[j].nplanes &&
visuals[numVisuals].redMask == visuals[j].redMask &&
visuals[numVisuals].greenMask == visuals[j].greenMask &&
......@@ -1204,8 +1224,15 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
if (j < numVisuals)
continue;
}
depthIndex = UNDEFINED;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Added visual [%lu].\n" ,
visuals[numVisuals].vid);
#endif
for (j = 0; j < numDepths; j++)
{
if (depths[j].depth == nxagentVisuals[i].depth)
......@@ -1240,11 +1267,25 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
depths[depthIndex].numVids++;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Registered visual [%lu] for depth [%d (%d)].\n" ,
visuals[numVisuals].vid, depthIndex,
depths[depthIndex].depth);
#endif
numVisuals++;
}
defaultVisual = visuals[nxagentDefaultVisualIndex].vid;
rootDepth = visuals[nxagentDefaultVisualIndex].nplanes;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Setting default visual [%d (%lu)].\n",
defaultVisualIndex, visuals[defaultVisualIndex].vid);
fprintf(stderr, "Debug: Setting root depth [%d].\n",
visuals[defaultVisualIndex].nplanes);
#endif
defaultVisual = visuals[defaultVisualIndex].vid;
rootDepth = visuals[defaultVisualIndex].nplanes;
nxagentInitAlphaVisual();
......@@ -1271,7 +1312,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
return FALSE;
}
#ifdef TEST
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "nxagentOpenScreen: Before fbScreenInit numVisuals [%d] numDepths [%d] "
"rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths,
rootDepth, defaultVisual);
......@@ -1288,7 +1329,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
return FALSE;
}
#ifdef TEST
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "nxagentOpenScreen: After fbScreenInit numVisuals [%d] numDepths [%d] "
"rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths,
rootDepth, defaultVisual);
......@@ -1300,7 +1341,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
* and will modify numVisuals and numDepths.
*/
#ifdef TEST
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "nxagentOpenScreen: Before GLX numVisuals [%d] numDepths [%d] "
"rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths,
rootDepth, defaultVisual);
......@@ -1309,7 +1350,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
nxagentInitGlxExtension(&visuals, &depths, &numVisuals, &numDepths,
&rootDepth, &defaultVisual);
#ifdef TEST
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "nxagentOpenScreen: After GLX numVisuals [%d] numDepths [%d] "
"rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths,
rootDepth, defaultVisual);
......
......@@ -3170,10 +3170,17 @@ static void nxagentReconfigureWindow(pointer param0, XID param1, pointer data_bu
{
nxagentRealizeWindow (pWin);
}
/*
XXX: This would break Motif menus.
If pWin is mapped but not realized, a followin UnmapWindow() wouldn't
do anything, leaving this mapped window around. XMapWindow()
is called in nxagentRealizeWindow() and there it is enough.
else if (pWin->mapped)
{
XMapWindow(nxagentDisplay, nxagentWindow(pWin));
}
*/
else if (nxagentOption(Rootless) && pWin -> overrideRedirect == 0 &&
nxagentWindowTopLevel(pWin) && nxagentIsIconic(pWin))
{
......
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