Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions src/ShellClients/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
private GestureController gesture_controller;
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, anchor: anchor, window: window, position: Position.from_anchor (anchor));
}
Expand All @@ -53,6 +50,8 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {

window.size_changed.connect (update_strut);
window.position_changed.connect (update_strut);
notify["width"].connect (update_strut);
notify["height"].connect (update_strut);

gesture_controller = new GestureController (DOCK, wm);
add_gesture_controller (gesture_controller);
Expand All @@ -62,32 +61,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
hide_tracker.show.connect (show);
}

public Mtk.Rectangle get_custom_window_rect () {
var window_rect = window.get_frame_rect ();

if (width > 0) {
window_rect.width = width;
}

if (height > 0) {
window_rect.height = height;

if (anchor == BOTTOM) {
var geom = wm.get_display ().get_monitor_geometry (window.get_monitor ());
window_rect.y = geom.y + geom.height - height;
}
}

return window_rect;
}

public void set_size (int width, int height) {
this.width = width;
this.height = height;

update_strut ();
}

private void hide () {
gesture_controller.goto (1);
}
Expand Down
27 changes: 27 additions & 0 deletions src/ShellClients/PositionedWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class Gala.PositionedWindow : Object {
public Position position { get; construct set; }
public Variant? position_data { get; construct set; }

private int width = -1;
private int height = -1;

private ulong position_changed_id;

public PositionedWindow (Meta.Window window, Position position, Variant? position_data = null) {
Expand All @@ -50,6 +53,30 @@ public class Gala.PositionedWindow : Object {
notify["position-data"].connect (position_window);
}

public Mtk.Rectangle get_custom_window_rect () {
var window_rect = window.get_frame_rect ();

if (width > 0) {
window_rect.width = width;
}

if (height > 0) {
window_rect.height = height;

if (position == BOTTOM) {
var geom = window.display.get_monitor_geometry (window.get_monitor ());
window_rect.y = geom.y + geom.height - height;
}
}

return window_rect;
}

public void set_size (int width, int height) {
this.width = width;
this.height = height;
}

private void position_window () {
int x = 0, y = 0;
var window_rect = window.get_frame_rect ();
Expand Down
8 changes: 5 additions & 3 deletions src/ShellClients/ShellWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
window_actor.notify["translation-y"].connect (update_clip);
notify["position"].connect (update_clip);

window_actor.notify["height"].connect (update_target);
window.size_changed.connect (update_target);
notify["position"].connect (update_target);
update_target ();
}
Expand Down Expand Up @@ -136,11 +136,13 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
}

private Value calculate_value (bool hidden) {
var custom_rect = get_custom_window_rect ();

switch (position) {
case TOP:
return hidden ? -window_actor.height : 0f;
return hidden ? -custom_rect.height : 0f;
case BOTTOM:
return hidden ? window_actor.height : 0f;
return hidden ? custom_rect.height : 0f;
default:
return hidden ? 0u : 255u;
}
Expand Down