public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
@ 2023-11-03 20:17 Stone, Timothy M
  2023-11-04 15:10 ` Jon Turney
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-03 20:17 UTC (permalink / raw)
  To: 'The Cygwin Mailing List'

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



Hi folks,



I'm having a really hard time debugging this issue.



If I use the exact same version of cygwin and XWin, exact same code, exact same Motif GUI app...



I find that when I try to use copy/paste functionality in TextFieldWidgets:



  *Cut/Copy/Paste works perfectly on Windows 7 Professional



  *Cut/Copy/Paste does not work at all and typically crashes on Windows 11 Enterprise



I am using an older version of cygwin for this specific test (cygwin 1.7.15 and XWin 1.13.2-1), but I am having the same issue with the latest version as well.



The fact that the same version works on 1 system and not on another seems to be the most important clue here.



Is there some system configuration I can enable to make the clipboard integration work on my newer system?





I am launching XWin like this on both systems (with clipboard integration):



run XWin -multiwindow -clipboard -silent-dup-error



Any help greatly appreciated!  Seems this must be a system issue since everything about the cygwin and XWin is exactly the same on both systems?



thanks!

tim



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-03 20:17 XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise Stone, Timothy M
@ 2023-11-04 15:10 ` Jon Turney
  2023-11-06 18:33   ` [EXT] " Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Turney @ 2023-11-04 15:10 UTC (permalink / raw)
  To: Stone, Timothy M, The Cygwin Mailing List

On 03/11/2023 20:17, Stone, Timothy M via Cygwin wrote:
>  
> 
> I'm having a really hard time debugging this issue.
> 
> 
> 
> If I use the exact same version of cygwin and XWin, exact same code, exact same Motif GUI app...
> 
> 
> 
> I find that when I try to use copy/paste functionality in TextFieldWidgets:
> 
> 
> 
>    *Cut/Copy/Paste works perfectly on Windows 7 Professional
> 
> 
> 
>    *Cut/Copy/Paste does not work at all and typically crashes on Windows 11 Enterprise
>

I'm assuming this means "the X server crashes", but it's not exactly clear.

If that is the case, there are some instructions on generating 
backtraces to help with debugging at [1].

[1] https://x.cygwin.com/devel/backtrace.html

> 
> I am using an older version of cygwin for this specific test (cygwin 1.7.15 and XWin 1.13.2-1), but I am having the same issue with the latest version as well.
> 
[...]
> 
> Any help greatly appreciated!  Seems this must be a system issue since everything about the cygwin and XWin is exactly the same on both systems?

It's not really safe to make assumptions like this. This could be a 
latent bug in XWin which just happens to get exposed on W11 (or that 
particular system, even)...



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-04 15:10 ` Jon Turney
@ 2023-11-06 18:33   ` Stone, Timothy M
  2023-11-06 18:54     ` Brian Inglis
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-06 18:33 UTC (permalink / raw)
  To: 'Jon Turney', The Cygwin Mailing List

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



Thanks for your reply.  I didn't provide enough information last time, sorry about that.



Let me start over, with an example and some brief code.



Below is some simple code to bring up a shell with a TextField widget in it.



When I initialize the TextField widget, I change the code to use 1 of the 2 listed translations:



  translations_copypaste:  This translation table calls the built-in actions for paste-clipboard, copy-clipboard, and cut-clipboard when the familiar ctrl-c, ctrl-x, and ctrl-v are pressed.



  translations_ignore:  This translation table always calls ignore_cut_paste() when the same keys are pressed.  This function just prints a message to the console ("Ignoring") so I know it's working.



This is almost the entire program.  All that is missing is initializing the parent and the app_context.





What happens is:



On Windows 7 Professional:

Both translation tables work as expected:

translations_ignore: Correctly causes the text "Ignoring" to print every time ctrl-c, ctrl-x, or ctrl-v are pressed.

translations_copypaste:  Correctly causes text in the small window to cut/paste/copy as expected and is integrated with the system clipboard.



On Windows 11 Enterprise:

translations_ignore: Correctly causes the text "Ignoring" to print every time ctrl-c, ctrl-x, or ctrl-v are pressed.

translations_copypaste:  My application (not the X-Server) crashes every time ctrl-c, ctrl-x, or ctrl-v are pressed.  The X-Server seems to continue running.





I don't know how to debug this further...

  it seems like the translation table is working, since the "ignore" translation table works...

  also, everything works perfectly on Windows 7 professional, so it seems like the "should"" be OK.





Code:




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

