49 #include <tqapplication.h>
50 #include <tqptrlist.h>
51 #include <tqptrdict.h>
52 #include <tqguardedptr.h>
53 #include <tqwhatsthis.h>
54 #include <tqfocusdata.h>
60 # include <X11/Xlib.h>
61 # include <X11/Xutil.h>
62 # include <X11/Xatom.h>
63 # define XK_MISCELLANY
65 # include <X11/keysymdef.h>
67 # include <kxerrorhandler.h>
74 # define USLEEP(x) usleep(x)
76 # define USLEEP(x) sleep(0)
79 # define USLEEP(x) sleep(0)
85 # ifndef XK_ISO_Left_Tab
86 # define XK_ISO_Left_Tab 0xFE20
90 const int XFocusOut = FocusOut;
91 const int XFocusIn = FocusIn;
92 const int XKeyPress = KeyPress;
93 const int XKeyRelease = KeyRelease;
100 extern Atom tqt_wm_protocols;
101 extern Atom tqt_wm_delete_window;
102 extern Atom tqt_wm_take_focus;
103 extern Atom tqt_wm_state;
106 static Atom xembed = 0;
107 static Atom context_help = 0;
110 #define XEMBED_EMBEDDED_NOTIFY 0
111 #define XEMBED_WINDOW_ACTIVATE 1
112 #define XEMBED_WINDOW_DEACTIVATE 2
113 #define XEMBED_REQUEST_FOCUS 3
114 #define XEMBED_FOCUS_IN 4
115 #define XEMBED_FOCUS_OUT 5
116 #define XEMBED_FOCUS_NEXT 6
117 #define XEMBED_FOCUS_PREV 7
121 #define XEMBED_FOCUS_CURRENT 0
122 #define XEMBED_FOCUS_FIRST 1
123 #define XEMBED_FOCUS_LAST 2
135 mapAfterRelease =
false;
136 lastPos = TQPoint(0,0);
143 bool mapAfterRelease;
144 TQWidget* focusProxy;
152 class QXEmbedAppFilter :
public TQObject
155 QXEmbedAppFilter() { tqApp->installEventFilter(
this ); }
156 ~QXEmbedAppFilter() { }
157 bool eventFilter( TQObject *, TQEvent * );
162 static QXEmbedAppFilter* filter = 0;
164 static TQPtrDict<TQGuardedPtr<TQWidget> > *focusMap = 0;
166 static XKeyEvent last_key_event;
176 class QPublicWidget :
public TQWidget
179 TQTLWExtra* topData() {
return TQWidget::topData(); }
180 TQFocusData *focusData(){
return TQWidget::focusData(); }
181 bool focusNextPrev(
bool b) {
return focusNextPrevChild(b); }
186 typedef int (*QX11EventFilter) (XEvent*);
187 extern QX11EventFilter tqt_set_x11_event_filter (QX11EventFilter filter);
188 static QX11EventFilter oldFilter = 0;
192 static void sendXEmbedMessage( WId window,
long message,
long detail = 0,
193 long data1 = 0,
long data2 = 0)
197 memset(&ev, 0,
sizeof(ev));
198 ev.xclient.type = ClientMessage;
199 ev.xclient.window = window;
200 ev.xclient.message_type = xembed;
201 ev.xclient.format = 32;
202 ev.xclient.data.l[0] = get_tqt_x_time();
203 ev.xclient.data.l[1] = message;
204 ev.xclient.data.l[2] = detail;
205 ev.xclient.data.l[3] = data1;
206 ev.xclient.data.l[4] = data2;
207 XSendEvent(tqt_xdisplay(), window,
false, NoEventMask, &ev);
212 static void sendClientMessage(Window window, Atom a,
long x)
216 memset(&ev, 0,
sizeof(ev));
217 ev.xclient.type = ClientMessage;
218 ev.xclient.window = window;
219 ev.xclient.message_type = a;
220 ev.xclient.format = 32;
221 ev.xclient.data.l[0] = x;
222 ev.xclient.data.l[1] = get_tqt_x_time();
223 XSendEvent(tqt_xdisplay(), window,
false, NoEventMask, &ev);
228 static void sendFocusMessage(Window window,
int type,
int mode,
int detail)
232 memset(&ev, 0,
sizeof(ev));
233 ev.xfocus.type = type;
234 ev.xfocus.window = window;
235 ev.xfocus.mode = mode;
236 ev.xfocus.detail = detail;
237 XSendEvent(tqt_xdisplay(), window,
false, FocusChangeMask, &ev);
299 bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
301 static bool obeyFocus =
false;
302 switch ( e->type() ) {
303 case TQEvent::MouseButtonPress:
305 if ( !((TQWidget*)o)->isActiveWindow() )
308 case TQEvent::FocusIn:
313 if ( tqApp->focusWidget() == o &&
314 ((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
315 TQFocusEvent* fe = (TQFocusEvent*) e;
316 if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow
322 WId window = ((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->parentWinId;
323 focusMap->remove( tqApp->focusWidget()->topLevelWidget() );
324 sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
325 }
else if ( fe->reason() == TQFocusEvent::ActiveWindow ) {
331 focusMap->remove( tqApp->focusWidget()->topLevelWidget() );
332 focusMap->insert( tqApp->focusWidget()->topLevelWidget(),
333 new TQGuardedPtr<TQWidget>(tqApp->focusWidget()->topLevelWidget()->focusWidget() ) );
336 tqApp->focusWidget()->clearFocus();
342 case TQEvent::KeyPress:
343 if (tqApp->focusWidget() == o &&
344 ((QPublicWidget*)tqApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
357 TQKeyEvent *k = (TQKeyEvent *)e;
358 TQWidget *w = tqApp->focusWidget();
361 bool tabForward =
true;
362 if ( !(k->state() & ControlButton || k->state() & AltButton) ) {
363 if ( k->key() == Key_Backtab || (k->key() == Key_Tab && (k->state() & ShiftButton)) ) {
364 TQFocusEvent::setReason( TQFocusEvent::Backtab );
365 res = ((QPublicWidget*)w)->focusNextPrev( tabForward =
false );
366 TQFocusEvent::resetReason();
367 }
else if ( k->key() == Key_Tab ) {
368 TQFocusEvent::setReason( TQFocusEvent::Tab );
369 res = ((QPublicWidget*)w)->focusNextPrev( tabForward =
true );
370 TQFocusEvent::resetReason();
376 TQFocusData *fd = ((QPublicWidget*)w)->focusData();
377 WId window = ((QPublicWidget*)w->topLevelWidget())->topData()->parentWinId;
379 TQWidget *fw = fd->home();
380 if (tabForward && window) {
381 while (cw != w && cw != fw && cw != w->topLevelWidget())
384 sendXEmbedMessage( window, XEMBED_FOCUS_NEXT );
386 while (cw != w && cw != fw && cw != w->topLevelWidget())
389 sendXEmbedMessage( window, XEMBED_FOCUS_PREV );
405 static int qxembed_x11_event_filter( XEvent* e)
411 last_key_event = e->xkey;
415 if ( e->xclient.message_type == xembed ) {
418 Time msgtime = (Time) e->xclient.data.l[0];
419 long message = e->xclient.data.l[1];
420 long detail = e->xclient.data.l[2];
422 if ( msgtime > get_tqt_x_time() )
423 set_tqt_x_time(msgtime);
424 TQWidget* w = TQWidget::find( e->xclient.window );
428 case XEMBED_EMBEDDED_NOTIFY: {
430 TQTLWExtra *extra = ((QPublicWidget*)w->topLevelWidget())->topData();
432 extra->parentWinId = e->xclient.data.l[3];
433 w->topLevelWidget()->show();
436 case XEMBED_WINDOW_ACTIVATE: {
443 memset(&ev, 0,
sizeof(ev));
444 ev.xfocus.display = tqt_xdisplay();
445 ev.xfocus.type = XFocusIn;
446 ev.xfocus.window = w->topLevelWidget()->winId();
447 ev.xfocus.mode = NotifyNormal;
448 ev.xfocus.detail = NotifyAncestor;
449 tqApp->x11ProcessEvent( &ev );
452 case XEMBED_WINDOW_DEACTIVATE: {
457 memset(&ev, 0,
sizeof(ev));
458 ev.xfocus.display = tqt_xdisplay();
459 ev.xfocus.type = XFocusOut;
460 ev.xfocus.window = w->topLevelWidget()->winId();
461 ev.xfocus.mode = NotifyNormal;
462 ev.xfocus.detail = NotifyAncestor;
463 tqApp->x11ProcessEvent( &ev );
466 case XEMBED_FOCUS_IN:
470 TQWidget* focusCurrent = 0;
471 TQGuardedPtr<TQWidget>* fw = focusMap->find( w->topLevelWidget() );
475 focusMap->remove( w->topLevelWidget() );
478 case XEMBED_FOCUS_CURRENT:
480 if ( focusCurrent ) {
481 focusCurrent->setFocus();
482 if( QXEmbed* emb =
dynamic_cast< QXEmbed*
>( focusCurrent ))
483 emb->updateEmbeddedFocus(
true );
485 else if ( !w->topLevelWidget()->focusWidget() )
486 w->topLevelWidget()->setFocus();
488 case XEMBED_FOCUS_FIRST:
491 TQFocusEvent::setReason( TQFocusEvent::Tab );
492 w->topLevelWidget()->setFocus();
493 ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(
true);
494 TQFocusEvent::resetReason();
497 case XEMBED_FOCUS_LAST:
500 TQFocusEvent::setReason( TQFocusEvent::Backtab );
501 w->topLevelWidget()->setFocus();
502 ((QPublicWidget*)w->topLevelWidget())->focusNextPrev(
false);
503 TQFocusEvent::resetReason();
511 case XEMBED_FOCUS_OUT:
515 if ( w->topLevelWidget()->focusWidget() ) {
516 if( QXEmbed* emb =
dynamic_cast< QXEmbed*
>( w->topLevelWidget()->focusWidget()))
517 emb->updateEmbeddedFocus(
false );
518 focusMap->insert( w->topLevelWidget(),
519 new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) );
520 w->topLevelWidget()->focusWidget()->clearFocus();
526 }
else if ( e->xclient.format == 32 && e->xclient.message_type ) {
527 if ( e->xclient.message_type == tqt_wm_protocols ) {
528 TQWidget* w = TQWidget::find( e->xclient.window );
538 Atom a = e->xclient.data.l[0];
539 if ( a == tqt_wm_take_focus ) {
541 if ( (ulong) e->xclient.data.l[1] > get_tqt_x_time() )
542 set_tqt_x_time(e->xclient.data.l[1]);
547 if ( w->isActiveWindow() ) {
548 TQEvent e( TQEvent::WindowActivate );
549 TQApplication::sendEvent( w, &e );
560 return oldFilter( e );
572 void QXEmbed::initialize()
574 static bool is_initialized =
false;
575 if ( is_initialized )
579 xembed = XInternAtom( tqt_xdisplay(),
"_XEMBED",
false );
581 oldFilter = tqt_set_x11_event_filter( qxembed_x11_event_filter );
583 focusMap =
new TQPtrDict<TQGuardedPtr<TQWidget> >;
584 focusMap->setAutoDelete(
true );
586 filter =
new QXEmbedAppFilter;
588 is_initialized =
true;
612 QXEmbed::QXEmbed(TQWidget *parent,
const char *name, WFlags f)
613 : TQWidget(parent,
name, f)
623 d->focusProxy =
new TQWidget( topLevelWidget(),
"xembed_focus" );
624 d->focusProxy->setGeometry( -1, -1, 1, 1 );
625 d->focusProxy->show();
627 TQApplication::sendPostedEvents( d->focusProxy, 0 );
633 setFocusPolicy(TQWidget::StrongFocus);
634 setKeyCompression(
false );
642 XSelectInput(tqt_xdisplay(), winId(),
643 KeyPressMask | KeyReleaseMask |
644 ButtonPressMask | ButtonReleaseMask |
648 EnterWindowMask | LeaveWindowMask |
651 StructureNotifyMask |
652 SubstructureRedirectMask |
653 SubstructureNotifyMask
658 topLevelWidget()->installEventFilter(
this );
659 tqApp->installEventFilter(
this );
663 if ( tqApp->activeWindow() == topLevelWidget() )
664 if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded )
665 XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
666 RevertToParent, get_tqt_x_time() );
668 setAcceptDrops(
true );
676 XUngrabButton( tqt_xdisplay(), AnyButton, AnyModifier, winId() );
677 if ( window && ( autoDelete() || !d->xplain ))
695 XUnmapWindow( tqt_xdisplay(), window );
697 XReparentWindow(tqt_xdisplay(), window, tqt_xrootwin(), 0, 0);
699 XRemoveFromSaveSet( tqt_xdisplay(), window );
700 if( d->mapAfterRelease )
701 XMapWindow( tqt_xdisplay(), window );
702 XSync(tqt_xdisplay(),
false);
716 XGetInputFocus( tqt_xdisplay(), &focus, &revert );
717 if( focus == d->focusProxy->winId())
718 XSetInputFocus( tqt_xdisplay(), topLevelWidget()->winId(), RevertToParent, get_tqt_x_time() );
727 void QXEmbed::sendDelete(
void )
731 sendClientMessage(window, tqt_wm_protocols, tqt_wm_delete_window);
732 XFlush( tqt_xdisplay() );
743 void QXEmbed::setProtocol( Protocol proto )
753 QXEmbed::Protocol QXEmbed::protocol()
762 void QXEmbed::resizeEvent(TQResizeEvent*)
765 XResizeWindow(tqt_xdisplay(), window, width(), height());
769 void QXEmbed::showEvent(TQShowEvent*)
772 XMapRaised(tqt_xdisplay(), window);
777 bool QXEmbed::eventFilter( TQObject *o, TQEvent * e)
780 switch ( e->type() ) {
781 case TQEvent::WindowActivate:
782 if ( o == topLevelWidget() ) {
785 if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded )
787 XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
788 RevertToParent, get_tqt_x_time() );
794 sendXEmbedMessage( window, XEMBED_WINDOW_ACTIVATE );
797 case TQEvent::WindowDeactivate:
798 if ( o == topLevelWidget() ) {
804 sendXEmbedMessage( window, XEMBED_WINDOW_DEACTIVATE );
809 TQWidget* pos =
this;
810 while( pos != o && pos != topLevelWidget())
811 pos = pos->parentWidget();
815 TQPoint globalPos = mapToGlobal(TQPoint(0,0));
816 if (globalPos != d->lastPos) {
817 d->lastPos = globalPos;
818 sendSyntheticConfigureNotifyEvent();
830 bool QXEmbed::event( TQEvent * e)
832 return TQWidget::event( e );
841 void QXEmbed::keyPressEvent( TQKeyEvent *)
845 last_key_event.window = window;
846 XSendEvent(tqt_xdisplay(), window,
false, KeyPressMask, (XEvent*)&last_key_event);
852 void QXEmbed::keyReleaseEvent( TQKeyEvent *)
856 last_key_event.window = window;
857 XSendEvent(tqt_xdisplay(), window,
false, KeyReleaseMask, (XEvent*)&last_key_event);
861 void QXEmbed::focusInEvent( TQFocusEvent * e ){
866 if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded )
867 if ( tqApp->activeWindow() == topLevelWidget() )
871 XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
872 RevertToParent, get_tqt_x_time() );
879 sendFocusMessage(window, XFocusIn, NotifyNormal, NotifyPointer );
883 int detail = XEMBED_FOCUS_CURRENT;
887 if ( e->reason() == TQFocusEvent::Tab )
888 detail = XEMBED_FOCUS_FIRST;
889 else if ( e->reason() == TQFocusEvent::Backtab )
890 detail = XEMBED_FOCUS_LAST;
891 sendXEmbedMessage( window, XEMBED_FOCUS_IN, detail);
896 void QXEmbed::focusOutEvent( TQFocusEvent * ){
903 sendFocusMessage(window, XFocusOut, NotifyNormal, NotifyPointer );
906 sendXEmbedMessage( window, XEMBED_FOCUS_OUT );
915 if ( !((QPublicWidget*) topLevelWidget())->topData()->embedded )
916 if ( tqApp->activeWindow() == topLevelWidget() )
921 XSetInputFocus( tqt_xdisplay(), d->focusProxy->winId(),
922 RevertToParent, get_tqt_x_time() );
928 void QXEmbed::updateEmbeddedFocus(
bool hasfocus ){
929 if (!window || d->xplain)
932 sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT);
934 sendXEmbedMessage( window, XEMBED_FOCUS_OUT);
939 static bool wstate_withdrawn( WId winid )
943 unsigned long length, after;
945 int r = XGetWindowProperty( tqt_xdisplay(), winid, tqt_wm_state, 0, 2,
946 false, AnyPropertyType, &type, &format,
947 &length, &after, &data );
948 bool withdrawn =
true;
951 if ( r == Success && data && format == 32 ) {
952 TQ_UINT32 *wstate = (TQ_UINT32*)data;
953 withdrawn = (*wstate == WithdrawnState );
954 XFree( (
char *)data );
961 static int get_parent(WId winid, Window *out_parent)
963 Window root, *children=0;
964 unsigned int nchildren;
965 int st = XQueryTree(tqt_xdisplay(), winid, &root, out_parent, &children, &nchildren);
973 void QXEmbed::embed(WId w)
975 kdDebug() <<
"*** Embed " << w <<
" into " << winId() <<
". window=" << window <<
endl;
980 bool has_window = (w == window);
987 if ( !wstate_withdrawn(window) ) {
988 XWithdrawWindow(tqt_xdisplay(), window, tqt_xscreen());
989 TQApplication::flushX();
991 for (
int i=0; i < 10000; ++i) {
992 if (wstate_withdrawn(window)) {
994 get_parent(w, &parent);
995 if (parent == tqt_xrootwin())
break;
1005 get_parent(w, &parent);
1006 kdDebug() << TQString(TQString(
"> before reparent: parent=0x%1").arg(parent,0,16)) <<
endl;
1007 for (
int i = 0; i < 50; i++) {
1011 XAddToSaveSet( tqt_xdisplay(), w );
1012 XReparentWindow(tqt_xdisplay(), w, winId(), 0, 0);
1013 if (get_parent(w, &parent) && parent == winId()) {
1014 kdDebug() << TQString(TQString(
"> Loop %1: ").arg(i))
1015 << TQString(TQString(
"> reparent of 0x%1").arg(w,0,16))
1016 << TQString(TQString(
" into 0x%1").arg(winId(),0,16))
1017 << TQString(
" successful") <<
endl;
1020 kdDebug() << TQString(TQString(
"> Loop %1: ").arg(i))
1021 << TQString(TQString(
"> reparent of 0x%1").arg(w,0,16))
1022 << TQString(TQString(
" into 0x%1").arg(winId(),0,16))
1023 << TQString(
" failed") <<
endl;
1026 if( parent != winId())
1033 void QXEmbed::handleEmbed()
1038 XAddToSaveSet( tqt_xdisplay(), window );
1039 XResizeWindow(tqt_xdisplay(), window, width(), height());
1040 XMapRaised(tqt_xdisplay(), window);
1042 sendSyntheticConfigureNotifyEvent();
1044 extraData()->xDndProxy = window;
1048 TQEvent * layoutHint =
new TQEvent( TQEvent::LayoutHint );
1049 TQApplication::postEvent( parent(), layoutHint );
1051 windowChanged( window );
1057 sendFocusMessage(window, XFocusIn, NotifyNormal, NotifyPointer );
1060 sendXEmbedMessage( window, XEMBED_EMBEDDED_NOTIFY, 0, (
long) winId() );
1061 if (isActiveWindow())
1062 sendXEmbedMessage( window, XEMBED_WINDOW_ACTIVATE);
1064 sendXEmbedMessage( window, XEMBED_WINDOW_DEACTIVATE);
1066 sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT );
1071 WId QXEmbed::embeddedWinId()
const
1079 bool QXEmbed::focusNextPrevChild(
bool next )
1091 return TQWidget::focusNextPrevChild( next );
1096 bool QXEmbed::x11Event( XEvent* e)
1098 switch ( e->type ) {
1100 if ( e->xdestroywindow.window == window ) {
1103 windowChanged( window );
1104 emit embeddedWindowDestroyed();
1110 window = e->xcreatewindow.window;
1114 case ReparentNotify:
1115 if ( e->xreparent.window == d->focusProxy->winId() )
1117 if ( window && e->xreparent.window == window &&
1118 e->xreparent.parent != winId() ) {
1121 windowChanged( window );
1122 emit embeddedWindowDestroyed();
1127 XRemoveFromSaveSet( tqt_xdisplay(), window );
1128 }
else if ( e->xreparent.parent == winId()){
1130 window = e->xreparent.window;
1132 if( e->xreparent.window == window )
1137 if (d->xplain && d->xgrab) {
1140 TQFocusEvent::setReason( TQFocusEvent::Mouse );
1142 TQFocusEvent::resetReason();
1144 XAllowEvents(tqt_xdisplay(), ReplayPointer, CurrentTime);
1150 if (d->xplain && d->xgrab) {
1152 XAllowEvents(tqt_xdisplay(), SyncPointer, CurrentTime);
1158 if ( window && e->xmaprequest.window == window )
1159 XMapRaised(tqt_xdisplay(), window );
1164 if ( e->xclient.format == 32 && e->xclient.message_type == xembed ) {
1165 long message = e->xclient.data.l[1];
1166 switch ( message ) {
1170 case XEMBED_FOCUS_NEXT:
1171 TQWidget::focusNextPrevChild(
true );
1173 case XEMBED_FOCUS_PREV:
1174 TQWidget::focusNextPrevChild(
false );
1177 case XEMBED_REQUEST_FOCUS:
1178 if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) {
1179 focusMap->remove( topLevelWidget() );
1180 focusMap->insert( topLevelWidget(),
new TQGuardedPtr<TQWidget>(
this ));
1181 WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
1182 sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
1184 TQFocusEvent::setReason( TQFocusEvent::Mouse );
1186 TQFocusEvent::resetReason();
1195 case ConfigureRequest:
1198 if (e->xconfigurerequest.window == window)
1200 sendSyntheticConfigureNotifyEvent();
1207 if ( TQWhatsThis::inWhatsThisMode() )
1208 enterWhatsThisMode();
1219 void QXEmbed::enterWhatsThisMode()
1225 TQWhatsThis::leaveWhatsThisMode();
1226 if ( !context_help )
1227 context_help = XInternAtom( x11Display(),
"_NET_WM_CONTEXT_HELP",
false );
1228 sendClientMessage(window , tqt_wm_protocols, context_help );
1233 void QXEmbed::windowChanged( WId )
1240 bool QXEmbed::processClientCmdline( TQWidget* client,
int& argc,
char ** argv )
1247 for ( i=1; i<myargc; i++ ) {
1248 if ( argv[i] && *argv[i] !=
'-' ) {
1249 argv[j++] = argv[i];
1252 TQCString arg = argv[i];
1253 if ( !strcmp(arg,
"-embed") && i < myargc-1 ) {
1254 TQCString s = argv[++i];
1257 argv[j++] = argv[i];
1262 embedClientIntoWindow( client, window );
1272 void QXEmbed::embedClientIntoWindow(TQWidget* client, WId window)
1275 XReparentWindow(tqt_xdisplay(), client->winId(), window, 0, 0);
1277 ((QXEmbed*)client)->topData()->embedded =
true;
1278 ((QXEmbed*)client)->topData()->parentWinId = window;
1288 TQSizePolicy QXEmbed::sizePolicy()
const
1290 return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding );
1295 TQSize QXEmbed::sizeHint()
const
1297 return minimumSizeHint();
1301 TQSize QXEmbed::minimumSizeHint()
const
1308 if (XGetWMNormalHints(tqt_xdisplay(), window, &size, &msize)
1309 && ( size.flags & PMinSize) ) {
1310 minw = size.min_width;
1311 minh = size.min_height;
1315 return TQSize( minw, minh );
1320 void QXEmbed::setAutoDelete(
bool b)
1326 bool QXEmbed::autoDelete()
const
1328 return d->autoDelete;
1332 bool QXEmbed::customWhatsThis()
const
1342 void QXEmbed::checkGrab()
1344 if (d->xplain && isActiveWindow() && !hasFocus()) {
1346 XGrabButton(tqt_xdisplay(), AnyButton, AnyModifier, winId(),
1347 false, ButtonPressMask, GrabModeSync, GrabModeAsync,
1352 XUngrabButton( tqt_xdisplay(), AnyButton, AnyModifier, winId() );
1359 void QXEmbed::sendSyntheticConfigureNotifyEvent()
1364 TQPoint globalPos = mapToGlobal(TQPoint(0,0));
1368 memset(&c, 0,
sizeof(c));
1369 c.type = ConfigureNotify;
1370 c.display = tqt_xdisplay();
1371 c.send_event = True;
1374 c.x = globalPos.x();
1375 c.y = globalPos.y();
1377 c.height = height();
1380 c.override_redirect = 0;
1381 XSendEvent( tqt_xdisplay(), c.event,
true, StructureNotifyMask, (XEvent*)&c );
1384 XSetWindowBorderWidth( tqt_xdisplay(), window, 1 );
1385 XSetWindowBorderWidth( tqt_xdisplay(), window, 0 );
1390 void QXEmbed::reparent( TQWidget * parent, WFlags f,
const TQPoint & p,
bool showIt )
1396 Q_ASSERT( !window );
1397 TQWidget::reparent( parent, f, p, showIt );
1401 #include "qxembed.moc"
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
TDEAction * revert(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name)
Revert the current document to the last saved version (essentially will undo all changes).
TQString name(StdAccel id)