summaryrefslogtreecommitdiffstats
path: root/tdeui/qxembed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdeui/qxembed.cpp')
-rw-r--r--tdeui/qxembed.cpp96
1 files changed, 24 insertions, 72 deletions
diff --git a/tdeui/qxembed.cpp b/tdeui/qxembed.cpp
index 6ba25fff7..23076e38d 100644
--- a/tdeui/qxembed.cpp
+++ b/tdeui/qxembed.cpp
@@ -54,7 +54,7 @@
#include <tqfocusdata.h>
// L0001: QXEmbed works only under X windows.
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
# include <X11/X.h>
# include <X11/Xlib.h>
@@ -199,7 +199,7 @@ static void sendXEmbedMessage( WId window, long message, long detail = 0,
ev.xclient.window = window;
ev.xclient.message_type = xembed;
ev.xclient.format = 32;
- ev.xclient.data.l[0] = GET_QT_X_TIME();
+ ev.xclient.data.l[0] = get_tqt_x_time();
ev.xclient.data.l[1] = message;
ev.xclient.data.l[2] = detail;
ev.xclient.data.l[3] = data1;
@@ -219,7 +219,7 @@ static void sendClientMessage(Window window, Atom a, long x)
ev.xclient.message_type = a;
ev.xclient.format = 32;
ev.xclient.data.l[0] = x;
- ev.xclient.data.l[1] = GET_QT_X_TIME();
+ ev.xclient.data.l[1] = get_tqt_x_time();
XSendEvent(tqt_xdisplay(), window, false, NoEventMask, &ev);
}
@@ -310,7 +310,7 @@ 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 ( TQT_BASE_OBJECT(tqApp->focusWidget()) == TQT_BASE_OBJECT(o) &&
+ if ( tqApp->focusWidget() == o &&
((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
TQFocusEvent* fe = (TQFocusEvent*) e;
if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow /*|| fe->reason() == TQFocusEvent::Mouse ||
@@ -319,11 +319,7 @@ 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).
-#ifdef USE_QT4
- WId window = ((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->effectiveWinId();
-#else // USE_QT4
WId window = ((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->parentWinId;
-#endif // USE_QT4
focusMap->remove( tqApp->focusWidget()->topLevelWidget() );
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else if ( fe->reason() == TQFocusEvent::ActiveWindow ) {
@@ -344,7 +340,7 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
}
break;
case TQEvent::KeyPress:
- if (TQT_BASE_OBJECT(tqApp->focusWidget()) == TQT_BASE_OBJECT(o) &&
+ if (tqApp->focusWidget() == o &&
((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
// L0620: The following code replaces the Qt code that
// handles focus focus changes with the tab key. See the
@@ -365,32 +361,20 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
bool tabForward = true;
if ( !(k->state() & ControlButton || k->state() & AltButton) ) {
if ( k->key() == Key_Backtab || (k->key() == Key_Tab && (k->state() & ShiftButton)) ) {
-#ifdef USE_QT4
- res = ((QPublicWidget*)w)->focusNextPrev( tabForward = false );
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Backtab );
res = ((QPublicWidget*)w)->focusNextPrev( tabForward = false );
TQFocusEvent::resetReason();
-#endif // USE_QT4
} else if ( k->key() == Key_Tab ) {
-#ifdef USE_QT4
- res = ((QPublicWidget*)w)->focusNextPrev( tabForward = true );
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Tab );
res = ((QPublicWidget*)w)->focusNextPrev( tabForward = true );
TQFocusEvent::resetReason();
-#endif // USE_QT4
}
}
if (res) {
// L0625: We changed the focus because of tab/backtab key
// Now check whether we have been looping around.
TQFocusData *fd = ((QPublicWidget*)w)->focusData();
-#ifdef USE_QT4
- WId window = ((QPublicWidget*)w->topLevelWidget())->effectiveWinId();
-#else // USE_QT4
WId window = ((QPublicWidget*)w->topLevelWidget())->topData()->parentWinId;
-#endif // USE_QT4
TQWidget *cw = 0;
TQWidget *fw = fd->home();
if (tabForward && window) {
@@ -435,9 +419,9 @@ static int qxembed_x11_event_filter( XEvent* e)
long message = e->xclient.data.l[1];
long detail = e->xclient.data.l[2];
// L0671: Keep Qt message time up to date
- if ( msgtime > GET_QT_X_TIME() )
- SET_QT_X_TIME(msgtime);
- TQWidget* w = TQT_TQWIDGET(TQWidget::find( e->xclient.window ));
+ if ( msgtime > get_tqt_x_time() )
+ set_tqt_x_time(msgtime);
+ TQWidget* w = TQWidget::find( e->xclient.window );
if ( !w )
break;
switch ( message) {
@@ -445,12 +429,7 @@ static int qxembed_x11_event_filter( XEvent* e)
// L0675: We just have been embedded into a XEMBED aware widget.
TQTLWExtra *extra = ((QPublicWidget*)w->topLevelWidget())->topData();
extra->embedded = 1;
-#ifdef USE_QT4
- // [FIXME]
- printf("[FIXME] WId not set in tdelibs/tdeui/qxembed.cpp\n");
-#else // USE_QT4
extra->parentWinId = e->xclient.data.l[3];
-#endif // USE_QT4
w->topLevelWidget()->show();
break;
}
@@ -500,7 +479,7 @@ static int qxembed_x11_event_filter( XEvent* e)
// L0683: Set focus on saved focus widget
if ( focusCurrent ) {
focusCurrent->setFocus();
- if( QXEmbed* emb = tqt_dynamic_cast< QXEmbed* >( focusCurrent ))
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( focusCurrent ))
emb->updateEmbeddedFocus( true );
}
else if ( !w->topLevelWidget()->focusWidget() )
@@ -509,29 +488,19 @@ static int qxembed_x11_event_filter( XEvent* e)
case XEMBED_FOCUS_FIRST:
{
// L0684: Search first widget in tab chain
-#ifdef USE_QT4
- w->topLevelWidget()->setFocus();
- ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(true);
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Tab );
w->topLevelWidget()->setFocus();
((QPublicWidget*)w->topLevelWidget())->focusNextPrev(true);
TQFocusEvent::resetReason();
-#endif // USE_QT4
}
break;
case XEMBED_FOCUS_LAST:
{
// L0686: Search last widget in tab chain
-#ifdef USE_QT4
- w->topLevelWidget()->setFocus();
- ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(false);
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Backtab );
w->topLevelWidget()->setFocus();
((QPublicWidget*)w->topLevelWidget())->focusNextPrev(false);
TQFocusEvent::resetReason();
-#endif // USE_QT4
}
break;
default:
@@ -544,7 +513,7 @@ static int qxembed_x11_event_filter( XEvent* e)
// We first record what the focus widget was
// and clear the Qt focus.
if ( w->topLevelWidget()->focusWidget() ) {
- if( QXEmbed* emb = tqt_dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget()))
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget()))
emb->updateEmbeddedFocus( false );
focusMap->insert( w->topLevelWidget(),
new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) );
@@ -556,7 +525,7 @@ static int qxembed_x11_event_filter( XEvent* e)
}
} else if ( e->xclient.format == 32 && e->xclient.message_type ) {
if ( e->xclient.message_type == tqt_wm_protocols ) {
- TQWidget* w = TQT_TQWIDGET(TQWidget::find( e->xclient.window ));
+ TQWidget* w = TQWidget::find( e->xclient.window );
if ( !w )
break;
// L0690: This is for the embedding side!
@@ -569,8 +538,8 @@ static int qxembed_x11_event_filter( XEvent* e)
Atom a = e->xclient.data.l[0];
if ( a == tqt_wm_take_focus ) {
// L0695: update Qt message time variable
- if ( (ulong) e->xclient.data.l[1] > GET_QT_X_TIME() )
- SET_QT_X_TIME(e->xclient.data.l[1]);
+ if ( (ulong) e->xclient.data.l[1] > get_tqt_x_time() )
+ set_tqt_x_time(e->xclient.data.l[1]);
// L0696: There is no problem when the window is not active.
// Qt will generate a WindowActivate event that will
// do the job (L1310). This does not happen if the
@@ -661,7 +630,7 @@ QXEmbed::QXEmbed(TQWidget *parent, const char *name, WFlags f)
// See L0660, L0671, L0685.
initialize();
window = 0;
- setFocusPolicy(TQ_StrongFocus);
+ setFocusPolicy(TQWidget::StrongFocus);
setKeyCompression( false );
// L0910: Trick Qt to create extraData();
@@ -694,7 +663,7 @@ QXEmbed::QXEmbed(TQWidget *parent, const char *name, WFlags f)
if ( tqApp->activeWindow() == topLevelWidget() )
if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded )
XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
- RevertToParent, GET_QT_X_TIME() );
+ RevertToParent, get_tqt_x_time() );
// L0915: ??? [drag&drop?]
setAcceptDrops( true );
}
@@ -746,7 +715,7 @@ QXEmbed::~QXEmbed()
int revert;
XGetInputFocus( tqt_xdisplay(), &focus, &revert );
if( focus == d->focusProxy->winId())
- XSetInputFocus( tqt_xdisplay(), topLevelWidget()->winId(), RevertToParent, GET_QT_X_TIME() );
+ XSetInputFocus( tqt_xdisplay(), topLevelWidget()->winId(), RevertToParent, get_tqt_x_time() );
// L01045: Delete our private data.
delete d;
}
@@ -810,13 +779,13 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e)
switch ( e->type() ) {
case TQEvent::WindowActivate:
- if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(topLevelWidget()) ) {
+ 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*) topLevelWidget())->topData()->embedded )
if (! hasFocus() )
XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
- RevertToParent, GET_QT_X_TIME() );
+ RevertToParent, get_tqt_x_time() );
if (d->xplain)
// L1311: Activation has changed. Grab state might change. See L2800.
checkGrab();
@@ -826,7 +795,7 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e)
}
break;
case TQEvent::WindowDeactivate:
- if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(topLevelWidget()) ) {
+ if ( o == topLevelWidget() ) {
if (d->xplain)
// L1321: Activation has changed. Grab state might change. See L2800.
checkGrab();
@@ -838,9 +807,9 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e)
case TQEvent::Move:
{
TQWidget* pos = this;
- while( TQT_BASE_OBJECT(pos) != TQT_BASE_OBJECT(o) && TQT_BASE_OBJECT(pos) != TQT_BASE_OBJECT(topLevelWidget()))
+ while( pos != o && pos != topLevelWidget())
pos = pos->parentWidget();
- if( TQT_BASE_OBJECT(pos) == TQT_BASE_OBJECT(o) ) {
+ if( pos == o ) {
// L1390: Send fake configure notify events whenever the
// global position of the client changes. See L2900.
TQPoint globalPos = mapToGlobal(TQPoint(0,0));
@@ -900,7 +869,7 @@ void QXEmbed::focusInEvent( TQFocusEvent * e ){
// This is dual safety here because FocusIn implies this.
// But see L1581 for an example where this really matters.
XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
- RevertToParent, GET_QT_X_TIME() );
+ RevertToParent, get_tqt_x_time() );
if (d->xplain) {
// L1520: Qt focus has changed. Grab state might change. See L2800.
checkGrab();
@@ -950,7 +919,7 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){
// Function isActiveWindow() also returns true when a modal
// dialog child of this window is active.
XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
- RevertToParent, GET_QT_X_TIME() );
+ RevertToParent, get_tqt_x_time() );
}
@@ -1168,13 +1137,9 @@ bool QXEmbed::x11Event( XEvent* e)
if (d->xplain && d->xgrab) {
// L2060: The passive grab has intercepted a mouse click
// in the embedded client window. Take the focus.
-#ifdef USE_QT4
- setFocus();
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Mouse );
setFocus();
TQFocusEvent::resetReason();
-#endif // USE_QT4
// L2064: Resume X11 event processing.
XAllowEvents(tqt_xdisplay(), ReplayPointer, CurrentTime);
// L2065: Qt should not know about this.
@@ -1213,20 +1178,12 @@ bool QXEmbed::x11Event( XEvent* e)
if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) {
focusMap->remove( topLevelWidget() );
focusMap->insert( topLevelWidget(), new TQGuardedPtr<TQWidget>( this ));
-#ifdef USE_QT4
- WId window = ((QPublicWidget*)topLevelWidget())->effectiveWinId();
-#else // USE_QT4
WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
-#endif // USE_QT4
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else {
-#ifdef USE_QT4
- setFocus();
-#else // USE_QT4
TQFocusEvent::setReason( TQFocusEvent::Mouse );
setFocus();
TQFocusEvent::resetReason();
-#endif // USE_QT4
}
break;
default:
@@ -1318,12 +1275,7 @@ void QXEmbed::embedClientIntoWindow(TQWidget* client, WId window)
XReparentWindow(tqt_xdisplay(), client->winId(), window, 0, 0);
// L2451: These two lines are redundant. See L0680.
((QXEmbed*)client)->topData()->embedded = true;
-#ifdef USE_QT4
- // [FIXME]
- printf("[FIXME] WId not set in tdelibs/tdeui/qxembed.cpp\n");
-#else // USE_QT4
((QXEmbed*)client)->topData()->parentWinId = window;
-#endif // USE_QT4
// L2452: This seems redundant because L2020 maps the window.
// But calling show() might also set Qt internal flags.
client->show();
@@ -1447,4 +1399,4 @@ void QXEmbed::reparent( TQWidget * parent, WFlags f, const TQPoint & p, bool sho
// for KDE
#include "qxembed.moc"
-#endif // Q_WS_X11
+#endif // TQ_WS_X11