Browse Source

support 64bit window property

pull/1639/head
bsp2 6 years ago
parent
commit
7ec662b2cd
1 changed files with 43 additions and 18 deletions
  1. +43
    -18
      other/vst2_debug_host/vst2_debug_host.cpp

+ 43
- 18
other/vst2_debug_host/vst2_debug_host.cpp View File

@@ -30,9 +30,8 @@ typedef AEffect* (*PluginEntryProc) (audioMasterCallback audioMaster);


#ifndef YAC_WIN32 #ifndef YAC_WIN32
// https://github.com/Ardour/ardour/blob/master/gtk2_ardour/linux_vst_gui_support.cc // https://github.com/Ardour/ardour/blob/master/gtk2_ardour/linux_vst_gui_support.cc
long getXWindowProperty(Display* display, Window window, Atom atom)
void *getXWindowProperty(Display* display, Window window, Atom atom)
{ {
long result = 0;
int userSize; int userSize;
unsigned long bytes; unsigned long bytes;
unsigned long userCount; unsigned long userCount;
@@ -47,27 +46,53 @@ long getXWindowProperty(Display* display, Window window, Atom atom)


// XErrorHandler olderrorhandler = XSetErrorHandler(TempErrorHandler); // XErrorHandler olderrorhandler = XSetErrorHandler(TempErrorHandler);


printf("xxx getXWindowProperty: window=%lu\n", window);

XGetWindowProperty(display, XGetWindowProperty(display,
window,
atom,
0,
2,
false,
AnyPropertyType,
&userType,
&userSize,
&userCount,
&bytes,
&data);

if(userCount == 1)
result = *(long*)data;
window,
atom,
0/*offset*/,
2/*length*/,
false/*delete*/,
AnyPropertyType,
&userType/*actual_type_return*/,
&userSize/*actual_format_return*/,
&userCount/*nitems_return*/,
&bytes/*bytes_after_return / partial reads*/,
&data);

union {
long l[2];
void *any;
} uptr;
uptr.any = 0;

printf("xxx getXWindowProperty: userSize=%d userCount=%lu bytes=%lu data=%p\n", userSize, userCount, bytes, data);

if(NULL != data)
{
if(userCount == 1)
{
// 32-bit
uptr.l[0] = *(long*)data;
uptr.l[1] = 0;
}
else if(2 == userCount)
{
// 64-bit
uptr.l[0] = ((long*)data)[0];
uptr.l[1] = ((long*)data)[1];
}

XFree(data);
}


// XSetErrorHandler(olderrorhandler); // XSetErrorHandler(olderrorhandler);


/*Hopefully this will return zero if the property is not set*/ /*Hopefully this will return zero if the property is not set*/
printf("xxx getXWindowProperty: return callback addr=%p\n", uptr.any);


return result;
return uptr.any;
} }
#endif #endif


@@ -161,7 +186,7 @@ void open_and_close(void) {
sleep(2); sleep(2);


#ifndef YAC_WIN32 #ifndef YAC_WIN32
long result = getXWindowProperty(d, w, XInternAtom(d, "_XEventProc", false));
void *result = getXWindowProperty(d, w, XInternAtom(d, "_XEventProc", false));
if(result == 0) if(result == 0)
{ {
printf("xxx no XEventProc found\n"); printf("xxx no XEventProc found\n");


Loading…
Cancel
Save