void TestPaste(Widget parent)
{
  Widget thewin,rowcol,textarea;
  XtActionsRec actions2;

  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,parent,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);
}

















-----Original Message-----
From: Jon Turney <jon.turney@dronecode.org.uk>
Sent: Saturday, November 4, 2023 11:11 AM
To: Stone, Timothy M <tstone@ida.org>; The Cygwin Mailing List <cygwin@cygwin.com>
Subject: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.



*** This email originated outside of IDA. Please verify that you recognize the sender and know the content is safe before proceeding. ***





On 03/11/2023 20:17, Stone, Timothy M via Cygwin wrote:

>

>

> I'm having a really hard time debugging this issue.

>

>

>

> If I use the exact same version of cygwin and XWin, exact same code, exact same Motif GUI app...

>

>

>

> I find that when I try to use copy/paste functionality in TextFieldWidgets:

>

>

>

>    *Cut/Copy/Paste works perfectly on Windows 7 Professional

>

>

>

>    *Cut/Copy/Paste does not work at all and typically crashes on

> Windows 11 Enterprise

>



I'm assuming this means "the X server crashes", but it's not exactly clear.



If that is the case, there are some instructions on generating backtraces to help with debugging at [1].



[1] https://x.cygwin.com/devel/backtrace.html



>

> I am using an older version of cygwin for this specific test (cygwin 1.7.15 and XWin 1.13.2-1), but I am having the same issue with the latest version as well.

>

[...]

>

> Any help greatly appreciated!  Seems this must be a system issue since everything about the cygwin and XWin is exactly the same on both systems?



It's not really safe to make assumptions like this. This could be a latent bug in XWin which just happens to get exposed on W11 (or that particular system, even)...





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-06 18:33   ` [EXT] " Stone, Timothy M
@ 2023-11-06 18:54     ` Brian Inglis
  2023-11-06 19:04       ` Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Brian Inglis @ 2023-11-06 18:54 UTC (permalink / raw)
  To: cygwin; +Cc: Stone, Timothy M

On 2023-11-06 11:33, Stone, Timothy M via Cygwin wrote:
>> On 03/11/2023 20:17, Stone, Timothy M via Cygwin wrote:
>>> I'm having a really hard time debugging this issue.
>>> If I use the exact same version of cygwin and XWin, exact same code,
>>> exact same Motif GUI app...
>>> I find that when I try to use copy/paste functionality in
>>> TextFieldWidgets:
>>>     *Cut/Copy/Paste works perfectly on Windows 7 Professional
>>>     *Cut/Copy/Paste does not work at all and typically crashes on
>>> Windows 11 Enterprise
>> I'm assuming this means "the X server crashes", but it's not exactly clear.
>> If that is the case, there are some instructions on generating backtraces to
>> help with debugging at [1].
>> [1] https://x.cygwin.com/devel/backtrace.html
>>> I am using an older version of cygwin for this specific test (cygwin 1.7.15
>>> and XWin 1.13.2-1), but I am having the same issue with the latest version
>>> as well.>> Any help greatly appreciated!  Seems this must be a system issue since 
>>> everything about the cygwin and XWin is exactly the same on both systems?> It's not really safe to make assumptions like this. This could be a latent
>> bug in XWin which just happens to get exposed on W11 (or that particular
>> system, even)...

> Thanks for your reply. I didn't provide enough information last time, sorry
> about that. > Let me start over, with an example and some brief code.
> Below is some simple code to bring up a shell with a TextField widget in it.
> When I initialize the TextField widget, I change the code to use 1 of the 2 listed translations:
>    translations_copypaste:  This translation table calls the built-in actions for paste-clipboard, copy-clipboard, and cut-clipboard when the familiar ctrl-c, ctrl-x, and ctrl-v are pressed.
>    translations_ignore:  This translation table always calls ignore_cut_paste() when the same keys are pressed.  This function just prints a message to the console ("Ignoring") so I know it's working.
> This is almost the entire program.  All that is missing is initializing the parent and the app_context.
> What happens is:
> On Windows 7 Professional:
> Both translation tables work as expected:
> translations_ignore: Correctly causes the text "Ignoring" to print every time ctrl-c, ctrl-x, or ctrl-v are pressed.
> translations_copypaste:  Correctly causes text in the small window to cut/paste/copy as expected and is integrated with the system clipboard.
> On Windows 11 Enterprise:
> translations_ignore: Correctly causes the text "Ignoring" to print every time ctrl-c, ctrl-x, or ctrl-v are pressed.
> translations_copypaste:  My application (not the X-Server) crashes every time ctrl-c, ctrl-x, or ctrl-v are pressed.  The X-Server seems to continue running.
> I don't know how to debug this further...
>    it seems like the translation table is working, since the "ignore" translation table works...
>    also, everything works perfectly on Windows 7 professional, so it seems like the "should"" be OK.
> Code:
> void ignore_cut_paste(Widget widget, XEvent *event, String *args, int *num_args)
> {
>    printf("Ignoring\n");
> }
> 
> void TestPaste(Widget parent)
> {
>    Widget thewin,rowcol,textarea;
>    XtActionsRec actions2;
> 
>    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,parent,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);
> }

Have you tried the original Motif copy/cut/paste C-Ins/S-Del/S-Ins available at 
Windows system level to see if that can give you some hints about what's happening?

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-06 18:54     ` Brian Inglis
@ 2023-11-06 19:04       ` Stone, Timothy M
  2023-11-06 19:14         ` Brian Inglis
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-06 19:04 UTC (permalink / raw)
  To: cygwin

