Move windows to uptr. Add simple text editing.
This commit is contained in:
parent
2bcc7b3d83
commit
b99708e7d3
55 changed files with 1257 additions and 994 deletions
|
@ -2,38 +2,38 @@
|
|||
#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)
|
||||
{
|
||||
/* get font */
|
||||
xcb_font_t font = xcb_generate_id(connection);
|
||||
xcb_open_font(connection, font, strlen(font_name), font_name);
|
||||
/* get font */
|
||||
xcb_font_t font = xcb_generate_id(connection);
|
||||
xcb_open_font(connection, font, strlen(font_name), font_name);
|
||||
|
||||
/* create graphics context */
|
||||
xcb_gcontext_t gc = xcb_generate_id(connection);
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
|
||||
uint32_t value_list[3] = {screen->black_pixel, screen->white_pixel, font };
|
||||
/* create graphics context */
|
||||
xcb_gcontext_t gc = xcb_generate_id(connection);
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
|
||||
uint32_t value_list[3] = {screen->black_pixel, screen->white_pixel, font };
|
||||
|
||||
xcb_create_gc(connection, gc, window, mask, value_list);
|
||||
xcb_create_gc(connection, gc, window, mask, value_list);
|
||||
|
||||
/* close font */
|
||||
xcb_close_font(connection, font);
|
||||
return gc;
|
||||
/* close font */
|
||||
xcb_close_font(connection, font);
|
||||
return gc;
|
||||
}
|
||||
|
||||
void XcbTextInterface::AddTextElement(xcb_connection_t* connection,
|
||||
xcb_screen_t* screen, xcb_window_t window,
|
||||
TextElementPtr textElement)
|
||||
xcb_screen_t* screen, xcb_window_t window,
|
||||
const TextElement* textElement)
|
||||
{
|
||||
/* get graphics context */
|
||||
xcb_gcontext_t gc = XcbTextInterface::GetFontGC(connection, screen, window,
|
||||
textElement->GetFontLabel().c_str());
|
||||
/* get graphics context */
|
||||
xcb_gcontext_t gc = XcbTextInterface::GetFontGC(connection, screen, window,
|
||||
textElement->GetFontLabel().c_str());
|
||||
|
||||
/* draw the text */
|
||||
std::string content = textElement->GetContent();
|
||||
Pixel loc = textElement->GetLocation();
|
||||
xcb_image_text_8(connection, content.length(), window, gc,
|
||||
loc.GetX(), loc.GetY(), content.c_str());
|
||||
/* draw the text */
|
||||
std::string content = textElement->GetContent();
|
||||
Pixel loc = textElement->GetLocation();
|
||||
xcb_image_text_8(connection, content.length(), window, gc,
|
||||
loc.GetX(), loc.GetY(), content.c_str());
|
||||
|
||||
/* free the gc */
|
||||
xcb_free_gc(connection, gc);
|
||||
/* free the gc */
|
||||
xcb_free_gc(connection, gc);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue