public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Stone, Timothy M" <tstone@ida.org>
To: "'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
Date: Thu, 16 Nov 2023 18:21:38 +0000	[thread overview]
Message-ID: <5c374b0c81c54137b616908f7c74e8cb@ida.org> (raw)
In-Reply-To: <9972254cab724b11a337507a379a1792@ida.org>

[-- Attachment #1: Type: text/plain, Size: 4699 bytes --]


I've finally figured out what was happening here.

The issue was not related to Cygwin.


For those interested:

I compile my app using libraries from Exceed, then later use Cygwin as my X Server.

I had (2) problems here:
(1) I was using the wrong version of the Exceed DLLs at runtime.
(2) There appears to be a bug in Exceed 15 where if you set the environment variable "UserDir", it causes the cut/paste functionality to not work.  There was a previous bug where NOT setting this variable caused other issues.

thanks for all your help!




From: Stone, Timothy M
Sent: Wednesday, November 8, 2023 10:24 AM
To: 'cygwin@cygwin.com' <cygwin@cygwin.com>
Subject: RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.


I have made an important discovery here.  I've been using "release" mode when compiling, and had the following results:


On Windows 11 enterprise (release):

When using "translations_ignore", it correctly just prints "Ignoring" every time I cut/copy/paste.

When using "translations_copypaste", the program crashes.



On Windows 7 professional (release):

When using "translations_ignore", it correctly just prints "Ignoring" every time I cut/copy/paste.

When using "translations_copypaste", it correctly cuts/copies/pastes.


I have now compiled and run the program in "debug" mode and have noticed an important difference.

Instead of crashing on Windows 11 when trying to copy/paste, the program prints an error message and actually exits.

The error message is:
"Error: Error - registered format name must be nonnull"

Does anyone know where this error message is coming from?

I am starting to suspect that Windows clipboard integration routines have changed since Windows 7 and are not being used correctly internally.
I see there are some functions (which I presume are used internally) that sound a lot like this error message.
"RegisterClipboardFormat()" and "GetClipboardFormatName()", for instance.


Hopefully this new information can help the experts help me determine why my program is working on Windows 7 and crashing on Windows 11.

thanks!



From: Stone, Timothy M
Sent: Tuesday, November 7, 2023 12:21 PM
To: cygwin@cygwin.com
Subject: RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.




I have created an entire program to test this.  It's only 40 lines.  The program pops up a type in window...then you can type something in it and test the copy/paste.



On Windows 11 enterprise:

When using "translations_ignore", it correctly just prints "Ignoring" every time I cut/copy/paste.

When using "translations_copypaste", the program crashes.



On Windows 7 professional:

When using "translations_ignore", it correctly just prints "Ignoring" every time I cut/copy/paste.

When using "translations_copypaste", it correctly cuts/copies/pastes.



Of course, you'll need to link with X/Motif libraries, and possibly change the one line to point at your XKeysymDB, but this 40 line program shows the whole problem:




#include <stdio.h>
#include <stdlib.h>
#include <Xm/RowColumn.h>
#include <Xm/TextF.h>

void ignore_cut_paste(Widget widget, XEvent *event, String *args, int *num_args)
{
  printf("Ignoring\n");
}

int main(int argc, char **argv)
{
  Widget W,thewin,rowcol,textarea;
  XtAppContext app_context;
  XtActionsRec actions2;

  _putenv("display=127.0.0.1:0.0");
  _putenv("xkeysymdb=.\\XKeysymDB");

  W = XtAppInitialize(&app_context, (String)"Test",NULL,(Cardinal)0,&argc,argv,NULL,NULL,(Cardinal)0);

  actions2.string = "ignore_cut_paste";
  actions2.proc = (XtActionProc)ignore_cut_paste;
  XtAppAddActions (app_context, &actions2, 1);

  String translations_copypaste = "#override\n Ctrl<Key>v:  paste-clipboard()\n Ctrl<Key>c:  copy-clipboard()\n Ctrl<Key>x:  cut-clipboard()";
  String translations_ignore = "#override\n Ctrl<Key>v:  ignore_cut_paste()\n Ctrl<Key>c:  ignore_cut_paste()\n Ctrl<Key>x:  ignore_cut_paste()";

  thewin = XtCreatePopupShell("Test", topLevelShellWidgetClass,W,NULL,0);
  rowcol = XtVaCreateWidget ("rowcol",xmRowColumnWidgetClass, thewin, NULL);
  textarea = XtVaCreateManagedWidget ("test_area",
                                  xmTextFieldWidgetClass, rowcol,
                                  XmNmaxLength,        80,
                                  XmNtranslations,     XtParseTranslationTable ( translations_copypaste ) ,
                                  NULL);
  XtManageChild(textarea);
  XtManageChild (rowcol);
  XtPopup(thewin,XtGrabNone);
  XtAppMainLoop(app_context);
}







      reply	other threads:[~2023-11-16 18:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 20:17 Stone, Timothy M
2023-11-04 15:10 ` Jon Turney
2023-11-06 18:33   ` [EXT] " Stone, Timothy M
2023-11-06 18:54     ` Brian Inglis
2023-11-06 19:04       ` Stone, Timothy M
2023-11-06 19:14         ` Brian Inglis
2023-11-06 19:44           ` Stone, Timothy M
2023-11-07 17:20             ` Stone, Timothy M
2023-11-08 15:24               ` Stone, Timothy M
2023-11-16 18:21                 ` Stone, Timothy M [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c374b0c81c54137b616908f7c74e8cb@ida.org \
    --to=tstone@ida.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).