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