aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2011-12-28 18:48:50 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2011-12-28 18:48:50 +0100
commit82ab807fd5397aa152dd7369a36beccbacb962cb (patch)
tree1f03b72ac7d497b8cd9ca5094615136edffd257c /nx-X11/programs/Xserver/hw/nxagent
parentaa166550657f3a928f5d7a8babc0956b69f4a587 (diff)
parentc29053f82cbea5f2704d99c4d5e8afe0329e5cbe (diff)
downloadnx-libs-82ab807fd5397aa152dd7369a36beccbacb962cb.tar.gz
nx-libs-82ab807fd5397aa152dd7369a36beccbacb962cb.tar.bz2
nx-libs-82ab807fd5397aa152dd7369a36beccbacb962cb.zip
Merge branch 'nxagent'
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/CHANGELOG14
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Colormap.c10
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Display.c127
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c30
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c24
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.h3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c81
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c7
8 files changed, 212 insertions, 84 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
index 0f20b79c3..763f066ad 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
+++ b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
@@ -1,5 +1,19 @@
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
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
index b0f0507b5..fbe52db9c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
@@ -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++);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index db70434e3..c60718d36 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -1482,6 +1482,10 @@ void nxagentSetDefaultVisual(void)
int i;
+ nxagentDefaultVisualIndex = 3;
+
+ return;
+
if (nxagentUserDefaultClass || nxagentUserDefaultDepth)
{
nxagentDefaultVisualIndex = UNDEFINED;
@@ -1840,68 +1844,98 @@ 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) );
-
- strncpy(temp_path, env_path, strlen(env_path));
- strncpy(temp_path1, "", lenght_env_path + strlen(icon_filename) );
+ icon_fp = nxagentLookForIconFile(NXAGENT_ICON_NAME, "r", icon_path);
- while (strlen(temp_path) > 0)
+ if (icon_fp != NULL)
{
- 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)
- {
- 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);
+ fclose (icon_fp);
+ success = True;
+ }
}
else
{
- fclose (icon_fp);
- success = True;
- strcpy(icon_path, default_path);
+ fclose (icon_fp);
+ success = True;
+ strcpy(icon_path, default_path);
}
if (success)
@@ -1948,7 +1982,6 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
}
}
- free(icon_path);
*nxIcon = IconPixmap;
*nxMask = IconShape;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index ce84c1b19..d0efa71e6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -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);
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 8db38892e..e3b58b6c7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -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;
@@ -1343,7 +1350,7 @@ int nxagentResetKeyboard(void)
}
}
-void nxagentCheckAltMetaKeys(CARD8 keycode, int j)
+void nxagentCheckAltMetaKeys(CARD8 keycode, int j)
{
if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_L))
{
@@ -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)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h
index 0e11a8a13..12d953d93 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h
@@ -115,4 +115,7 @@ void nxagentResetKeycodeConversion(void);
CARD8 nxagentConvertKeycode(CARD8 k);
+extern CARD8 nxagentCapsLockKeycode;
+extern CARD8 nxagentNumLockKeycode;
+
#endif /* __Keyboard_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index b847b08e6..de688a0db 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -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,26 +1193,46 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
* Check for and remove the duplicates.
*/
- for (j = 0; j < numVisuals; j++)
+ if (i == nxagentDefaultVisualIndex)
{
- if (visuals[numVisuals].class == visuals[j].class &&
- 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 &&
- visuals[numVisuals].blueMask == visuals[j].blueMask &&
- visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
- visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
- visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
- break;
+ 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].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ break;
+ }
+
+ if (j < numVisuals)
+ continue;
- 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);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index 988193609..35a35984a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -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))
{