Title in cefsimple

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Title in cefsimple

Postby n1c0la4 » Sun Mar 27, 2022 5:50 am

In Linux a title is not shown in the cefsimple example. But if add XFlush(display); to end of function then all works perfectly

This function from SDL can be helpful

Code: Select all
void
X11_SetWindowTitle(_THIS, SDL_Window * window)
{
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    Display *display = data->videodata->display;
    XTextProperty titleprop;
    Status status;
    const char *title = window->title ? window->title : "";
    char *title_locale = NULL;

#ifdef X_HAVE_UTF8_STRING
    Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
#endif

    title_locale = SDL_iconv_utf8_locale(title);
    if (!title_locale) {
        SDL_OutOfMemory();
        return;
    }

    status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
    SDL_free(title_locale);
    if (status) {
        X11_XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
        X11_XFree(titleprop.value);
    }
#ifdef X_HAVE_UTF8_STRING
    if (SDL_X11_HAVE_UTF8) {
        status = X11_Xutf8TextListToTextProperty(display, (char **) &title, 1,
                                            XUTF8StringStyle, &titleprop);
        if (status == Success) {
            X11_XSetTextProperty(display, data->xwindow, &titleprop,
                                 _NET_WM_NAME);
            X11_XFree(titleprop.value);
        }
    }
#endif

    X11_XFlush(display);
}
n1c0la4
Techie
 
Posts: 18
Joined: Tue Nov 19, 2019 1:52 pm

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 49 guests