diff options
Diffstat (limited to 'kdeui/qxembed.cpp')
-rw-r--r-- | kdeui/qxembed.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/kdeui/qxembed.cpp b/kdeui/qxembed.cpp index 422a424ff..7ec1db3a2 100644 --- a/kdeui/qxembed.cpp +++ b/kdeui/qxembed.cpp @@ -150,10 +150,10 @@ namespace { // L0200: This application wide event filter handles focus // issues in the embedded client. - class QXEmbedAppFilter : public TQObject + class QXEmbedAppFilter : public QObject { public: - QXEmbedAppFilter() { tqApp->installEventFilter( this ); } + QXEmbedAppFilter() { qApp->installEventFilter( this ); } ~QXEmbedAppFilter() { } bool eventFilter( TQObject *, TQEvent * ); }; @@ -169,7 +169,7 @@ static XKeyEvent last_key_event; // L0300: This class gives access protected members of class TQWidget. // Function focusData() is useful to reimplement tab focus management // (L0620) Function topData() returns a structure QTLWExtra containing -// information unique to toplevel windows. This structure tqcontains two +// information unique to toplevel windows. This structure contains two // members for the sole use of QXEmbed. Flag `embedded' indicates whether // the toplevel window is embedded using the XEMBED protocol (L0680). // Handle `parentWinId' then records the id of the embedding window. @@ -311,8 +311,8 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e) // active and has just been given the Qt focus (L0614) or // because the widget already had the Qt focus and just became // active (L0615). - if ( tqApp->tqfocusWidget() == o && - ((QPublicWidget*)tqApp->tqfocusWidget()->tqtopLevelWidget())->topData()->embedded ) { + if ( qApp->focusWidget() == o && + ((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->embedded ) { TQFocusEvent* fe = (TQFocusEvent*) e; if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow /*|| fe->reason() == TQFocusEvent::Mouse || fe->reason() == TQFocusEvent::Shortcut*/ ) { @@ -320,8 +320,8 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e) // Variable `obeyFocus' suggests that this is the result of mouse // activity in the client. The XEMBED_REQUEST_FOCUS message causes // the embedding widget to take the Qt focus (L2085). - WId window = ((QPublicWidget*)tqApp->tqfocusWidget()->tqtopLevelWidget())->topData()->parentWinId; - focusMap->remove( tqApp->tqfocusWidget()->tqtopLevelWidget() ); + WId window = ((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->parentWinId; + focusMap->remove( qApp->focusWidget()->topLevelWidget() ); sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS ); } else if ( fe->reason() == TQFocusEvent::ActiveWindow ) { // L0615: Both the embedder and the embedded client became active. @@ -329,21 +329,21 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e) // So we clear the Qt focus for now. If indeed the QXEmbed widget // has the focus, it will receive a FocusIn message (L1530) and // tell us to restore the focus (L0680, L0683). - focusMap->remove( tqApp->tqfocusWidget()->tqtopLevelWidget() ); - focusMap->insert( tqApp->tqfocusWidget()->tqtopLevelWidget(), - new TQGuardedPtr<TQWidget>(tqApp->tqfocusWidget()->tqtopLevelWidget()->tqfocusWidget() ) ); - // L0616: tqApp->tqfocusWidget() might belong to a modal dialog and not be - // equal to tqApp->tqfocusWidget()->tqtopLevelWidget()->tqfocusWidget() ! - tqApp->tqfocusWidget()->clearFocus(); + focusMap->remove( qApp->focusWidget()->topLevelWidget() ); + focusMap->insert( qApp->focusWidget()->topLevelWidget(), + new TQGuardedPtr<TQWidget>(qApp->focusWidget()->topLevelWidget()->focusWidget() ) ); + // L0616: qApp->focusWidget() might belong to a modal dialog and not be + // equal to qApp->focusWidget()->topLevelWidget()->focusWidget() ! + qApp->focusWidget()->clearFocus(); // L0617: ??? [why not {obeyFocus=false; return true;} here?] } obeyFocus = false; } break; case TQEvent::KeyPress: - if (tqApp->tqfocusWidget() == o && - ((QPublicWidget*)tqApp->tqfocusWidget()->tqtopLevelWidget())->topData()->embedded ) { - // L0620: The following code tqreplaces the Qt code that + if (qApp->focusWidget() == o && + ((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->embedded ) { + // L0620: The following code replaces the Qt code that // handles focus focus changes with the tab key. See the // XEMBED specification for details. The keypress event // arrives here after an interesting itinerary. It is first @@ -356,7 +356,7 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e) // (L0653, L0654) which then performs tab navigation // (L2081). TQKeyEvent *k = (TQKeyEvent *)e; - TQWidget *w = tqApp->tqfocusWidget(); + TQWidget *w = qApp->focusWidget(); // L0621: The following tests are copied from TQWidget::event(). bool res = false; bool tabForward = true; @@ -375,16 +375,16 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e) // L0625: We changed the focus because of tab/backtab key // Now check whether we have been looping around. TQFocusData *fd = ((QPublicWidget*)w)->focusData(); - WId window = ((QPublicWidget*)w->tqtopLevelWidget())->topData()->parentWinId; + WId window = ((QPublicWidget*)w->topLevelWidget())->topData()->parentWinId; TQWidget *cw = 0; TQWidget *fw = fd->home(); if (tabForward && window) { - while (cw != w && cw != fw && cw != w->tqtopLevelWidget()) + while (cw != w && cw != fw && cw != w->topLevelWidget()) cw = fd->prev(); if (cw != w) sendXEmbedMessage( window, XEMBED_FOCUS_NEXT ); } else if (window) { - while (cw != w && cw != fw && cw != w->tqtopLevelWidget()) + while (cw != w && cw != fw && cw != w->topLevelWidget()) cw = fd->next(); if (cw != w) sendXEmbedMessage( window, XEMBED_FOCUS_PREV ); @@ -422,16 +422,16 @@ static int qxembed_x11_event_filter( XEvent* e) // L0671: Keep Qt message time up to date if ( msgtime > qt_x_time ) qt_x_time = msgtime; - TQWidget* w = TQWidget::tqfind( e->xclient.window ); + TQWidget* w = TQWidget::find( e->xclient.window ); if ( !w ) break; switch ( message) { case XEMBED_EMBEDDED_NOTIFY: { // L0675: We just have been embedded into a XEMBED aware widget. - QTLWExtra *extra = ((QPublicWidget*)w->tqtopLevelWidget())->topData(); + QTLWExtra *extra = ((QPublicWidget*)w->topLevelWidget())->topData(); extra->embedded = 1; extra->parentWinId = e->xclient.data.l[3]; - w->tqtopLevelWidget()->show(); + w->topLevelWidget()->show(); break; } case XEMBED_WINDOW_ACTIVATE: { @@ -444,10 +444,10 @@ static int qxembed_x11_event_filter( XEvent* e) memset(&ev, 0, sizeof(ev)); ev.xfocus.display = qt_xdisplay(); ev.xfocus.type = XFocusIn; - ev.xfocus.window = w->tqtopLevelWidget()->winId(); + ev.xfocus.window = w->topLevelWidget()->winId(); ev.xfocus.mode = NotifyNormal; ev.xfocus.detail = NotifyAncestor; - tqApp->x11ProcessEvent( &ev ); + qApp->x11ProcessEvent( &ev ); } break; case XEMBED_WINDOW_DEACTIVATE: { @@ -458,10 +458,10 @@ static int qxembed_x11_event_filter( XEvent* e) memset(&ev, 0, sizeof(ev)); ev.xfocus.display = qt_xdisplay(); ev.xfocus.type = XFocusOut; - ev.xfocus.window = w->tqtopLevelWidget()->winId(); + ev.xfocus.window = w->topLevelWidget()->winId(); ev.xfocus.mode = NotifyNormal; ev.xfocus.detail = NotifyAncestor; - tqApp->x11ProcessEvent( &ev ); + qApp->x11ProcessEvent( &ev ); } break; case XEMBED_FOCUS_IN: @@ -469,11 +469,11 @@ static int qxembed_x11_event_filter( XEvent* e) { // L0681: Search saved focus widget. TQWidget* focusCurrent = 0; - TQGuardedPtr<TQWidget>* fw = focusMap->tqfind( w->tqtopLevelWidget() ); + TQGuardedPtr<TQWidget>* fw = focusMap->find( w->topLevelWidget() ); if ( fw ) { focusCurrent = *fw; // L0682: Remove it from the map - focusMap->remove( w->tqtopLevelWidget() ); + focusMap->remove( w->topLevelWidget() ); } switch ( detail ) { case XEMBED_FOCUS_CURRENT: @@ -483,15 +483,15 @@ static int qxembed_x11_event_filter( XEvent* e) if( QXEmbed* emb = dynamic_cast< QXEmbed* >( focusCurrent )) emb->updateEmbeddedFocus( true ); } - else if ( !w->tqtopLevelWidget()->tqfocusWidget() ) - w->tqtopLevelWidget()->setFocus(); + else if ( !w->topLevelWidget()->focusWidget() ) + w->topLevelWidget()->setFocus(); break; case XEMBED_FOCUS_FIRST: { // L0684: Search first widget in tab chain TQFocusEvent::setReason( TQFocusEvent::Tab ); - w->tqtopLevelWidget()->setFocus(); - ((QPublicWidget*)w->tqtopLevelWidget())->focusNextPrev(true); + w->topLevelWidget()->setFocus(); + ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(true); TQFocusEvent::resetReason(); } break; @@ -499,8 +499,8 @@ static int qxembed_x11_event_filter( XEvent* e) { // L0686: Search last widget in tab chain TQFocusEvent::setReason( TQFocusEvent::Backtab ); - w->tqtopLevelWidget()->setFocus(); - ((QPublicWidget*)w->tqtopLevelWidget())->focusNextPrev(false); + w->topLevelWidget()->setFocus(); + ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(false); TQFocusEvent::resetReason(); } break; @@ -513,12 +513,12 @@ static int qxembed_x11_event_filter( XEvent* e) // L0688: Embedding application takes the focus away // We first record what the focus widget was // and clear the Qt focus. - if ( w->tqtopLevelWidget()->tqfocusWidget() ) { - if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->tqtopLevelWidget()->tqfocusWidget())) + if ( w->topLevelWidget()->focusWidget() ) { + if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget())) emb->updateEmbeddedFocus( false ); - focusMap->insert( w->tqtopLevelWidget(), - new TQGuardedPtr<TQWidget>(w->tqtopLevelWidget()->tqfocusWidget() ) ); - w->tqtopLevelWidget()->tqfocusWidget()->clearFocus(); + focusMap->insert( w->topLevelWidget(), + new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) ); + w->topLevelWidget()->focusWidget()->clearFocus(); } break; default: @@ -526,7 +526,7 @@ static int qxembed_x11_event_filter( XEvent* e) } } else if ( e->xclient.format == 32 && e->xclient.message_type ) { if ( e->xclient.message_type == qt_wm_protocols ) { - TQWidget* w = TQWidget::tqfind( e->xclient.window ); + TQWidget* w = TQWidget::find( e->xclient.window ); if ( !w ) break; // L0690: This is for the embedding side! @@ -621,7 +621,7 @@ QXEmbed::QXEmbed(TQWidget *parent, const char *name, WFlags f) // whole embedding application. They compete between themselves and // against Qt (L0690, L0914, L1040, L1310, L1510, L1580). // This would be much simpler if implemented within Qt. - d->focusProxy = new TQWidget( tqtopLevelWidget(), "xembed_focus" ); + d->focusProxy = new TQWidget( topLevelWidget(), "xembed_focus" ); d->focusProxy->setGeometry( -1, -1, 1, 1 ); d->focusProxy->show(); // make sure it's shown - for XSetInputFocus @@ -656,13 +656,13 @@ QXEmbed::QXEmbed(TQWidget *parent, const char *name, WFlags f) // L0913: all application events pass through eventFilter(). // This is mostly used to force the X11 focus on the // proxy focus window. See L1300. - tqtopLevelWidget()->installEventFilter( this ); - tqApp->installEventFilter( this ); + topLevelWidget()->installEventFilter( this ); + qApp->installEventFilter( this ); // L0914: Start moving the X11 focus on the focus proxy window. // See L1581 to know why we do not use isActiveWindow(). - if ( tqApp->activeWindow() == tqtopLevelWidget() ) - if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded ) + if ( qApp->activeWindow() == topLevelWidget() ) + if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded ) XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(), RevertToParent, qt_x_time ); // L0915: ??? [drag&drop?] @@ -682,7 +682,7 @@ QXEmbed::~QXEmbed() // with this QXEmbed's window. #if 0 // TODO: The proper XEmbed way would be to unmap the window, and the embedded -// app would detect the embedding has ended, and do whatever it tqfinds appropriate. +// app would detect the embedding has ended, and do whatever it finds appropriate. // However, QXEmbed currently doesn't provide support for this detection, // so for the time being, it's better to leave the window mapped as toplevel window. // This will be ever more complicated with the systray windows, as the simple API @@ -716,7 +716,7 @@ QXEmbed::~QXEmbed() int revert; XGetInputFocus( qt_xdisplay(), &focus, &revert ); if( focus == d->focusProxy->winId()) - XSetInputFocus( qt_xdisplay(), tqtopLevelWidget()->winId(), RevertToParent, qt_x_time ); + XSetInputFocus( qt_xdisplay(), topLevelWidget()->winId(), RevertToParent, qt_x_time ); // L01045: Delete our private data. delete d; } @@ -780,10 +780,10 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e) switch ( e->type() ) { case TQEvent::WindowActivate: - if ( o == tqtopLevelWidget() ) { + if ( o == topLevelWidget() ) { // L1310: Qt thinks the application window has just been activated. // Make sure the X11 focus is on the focus proxy window. See L0686. - if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded ) + if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded ) if (! hasFocus() ) XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(), RevertToParent, qt_x_time ); @@ -796,7 +796,7 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e) } break; case TQEvent::WindowDeactivate: - if ( o == tqtopLevelWidget() ) { + if ( o == topLevelWidget() ) { if (d->xplain) // L1321: Activation has changed. Grab state might change. See L2800. checkGrab(); @@ -808,8 +808,8 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e) case TQEvent::Move: { TQWidget* pos = this; - while( pos != o && pos != tqtopLevelWidget()) - pos = pos->tqparentWidget(); + while( pos != o && pos != topLevelWidget()) + pos = pos->parentWidget(); if( pos == o ) { // L1390: Send fake configure notify events whenever the // global position of the client changes. See L2900. @@ -864,8 +864,8 @@ void QXEmbed::focusInEvent( TQFocusEvent * e ){ return; // L1510: This is a good time to set the X11 focus on the focus proxy window. // Except if the the embedding application itself is embedded into another. - if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded ) - if ( tqApp->activeWindow() == tqtopLevelWidget() ) + if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded ) + if ( qApp->activeWindow() == topLevelWidget() ) // L1511: Alter X focus only when window is active. // This is dual safety here because FocusIn implies this. // But see L1581 for an example where this really matters. @@ -913,8 +913,8 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){ // is properly set to the X11 focus widget. We do this because // the client application might have moved the X11 focus after // receiving the fake focus messages. - if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded ) - if ( tqApp->activeWindow() == tqtopLevelWidget() ) + if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded ) + if ( qApp->activeWindow() == topLevelWidget() ) // L1581: Alter X focus only when window is active. // The test above is not the same as isActiveWindow(). // Function isActiveWindow() also returns true when a modal @@ -950,7 +950,7 @@ static bool wstate_withdrawn( WId winid ) // L1610: Non managed windows have no WM_STATE property. // Returning true ensures that the loop L1711 stops. if ( r == Success && data && format == 32 ) { - TQ_UINT32 *wstate = (TQ_UINT32*)data; + Q_UINT32 *wstate = (Q_UINT32*)data; withdrawn = (*wstate == WithdrawnState ); XFree( (char *)data ); } @@ -1046,8 +1046,8 @@ void QXEmbed::handleEmbed() if ( parent() ) { // L2030: embedded window might have new size requirements. // see L2500, L2520, L2550. - TQEvent * tqlayoutHint = new TQEvent( TQEvent::LayoutHint ); - TQApplication::postEvent( parent(), tqlayoutHint ); + TQEvent * layoutHint = new TQEvent( TQEvent::LayoutHint ); + TQApplication::postEvent( parent(), layoutHint ); } windowChanged( window ); if (d->xplain) { @@ -1176,10 +1176,10 @@ bool QXEmbed::x11Event( XEvent* e) break; // L2085: The client asks for the focus. case XEMBED_REQUEST_FOCUS: - if( ((QPublicWidget*)tqtopLevelWidget())->topData()->embedded ) { - focusMap->remove( tqtopLevelWidget() ); - focusMap->insert( tqtopLevelWidget(), new TQGuardedPtr<TQWidget>( this )); - WId window = ((QPublicWidget*)tqtopLevelWidget())->topData()->parentWinId; + if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) { + focusMap->remove( topLevelWidget() ); + focusMap->insert( topLevelWidget(), new TQGuardedPtr<TQWidget>( this )); + WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId; sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS ); } else { TQFocusEvent::setReason( TQFocusEvent::Mouse ); @@ -1194,7 +1194,7 @@ bool QXEmbed::x11Event( XEvent* e) break; case ConfigureRequest: - // L2090: Client wants to change its tqgeometry. + // L2090: Client wants to change its geometry. // Just inform it that nothing has changed. if (e->xconfigurerequest.window == window) { @@ -1285,7 +1285,7 @@ void QXEmbed::embedClientIntoWindow(TQWidget* client, WId window) // L2500: Specifies that this widget can use additional space, -// and that it can survive on less than tqsizeHint(). +// and that it can survive on less than sizeHint(). TQSizePolicy QXEmbed::sizePolicy() const { return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ); @@ -1293,13 +1293,13 @@ TQSizePolicy QXEmbed::sizePolicy() const // L2520: Returns a size sufficient for the embedded window -TQSize QXEmbed::tqsizeHint() const +TQSize QXEmbed::sizeHint() const { - return tqminimumSizeHint(); + return minimumSizeHint(); } // L2550: Returns the minimum size specified by the embedded window. -TQSize QXEmbed::tqminimumSizeHint() const +TQSize QXEmbed::minimumSizeHint() const { int minw = 0; int minh = 0; @@ -1356,7 +1356,7 @@ void QXEmbed::checkGrab() } // L2900: This sends fake configure notify events to inform -// the client about its window tqgeometry. See L1390, L2024 and L2090. +// the client about its window geometry. See L1390, L2024 and L2090. void QXEmbed::sendSyntheticConfigureNotifyEvent() { // L2910: It seems that the x and y coordinates are global. |