• 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 // kompmgr
419 void setPopupClientOpacity(int v);
420 void resetClientOpacity();
421 void setTransButtonText(int value);
422 void unblockKompmgrRestart();
423 void restartKompmgr( TDEProcess *proc );
424 void handleKompmgrOutput( TDEProcess *proc, char *buffer, int buflen);
425 void stopKompmgr();
426 void kompmgrReloadSettings();
427 // end
428
429 protected:
430 bool keyPressMouseEmulation( XKeyEvent& ev );
431
432 private:
433 void init();
434 void initShortcuts();
435 void readShortcuts();
436 void initDesktopPopup();
437 void setupWindowShortcut( Client* c );
438
439 bool startKDEWalkThroughWindows();
440 bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
441 bool startWalkThroughDesktops();
442 bool startWalkThroughDesktopList();
443 void KDEWalkThroughWindows( bool forward );
444 void CDEWalkThroughWindows( bool forward );
445 void walkThroughDesktops( bool forward );
446 void KDEOneStepThroughWindows( bool forward );
447 void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
448 void oneStepThroughDesktops( bool forward );
449 void oneStepThroughDesktopList( bool forward );
450 bool establishTabBoxGrab();
451 void removeTabBoxGrab();
452 int desktopToRight( int desktop ) const;
453 int desktopToLeft( int desktop ) const;
454 int desktopUp( int desktop ) const;
455 int desktopDown( int desktop ) const;
456
457 void updateStackingOrder( bool propagate_new_clients = false );
458 void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
459 ClientList constrainedStackingOrder();
460 void raiseClientWithinApplication( Client* c );
461 void lowerClientWithinApplication( Client* c );
462 bool allowFullClientRaising( const Client* c, Time timestamp );
463 bool keepTransientAbove( const Client* mainwindow, const Client* transient );
464 void blockStackingUpdates( bool block );
465 void addTopMenu( Client* c );
466 void removeTopMenu( Client* c );
467 void setupTopMenuHandling();
468 void updateTopMenuGeometry( Client* c = NULL );
469 void updateToolWindows( bool also_hide );
470
471 // this is the right way to create a new client
472 Client* createClient( Window w, bool is_mapped );
473 void addClient( Client* c, allowed_t );
474
475 Window findSpecialEventWindow( XEvent* e );
476
477 void randomPlacement(Client* c);
478 void smartPlacement(Client* c);
479 void cascadePlacement(Client* c, bool re_init = false);
480
481 bool addSystemTrayWin( WId w );
482 bool removeSystemTrayWin( WId w, bool check );
483 void propagateSystemTrayWins();
484 SystemTrayWindow findSystemTrayWin( WId w );
485
486 // desktop names and number of desktops
487 void loadDesktopSettings();
488 void saveDesktopSettings();
489
490 // mouse emulation
491 WId getMouseEmulationWindow();
492 enum MouseEmulation { EmuPress, EmuRelease, EmuMove };
493 unsigned int sendFakedMouseEvent( TQPoint pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state
494
495 void tabBoxKeyPress( const KKeyNative& keyX );
496 void tabBoxKeyRelease( const XKeyEvent& ev );
497
498 // active borders
499 void destroyActiveBorders();
500 bool activeBorderEvent(XEvent *e);
501 void activeBorderSwitchDesktop(ActiveBorder border, const TQPoint& pos);
502
503 // ------------------
504
505 void helperDialog( const TQString& message, const Client* c );
506
507 void calcDesktopLayout(int &x, int &y) const;
508
509 TQPopupMenu* clientPopup();
510 void closeActivePopup();
511
512 void updateClientArea( bool force );
513
514 SystemTrayWindowList systemTrayWins;
515
516 int current_desktop;
517 int number_of_desktops;
518 TQMemArray<int> desktop_focus_chain;
519 int active_screen;
520
521 TQWidget* active_popup;
522 Client* active_popup_client;
523
524 TQWidget* desktop_widget;
525
526 void loadSessionInfo();
527 void loadWindowRules();
528 void editWindowRules( Client* c, bool whole_app );
529
530 TQPtrList<SessionInfo> session;
531 TQValueList<Rules*> rules;
532 KXMessages temporaryRulesMessages;
533 TQTimer rulesUpdatedTimer;
534 bool rules_updates_disabled;
535 static const char* windowTypeToTxt( NET::WindowType type );
536 static NET::WindowType txtToWindowType( const char* txt );
537 static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
538
539 Client* active_client;
540 Client* last_active_client;
541 Client* next_active_client; // will be active after active_client deactivates
542 Client* most_recently_raised; // used _only_ by raiseOrLowerClient()
543 Client* movingClient;
544 Client* pending_take_activity;
545
546 // delay(ed) window focus timer and client
547 TQTimer* delayFocusTimer;
548 Client* delayfocus_client;
549 TQPoint focusMousePos;
550
551 ClientList clients;
552 ClientList desktops;
553
554 ClientList unconstrained_stacking_order; // topmost last
555 ClientList stacking_order; // topmost last
556 TQValueVector< ClientList > focus_chain; // currently active last
557 ClientList global_focus_chain; // this one is only for things like tabbox's MRU
558 ClientList should_get_focus; // last is most recent
559 ClientList attention_chain;
560
561 bool showing_desktop;
562 ClientList showing_desktop_clients;
563 int block_showing_desktop;
564
565 GroupList groups;
566
567 bool was_user_interaction;
568 bool session_saving;
569 int session_active_client;
570 int session_desktop;
571
572 bool control_grab;
573 bool tab_grab;
574 //KKeyNative walkThroughDesktopsKeycode, walkBackThroughDesktopsKeycode;
575 //KKeyNative walkThroughDesktopListKeycode, walkBackThroughDesktopListKeycode;
576 //KKeyNative walkThroughWindowsKeycode, walkBackThroughWindowsKeycode;
577 TDEShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse;
578 TDEShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse;
579 TDEShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse;
580 TDEShortcut cutWalkThroughApps, cutWalkThroughAppsReverse;
581 bool mouse_emulation;
582 unsigned int mouse_emulation_state;
583 WId mouse_emulation_window;
584 int block_focus;
585
586 TabBox* tab_box;
587 PopupInfo* popupinfo;
588
589 TQPopupMenu *popup;
590 TQPopupMenu *advanced_popup;
591 TQPopupMenu *desk_popup;
592 int desk_popup_index;
593
594 TDEGlobalAccel *keys;
595 TDEGlobalAccel *client_keys;
596 ShortcutDialog* client_keys_dialog;
597 Client* client_keys_client;
598 TDEGlobalAccel *disable_shortcuts_keys;
599 bool global_shortcuts_disabled;
600 bool global_shortcuts_disabled_for_client;
601
602 WId root;
603
604 PluginMgr *mgr;
605
606 RootInfo *rootInfo;
607 TQWidget* supportWindow;
608
609 // swallowing
610 TQStringList doNotManageList;
611
612 // colormap handling
613 Colormap default_colormap;
614 Colormap installed_colormap;
615
616 // Timer to collect requests for 'reconfigure'
617 TQTimer reconfigureTimer;
618
619 TQTimer updateToolWindowsTimer;
620
621 static Workspace *_self;
622
623 bool workspaceInit;
624
625 TDEStartupInfo* startup;
626
627 ActiveBorder active_current_border;
628 Window active_windows[ ACTIVE_BORDER_COUNT ];
629 int activeLeft;
630 int activeRight;
631 int activeTop;
632 int activeBottom;
633 Time active_time_first;
634 Time active_time_last;
635 Time active_time_last_trigger;
636 TQPoint active_push_point;
637 int active_reserved[ ACTIVE_BORDER_COUNT ]; // corners/edges used by something
638
639 TQt::Orientation layoutOrientation;
640 int layoutX;
641 int layoutY;
642
643 Placement *initPositioning;
644
645 TQRect* workarea; // array of workareas for virtual desktops
646 TQRect** screenarea; // array of workareas per xinerama screen for all virtual desktops
647
648 bool managing_topmenus;
649 TDESelectionOwner* topmenu_selection;
650 TDESelectionWatcher* topmenu_watcher;
651 ClientList topmenus; // doesn't own them
652 mutable int topmenu_height;
653 TQWidget* topmenu_space;
654
655 int set_active_client_recursion;
656 int block_stacking_updates; // when >0, stacking updates are temporarily disabled
657 bool blocked_propagating_new_clients; // propagate also new clients after enabling stacking updates?
658 Window null_focus_window;
659 bool forced_global_mouse_grab;
660 friend class StackingUpdatesBlocker;
661 friend class Client;
662
663 //kompmgr
664 TQSlider *transSlider;
665 TQPushButton *transButton;
666 // not used yet
667 /*Client* topDock;
668 int maximizedWindowCounter;
669 int topDockShadowSize;*/
670 //end
671
672 Window outline_left;
673 Window outline_right;
674 Window outline_top;
675 Window outline_bottom;
676 signals:
677 void kompmgrStarted();
678 void kompmgrStopped();
679
680 private:
681 friend bool performTransiencyCheck();
682 };
683
684// helper for Workspace::blockStackingUpdates() being called in pairs (true/false)
685class StackingUpdatesBlocker
686 {
687 public:
688 StackingUpdatesBlocker( Workspace* w )
689 : ws( w ) { ws->blockStackingUpdates( true ); }
690 ~StackingUpdatesBlocker()
691 { ws->blockStackingUpdates( false ); }
692 private:
693 Workspace* ws;
694 };
695
696// NET WM Protocol handler class
697class RootInfo : public NETRootInfo4
698 {
699 private:
700 typedef KWinInternal::Client Client; // because of NET::Client
701 public:
702 RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr= -1);
703 protected:
704 virtual void changeNumberOfDesktops(int n);
705 virtual void changeCurrentDesktop(int d);
706// virtual void changeActiveWindow(Window w); the extended version is used
707 virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
708 virtual void closeWindow(Window w);
709 virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
710 virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
711 virtual void gotPing(Window w, Time timestamp);
712 virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
713 virtual void gotTakeActivity(Window w, Time timestamp, long flags );
714 virtual void changeShowingDesktop( bool showing );
715 private:
716 Workspace* workspace;
717 };
718
719
720inline WId Workspace::rootWin() const
721 {
722 return root;
723 }
724
725inline bool Workspace::initializing() const
726 {
727 return workspaceInit;
728 }
729
730inline Client* Workspace::activeClient() const
731 {
732 // next_active_client is a kludge for drop shadows. If a window that is
733 // activated is not also raised (i.e. when focus follows mouse), then the
734 // newly activated window and its shadow won't cover visual artifacts that
735 // might exist in the inactive window's shadow. We work around this by
736 // (re)drawing the inactive window's shadow after the active window's shadow
737 // is drawn, but to do that the inactive window needs to know which window
738 // will become active next. next_active_client is a Client pointer for that
739 // purpose.
740 return next_active_client != NULL ? next_active_client : active_client;
741 }
742
743inline Client* Workspace::mostRecentlyActivatedClient() const
744 {
745 return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
746 }
747
748inline int Workspace::currentDesktop() const
749 {
750 return current_desktop;
751 }
752
753inline int Workspace::numberOfDesktops() const
754 {
755 return number_of_desktops;
756 }
757
758inline void Workspace::addGroup( Group* group, allowed_t )
759 {
760 groups.append( group );
761 }
762
763inline void Workspace::removeGroup( Group* group, allowed_t )
764 {
765 groups.remove( group );
766 }
767
768inline const ClientList& Workspace::stackingOrder() const
769 {
770// TODO Q_ASSERT( block_stacking_updates == 0 );
771 return stacking_order;
772 }
773
774inline void Workspace::showWindowMenu(TQPoint pos, Client* cl)
775 {
776 showWindowMenu(TQRect(pos, pos), cl);
777 }
778
779inline void Workspace::showWindowMenu(int x, int y, Client* cl)
780 {
781 showWindowMenu(TQRect(TQPoint(x, y), TQPoint(x, y)), cl);
782 }
783
784inline
785void Workspace::setWasUserInteraction()
786 {
787 was_user_interaction = true;
788 }
789
790inline
791bool Workspace::wasUserInteraction() const
792 {
793 return was_user_interaction;
794 }
795
796inline
797bool Workspace::managingTopMenus() const
798 {
799 return managing_topmenus;
800 }
801
802inline void Workspace::sessionSaveStarted()
803 {
804 session_saving = true;
805 }
806
807inline void Workspace::sessionSaveDone()
808 {
809 session_saving = false;
810 }
811
812inline bool Workspace::sessionSaving() const
813 {
814 return session_saving;
815 }
816
817inline bool Workspace::forcedGlobalMouseGrab() const
818 {
819 return forced_global_mouse_grab;
820 }
821
822inline bool Workspace::showingDesktop() const
823 {
824 return showing_desktop;
825 }
826
827inline bool Workspace::globalShortcutsDisabled() const
828 {
829 return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
830 }
831
832inline
833bool Workspace::rulesUpdatesDisabled() const
834 {
835 return rules_updates_disabled;
836 }
837
838inline
839void Workspace::updateFocusMousePosition( const TQPoint& pos )
840 {
841 focusMousePos = pos;
842 }
843
844inline
845TQPoint Workspace::focusMousePosition() const
846 {
847 return focusMousePos;
848 }
849
850template< typename T >
851inline Client* Workspace::findClient( T predicate )
852 {
853 if( Client* ret = findClientInList( clients, predicate ))
854 return ret;
855 if( Client* ret = findClientInList( desktops, predicate ))
856 return ret;
857 return NULL;
858 }
859
860template< typename T1, typename T2 >
861inline void Workspace::forEachClient( T1 procedure, T2 predicate )
862 {
863 for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
864 if ( predicate( const_cast< const Client* >( *it)))
865 procedure( *it );
866 for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
867 if ( predicate( const_cast< const Client* >( *it)))
868 procedure( *it );
869 }
870
871template< typename T >
872inline void Workspace::forEachClient( T procedure )
873 {
874 return forEachClient( procedure, TruePredicate());
875 }
876
877KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
878inline bool Workspace::hasClient( const Client* c )
879 {
880 return findClient( ClientMatchPredicate( c ));
881 }
882
883} // namespace
884
885#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.8
This website is maintained by Timothy Pearson.