Skip to content

Commit

Permalink
Merge branch 'leolost/wl-protocol' of github.com:elementary/dock into…
Browse files Browse the repository at this point in the history
… leolost/wl-protocol
  • Loading branch information
leolost2605 committed May 24, 2024
2 parents d3bc365 + e25bcea commit 08e5489
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
39 changes: 39 additions & 0 deletions protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
<entry name="right" value="3" summary="the right edge of the screen"/>
</enum>

<enum name="hide_mode">
<description summary="hide mode">
How the shell should handle the window.
</description>
<entry name="never" value="0" summary="make the surface exclusive"/>
<entry name="maximized_focus_window" value="1" summary="hide when the focused window is maximized"/>
<entry name="overlapping_focus_window" value="2" summary="hide when the focused window overlaps the surface"/>
<entry name="overlapping_window" value="3" summary="hide when any window overlaps the surface"/>
<entry name="always" value="4" summary="always hide and only show if requested by the user"/>
</enum>

<request name="set_anchor">
<description summary="set panel edge anchor">
Tell the shell which side of the screen the panel is
Expand All @@ -59,6 +70,34 @@

<arg name="anchor" type="uint" enum="anchor" summary="anchor"/>
</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>

<request name="set_size">
<description summary="set size">
The given size is only used for exclusive zones and
collision tracking for auto hide. By default and if set
to -1 the size of the surface is used.
</description>

<arg name="width" type="int"/>
<arg name="height" type="int"/>
</request>

<request name="set_hide_mode">
<description summary="set panel hide mode">
Tell the shell when to hide the panel.
</description>

<arg name="hide_mode" type="uint" enum="hide_mode" summary="hide mode"/>
</request>
</interface>

<interface name="io_elementary_pantheon_widget_v1" version="1">
Expand Down
12 changes: 12 additions & 0 deletions protocol/pantheon-desktop-shell.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ namespace Pantheon.Desktop {
RIGHT,
}

[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "enum io_elementary_pantheon_panel_v1_hide_mode", cprefix="IO_ELEMENTARY_PANTHEON_PANEL_V1_HIDE_MODE_", has_type_id = false)]
public enum HideMode {
NEVER,
MAXIMIZED_FOCUS_WINDOW,
OVERLAPPING_FOCUS_WINDOW,
OVERLAPPING_WINDOW,
ALWAYS
}

[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_panel_v1", cprefix = "io_elementary_pantheon_panel_v1_")]
public class Panel : Wl.Proxy {
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_panel_v1_interface")]
Expand All @@ -35,6 +44,9 @@ namespace Pantheon.Desktop {
public uint32 get_version ();
public void destroy ();
public void set_anchor (Pantheon.Desktop.Anchor anchor);
public void focus ();
public void set_size (int width, int height);
public void set_hide_mode (Pantheon.Desktop.HideMode hide_mode);
}

[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_widget_v1", cprefix = "io_elementary_pantheon_widget_v1_")]
Expand Down
3 changes: 2 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
if (surface is Gdk.Wayland.Surface) {
unowned var wl_surface = ((Gdk.Wayland.Surface) surface).get_wl_surface ();
panel = desktop_shell.get_panel (wl_surface);
panel.set_anchor (settings.get_enum ("autohide-mode"));
panel.set_anchor (BOTTOM);
panel.set_hide_mode (settings.get_enum ("autohide-mode"));
}
}
}
Expand Down

0 comments on commit 08e5489

Please sign in to comment.