2023-03-01 18:01:08 +03:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* X11 helper utilities
|
|
|
|
*
|
|
|
|
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
|
|
|
|
* Copyringht 2023 Thincast Technologies GmbH
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-03-01 18:17:03 +03:00
|
|
|
#include <winpr/assert.h>
|
|
|
|
|
2023-03-01 18:01:08 +03:00
|
|
|
#include "xf_utils.h"
|
|
|
|
|
2023-03-01 18:17:03 +03:00
|
|
|
static const DWORD level = WLOG_TRACE;
|
|
|
|
|
2023-03-01 18:01:08 +03:00
|
|
|
int LogTagAndXChangeProperty(const char* tag, Display* display, Window w, Atom property, Atom type,
|
|
|
|
int format, int mode, const unsigned char* data, int nelements)
|
|
|
|
{
|
|
|
|
wLog* log = WLog_Get(tag);
|
|
|
|
return LogDynAndXChangeProperty(log, display, w, property, type, format, mode, data, nelements);
|
|
|
|
}
|
|
|
|
|
|
|
|
int LogDynAndXChangeProperty(wLog* log, Display* display, Window w, Atom property, Atom type,
|
|
|
|
int format, int mode, const unsigned char* data, int nelements)
|
|
|
|
{
|
|
|
|
if (WLog_IsLevelActive(log, level))
|
|
|
|
{
|
|
|
|
char* propstr = XGetAtomName(display, property);
|
|
|
|
char* typestr = XGetAtomName(display, type);
|
|
|
|
WLog_Print(log, WLOG_DEBUG, "XChangeProperty(%p, %d, %s [%d], %s [%d], %d, %d, %p, %d)",
|
|
|
|
display, w, propstr, property, typestr, type, format, mode, data, nelements);
|
|
|
|
XFree(propstr);
|
|
|
|
XFree(typestr);
|
|
|
|
}
|
|
|
|
return XChangeProperty(display, w, property, type, format, mode, data, nelements);
|
|
|
|
}
|
2023-03-01 18:17:03 +03:00
|
|
|
|
|
|
|
int LogTagAndXDeleteProperty(const char* tag, Display* display, Window w, Atom property)
|
|
|
|
{
|
|
|
|
wLog* log = WLog_Get(tag);
|
|
|
|
return LogDynAndXDeleteProperty(log, display, w, property);
|
|
|
|
}
|
|
|
|
|
|
|
|
int LogDynAndXDeleteProperty(wLog* log, Display* display, Window w, Atom property)
|
|
|
|
{
|
|
|
|
if (WLog_IsLevelActive(log, level))
|
|
|
|
{
|
|
|
|
char* propstr = XGetAtomName(display, property);
|
|
|
|
WLog_Print(log, WLOG_DEBUG, "XDeleteProperty(%p, %d, %s [%d])", display, w, propstr,
|
|
|
|
property);
|
|
|
|
XFree(propstr);
|
|
|
|
}
|
|
|
|
return XDeleteProperty(display, w, property);
|
|
|
|
}
|