• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
twin.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Matthias Ettrich (ettrich@kde.org)
3 
4  $Id$
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include <stdlib.h>
23 #include <unistd.h>
24 
25 #ifdef HAVE_SYSENT_H
26 #include <sysent.h>
27 #endif
28 
29 #include <kuniqueapplication.h>
30 #include <tqbitmap.h>
31 #include <tqimage.h>
32 #include <tqwhatsthis.h>
33 #include <tqcstring.h>
34 #include <tqdialog.h>
35 
36 #include "config.h"
37 #include "twin.h"
38 #include "tdeapplication.h"
39 
40 #include <tdeglobal.h>
41 #include <kiconloader.h>
42 #include <kdebug.h>
43 
44 #include <kdatastream.h>
45 #include <tdelocale.h>
46 #include <dcopclient.h>
47 #include <dcopref.h>
48 #ifdef Q_WS_X11
49 #include <tdestartupinfo.h>
50 #include <kxerrorhandler.h>
51 
52 #include <X11/Xlib.h>
53 #include <X11/Xatom.h>
54 #include <X11/Xutil.h>
55 
56 #include "netwm.h"
57 
58 static bool atoms_created = false;
59 extern Atom tqt_wm_protocols;
60 
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;
67 
68 static void twin_net_create_atoms() {
69  if (!atoms_created){
70  const int max = 20;
71  Atom* atoms[max];
72  const char* names[max];
73  Atom atoms_return[max];
74  int n = 0;
75 
76  atoms[n] = &net_wm_context_help;
77  names[n++] = "_NET_WM_CONTEXT_HELP";
78 
79  atoms[n] = &kde_wm_change_state;
80  names[n++] = "_TDE_WM_CHANGE_STATE";
81 
82  atoms[n] = &kde_wm_window_opacity;
83  names[n++] = (char*) "_TDE_WM_WINDOW_OPACITY";
84 
85  atoms[n] = &kde_wm_window_shadow;
86  names[n++] = (char*) "_TDE_WM_WINDOW_SHADOW";
87 
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;
92 
93  // we need a const_cast for the horrible X API
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];
97 
98  atoms_created = True;
99  }
100 }
101 #endif
102 
103 /*
104  Sends a client message to the ROOT window.
105  */
106 #ifdef Q_WS_X11
107 static void sendClientMessageToRoot(Window w, Atom a, long x, long y = 0, long z = 0 ){
108  XEvent ev;
109  long mask;
110 
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);
121 }
122 #endif
123 
124 /*
125  Send a client message to window w
126  */
127 #ifdef Q_WS_X11
128 static void sendClientMessage(Window w, Atom a, long x){
129  XEvent ev;
130  long mask;
131 
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;
139  mask = 0L;
140  if (w == tqt_xrootwin())
141  mask = SubstructureRedirectMask; /* magic! */
142  XSendEvent(tqt_xdisplay(), w, False, mask, &ev);
143 }
144 #endif
145 
146 bool KWin::compositingActive()
147 {
148 #ifdef Q_WS_X11
149  twin_net_create_atoms();
150  return XGetSelectionOwner( tqt_xdisplay(), net_wm_cm ) != None;
151 #else
152  return false;
153 #endif
154 }
155 
156 #ifdef Q_WS_X11
157 namespace
158 {
159 class ContextWidget : public TQWidget
160 {
161 public:
162  ContextWidget();
163  virtual bool x11Event( XEvent * ev);
164 };
165 
166 ContextWidget::ContextWidget()
167  : TQWidget(0,0)
168  {
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 |
177  LeaveWindowMask ),
178  GrabModeAsync, GrabModeAsync,
179  None, c.handle(), CurrentTime );
180  tqApp->enter_loop();
181  }
182 
183 
184 bool ContextWidget::x11Event( XEvent * ev)
185  {
186  if ( ev->type == ButtonPress && ev->xbutton.button == Button1 ) {
187  XUngrabPointer( tqt_xdisplay(), ev->xbutton.time );
188  Window root;
189  Window child = tqt_xrootwin();
190  int root_x, root_y, lx, ly;
191  uint state;
192  Window w;
193  do {
194  w = child;
195  XQueryPointer( tqt_xdisplay(), w, &root, &child,
196  &root_x, &root_y, &lx, &ly, &state );
197  } while ( child != None && child != w );
198 
199  ::sendClientMessage(w, tqt_wm_protocols, net_wm_context_help);
200  XEvent e = *ev;
201  e.xbutton.window = w;
202  e.xbutton.subwindow = w;
203  e.xbutton.x = lx;
204  e.xbutton.y = ly;
205  XSendEvent( tqt_xdisplay(), w, true, ButtonPressMask, &e );
206  tqApp->exit_loop();
207  return true;
208  }
209  return false;
210  }
211 } // namespace
212 #endif
213 
214 void KWin::invokeContextHelp()
215 {
216 #ifdef Q_WS_X11
217  ContextWidget w;
218 #endif
219 }
220 
221 void KWin::setSystemTrayWindowFor( WId trayWin, WId forWin )
222 {
223 #ifdef Q_WS_X11
224  NETWinInfo info( tqt_xdisplay(), trayWin, tqt_xrootwin(), 0 );
225  if ( !forWin )
226  forWin = tqt_xrootwin();
227  info.setKDESystemTrayWinFor( forWin );
228  NETRootInfo rootinfo( tqt_xdisplay(), NET::Supported );
229  if( !rootinfo.isSupported( NET::WMKDESystemTrayWinFor )) {
230  DCOPRef ref( "kded", "kded" );
231  if( !ref.send( "loadModule", TQCString( "kdetrayproxy" )))
232  kdWarning( 176 ) << "Loading of kdetrayproxy failed." << endl;
233  }
234 #endif
235 }
236 
237 void KWin::activateWindow( WId win, long time )
238 {
239 #ifdef Q_WS_X11
240  NETRootInfo info( tqt_xdisplay(), 0 );
241  if( time == 0 )
242  time = GET_QT_X_USER_TIME();
243  info.setActiveWindow( win, NET::FromApplication, time,
244  kapp->activeWindow() ? kapp->activeWindow()->winId() : 0 );
245 #endif // Q_WS_X11 ...
246  KUniqueApplication::setHandleAutoStarted();
247 }
248 
249 void KWin::forceActiveWindow( WId win, long time )
250 {
251 #ifdef Q_WS_X11
252  NETRootInfo info( tqt_xdisplay(), 0 );
253  if( time == 0 )
254  time = GET_QT_X_TIME();
255  info.setActiveWindow( win, NET::FromTool, time, 0 );
256 #endif // Q_WS_X11
257  KUniqueApplication::setHandleAutoStarted();
258 }
259 
260 void KWin::setActiveWindow( WId win )
261 {
262 #ifdef Q_WS_X11
263  NETRootInfo info( tqt_xdisplay(), 0 );
264  info.setActiveWindow( win, NET::FromUnknown, 0, 0 );
265 #endif
266  KUniqueApplication::setHandleAutoStarted();
267 }
268 
269 void KWin::demandAttention( WId win, bool set )
270 {
271 #ifdef Q_WS_X11
272  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
273  info.setState( set ? NET::DemandsAttention : 0, NET::DemandsAttention );
274 #endif
275 }
276 
277 void KWin::setUserTime( WId win, long time )
278 {
279 #ifdef Q_WS_X11
280  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
281  info.setUserTime( time );
282 #endif
283 }
284 
285 KWin::WindowInfo KWin::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
286 {
287  return WindowInfo( win, properties, properties2 );
288 }
289 
290 
291 WId KWin::transientFor( WId win )
292 {
293 #ifdef Q_WS_X11
294  KXErrorHandler handler; // ignore badwindow
295  Window transient_for = None;
296  if( XGetTransientForHint( tqt_xdisplay(), win, &transient_for ))
297  return transient_for;
298  // XGetTransientForHint() did sync
299  return None;
300 #else
301  return 0L;
302 #endif
303 }
304 
305 void KWin::setMainWindow( TQWidget* subwindow, WId mainwindow )
306 {
307 #ifdef Q_WS_X11
308  if( mainwindow != 0 )
309  {
310  /*
311  Grmbl. See TQDialog::show(). That should get fixed in Qt somehow.
312  */
313  if( tqqt_cast< TQDialog* >( subwindow ) != NULL
314  && subwindow->parentWidget() == NULL
315  && kapp->mainWidget() != NULL )
316  {
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;
319  }
320  XSetTransientForHint( tqt_xdisplay(), subwindow->winId(), mainwindow );
321  }
322  else
323  XDeleteProperty( tqt_xdisplay(), subwindow->winId(), XA_WM_TRANSIENT_FOR );
324 #endif
325 }
326 
327 WId KWin::groupLeader( WId win )
328 {
329 #ifdef Q_WS_X11
330  KXErrorHandler handler; // ignore badwindow
331  XWMHints *hints = XGetWMHints( tqt_xdisplay(), win );
332  Window window_group = None;
333  if ( hints )
334  {
335  if( hints->flags & WindowGroupHint )
336  window_group = hints->window_group;
337  XFree( reinterpret_cast< char* >( hints ));
338  }
339  // XGetWMHints() did sync
340  return window_group;
341 #else
342  return 0L;
343 #endif
344 }
345 
346 // this one is deprecated, KWin::WindowInfo should be used instead
347 KWin::Info KWin::info( WId win )
348 {
349  Info w;
350 #ifdef Q_WS_X11
351  NETWinInfo inf( tqt_xdisplay(), win, tqt_xrootwin(),
352  NET::WMState |
353  NET::WMStrut |
354  NET::WMWindowType |
355  NET::WMName |
356  NET::WMVisibleName |
357  NET::WMDesktop |
358  NET::WMPid |
359  NET::WMKDEFrameStrut |
360  NET::XAWMState
361  );
362 
363  w.win = win;
364  w.state = inf.state();
365  w.mappingState = inf.mappingState();
366  w.strut = inf.strut();
367  w.windowType = inf.windowType( -1U );
368  if ( inf.name() ) {
369  w.name = TQString::fromUtf8( inf.name() );
370  } else {
371  char* c = 0;
372  if ( XFetchName( tqt_xdisplay(), win, &c ) != 0 ) {
373  w.name = TQString::fromLocal8Bit( c );
374  XFree( c );
375  }
376  }
377  if ( inf.visibleName() )
378  w.visibleName = TQString::fromUtf8( inf.visibleName() );
379  else
380  w.visibleName = w.name;
381 
382  w.desktop = inf.desktop();
383  w.onAllDesktops = inf.desktop() == NETWinInfo::OnAllDesktops;
384  w.pid = inf.pid();
385  NETRect frame, geom;
386  inf.kdeGeometry( frame, geom );
387  w.geometry.setRect( geom.pos.x, geom.pos.y, geom.size.width, geom.size.height );
388  w.frameGeometry.setRect( frame.pos.x, frame.pos.y, frame.size.width, frame.size.height );
389 #endif
390  return w;
391 }
392 
393 TQPixmap KWin::icon( WId win, int width, int height, bool scale )
394 {
395  return icon( win, width, height, scale, NETWM | WMHints | ClassHint | XApp );
396 }
397 
398 
399 TQPixmap KWin::icon( WId win, int width, int height, bool scale, int flags )
400 {
401 #ifdef Q_WS_X11
402  KXErrorHandler handler; // ignore badwindow
403 #endif
404  TQPixmap result;
405 #ifdef Q_WS_X11
406  if( flags & NETWM ) {
407  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMIcon );
408  NETIcon ni = info.icon( width, height );
409  if ( ni.data && ni.size.width > 0 && ni.size.height > 0 ) {
410  TQImage img( (uchar*) ni.data, (int) ni.size.width, (int) ni.size.height, 32, 0, 0, TQImage::IgnoreEndian );
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 );
414  if ( !img.isNull() )
415  result.convertFromImage( img );
416  return result;
417  }
418  }
419 
420  if( flags & WMHints ) {
421  Pixmap p = None;
422  Pixmap p_mask = None;
423 
424  XWMHints *hints = XGetWMHints(tqt_xdisplay(), win );
425  if (hints && (hints->flags & IconPixmapHint)){
426  p = hints->icon_pixmap;
427  }
428  if (hints && (hints->flags & IconMaskHint)){
429  p_mask = hints->icon_mask;
430  }
431  if (hints)
432  XFree((char*)hints);
433 
434  if (p != None){
435  Window root;
436  int x, y;
437  unsigned int w = 0;
438  unsigned int h = 0;
439  unsigned int border_w, depth;
440  XGetGeometry(tqt_xdisplay(), p, &root,
441  &x, &y, &w, &h, &border_w, &depth);
442  if (w > 0 && h > 0){
443  TQPixmap pm(w, h, depth);
444  // Always detach before doing something behind QPixmap's back.
445  pm.detach();
446  XCopyArea(tqt_xdisplay(), p, pm.handle(),
447  tqt_xget_temp_gc(tqt_xscreen(), depth==1),
448  0, 0, w, h, 0, 0);
449  if (p_mask != None){
450  TQBitmap bm(w, h);
451  XCopyArea(tqt_xdisplay(), p_mask, bm.handle(),
452  tqt_xget_temp_gc(tqt_xscreen(), true),
453  0, 0, w, h, 0, 0);
454  pm.setMask(bm);
455  }
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 ) );
459  } else {
460  result = pm;
461  }
462  }
463  }
464  }
465 
466  // Since width can be any arbitrary size, but the icons cannot,
467  // take the nearest value for best results (ignoring 22 pixel
468  // icons as they don't exist for apps):
469  int iconWidth;
470  if( width < 24 )
471  iconWidth = 16;
472  else if( width < 40 )
473  iconWidth = 32;
474  else
475  iconWidth = 48;
476 
477  if( flags & ClassHint ) {
478  // Try to load the icon from the classhint if the app didn't specify
479  // its own:
480  if( result.isNull() ) {
481 
482  XClassHint hint;
483  if( XGetClassHint( tqt_xdisplay(), win, &hint ) ) {
484  TQString className = hint.res_class;
485 
486  TQPixmap pm = TDEGlobal::instance()->iconLoader()->loadIcon( className.lower(), TDEIcon::Small, iconWidth,
487  TDEIcon::DefaultState, 0, true );
488  if( scale && !pm.isNull() )
489  result.convertFromImage( TQImage(pm.convertToImage()).smoothScale( width, height ) );
490  else
491  result = pm;
492 
493  XFree( hint.res_name );
494  XFree( hint.res_class );
495  }
496  }
497  }
498 
499  if( flags & XApp ) {
500  // If the icon is still a null pixmap, load the 'xapp' icon
501  // as a last resort:
502  if ( result.isNull() ) {
503  TQPixmap pm = TDEGlobal::instance()->iconLoader()->loadIcon( "xapp", TDEIcon::Small, iconWidth,
504  TDEIcon::DefaultState, 0, true );
505  if( scale && !pm.isNull() )
506  result.convertFromImage( TQImage(pm.convertToImage()).smoothScale( width, height ) );
507  else
508  result = pm;
509  }
510  }
511 #endif
512  return result;
513 }
514 
515 void KWin::setIcons( WId win, const TQPixmap& icon, const TQPixmap& miniIcon )
516 {
517 #ifdef Q_WS_X11
518  if ( icon.isNull() )
519  return;
520  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
521  TQImage img = TQImage(icon.convertToImage()).convertDepth( 32 );
522  NETIcon ni;
523  ni.size.width = img.size().width();
524  ni.size.height = img.size().height();
525  ni.data = (unsigned char *) img.bits();
526  info.setIcon( ni, true );
527  if ( miniIcon.isNull() )
528  return;
529  img = TQImage(miniIcon.convertToImage()).convertDepth( 32 );
530  ni.size.width = img.size().width();
531  ni.size.height = img.size().height();
532  ni.data = (unsigned char *) img.bits();
533  info.setIcon( ni, false );
534 #endif
535 }
536 
537 void KWin::setType( WId win, NET::WindowType windowType )
538 {
539 #ifdef Q_WS_X11
540  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
541  info.setWindowType( windowType );
542 #endif
543 }
544 
545 void KWin::setState( WId win, unsigned long state )
546 {
547 #ifdef Q_WS_X11
548  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMState );
549  info.setState( state, state );
550 #endif
551 }
552 
553 void KWin::clearState( WId win, unsigned long state )
554 {
555 #ifdef Q_WS_X11
556  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMState );
557  info.setState( 0, state );
558 #endif
559 }
560 
561 void KWin::setOpacity( WId win, uint percent )
562 {
563 #ifdef Q_WS_X11
564  twin_net_create_atoms();
565  if (percent > 99)
566  XDeleteProperty (tqt_xdisplay(), win, kde_wm_window_opacity);
567  else
568  {
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);
571  }
572 #endif
573 }
574 
575 void KWin::setShadowSize( WId win, uint percent )
576 {
577 #ifdef Q_WS_X11
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);
581 #endif
582 }
583 
584 void KWin::setOnAllDesktops( WId win, bool b )
585 {
586 #ifdef Q_WS_X11
587  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMDesktop );
588  if ( b )
589  info.setDesktop( NETWinInfo::OnAllDesktops );
590  else if ( info.desktop() == NETWinInfo::OnAllDesktops ) {
591  NETRootInfo rinfo( tqt_xdisplay(), NET::CurrentDesktop );
592  info.setDesktop( rinfo.currentDesktop() );
593  }
594 #endif
595 }
596 
597 void KWin::setOnDesktop( WId win, int desktop )
598 {
599 #ifdef Q_WS_X11
600  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), NET::WMDesktop );
601  info.setDesktop( desktop );
602 #endif
603 }
604 
605 void KWin::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
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 )
608 {
609 #ifdef Q_WS_X11
610  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
611  NETExtendedStrut strut;
612  strut.left_width = left_width;
613  strut.right_width = right_width;
614  strut.top_width = top_width;
615  strut.bottom_width = bottom_width;
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 );
625 #endif
626 }
627 
628 void KWin::setStrut( WId win, int left, int right, int top, int bottom )
629 {
630 #ifdef Q_WS_X11
631  NETWinInfo info( tqt_xdisplay(), win, tqt_xrootwin(), 0 );
632  NETStrut strut;
633  strut.left = left;
634  strut.right = right;
635  strut.top = top;
636  strut.bottom = bottom;
637  info.setStrut( strut );
638 #endif
639 }
640 
641 int KWin::currentDesktop()
642 {
643 #ifdef Q_WS_X11
644  if (!tqt_xdisplay())
645 #endif
646  return 1;
647 #ifdef Q_WS_X11
648  NETRootInfo info( tqt_xdisplay(), NET::CurrentDesktop );
649  return info.currentDesktop();
650 #endif
651 }
652 
653 int KWin::numberOfDesktops()
654 {
655 #ifdef Q_WS_X11
656  if (!tqt_xdisplay())
657 #endif
658  return 0;
659 #ifdef Q_WS_X11
660  NETRootInfo info( tqt_xdisplay(), NET::NumberOfDesktops );
661  return info.numberOfDesktops();
662 #endif
663 }
664 
665 void KWin::setCurrentDesktop( int desktop )
666 {
667 #ifdef Q_WS_X11
668  NETRootInfo info( tqt_xdisplay(), NET::CurrentDesktop );
669  info.setCurrentDesktop( desktop );
670 #endif
671 }
672 
673 void KWin::setCurrentDesktopViewport( int desktop, TQPoint viewport )
674 {
675 #ifdef Q_WS_X11
676  NETRootInfo info( tqt_xdisplay(), NET::CurrentDesktop );
677  NETPoint netview;
678  netview.x = viewport.x();
679  netview.y = viewport.y();
680  info.setDesktopViewport( desktop, netview );
681 #endif
682 }
683 
684 void KWin::iconifyWindow( WId win, bool animation)
685 {
686 #ifdef Q_WS_X11
687  if ( !animation )
688  {
689  twin_net_create_atoms();
690  sendClientMessageToRoot( win, kde_wm_change_state, IconicState, 1 );
691  }
692  XIconifyWindow( tqt_xdisplay(), win, tqt_xscreen() );
693 #endif
694 }
695 
696 
697 void KWin::deIconifyWindow( WId win, bool animation )
698 {
699 #ifdef Q_WS_X11
700  if ( !animation )
701  {
702  twin_net_create_atoms();
703  sendClientMessageToRoot( win, kde_wm_change_state, NormalState, 1 );
704  }
705  XMapWindow( tqt_xdisplay(), win );
706 #endif
707 }
708 
709 void KWin::raiseWindow( WId win )
710 {
711 #ifdef Q_WS_X11
712  NETRootInfo info( tqt_xdisplay(), NET::Supported );
713  if( info.isSupported( NET::WM2RestackWindow ))
714  info.restackRequest( win, None, Above );
715  else
716  XRaiseWindow( tqt_xdisplay(), win );
717 #endif
718 }
719 
720 void KWin::lowerWindow( WId win )
721 {
722 #ifdef Q_WS_X11
723  NETRootInfo info( tqt_xdisplay(), NET::Supported );
724  if( info.isSupported( NET::WM2RestackWindow ))
725  info.restackRequest( win, None, Below );
726  else
727  XLowerWindow( tqt_xdisplay(), win );
728 #endif
729 }
730 
731 void KWin::appStarted()
732 {
733 #ifdef Q_WS_X11
734  TDEStartupInfo::appStarted();
735 #endif
736 }
737 
738 class KWin::WindowInfoPrivate
739 {
740  public:
741  WindowInfoPrivate()
742 #ifdef Q_WS_X11
743  : info( NULL )
744 #endif
745  {}
746 #ifdef Q_WS_X11
747  ~WindowInfoPrivate() { delete info; }
748  NETWinInfo* info;
749 #endif
750  WId win_;
751  TQString name_;
752  TQString iconic_name_;
753  TQRect geometry_;
754  TQRect frame_geometry_;
755  int ref;
756  bool valid;
757  private:
758  WindowInfoPrivate( const WindowInfoPrivate& );
759  void operator=( const WindowInfoPrivate& );
760 };
761 
762 // KWin::info() should be updated too if something has to be changed here
763 KWin::WindowInfo::WindowInfo( WId win, unsigned long properties, unsigned long properties2 )
764 {
765 #ifdef Q_WS_X11
766  KXErrorHandler handler;
767  d = new WindowInfoPrivate;
768  d->ref = 1;
769  if( properties == 0 )
770  properties = NET::WMState |
771  NET::WMStrut |
772  NET::WMWindowType |
773  NET::WMName |
774  NET::WMVisibleName |
775  NET::WMIconName |
776  NET::WMVisibleIconName |
777  NET::WMDesktop |
778  NET::WMPid |
779  NET::WMKDEFrameStrut |
780  NET::XAWMState |
781  NET::WMGeometry;
782  if( properties & NET::WMVisibleIconName )
783  properties |= NET::WMIconName | NET::WMVisibleName; // force, in case it will be used as a fallback
784  if( properties & NET::WMVisibleName )
785  properties |= NET::WMName; // force, in case it will be used as a fallback
786  if( properties2 & NET::WM2ExtendedStrut )
787  properties |= NET::WMStrut; // will be used as fallback
788  properties |= NET::XAWMState; // force to get error detection for valid()
789  unsigned long props[ 2 ] = { properties, properties2 };
790  d->info = new NETWinInfo( tqt_xdisplay(), win, tqt_xrootwin(), props, 2 );
791  d->win_ = win;
792  if( properties & NET::WMName ) {
793  if( d->info->name() && d->info->name()[ 0 ] != '\0' )
794  d->name_ = TQString::fromUtf8( d->info->name() );
795  else
796  d->name_ = readNameProperty( win, XA_WM_NAME );
797  }
798  if( properties & NET::WMIconName ) {
799  if( d->info->iconName() && d->info->iconName()[ 0 ] != '\0' )
800  d->iconic_name_ = TQString::fromUtf8( d->info->iconName());
801  else
802  d->iconic_name_ = readNameProperty( win, XA_WM_ICON_NAME );
803  }
804  if( properties & ( NET::WMGeometry | NET::WMKDEFrameStrut )) {
805  NETRect frame, geom;
806  d->info->kdeGeometry( frame, geom );
807  d->geometry_.setRect( geom.pos.x, geom.pos.y, geom.size.width, geom.size.height );
808  d->frame_geometry_.setRect( frame.pos.x, frame.pos.y, frame.size.width, frame.size.height );
809  }
810  d->valid = !handler.error( false ); // no sync - NETWinInfo did roundtrips
811 #endif
812 }
813 
814 // this one is only to make TQValueList<> or similar happy
815 KWin::WindowInfo::WindowInfo()
816  : d( NULL )
817 {
818 }
819 
820 KWin::WindowInfo::~WindowInfo()
821 {
822  if( d != NULL ) {
823  if( --d->ref == 0 ) {
824  delete d;
825  }
826  }
827 }
828 
829 KWin::WindowInfo::WindowInfo( const WindowInfo& wininfo )
830  : d( wininfo.d )
831 {
832  if( d != NULL )
833  ++d->ref;
834 }
835 
836 KWin::WindowInfo& KWin::WindowInfo::operator=( const WindowInfo& wininfo )
837 {
838  if( d != wininfo.d ) {
839  if( d != NULL )
840  if( --d->ref == 0 )
841  delete d;
842  d = wininfo.d;
843  if( d != NULL )
844  ++d->ref;
845  }
846  return *this;
847 }
848 
849 bool KWin::WindowInfo::valid( bool withdrawn_is_valid ) const
850 {
851  if( !d->valid )
852  return false;
853  if( !withdrawn_is_valid && mappingState() == NET::Withdrawn )
854  return false;
855  return true;
856 }
857 
858 WId KWin::WindowInfo::win() const
859 {
860  return d->win_;
861 }
862 
863 unsigned long KWin::WindowInfo::state() const
864 {
865 #ifdef Q_WS_X11
866  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMState ) == 0, 176 )
867  << "Pass NET::WMState to KWin::windowInfo()" << endl;
868  return d->info->state();
869 #else
870  return 0;
871 #endif
872 }
873 
874 NET::MappingState KWin::WindowInfo::mappingState() const
875 {
876 #ifdef Q_WS_X11
877  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::XAWMState ) == 0, 176 )
878  << "Pass NET::XAWMState to KWin::windowInfo()" << endl;
879  return d->info->mappingState();
880 #else
881  return NET::Visible;
882 #endif
883 }
884 
885 NETExtendedStrut KWin::WindowInfo::extendedStrut() const
886 {
887 #ifdef Q_WS_X11
888  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2ExtendedStrut ) == 0, 176 )
889  << "Pass NET::WM2ExtendedStrut to second argument of KWin::windowInfo()" << endl;
890  NETExtendedStrut ext = d->info->extendedStrut();
891  NETStrut str = d->info->strut();
892  if( ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0
893  && ( str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0 )) {
894  // build extended from simple
895  if( str.left != 0 ) {
896  ext.left_width = str.left;
897  ext.left_start = 0;
898  ext.left_end = XDisplayHeight( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
899  }
900  if( str.right != 0 ) {
901  ext.right_width = str.right;
902  ext.right_start = 0;
903  ext.right_end = XDisplayHeight( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
904  }
905  if( str.top != 0 ) {
906  ext.top_width = str.top;
907  ext.top_start = 0;
908  ext.top_end = XDisplayWidth( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
909  }
910  if( str.bottom != 0 ) {
911  ext.bottom_width = str.bottom;
912  ext.bottom_start = 0;
913  ext.bottom_end = XDisplayWidth( tqt_xdisplay(), DefaultScreen( tqt_xdisplay()));
914  }
915  }
916  return ext;
917 #else
918  NETExtendedStrut n;
919  return n;
920 #endif
921 }
922 
923 NETStrut KWin::WindowInfo::strut() const
924 {
925 #ifdef Q_WS_X11
926  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMStrut ) == 0, 176 )
927  << "Pass NET::WMStrut to KWin::windowInfo()" << endl;
928  return d->info->strut();
929 #else
930  NETStrut n;
931  return n;
932 #endif
933 }
934 
935 NET::WindowType KWin::WindowInfo::windowType( int supported_types ) const
936 {
937 #ifdef Q_WS_X11
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 );
941 #else
942  return 0;
943 #endif
944 }
945 
946 TQString KWin::WindowInfo::visibleNameWithState() const
947 {
948  TQString s = visibleName();
949  if ( isMinimized() ) {
950  s.prepend('(');
951  s.append(')');
952  }
953  return s;
954 }
955 
956 TQString KWin::Info::visibleNameWithState() const
957 {
958  TQString s = visibleName;
959  if ( isMinimized() ) {
960  s.prepend('(');
961  s.append(')');
962  }
963  return s;
964 }
965 
966 TQString KWin::WindowInfo::visibleName() const
967 {
968 #ifdef Q_WS_X11
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();
973 #else
974  return TQString("name");
975 #endif
976 }
977 
978 TQString KWin::WindowInfo::name() const
979 {
980 #ifdef Q_WS_X11
981  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMName ) == 0, 176 )
982  << "Pass NET::WMName to KWin::windowInfo()" << endl;
983  return d->name_;
984 #else
985  return TQString();
986 #endif
987 }
988 
989 TQString KWin::WindowInfo::visibleIconNameWithState() const
990 {
991  TQString s = visibleIconName();
992  if ( isMinimized() ) {
993  s.prepend('(');
994  s.append(')');
995  }
996  return s;
997 }
998 
999 TQString KWin::WindowInfo::visibleIconName() const
1000 {
1001 #ifdef Q_WS_X11
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_;
1010 #endif
1011  return visibleName();
1012 }
1013 
1014 TQString KWin::WindowInfo::iconName() const
1015 {
1016 #ifdef Q_WS_X11
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_;
1023 #endif
1024  return name();
1025 }
1026 
1027 bool KWin::WindowInfo::isOnCurrentDesktop() const
1028 {
1029 #ifdef Q_WS_X11
1030  return isOnDesktop( KWin::currentDesktop());
1031 #else
1032  return false;
1033 #endif
1034 }
1035 
1036 bool KWin::WindowInfo::isOnDesktop( int desktop ) const
1037 {
1038 #ifdef Q_WS_X11
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;
1042 #else
1043  return false;
1044 #endif
1045 }
1046 
1047 bool KWin::WindowInfo::onAllDesktops() const
1048 {
1049 #ifdef Q_WS_X11
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;
1053 #else
1054  return false;
1055 #endif
1056 }
1057 
1058 int KWin::WindowInfo::desktop() const
1059 {
1060 #ifdef Q_WS_X11
1061  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMDesktop ) == 0, 176 )
1062  << "Pass NET::WMDesktop to KWin::windowInfo()" << endl;
1063  return d->info->desktop();
1064 #else
1065  return 1;
1066 #endif
1067 }
1068 
1069 TQRect KWin::WindowInfo::geometry() const
1070 {
1071 #ifdef Q_WS_X11
1072  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMGeometry ) == 0, 176 )
1073  << "Pass NET::WMGeometry to KWin::windowInfo()" << endl;
1074  return d->geometry_;
1075 #else
1076  return TQRect( 100, 100, 200, 200 );
1077 #endif
1078 }
1079 
1080 TQRect KWin::WindowInfo::frameGeometry() const
1081 {
1082 #ifdef Q_WS_X11
1083  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS ] & NET::WMKDEFrameStrut ) == 0, 176 )
1084  << "Pass NET::WMKDEFrameStrut to KWin::windowInfo()" << endl;
1085  return d->frame_geometry_;
1086 #else
1087  return TQRect();
1088 #endif
1089 }
1090 
1091 WId KWin::WindowInfo::transientFor() const
1092 {
1093 #ifdef Q_WS_X11
1094  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2TransientFor ) == 0, 176 )
1095  << "Pass NET::WM2TransientFor to KWin::windowInfo()" << endl;
1096  return d->info->transientFor();
1097 #else
1098  return 0;
1099 #endif
1100 }
1101 
1102 WId KWin::WindowInfo::groupLeader() const
1103 {
1104 #ifdef Q_WS_X11
1105  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2GroupLeader ) == 0, 176 )
1106  << "Pass NET::WM2GroupLeader to KWin::windowInfo()" << endl;
1107  return d->info->groupLeader();
1108 #else
1109  return 0;
1110 #endif
1111 }
1112 
1113 TQCString KWin::WindowInfo::windowClassClass() const
1114 {
1115 #ifdef Q_WS_X11
1116  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2WindowClass ) == 0, 176 )
1117  << "Pass NET::WM2WindowClass to KWin::windowInfo()" << endl;
1118  return d->info->windowClassClass();
1119 #else
1120  return 0;
1121 #endif
1122 }
1123 
1124 TQCString KWin::WindowInfo::windowClassName() const
1125 {
1126 #ifdef Q_WS_X11
1127  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2WindowClass ) == 0, 176 )
1128  << "Pass NET::WM2WindowClass to KWin::windowInfo()" << endl;
1129  return d->info->windowClassName();
1130 #else
1131  return 0;
1132 #endif
1133 }
1134 
1135 TQCString KWin::WindowInfo::windowRole() const
1136 {
1137 #ifdef Q_WS_X11
1138  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2WindowRole ) == 0, 176 )
1139  << "Pass NET::WM2WindowRole to KWin::windowInfo()" << endl;
1140  return d->info->windowRole();
1141 #else
1142  return 0;
1143 #endif
1144 }
1145 
1146 TQCString KWin::WindowInfo::clientMachine() const
1147 {
1148 #ifdef Q_WS_X11
1149  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2ClientMachine ) == 0, 176 )
1150  << "Pass NET::WM2ClientMachine to KWin::windowInfo()" << endl;
1151  return d->info->clientMachine();
1152 #else
1153  return 0;
1154 #endif
1155 }
1156 
1157 bool KWin::WindowInfo::actionSupported( NET::Action action ) const
1158 {
1159 #ifdef Q_WS_X11
1160  kdWarning(( d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2AllowedActions ) == 0, 176 )
1161  << "Pass NET::WM2AllowedActions to KWin::windowInfo()" << endl;
1162  if( allowedActionsSupported())
1163  return d->info->allowedActions() & action;
1164  else
1165 #endif
1166  return true; // no idea if it's supported or not -> pretend it is
1167 }
1168 
1169 // see NETWM spec section 7.6
1170 bool KWin::WindowInfo::isMinimized() const
1171 {
1172 #ifdef Q_WS_X11
1173  if( mappingState() != NET::Iconic )
1174  return false;
1175  // NETWM 1.2 compliant WM - uses NET::Hidden for minimized windows
1176  if(( state() & NET::Hidden ) != 0
1177  && ( state() & NET::Shaded ) == 0 ) // shaded may have NET::Hidden too
1178  return true;
1179  // older WMs use WithdrawnState for other virtual desktops
1180  // and IconicState only for minimized
1181  return icccmCompliantMappingState() ? false : true;
1182 #else
1183  return false;
1184 #endif
1185 }
1186 
1187 bool KWin::Info::isMinimized() const
1188 {
1189 #ifdef Q_WS_X11
1190  if( mappingState != NET::Iconic )
1191  return false;
1192  // NETWM 1.2 compliant WM - uses NET::Hidden for minimized windows
1193  if(( state & NET::Hidden ) != 0
1194  && ( state & NET::Shaded ) == 0 ) // shaded may have NET::Hidden too
1195  return true;
1196  // older WMs use WithdrawnState for other virtual desktops
1197  // and IconicState only for minimized
1198  return icccmCompliantMappingState() ? false : true;
1199 #else
1200  return false;
1201 #endif
1202 }
1203 
1204 bool KWin::Info::isIconified() const
1205 {
1206  return isMinimized();
1207 }
1208 
1209 bool KWin::icccmCompliantMappingState()
1210 {
1211 #ifdef Q_WS_X11
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 );
1215  wm_is_1_2_compliant = info.isSupported( NET::Hidden ) ? yes : no;
1216  }
1217  return wm_is_1_2_compliant == yes;
1218 #else
1219  return false;
1220 #endif
1221 }
1222 
1223 bool KWin::allowedActionsSupported()
1224 {
1225 #ifdef Q_WS_X11
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;
1230  }
1231  return wm_supports_allowed_actions == yes;
1232 #else
1233  return false;
1234 #endif
1235 }
1236 
1237 TQString KWin::readNameProperty( WId win, unsigned long atom )
1238 {
1239 #ifdef Q_WS_X11
1240  XTextProperty tp;
1241  char **text = NULL;
1242  int count;
1243 #endif
1244  TQString result;
1245 #ifdef Q_WS_X11
1246  if ( XGetTextProperty( tqt_xdisplay(), win, &tp, atom ) != 0 && tp.value != NULL )
1247  {
1248  if (!twin_UTF8_STRING)
1249  twin_UTF8_STRING = XInternAtom( tqt_xdisplay(), "UTF8_STRING", False);
1250 
1251  if ( tp.encoding == twin_UTF8_STRING ) {
1252  result = TQString::fromUtf8 ( (const char*) tp.value );
1253  }
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 );
1259  if( text != NULL )
1260  XFreeStringList( text );
1261  XFree( tp.value );
1262  }
1263 #endif
1264  return result;
1265 }
1266 
1267 //#endif
KWin::WindowInfo
Information about a window.
Definition: twin.h:522
NETIcon
Simple icon class for NET classes.
Definition: netwm_def.h:122
KWin::WindowInfo::mappingState
NET::MappingState mappingState() const
Returns the mapping state of the window (see NET::MappingState).
Definition: twin.cpp:874
KWin::iconifyWindow
static void iconifyWindow(WId win, bool animation=true)
Iconifies a window.
Definition: twin.cpp:684
NETStrut
Definition: netwm_def.h:195
KXErrorHandler::error
bool error(bool sync) const
This function returns true if the error flag is set (i.e.
NETStrut::bottom
int bottom
Bottom border of the strut.
Definition: netwm_def.h:219
KWin::lowerWindow
static void lowerWindow(WId win)
Lowers the given window.
Definition: twin.cpp:720
TDEIcon::DefaultState
The default state.
Definition: kicontheme.h:130
KWin::WindowInfo::strut
NETStrut strut() const
Definition: twin.cpp:923
NETExtendedStrut::bottom_width
int bottom_width
Bottom border of the strut, width and range.
Definition: netwm_def.h:179
NETIcon::data
unsigned char * data
Image data for the icon.
Definition: netwm_def.h:140
TDEInstance::iconLoader
TDEIconLoader * iconLoader() const
Returns an iconloader object.
Definition: kinstance.cpp:274
KWin::WindowInfo::name
TQString name() const
Returns the name of the window, as specified by the application, without any modifications.
Definition: twin.cpp:978
KWin::invokeContextHelp
static void invokeContextHelp()
Invokes interactive context help.
Definition: twin.cpp:214
NETStrut::right
int right
Right border of the strut.
Definition: netwm_def.h:209
NETPoint::y
int y
y coordinate
Definition: netwm_def.h:53
KWin::WindowInfo::valid
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)...
Definition: twin.cpp:849
KWin::WindowInfo::windowClassName
TQCString windowClassName() const
Returns the name component of the window class for the window (i.e.
Definition: twin.cpp:1124
KWin::Info::geometry
TQRect geometry
Position and size of the window contents.
Definition: twin.h:494
DCOPRef
KWin::WindowInfo::iconName
TQString iconName() const
Returns the name of the window that should be shown in taskbar and all other "iconic" representations...
Definition: twin.cpp:1014
KWin::setActiveWindow
static void setActiveWindow(WId win) KDE_DEPRECATED
Definition: twin.cpp:260
NET::WM2WindowClass
Definition: netwm_def.h:609
KWin::WindowInfo::geometry
TQRect geometry() const
Returns the position and size of the window contents.
Definition: twin.cpp:1069
NETExtendedStrut
Partial strut class for NET classes.
Definition: netwm_def.h:153
KWin::Info::windowType
NET::WindowType windowType
The window type.
Definition: twin.h:482
KWin::WindowInfo::extendedStrut
NETExtendedStrut extendedStrut() const
Returns the window extended (partial) strut.
Definition: twin.cpp:885
KWin::demandAttention
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...
Definition: twin.cpp:269
KWin::WindowInfo::transientFor
WId transientFor() const
Returns the WM_TRANSIENT_FOR property for the window, i.e.
Definition: twin.cpp:1091
NETStrut::left
int left
Left border of the strut.
Definition: netwm_def.h:204
KWin::WindowInfo::isOnDesktop
bool isOnDesktop(int desktop) const
Returns true if the window is on the given virtual desktop.
Definition: twin.cpp:1036
NET::Hidden
Definition: netwm_def.h:400
KWin::readNameProperty
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...
Definition: twin.cpp:1237
DCOPRef::send
bool send(const TQCString &fun)
NET::MappingState
MappingState
Client window mapping state.
Definition: netwm_def.h:464
KWin::Info::isMinimized
bool isMinimized() const
The mapping state.
Definition: twin.cpp:1187
KWin::setType
static void setType(WId win, NET::WindowType windowType)
Sets the type of window win to windowType.
Definition: twin.cpp:537
KWin::setShadowSize
static void setShadowSize(WId win, uint percent)
Sets the shadowsize of window win to percetage percent.
Definition: twin.cpp:575
NETRect::size
NETSize size
Size of the rectangle.
Definition: netwm_def.h:107
NET::WM2WindowRole
Definition: netwm_def.h:610
KWin::WindowInfo::state
unsigned long state() const
Returns the window's state flags (see the NET::State enum for details).
Definition: twin.cpp:863
KWin::WindowInfo::win
WId win() const
Returns the window identifier.
Definition: twin.cpp:858
NET::WindowType
WindowType
Window type.
Definition: netwm_def.h:294
tdelocale.h
NETPoint::x
int x
x coordinate.
Definition: netwm_def.h:53
KWin::appStarted
static void appStarted() KDE_DEPRECATED
Definition: twin.cpp:731
NETIcon::size
NETSize size
Size of the icon.
Definition: netwm_def.h:133
KWin::Info::visibleName
TQString visibleName
The visible name of the window.
Definition: twin.h:484
KWin::forceActiveWindow
static void forceActiveWindow(WId win, long time=0)
Sets window win to be the active window.
Definition: twin.cpp:249
KWin::Info::name
TQString name
The name of the window.
Definition: twin.h:486
KWin::Info::onAllDesktops
bool onAllDesktops
true if the window is on all desktops.
Definition: twin.h:490
TDEGlobal::instance
static TDEInstance * instance()
Returns the global instance.
Definition: tdeglobal.cpp:102
KWin::Info::win
WId win
The window's id.
Definition: twin.h:472
KWin::Info::pid
pid_t pid
The process id of the window's owner.
Definition: twin.h:492
KWin::Info::strut
NETStrut strut
The strut.
Definition: twin.h:480
KWin::deIconifyWindow
static void deIconifyWindow(WId win, bool animation=true)
DeIconifies a window.
Definition: twin.cpp:697
NETRect::pos
NETPoint pos
Position of the rectangle.
Definition: netwm_def.h:100
KWin::setStrut
static void setStrut(WId win, int left, int right, int top, int bottom)
Definition: twin.cpp:628
KWin::Info::state
long unsigned int state
The window's state.
Definition: twin.h:474
NETPoint
Simple point class for NET classes.
Definition: netwm_def.h:44
KXErrorHandler
This class simplifies handling of X errors.
Definition: kxerrorhandler.h:57
KWin::allowedActionsSupported
static bool allowedActionsSupported()
Returns true if the WM announces which actions it allows for windows.
Definition: twin.cpp:1223
KWin::setSystemTrayWindowFor
static void setSystemTrayWindowFor(WId trayWin, WId forWin)
Makes trayWin a system tray window for forWin.
Definition: twin.cpp:221
KWin::info
static Info info(WId win) KDE_DEPRECATED
Definition: twin.cpp:347
KWin::numberOfDesktops
static int numberOfDesktops()
Convenience function to access the number of desktops.
Definition: twin.cpp:653
KWin::ClassHint
load icon after getting name from the classhint
Definition: twin.h:233
TDEIconLoader::loadIcon
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.
Definition: kiconloader.cpp:583
KWin::WindowInfo::onAllDesktops
bool onAllDesktops() const
Returns true if the window is on all desktops (equal to desktop()==NET::OnAllDesktops).
Definition: twin.cpp:1047
NETExtendedStrut::top_width
int top_width
Top border of the strut, width and range.
Definition: netwm_def.h:174
KWin::setCurrentDesktop
static void setCurrentDesktop(int desktop)
Convenience function to set the current desktop to desktop.
Definition: twin.cpp:665
KWin::compositingActive
static bool compositingActive()
Returns true if a compositing manager is running (i.e.
Definition: twin.cpp:146
TDEIcon::Small
Small icons.
Definition: kicontheme.h:100
KWin::WindowInfo::visibleIconName
TQString visibleIconName() const
Returns the visible name of the window that should be shown in taskbar and all other "iconic" represe...
Definition: twin.cpp:999
KWin::clearState
static void clearState(WId win, unsigned long state)
Clears the state of window win from state.
Definition: twin.cpp:553
KWin::WindowInfo::windowClassClass
TQCString windowClassClass() const
Returns the class component of the window class for the window (i.e.
Definition: twin.cpp:1113
KWin::Info
Definition: twin.h:469
KWin::WindowInfo::clientMachine
TQCString clientMachine() const
Returns the client machine for the window (i.e.
Definition: twin.cpp:1146
NETRect
Simple rectangle class for NET classes.
Definition: netwm_def.h:94
KWin::setOnAllDesktops
static void setOnAllDesktops(WId win, bool b)
Sets window win to be present on all virtual desktops if is true.
Definition: twin.cpp:584
KWin::currentDesktop
static int currentDesktop()
Convenience function to access the current desktop.
Definition: twin.cpp:641
KWin::groupLeader
static WId groupLeader(WId window)
Returns the leader window for the group the given window is in, if any.
Definition: twin.cpp:327
KWin::WindowInfo::visibleNameWithState
TQString visibleNameWithState() const
Returns a visible name with state.
Definition: twin.cpp:946
KWin::WindowInfo::frameGeometry
TQRect frameGeometry() const
Returns the frame geometry of the window, i.e.
Definition: twin.cpp:1080
KWin::WindowInfo::windowType
NET::WindowType windowType(int supported_types) const
Returns the window type of this window (see NET::WindowType).
Definition: twin.cpp:935
KWin::WindowInfo::isOnCurrentDesktop
bool isOnCurrentDesktop() const
Returns true if the window is on the currently active virtual desktop.
Definition: twin.cpp:1027
KWin::XApp
load the standard X icon (last fallback)
Definition: twin.h:234
KWin::transientFor
static WId transientFor(WId window)
Returns the WM_TRANSIENT_FOR property for the given window, i.e.
Definition: twin.cpp:291
KWin::activateWindow
static void activateWindow(WId win, long time=0)
Requests that window win is activated.
Definition: twin.cpp:237
NET::DemandsAttention
Definition: netwm_def.h:403
KWin::WindowInfo::visibleName
TQString visibleName() const
Returns the visible name of the window (i.e.
Definition: twin.cpp:966
KWin::WMHints
read from WMHints property
Definition: twin.h:232
KWin::setCurrentDesktopViewport
static void setCurrentDesktopViewport(int desktop, TQPoint viewport)
Convenience function to set the current viewport to viewport.
Definition: twin.cpp:673
NETSize::width
int width
Width.
Definition: netwm_def.h:80
KWin::WindowInfo::desktop
int desktop() const
Returns the virtual desktop this window is on (NET::OnAllDesktops if the window is on all desktops)...
Definition: twin.cpp:1058
KWin::setUserTime
static void setUserTime(WId win, long time)
Sets user timestamp time on window win.
Definition: twin.cpp:277
NETExtendedStrut::right_width
int right_width
Right border of the strut, width and range.
Definition: netwm_def.h:169
KWin::windowInfo
static WindowInfo windowInfo(WId win, unsigned long properties=0, unsigned long properties2=0)
Returns information about window win.
Definition: twin.cpp:285
KWin::WindowInfo::isMinimized
bool isMinimized() const
Returns true if the window is minimized.
Definition: twin.cpp:1170
KWin::setOpacity
static void setOpacity(WId win, uint percent)
Sets the opacity of window win to percetage percent.
Definition: twin.cpp:561
KWin::setMainWindow
static void setMainWindow(TQWidget *subwindow, WId mainwindow)
Sets the parent window of subwindow to be mainwindow.
Definition: twin.cpp:305
NET::Action
Action
Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
Definition: netwm_def.h:474
KWin::WindowInfo::groupLeader
WId groupLeader() const
Returns the leader window for the group the window is in, if any.
Definition: twin.cpp:1102
NETSize::height
int height
Height.
Definition: netwm_def.h:80
NETExtendedStrut::left_width
int left_width
Left border of the strut, width and range.
Definition: netwm_def.h:164
endl
kndbgstream & endl(kndbgstream &s)
Does nothing.
Definition: kdebug.h:583
KWin::WindowInfo::actionSupported
bool actionSupported(NET::Action action) const
Returns true if the given action is currently supported for the window by the window manager...
Definition: twin.cpp:1157
KWin::WindowInfo::visibleIconNameWithState
TQString visibleIconNameWithState() const
Returns a visible name with state.
Definition: twin.cpp:989
KWin::setOnDesktop
static void setOnDesktop(WId win, int desktop)
Moves window win to desktop desktop.
Definition: twin.cpp:597
KWin::raiseWindow
static void raiseWindow(WId win)
Raises the given window.
Definition: twin.cpp:709
KWin::setExtendedStrut
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...
Definition: twin.cpp:605
KWin::NETWM
read from property from the window manager specification
Definition: twin.h:231
KWin::icon
static TQPixmap icon(WId win, int width=-1, int height=-1, bool scale=false)
Returns an icon for window win.
Definition: twin.cpp:393
NETStrut::top
int top
Top border of the strut.
Definition: netwm_def.h:214
KWin::setIcons
static void setIcons(WId win, const TQPixmap &icon, const TQPixmap &miniIcon)
Sets an icon and a miniIcon on window win.
Definition: twin.cpp:515
KWin::WindowInfo::windowRole
TQCString windowRole() const
Returns the window role for the window (i.e.
Definition: twin.cpp:1135
KWin::setState
static void setState(WId win, unsigned long state)
Sets the state of window win to state.
Definition: twin.cpp:545
NET::WM2ClientMachine
Definition: netwm_def.h:611
KWin::WindowInfo::WindowInfo
WindowInfo(WId window, unsigned long properties, unsigned long properties2)
Reads all the info about the given window.
Definition: twin.cpp:763
KWin::Info::desktop
int desktop
The number of the window's desktop.
Definition: twin.h:488
KWin::Info::frameGeometry
TQRect frameGeometry
Position and size of the window's frame.
Definition: twin.h:496

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.