Running on Linux again and small clean up.

This commit is contained in:
jmsgrogan 2021-03-06 16:02:13 -05:00
parent 683ba5447f
commit 2bde5567be
24 changed files with 113 additions and 60 deletions

View file

@ -1,12 +1,15 @@
#include "XcbTextInterface.h"
#include "XcbLayerInterface.h"
#include "VisualLayer.h"
#include "Color.h"
#include "RectangleElement.h"
#include <string.h>
xcb_gcontext_t XcbTextInterface::GetFontGC(xcb_connection_t *connection,
xcb_screen_t *screen, xcb_window_t window, const char*font_name,
xcb_screen_t *screen, xcb_window_t window, const char* font_name,
const TextElement* textElement)
{
/* get font */
xcb_font_t font = xcb_generate_id(connection);
xcb_open_font(connection, font, strlen(font_name), font_name);
@ -28,11 +31,11 @@ void XcbTextInterface::AddTextElement(xcb_connection_t* connection,
const TextElement* textElement)
{
/* get graphics context */
xcb_gcontext_t gc = XcbTextInterface::GetFontGC(connection, screen, window,
auto gc = XcbTextInterface::GetFontGC(connection, screen, window,
textElement->GetFontLabel().c_str(), textElement);
/* draw the text */
std::string content = textElement->GetContent();
const auto content = textElement->GetContent();
Pixel loc = textElement->GetLocation();
xcb_image_text_8(connection, content.length(), window, gc,
loc.GetX(), loc.GetY(), content.c_str());