Thread: New wx patch
Hi Dave, I nailed down and fixed another clipboard bug. Actually, it's the same problem we had with gtk, so I extended an existing patch. I uploaded a cumulative patch to snake, but for compiling a new wx snapshot you'd probable be better off if you apply the attached patch separately. Since three files in the current snapshot are already patched, the re-patch probably fails. Just get a fresh copy from wx cvs, or I could mail you the files if you like that better. For gtk, nightly builds do *not* need this additional patch, because the new patch is just a reimplementation; this change affects only msw. Regards, Andreas Index: src/gtk/clipbrd.cpp =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/src/gtk/clipbrd.cpp,v retrieving revision 1.53 diff -u -r1.53 clipbrd.cpp --- src/gtk/clipbrd.cpp 2003/08/09 12:46:08 1.53 +++ src/gtk/clipbrd.cpp 2003/10/26 15:40:15 @@ -171,11 +171,14 @@ /* make sure we got the data in the correct form (selection type). if so, copy data to target object */ +#if 0 + // prevents things to work, we already checked above! if (selection_data->type != GDK_SELECTION_TYPE_STRING) { clipboard->m_waiting = FALSE; return; } +#endif data_object->SetData( format, (size_t) selection_data->length, (const char*) selection_data->data ); @@ -497,6 +500,15 @@ (guint32) GDK_CURRENT_TIME ); while (m_waiting) gtk_main_iteration(); + +#if defined(__WXGTK20__) && wxUSE_UNICODE + if (!m_formatSupported && format == wxDataFormat(wxDF_UNICODETEXT)) + { + // Another try with plain STRING format + extern GdkAtom g_altTextAtom; + return IsSupported(g_altTextAtom); + } +#endif if (!m_formatSupported) return FALSE; Index: src/gtk/dataobj.cpp =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/src/gtk/dataobj.cpp,v retrieving revision 1.40 diff -u -r1.40 dataobj.cpp --- src/gtk/dataobj.cpp 2003/09/09 18:04:57 1.40 +++ src/gtk/dataobj.cpp 2003/10/26 15:40:16 @@ -28,6 +28,7 @@ //------------------------------------------------------------------------- GdkAtom g_textAtom = 0; +GdkAtom g_altTextAtom = 0; GdkAtom g_pngAtom = 0; GdkAtom g_fileAtom = 0; @@ -77,12 +78,9 @@ { PrepareFormats(); - if (type == wxDF_UNICODETEXT) - type = wxDF_TEXT; - m_type = type; - if (m_type == wxDF_TEXT) + if (m_type == wxDF_TEXT || m_type == wxDF_UNICODETEXT) m_format = g_textAtom; else if (m_type == wxDF_BITMAP) @@ -143,7 +141,10 @@ // here (with whom?) if (!g_textAtom) #if wxUSE_UNICODE + { g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE ); + g_altTextAtom = gdk_atom_intern( "STRING", FALSE ); + } #else g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE ); #endif @@ -191,6 +192,21 @@ return n < nFormatCount; } } + + +// ---------------------------------------------------------------------------- +// wxTextDataObject +// ---------------------------------------------------------------------------- + +#if defined(__WXGTK20__) && wxUSE_UNICODE + +void wxTextDataObject::GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir) const +{ + *formats++ = GetPreferredFormat(); + *formats = g_altTextAtom; +} + +#endif // ---------------------------------------------------------------------------- // wxFileDataObject Index: src/msw/ole/dataobj.cpp =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/src/msw/ole/dataobj.cpp,v retrieving revision 1.75 diff -u -r1.75 dataobj.cpp --- src/msw/ole/dataobj.cpp 2003/09/12 16:10:00 1.75 +++ src/msw/ole/dataobj.cpp 2003/10/26 15:40:16 @@ -755,6 +755,23 @@ #endif // Debug + + +// ---------------------------------------------------------------------------- +// wxTextDataObject supports CF_UNICODETEXT, CF_TEXT, CF_OEMTEXT +// ---------------------------------------------------------------------------- + + +void wxTextDataObject::GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir)) const +{ + *formats++ = wxDataFormat(wxDF_UNICODETEXT); + *formats++ = wxDataFormat(wxDF_TEXT); + *formats = wxDataFormat(wxDF_OEMTEXT); +} + + + // ---------------------------------------------------------------------------- // wxBitmapDataObject supports CF_DIB format // ---------------------------------------------------------------------------- Index: include/wx/dataobj.h =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/include/wx/dataobj.h,v retrieving revision 1.51 diff -u -r1.51 dataobj.h --- include/wx/dataobj.h 2003/08/09 12:37:10 1.51 +++ include/wx/dataobj.h 2003/10/26 15:40:16 @@ -335,20 +335,32 @@ // implement base class pure virtuals // ---------------------------------- - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } + virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } + virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } +#if wxUSE_UNICODE +#if defined(__WXGTK20__) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; +#endif + +#if defined(__WXMSW__) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 3; }; + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; +#endif + +#endif + private: wxString m_text; // virtual function hiding supression - size_t GetDataSize(const wxDataFormat& format) const - { return(wxDataObjectSimple::GetDataSize(format)); } - bool GetDataHere(const wxDataFormat& format, void *pBuf) const - { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) - { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } + size_t GetDataSize(const wxDataFormat& format) const; + bool GetDataHere(const wxDataFormat& format, void *pBuf) const; + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); DECLARE_NO_COPY_CLASS(wxTextDataObject) }; Index: src/common/dobjcmn.cpp =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/src/common/dobjcmn.cpp,v retrieving revision 1.25 diff -u -r1.25 dobjcmn.cpp --- src/common/dobjcmn.cpp 2003/08/09 12:45:45 1.25 +++ src/common/dobjcmn.cpp 2003/10/26 15:40:16 @@ -237,41 +237,63 @@ // wxTextDataObject // ---------------------------------------------------------------------------- -size_t wxTextDataObject::GetDataSize() const +size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { -#if defined(__WXGTK20__) && wxUSE_UNICODE - // Use UTF8 not UCS4 - wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); - return strlen( (const char*) buffer ) + 1; + if (format == wxDF_UNICODETEXT) + { +#if defined(__WXGTK20__) + // Use UTF8 not UCS4 + wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); + return strlen( (const char*) buffer ) + 1; #else - return GetTextLength() * sizeof(wxChar); + return GetTextLength() * sizeof(wxChar); #endif + } + else + { + wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() ); + return strlen( (const char*) buffer ) + 1; + } } -bool wxTextDataObject::GetDataHere(void *buf) const + +bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { -#if defined(__WXGTK20__) && wxUSE_UNICODE - // Use UTF8 not UCS4 - wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); - strcpy( (char*) buf, (const char*) buffer ); + if (format == wxDF_UNICODETEXT) + { +#if defined(__WXGTK20__) + // Use UTF8 not UCS4 + wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); + strcpy( (char*) buf, (const char*) buffer ); #else - wxStrcpy((wxChar *)buf, GetText().c_str()); + wxStrcpy((wxChar *)buf, GetText().c_str()); #endif - + } + else + { + wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() ); + strcpy( (char*) buf, (const char*) buffer ); + } return TRUE; } + -bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf) +bool wxTextDataObject::SetData(const wxDataFormat& format, + size_t WXUNUSED(len), const void *buf) { -#if defined(__WXGTK20__) && wxUSE_UNICODE - // Use UTF8 not UCS4 - SetText( wxConvUTF8.cMB2WX( (const char*) buf ) ); + if (format == wxDF_UNICODETEXT) +#ifdef __WXGTK20__ + SetText( wxConvUTF8.cMB2WX( (const char*) buf ) ); #else - SetText(wxString((const wxChar *)buf)); + SetText(wxString((const wxChar *)buf)); #endif + else + SetText( wxConvLibc.cMB2WX( (const char*) buf ) ); return TRUE; } + + // ---------------------------------------------------------------------------- // wxFileDataObjectBase
Hi Andreas. setup0.h isn't contained though "wx-20031026.patch" of the accumulation. you think that it was particularly excluded. Write it in readme-patches.txt. Because I was stupid, I did Make-Test again.:-( Does the thing which contains it become wxWindows-pgAdmin3-20031010-6.tar.bz2? And ID of the doubt?(828538->828537) ---readme-patches.txt----- ... wx-20031026.patch ================= ... all 828538 Wrong size calculation in wxCalendarCtrl Is it 828538? So, I am not found. regards, Hiroshi Saito ----- Original Message ----- From: "Andreas Pflug" <pgadmin@pse-consulting.de> > Hi Dave, > > I nailed down and fixed another clipboard bug. Actually, it's the same > problem we had with gtk, so I extended an existing patch. > I uploaded a cumulative patch to snake, but for compiling a new wx > snapshot you'd probable be better off if you apply the attached patch > separately. Since three files in the current snapshot are already > patched, the re-patch probably fails. Just get a fresh copy from wx cvs, > or I could mail you the files if you like that better. > > For gtk, nightly builds do *not* need this additional patch, because the > new patch is just a reimplementation; this change affects only msw.
Hiroshi Saito wrote: >Hi Andreas. > >setup0.h isn't contained though "wx-20031026.patch" of the accumulation. >you think that it was particularly excluded. >Write it in readme-patches.txt. > > Hm, should be still in it, since xxxx-2. >Because I was stupid, I did Make-Test again.:-( >Does the thing which contains it become wxWindows-pgAdmin3-20031010-6.tar.bz2? > > Yes, probably, as soon as Dave finds the time to do so. >And ID of the doubt?(828538->828537) > > Typo, corrected. Regards, Andreas
> -----Original Message----- > From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] > Sent: 27 October 2003 10:32 > To: Hiroshi Saito > Cc: Dave Page; pgadmin-hackers > Subject: Re: [pgadmin-hackers] New wx patch > > > Yes, probably, as soon as Dave finds the time to do so. Go live has been surprisingly quiet so far so I can only assume all our staff are on holiday. I'm building the new snapshot now - this will be based on the 20031026 wx snapshot if all works. Regards, Dave.
Dave Page wrote: > > > > >>-----Original Message----- >>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] >>Sent: 27 October 2003 10:32 >>To: Hiroshi Saito >>Cc: Dave Page; pgadmin-hackers >>Subject: Re: [pgadmin-hackers] New wx patch >> >> >>Yes, probably, as soon as Dave finds the time to do so. >> >> > >Go live has been surprisingly quiet so far so I can only assume all our >staff are on holiday. > >I'm building the new snapshot now - this will be based on the 20031026 >wx snapshot if all works. > > Do you mean a wx cvs snapshot as of Oct. 26th? This isn't tested! The name of the new patch file might be misleading, but it is still based on the Oct. 10th wx cvs. Regards, Andreas
> -----Original Message----- > From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] > Sent: 27 October 2003 11:16 > To: Dave Page > Cc: pgadmin-hackers > Subject: Re: [pgadmin-hackers] New wx patch > > Do you mean a wx cvs snapshot as of Oct. 26th? This isn't tested! > The name of the new patch file might be misleading, Combined with your comment of: 'Just get a fresh copy from wx cvs' which at first glance said 'upgrade' to me. > but it is > still based on the Oct. 10th wx cvs. Probably a good thing because 20031026 doesn't work. It just hangs without even showing the splash screen. Regards, Dave.
Dave Page wrote: > > > > >>-----Original Message----- >>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] >>Sent: 27 October 2003 11:16 >>To: Dave Page >>Cc: pgadmin-hackers >>Subject: Re: [pgadmin-hackers] New wx patch >> >>Do you mean a wx cvs snapshot as of Oct. 26th? This isn't tested! >>The name of the new patch file might be misleading, >> >> > >Combined with your comment of: 'Just get a fresh copy from wx cvs' which >at first glance said 'upgrade' to me. > > Sorry to be too unprecise. I meant 'get a fresh copy of that 3 files with the sticky option 20031010'. >Probably a good thing because 20031026 doesn't work. > I'm not too surprised... As long as there's not a real good reason (major platform enhancement, release) there's no reason to try cvs head. All new wx controls we need are contained in the pgAdmin3 sources. Regards, Andreas
> -----Original Message----- > From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] > Sent: 27 October 2003 12:04 > To: Dave Page > Cc: pgadmin-hackers > Subject: Re: [pgadmin-hackers] New wx patch > > Dave Page wrote: > > > > >Probably a good thing because 20031026 doesn't work. > > > > I'm not too surprised... > As long as there's not a real good reason (major platform > enhancement, > release) there's no reason to try cvs head. All new wx > controls we need > are contained in the pgAdmin3 sources. Although I now find that 20031010 hangs in the same way :-( No logfile is created. Regards, Dave. root@snake:/usr/local/src/pgadmin3# gdb src/pgadmin3 GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-slackware-linux"... (gdb) run Starting program: /usr/local/src/pgadmin3/src/pgadmin3 [New Thread 16384 (LWP 14288)] Program received signal SIGINT, Interrupt. [Switching to Thread 16384 (LWP 14288)] 0x40795d61 in sigsuspend () from /lib/libc.so.6 Current language: auto; currently c (gdb) bt #0 0x40795d61 in sigsuspend () from /lib/libc.so.6 #1 0x40722128 in __pthread_wait_for_restart_signal () from /lib/libpthread.so.0 #2 0x407243cc in __pthread_alt_lock () from /lib/libpthread.so.0 #3 0x40720490 in pthread_mutex_lock () from /lib/libpthread.so.0 #4 0x085db7c5 in wxMutexInternal::Lock() (this=0x88c4280) at src/unix/threadpsx.cpp:244 #5 0x085de6de in wxMutex::Lock() (this=0x88bff80) at include/wx/thrimpl.cpp:44 #6 0x085df145 in wxCriticalSection::Enter() (this=0x88bff80) at include/wx/thread.h:270 #7 0x085df19b in wxCriticalSectionLocker (this=0xbffff1c0, cs=@0x88bff80) at include/wx/thread.h:285 #8 0x085ad873 in wxVLogError(wchar_t const*, char*) (szFormat=0x87430c0, argptr=0xbffff204 "ôÆ\216\b(òÿ¿v\030~@") at src/common/log.cpp:167 #9 0x085ad8fc in wxLogError(wchar_t const*, ...) (szFormat=0x87430c0) at src/common/log.cpp:167 #10 0x085ba1f0 in wxCSConv::DoCreate() const (this=0x88c2038) at src/common/strconv.cpp:1420 #11 0x085ba297 in wxCSConv::CreateConvIfNeeded() const (this=0x88c2038) at src/common/strconv.cpp:1448 #12 0x085ba34f in wxCSConv::WC2MB(char*, wchar_t const*, unsigned) const ( this=0x88c2038, buf=0x0, psz=0x8740998, n=0) at src/common/strconv.cpp:1474 #13 0x085b8433 in wxMBConv::cWC2MB(wchar_t const*) const (this=0x88c2038, pwz=0x8740998) at src/common/strconv.cpp:187 #14 0x085baab5 in wxMBConv::cWX2MB(wchar_t const*) const (this=0x88c2038, psz=0x8740998) at include/wx/strconv.h:56 #15 0x085cc971 in wxStrftime(wchar_t*, unsigned, wchar_t const*, tm const*) ( s=0xbffff400, max=256, fmt=0x8740998, tm=0x4089e920) at src/common/wxchar.cpp:1312 #16 0x085ae5a2 in wxLog::TimeStamp(wxString*) (str=0xbffff840) at src/common/log.cpp:456 #17 0x085aea8c in wxLogStderr::DoLogString(wchar_t const*, long) ( this=0x88d8078, szString=0x88ebf44) at src/common/log.cpp:542 #18 0x085ae759 in wxLog::DoLog(unsigned long, wchar_t const*, long) ( this=0x88d8078, level=1, szString=0x88bbf80, t=1067258475) at src/common/log.cpp:478 #19 0x085af2d3 in wxLog::OnLog(unsigned long, wchar_t const*, long) (level=1, szString=0x88bbf80, t=1067258475) at include/wx/log.h:141 #20 0x085ad8a5 in wxVLogError(wchar_t const*, char*) (szFormat=0x87430c0, argptr=0xbffff944 "¤Ï\216\bhùÿ¿v\030~@") at src/common/log.cpp:167 #21 0x085ad8fc in wxLogError(wchar_t const*, ...) (szFormat=0x87430c0) at src/common/log.cpp:167 #22 0x085ba1f0 in wxCSConv::DoCreate() const (this=0x88c2038) at src/common/strconv.cpp:1420 #23 0x085ba297 in wxCSConv::CreateConvIfNeeded() const (this=0x88c2038) at src/common/strconv.cpp:1448 #24 0x085ba2bb in wxCSConv::MB2WC(wchar_t*, char const*, unsigned) const ( this=0x88c2038, buf=0x0, psz=0xbffffcb7 "/usr/local/src/pgadmin3/src/pgadmin3", n=0) at src/common/strconv.cpp:1455 #25 0x085b8316 in wxMBConv::cMB2WC(char const*) const (this=0x88c2038, psz=0xbffffcb7 "/usr/local/src/pgadmin3/src/pgadmin3") at src/common/strconv.cpp:167 #26 0x085baa8f in wxMBConv::cMB2WX(char const*) const (this=0x88c2038, psz=0xbffffcb7 "/usr/local/src/pgadmin3/src/pgadmin3") at include/wx/strconv.h:55 #27 0x0859cdee in ConvertArgsToUnicode (argc=1, argv=0xbffffbb4) at src/common/init.cpp:181 #28 0x0859d47e in wxEntry(int&, char**) (argc=@0xbffffb60, argv=0xbffffbb4) at src/common/init.cpp:461 #29 0x0819e364 in main (argc=1, argv=0xbffffbb4) at pgAdmin3.cpp:78 #30 0x40781bb4 in __libc_start_main () from /lib/libc.so.6 (gdb)
Dave Page wrote: >Although I now find that 20031010 hangs in the same way :-( > > Probably because you're working as root ;-) This might still be a cvs head, not a 20031010 snapshot. There's work going on in the conversion section. For sure, it's a problem in the wx startup code. Regards, Andreas
> -----Original Message----- > From: Andreas Pflug [mailto:pgadmin@pse-consulting.de] > Sent: 27 October 2003 12:59 > To: Dave Page > Cc: pgadmin-hackers > Subject: Re: [pgadmin-hackers] New wx patch > > Dave Page wrote: > > >Although I now find that 20031010 hangs in the same way :-( > > > > > > Probably because you're working as root ;-) > > This might still be a cvs head, not a 20031010 snapshot. > There's work going on in the conversion section. For sure, > it's a problem in the wx startup code. Ack. Typo in the CVS command. 'Tis OK, now - there is a new wx snapshot on Snake. Regards, Dave.