XmText Cut, Copy and Paste don't work on Gnome/FC 5 - Motif

This is a discussion on XmText Cut, Copy and Paste don't work on Gnome/FC 5 - Motif ; The cut, copy and paste features of XmText widgets don't seem to work on Gnome as supplied with Fedora Core 5. This was first noticed in an editor application with menu callbacks that call XmTextCut, XmTextCopy and XmTextPaste, It can ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: XmText Cut, Copy and Paste don't work on Gnome/FC 5

  1. XmText Cut, Copy and Paste don't work on Gnome/FC 5

    The cut, copy and paste features of XmText widgets don't seem to work on
    Gnome as supplied with Fedora Core 5. This was first noticed in an editor
    application with menu callbacks that call XmTextCut, XmTextCopy and
    XmTextPaste, It can also be demonstrated with the toy example code attached
    below using shift+insert, control+insert and shift+delete to invoke the
    cut, copy and paste actions.

    The same programs work fine under KDE and under Gnome on earlier versions of
    Fedora Core. The Gnome set-up is exactly as it comes out of the box in
    Fedora Core 5 and the virtual bindings seem to be set up right.

    I'd be grateful for any suggestions about how to work around this or how to
    pin down the cause of the bug (including pointers to a more appropriate
    forum if this is a bit off-topic).

    Regards,

    Rob.


    /*
    * fileview.c: create a scrolled text widget with contents of a file in it:
    * To compile (on typical Linux):
    gcc -g -o fileview -L/usr/X11R6/lib -lXm fileview.c
    *
    * To run:
    * fileview
    */
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    int main(int argc, char **argv)
    {
    XtAppContext app;
    Widget root, text;
    char *file_name;
    FILE *file;
    struct stat stat_res;
    char *buffer;
    Arg args[12];
    int i;
    root = XtVaAppInitialize(&app,
    "Fileview",
    NULL,
    0,
    &argc,
    argv, NULL, NULL);
    if (argc != 2) {
    fprintf(stderr, "fileview: usage: fileview \n");
    exit(EXIT_FAILURE);
    }
    if(stat(argv[1], &stat_res) < 0) {
    fprintf(stderr, "fileview: cannot stat %s\n", argv[1]);
    exit(EXIT_FAILURE);
    }
    if((file = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "fileview: cannot open %s\n", argv[1]);
    exit(EXIT_FAILURE);
    }
    if((buffer = XtMalloc(stat_res.st_size + 1)) == NULL) {
    fprintf(stderr, "fileview: not enough memory to read %s\n", argv[1]);
    exit(EXIT_FAILURE);
    }
    if(fread(buffer, 1, stat_res.st_size, file) != stat_res.st_size) {
    fprintf(stderr, "fileview: i/o failure on %s\n", argv[1]);
    exit(EXIT_FAILURE);
    }
    buffer[stat_res.st_size] = 0;
    i = 0;
    XtSetArg(args[i], XmNeditable, True); ++i;
    XtSetArg(args[i], XmNeditMode, XmMULTI_LINE_EDIT); ++i;
    XtSetArg(args[i], XmNrows, 24); ++i;
    XtSetArg(args[i], XmNcolumns, 80); ++i;
    text = XmCreateScrolledText(root, "text", args, i);
    XmTextSetString(text, buffer);
    XtFree(buffer);
    XtManageChild(text);
    XtRealizeWidget(root);
    XtAppMainLoop(app);
    }

    /* end of fileview.c */

  2. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    Rob Arthan wrote:

    > The cut, copy and paste features of XmText widgets don't seem to work on
    > Gnome as supplied with Fedora Core 5. This was first noticed in an editor
    > application with menu callbacks that call XmTextCut, XmTextCopy and
    > XmTextPaste, It can also be demonstrated with the toy example code attached
    > below using shift+insert, control+insert and shift+delete to invoke the
    > cut, copy and paste actions.


    I heard Fedora was dropping the real Motif and replacing it with
    LessTif. It's probably a lesstif bug, and lesstif is notorious for
    breaking

    The first thing I'd do is look at the version numbers of the Motif
    packages for each system and which you compiled against. It's nearly
    impossible to develop an nontrivial Motif app on Linux unless you are
    keenly aware of which Motif you are using and the exact version down to
    the patchlevel.

    If it did change, and you didn't recompile the application, then you may
    be relying on binary compatability between lesstif and openmotif...
    which is like relying on a raft to get you down Niagra falls. Perhaps
    technically it's supposed to work, but it's wise not to try it.

  3. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    ST wrote:

    > Rob Arthan wrote:
    >
    >> The cut, copy and paste features of XmText widgets don't seem to work on
    >> Gnome as supplied with Fedora Core 5. This was first noticed in an editor
    >> application with menu callbacks that call XmTextCut, XmTextCopy and
    >> XmTextPaste, It can also be demonstrated with the toy example code
    >> attached below using shift+insert, control+insert and shift+delete to
    >> invoke the cut, copy and paste actions.

    >
    > I heard Fedora was dropping the real Motif and replacing it with
    > LessTif. It's probably a lesstif bug, and lesstif is notorious for
    > breaking
    >
    > The first thing I'd do is look at the version numbers of the Motif
    > packages for each system and which you compiled against. It's nearly
    > impossible to develop an nontrivial Motif app on Linux unless you are
    > keenly aware of which Motif you are using and the exact version down to
    > the patchlevel.


    What do you find you have to do with these version numbers and patchlevels?
    Maybe I'm just lucky, but my code has been working quite happily on Solaris,
    most Linuxes and Mac OS X and on most versions of Motif for many years. In
    this case, I am using OpenMotif 2.3.0.
    >
    > If it did change, and you didn't recompile the application, then you may
    > be relying on binary compatability between lesstif and openmotif...


    I know that most versions of lesstif don't support my app, so I am careful
    not to use it.

    > which is like relying on a raft to get you down Niagra falls. Perhaps
    > technically it's supposed to work, but it's wise not to try it.


    Thanks, but that doesn't seem to explain the problem: I build from source on
    the platform with the problem (as did the user who originally discovered
    it). The same binaries work fine on the same platform under window managers
    other than Gnome (e.g., KDE, mwm and twm).

    Regards,

    Rob.


  4. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    Rob Arthan wrote:

    > What do you find you have to do with these version numbers and patchlevels?


    There are a bunch of defines in Xm.h --

    #define XmVERSION 2
    #define XmREVISION 2
    #define XmUPDATE_LEVEL 3
    #define XmVersion (XmVERSION * 1000 + XmREVISION)
    #define XmVERSION_STRING "@(#)Motif Version 2.2.3"

    The best way to use them is to embed these in your programs under some
    debug output, rather than just looking at them.

    More than once I've seen Linux systems configured with multiple
    Motif/LessTif versions installed, and the one I thought I was compling
    against was not the one that it really was compiling against.

    But, now that I read your message a bit more, you say it works okay
    under KDE on the same machine?

  5. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    ST wrote:
    >> What do you find you have to do with these version numbers and
    >> patchlevels?

    I also do not think that it is related to Motif version,
    most probably Gnome overrides some of the Motif's keyboard accelerators.
    So you need to search GNOME settings and try to disable that.
    I mostly use KDE on SUSE 10.1 and don't have much problems
    other than having to reset the colors to Motif default.
    http://www.arahne.si/setup3.html

    Best regards,

    Dušan Peterc
    http://www.arahne.si

  6. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    arahne wrote:

    > ST wrote:
    >>> What do you find you have to do with these version numbers and
    >>> patchlevels?

    > I also do not think that it is related to Motif version,
    > most probably Gnome overrides some of the Motif's keyboard accelerators.
    > So you need to search GNOME settings and try to disable that.
    >...


    I don't see how that can be the answer. I am getting the virtual key
    bindings that I expect.

    In any case, as I said in my original post, the problem also happens in an
    app which calls XmTextCut, XmTextCopy and XmTextPaste explicitly in menu
    callbacks - and I've just checked with a debugger and it really is making
    those calls.

    Regards,

    Rob.


  7. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    Rob Arthan wrote:

    > In any case, as I said in my original post, the problem also happens in an
    > app which calls XmTextCut, XmTextCopy and XmTextPaste explicitly in menu
    > callbacks - and I've just checked with a debugger and it really is making
    > those calls.


    What is the return code of these function calls? The call can fail if
    the clipboard is locked by another app.

    Are you running a clipboard manager at all (xclipboard/gcm/etc)? What
    happens when it's present or not present?

  8. Re: XmText Cut, Copy and Paste don't work on Gnome/FC 5

    ST wrote:

    > Rob Arthan wrote:
    >
    >> In any case, as I said in my original post, the problem also happens in
    >> an app which calls XmTextCut, XmTextCopy and XmTextPaste explicitly in
    >> menu callbacks - and I've just checked with a debugger and it really is
    >> making those calls.

    >
    > What is the return code of these function calls? The call can fail if
    > the clipboard is locked by another app.


    They return 1 - i.e., True, i.e., OK.

    >
    > Are you running a clipboard manager at all (xclipboard/gcm/etc)? What
    > happens when it's present or not present?


    Thanks - good suggestion. A grep for CLIPBOARD_MANAGER through the binaries
    of the running processes reveals that the culprit is gnome-settings-daemon.
    Killing it makes cut-and-paste work properly in my app. I will raise the
    problem on the Gnome support forum to see if they really meant it to break
    Motif apps.

    Regards,

    Rob.





+ Reply to Thread