- case LayoutState::LayoutSplit:
- if (this->can_split(surface_id)) {
- this->deactivate(this->state.sub);
- this->surface_set_layout_split(this->state.main, surface_id);
+ this->surface_set_layout_full(*surface_id);
+ this->activate(*surface_id);
+ state.main = *surface_id;
+ state.sub = -1;
+ state.s = LayoutState::Single;
+
+ this->emit_flushdraw(drawing_name);
+ } else {
+ bool can_split = this->can_split(state, *surface_id);
+
+ if (state.sub == -1) {
+ if (can_split) {
+ if (state.main != *surface_id) {
+ std::string main = *this->lookup_name(state.main);
+ this->emit_syncdraw(drawing_name);
+ this->emit_syncdraw(main.c_str());
+
+ this->surface_set_layout_split(state.main, *surface_id);
+ this->activate(*surface_id);
+ state.sub = *surface_id;
+
+ // Should wait for EndDraw event...
+ this->emit_flushdraw(drawing_name);
+ this->emit_flushdraw(main.c_str());