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







-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to