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