Added configuration option for fullscreen check
This commit is contained in:
5
glava.c
5
glava.c
@@ -279,10 +279,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&audio.mutex);
|
pthread_mutex_unlock(&audio.mutex);
|
||||||
|
|
||||||
/* Only render if needed (ie. stop rendering when fullscreen windows are focused) */
|
if (!rd_update(r, lb, rb, r->bufsize_request, modified)) {
|
||||||
if (xwin_should_render(r)) {
|
|
||||||
rd_update(r, lb, rb, r->bufsize_request, modified);
|
|
||||||
} else {
|
|
||||||
/* Sleep for 50ms and then attempt to render again */
|
/* Sleep for 50ms and then attempt to render again */
|
||||||
struct timespec tv = {
|
struct timespec tv = {
|
||||||
.tv_sec = 0, .tv_nsec = 50 * 1000000
|
.tv_sec = 0, .tv_nsec = 50 * 1000000
|
||||||
|
|||||||
17
render.c
17
render.c
@@ -109,7 +109,7 @@ struct gl_data {
|
|||||||
double tcounter;
|
double tcounter;
|
||||||
int fcounter, ucounter, kcounter;
|
int fcounter, ucounter, kcounter;
|
||||||
bool print_fps, avg_window, interpolate, force_geometry, copy_desktop,
|
bool print_fps, avg_window, interpolate, force_geometry, copy_desktop,
|
||||||
smooth_pass, premultiply_alpha;
|
smooth_pass, premultiply_alpha, check_fullscreen;
|
||||||
void** t_data;
|
void** t_data;
|
||||||
float gravity_step, target_spu, fr, ur, smooth_distance, smooth_ratio,
|
float gravity_step, target_spu, fr, ur, smooth_distance, smooth_ratio,
|
||||||
smooth_factor, fft_scale, fft_cutoff;
|
smooth_factor, fft_scale, fft_cutoff;
|
||||||
@@ -721,6 +721,7 @@ struct renderer* rd_new(const char** paths, const char* entry,
|
|||||||
.sm_prog = 0,
|
.sm_prog = 0,
|
||||||
.copy_desktop = true,
|
.copy_desktop = true,
|
||||||
.premultiply_alpha = true,
|
.premultiply_alpha = true,
|
||||||
|
.check_fullscreen = true,
|
||||||
.smooth_pass = true,
|
.smooth_pass = true,
|
||||||
.fft_scale = 10.2F,
|
.fft_scale = 10.2F,
|
||||||
.fft_cutoff = 0.3F,
|
.fft_cutoff = 0.3F,
|
||||||
@@ -823,6 +824,10 @@ struct renderer* rd_new(const char** paths, const char* entry,
|
|||||||
.name = "setmirror", .fmt = "b",
|
.name = "setmirror", .fmt = "b",
|
||||||
.handler = RHANDLER(name, args, { r->mirror_input = *(bool*) args[0]; })
|
.handler = RHANDLER(name, args, { r->mirror_input = *(bool*) args[0]; })
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "setfullscreencheck", .fmt = "b",
|
||||||
|
.handler = RHANDLER(name, args, { gl->check_fullscreen = *(bool*) args[0]; })
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "setbg", .fmt = "s",
|
.name = "setbg", .fmt = "s",
|
||||||
.handler = RHANDLER(name, args, {
|
.handler = RHANDLER(name, args, {
|
||||||
@@ -1276,13 +1281,17 @@ void rd_time(struct renderer* r) {
|
|||||||
gl->wcb->set_time(gl->w, 0.0D); /* reset time for measuring this frame */
|
gl->wcb->set_time(gl->w, 0.0D); /* reset time for measuring this frame */
|
||||||
}
|
}
|
||||||
|
|
||||||
void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modified) {
|
bool rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modified) {
|
||||||
struct gl_data* gl = r->gl;
|
struct gl_data* gl = r->gl;
|
||||||
size_t t, a, fbsz = bsz * sizeof(float);
|
size_t t, a, fbsz = bsz * sizeof(float);
|
||||||
|
|
||||||
r->alive = !gl->wcb->should_close(gl->w);
|
r->alive = !gl->wcb->should_close(gl->w);
|
||||||
if (!r->alive)
|
if (!r->alive)
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
|
/* Stop rendering when fullscreen windows are focused */
|
||||||
|
if (gl->check_fullscreen && !xwin_should_render(r))
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Force disable interpolation if the update rate is close to or higher than the frame rate */
|
/* Force disable interpolation if the update rate is close to or higher than the frame rate */
|
||||||
float uratio = (gl->ur / gl->fr); /* update : framerate ratio */
|
float uratio = (gl->ur / gl->fr); /* update : framerate ratio */
|
||||||
@@ -1628,6 +1637,8 @@ void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
|
|||||||
|
|
||||||
/* Restore interpolation settings */
|
/* Restore interpolation settings */
|
||||||
gl->interpolate = old_interpolate;
|
gl->interpolate = old_interpolate;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* rd_get_impl_window (struct renderer* r) { return r->gl->w; }
|
void* rd_get_impl_window (struct renderer* r) { return r->gl->w; }
|
||||||
|
|||||||
2
render.h
2
render.h
@@ -13,7 +13,7 @@ typedef struct renderer {
|
|||||||
|
|
||||||
struct renderer* rd_new (const char** paths, const char* entry,
|
struct renderer* rd_new (const char** paths, const char* entry,
|
||||||
const char* force_mod, const char* force_backend);
|
const char* force_mod, const char* force_backend);
|
||||||
void rd_update (struct renderer*, float* lb, float* rb,
|
bool rd_update (struct renderer*, float* lb, float* rb,
|
||||||
size_t bsz, bool modified);
|
size_t bsz, bool modified);
|
||||||
void rd_destroy (struct renderer*);
|
void rd_destroy (struct renderer*);
|
||||||
void rd_time (struct renderer*);
|
void rd_time (struct renderer*);
|
||||||
|
|||||||
@@ -124,6 +124,12 @@
|
|||||||
simple set to zero (or lower) to disable the frame limiter. */
|
simple set to zero (or lower) to disable the frame limiter. */
|
||||||
#request setframerate 0
|
#request setframerate 0
|
||||||
|
|
||||||
|
/* Enable/disable fullscreen checks. This looks at the currently
|
||||||
|
focused window and halts GLava's rendering if it is
|
||||||
|
fullscreen. This prevents rendering from interfering with
|
||||||
|
other graphically intensive tasks. */
|
||||||
|
#request setfullscreencheck true
|
||||||
|
|
||||||
/* Enable/disable printing framerate every second. 'FPS' stands
|
/* Enable/disable printing framerate every second. 'FPS' stands
|
||||||
for 'Frames Per Second', and 'UPS' stands for 'Updates Per
|
for 'Frames Per Second', and 'UPS' stands for 'Updates Per
|
||||||
Second'. Updates are performed when new data is submitted
|
Second'. Updates are performed when new data is submitted
|
||||||
|
|||||||
Reference in New Issue
Block a user