diff options
author | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:58:57 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:58:57 +0200 |
commit | e9132da09462b3d2607a97e2f580cbd3144819eb (patch) | |
tree | 2dfc6a37f2be48a8e61f37d62565e83be4b73186 /nx-X11/programs/Xserver/hw/nxagent/Rootless.c | |
parent | 6f5e20bc49695159bd3b313333591c4eb27ad422 (diff) | |
download | nx-libs-e9132da09462b3d2607a97e2f580cbd3144819eb.tar.gz nx-libs-e9132da09462b3d2607a97e2f580cbd3144819eb.tar.bz2 nx-libs-e9132da09462b3d2607a97e2f580cbd3144819eb.zip |
Imported nxagent-3.4.0-11.tar.gznxagent/3.4.0-11
Summary: Imported nxagent-3.4.0-11.tar.gz
Keywords:
Imported nxagent-3.4.0-11.tar.gz
into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Rootless.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 111 |
1 files changed, 86 insertions, 25 deletions
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) { |