Create x11_update_window_title

This commit is contained in:
twinaphex 2015-11-19 11:18:57 +01:00
parent eb31cf4d43
commit f868cbab31
5 changed files with 19 additions and 38 deletions

View File

@ -25,6 +25,7 @@
#include "x11_common.h"
#include "../../general.h"
#include "../video_monitor.h"
static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
@ -521,3 +522,16 @@ bool x11_connect(void)
return true;
}
void x11_update_window_title(void *data)
{
char buf[128] = {0};
char buf_fps[128] = {0};
settings_t *settings = config_get_ptr();
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}

View File

@ -80,5 +80,7 @@ void x11_install_sighandlers(void);
bool x11_connect(void);
void x11_update_window_title(void *data);
#endif

View File

@ -755,7 +755,6 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
unsigned pitch, const char *msg)
{
XWindowAttributes target;
char buf[128] = {0};
xv_t *xv = (xv_t*)data;
if (!frame)
@ -780,8 +779,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
true);
XSync(g_x11_dpy, False);
if (video_monitor_get_fps(buf, sizeof(buf), NULL, 0))
XStoreName(g_x11_dpy, g_x11_win, buf);
x11_update_window_title(NULL);
return true;
}

View File

@ -21,7 +21,6 @@
#include "../../driver.h"
#include "../../runloop.h"
#include "../video_monitor.h"
#include "../common/gl_common.h"
#include "../common/x11_common.h"
@ -218,21 +217,6 @@ static void gfx_ctx_glx_set_resize(void *data,
(void)height;
}
static void gfx_ctx_glx_update_window_title(void *data)
{
char buf[128] = {0};
char buf_fps[128] = {0};
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_glx_init(void *data)
{
static const int visual_attribs[] = {
@ -655,7 +639,7 @@ const gfx_ctx_driver_t gfx_ctx_glx = {
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
gfx_ctx_glx_update_window_title,
x11_update_window_title,
x11_check_window,
gfx_ctx_glx_set_resize,
x11_has_focus,

View File

@ -26,7 +26,6 @@
#include "../../driver.h"
#include "../../runloop.h"
#include "../video_monitor.h"
#include "../common/gl_common.h"
#include "../common/x11_common.h"
@ -133,22 +132,6 @@ static void gfx_ctx_xegl_set_resize(void *data,
(void)height;
}
static void gfx_ctx_xegl_update_window_title(void *data)
{
char buf[128] = {0};
char buf_fps[128] = {0};
settings_t *settings = config_get_ptr();
(void)data;
if (video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (settings->fps_show)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
#define XEGL_ATTRIBS_BASE \
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
EGL_RED_SIZE, 1, \
@ -687,7 +670,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
gfx_ctx_xegl_update_window_title,
x11_update_window_title,
x11_check_window,
gfx_ctx_xegl_set_resize,
gfx_ctx_xegl_has_focus,