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