From ad771450f3fe9c170d8cef42147e444f2f7aaea8 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 5 Apr 2023 22:08:38 +0300 Subject: TWin: Active borders and snap tiling This commit is a squash of the commits of TDE/tdebase#331. In short, this backports some improvements to existing electric border functionality from KDE, adds the snap tiling (or aerosnap) feature and brings rudimentary support for active corners, which will be fully implemented in a later PR. The options dialog and the documentation has been updated to reflect these changes. Additionally, a new relevant option is introduced: an option for restoring the original size of maximized/tiled windows when the user starts dragging them. The option is set to be off by default, preserving the traditional behaviour of KDE 3.x/TDE. Last but not least, the term "electric" in relation to borders and corners is replaced by "active" for clarity to the users. Signed-off-by: Mavridis Philippe (cherry picked from commit 31335a04ed9bc01fd3ede33afde40d6f3359f2e9) --- twin/workspace.h | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'twin/workspace.h') diff --git a/twin/workspace.h b/twin/workspace.h index e88e68c85..3a724a4a2 100644 --- a/twin/workspace.h +++ b/twin/workspace.h @@ -156,7 +156,10 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void clientHidden( Client* ); void clientAttentionChanged( Client* c, bool set ); - void clientMoved(const TQPoint &pos, Time time); + void checkActiveBorder(const TQPoint &pos, Time time); + void reserveActiveBorder(ActiveBorder border); + void unreserveActiveBorder(ActiveBorder border); + void reserveActiveBorderSwitching(bool reserve); /** * Returns the current virtual desktop of this workspace @@ -302,7 +305,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void requestDelayFocus( Client* ); void updateFocusMousePosition( const TQPoint& pos ); TQPoint focusMousePosition() const; - + void toggleTopDockShadows(bool on); public slots: @@ -406,6 +409,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void cleanupTemporaryRules(); void writeWindowRules(); void kipcMessage( int id, int data ); + void updateActiveBorders(); // kompmgr void setPopupClientOpacity(int v); void resetClientOpacity(); @@ -486,12 +490,10 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin 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(); + // active borders + void destroyActiveBorders(); + bool activeBorderEvent(XEvent *e); + void activeBorderSwitchDesktop(ActiveBorder border, const TQPoint& pos); // ------------------ @@ -617,19 +619,17 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin 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; + ActiveBorder active_current_border; + Window active_windows[ ACTIVE_BORDER_COUNT ]; + int activeLeft; + int activeRight; + int activeTop; + int activeBottom; + Time active_time_first; + Time active_time_last; + Time active_time_last_trigger; + TQPoint active_push_point; + int active_reserved[ ACTIVE_BORDER_COUNT ]; // corners/edges used by something Qt::Orientation layoutOrientation; int layoutX; @@ -663,7 +663,11 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin int maximizedWindowCounter; int topDockShadowSize;*/ //end - + + Window outline_left; + Window outline_right; + Window outline_top; + Window outline_bottom; signals: void kompmgrStarted(); void kompmgrStopped(); -- cgit v1.2.1