use own TagState enum for consistency with stdin patch
This commit is contained in:
		
							parent
							
								
									b40f557467
								
							
						
					
					
						commit
						c7ecfd3911
					
				| @ -72,7 +72,7 @@ Bar::Bar(Monitor* mon) | ||||
| 	_pangoContext.reset(pango_font_map_create_context(pango_cairo_font_map_get_default())); | ||||
| 	if (!_pangoContext) die("pango_font_map_create_context"); | ||||
| 	for (auto i=0u; i<tagNames.size(); i++) { | ||||
| 		_tags.push_back({ ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_NONE, 0, 0, createComponent(tagNames[i]) }); | ||||
| 		_tags.push_back({ TagState::None, 0, 0, createComponent(tagNames[i]) }); | ||||
| 	} | ||||
| 	_layoutCmp = createComponent(); | ||||
| 	_titleCmp = createComponent(); | ||||
| @ -107,7 +107,7 @@ void Bar::hide() | ||||
| 	_bufs.reset(); | ||||
| } | ||||
| 
 | ||||
| void Bar::setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient) | ||||
| void Bar::setTag(int tag, int state, int numClients, int focusedClient) | ||||
| { | ||||
| 	auto& t = _tags[tag]; | ||||
| 	t.state = state; | ||||
| @ -196,8 +196,8 @@ void Bar::renderTags() | ||||
| { | ||||
| 	for (auto &tag : _tags) { | ||||
| 		setColorScheme( | ||||
| 			tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE ? colorActive : colorInactive, | ||||
| 			tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT); | ||||
| 			tag.state & TagState::Active ? colorActive : colorInactive, | ||||
| 			tag.state & TagState::Urgent); | ||||
| 		renderComponent(tag.component); | ||||
| 		auto indicators = std::min(tag.numClients, _bufs->height/2); | ||||
| 		for (auto ind = 0; ind < indicators; ind++) { | ||||
|  | ||||
| @ -22,7 +22,7 @@ public: | ||||
| }; | ||||
| 
 | ||||
| struct Tag { | ||||
| 	znet_tapesoftware_dwl_wm_monitor_v1_tag_state state; | ||||
| 	int state; | ||||
| 	int numClients; | ||||
| 	int focusedClient; | ||||
| 	BarComponent component; | ||||
| @ -65,7 +65,7 @@ public: | ||||
| 	bool visible() const; | ||||
| 	void show(wl_output* output); | ||||
| 	void hide(); | ||||
| 	void setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient); | ||||
| 	void setTag(int tag, int state, int numClients, int focusedClient); | ||||
| 	void setSelected(bool selected); | ||||
| 	void setLayout(const std::string& layout); | ||||
| 	void setTitle(const std::string& title); | ||||
|  | ||||
| @ -26,6 +26,7 @@ union Arg { | ||||
| }; | ||||
| struct Monitor; | ||||
| 
 | ||||
| enum TagState { None, Active = 0x01, Urgent = 0x02 }; | ||||
| enum { ClkNone, ClkTagBar, ClkLayoutSymbol, ClkWinTitle, ClkStatusText }; | ||||
| struct Button { | ||||
| 	int control; | ||||
|  | ||||
| @ -227,9 +227,14 @@ static const struct znet_tapesoftware_dwl_wm_monitor_v1_listener dwlWmMonitorLis | ||||
| 	}, | ||||
| 	.tag = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t tag, uint32_t state, uint32_t numClients, int32_t focusedClient) { | ||||
| 		auto mon = static_cast<Monitor*>(mv); | ||||
| 		mon->bar->setTag(tag, static_cast<znet_tapesoftware_dwl_wm_monitor_v1_tag_state>(state), numClients, focusedClient); | ||||
| 		int tagState = TagState::None; | ||||
| 		if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE) | ||||
| 			tagState |= TagState::Active; | ||||
| 		if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT) | ||||
| 			tagState |= TagState::Urgent; | ||||
| 		mon->bar->setTag(tag, tagState, numClients, focusedClient); | ||||
| 		uint32_t mask = 1 << tag; | ||||
| 		if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE) { | ||||
| 		if (tagState & TagState::Active) { | ||||
| 			mon->tags |= mask; | ||||
| 		} else { | ||||
| 			mon->tags &= ~mask; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user