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

twin

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

twin

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

twin

Skip menu "twin"
  • kate
  • libkonq
  • twin
  •   lib
Generated for twin by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.