(Win32) Do optimization for Windows where we only update the title

when the previous title differs from the current title
(X11) Have to roll back the previous title optimization/less calls to XChangeProperty,
because the title is lost upon toggling between fullscreen/windowed and is no longer
set
This commit is contained in:
LibretroAdmin 2022-08-27 16:16:24 +02:00
parent 938d7c1fc4
commit e6fd2c9cdb
2 changed files with 6 additions and 15 deletions

View File

@ -2339,22 +2339,17 @@ bool win32_set_video_mode(void *data,
void win32_update_title(void)
{
const ui_window_t *window = ui_companion_driver_get_window_ptr();
static unsigned update_title_wait = 0;
if (update_title_wait)
{
update_title_wait--;
return;
}
if (window)
{
static char prev_title[128];
char title[128];
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
update_title_wait = g_win32_refresh_rate;
if (title[0])
if (title[0] && !string_is_equal(title, prev_title))
{
window->set_title(&main_window, title);
strlcpy(prev_title, title, sizeof(prev_title));
}
}
}
#endif

View File

@ -766,16 +766,12 @@ bool x11_connect(void)
void x11_update_title(void *data)
{
size_t len;
static char prev_title[128];
char title[128];
title[0] = '\0';
len = video_driver_get_window_title(title, sizeof(title));
if (title[0] && !string_is_equal(title, prev_title))
{
if (title[0])
XChangeProperty(g_x11_dpy, g_x11_win, XA_WM_NAME, XA_STRING,
8, PropModeReplace, (const unsigned char*)title, len);
strlcpy(prev_title, title, sizeof(prev_title));
}
}
bool x11_input_ctx_new(bool true_full)