29 #include <kuniqueapplication.h>
32 #include <tqwhatsthis.h>
33 #include <tqcstring.h>
38 #include "tdeapplication.h"
40 #include <tdeglobal.h>
41 #include <kiconloader.h>
44 #include <kdatastream.h>
46 #include <dcopclient.h>
49 #include <tdestartupinfo.h>
50 #include <kxerrorhandler.h>
53 #include <X11/Xatom.h>
54 #include <X11/Xutil.h>
58 static bool atoms_created =
false;
59 extern Atom tqt_wm_protocols;
61 static Atom net_wm_context_help;
62 static Atom kde_wm_change_state;
63 static Atom kde_wm_window_opacity;
64 static Atom kde_wm_window_shadow;
65 static Atom twin_UTF8_STRING;
66 static Atom net_wm_cm;
68 static void twin_net_create_atoms() {
72 const char* names[max];
73 Atom atoms_return[max];
76 atoms[n] = &net_wm_context_help;
77 names[n++] =
"_NET_WM_CONTEXT_HELP";
79 atoms[n] = &kde_wm_change_state;
80 names[n++] =
"_TDE_WM_CHANGE_STATE";
82 atoms[n] = &kde_wm_window_opacity;
83 names[n++] = (
char*)
"_TDE_WM_WINDOW_OPACITY";
85 atoms[n] = &kde_wm_window_shadow;
86 names[n++] = (
char*)
"_TDE_WM_WINDOW_SHADOW";
88 char net_wm_cm_name[ 100 ];
89 sprintf( net_wm_cm_name,
"_NET_WM_CM_S%d", DefaultScreen( tqt_xdisplay()));
90 atoms[n] = &net_wm_cm;
91 names[n++] = net_wm_cm_name;
94 XInternAtoms( tqt_xdisplay(),
const_cast<char**
>(names), n,
false, atoms_return );
95 for (
int i = 0; i < n; i++ )
96 *atoms[i] = atoms_return[i];
107 static void sendClientMessageToRoot(Window w, Atom a,
long x,
long y = 0,
long z = 0 ){
111 memset(&ev, 0,
sizeof(ev));
112 ev.xclient.type = ClientMessage;
113 ev.xclient.window = w;
114 ev.xclient.message_type = a;
115 ev.xclient.format = 32;
116 ev.xclient.data.l[0] = x;
117 ev.xclient.data.l[1] = y;
118 ev.xclient.data.l[2] = z;
119 mask = SubstructureRedirectMask;
120 XSendEvent(tqt_xdisplay(), tqt_xrootwin(), False, mask, &ev);
128 static void sendClientMessage(Window w, Atom a,
long x){
132 memset(&ev, 0,
sizeof(ev));
133 ev.xclient.type = ClientMessage;
134 ev.xclient.window = w;
135 ev.xclient.message_type = a;
136 ev.xclient.format = 32;
137 ev.xclient.data.l[0] = x;
138 ev.xclient.data.l[1] = CurrentTime;
140 if (w == tqt_xrootwin())
141 mask = SubstructureRedirectMask;
142 XSendEvent(tqt_xdisplay(), w, False, mask, &ev);
149 twin_net_create_atoms();
150 return XGetSelectionOwner( tqt_xdisplay(), net_wm_cm ) != None;
159 class ContextWidget :
public TQWidget
163 virtual bool x11Event( XEvent * ev);
166 ContextWidget::ContextWidget()
169 twin_net_create_atoms();
170 kapp->installX11EventFilter(
this );
171 TQWhatsThis::enterWhatsThisMode();
172 TQCursor c = *TQApplication::overrideCursor();
173 TQWhatsThis::leaveWhatsThisMode();
174 XGrabPointer( tqt_xdisplay(), tqt_xrootwin(),
true,
175 (uint)( ButtonPressMask | ButtonReleaseMask |
176 PointerMotionMask | EnterWindowMask |
178 GrabModeAsync, GrabModeAsync,
179 None, c.handle(), CurrentTime );
184 bool ContextWidget::x11Event( XEvent * ev)
186 if ( ev->type == ButtonPress && ev->xbutton.button == Button1 ) {
187 XUngrabPointer( tqt_xdisplay(), ev->xbutton.time );
189 Window child = tqt_xrootwin();
190 int root_x, root_y, lx, ly;
195 XQueryPointer( tqt_xdisplay(), w, &root, &child,
196 &root_x, &root_y, &lx, &ly, &state );
197 }
while ( child != None && child != w );
199 ::sendClientMessage(w, tqt_wm_protocols, net_wm_context_help);
201 e.xbutton.window = w;
202 e.xbutton.subwindow = w;
205 XSendEvent( tqt_xdisplay(), w,
true, ButtonPressMask, &e );
224 NETWinInfo
info( tqt_xdisplay(), trayWin, tqt_xrootwin(), 0 );
226 forWin = tqt_xrootwin();
227 info.setKDESystemTrayWinFor( forWin );
228 NETRootInfo rootinfo( tqt_xdisplay(), NET::Supported );
229 if( !rootinfo.isSupported( NET::WMKDESystemTrayWinFor )) {
231 if( !ref.
send(
"loadModule", TQCString(
"kdetrayproxy" )))
232 kdWarning( 176 ) <<
"Loading of kdetrayproxy failed." <<
endl;
240 NETRootInfo
info( tqt_xdisplay(), 0 );
242 time = get_tqt_x_user_time();
243 info.setActiveWindow( win, NET::FromApplication, time,
244 kapp->activeWindow() ? kapp->activeWindow()->winId() : 0 );
246 KUniqueApplication::setHandleAutoStarted();
252 NETRootInfo
info( tqt_xdisplay(), 0 );
254 time = get_tqt_x_time();
255 info.setActiveWindow( win, NET::FromTool, time, 0 );
257 KUniqueApplication::setHandleAutoStarted();
263 NETRootInfo
info( tqt_xdisplay(), 0 );
264 info.setActiveWindow( win, NET::FromUnknown, 0, 0 );
266 KUniqueApplication::setHandleAutoStarted();
272 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
280 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
281 info.setUserTime( time );
287 return WindowInfo( win, properties, properties2 );
295 Window transient_for = None;
296 if( XGetTransientForHint( tqt_xdisplay(), win, &transient_for ))
297 return transient_for;
308 if( mainwindow != 0 )
313 if( tqt_cast< TQDialog* >( subwindow ) != NULL
314 && subwindow->parentWidget() == NULL
315 && kapp->mainWidget() != NULL )
317 kdWarning() <<
"KWin::setMainWindow(): There either mustn't be kapp->mainWidget(),"
318 " or the dialog must have a non-NULL parent, otherwise Qt will reset the change. Bummer." <<
endl;
320 XSetTransientForHint( tqt_xdisplay(), subwindow->winId(), mainwindow );
323 XDeleteProperty( tqt_xdisplay(), subwindow->winId(), XA_WM_TRANSIENT_FOR );
331 XWMHints *hints = XGetWMHints( tqt_xdisplay(), win );
332 Window window_group = None;
335 if( hints->flags & WindowGroupHint )
336 window_group = hints->window_group;
337 XFree(
reinterpret_cast< char*
>( hints ));
351 NETWinInfo inf( tqt_xdisplay(), win, tqt_xrootwin(),
359 NET::WMKDEFrameStrut |
364 w.
state = inf.state();
365 w.mappingState = inf.mappingState();
366 w.
strut = inf.strut();
369 w.
name = TQString::fromUtf8( inf.name() );
372 if ( XFetchName( tqt_xdisplay(), win, &c ) != 0 ) {
373 w.
name = TQString::fromLocal8Bit( c );
377 if ( inf.visibleName() )
378 w.
visibleName = TQString::fromUtf8( inf.visibleName() );
383 w.
onAllDesktops = inf.desktop() == NETWinInfo::OnAllDesktops;
386 inf.kdeGeometry( frame, geom );
393 TQPixmap
KWin::icon( WId win,
int width,
int height,
bool scale )
399 TQPixmap
KWin::icon( WId win,
int width,
int height,
bool scale,
int flags )
406 if( flags &
NETWM ) {
407 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMIcon );
411 img.setAlphaBuffer(
true );
412 if ( scale && width > 0 && height > 0 &&img.size() != TQSize( width, height ) && !img.isNull() )
413 img = TQImage(img).smoothScale( width, height );
415 result.convertFromImage( img );
422 Pixmap p_mask = None;
424 XWMHints *hints = XGetWMHints(tqt_xdisplay(), win );
425 if (hints && (hints->flags & IconPixmapHint)){
426 p = hints->icon_pixmap;
428 if (hints && (hints->flags & IconMaskHint)){
429 p_mask = hints->icon_mask;
439 unsigned int border_w, depth;
440 XGetGeometry(tqt_xdisplay(), p, &root,
441 &x, &y, &w, &h, &border_w, &depth);
443 TQPixmap pm(w, h, depth);
446 XCopyArea(tqt_xdisplay(), p, pm.handle(),
447 tqt_xget_temp_gc(tqt_xscreen(), depth==1),
451 XCopyArea(tqt_xdisplay(), p_mask, bm.handle(),
452 tqt_xget_temp_gc(tqt_xscreen(),
true),
456 if ( scale && width > 0 && height > 0 && !pm.isNull() &&
457 ( (
int) w != width || (
int) h != height) ){
458 result.convertFromImage( TQImage(pm.convertToImage()).smoothScale( width, height ) );
472 else if( width < 40 )
480 if( result.isNull() ) {
483 if( XGetClassHint( tqt_xdisplay(), win, &hint ) ) {
484 TQString className = hint.res_class;
488 if( scale && !pm.isNull() )
489 result.convertFromImage( TQImage(pm.convertToImage()).smoothScale( width, height ) );
493 XFree( hint.res_name );
494 XFree( hint.res_class );
502 if ( result.isNull() ) {
505 if( scale && !pm.isNull() )
506 result.convertFromImage( TQImage(pm.convertToImage()).smoothScale( width, height ) );
520 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
521 TQImage img = TQImage(
icon.convertToImage()).convertDepth( 32 );
525 ni.
data = (
unsigned char *) img.bits();
526 info.setIcon( ni,
true );
527 if ( miniIcon.isNull() )
529 img = TQImage(miniIcon.convertToImage()).convertDepth( 32 );
532 ni.
data = (
unsigned char *) img.bits();
533 info.setIcon( ni,
false );
540 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
541 info.setWindowType( windowType );
548 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMState );
549 info.setState( state, state );
556 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMState );
557 info.setState( 0, state );
564 twin_net_create_atoms();
566 XDeleteProperty (tqt_xdisplay(), win, kde_wm_window_opacity);
569 long opacity = long(0xFFFFFFFF/100.0*percent);
570 XChangeProperty(tqt_xdisplay(), win, kde_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (
unsigned char *) &opacity, 1L);
578 twin_net_create_atoms();
579 long shadowSize = long(0xFFFFFFFF/100.0*percent);
580 XChangeProperty(tqt_xdisplay(), win, kde_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (
unsigned char *) &shadowSize, 1L);
587 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMDesktop );
589 info.setDesktop( NETWinInfo::OnAllDesktops );
590 else if (
info.
desktop() == NETWinInfo::OnAllDesktops ) {
591 NETRootInfo rinfo( tqt_xdisplay(), NET::CurrentDesktop );
592 info.setDesktop( rinfo.currentDesktop() );
600 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMDesktop );
601 info.setDesktop( desktop );
606 int right_width,
int right_start,
int right_end,
int top_width,
int top_start,
int top_end,
607 int bottom_width,
int bottom_start,
int bottom_end )
610 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
616 strut.left_start = left_start;
617 strut.left_end = left_end;
618 strut.right_start = right_start;
619 strut.right_end = right_end;
620 strut.top_start = top_start;
621 strut.top_end = top_end;
622 strut.bottom_start = bottom_start;
623 strut.bottom_end = bottom_end;
624 info.setExtendedStrut( strut );
631 NETWinInfo
info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
637 info.setStrut( strut );
648 NETRootInfo
info( tqt_xdisplay(), NET::CurrentDesktop );
649 return info.currentDesktop();
660 NETRootInfo
info( tqt_xdisplay(), NET::NumberOfDesktops );
661 return info.numberOfDesktops();
668 NETRootInfo
info( tqt_xdisplay(), NET::CurrentDesktop );
669 info.setCurrentDesktop( desktop );
676 NETRootInfo
info( tqt_xdisplay(), NET::CurrentDesktop );
678 netview.
x = viewport.x();
679 netview.
y = viewport.y();
680 info.setDesktopViewport( desktop, netview );
689 twin_net_create_atoms();
690 sendClientMessageToRoot( win, kde_wm_change_state, IconicState, 1 );
692 XIconifyWindow( tqt_xdisplay(), win, tqt_xscreen() );
702 twin_net_create_atoms();
703 sendClientMessageToRoot( win, kde_wm_change_state, NormalState, 1 );
705 XMapWindow( tqt_xdisplay(), win );
712 NETRootInfo
info( tqt_xdisplay(), NET::Supported );
713 if(
info.isSupported( NET::WM2RestackWindow ))
714 info.restackRequest( win, None, Above );
716 XRaiseWindow( tqt_xdisplay(), win );
723 NETRootInfo
info( tqt_xdisplay(), NET::Supported );
724 if(
info.isSupported( NET::WM2RestackWindow ))
725 info.restackRequest( win, None, Below );
727 XLowerWindow( tqt_xdisplay(), win );
734 TDEStartupInfo::appStarted();
738 class KWin::WindowInfoPrivate
747 ~WindowInfoPrivate() {
delete info; }
752 TQString iconic_name_;
754 TQRect frame_geometry_;
758 WindowInfoPrivate(
const WindowInfoPrivate& );
759 void operator=(
const WindowInfoPrivate& );
767 d =
new WindowInfoPrivate;
769 if( properties == 0 )
770 properties = NET::WMState |
776 NET::WMVisibleIconName |
779 NET::WMKDEFrameStrut |
782 if( properties & NET::WMVisibleIconName )
783 properties |= NET::WMIconName | NET::WMVisibleName;
784 if( properties & NET::WMVisibleName )
785 properties |= NET::WMName;
786 if( properties2 & NET::WM2ExtendedStrut )
787 properties |= NET::WMStrut;
788 properties |= NET::XAWMState;
789 unsigned long props[ 2 ] = { properties, properties2 };
790 d->info =
new NETWinInfo( tqt_xdisplay(),
win, tqt_xrootwin(), props, 2 );
792 if( properties & NET::WMName ) {
793 if( d->info->name() && d->info->name()[ 0 ] !=
'\0' )
794 d->name_ = TQString::fromUtf8( d->info->name() );
798 if( properties & NET::WMIconName ) {
799 if( d->info->iconName() && d->info->iconName()[ 0 ] !=
'\0' )
800 d->iconic_name_ = TQString::fromUtf8( d->info->iconName());
804 if( properties & ( NET::WMGeometry | NET::WMKDEFrameStrut )) {
806 d->info->kdeGeometry( frame, geom );
810 d->valid = !handler.
error(
false );
815 KWin::WindowInfo::WindowInfo()
820 KWin::WindowInfo::~WindowInfo()
823 if( --d->ref == 0 ) {
838 if( d != wininfo.d ) {
853 if( !withdrawn_is_valid && mappingState() == NET::Withdrawn )
866 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMState ) == 0, 176 )
867 <<
"Pass NET::WMState to KWin::windowInfo()" <<
endl;
868 return d->info->state();
877 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::XAWMState ) == 0, 176 )
878 <<
"Pass NET::XAWMState to KWin::windowInfo()" <<
endl;
879 return d->info->mappingState();
888 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2ExtendedStrut ) == 0, 176 )
889 <<
"Pass NET::WM2ExtendedStrut to second argument of KWin::windowInfo()" <<
endl;
895 if( str.
left != 0 ) {
898 ext.left_end = XDisplayHeight( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
900 if( str.
right != 0 ) {
903 ext.right_end = XDisplayHeight( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
908 ext.top_end = XDisplayWidth( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
912 ext.bottom_start = 0;
913 ext.bottom_end = XDisplayWidth( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
926 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMStrut ) == 0, 176 )
927 <<
"Pass NET::WMStrut to KWin::windowInfo()" <<
endl;
928 return d->info->strut();
938 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMWindowType ) == 0, 176 )
939 <<
"Pass NET::WMWindowType to KWin::windowInfo()" <<
endl;
940 return d->info->windowType( supported_types );
948 TQString s = visibleName();
949 if ( isMinimized() ) {
956 TQString KWin::Info::visibleNameWithState()
const
958 TQString s = visibleName;
959 if ( isMinimized() ) {
969 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMVisibleName ) == 0, 176 )
970 <<
"Pass NET::WMVisibleName to KWin::windowInfo()" <<
endl;
971 return d->info->visibleName() && d->info->visibleName()[ 0 ] !=
'\0'
972 ? TQString::fromUtf8(d->info->visibleName()) : name();
974 return TQString(
"name");
981 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMName ) == 0, 176 )
982 <<
"Pass NET::WMName to KWin::windowInfo()" <<
endl;
991 TQString s = visibleIconName();
992 if ( isMinimized() ) {
1002 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMVisibleIconName ) == 0, 176 )
1003 <<
"Pass NET::WMVisibleIconName to KWin::windowInfo()" <<
endl;
1004 if( d->info->visibleIconName() && d->info->visibleIconName()[ 0 ] !=
'\0' )
1005 return TQString::fromUtf8( d->info->visibleIconName());
1006 if( d->info->iconName() && d->info->iconName()[ 0 ] !=
'\0' )
1007 return TQString::fromUtf8( d->info->iconName());
1008 if( !d->iconic_name_.isEmpty())
1009 return d->iconic_name_;
1011 return visibleName();
1017 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMIconName ) == 0, 176 )
1018 <<
"Pass NET::WMIconName to KWin::windowInfo()" <<
endl;
1019 if( d->info->iconName() && d->info->iconName()[ 0 ] !=
'\0' )
1020 return TQString::fromUtf8( d->info->iconName());
1021 if( !d->iconic_name_.isEmpty())
1022 return d->iconic_name_;
1039 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMDesktop ) == 0, 176 )
1040 <<
"Pass NET::WMDesktop to KWin::windowInfo()" <<
endl;
1041 return d->info->desktop() == desktop || d->info->desktop() == NET::OnAllDesktops;
1050 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMDesktop ) == 0, 176 )
1051 <<
"Pass NET::WMDesktop to KWin::windowInfo()" <<
endl;
1052 return d->info->desktop() == NET::OnAllDesktops;
1061 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMDesktop ) == 0, 176 )
1062 <<
"Pass NET::WMDesktop to KWin::windowInfo()" <<
endl;
1063 return d->info->desktop();
1072 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMGeometry ) == 0, 176 )
1073 <<
"Pass NET::WMGeometry to KWin::windowInfo()" <<
endl;
1074 return d->geometry_;
1076 return TQRect( 100, 100, 200, 200 );
1083 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMKDEFrameStrut ) == 0, 176 )
1084 <<
"Pass NET::WMKDEFrameStrut to KWin::windowInfo()" <<
endl;
1085 return d->frame_geometry_;
1094 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2TransientFor ) == 0, 176 )
1095 <<
"Pass NET::WM2TransientFor to KWin::windowInfo()" <<
endl;
1096 return d->info->transientFor();
1105 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2GroupLeader ) == 0, 176 )
1106 <<
"Pass NET::WM2GroupLeader to KWin::windowInfo()" <<
endl;
1107 return d->info->groupLeader();
1116 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] &
NET::WM2WindowClass ) == 0, 176 )
1117 <<
"Pass NET::WM2WindowClass to KWin::windowInfo()" <<
endl;
1118 return d->info->windowClassClass();
1127 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] &
NET::WM2WindowClass ) == 0, 176 )
1128 <<
"Pass NET::WM2WindowClass to KWin::windowInfo()" <<
endl;
1129 return d->info->windowClassName();
1138 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] &
NET::WM2WindowRole ) == 0, 176 )
1139 <<
"Pass NET::WM2WindowRole to KWin::windowInfo()" <<
endl;
1140 return d->info->windowRole();
1149 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] &
NET::WM2ClientMachine ) == 0, 176 )
1150 <<
"Pass NET::WM2ClientMachine to KWin::windowInfo()" <<
endl;
1151 return d->info->clientMachine();
1160 kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2AllowedActions ) == 0, 176 )
1161 <<
"Pass NET::WM2AllowedActions to KWin::windowInfo()" <<
endl;
1163 return d->info->allowedActions() & action;
1173 if( mappingState() != NET::Iconic )
1177 && ( state() & NET::Shaded ) == 0 )
1181 return icccmCompliantMappingState() ? false :
true;
1190 if( mappingState != NET::Iconic )
1194 && ( state & NET::Shaded ) == 0 )
1198 return icccmCompliantMappingState() ? false :
true;
1204 bool KWin::Info::isIconified()
const
1206 return isMinimized();
1209 bool KWin::icccmCompliantMappingState()
1212 static enum { noidea, yes, no } wm_is_1_2_compliant = noidea;
1213 if( wm_is_1_2_compliant == noidea ) {
1214 NETRootInfo
info( tqt_xdisplay(), NET::Supported );
1217 return wm_is_1_2_compliant == yes;
1226 static enum { noidea, yes, no } wm_supports_allowed_actions = noidea;
1227 if( wm_supports_allowed_actions == noidea ) {
1228 NETRootInfo
info( tqt_xdisplay(), NET::Supported );
1229 wm_supports_allowed_actions =
info.isSupported( NET::WM2AllowedActions ) ? yes : no;
1231 return wm_supports_allowed_actions == yes;
1246 if ( XGetTextProperty( tqt_xdisplay(), win, &tp, atom ) != 0 && tp.value != NULL )
1248 if (!twin_UTF8_STRING)
1249 twin_UTF8_STRING = XInternAtom( tqt_xdisplay(),
"UTF8_STRING", False);
1251 if ( tp.encoding == twin_UTF8_STRING ) {
1252 result = TQString::fromUtf8 ( (
const char*) tp.value );
1254 else if ( XmbTextPropertyToTextList( tqt_xdisplay(), &tp, &text, &count) == Success &&
1255 text != NULL && count > 0 ) {
1256 result = TQString::fromLocal8Bit( text[0] );
1257 }
else if ( tp.encoding == XA_STRING )
1258 result = TQString::fromLocal8Bit( (
const char*) tp.value );
1260 XFreeStringList( text );
bool send(const TQCString &fun)
Information about a window.
NET::WindowType windowType(int supported_types) const
Returns the window type of this window (see NET::WindowType).
WId transientFor() const
Returns the WM_TRANSIENT_FOR property for the window, i.e.
TQString name() const
Returns the name of the window, as specified by the application, without any modifications.
TQString visibleName() const
Returns the visible name of the window (i.e.
bool actionSupported(NET::Action action) const
Returns true if the given action is currently supported for the window by the window manager.
TQString iconName() const
Returns the name of the window that should be shown in taskbar and all other "iconic" representations...
bool valid(bool withdrawn_is_valid=false) const
Returns false if this window info is not valid (most probably the given window doesn't exist).
bool isMinimized() const
Returns true if the window is minimized.
bool isOnDesktop(int desktop) const
Returns true if the window is on the given virtual desktop.
WId win() const
Returns the window identifier.
WId groupLeader() const
Returns the leader window for the group the window is in, if any.
WindowInfo(WId window, unsigned long properties, unsigned long properties2)
Reads all the info about the given window.
NET::MappingState mappingState() const
Returns the mapping state of the window (see NET::MappingState).
TQString visibleIconNameWithState() const
Returns a visible name with state.
TQString visibleNameWithState() const
Returns a visible name with state.
TQCString windowClassName() const
Returns the name component of the window class for the window (i.e.
TQRect geometry() const
Returns the position and size of the window contents.
unsigned long state() const
Returns the window's state flags (see the NET::State enum for details).
TQString visibleIconName() const
Returns the visible name of the window that should be shown in taskbar and all other "iconic" represe...
TQRect frameGeometry() const
Returns the frame geometry of the window, i.e.
NETExtendedStrut extendedStrut() const
Returns the window extended (partial) strut.
int desktop() const
Returns the virtual desktop this window is on (NET::OnAllDesktops if the window is on all desktops).
bool onAllDesktops() const
Returns true if the window is on all desktops (equal to desktop()==NET::OnAllDesktops).
TQCString windowRole() const
Returns the window role for the window (i.e.
TQCString windowClassClass() const
Returns the class component of the window class for the window (i.e.
TQCString clientMachine() const
Returns the client machine for the window (i.e.
bool isOnCurrentDesktop() const
Returns true if the window is on the currently active virtual desktop.
static WId groupLeader(WId window)
Returns the leader window for the group the given window is in, if any.
static bool compositingActive()
Returns true if a compositing manager is running (i.e.
static void setCurrentDesktop(int desktop)
Convenience function to set the current desktop to desktop.
static void activateWindow(WId win, long time=0)
Requests that window win is activated.
static void setCurrentDesktopViewport(int desktop, TQPoint viewport)
Convenience function to set the current viewport to viewport.
static void iconifyWindow(WId win, bool animation=true)
Iconifies a window.
static void setExtendedStrut(WId win, int left_width, int left_start, int left_end, int right_width, int right_start, int right_end, int top_width, int top_start, int top_end, int bottom_width, int bottom_start, int bottom_end)
Sets the strut of window win to to left width ranging from left_start to left_end on the left edge,...
static WId transientFor(WId window)
Returns the WM_TRANSIENT_FOR property for the given window, i.e.
static void appStarted() TDE_DEPRECATED
static void demandAttention(WId win, bool set=true)
When application finishes some operation and wants to notify the user about it, it can call demandAtt...
static void setUserTime(WId win, long time)
Sets user timestamp time on window win.
static void deIconifyWindow(WId win, bool animation=true)
DeIconifies a window.
@ WMHints
read from WMHints property
@ NETWM
read from property from the window manager specification
@ ClassHint
load icon after getting name from the classhint
@ XApp
load the standard X icon (last fallback)
static void forceActiveWindow(WId win, long time=0)
Sets window win to be the active window.
static void setOnAllDesktops(WId win, bool b)
Sets window win to be present on all virtual desktops if is true.
static WindowInfo windowInfo(WId win, unsigned long properties=0, unsigned long properties2=0)
Returns information about window win.
static void lowerWindow(WId win)
Lowers the given window.
static void setMainWindow(TQWidget *subwindow, WId mainwindow)
Sets the parent window of subwindow to be mainwindow.
static Info info(WId win) TDE_DEPRECATED
static void clearState(WId win, unsigned long state)
Clears the state of window win from state.
static void setShadowSize(WId win, uint percent)
Sets the shadowsize of window win to percetage percent.
static void setOnDesktop(WId win, int desktop)
Moves window win to desktop desktop.
static int numberOfDesktops()
Convenience function to access the number of desktops.
static void setOpacity(WId win, uint percent)
Sets the opacity of window win to percetage percent.
static void setType(WId win, NET::WindowType windowType)
Sets the type of window win to windowType.
static void setStrut(WId win, int left, int right, int top, int bottom)
static int currentDesktop()
Convenience function to access the current desktop.
static TQString readNameProperty(WId window, unsigned long atom)
Function that reads and returns the contents of the given text property (WM_NAME, WM_ICON_NAME,...
static void setActiveWindow(WId win) TDE_DEPRECATED
static bool allowedActionsSupported()
Returns true if the WM announces which actions it allows for windows.
static void setSystemTrayWindowFor(WId trayWin, WId forWin)
Makes trayWin a system tray window for forWin.
static void invokeContextHelp()
Invokes interactive context help.
static void raiseWindow(WId win)
Raises the given window.
static TQPixmap icon(WId win, int width=-1, int height=-1, bool scale=false)
Returns an icon for window win.
static void setState(WId win, unsigned long state)
Sets the state of window win to state.
static void setIcons(WId win, const TQPixmap &icon, const TQPixmap &miniIcon)
Sets an icon and a miniIcon on window win.
This class simplifies handling of X errors.
bool error(bool sync) const
This function returns true if the error flag is set (i.e.
Action
Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
MappingState
Client window mapping state.
static TDEInstance * instance()
Returns the global instance.
TQPixmap loadIcon(const TQString &name, TDEIcon::Group group, int size=0, int state=TDEIcon::DefaultState, TQString *path_store=0L, bool canReturnNull=false) const
Loads an icon.
@ DefaultState
The default state.
TDEIconLoader * iconLoader() const
Returns an iconloader object.
kndbgstream & endl(kndbgstream &s)
Does nothing.
TQRect frameGeometry
Position and size of the window's frame.
pid_t pid
The process id of the window's owner.
TQRect geometry
Position and size of the window contents.
long unsigned int state
The window's state.
int desktop
The number of the window's desktop.
bool isMinimized() const
The mapping state.
NET::WindowType windowType
The window type.
bool onAllDesktops
true if the window is on all desktops.
TQString visibleName
The visible name of the window.
TQString name
The name of the window.
Partial strut class for NET classes.
int bottom_width
Bottom border of the strut, width and range.
int left_width
Left border of the strut, width and range.
int right_width
Right border of the strut, width and range.
int top_width
Top border of the strut, width and range.
Simple icon class for NET classes.
NETSize size
Size of the icon.
unsigned char * data
Image data for the icon.
Simple point class for NET classes.
Simple rectangle class for NET classes.
NETPoint pos
Position of the rectangle.
NETSize size
Size of the rectangle.
int bottom
Bottom border of the strut.
int left
Left border of the strut.
int right
Right border of the strut.
int top
Top border of the strut.