Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

7.7 KB
Raw Blame
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="rediwm_titlebar_tabs_v1">
  <description summary="tabs in the compositor's titlebar">
    An application publishes the tabs of its window and the compositor paints
    them in the window's titlebar. The compositor draws and hit-tests the strip;
    the application owns the tabs and the user's actions come back as events.
    The strip only shows while the compositor draws the window's titlebar
    (server-side decorations). An application that has to draw its own titlebar
    draws its own tabs.

    Private to rediwm and its bundled applications.
  </description>

  <interface name="rediwm_titlebar_tabs_manager_v1" version="2">
    <description summary="titlebar tabs factory"/>

    <request name="destroy" type="destructor">
      <description summary="destroy the factory">
        Objects already created from it stay valid.
      </description>
    </request>

    <request name="get_titlebar_tabs">
      <description summary="create the tab strip for a toplevel's surface">
        The surface is, or will become, the surface of an xdg_toplevel. Like
        the KDE decoration manager this can be sent before the shell role is
        assigned. The strip is empty until the first commit.
      </description>
      <arg name="id" type="new_id" interface="rediwm_titlebar_tabs_v1"/>
      <arg name="surface" type="object" interface="wl_surface"/>
    </request>

    <enum name="error">
      <entry name="already_constructed" value="0"
             summary="the surface already has a tab strip"/>
    </enum>
  </interface>

  <interface name="rediwm_titlebar_tabs_v1" version="2">
    <description summary="a toplevel's titlebar tab strip">
      State is double-buffered: add_tab, set_selected and the like build a
      pending strip that replaces the shown one on commit. The pending state
      is empty again after every commit, so each commit describes the whole
      strip.
    </description>

    <enum name="error">
      <entry name="duplicate_id" value="0"
             summary="two tabs in one commit have the same id"/>
      <entry name="unknown_selected" value="1"
             summary="the selected id is not among the tabs"/>
      <entry name="too_many_tabs" value="2"
             summary="more than 128 tabs in one commit"/>
      <entry name="invalid_id" value="3"
             summary="tab ids must not be zero"/>
    </enum>

    <enum name="flags" bitfield="true">
      <entry name="modified" value="1"
             summary="the tab has unsaved changes; shown as a leading bullet"/>
      <entry name="attention" value="2"
             summary="the tab asks for attention"/>
    </enum>

    <request name="destroy" type="destructor">
      <description summary="remove the strip and destroy the object"/>
    </request>

    <request name="add_tab">
      <description summary="append a tab to the pending strip">
        Tabs show in the order they are added. Titles longer than 256 bytes
        are cut; a title that is not valid UTF-8 is replaced. The icon name
        is accepted and ignored in this version; every tab shows the
        application's icon.
      </description>
      <arg name="id" type="uint" summary="the application's id for the tab, not zero"/>
      <arg name="title" type="string"/>
      <arg name="icon_name" type="string" allow-null="true"/>
      <arg name="flags" type="uint" summary="a bitfield of flags"/>
    </request>

    <request name="set_selected">
      <description summary="select a tab in the pending strip">
        Required before a commit that adds tabs, and it must name one of them.
      </description>
      <arg name="id" type="uint"/>
    </request>

    <request name="set_leading_button">
      <description summary="show the application's icon as a button before the tabs">
        The button shows the application's own icon. Pressing it sends
        leading_activated, typically to open the application's menu. Part of
        the pending state like the tabs, so it takes effect on commit; it
        stays off until set.
      </description>
      <arg name="enabled" type="uint" summary="0 hides the button, anything else shows it"/>
    </request>

    <request name="set_detachable" since="2">
      <description summary="allow tabs to be dragged out of the strip">
        With this on, dragging a tab well away from the strip and releasing
        sends tear_off or drop_on instead of nothing. Applies at once, not on
        commit. Off by default: an application that does not handle the two
        events must not turn it on.
      </description>
      <arg name="enabled" type="uint" summary="0 is off, anything else on"/>
    </request>

    <request name="commit">
      <description summary="show the pending strip">
        Replaces the shown strip. A commit with no tabs removes the strip and
        the titlebar goes back to showing the window's title.
      </description>
    </request>

    <event name="select">
      <description summary="the user selected a tab">
        The compositor does not change the selected tab itself: the
        application changes its state and commits the result.
      </description>
      <arg name="id" type="uint"/>
    </event>

    <event name="close">
      <description summary="the user asked to close a tab"/>
      <arg name="id" type="uint"/>
    </event>

    <event name="new_tab">
      <description summary="the user pressed the new tab button"/>
    </event>

    <event name="move">
      <description summary="the user dragged a tab to a new place">
        Sent once, when the button is released. The index is the position the
        tab takes among all the tabs once it is removed from its old place
        and inserted at the new one (0 is the first). Like select, it only
        asks: the strip changes when the application commits the new order.
        While the drag lasts the compositor previews the move on its own.
      </description>
      <arg name="id" type="uint"/>
      <arg name="index" type="uint"/>
    </event>

    <event name="tear_off" since="2">
      <description summary="the user dragged a tab out and let go in empty space">
        Only sent while set_detachable is on, and not for the last tab of a
        strip. The position is the pointer in layout coordinates. The
        application opens a new toplevel holding the tab and removes it from
        this strip; the compositor places the next toplevel of this client near
        the pointer. Like select, it only asks: if the application does
        nothing, the tab stays.
      </description>
      <arg name="id" type="uint"/>
      <arg name="x" type="int"/>
      <arg name="y" type="int"/>
    </event>

    <event name="drop_on" since="2">
      <description summary="the user dropped a tab on another strip of this client">
        Only sent while set_detachable is on. The target is another strip of
        the same client, never of another application. The index is the place
        the tab takes among the target's tabs, counted as in move (0 is
        before the first). The application moves the tab and commits both
        strips.
      </description>
      <arg name="id" type="uint"/>
      <arg name="target" type="object" interface="rediwm_titlebar_tabs_v1"/>
      <arg name="index" type="uint"/>
    </event>

    <event name="leading_activated">
      <description summary="the user pressed the leading button">
        The button's rectangle is in the surface's coordinates. The titlebar
        sits above the surface, so y is negative. The application can anchor
        a popup menu to it.
      </description>
      <arg name="x" type="int"/>
      <arg name="y" type="int"/>
      <arg name="width" type="int"/>
      <arg name="height" type="int"/>
    </event>
  </interface>
</protocol>