Fix regression: bug copying & pasting regular cels in the timeline

Before this fix if an image were allocated in the clipboard, then you
copied a Cel and wanted to paste it to other Cel, the previous image
were pasted in the canvas instead the last Cel copied in the timeline.

How to reproduce the bug:

- Make a sprite.
- Draw something on the canvas.
- Select a drawn region and copy the selection (the image is now in
  the clipboard).
- Add a frame in the time line.
- Copy the Cel of frame 1.
- Select the empty Cel of the frame 2.
- Paste: you'll see the image selected in step 3 was pasted on the
  canvas instead the last Cel copied on the timeline.
This commit is contained in:
Gaspar Capello 2021-04-19 14:45:18 -03:00 committed by David Capello
parent 80322af02e
commit 684ae08112
3 changed files with 9 additions and 0 deletions

View File

@ -341,6 +341,8 @@ void Clipboard::clearMaskFromCels(Tx& tx,
void Clipboard::clearContent()
{
if (use_native_clipboard())
clearNativeContent();
m_data->clear();
}

View File

@ -96,6 +96,7 @@ namespace app {
bool copyFromDocument(const Site& site, bool merged = false);
// Native clipboard
void clearNativeContent();
void registerNativeFormats();
bool hasNativeBitmap() const;
bool setNativeBitmap(const doc::Image* image,

View File

@ -54,6 +54,12 @@ namespace {
}
void Clipboard::clearNativeContent()
{
clip::lock l(native_window_handle());
l.clear();
}
void Clipboard::registerNativeFormats()
{
clip::set_error_handler(custom_error_handler);