https://bugs.winehq.org/show_bug.cgi?id=50598
Bug ID: 50598 Summary: Wine Clipboard not always shared across to X11 Product: Wine Version: 6.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: paucoma@gmail.com Distribution: ---
Created attachment 69283 --> https://bugs.winehq.org/attachment.cgi?id=69283 Details on how I installed Wine
PDF XChange Editor Installation -------
https://www.tracker-software.com/product/pdf-xchange-editor https://pdf-xchange.eu/DL/pdf-xchange-editor.htm Download PDF-XChange Editor/Plus PORTABLE no OCR (32/64 Bit Version) (as ZIP File) unzipped into directory ..."C:\opt..." Version 8.0, build 343.0 [], Portable
installed Winbind as apparent "depenency" for error 005b:err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
:~$ apt list *winbind* | grep -i installed winbind/focal-updates,focal-security,now 2:4.11.6+dfsg-0ubuntu1.6 amd64 [installed]
Created a desktop entry in ~/.local/share/applications/wine-pdfxchgeditor.desktop
[Desktop Entry] Type=Application Name=PDF XChange Editor Comment=Windows Pdf Editor launched in wine Exec=env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='+clipboard,+timestamp,+tid,fixme-all' wine start "C:\opt\pdfxedit\PDFXEdit.exe" Terminal=true X-KeepTerminal=true Categories=Application; StartupNotify=true Icon=pdfxchg_bxv6 MimeType=application/pdf;
How To Reproduce the Bug: ------------
Not Working procedure: 1. Start the pdf Editor via the Ubuntu Launcher 2. Open any pdf file 3. Select text , copy (cntrl+C) (rightclick copy) 4. Paste in the same pdf and you see that the Wine Local Environment has the contents in its Clipboard 5. Goto a linux local environment gedit empty file, attempt to paste. The pasted contents are the "old" contents from a linux local environment.
Clipboards are not Shared
6. Keep this Not working instance of the program open and open a terminal 7. Execute the same command as in Exec from the .desktop shortcut and add logging (I have not been able to get logging from within the launcher to work) env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='+clipboard,+timestamp,+tid,fixme-all' wine start "C:\opt\pdfxedit\PDFXEdit.exe" &>myKOlog.txt 8. Attempt the same and you will see that it doesn't work either.
Working procedure: 1. Close any wine instances of the launched program (Fresh start) 2. Open a terminal window 3. env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='+clipboard,+timestamp,+tid,fixme-all' wine start "C:\opt\pdfxedit\PDFXEdit.exe" &>myOKlog.txt 4. Attempt Copy+Paste Routine, Locally within the wine program --> Works 5. Attempt Copy+Paste Across Wine to local linux Environment, e.g. gedit empty document. --> Works
Clipboards are Shared
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #1 from Pau Coma Ramirez paucoma@gmail.com --- Created attachment 69284 --> https://bugs.winehq.org/attachment.cgi?id=69284 Not Working Log output: WINEDEBUG='+ole,+clipboard,+timestamp,+tid'
env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='+ole,+clipboard,+timestamp,+tid' wine start "C:\opt\pdfxedit\PDFXEdit.exe" &>logKO.txt
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #2 from Pau Coma Ramirez paucoma@gmail.com --- Created attachment 69285 --> https://bugs.winehq.org/attachment.cgi?id=69285 Working Log output: WINEDEBUG='+ole,+clipboard,+timestamp,+tid'
env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='+ole,+clipboard,+timestamp,+tid' wine start "C:\opt\pdfxedit\PDFXEdit.exe" &>logOK.txt
https://bugs.winehq.org/show_bug.cgi?id=50598
Pau Coma Ramirez paucoma@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |paucoma@gmail.com Distribution|--- |Ubuntu
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #3 from Pau Coma Ramirez paucoma@gmail.com --- So Investigating the source code
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/clipboard...
2111 if ((event->selection != x11drv_atom(CLIPBOARD)) && 2112 (!use_primary_selection || event->selection != XA_PRIMARY)) goto done;
Searching for who was seeting the variable <use_primary_selection>
dlls/winex11.drv/x11drv_main.c 74 BOOL use_primary_selection = FALSE;
397 if (!get_config_key( hkey, appkey, "UsePrimarySelection", buffer, sizeof(buffer) )) 398 use_primary_selection = IS_OPTION_TRUE( buffer[0] );
Specifically within the function [static void setup_options(void)](https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/x11drv_ma...)
First it checks if the /* @@ Wine registry key: HKCU\Software\Wine\X11 Driver */ exists and assigns handle to hkey Second it checks if the /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults */ exits Then checks if the /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */ exists and assigns handle to appkey
the function `get_config_key(...)` First checks the application specific value `HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver\UsePrimarySelection" and returns its assigned value if it exists if it did not find an application specific value it checks the current user "general" value HKCU\Software\Wine\X11 Driver\UsePrimarySelection" and returns its assigned value if it exists
"True" has the following equivalencies. 121 #define IS_OPTION_TRUE(ch) \ 122 ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
I have added a specific registry for the app, and it has no influence on the app when started through the ubuntu launcher. When started from a terminal, currently it works. when earlier it didn't without the registry key. Yet previously it had worked without the registry key so I am not convinced that this is this... appears kinda randomly.... well requires more testing.. I will continue testing with the app specific registry key in place and see how it behaves.
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #4 from Pau Coma Ramirez paucoma@gmail.com --- Also searching through the code I found:
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/user32/tests/clipboar...
Which appears to be a whole load of tests I could possibly perform.
1- I have no idea what I need to even compile this into a usable executable 2- I have had a look and seems that some functions provide a routine of tests, yet if I would not know really how to use it.
I am guessing this is bundled within the winetest_latest.exe | https://wiki.winehq.org/Conformance_Tests, I have tried to run it as a full routine but it crashed my system and with the -n option I do not know how I would exlcude all options except for clipboard tests.
Any pointers?
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #5 from Pau Coma Ramirez paucoma@gmail.com --- I followed through some more code and performed some more tests attempting to trace where it is getting hanged and found the following: X11DRV_SelectionRequest(..) OK log gets called , KO log not
X11DRV_SelectionRequest(..) is called in `dlls/winex11.drv/event.c`
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/event.c#l... 107 static x11drv_event_handler handlers[MAX_EVENT_HANDLERS] = 108 { ... 139 X11DRV_SelectionRequest, /* 30 SelectionRequest */
217 void X11DRV_register_event_handler( int type, x11drv_event_handler handler, const char *name )
X11DRV_register_event_handler(..) OK log gets called , KO log not
380 static inline BOOL call_event_handler( Display *display, XEvent *event )
call_event_handler(..) OK log gets called , KO log also but never for `event->type "SelectionRequest"` in KO log
Lets see who calls `X11DRV_register_event_handler`
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/clipboard... 1977 static void xfixes_init(void)
xfixes_init(void) OK log gets called , KO log not
xfixes_init() called by clipboard_thread( ..)
2029 static DWORD WINAPI clipboard_thread( void *arg )
clipboard_thread(..) OK log gets called , KO log not
Clipboard_thread created in 2157 void X11DRV_InitClipboard(void)
X11DRV_InitClipboard(void) called in X11DRV_CreateWindow(..)
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/window.c#... 1866 BOOL CDECL X11DRV_CreateWindow( HWND hwnd ) 1867 { 1868 if (hwnd == GetDesktopWindow()) 1869 { ... 1884 X11DRV_InitClipboard();
I am suspecting that GetDesktopWindow may be a point of interest... found in https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/user32/win.c#l2063
GetDesktopWindow gets called in OK not in KO
This seems to be as far as I can go due to the lack of trace/debug messages...
https://bugs.winehq.org/show_bug.cgi?id=50598
--- Comment #6 from Pau Coma Ramirez paucoma@gmail.com --- So going back to the original point where I saw a difference..
Using `wine start` on the Ubuntu unity launcher is the problematic point.
I do not understand what the ubuntu unity launcher is doing when it executes what is specified in `Exec` line, in the `.desktop` file.
Clipboard Not Shared from wine to X11: Launched through `.desktop` Exec=env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='fixme-all' wine start "C:\opt\pdfxedit\PDFXEdit.exe" Z:%f
Clipboard gets Shared: Launched through `.desktop` Exec=env WINEPREFIX="/home/paui/.winex86" WINEDEBUG='fixme-all' wine /home/paui/.winex86/drive_c/opt/pdfxedit/PDFXEdit.exe Z:%f
When the same commands specified in the Exec line via a Terminal get executed Clipboard gets shared, in both cases.
"local" clipboards always work in all the cases.
I tried to add the /b option "Don't create a new console for the program." as specified [here](https://wiki.winehq.org/Start) but I am guessing it is not interpreted correctly and the program does not get executed.. or perhaps I have misunderstood how that option should work.
Anyway putting this to rest for now and as default will attempt to Avoid using wine start in the future.
https://bugs.winehq.org/show_bug.cgi?id=50598
Pau Coma Ramirez paucoma@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |winex11.drv
https://bugs.winehq.org/show_bug.cgi?id=50598
t.bussmann@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |t.bussmann@gmx.net