add Jtk_SetWindowTitle()

This commit is contained in:
Josh Holtrop 2017-10-14 12:16:16 -04:00
parent 2d944e4a87
commit 314c840105
3 changed files with 13 additions and 0 deletions

View File

@ -83,6 +83,7 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
std::cerr << "Error creating window" << std::endl; std::cerr << "Error creating window" << std::endl;
return false; return false;
} }
Jtk_SetWindowTitle(m_window, "jes");
#if 0 #if 0
set_window_icon(); set_window_icon();

View File

@ -6,6 +6,7 @@
#include <GL/glx.h> #include <GL/glx.h>
#include "Jtk_internal.h" #include "Jtk_internal.h"
#include <stdio.h> #include <stdio.h>
#include <X11/Xatom.h>
static Bool WaitForNotify(Display * display, XEvent * event, XPointer arg) static Bool WaitForNotify(Display * display, XEvent * event, XPointer arg)
{ {
@ -41,4 +42,14 @@ void Jtk_CloseWindow(void * window)
XDestroyWindow(g_display, (Window)window); XDestroyWindow(g_display, (Window)window);
} }
void Jtk_SetWindowTitle(void * window, const char * title)
{
XTextProperty title_property;
if (XStringListToTextProperty((char **)&title, 1, &title_property) != 0)
{
XSetTextProperty(g_display, (Window)window, &title_property, XA_WM_NAME);
XFree(title_property.value);
}
}
#endif #endif

View File

@ -4,5 +4,6 @@
void * Jtk_CreateWindow(); void * Jtk_CreateWindow();
void Jtk_SwapBuffers(void * window); void Jtk_SwapBuffers(void * window);
void Jtk_CloseWindow(void * window); void Jtk_CloseWindow(void * window);
void Jtk_SetWindowTitle(void * window, const char * title);
#endif #endif