kranewm

An ICCCM & EWMH compliant X11 reparenting, dynamic window manager, written in C++
git clone git://git.deurzen.net/kranewm
Log | Files | Refs | LICENSE

connection.hh (5664B)


      1 #ifndef __WINSYS_CONNECTION_H_GUARD__
      2 #define __WINSYS_CONNECTION_H_GUARD__
      3 
      4 #include "common.hh"
      5 #include "event.hh"
      6 #include "hints.hh"
      7 #include "message.hh"
      8 #include "screen.hh"
      9 #include "window.hh"
     10 
     11 #include <functional>
     12 #include <optional>
     13 #include <string>
     14 #include <tuple>
     15 #include <unordered_set>
     16 #include <vector>
     17 
     18 namespace winsys
     19 {
     20 
     21     class Connection
     22     {
     23     public:
     24         virtual ~Connection() {};
     25 
     26         virtual void init_wm_ipc() = 0;
     27         virtual bool flush() = 0;
     28         virtual Event step() = 0;
     29         virtual bool check_progress() = 0;
     30         virtual void process_events(std::function<void(Event)>) = 0;
     31         virtual void process_messages(std::function<void(Message)>) = 0;
     32         virtual std::vector<Screen> connected_outputs() = 0;
     33         virtual std::vector<Window> top_level_windows() = 0;
     34         virtual Pos get_pointer_position() = 0;
     35         virtual void warp_pointer_center_of_window_or_root(std::optional<Window>, Screen&) = 0;
     36         virtual void warp_pointer(Pos) = 0;
     37         virtual void warp_pointer_rpos(Window, Pos) = 0;
     38         virtual void confine_pointer(Window) = 0;
     39         virtual bool release_pointer() = 0;
     40         virtual void call_external_command(std::string&) = 0;
     41         virtual void cleanup() = 0;
     42 
     43         // window manipulation
     44         virtual Window create_frame(Region) = 0;
     45         virtual void init_window(Window) = 0;
     46         virtual void init_frame(Window, bool) = 0;
     47         virtual void init_unmanaged(Window) = 0;
     48         virtual void init_move(Window) = 0;
     49         virtual void init_resize(Window) = 0;
     50         virtual void cleanup_window(Window) = 0;
     51         virtual void map_window(Window) = 0;
     52         virtual void unmap_window(Window) = 0;
     53         virtual void reparent_window(Window, Window, Pos) = 0;
     54         virtual void unparent_window(Window, Pos) = 0;
     55         virtual void destroy_window(Window) = 0;
     56         virtual bool close_window(Window) = 0;
     57         virtual bool kill_window(Window) = 0;
     58         virtual void place_window(Window, Region&) = 0;
     59         virtual void move_window(Window, Pos) = 0;
     60         virtual void resize_window(Window, Dim) = 0;
     61         virtual void focus_window(Window) = 0;
     62         virtual void stack_window_above(Window, std::optional<Window>) = 0;
     63         virtual void stack_window_below(Window, std::optional<Window>) = 0;
     64         virtual void insert_window_in_save_set(Window) = 0;
     65         virtual void grab_bindings(std::vector<KeyInput>&, std::vector<MouseInput>&) = 0;
     66         virtual void regrab_buttons(Window) = 0;
     67         virtual void ungrab_buttons(Window) = 0;
     68         virtual void unfocus() = 0;
     69         virtual void set_window_border_width(Window, unsigned) = 0;
     70         virtual void set_window_border_color(Window, unsigned) = 0;
     71         virtual void set_window_background_color(Window, unsigned) = 0;
     72         virtual void set_window_notify_enter(Window, bool) = 0;
     73         virtual void update_window_offset(Window, Window) = 0;
     74         virtual Window get_focused_window() = 0;
     75         virtual std::optional<Region> get_window_geometry(Window) = 0;
     76         virtual std::optional<Pid> get_window_pid(Window) = 0;
     77         virtual std::optional<Pid> get_ppid(std::optional<Pid>) = 0;
     78         virtual bool must_manage_window(Window) = 0;
     79         virtual bool must_free_window(Window) = 0;
     80         virtual bool window_is_mappable(Window) = 0;
     81 
     82         // ICCCM
     83         virtual void set_icccm_window_state(Window, IcccmWindowState) = 0;
     84         virtual void set_icccm_window_hints(Window, Hints) = 0;
     85         virtual std::string get_icccm_window_name(Window) = 0;
     86         virtual std::string get_icccm_window_class(Window) = 0;
     87         virtual std::string get_icccm_window_instance(Window) = 0;
     88         virtual std::optional<Window> get_icccm_window_transient_for(Window) = 0;
     89         virtual std::optional<Window> get_icccm_window_client_leader(Window) = 0;
     90         virtual std::optional<Hints> get_icccm_window_hints(Window) = 0;
     91         virtual std::optional<SizeHints> get_icccm_window_size_hints(Window, std::optional<Dim>) = 0;
     92 
     93         // EWMH
     94         virtual void init_for_wm(std::vector<std::string> const&) = 0;
     95         virtual void set_current_desktop(Index) = 0;
     96         virtual void set_root_window_name(std::string const&) = 0;
     97         virtual void set_window_desktop(Window, Index) = 0;
     98         virtual void set_window_state(Window, WindowState, bool) = 0;
     99         virtual void set_window_frame_extents(Window, Extents) = 0;
    100         virtual void set_desktop_geometry(std::vector<Region> const&) = 0;
    101         virtual void set_desktop_viewport(std::vector<Region> const&) = 0;
    102         virtual void set_workarea(std::vector<Region> const&) = 0;
    103         virtual void update_desktops(std::vector<std::string> const&) = 0;
    104         virtual void update_client_list(std::vector<Window> const&) = 0;
    105         virtual void update_client_list_stacking(std::vector<Window> const&) = 0;
    106         virtual std::optional<std::vector<std::optional<Strut>>> get_window_strut(Window) = 0;
    107         virtual std::optional<std::vector<std::optional<Strut>>> get_window_strut_partial(Window) = 0;
    108         virtual std::optional<Index> get_window_desktop(Window) = 0;
    109         virtual std::unordered_set<WindowType> get_window_types(Window) = 0;
    110         virtual std::unordered_set<WindowState> get_window_states(Window) = 0;
    111         virtual bool window_is_fullscreen(Window) = 0;
    112         virtual bool window_is_above(Window) = 0;
    113         virtual bool window_is_below(Window) = 0;
    114         virtual bool window_is_sticky(Window) = 0;
    115 
    116         // IPC client
    117         virtual void init_for_client() = 0;
    118 
    119     };
    120 
    121 }
    122 
    123 #endif//__WINSYS_CONNECTION_H_GUARD__