16 auto & out = view->
out();
18 for(
auto & [ input_id, binds ] : this->binds )
38 out <<
"( Key::" <<
StringIO_Write( device_key.first, view->
context() ) <<
", "<< device_key.second <<
" )";
48 for(
auto & [ input_id, binds ] : this->hover_binds )
68 out <<
"( Key::" <<
StringIO_Write( device_key.first, view->
context() ) <<
", "<< device_key.second <<
" )";
80 this->listeners.insert( lst );
85 this->listeners.erase( lst );
88 void InputBindingSystem::binding_changed()
90 this->listeners.foreach(
100 if( device_index < 0 )
101 this->binds[ inputId ].all.insert( key );
103 this->binds[ inputId ].device.insert( std::pair( key, device_index ) );
105 this->binding_changed();
110 auto bind = this->binds[ inputId ];
111 if( device_index < 0 )
112 bind.all.erase( key );
114 bind.device.erase( std::pair( key, device_index ) );
116 if( bind.all.empty() && bind.device.empty() )
117 this->binds.erase( inputId );
119 this->binding_changed();
124 auto it = this->binds.find( inputId );
125 if( it == this->binds.end() )
128 if( it->second.all.count( key ) )
131 if( it->second.device.count( std::pair( key, device_index ) ) )
140 if( device_index < 0 )
141 this->hover_binds[ inputId ].all.insert( key );
143 this->hover_binds[ inputId ].device.insert( std::pair( key, device_index ) );
145 this->binding_changed();
150 auto bind = this->hover_binds[ inputId ];
151 if( device_index < 0 )
152 bind.all.erase( key );
154 bind.device.erase( std::pair( key, device_index ) );
156 if( bind.all.empty() && bind.device.empty() )
157 this->hover_binds.erase( inputId );
159 this->binding_changed();
164 auto it = this->hover_binds.find( inputId );
165 if( it == this->hover_binds.end() )
168 if( it->second.all.count( key ) )
171 if( it->second.device.count( std::pair( key, device_index ) ) )