[AD] A new patch [Fix (complete) al_inhibit_screensaver function] |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: allegro-developers@xxxxxxxxxxxxxxxxxx
- Subject: [AD] A new patch [Fix (complete) al_inhibit_screensaver function]
- From: Rm Beer <rmbeer2@xxxxxxxxx>
- Date: Mon, 29 Apr 2019 16:39:59 -0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=vbGS0r1L8HpRompQ2G98+mrqIDKcDKrM89CE4+q5aQM=; b=O3Ph8o5GoJgVIZxIwlUBK72i1pdVZytgrMCjyaWRMFWe7pkM3fZWSIg+J04BopdmfE bsEV8TNkKhA92l86bA1IIoq0uRQJPaFmeyqWDUYS+ASt42oq0DS3DN8VCwJMSwVdp6aY NwhVGtstaXHbP6O4dlVhIcSTGKtqLvEI9q7nuU6WYij9jvwDvQCGe5bLivU8IYPXf0PM lQtmwvSsI7ll4CDEr2/0jqaA19LGlHvWFnPdFUylLlIdtpy1QQ45dgkLQ0K95/Zetc+Z J9MijaLkInaPEF5KuB2LqlYt0KGE0WvzxCiRIxcpe/56K4vkVpfWVkK+8eP8+Mm74eoo q99g==
From 5ddd16d9c6af25efbdfd90a2fdc0e8d4c63e94e8 Mon Sep 17 00:00:00 2001
From: RmBeer <rmbeer2@xxxxxxxxx>
Date: Mon, 29 Apr 2019 16:29:18 -0300
Subject: [PATCH 1/1] Fix (complete) al_inhibit_screensaver function
---
src/x/xsystem.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/x/xsystem.c b/src/x/xsystem.c
index 824ca7aac..4c4d048f4 100644
--- a/src/x/xsystem.c
+++ b/src/x/xsystem.c
@@ -354,6 +354,14 @@ static bool xglx_get_cursor_position(int *ret_x, int *ret_y)
static bool xglx_inhibit_screensaver(bool inhibit)
{
ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver();
+ int temp, temp_version_min, temp_version_max;
+
+ if (!XScreenSaverQueryExtension(system->x11display, &temp, &temp) ||
+ !XScreenSaverQueryVersion(system->x11display, &temp_version_max, &temp_version_min) ||
+ temp_version_max < 1 || (temp_version_max == 1 && temp_version_min < 1)) {
+ return false;
+ }
+ XScreenSaverSuspend(system->x11display, inhibit);
system->inhibit_screensaver = inhibit;
return true;
--
2.21.0