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

kwin

  • kwin
workspace.h
1 /*****************************************************************
2  KWin - the KDE window manager
3  This file is part of the KDE project.
4 
5 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7 
8 You can Freely distribute this program under the GNU General Public
9 License. See the file "COPYING" for the exact licensing terms.
10 ******************************************************************/
11 
12 #ifndef KWIN_WORKSPACE_H
13 #define KWIN_WORKSPACE_H
14 
15 #include <tqtimer.h>
16 #include <tqvaluevector.h>
17 #include <kshortcut.h>
18 #include <tqcursor.h>
19 #include <netwm.h>
20 #include <kxmessages.h>
21 
22 #include "KWinInterface.h"
23 #include "utils.h"
24 #include "kdecoration.h"
25 #include "sm.h"
26 
27 #include <X11/Xlib.h>
28 
29 class TQPopupMenu;
30 class KConfig;
31 class KGlobalAccel;
32 class KShortcutDialog;
33 class KStartupInfo;
34 class KStartupInfoId;
35 class KStartupInfoData;
36 class TQSlider;
37 class TQPushButton;
38 class KProcess;
39 
40 namespace KWinInternal
41 {
42 
43 class Client;
44 class TabBox;
45 class PopupInfo;
46 class RootInfo;
47 class PluginMgr;
48 class Placement;
49 class Rules;
50 class WindowRules;
51 
52 class SystemTrayWindow
53  {
54  public:
55  SystemTrayWindow()
56  : win(0),winFor(0)
57  {}
58  SystemTrayWindow( WId w )
59  : win(w),winFor(0)
60  {}
61  SystemTrayWindow( WId w, WId wf )
62  : win(w),winFor(wf)
63  {}
64 
65  bool operator==( const SystemTrayWindow& other )
66  { return win == other.win; }
67  WId win;
68  WId winFor;
69  };
70 
71 typedef TQValueList<SystemTrayWindow> SystemTrayWindowList;
72 
73 class Workspace : public TQObject, public KWinInterface, public KDecorationDefines
74  {
75  Q_OBJECT
76  public:
77  Workspace( bool restore = FALSE );
78  virtual ~Workspace();
79 
80  static Workspace * self() { return _self; }
81 
82  bool workspaceEvent( XEvent * );
83 
84  KDecoration* createDecoration( KDecorationBridge* bridge );
85 
86  bool hasClient( const Client * );
87 
88  template< typename T > Client* findClient( T predicate );
89  template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate );
90  template< typename T > void forEachClient( T procedure );
91 
92  TQRect clientArea( clientAreaOption, const TQPoint& p, int desktop ) const;
93  TQRect clientArea( clientAreaOption, const Client* c ) const;
94  TQRect clientArea( clientAreaOption, int screen, int desktop ) const;
95 
99  void killWindowId( Window window);
100 
101  void killWindow() { slotKillWindow(); }
102 
103  WId rootWin() const;
104 
105  bool initializing() const;
106 
111  Client* activeClient() const;
112  // Client that was activated, but it's not yet really activeClient(), because
113  // we didn't process yet the matching FocusIn event. Used mostly in focus
114  // stealing prevention code.
115  Client* mostRecentlyActivatedClient() const;
116 
117  void activateClient( Client*, bool force = FALSE );
118  void requestFocus( Client* c, bool force = FALSE );
119  void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags
120  void handleTakeActivity( Client* c, Time timestamp, int flags ); // flags are ActivityFlags
121  bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false );
122  void restoreFocus();
123  void gotFocusIn( const Client* );
124  void setShouldGetFocus( Client* );
125  bool fakeRequestedActivity( Client* c );
126  void unfakeActivity( Client* c );
127  bool activateNextClient( Client* c );
128  bool focusChangeEnabled() { return block_focus == 0; }
129 
130  void updateColormap();
131 
135  void setClientIsMoving( Client *c );
136 
137  void place( Client *c, TQRect& area );
138  void placeSmart( Client* c, const TQRect& area );
139 
140  TQPoint adjustClientPosition( Client* c, TQPoint pos );
141  TQRect adjustClientSize( Client* c, TQRect moveResizeGeom, int mode );
142  void raiseClient( Client* c );
143  void lowerClient( Client* c );
144  void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp );
145  void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
146  void restackClientUnderActive( Client* );
147  void updateClientLayer( Client* c );
148  void raiseOrLowerClient( Client * );
149  void reconfigure();
150 
151  void clientHidden( Client* );
152  void clientAttentionChanged( Client* c, bool set );
153 
154  void clientMoved(const TQPoint &pos, Time time);
155 
159  int currentDesktop() const;
163  int numberOfDesktops() const;
164  void setNumberOfDesktops( int n );
165 
166  int activeScreen() const;
167  int numScreens() const;
168  void checkActiveScreen( const Client* c );
169  void setActiveScreenMouse( TQPoint mousepos );
170  TQRect screenGeometry( int screen ) const;
171  int screenNumber( TQPoint pos ) const;
172 
173  TQWidget* desktopWidget();
174 
175  // for TabBox
176  Client* nextFocusChainClient(Client*) const;
177  Client* previousFocusChainClient(Client*) const;
178  Client* nextStaticClient(Client*) const;
179  Client* previousStaticClient(Client*) const;
180  int nextDesktopFocusChain( int iDesktop ) const;
181  int previousDesktopFocusChain( int iDesktop ) const;
182  void closeTabBox();
183 
188  const ClientList& stackingOrder() const;
189 
190  ClientList ensureStackingOrder( const ClientList& clients ) const;
191 
192  Client* topClientOnDesktop( int desktop, bool unconstrained = false, bool only_normal = true ) const;
193  Client* findDesktop( bool topmost, int desktop ) const;
194  void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
195  void windowToPreviousDesktop( Client* c );
196  void windowToNextDesktop( Client* c );
197  void sendClientToScreen( Client* c, int screen );
198 
199  // KDE4 remove me - and it's also in the DCOP interface :(
200  void showWindowMenuAt( unsigned long id, int x, int y );
201  void kDestopResized();
202 
207  void showWindowMenu( const TQRect &pos, Client* cl );
211  void showWindowMenu( int x, int y, Client* cl );
212  void showWindowMenu( TQPoint pos, Client* cl );
213 
214  void updateMinimizedOfTransients( Client* );
215  void updateOnAllDesktopsOfTransients( Client* );
216  void checkTransients( Window w );
217 
218  void performWindowOperation( Client* c, WindowOperation op );
219 
220  void storeSession( KConfig* config, SMSavePhase phase );
221 
222  SessionInfo* takeSessionInfo( Client* );
223  WindowRules findWindowRules( const Client*, bool );
224  void rulesUpdated();
225  void discardUsedWindowRules( Client* c, bool withdraw );
226  void disableRulesUpdates( bool disable );
227  bool rulesUpdatesDisabled() const;
228 
229  // dcop interface
230  void cascadeDesktop();
231  void unclutterDesktop();
232  void doNotManage(TQString);
233  bool setCurrentDesktop( int new_desktop );
234  void updateOverlappingShadows(WId window);
235  void setShadowed(WId window, bool shadowed);
236  void nextDesktop();
237  void previousDesktop();
238  void circulateDesktopApplications();
239  void setCurrentScreen( int new_screen );
240 
241  TQString desktopName( int desk ) const;
242  virtual void setDesktopLayout(int , int , int );
243  void updateDesktopLayout();
244  void setShowingDesktop( bool showing );
245  void resetShowingDesktop( bool keep_hidden );
246  bool showingDesktop() const;
247 
248  bool isNotManaged( const TQString& title ); // ### setter or getter ?
249 
250  void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow()
251  void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity()
252 
253  bool kompmgrIsRunning();
254  void setOpacity(unsigned long winId, unsigned int opacityPercent);
255  void setShadowSize(unsigned long winId, unsigned int shadowSizePercent);
256  void setUnshadowed(unsigned long winId); // redundant, equals setShadowSize(inId, 0)
257 
258  // only called from Client::destroyClient() or Client::releaseWindow()
259  void removeClient( Client*, allowed_t );
260  void setActiveClient( Client*, allowed_t );
261  Group* findGroup( Window leader ) const;
262  void addGroup( Group* group, allowed_t );
263  void removeGroup( Group* group, allowed_t );
264  Group* findClientLeaderGroup( const Client* c ) const;
265 
266  bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
267 
268  void focusToNull(); // SELI public?
269  enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate };
270  void updateFocusChains( Client* c, FocusChainChange change );
271 
272  bool forcedGlobalMouseGrab() const;
273  void clientShortcutUpdated( Client* c );
274  bool shortcutAvailable( const KShortcut& cut, Client* ignore = NULL ) const;
275  bool globalShortcutsDisabled() const;
276  void disableGlobalShortcuts( bool disable );
277  void disableGlobalShortcutsForClient( bool disable );
278 
279  void sessionSaveStarted();
280  void sessionSaveDone();
281  void setWasUserInteraction();
282  bool wasUserInteraction() const;
283  bool sessionSaving() const;
284 
285  bool managingTopMenus() const;
286  int topMenuHeight() const;
287  void updateCurrentTopMenu();
288 
289  int packPositionLeft( const Client* cl, int oldx, bool left_edge ) const;
290  int packPositionRight( const Client* cl, int oldx, bool right_edge ) const;
291  int packPositionUp( const Client* cl, int oldy, bool top_edge ) const;
292  int packPositionDown( const Client* cl, int oldy, bool bottom_edge ) const;
293 
294  static TQStringList configModules(bool controlCenter);
295 
296  void cancelDelayFocus();
297  void requestDelayFocus( Client* );
298  void updateFocusMousePosition( const TQPoint& pos );
299  TQPoint focusMousePosition() const;
300 
301  void toggleTopDockShadows(bool on);
302 
303  public slots:
304  void refresh();
305  // keybindings
306  void slotSwitchDesktopNext();
307  void slotSwitchDesktopPrevious();
308  void slotSwitchDesktopRight();
309  void slotSwitchDesktopLeft();
310  void slotSwitchDesktopUp();
311  void slotSwitchDesktopDown();
312 
313  void slotSwitchToDesktop( int );
314  //void slotSwitchToWindow( int );
315  void slotWindowToDesktop( int );
316  //void slotWindowToListPosition( int );
317  void slotSwitchToScreen( int );
318  void slotWindowToScreen( int );
319  void slotSwitchToNextScreen();
320  void slotWindowToNextScreen();
321 
322  void slotWindowMaximize();
323  void slotWindowMaximizeVertical();
324  void slotWindowMaximizeHorizontal();
325  void slotWindowMinimize();
326  void slotWindowShade();
327  void slotWindowRaise();
328  void slotWindowLower();
329  void slotWindowRaiseOrLower();
330  void slotActivateAttentionWindow();
331  void slotWindowPackLeft();
332  void slotWindowPackRight();
333  void slotWindowPackUp();
334  void slotWindowPackDown();
335  void slotWindowGrowHorizontal();
336  void slotWindowGrowVertical();
337  void slotWindowShrinkHorizontal();
338  void slotWindowShrinkVertical();
339 
340  void slotWalkThroughDesktops();
341  void slotWalkBackThroughDesktops();
342  void slotWalkThroughDesktopList();
343  void slotWalkBackThroughDesktopList();
344  void slotWalkThroughWindows();
345  void slotWalkBackThroughWindows();
346 
347  void slotWindowOperations();
348  void slotWindowClose();
349  void slotWindowMove();
350  void slotWindowResize();
351  void slotWindowAbove();
352  void slotWindowBelow();
353  void slotWindowOnAllDesktops();
354  void slotWindowFullScreen();
355  void slotWindowNoBorder();
356 
357  void slotWindowToNextDesktop();
358  void slotWindowToPreviousDesktop();
359  void slotWindowToDesktopRight();
360  void slotWindowToDesktopLeft();
361  void slotWindowToDesktopUp();
362  void slotWindowToDesktopDown();
363 
364  void slotMouseEmulation();
365  void slotDisableGlobalShortcuts();
366 
367  void slotSettingsChanged( int category );
368 
369  void slotReconfigure();
370 
371  void slotKillWindow();
372 
373  void slotGrabWindow();
374  void slotGrabDesktop();
375 
376  void slotSetupWindowShortcut();
377  void setupWindowShortcutDone( bool );
378 
379  void updateClientArea();
380 
381  // kompmgr, also dcop
382  void startKompmgr();
383 
384  private slots:
385  void desktopPopupAboutToShow();
386  void clientPopupAboutToShow();
387  void slotSendToDesktop( int );
388  void clientPopupActivated( int );
389  void configureWM();
390  void desktopResized();
391  void slotUpdateToolWindows();
392  void lostTopMenuSelection();
393  void lostTopMenuOwner();
394  void delayFocus();
395  void gotTemporaryRulesMessage( const TQString& );
396  void cleanupTemporaryRules();
397  void writeWindowRules();
398  void kipcMessage( int id, int data );
399  // kompmgr
400  void setPopupClientOpacity(int v);
401  void resetClientOpacity();
402  void setTransButtonText(int value);
403  void unblockKompmgrRestart();
404  void restartKompmgr( KProcess *proc );
405  void handleKompmgrOutput( KProcess *proc, char *buffer, int buflen);
406  void stopKompmgr();
407  // end
408 
409  protected:
410  bool keyPressMouseEmulation( XKeyEvent& ev );
411 
412  private:
413  void init();
414  void initShortcuts();
415  void readShortcuts();
416  void initDesktopPopup();
417  void setupWindowShortcut( Client* c );
418 
419  bool startKDEWalkThroughWindows();
420  bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
421  bool startWalkThroughDesktops();
422  bool startWalkThroughDesktopList();
423  void KDEWalkThroughWindows( bool forward );
424  void CDEWalkThroughWindows( bool forward );
425  void walkThroughDesktops( bool forward );
426  void KDEOneStepThroughWindows( bool forward );
427  void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
428  void oneStepThroughDesktops( bool forward );
429  void oneStepThroughDesktopList( bool forward );
430  bool establishTabBoxGrab();
431  void removeTabBoxGrab();
432  int desktopToRight( int desktop ) const;
433  int desktopToLeft( int desktop ) const;
434  int desktopUp( int desktop ) const;
435  int desktopDown( int desktop ) const;
436 
437  void updateStackingOrder( bool propagate_new_clients = false );
438  void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
439  ClientList constrainedStackingOrder();
440  void raiseClientWithinApplication( Client* c );
441  void lowerClientWithinApplication( Client* c );
442  bool allowFullClientRaising( const Client* c, Time timestamp );
443  bool keepTransientAbove( const Client* mainwindow, const Client* transient );
444  void blockStackingUpdates( bool block );
445  void addTopMenu( Client* c );
446  void removeTopMenu( Client* c );
447  void setupTopMenuHandling();
448  void updateTopMenuGeometry( Client* c = NULL );
449  void updateToolWindows( bool also_hide );
450 
451  // this is the right way to create a new client
452  Client* createClient( Window w, bool is_mapped );
453  void addClient( Client* c, allowed_t );
454 
455  Window findSpecialEventWindow( XEvent* e );
456 
457  void randomPlacement(Client* c);
458  void smartPlacement(Client* c);
459  void cascadePlacement(Client* c, bool re_init = false);
460 
461  bool addSystemTrayWin( WId w );
462  bool removeSystemTrayWin( WId w, bool check );
463  void propagateSystemTrayWins();
464  SystemTrayWindow findSystemTrayWin( WId w );
465 
466  // desktop names and number of desktops
467  void loadDesktopSettings();
468  void saveDesktopSettings();
469 
470  // mouse emulation
471  WId getMouseEmulationWindow();
472  enum MouseEmulation { EmuPress, EmuRelease, EmuMove };
473  unsigned int sendFakedMouseEvent( TQPoint pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state
474 
475  void tabBoxKeyPress( const KKeyNative& keyX );
476  void tabBoxKeyRelease( const XKeyEvent& ev );
477 
478  // electric borders
479  void checkElectricBorders( bool force = false );
480  void createBorderWindows();
481  void destroyBorderWindows();
482  bool electricBorder(XEvent * e);
483  void raiseElectricBorders();
484 
485  // ------------------
486 
487  void helperDialog( const TQString& message, const Client* c );
488 
489  void calcDesktopLayout(int &x, int &y) const;
490 
491  TQPopupMenu* clientPopup();
492  void closeActivePopup();
493 
494  void updateClientArea( bool force );
495 
496  SystemTrayWindowList systemTrayWins;
497 
498  int current_desktop;
499  int number_of_desktops;
500  TQMemArray<int> desktop_focus_chain;
501  int active_screen;
502 
503  TQWidget* active_popup;
504  Client* active_popup_client;
505 
506  TQWidget* desktop_widget;
507 
508  void loadSessionInfo();
509  void loadWindowRules();
510  void editWindowRules( Client* c, bool whole_app );
511 
512  TQPtrList<SessionInfo> session;
513  TQValueList<Rules*> rules;
514  KXMessages temporaryRulesMessages;
515  TQTimer rulesUpdatedTimer;
516  bool rules_updates_disabled;
517  static const char* windowTypeToTxt( NET::WindowType type );
518  static NET::WindowType txtToWindowType( const char* txt );
519  static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
520 
521  Client* active_client;
522  Client* last_active_client;
523  Client* next_active_client; // will be active after active_client deactivates
524  Client* most_recently_raised; // used _only_ by raiseOrLowerClient()
525  Client* movingClient;
526  Client* pending_take_activity;
527 
528  // delay(ed) window focus timer and client
529  TQTimer* delayFocusTimer;
530  Client* delayfocus_client;
531  TQPoint focusMousePos;
532 
533  ClientList clients;
534  ClientList desktops;
535 
536  ClientList unconstrained_stacking_order; // topmost last
537  ClientList stacking_order; // topmost last
538  TQValueVector< ClientList > focus_chain; // currently active last
539  ClientList global_focus_chain; // this one is only for things like tabbox's MRU
540  ClientList should_get_focus; // last is most recent
541  ClientList attention_chain;
542 
543  bool showing_desktop;
544  ClientList showing_desktop_clients;
545  int block_showing_desktop;
546 
547  GroupList groups;
548 
549  bool was_user_interaction;
550  bool session_saving;
551  int session_active_client;
552  int session_desktop;
553 
554  bool control_grab;
555  bool tab_grab;
556  //KKeyNative walkThroughDesktopsKeycode, walkBackThroughDesktopsKeycode;
557  //KKeyNative walkThroughDesktopListKeycode, walkBackThroughDesktopListKeycode;
558  //KKeyNative walkThroughWindowsKeycode, walkBackThroughWindowsKeycode;
559  KShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse;
560  KShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse;
561  KShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse;
562  bool mouse_emulation;
563  unsigned int mouse_emulation_state;
564  WId mouse_emulation_window;
565  int block_focus;
566 
567  TabBox* tab_box;
568  PopupInfo* popupinfo;
569 
570  TQPopupMenu *popup;
571  TQPopupMenu *advanced_popup;
572  TQPopupMenu *desk_popup;
573  int desk_popup_index;
574 
575  KGlobalAccel *keys;
576  KGlobalAccel *client_keys;
577  ShortcutDialog* client_keys_dialog;
578  Client* client_keys_client;
579  KGlobalAccel *disable_shortcuts_keys;
580  bool global_shortcuts_disabled;
581  bool global_shortcuts_disabled_for_client;
582 
583  WId root;
584 
585  PluginMgr *mgr;
586 
587  RootInfo *rootInfo;
588  TQWidget* supportWindow;
589 
590  // swallowing
591  TQStringList doNotManageList;
592 
593  // colormap handling
594  Colormap default_colormap;
595  Colormap installed_colormap;
596 
597  // Timer to collect requests for 'reconfigure'
598  TQTimer reconfigureTimer;
599 
600  TQTimer updateToolWindowsTimer;
601 
602  static Workspace *_self;
603 
604  bool workspaceInit;
605 
606  KStartupInfo* startup;
607 
608  bool electric_have_borders;
609  int electric_current_border;
610  WId electric_top_border;
611  WId electric_bottom_border;
612  WId electric_left_border;
613  WId electric_right_border;
614  int electricLeft;
615  int electricRight;
616  int electricTop;
617  int electricBottom;
618  Time electric_time_first;
619  Time electric_time_last;
620  TQPoint electric_push_point;
621 
622  Qt::Orientation layoutOrientation;
623  int layoutX;
624  int layoutY;
625 
626  Placement *initPositioning;
627 
628  TQRect* workarea; // array of workareas for virtual desktops
629  TQRect** screenarea; // array of workareas per xinerama screen for all virtual desktops
630 
631  bool managing_topmenus;
632  KSelectionOwner* topmenu_selection;
633  KSelectionWatcher* topmenu_watcher;
634  ClientList topmenus; // doesn't own them
635  mutable int topmenu_height;
636  TQWidget* topmenu_space;
637 
638  int set_active_client_recursion;
639  int block_stacking_updates; // when >0, stacking updates are temporarily disabled
640  bool blocked_propagating_new_clients; // propagate also new clients after enabling stacking updates?
641  Window null_focus_window;
642  bool forced_global_mouse_grab;
643  friend class StackingUpdatesBlocker;
644 
645  //kompmgr
646  TQSlider *transSlider;
647  TQPushButton *transButton;
648  // not used yet
649  /*Client* topDock;
650  int maximizedWindowCounter;
651  int topDockShadowSize;*/
652  //end
653 
654  signals:
655  void kompmgrStarted();
656  void kompmgrStopped();
657 
658  private:
659  friend bool performTransiencyCheck();
660  };
661 
662 // helper for Workspace::blockStackingUpdates() being called in pairs (true/false)
663 class StackingUpdatesBlocker
664  {
665  public:
666  StackingUpdatesBlocker( Workspace* w )
667  : ws( w ) { ws->blockStackingUpdates( true ); }
668  ~StackingUpdatesBlocker()
669  { ws->blockStackingUpdates( false ); }
670  private:
671  Workspace* ws;
672  };
673 
674 // NET WM Protocol handler class
675 class RootInfo : public NETRootInfo4
676  {
677  private:
678  typedef KWinInternal::Client Client; // because of NET::Client
679  public:
680  RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr= -1);
681  protected:
682  virtual void changeNumberOfDesktops(int n);
683  virtual void changeCurrentDesktop(int d);
684 // virtual void changeActiveWindow(Window w); the extended version is used
685  virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
686  virtual void closeWindow(Window w);
687  virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
688  virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
689  virtual void gotPing(Window w, Time timestamp);
690  virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
691  virtual void gotTakeActivity(Window w, Time timestamp, long flags );
692  virtual void changeShowingDesktop( bool showing );
693  private:
694  Workspace* workspace;
695  };
696 
697 
698 inline WId Workspace::rootWin() const
699  {
700  return root;
701  }
702 
703 inline bool Workspace::initializing() const
704  {
705  return workspaceInit;
706  }
707 
708 inline Client* Workspace::activeClient() const
709  {
710  // next_active_client is a kludge for drop shadows. If a window that is
711  // activated is not also raised (i.e. when focus follows mouse), then the
712  // newly activated window and its shadow won't cover visual artifacts that
713  // might exist in the inactive window's shadow. We work around this by
714  // (re)drawing the inactive window's shadow after the active window's shadow
715  // is drawn, but to do that the inactive window needs to know which window
716  // will become active next. next_active_client is a Client pointer for that
717  // purpose.
718  return next_active_client != NULL ? next_active_client : active_client;
719  }
720 
721 inline Client* Workspace::mostRecentlyActivatedClient() const
722  {
723  return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
724  }
725 
726 inline int Workspace::currentDesktop() const
727  {
728  return current_desktop;
729  }
730 
731 inline int Workspace::numberOfDesktops() const
732  {
733  return number_of_desktops;
734  }
735 
736 inline void Workspace::addGroup( Group* group, allowed_t )
737  {
738  groups.append( group );
739  }
740 
741 inline void Workspace::removeGroup( Group* group, allowed_t )
742  {
743  groups.remove( group );
744  }
745 
746 inline const ClientList& Workspace::stackingOrder() const
747  {
748 // TODO Q_ASSERT( block_stacking_updates == 0 );
749  return stacking_order;
750  }
751 
752 inline void Workspace::showWindowMenu(TQPoint pos, Client* cl)
753  {
754  showWindowMenu(TQRect(pos, pos), cl);
755  }
756 
757 inline void Workspace::showWindowMenu(int x, int y, Client* cl)
758  {
759  showWindowMenu(TQRect(TQPoint(x, y), TQPoint(x, y)), cl);
760  }
761 
762 inline
763 void Workspace::setWasUserInteraction()
764  {
765  was_user_interaction = true;
766  }
767 
768 inline
769 bool Workspace::wasUserInteraction() const
770  {
771  return was_user_interaction;
772  }
773 
774 inline
775 bool Workspace::managingTopMenus() const
776  {
777  return managing_topmenus;
778  }
779 
780 inline void Workspace::sessionSaveStarted()
781  {
782  session_saving = true;
783  }
784 
785 inline void Workspace::sessionSaveDone()
786  {
787  session_saving = false;
788  }
789 
790 inline bool Workspace::sessionSaving() const
791  {
792  return session_saving;
793  }
794 
795 inline bool Workspace::forcedGlobalMouseGrab() const
796  {
797  return forced_global_mouse_grab;
798  }
799 
800 inline bool Workspace::showingDesktop() const
801  {
802  return showing_desktop;
803  }
804 
805 inline bool Workspace::globalShortcutsDisabled() const
806  {
807  return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
808  }
809 
810 inline
811 bool Workspace::rulesUpdatesDisabled() const
812  {
813  return rules_updates_disabled;
814  }
815 
816 inline
817 void Workspace::updateFocusMousePosition( const TQPoint& pos )
818  {
819  focusMousePos = pos;
820  }
821 
822 inline
823 TQPoint Workspace::focusMousePosition() const
824  {
825  return focusMousePos;
826  }
827 
828 template< typename T >
829 inline Client* Workspace::findClient( T predicate )
830  {
831  if( Client* ret = findClientInList( clients, predicate ))
832  return ret;
833  if( Client* ret = findClientInList( desktops, predicate ))
834  return ret;
835  return NULL;
836  }
837 
838 template< typename T1, typename T2 >
839 inline void Workspace::forEachClient( T1 procedure, T2 predicate )
840  {
841  for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
842  if ( predicate( const_cast< const Client* >( *it)))
843  procedure( *it );
844  for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
845  if ( predicate( const_cast< const Client* >( *it)))
846  procedure( *it );
847  }
848 
849 template< typename T >
850 inline void Workspace::forEachClient( T procedure )
851  {
852  return forEachClient( procedure, TruePredicate());
853  }
854 
855 KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
856 inline bool Workspace::hasClient( const Client* c )
857  {
858  return findClient( ClientMatchPredicate( c ));
859  }
860 
861 } // namespace
862 
863 #endif

kwin

Skip menu "kwin"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kwin

Skip menu "kwin"
  • kate
  • kwin
  •   lib
  • libkonq
Generated for kwin by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |