Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-09

Anybody know X11 and XDND (drag-n-drop)

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I'm having trouble fetching the XdndTypeList data. It works 100% on my 32-bit Linux laptop, but now trying on my 64-bit Linux desktop at work, the XGetWindowProperty() call under 64-bit linux for the XdndTypeList always returns count = 0, when in fact it should be 8, as my last section of the output shows. I simply forced count = 8, because I knew Nautilus has that many types, and wanted to see if my array of TAtom's actually contains the data - which it does! So it does seem to fetch the data, it just doesn't report it in the variables: actualformat, count, remaining.

Anybody got experience with this and know how I can resolve this problem?

type
  AtomArray = array [0..0] of TAtom;
  PAtomArray = ^AtomArray;
var
  s: string;
  actualtype: TAtom;
  actualformat: Integer;
  count, remaining, dummy: longword;
  xdndtypes: PAtomArray;
begin
...
        XGetWindowProperty(fpgApplication.Display, FSrcWinHandle,
            XdndTypeList, 0, dummy,
            TBool(False),
            AnyPropertyType,
            @actualtype, @actualformat, @count, @remaining,
            @xdndtypes);
        s := XGetAtomName(fpgApplication.Display, actualtype);
        writeln(Format('  ActualType: %s (%d)', [s, ActualType]));
        writeln('  Actualformat = ', ActualFormat);
        writeln('  count = ', count);
        writeln('  remaining = ', remaining);

------------ [ output of my test program ]-------------------- XdndEnter event received!
ver(4) check-XdndTypeList(True) data=1E0E816h,67108865,0,0,0
* We will be using XDND v4 protocol *
** We need to fetch XdndTypeList (>3 types)

Actual fetch: ---------------------
ActualType: ATOM (4)
Actualformat = 0
count = 0 <--- ???????????? remaining = 0

Force the count size to be eight: -------------------------- Format #1 = x-special/gnome-icon-list (564)
Format #2 = text/uri-list (531)
Format #3 = UTF8_STRING (283)
Format #4 = COMPOUND_TEXT (463)
Format #5 = TEXT (464)
Format #6 = STRING (31)
Format #7 = text/plain;charset=utf-8 (465)
Format #8 = text/plain (466)

--------------------------------

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/
Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

Show quoted text 9 lines
I'm having trouble fetching the XdndTypeList data. It works 100% on my 32-bit Linux laptop, but now trying on my 64-bit Linux desktop at work, the XGetWindowProperty() call under 64-bit linux for the XdndTypeList always returns count = 0, when in fact it should be 8, as my last section of the output shows. I simply forced count = 8, because I knew Nautilus has that many types, and wanted to see if my array of TAtom's actually contains the data - which it does! So it does seem to fetch the data, it just doesn't report it in the variables: actualformat, count, remaining.

You are not passing unix types, and are passing pointers to 32-bit types to parametesr that expect pointers to 64-bit types (pculong).

Since they are on the stack, they probably overwrite eachother. As always with 64-bit, pay great care to the typing.

Henry Vermaak
to Graeme Geldenhuys: I'm having trouble fetching the XdndTypeList data. It works 100% on my 32-bit Linux…
Graeme Geldenhuys wrote 24 lines
Hi, I'm having trouble fetching the XdndTypeList data. It works 100% on my 32-bit Linux laptop, but now trying on my 64-bit Linux desktop at work, the XGetWindowProperty() call under 64-bit linux for the XdndTypeList always returns count = 0, when in fact it should be 8, as my last section of the output shows. I simply forced count = 8, because I knew Nautilus has that many types, and wanted to see if my array of TAtom's actually contains the data - which it does!  So it does seem to fetch the data, it just doesn't report it in the variables: actualformat, count, remaining. Anybody got experience with this and know how I can resolve this problem? type  AtomArray = array [0..0] of TAtom;  PAtomArray = ^AtomArray; var  s: string;  actualtype: TAtom;  actualformat: Integer;  count, remaining, dummy: longword;  xdndtypes: PAtomArray;

You should use the ctypes here, since they'll change for 64 bit.

Henry

Graeme Geldenhuys
to Marco van de Voort: In our previous episode, Graeme Geldenhuys said: You are not passing unix types, and are…
Marco van de Voort wrote
You are not passing unix types, and are passing pointers to 32-bit types to parametesr that expect pointers to 64-bit types (pculong).

Oops! Thanks Marco, changing them to ctypes solved the problem. I better double check my other X11 code too, I might be making the same mistake in a few more place. :-/

Finally got fpGUI-X11 drag-n-drop to work! :-)

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/