App/API: fix event emission methods
[staging/windowmanager.git] / src / app.hpp
index da614a0..6921865 100644 (file)
@@ -42,8 +42,8 @@ struct controller;
 namespace wm {
 
 struct id_allocator {
-   constexpr static unsigned id_shift = 20;
-   constexpr static unsigned id_mask = (1 << id_shift) - 1;
+   constexpr static const unsigned id_shift = 22;
+   constexpr static const unsigned id_mask = (1 << id_shift) - 1;
 
    unsigned next = 1;
 
@@ -60,7 +60,6 @@ struct id_allocator {
    // Insert and return a new ID
    unsigned generate_id(std::string const &name) {
       unsigned sid = this->next++;
-      sid <<= id_shift;
       this->surfaces[sid] = name;
       // this->pending_surfaces.insert({sid});
       this->names[name] = sid;
@@ -115,7 +114,6 @@ struct App {
    layer_map layers;
 
    typedef std::pair<char const *, std::function<void()>> name_task_pair;
-   std::vector<name_task_pair> pending;
 
    typedef std::map<std::string, int> drawing_name_map;
    drawing_name_map name_mapping;
@@ -148,10 +146,6 @@ struct App {
    char const *activate_surface(char const *drawing_name);
    char const *deactivate_surface(char const *drawing_name);
 
-   // add tasks, executed after dispatch_events()
-   void add_task(char const *name, std::function<void()> &&f);
-   void execute_pending();
-
    // Events from the compositor we are interested in
    void surface_created(uint32_t surface_id);
    void surface_removed(uint32_t surface_id);
@@ -160,6 +154,7 @@ struct App {
    void emit_activated(char const *label);
    void emit_deactivated(char const *label);
    void emit_syncdraw(char const *label);
+   void emit_flushdraw(char const *label);
    void emit_visible(char const *label, bool is_visible);
 };