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
34 changes: 34 additions & 0 deletions protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@
Tell the shell that the panel would like to be visible in the multitasking view.
</description>
</request>

<request name="add_blur">
<description summary="add blur">
Tell the window manager to add background blur.
</description>

<arg name="left" type="uint"/>
<arg name="right" type="uint"/>
<arg name="top" type="uint"/>
<arg name="bottom" type="uint"/>
<arg name="clip_radius" type="uint"/>
</request>

<request name="remove_blur">
<description summary="remove blur">
Tell the window manager to remove blur that was set in set_blur_region.
</description>
</request>
</interface>

<interface name="io_elementary_pantheon_widget_v1" version="1">
Expand All @@ -117,5 +135,21 @@
Tell the shell to keep the surface above on all workspaces
</description>
</request>

<request name="make_centered">
<description summary="requests to keep the surface centered">
Request to keep the surface centered. This will cause keyboard focus
to not be granted automatically but having to be requested via focus.
</description>
</request>

<request name="focus">
<description summary="request keyboard focus">
Request keyboard focus, taking it away from any other window.
Keyboard focus must always be manually be requested and is
- in contrast to normal windows - never automatically granted
by the compositor.
</description>
</request>
</interface>
</protocol>
2 changes: 2 additions & 0 deletions protocol/pantheon-desktop-shell.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ namespace Pantheon.Desktop {
public void set_size (int width, int height);
public void set_hide_mode (Pantheon.Desktop.HideMode hide_mode);
public void request_visible_in_multitasking_view ();
public void add_blur (uint left, uint right, uint top, uint bottom, uint clip_radius);
public void remove_blur ();
}

[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_widget_v1", cprefix = "io_elementary_pantheon_widget_v1_")]
Expand Down
28 changes: 27 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {

// Matches top margin in Launcher.css
private const int TOP_MARGIN = 64;
private const int BORDER_RADIUS = 9;

private Settings transparency_settings;
private static Settings settings = new Settings ("io.elementary.dock");
Expand All @@ -28,6 +29,8 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
private Gtk.Box main_box;

private WindowDragManager window_drag_manager;
private BottomMargin bottom_margin;
private bool initialized_blur = false;

class construct {
set_css_name ("dock-window");
Expand All @@ -50,9 +53,11 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
size_group.add_widget (overlay.child);
size_group.add_widget (launcher_manager);

bottom_margin = new BottomMargin ();

main_box = new Gtk.Box (VERTICAL, 0);
main_box.append (overlay);
main_box.append (new BottomMargin ());
main_box.append (bottom_margin);
child = main_box;

remove_css_class ("background");
Expand Down Expand Up @@ -131,6 +136,21 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
item_manager_width,
surface.height - top_margin
}));

if (initialized_blur) {
return;
}

Graphene.Rect bounds;
bottom_margin.compute_bounds (bottom_margin, out bounds);

initialized_blur = true;

if (panel != null) {
panel.add_blur (0, 0, 0, (int) bounds.get_height (), BORDER_RADIUS);
} else {
update_panel_x11 ();
}
});

registry_listener.global = registry_handle_global;
Expand Down Expand Up @@ -162,6 +182,12 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {

var value = "anchor=8:hide-mode=%d:restore-previous-region=1:visible-in-multitasking-view=1".printf (settings.get_enum ("autohide-mode"));

if (initialized_blur) {
Graphene.Rect bounds;
bottom_margin.compute_bounds (bottom_margin, out bounds);
value += ":blur=0,0,0,%d,%d".printf ((int) bounds.get_height (), BORDER_RADIUS);
}

xdisplay.change_property (window, prop, X.XA_STRING, 8, 0, (uchar[]) value, value.length);
}
}
Expand Down