Copy-paste from closed editor

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
AndrzejB
Experienced Solver
Experienced Solver
Posts: 76
Joined: Sun Nov 29, 2015 12:46 pm

Copy-paste from closed editor

Post by AndrzejB » Fri Sep 25, 2020 6:44 pm

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?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2580
Joined: Sun Jan 03, 2010 5:45 pm

Re: Copy-paste from closed editor

Post by PB » Fri Sep 25, 2020 7:21 pm

Do you use wxClipboard::Flush() in your code?
https://docs.wxwidgets.org/trunk/classw ... 33f291f932

AndrzejB
Experienced Solver
Experienced Solver
Posts: 76
Joined: Sun Nov 29, 2015 12:46 pm

Re: Copy-paste from closed editor

Post by AndrzejB » Sat Sep 26, 2020 6:12 am

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?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2580
Joined: Sun Jan 03, 2010 5:45 pm

Re: Copy-paste from closed editor

Post by PB » Sat Sep 26, 2020 7:26 am

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?

AndrzejB
Experienced Solver
Experienced Solver
Posts: 76
Joined: Sun Nov 29, 2015 12:46 pm

Re: Copy-paste from closed editor

Post by AndrzejB » Sat Sep 26, 2020 1:20 pm

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.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4438
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Copy-paste from closed editor

Post by ONEEYEMAN » Sat Sep 26, 2020 11:00 pm

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.

AndrzejB
Experienced Solver
Experienced Solver
Posts: 76
Joined: Sun Nov 29, 2015 12:46 pm

Re: Copy-paste from closed editor

Post by AndrzejB » Mon Sep 28, 2020 5:56 am

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

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4438
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Copy-paste from closed editor

Post by ONEEYEMAN » Mon Sep 28, 2020 6:37 am

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.

AndrzejB
Experienced Solver
Experienced Solver
Posts: 76
Joined: Sun Nov 29, 2015 12:46 pm

Re: Copy-paste from closed editor

Post by AndrzejB » Mon Sep 28, 2020 8:03 am

I have cinnamon. Other applications have the same problem, including gedit and gitk.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4438
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Copy-paste from closed editor

Post by ONEEYEMAN » Mon Sep 28, 2020 3:31 pm

Hi,
It might be native behavior then (native in terms of Window Manager).

Thank you.

Post Reply