From e9132da09462b3d2607a97e2f580cbd3144819eb Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:58:57 +0200 Subject: Imported nxagent-3.4.0-11.tar.gz Summary: Imported nxagent-3.4.0-11.tar.gz Keywords: Imported nxagent-3.4.0-11.tar.gz into Git repository --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 111 ++++++++++++++++++++------ 1 file changed, 86 insertions(+), 25 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Rootless.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 79cb74efa..612e71cf7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ @@ -9,7 +9,7 @@ /* */ /* Check http://www.nomachine.com/licensing.html for applicability. */ /* */ -/* NX and NoMachine are trademarks of NoMachine S.r.l. */ +/* NX and NoMachine are trademarks of Medialogic S.p.A. */ /* */ /* All rights reserved. */ /* */ @@ -60,6 +60,27 @@ typedef struct } nxagentWMHints; +/* + * This structure is compatible with 32 + * and 64 bit library interface. It has + * been copied from Xatomtype.h and it's + * a parameter of XChangeProperty(). + */ + +typedef struct +{ + unsigned long flags; + long input; + long initialState; + unsigned long iconPixmap; + unsigned long iconWindow; + long iconX; + long iconY; + unsigned long iconMask; + unsigned long windowGroup; +} +nxagentPropWMHints; + WindowPtr nxagentRootlessWindow = NULL; #define TOP_LEVEL_TABLE_UNIT 100 @@ -429,6 +450,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) Atom propertyX, typeX; char *output = NULL; nxagentWMHints wmHints; + nxagentPropWMHints propHints; Bool export = False; Bool freeMem = False; @@ -489,8 +511,22 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) wmHints.flags |= InputHint; wmHints.input = True; - output = (char*) &wmHints; - export = True; + /* + * Initialize the structure used in XChangeProperty(). + */ + + propHints.flags = wmHints.flags; + propHints.input = (wmHints.input == True ? 1 : 0); + propHints.initialState = wmHints.initial_state; + propHints.iconPixmap = wmHints.icon_pixmap; + propHints.iconWindow = wmHints.icon_window; + propHints.iconX = wmHints.icon_x; + propHints.iconY = wmHints.icon_y; + propHints.iconMask = wmHints.icon_mask; + propHints.windowGroup = wmHints.window_group; + + output = (char*) &propHints; + export = True; if ((wmHints.flags & IconPixmapHint) && (wmHints.icon_pixmap != None)) { @@ -504,17 +540,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) nxagentSynchronizeRegion((DrawablePtr) icon, NullRegion, NEVER_BREAK, NULL); } - wmHints.icon_pixmap = nxagentPixmap(icon); + propHints.iconPixmap = nxagentPixmap(icon); } else { - wmHints.flags &= ~IconPixmapHint; + propHints.flags &= ~IconPixmapHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_pixmap, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -526,17 +562,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (icon) { - wmHints.icon_window = nxagentWindow(icon); + propHints.iconWindow = nxagentWindow(icon); } else { - wmHints.flags &= ~IconWindowHint; + propHints.flags &= ~IconWindowHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_window, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -548,17 +584,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (icon) { - wmHints.icon_mask = nxagentPixmap(icon); + propHints.iconMask = nxagentPixmap(icon); } else { - wmHints.flags &= ~IconMaskHint; + propHints.flags &= ~IconMaskHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_mask, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -570,17 +606,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (window) { - wmHints.window_group = nxagentWindow(window); + propHints.windowGroup = nxagentWindow(window); } else { - wmHints.flags &= ~WindowGroupHint; + propHints.flags &= ~WindowGroupHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.window_group, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -590,6 +626,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) XlibAtom *atoms = malloc(nUnits * sizeof(*atoms)); Atom *input = value; int i; + int j = 0; freeMem = True; export = True; @@ -597,16 +634,40 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) for (i = 0; i < nUnits; i++) { - atoms[i] = nxagentLocalToRemoteAtom(input[i]); - - if (atoms[i] == None) - { - #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n", - (long int) input[i], validateString(NameForAtom(input[i]))); - #endif - } + /* + * Exporting the _NET_WM_PING property could + * result in rootless windows being grayed out + * when the compiz window manager is running. + * + * Better solution would probably be to handle + * the communication with the window manager + * instead of just getting rid of the property. + */ + + if (strcmp(NameForAtom(input[i]), "_NET_WM_PING") != 0) + { + atoms[j] = nxagentLocalToRemoteAtom(input[i]); + + if (atoms[j] == None) + { + #ifdef WARNING + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n", + (long int) input[i], validateString(NameForAtom(input[i]))); + #endif + } + + j++; + } + #ifdef TEST + else + { + fprintf(stderr, "nxagentExportProperty: WARNING! " + "Not exporting the _NET_WM_PING property.\n"); + } + #endif } + + nUnits = j; } else if (strcmp(typeS, "WINDOW") == 0) { -- cgit v1.2.3