[GB.DESKTOP]

* BUG: Desktop.FindWindow() should work correctly now.
* BUG: Reading X11 properties on 64 bits systems should work in all cases 
  now.


git-svn-id: svn://localhost/gambas/trunk@3557 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-02-12 01:18:32 +00:00
parent 526a704e32
commit a3a5cbd125
3 changed files with 12 additions and 8 deletions

View file

@ -97,11 +97,10 @@ BEGIN_METHOD(CDESKTOP_find, GB_STRING title; GB_STRING klass; GB_STRING role)
for (i = 0; i < count; i++)
{
win = windows[i];
//qDebug("win = %08X", win);
if (ltitle)
{
X11_get_window_title(win, &prop, &lprop);
//qDebug("title = %.*s", lprop, prop);
if (!GB.MatchString(title, ltitle, prop, lprop))
continue;
}

View file

@ -13,7 +13,7 @@ SearchString=True
[OpenFile]
Active=1
File[1]=".src/Desktop.class:173.20"
File[1]=".src/Desktop.class:92.2"
File[2]=".src/Main.module:8.2"
File[3]=".src/_DesktopPasswords.class:65.56"
File[4]=".src/Form1.form"

View file

@ -135,7 +135,7 @@ char *X11_get_property(Window wid, Atom prop, Atom *type, int *format, int *pcou
*pcount = 0;
if (XGetWindowProperty(_display, wid, prop, 0, PROPERTY_START_READ / sizeof(long),
if (XGetWindowProperty(_display, wid, prop, 0, PROPERTY_START_READ / sizeof(int32_t),
False, AnyPropertyType, type, format,
&count, &after, &data) != Success)
return NULL;
@ -148,17 +148,17 @@ char *X11_get_property(Window wid, Atom prop, Atom *type, int *format, int *pcou
_property_value = GB.NewString((char *)data, count * size);
XFree(data);
offset = count * size / sizeof(long);
offset = count * size / sizeof(int32_t);
while (after)
{
if (XGetWindowProperty(_display, wid, prop, offset, PROPERTY_NEXT_READ / sizeof(long),
if (XGetWindowProperty(_display, wid, prop, offset, PROPERTY_NEXT_READ / sizeof(int32_t),
False, AnyPropertyType, type, format,
&count, &after, &data) != Success)
return NULL;
*pcount += count;
offset += count * size / sizeof(long);
offset += count * size / sizeof(int32_t);
GB.AddString(&_property_value, (char *)data, count * size);
XFree(data);
@ -503,7 +503,12 @@ void X11_find_windows(Window **window_list, int *count)
void X11_get_window_title(Window window, char **result, int *length)
{
*result = get_property(window, XA_WM_NAME, length);
static Atom _net_wm_name = 0;
if (!_net_wm_name)
_net_wm_name = XInternAtom(_display, "_NET_WM_NAME", True);
*result = get_property(window, _net_wm_name, length);
}
void X11_get_window_class(Window window, char **result, int *length)