Giter VIP home page Giter VIP logo

Comments (8)

vadz avatar vadz commented on June 11, 2024

Just to check, when you say "latest", it's really latest, including #24423 (~a week ago)?

from wxwidgets.

tobiolo avatar tobiolo commented on June 11, 2024

Just to check, when you say "latest", it's really latest, including #24423 (~a week ago)?

Thanks for your quick reply. Yes, it does include #24423.

from wxwidgets.

tobiolo avatar tobiolo commented on June 11, 2024

Just for information:

(gdb) b wxGTKIsSameFormat(_GdkAtom*, _GdkAtom*) 
Breakpoint 1 at 0x429db8: file /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/dataobj.cpp, line 179.
Thread 1 "treesheets" hit Breakpoint 1, wxGTKIsSameFormat (atom1=0x47, atom2=0x4e) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/dataobj.cpp:179
179	   if (atom1 == atom2)
(gdb) f
#0  wxGTKIsSameFormat (atom1=0x47, atom2=0x4e) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/dataobj.cpp:179
179	   if (atom1 == atom2)
(gdb) s
182	   if (atom1 == g_u8strAtom && atom2 == g_u8textAtom)
(gdb) p g_u8strAtom
$4 = {m_name = 0x555555e814cb "UTF8_STRING", m_atom = 0x47}
(gdb) p g_u8textAtom
$5 = {m_name = 0x555555e814de "text/plain;charset=utf-8", m_atom = 0x4e}
(gdb) p atom1
$6 = (GdkAtom) 0x47
(gdb) p atom2
$7 = (GdkAtom) 0x4e
(gdb) s
(anonymous namespace)::operator== (atom=0x47, wxatom=...) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/dataobj.cpp:68
68	   return atom == wxatom.Get();
(gdb) p atom
$8 = (GdkAtom) 0x47
(gdb) p wxatom
$9 = (const (anonymous namespace)::wxGdkAtom &) @0x555556233610: {m_name = 0x555555e814cb "UTF8_STRING", m_atom = 0x47}

from wxwidgets.

tobiolo avatar tobiolo commented on June 11, 2024

I guess the relevant breakpoints are

(gdb) info b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x000055555597860f in wxClipboard::DoGetTarget(wxDataFormat const&) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/clipbrd.cpp:561
	breakpoint already hit 11 times
2       breakpoint     keep y   0x0000555555975e96 in wxClipboard::GTKOnTargetReceived(wxDataFormat const&) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/clipbrd.cpp:181
	breakpoint already hit 1 time
3       breakpoint     keep y   0x0000555555975e7b in wxClipboard::GTKOnTargetReceived(wxDataFormat const&) at /home/t2b3/development/treesheets/lib/wxWidgets/src/gtk/clipbrd.cpp:178
	breakpoint already hit 22 times
``

from wxwidgets.

tobiolo avatar tobiolo commented on June 11, 2024

I think that this should illustrate the issue and the interplay between wxClipboard::DoGetTarget(wxDataFormat const&) and wxClipboard::GTKOnTargetReceived(wxDataFormat const&).

image

from wxwidgets.

vadz avatar vadz commented on June 11, 2024

Sorry, I'm a bit lost here, could you please clarify what exactly the problem is and how can it be reproduced? The fact that the atom doesn't "match" is not necessarily a problem per se, it's just an implementation detail, so I'd like to understand what actually goes wrong at the application level.

As usual, having (the smallest possible) patch to the text sample would be ideal. TIA!

from wxwidgets.

tobiolo avatar tobiolo commented on June 11, 2024

Here is the smallest patch.

diff --git a/samples/text/text.cpp b/samples/text/text.cpp
index 172128b090..baa589a33d 100644
--- a/samples/text/text.cpp
+++ b/samples/text/text.cpp
@@ -1345,20 +1345,22 @@ void MyPanel::DoPasteFromClipboard()
 #endif // wxUSE_LOG
     }
 
-    wxTextDataObject data;
+    wxDataObjectComposite* datac = new wxDataObjectComposite();
+    wxTextDataObject* data = new wxTextDataObject();
+    datac->Add(data);
 
-    if (wxTheClipboard->IsSupported( data.GetFormat() ))
+    if (wxTheClipboard->IsSupported( data->GetFormat() ))
     {
 #if wxUSE_LOG
         *m_log << "Clipboard supports requested format.\n";
 #endif // wxUSE_LOG
 
-        if (wxTheClipboard->GetData( data ))
+        if (wxTheClipboard->GetData( *datac ))
         {
 #if wxUSE_LOG
             *m_log << "Successfully retrieved data from the clipboard.\n";
 #endif // wxUSE_LOG
-            GetFocusedText()->AppendText(data.GetText());
+            GetFocusedText()->AppendText(data->GetText());
         }
         else
         {

When you run the application with Wayland, copy some text from GNOME Nautilus or from the address bar in Google Chrome (examples only using the two text/plain mimetype atoms) and then try to paste with the menubar action in the application you get an assert error:
/home/t2b3/development/treesheets/lib/wxWidgets/src/common/dobjcmn.cpp(210): assert "dataObj" failed in SetData(): unsupported format in wxDataObjectComposite

from wxwidgets.

vadz avatar vadz commented on June 11, 2024

Should be fixed by #24505, please let me know if you still see any problems. TIA!

from wxwidgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.