-
-
Notifications
You must be signed in to change notification settings - Fork 77
Move panel hiding to the shell clients #2239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d5c733e
Introduce a ShellWindow
leolost2605 7af83ee
Rm PanelClone, rename Windowpositionr, derive panelwindow from shellw…
leolost2605 645712b
MultitaskingView: Use ShellClients state for panel hiding
leolost2605 575e120
Cleanup
leolost2605 113b91c
Remove hidden, state is enough
leolost2605 3bf2ed2
Cleanup and handle fullscreen
leolost2605 6c10485
Merge branch 'main' into leolost/shell-window
leolost2605 a8b2a06
Add with_gesture for now
leolost2605 cd9ceac
Fix no callback
leolost2605 20539f1
Fix X passthrough
leolost2605 985ac0a
Cleanup
leolost2605 7466e71
Don't update transients that are positioned itselfs (e.g. log out dia…
leolost2605 e9916b0
Make invisible once hidden
leolost2605 40050c4
Remove remnant and fix hide inconsistencies
leolost2605 c8b4c77
Merge branch 'main' into leolost/shell-window
lenemter 698558a
Don't ignore new state while gesture is ongoing
leolost2605 0029878
Merge branch 'main' into leolost/shell-window
leolost2605 3fb6436
Merge branch 'main' into leolost/shell-window
lenemter d7df5c0
Merge branch 'main' into leolost/shell-window
leolost2605 e5e24c9
Remove SafeWindowClone
leolost2605 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,22 +5,44 @@ | |
| * Authored by: Leonhard Kargl <[email protected]> | ||
| */ | ||
|
|
||
| public class Gala.PanelWindow : Object { | ||
| public class Gala.PanelWindow : ShellWindow { | ||
| private const int ANIMATION_DURATION = 250; | ||
|
|
||
| private static HashTable<Meta.Window, Meta.Strut?> window_struts = new HashTable<Meta.Window, Meta.Strut?> (null, null); | ||
|
|
||
| public WindowManager wm { get; construct; } | ||
| public Meta.Window window { get; construct; } | ||
| public Pantheon.Desktop.Anchor anchor { get; construct set; } | ||
|
|
||
| private WindowPositioner window_positioner; | ||
| public Pantheon.Desktop.HideMode hide_mode { | ||
| get { | ||
| return hide_tracker == null ? Pantheon.Desktop.HideMode.NEVER : hide_tracker.hide_mode; | ||
| } | ||
| set { | ||
| if (value == NEVER) { | ||
| hide_tracker = null; | ||
| show (); | ||
| make_exclusive (); | ||
| return; | ||
| } else if (hide_tracker == null) { | ||
| unmake_exclusive (); | ||
|
|
||
| hide_tracker = new HideTracker (wm.get_display (), this); | ||
| hide_tracker.hide.connect (hide); | ||
| hide_tracker.show.connect (show); | ||
| } | ||
|
|
||
| hide_tracker.hide_mode = value; | ||
| } | ||
| } | ||
|
|
||
| private PanelClone clone; | ||
| private GestureTracker default_gesture_tracker; | ||
| private HideTracker? hide_tracker; | ||
|
|
||
| private int width = -1; | ||
| private int height = -1; | ||
|
|
||
| public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) { | ||
| Object (wm: wm, window: window, anchor: anchor); | ||
| Object (wm: wm, anchor: anchor, window: window, position: Position.from_anchor (anchor)); | ||
| } | ||
|
|
||
| construct { | ||
|
|
@@ -30,22 +52,34 @@ public class Gala.PanelWindow : Object { | |
| } | ||
| }); | ||
|
|
||
| window.stick (); | ||
|
|
||
| clone = new PanelClone (wm, this); | ||
|
|
||
| unowned var display = wm.get_display (); | ||
|
|
||
| window_positioner = new WindowPositioner (display, window, WindowPositioner.Position.from_anchor (anchor)); | ||
|
|
||
| notify["anchor"].connect (() => window_positioner.position = WindowPositioner.Position.from_anchor (anchor)); | ||
| notify["anchor"].connect (() => position = Position.from_anchor (anchor)); | ||
|
|
||
| unowned var workspace_manager = display.get_workspace_manager (); | ||
| unowned var workspace_manager = window.display.get_workspace_manager (); | ||
| workspace_manager.workspace_added.connect (update_strut); | ||
| workspace_manager.workspace_removed.connect (update_strut); | ||
|
|
||
| window.size_changed.connect (update_strut); | ||
| window.position_changed.connect (update_strut); | ||
|
|
||
| default_gesture_tracker = new GestureTracker (ANIMATION_DURATION, ANIMATION_DURATION); | ||
|
|
||
| notify["hidden"].connect (() => { | ||
| // When hidden changes schedule an update to make sure it's actually | ||
| // correct since things might have changed during the animation | ||
| if (hide_tracker != null) { | ||
| hide_tracker.schedule_update (); | ||
| } | ||
| }); | ||
|
|
||
| window.display.in_fullscreen_changed.connect (() => { | ||
| if (wm.get_display ().get_monitor_in_fullscreen (window.get_monitor ())) { | ||
| hide (); | ||
| } else if (hide_mode == NEVER) { | ||
| show (); | ||
| } else { | ||
| hide_tracker.update_overlap (); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| #if HAS_MUTTER45 | ||
|
|
@@ -78,22 +112,24 @@ public class Gala.PanelWindow : Object { | |
| update_strut (); | ||
| } | ||
|
|
||
| public void set_hide_mode (Pantheon.Desktop.HideMode hide_mode) { | ||
| clone.hide_mode = hide_mode; | ||
| private void hide () { | ||
| add_state (CUSTOM_HIDDEN, default_gesture_tracker, false); | ||
| } | ||
|
|
||
| if (hide_mode == NEVER) { | ||
| make_exclusive (); | ||
| } else { | ||
| unmake_exclusive (); | ||
| private void show () { | ||
| if (window.display.get_monitor_in_fullscreen (window.get_monitor ())) { | ||
| return; | ||
| } | ||
|
|
||
| remove_state (CUSTOM_HIDDEN, default_gesture_tracker, false); | ||
| } | ||
|
|
||
| private void make_exclusive () { | ||
| update_strut (); | ||
| } | ||
|
|
||
| private void update_strut () { | ||
| if (clone.hide_mode != NEVER) { | ||
| if (hide_mode != NEVER) { | ||
| return; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| * Authored by: Leonhard Kargl <[email protected]> | ||
| */ | ||
|
|
||
| public class Gala.WindowPositioner : Object { | ||
| public class Gala.PositionedWindow : Object { | ||
| public enum Position { | ||
| TOP, | ||
| BOTTOM, | ||
|
|
@@ -21,7 +21,6 @@ public class Gala.WindowPositioner : Object { | |
| } | ||
| } | ||
|
|
||
| public Meta.Display display { get; construct; } | ||
| public Meta.Window window { get; construct; } | ||
| /** | ||
| * This may only be set after the window was shown. | ||
|
|
@@ -30,8 +29,8 @@ public class Gala.WindowPositioner : Object { | |
| public Position position { get; construct set; } | ||
| public Variant? position_data { get; construct set; } | ||
|
|
||
| public WindowPositioner (Meta.Display display, Meta.Window window, Position position, Variant? position_data = null) { | ||
| Object (display: display, window: window, position: position, position_data: position_data); | ||
| public PositionedWindow (Meta.Window window, Position position, Variant? position_data = null) { | ||
| Object (window: window, position: position, position_data: position_data); | ||
| } | ||
|
|
||
| construct { | ||
|
|
@@ -41,7 +40,7 @@ public class Gala.WindowPositioner : Object { | |
| window.position_changed.connect (position_window); | ||
| window.shown.connect (position_window); | ||
|
|
||
| unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager (); | ||
| unowned var monitor_manager = window.display.get_context ().get_backend ().get_monitor_manager (); | ||
| monitor_manager.monitors_changed.connect (position_window); | ||
| monitor_manager.monitors_changed_internal.connect (position_window); | ||
|
|
||
|
|
@@ -51,8 +50,8 @@ public class Gala.WindowPositioner : Object { | |
|
|
||
| private void position_window () { | ||
| int x = 0, y = 0; | ||
|
|
||
| var window_rect = window.get_frame_rect (); | ||
| unowned var display = window.display; | ||
|
|
||
| switch (position) { | ||
| case CENTER: | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.