Changeset 114 for trunk/src


Ignore:
Timestamp:
Aug 10, 2006, 7:56:11 PM (19 years ago)
Author:
dmik
Message:

Kernel: Updated QPMMime to use QPMObjectWindow instead of its own QPMMime::Messenger.

Location:
trunk/src/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qdnd_pm.cpp

    r97 r114  
    588588}
    589589
    590 class QPMCoopDragWorker : public QPMMime::DragWorker, QPMMime::Messenger
     590class QPMCoopDragWorker : public QPMMime::DragWorker, public QPMObjectWindow
    591591{
    592592public:
     
    602602    DRAGINFO *createDragInfo( const char *name, USHORT supportedOps );
    603603
    604     // Messenger interface
     604    // QPMObjectWindow interface
    605605    MRESULT message( ULONG msg, MPARAM mp1, MPARAM mp2 );
    606606   
     
    746746    }
    747747   
    748     return QPMMime::Messenger::hwnd();
     748    return QPMObjectWindow::hwnd();
    749749}
    750750
  • trunk/src/kernel/qmime_pm.cpp

    r103 r114  
    211211{
    212212    return hex_to_int( (uchar) c );
    213 }
    214 
    215 // -----------------------------------------------------------------------------
    216 
    217 static QPtrList<HWND> msgWindows;
    218 
    219 static void destroyAllMessengerWindows()
    220 {
    221     for ( HWND *w = msgWindows.first(); w; w = msgWindows.next() ) {
    222         Q_ASSERT( *w );
    223         WinDestroyWindow( *w );
    224         // tell Messenger the window has been destroyed
    225         *w = 0;
    226     }
    227 }
    228 
    229 QPMMime::Messenger::Messenger() : w( 0 )
    230 {
    231     static const char *ClassName = "QPMMime::Messenger";
    232     static bool classRegistered = FALSE;
    233     if ( !classRegistered ) {
    234         WinRegisterClass( 0, ClassName, windowProc, 0, QWL_USER + sizeof(PVOID) );
    235         classRegistered = TRUE;
    236         // make sure windows are destroyed before the message queue
    237         qAddPostRoutine ( destroyAllMessengerWindows );
    238     }
    239 
    240     w = WinCreateWindow( HWND_OBJECT, ClassName,
    241                          NULL, 0, 0, 0, 0, 0, NULL,
    242                          HWND_BOTTOM, 0, this, NULL );
    243     Q_ASSERT( w );
    244     if ( w )
    245         msgWindows.append( &w );
    246 }
    247 
    248 QPMMime::Messenger::~Messenger()
    249 {
    250     if ( w ) {
    251         msgWindows.removeRef( &w );
    252         HWND h = w;
    253         w = 0; // tell windowProc() we're unsafe
    254         WinDestroyWindow( h );
    255     }
    256 }
    257 
    258 //static
    259 MRESULT EXPENTRY QPMMime::Messenger::windowProc( HWND hwnd, ULONG msg,
    260                                                  MPARAM mp1, MPARAM mp2 )
    261 {
    262     if ( msg == WM_CREATE ) {
    263         Messenger *that = (Messenger *) mp1;
    264         if ( !that )
    265             return (MRESULT) TRUE;
    266         WinSetWindowPtr( hwnd, QWL_USER, that );
    267         return (MRESULT) FALSE;
    268     }
    269 
    270     Messenger *that = (Messenger *) WinQueryWindowPtr( hwnd, QWL_USER );
    271     Q_ASSERT( that );
    272    
    273     // Note: before WinCreateWindow() returns to the constructor or after the
    274     // destructor has been called, w is 0. We use this to determine that the
    275     // object is in the unsafe state (VTBL is not yet initialized or has been
    276     // already uninitialized), so message() points to never-never land.
    277     if ( !that || !that->w )
    278         return (MRESULT) FALSE;
    279    
    280     return that->message( msg, mp1, mp2 );
    281213}
    282214
     
    17541686    DropWorker *dropWorkerFor( DRAGINFO *info );
    17551687
    1756     class NativeFileDrag : public DragWorker, public Messenger
     1688    class NativeFileDrag : public DragWorker, public QPMObjectWindow
    17571689    {
    17581690    public:
     
    17611693        bool isExclusive() const { return TRUE; }
    17621694        ULONG itemCount() const { return 0; } // super exclusive
    1763         HWND hwnd() const { return Messenger::hwnd(); }
     1695        HWND hwnd() const { return QPMObjectWindow::hwnd(); }
    17641696        DRAGINFO *createDragInfo( const char *name, USHORT supportedOps );
    1765         // Messenger interface (dummy implementation, we don't need to interact)
     1697        // QPMObjectWindow interface (dummy implementation, we don't need to interact)
    17661698        MRESULT message( ULONG msg, MPARAM mp1, MPARAM mp2 ) { return 0; }
    17671699    };
Note: See TracChangeset for help on using the changeset viewer.