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

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.9.4
This website is maintained by Timothy Pearson.