>Have you tried the original Motif copy/cut/paste C-Ins/S-Del/S-Ins available at Windows system level to see if that can give you some hints about what's happening?
>
>-- 
>Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada
>
>La perfection est atteinte                   Perfection is achieved
>non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
>mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
>                                 -- Antoine de Saint-Exupéry


I don't know how to do this...can you explain?  



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-06 19:04       ` Stone, Timothy M
@ 2023-11-06 19:14         ` Brian Inglis
  2023-11-06 19:44           ` Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Brian Inglis @ 2023-11-06 19:14 UTC (permalink / raw)
  To: cygwin; +Cc: Stone, Timothy M

On 2023-11-06 12:04, Stone, Timothy M via Cygwin wrote:
>> Have you tried the original Motif copy/cut/paste C-Ins/S-Del/S-Ins
>> available at Windows system level to see if that can give you some hints
>> about what's happening?
> I don't know how to do this...can you explain?

Try Ctrl-Insert/Shift-Delete/Shift-Insert instead of ^C/^X/^V and see if 
anything is the same/different and if that tells you anything more.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-06 19:14         ` Brian Inglis
@ 2023-11-06 19:44           ` Stone, Timothy M
  2023-11-07 17:20             ` Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-06 19:44 UTC (permalink / raw)
  To: cygwin



>-----Original Message-----
>From: Brian Inglis <Brian.Inglis@Shaw.ca> 
>Sent: Monday, November 6, 2023 2:14 PM
>To: cygwin@cygwin.com
>Cc: Stone, Timothy M <tstone@ida.org>
>Subject: Re: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.

>On 2023-11-06 12:04, Stone, Timothy M via Cygwin wrote:
>>> Have you tried the original Motif copy/cut/paste C-Ins/S-Del/S-Ins 
>>> available at Windows system level to see if that can give you some 
>>> hints about what's happening?
>> I don't know how to do this...can you explain?

>Try Ctrl-Insert/Shift-Delete/Shift-Insert instead of ^C/^X/^V and see if anything is the same/different and if that tells you anything more.


Using these system commands gives the exact same results as in my app:

Ctrl-insert or Ctrl-c:  Should "copy", but crashes every time.

Shift-Delete or Ctrl-x:  Should "cut", but crashes every time.

Shift-insert or Ctrl-v:  Should "paste", but does nothing if I have the cursor positioned.
Actually, if I have some characters highlighted, they go away, as if I pasted "nothing".  At least it doesn't crash!
Perhaps because the cygwin clipboard is empty and it isn't for some reason using the system clipboard, it special cases to just remove the characters and not crash?

PS I have obviously started xwin with "-clipboard" (since it works on Windows 7).  It should see the system clipboard and paste that value.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-06 19:44           ` Stone, Timothy M
@ 2023-11-07 17:20             ` Stone, Timothy M
  2023-11-08 15:24               ` Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-07 17:20 UTC (permalink / raw)
  To: cygwin

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



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);
}







^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-07 17:20             ` Stone, Timothy M
@ 2023-11-08 15:24               ` Stone, Timothy M
  2023-11-16 18:21                 ` Stone, Timothy M
  0 siblings, 1 reply; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-08 15:24 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

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


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);
}







^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXT] Re: XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise.
  2023-11-08 15:24               ` Stone, Timothy M
@ 2023-11-16 18:21                 ` Stone, Timothy M
  0 siblings, 0 replies; 10+ messages in thread
From: Stone, Timothy M @ 2023-11-16 18:21 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

[-- 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);
}







^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-16 18:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03 20:17 XWin copy/paste succeeds on Windows 7, crashes on Windows 11 Enterprise 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 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).