Page 1 of 1

Copy-paste from closed editor

Posted: Fri Sep 25, 2020 6:44 pm
by AndrzejB
I have Linux Mint 20.
I open my editor, copy from, paste to other place is ok.
I open my editor, copy from, close editor, paste to other place - no paste
It is for my editor, using Scintilla or Pascal Synedit.
But - if I open Gedit, copy from, close Gedit, is OK.
Is possible paste from my closed editor like Gedit?

Re: Copy-paste from closed editor

Posted: Fri Sep 25, 2020 7:21 pm
by PB
Do you use wxClipboard::Flush() in your code?
https://docs.wxwidgets.org/trunk/classw ... 33f291f932

Re: Copy-paste from closed editor

Posted: Sat Sep 26, 2020 6:12 am
by AndrzejB
I do :

Code: Select all

void MyFrame::OnCloseMain(wxCloseEvent& event)
{
    if (CloseAll()) {
        wxTheClipboard->Flush();
        Destroy();
    }
    else
        event.Veto();
}
But clipboard is cleared before destroy:, I must flush before delete notebook page.
Is problem: clibboard is cleared in wxModule::DoCleanUpModules ->
wxClipboardModule.OnExit(): wxDELETE(gs_clipboard);

Code: Select all

wxClipboard::~wxClipboard()
{
    Clear();

    gtk_widget_destroy( m_clipboardWidget ); <--------------------
    gtk_widget_destroy( m_targetsWidget );
}
Flush is only for application, not system?

Re: Copy-paste from closed editor

Posted: Sat Sep 26, 2020 7:26 am
by PB
Sorry, I do not use Linux myself, I am just aware of the method.

I assume you read the notes and did everything (i.e., have non-primary selection, checking the return value of Flush()).

Did you try the bundled clipboard sample and used File / Flush the Clipboard to see if it misbehaves as well on your system?

Re: Copy-paste from closed editor

Posted: Sat Sep 26, 2020 1:20 pm
by AndrzejB
Before closing I have text "Text from wx clipboard sample at Sat Sep 26 15:16:34 2020"
but after closing - no text.
I think it is Linux behaviour Other applications like Gedit (previously I badly check it) also not copied clipboard after closing.
Partially solution - editor will opened long time with single instance with IPC.

Re: Copy-paste from closed editor

Posted: Sat Sep 26, 2020 11:00 pm
by ONEEYEMAN
Hi,
What is your version of wx?
What GTK version it is built against??
What WM are you using IGNOME, KDE, Mate, etc)?

Thank you.

Re: Copy-paste from closed editor

Posted: Mon Sep 28, 2020 5:56 am
by AndrzejB
I compiled wxWidgets 3.1.4 with configure:
../configure --enable-sockets --with-gtk=3 --enable-unicode --enable-debug --disable-monolithic --disable-shared
on Linux Mint 20

Re: Copy-paste from closed editor

Posted: Mon Sep 28, 2020 6:37 am
by ONEEYEMAN
Hi,
Can you try clipbrd sample?

Also - Flush() call is for application - it stores the data inside the clipboard somewhere for later use.

Also try to build it with:

Code: Select all

../configure --enable-debug ---with-gtk=3
Thank you.

Re: Copy-paste from closed editor

Posted: Mon Sep 28, 2020 8:03 am
by AndrzejB
I have cinnamon. Other applications have the same problem, including gedit and gitk.

Re: Copy-paste from closed editor

Posted: Mon Sep 28, 2020 3:31 pm
by ONEEYEMAN
Hi,
It might be native behavior then (native in terms of Window Manager).

Thank you.