mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
../Xext/namespace/hook-init-rootwindow.c: In function ‘hookInitRootWindow’:
../Xext/namespace/hook-init-rootwindow.c:38:21: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘XID’ {aka ‘long unsigned int’} [-Wformat=]
38 | XNS_LOG("<%s> actual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
| ^~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| XID {aka long unsigned int}
../Xext/namespace/namespace.h:71:50: note: in definition of macro ‘XNS_LOG’
71 | #define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
| ^~~~~~~~~~~
../Xext/namespace/hook-init-rootwindow.c:38:43: note: format string is defined here
38 | XNS_LOG("<%s> actual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
| ~~^
| |
| unsigned int
| %0lx
../Xext/namespace/hook-init-rootwindow.c:70:17: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘XID’ {aka ‘long unsigned int’} [-Wformat=]
70 | XNS_LOG("<%s> virtual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
| ^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| XID {aka long unsigned int}
../Xext/namespace/namespace.h:71:50: note: in definition of macro ‘XNS_LOG’
71 | #define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
| ^~~~~~~~~~~
../Xext/namespace/hook-init-rootwindow.c:70:40: note: format string is defined here
70 | XNS_LOG("<%s> virtual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
| ~~^
| |
| unsigned int
| %0lx
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
#define HOOK_NAME "windowproperty"
|
|
|
|
#include <dix-config.h>
|
|
|
|
#include <inttypes.h>
|
|
#include <X11/Xmd.h>
|
|
|
|
#include "dix/dix_priv.h"
|
|
#include "dix/property_priv.h"
|
|
#include "dix/window_priv.h"
|
|
|
|
#include "namespace.h"
|
|
#include "hooks.h"
|
|
|
|
void hookWindowProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|
{
|
|
XNS_HOOK_HEAD(PropertyFilterParam);
|
|
|
|
// no redirect on super power
|
|
if (subj->ns->superPower)
|
|
return;
|
|
|
|
const ClientPtr owner = dixLookupXIDOwner(param->window);
|
|
if (!owner) {
|
|
param->status = BadWindow;
|
|
param->skip = TRUE;
|
|
XNS_HOOK_LOG("owner of window 0x%0llx doesn't exist\n", (unsigned long long)param->window);
|
|
return;
|
|
}
|
|
|
|
// whitelist anything that goes to caller's own namespace
|
|
struct XnamespaceClientPriv *obj = XnsClientPriv(owner);
|
|
if (XnsClientSameNS(subj, obj))
|
|
return;
|
|
|
|
// allow access to namespace virtual root
|
|
if (param->window == subj->ns->rootWindow->drawable.id)
|
|
return;
|
|
|
|
// redirect root window access to namespace's virtual root
|
|
if (dixWindowIsRoot(param->window)) {
|
|
param->window = subj->ns->rootWindow->drawable.id;
|
|
return;
|
|
}
|
|
}
|