Accepting request 678875 from X11:LXQt
- Update to 0.14.1: * Bumped version to 0.14.1 * Enable/disable a standard button if it exists. This is needed for adding Apply button later because Apply button should be enabled/disabled appropriately. * Updated translations * Note for packagers: liblxqt now depend on libqtxdg 3.3.1 - Update to 0.14.0: * Added missing text color of our HTML delegate * lxqtbacklight: fix and improve command line parameter handling * lxqthtmldelegate: Position, alignment and size fixes for HTML delegate * lxqtpageselectwidget: Fix config dialog cell height * lxqtpageselectwidget: Fixed config dialog select widget cells - Remove liblxqt-0.13.0-backlight.patch: upstreamed - Move translation from lxqt-l10n into package OBS-URL: https://build.opensuse.org/request/show/678875 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/liblxqt?expand=0&rev=11
This commit is contained in:
commit
5c936d8bcb
@ -1,672 +0,0 @@
|
||||
See: https://github.com/lxqt/liblxqt/pull/148
|
||||
|
||||
From a4671083ad7277288fa2a17b90efc11439088df2 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 16:31:15 +0200
|
||||
Subject: [PATCH 1/8] lxqtbacklight: centralize fopen() and perform path
|
||||
handling with length checks
|
||||
|
||||
---
|
||||
.../linux_backend/driver/libbacklight_backend.c | 47 ++++++++++++++--------
|
||||
.../linux_backend/driver/lxqtbacklight_backend.c | 14 ++-----
|
||||
2 files changed, 33 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index 13689ef..4d90c20 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -55,6 +55,7 @@
|
||||
* in order to write in /sys/class/backlight/driver/brightness file.
|
||||
*******************************************************************************/
|
||||
|
||||
+#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
@@ -67,6 +68,7 @@
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
+static FILE* open_driver_file(const char *path, const char *driver, const char *mode);
|
||||
static int read_backlight(char *driver);
|
||||
static int read_max_backlight(char *driver);
|
||||
static int read_bl_power(char *driver);
|
||||
@@ -114,13 +116,10 @@ int lxqt_backlight_is_backlight_off()
|
||||
return bl_power;
|
||||
}
|
||||
|
||||
-static int read_int(char *path)
|
||||
+static int read_int(const char *tpl, const char *driver)
|
||||
{
|
||||
- FILE *in = fopen(path, "r");
|
||||
+ FILE *in = open_driver_file(tpl, driver, "r");
|
||||
if( in == NULL ) {
|
||||
- char buffer[1024];
|
||||
- sprintf(buffer, "Couldn't open %s", path);
|
||||
- perror(buffer);
|
||||
return -1;
|
||||
}
|
||||
int value;
|
||||
@@ -132,25 +131,40 @@ static int read_int(char *path)
|
||||
return value;
|
||||
}
|
||||
|
||||
+static FILE* open_driver_file(const char *tpl, const char *driver, const char *mode)
|
||||
+{
|
||||
+ char path[PATH_MAX];
|
||||
+ int res;
|
||||
+
|
||||
+ res = snprintf(path, PATH_MAX, tpl, driver);
|
||||
+
|
||||
+ if( res <= 0 || res >= PATH_MAX ) {
|
||||
+ path[0] = '\0';
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ FILE *ret = fopen(path, mode);
|
||||
+
|
||||
+ if( ret == NULL ) {
|
||||
+ fprintf(stderr, "Couldn't open %s: %s\n", path, strerror(errno));
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int read_backlight(char *driver)
|
||||
{
|
||||
- char path[1024];
|
||||
- sprintf(path, "/sys/class/backlight/%s/actual_brightness", driver);
|
||||
- return read_int(path);
|
||||
+ return read_int("/sys/class/backlight/%s/actual_brightness", driver);
|
||||
}
|
||||
|
||||
static int read_max_backlight(char *driver)
|
||||
{
|
||||
- char path[1024];
|
||||
- sprintf(path, "/sys/class/backlight/%s/max_brightness", driver);
|
||||
- return read_int(path);
|
||||
+ return read_int("/sys/class/backlight/%s/max_brightness", driver);
|
||||
}
|
||||
|
||||
static int read_bl_power(char *driver)
|
||||
{
|
||||
- char path[1024];
|
||||
- sprintf(path, "/sys/class/backlight/%s/bl_power", driver);
|
||||
- return read_int(path);
|
||||
+ return read_int("/sys/class/backlight/%s/bl_power", driver);
|
||||
}
|
||||
|
||||
typedef enum {FIRMWARE, PLATFORM, RAW, OTHER, N_BACKLIGHT} BackligthTypes;
|
||||
@@ -163,7 +177,7 @@ char *lxqt_backlight_backend_get_driver()
|
||||
char *drivers[N_BACKLIGHT];
|
||||
char *driver;
|
||||
int n;
|
||||
- char path[1024], type[1024];
|
||||
+ char type[1024];
|
||||
|
||||
for(n=0;n<N_BACKLIGHT;n++)
|
||||
drivers[n] = NULL;
|
||||
@@ -179,8 +193,7 @@ char *lxqt_backlight_backend_get_driver()
|
||||
if( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") )
|
||||
continue;
|
||||
driver = dp->d_name;
|
||||
- sprintf(path, "/sys/class/backlight/%s/type", driver);
|
||||
- FILE *in = fopen(path, "r");
|
||||
+ FILE *in = open_driver_file("/sys/class/backlight/%s/type", driver, "r");
|
||||
if( in == NULL )
|
||||
continue;
|
||||
int ok = fscanf(in, "%s", type);
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 9586485..45c9281 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -35,14 +35,10 @@
|
||||
*/
|
||||
static void set_bl_power(char *driver, int value)
|
||||
{
|
||||
- char path[1024];
|
||||
- sprintf(path, "/sys/class/backlight/%s/bl_power", driver);
|
||||
- FILE *out = fopen(path, "w");
|
||||
+ FILE *out = open_driver_file("/sys/class/backlight/%s/bl_power", driver, "w");
|
||||
if( out != NULL ) {
|
||||
fprintf(out, "%d", value);
|
||||
fclose(out);
|
||||
- } else {
|
||||
- perror("Couldn't open /sys/class/backlight/driver/bl_power");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +46,10 @@ static void set_bl_power(char *driver, int value)
|
||||
static void set_backlight(char *driver, int value)
|
||||
{
|
||||
if(value>0) {
|
||||
- char path[1024];
|
||||
- sprintf(path, "/sys/class/backlight/%s/brightness", driver);
|
||||
- FILE *out = fopen(path, "w");
|
||||
+ FILE *out = open_driver_file("/sys/class/backlight/%s/brightness", driver, "w");
|
||||
if( out != NULL ) {
|
||||
fprintf(out, "%d", value);
|
||||
fclose(out);
|
||||
- } else {
|
||||
- perror("Couldn't open /sys/class/backlight/driver/brightness");
|
||||
}
|
||||
if(read_bl_power(driver) > 0)
|
||||
set_bl_power(driver, 0);
|
||||
@@ -247,4 +239,4 @@ int main(int argc, char *argv[])
|
||||
change_blacklight(value, value_percent_ok);
|
||||
|
||||
return 0;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
|
||||
From 318f85b2aca43ed6c9b4f6099f3d476bb8b9e1c2 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 16:36:41 +0200
|
||||
Subject: [PATCH 2/8] lxqtbacklight: apply maximum string length to fscanf to
|
||||
prevent overflow
|
||||
|
||||
---
|
||||
lxqtbacklight/linux_backend/driver/libbacklight_backend.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index 4d90c20..c7ce7ab 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -196,7 +196,8 @@ char *lxqt_backlight_backend_get_driver()
|
||||
FILE *in = open_driver_file("/sys/class/backlight/%s/type", driver, "r");
|
||||
if( in == NULL )
|
||||
continue;
|
||||
- int ok = fscanf(in, "%s", type);
|
||||
+ // the maximum field width does not include '\0'!
|
||||
+ int ok = fscanf(in, "%1023s", type);
|
||||
fclose(in);
|
||||
if( ok != EOF ) {
|
||||
// firmware control should be preferred to platform control should be preferred to raw control.
|
||||
|
||||
From 628dbd33fcaf93b79334572782991ac8d4362f14 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 16:49:07 +0200
|
||||
Subject: [PATCH 3/8] lxqtbacklight: removed useless commented out code
|
||||
|
||||
---
|
||||
.../linux_backend/driver/lxqtbacklight_backend.c | 34 ----------------------
|
||||
1 file changed, 34 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 45c9281..3dc7d7e 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -58,40 +58,6 @@ static void set_backlight(char *driver, int value)
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-// static int read_int(char *path)
|
||||
-// {
|
||||
-// FILE *in = fopen(path, "r");
|
||||
-// if( in == NULL ) {
|
||||
-// char buffer[1024];
|
||||
-// sprintf(buffer, "Couldn't open %s", path);
|
||||
-// perror(buffer);
|
||||
-// return -1;
|
||||
-// }
|
||||
-// int value;
|
||||
-// int ok = fscanf(in, "%d", &value);
|
||||
-// fclose(in);
|
||||
-// if( ok == EOF ) {
|
||||
-// value = 0;
|
||||
-// }
|
||||
-// return value;
|
||||
-// }
|
||||
-
|
||||
-
|
||||
-// static int read_backlight(char *driver)
|
||||
-// {
|
||||
-// char path[1024];
|
||||
-// sprintf(path, "/sys/class/backlight/%s/actual_brightness", driver);
|
||||
-// return read_int(path);
|
||||
-// }
|
||||
-
|
||||
-// static int read_max_backlight(char *driver)
|
||||
-// {
|
||||
-// char path[1024];
|
||||
-// sprintf(path, "/sys/class/backlight/%s/max_brightness", driver);
|
||||
-// return read_int(path);
|
||||
-// }
|
||||
-
|
||||
static char *get_driver()
|
||||
{
|
||||
return lxqt_backlight_backend_get_driver();
|
||||
|
||||
From 8ddd5354c6e5175d0674ff77ff7093d9b4fdba3e Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 16:52:42 +0200
|
||||
Subject: [PATCH 4/8] lxqtbacklight: constified char *driver, where appropriate
|
||||
|
||||
---
|
||||
lxqtbacklight/linux_backend/driver/libbacklight_backend.c | 12 ++++++------
|
||||
lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c | 4 ++--
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index c7ce7ab..bab2c48 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -69,9 +69,9 @@
|
||||
#define False 0
|
||||
|
||||
static FILE* open_driver_file(const char *path, const char *driver, const char *mode);
|
||||
-static int read_backlight(char *driver);
|
||||
-static int read_max_backlight(char *driver);
|
||||
-static int read_bl_power(char *driver);
|
||||
+static int read_backlight(const char *driver);
|
||||
+static int read_max_backlight(const char *driver);
|
||||
+static int read_bl_power(const char *driver);
|
||||
|
||||
int lxqt_backlight_backend_get()
|
||||
{
|
||||
@@ -152,17 +152,17 @@ static FILE* open_driver_file(const char *tpl, const char *driver, const char *m
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int read_backlight(char *driver)
|
||||
+static int read_backlight(const char *driver)
|
||||
{
|
||||
return read_int("/sys/class/backlight/%s/actual_brightness", driver);
|
||||
}
|
||||
|
||||
-static int read_max_backlight(char *driver)
|
||||
+static int read_max_backlight(const char *driver)
|
||||
{
|
||||
return read_int("/sys/class/backlight/%s/max_brightness", driver);
|
||||
}
|
||||
|
||||
-static int read_bl_power(char *driver)
|
||||
+static int read_bl_power(const char *driver)
|
||||
{
|
||||
return read_int("/sys/class/backlight/%s/bl_power", driver);
|
||||
}
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 3dc7d7e..4c895ae 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -33,7 +33,7 @@
|
||||
* @param driver is the driver to use
|
||||
* @param value 0 turns on backlight, 4 turns off backlight
|
||||
*/
|
||||
-static void set_bl_power(char *driver, int value)
|
||||
+static void set_bl_power(const char *driver, int value)
|
||||
{
|
||||
FILE *out = open_driver_file("/sys/class/backlight/%s/bl_power", driver, "w");
|
||||
if( out != NULL ) {
|
||||
@@ -43,7 +43,7 @@ static void set_bl_power(char *driver, int value)
|
||||
}
|
||||
|
||||
|
||||
-static void set_backlight(char *driver, int value)
|
||||
+static void set_backlight(const char *driver, int value)
|
||||
{
|
||||
if(value>0) {
|
||||
FILE *out = open_driver_file("/sys/class/backlight/%s/brightness", driver, "w");
|
||||
|
||||
From 25114361c2e3bd60f917dde86807b4f1e72e7dc3 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 17:11:08 +0200
|
||||
Subject: [PATCH 5/8] lxqtbacklight: centralized error output on empty
|
||||
backlight dir
|
||||
|
||||
- added missing newline to output
|
||||
- also catch error in --stdin case, this could lead to a SIGSEGV on some
|
||||
libc implementations and results in trying to open
|
||||
/sys/class/backlight/(null)/max_brightness with glibc.
|
||||
---
|
||||
.../linux_backend/driver/libbacklight_backend.c | 18 +++++++++++-------
|
||||
.../linux_backend/driver/lxqtbacklight_backend.c | 7 +++----
|
||||
2 files changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index bab2c48..484e3d5 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -72,12 +72,12 @@ static FILE* open_driver_file(const char *path, const char *driver, const char *
|
||||
static int read_backlight(const char *driver);
|
||||
static int read_max_backlight(const char *driver);
|
||||
static int read_bl_power(const char *driver);
|
||||
+static const char *sysfs_backlight_dir = "/sys/class/backlight";
|
||||
|
||||
int lxqt_backlight_backend_get()
|
||||
{
|
||||
char *driver = lxqt_backlight_backend_get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return -1;
|
||||
}
|
||||
int value = read_backlight(driver);
|
||||
@@ -89,7 +89,6 @@ int lxqt_backlight_backend_get_max()
|
||||
{
|
||||
char *driver = lxqt_backlight_backend_get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return -1;
|
||||
}
|
||||
int value = read_max_backlight(driver);
|
||||
@@ -108,7 +107,6 @@ int lxqt_backlight_is_backlight_off()
|
||||
{
|
||||
char *driver = lxqt_backlight_backend_get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return -1;
|
||||
}
|
||||
int bl_power = read_bl_power(driver);
|
||||
@@ -182,8 +180,8 @@ char *lxqt_backlight_backend_get_driver()
|
||||
for(n=0;n<N_BACKLIGHT;n++)
|
||||
drivers[n] = NULL;
|
||||
|
||||
- if ((dirp = opendir("/sys/class/backlight")) == NULL) {
|
||||
- perror("Couldn't open /sys/class/backlight");
|
||||
+ if ((dirp = opendir(sysfs_backlight_dir)) == NULL) {
|
||||
+ fprintf(stderr, "Couldn't open %s: %s\n", sysfs_backlight_dir, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -216,8 +214,9 @@ char *lxqt_backlight_backend_get_driver()
|
||||
|
||||
closedir(dirp);
|
||||
|
||||
- if (errno != 0)
|
||||
- perror("Error reading directory");
|
||||
+ if (errno != 0) {
|
||||
+ fprintf(stderr, "Error reading directory %s: %s\n", sysfs_backlight_dir, strerror(errno));
|
||||
+ }
|
||||
|
||||
driver = NULL;
|
||||
for(n=0;n<N_BACKLIGHT;n++) {
|
||||
@@ -227,6 +226,11 @@ char *lxqt_backlight_backend_get_driver()
|
||||
free(drivers[n]);
|
||||
}
|
||||
|
||||
+ if( driver == NULL )
|
||||
+ {
|
||||
+ fprintf(stderr, "Error: %s is empty (no driver found).\n", sysfs_backlight_dir);
|
||||
+ }
|
||||
+
|
||||
return driver;
|
||||
}
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 4c895ae..bcf2b9e 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -68,7 +68,6 @@ static void show_blacklight()
|
||||
{
|
||||
char *driver = get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return;
|
||||
}
|
||||
int max_value = read_max_backlight(driver);
|
||||
@@ -81,7 +80,6 @@ static void change_blacklight(int value, int percent_ok)
|
||||
{
|
||||
char *driver = get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return;
|
||||
}
|
||||
int max_value = read_max_backlight(driver);
|
||||
@@ -97,7 +95,6 @@ static void increases_blacklight()
|
||||
{
|
||||
char *driver = get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return;
|
||||
}
|
||||
int max_value = read_max_backlight(driver);
|
||||
@@ -118,7 +115,6 @@ static void decreases_blacklight()
|
||||
{
|
||||
char *driver = get_driver();
|
||||
if( driver == NULL ) {
|
||||
- fprintf(stderr, "Error: /sys/class/backlight is empty.");
|
||||
return;
|
||||
}
|
||||
int max_value = read_max_backlight(driver);
|
||||
@@ -140,6 +136,9 @@ static void set_backlight_from_stdin()
|
||||
char *driver = get_driver();
|
||||
int ok = True, value;
|
||||
int max_value = read_max_backlight(driver);
|
||||
+ if( driver == NULL ) {
|
||||
+ return;
|
||||
+ }
|
||||
while(ok && !feof(stdin)) {
|
||||
ok = scanf("%d", &value);
|
||||
if( ok != EOF && value > 0 && value <= max_value) {
|
||||
|
||||
From 3b1610dd32e015b2625008235be44f51cae4a8c8 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 17:23:49 +0200
|
||||
Subject: [PATCH 6/8] lxqtbacklight: removed extra whitespace
|
||||
|
||||
---
|
||||
lxqtbacklight/linux_backend/driver/libbacklight_backend.c | 6 +++---
|
||||
lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c | 6 +++---
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index 484e3d5..733fe9e 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -171,12 +171,12 @@ char *lxqt_backlight_backend_get_driver()
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
-
|
||||
+
|
||||
char *drivers[N_BACKLIGHT];
|
||||
char *driver;
|
||||
int n;
|
||||
char type[1024];
|
||||
-
|
||||
+
|
||||
for(n=0;n<N_BACKLIGHT;n++)
|
||||
drivers[n] = NULL;
|
||||
|
||||
@@ -217,7 +217,7 @@ char *lxqt_backlight_backend_get_driver()
|
||||
if (errno != 0) {
|
||||
fprintf(stderr, "Error reading directory %s: %s\n", sysfs_backlight_dir, strerror(errno));
|
||||
}
|
||||
-
|
||||
+
|
||||
driver = NULL;
|
||||
for(n=0;n<N_BACKLIGHT;n++) {
|
||||
if( drivers[n] != NULL && driver == NULL )
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index bcf2b9e..3e545a8 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
} if( !strcmp(argv[n], "--dec") ) {
|
||||
decreases_blacklight();
|
||||
- return 0;
|
||||
+ return 0;
|
||||
} if( !strcmp(argv[n], "--stdin") ) {
|
||||
set_backlight_from_stdin();
|
||||
return 0;
|
||||
@@ -195,12 +195,12 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
if( argc == 1 ) {
|
||||
help(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+
|
||||
change_blacklight(value, value_percent_ok);
|
||||
|
||||
return 0;
|
||||
|
||||
From f5c4cc47f60c674df2cc8a93343526a69c54a1aa Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Wed, 13 Jun 2018 18:01:36 +0200
|
||||
Subject: [PATCH 7/8] lxqtbacklight: fix and improve command line parameter
|
||||
handling
|
||||
|
||||
- the percent variant didn't work before, because the logic was wrong
|
||||
- detect non-numerical unsupported arguments and print usage in this case
|
||||
- support 0% and 100% but avoid turning off the backlight completely
|
||||
---
|
||||
.../linux_backend/driver/lxqtbacklight_backend.c | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 3e545a8..836e3f3 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <ctype.h>
|
||||
|
||||
#include "libbacklight_backend.h"
|
||||
#include "libbacklight_backend.c"
|
||||
@@ -83,9 +84,14 @@ static void change_blacklight(int value, int percent_ok)
|
||||
return;
|
||||
}
|
||||
int max_value = read_max_backlight(driver);
|
||||
- if(percent_ok)
|
||||
+ if(percent_ok) {
|
||||
value = (float)(max_value*value)/100.0;
|
||||
- if(value<max_value && value>0) {
|
||||
+ if( value == 0 ) {
|
||||
+ // avoid switching off backlight but support zero as lowest value
|
||||
+ value = 1;
|
||||
+ }
|
||||
+ }
|
||||
+ if(value<=max_value && value>0) {
|
||||
set_backlight(driver, value);
|
||||
}
|
||||
free(driver);
|
||||
@@ -186,10 +192,10 @@ int main(int argc, char *argv[])
|
||||
} if( !strcmp(argv[n], "--stdin") ) {
|
||||
set_backlight_from_stdin();
|
||||
return 0;
|
||||
- } else if ( argv[n][0] != '-' ) {
|
||||
- value = atoi(argv[1]);
|
||||
- } else if ( argv[n][0] != '%' && strlen(argv[n])==1 ) {
|
||||
+ } else if ( !strcmp(argv[n], "%") ) {
|
||||
value_percent_ok = True;
|
||||
+ } else if ( isdigit(argv[n][0]) ) {
|
||||
+ value = atoi(argv[n]);
|
||||
} else {
|
||||
help(argv[0]);
|
||||
return 0;
|
||||
|
||||
From 7bd68881d6a65541437f2e4dfad0f6749b12034b Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Date: Thu, 14 Jun 2018 11:28:14 +0200
|
||||
Subject: [PATCH 8/8] lxqtbacklight: only pass basename into open_driver_file()
|
||||
|
||||
this way the sysfs directory path is centrally defined and the code
|
||||
becomes better readable.
|
||||
---
|
||||
.../linux_backend/driver/libbacklight_backend.c | 18 +++++++++---------
|
||||
.../linux_backend/driver/lxqtbacklight_backend.c | 4 ++--
|
||||
2 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
index 733fe9e..1282706 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/libbacklight_backend.c
|
||||
@@ -68,7 +68,7 @@
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
-static FILE* open_driver_file(const char *path, const char *driver, const char *mode);
|
||||
+static FILE* open_driver_file(const char *file, const char *driver, const char *mode);
|
||||
static int read_backlight(const char *driver);
|
||||
static int read_max_backlight(const char *driver);
|
||||
static int read_bl_power(const char *driver);
|
||||
@@ -114,9 +114,9 @@ int lxqt_backlight_is_backlight_off()
|
||||
return bl_power;
|
||||
}
|
||||
|
||||
-static int read_int(const char *tpl, const char *driver)
|
||||
+static int read_int(const char *file, const char *driver)
|
||||
{
|
||||
- FILE *in = open_driver_file(tpl, driver, "r");
|
||||
+ FILE *in = open_driver_file(file, driver, "r");
|
||||
if( in == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
@@ -129,12 +129,12 @@ static int read_int(const char *tpl, const char *driver)
|
||||
return value;
|
||||
}
|
||||
|
||||
-static FILE* open_driver_file(const char *tpl, const char *driver, const char *mode)
|
||||
+static FILE* open_driver_file(const char *file, const char *driver, const char *mode)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
int res;
|
||||
|
||||
- res = snprintf(path, PATH_MAX, tpl, driver);
|
||||
+ res = snprintf(path, PATH_MAX, "%s/%s/%s", sysfs_backlight_dir, driver, file);
|
||||
|
||||
if( res <= 0 || res >= PATH_MAX ) {
|
||||
path[0] = '\0';
|
||||
@@ -152,17 +152,17 @@ static FILE* open_driver_file(const char *tpl, const char *driver, const char *m
|
||||
|
||||
static int read_backlight(const char *driver)
|
||||
{
|
||||
- return read_int("/sys/class/backlight/%s/actual_brightness", driver);
|
||||
+ return read_int("actual_brightness", driver);
|
||||
}
|
||||
|
||||
static int read_max_backlight(const char *driver)
|
||||
{
|
||||
- return read_int("/sys/class/backlight/%s/max_brightness", driver);
|
||||
+ return read_int("max_brightness", driver);
|
||||
}
|
||||
|
||||
static int read_bl_power(const char *driver)
|
||||
{
|
||||
- return read_int("/sys/class/backlight/%s/bl_power", driver);
|
||||
+ return read_int("bl_power", driver);
|
||||
}
|
||||
|
||||
typedef enum {FIRMWARE, PLATFORM, RAW, OTHER, N_BACKLIGHT} BackligthTypes;
|
||||
@@ -191,7 +191,7 @@ char *lxqt_backlight_backend_get_driver()
|
||||
if( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") )
|
||||
continue;
|
||||
driver = dp->d_name;
|
||||
- FILE *in = open_driver_file("/sys/class/backlight/%s/type", driver, "r");
|
||||
+ FILE *in = open_driver_file("type", driver, "r");
|
||||
if( in == NULL )
|
||||
continue;
|
||||
// the maximum field width does not include '\0'!
|
||||
diff --git a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
index 836e3f3..8886a74 100644
|
||||
--- a/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
+++ b/lxqtbacklight/linux_backend/driver/lxqtbacklight_backend.c
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
static void set_bl_power(const char *driver, int value)
|
||||
{
|
||||
- FILE *out = open_driver_file("/sys/class/backlight/%s/bl_power", driver, "w");
|
||||
+ FILE *out = open_driver_file("bl_power", driver, "w");
|
||||
if( out != NULL ) {
|
||||
fprintf(out, "%d", value);
|
||||
fclose(out);
|
||||
@@ -47,7 +47,7 @@ static void set_bl_power(const char *driver, int value)
|
||||
static void set_backlight(const char *driver, int value)
|
||||
{
|
||||
if(value>0) {
|
||||
- FILE *out = open_driver_file("/sys/class/backlight/%s/brightness", driver, "w");
|
||||
+ FILE *out = open_driver_file("brightness", driver, "w");
|
||||
if( out != NULL ) {
|
||||
fprintf(out, "%d", value);
|
||||
fclose(out);
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b41db9dd6fcc4e3232402ee0304d2b977ec82d696c464667dddba555b0056a39
|
||||
size 56896
|
@ -1,16 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCgAdFiEEfHM7pfWFqtZp5NI6QsnI069epeMFAlsC/fUACgkQQsnI069e
|
||||
peOCzw/9Fpe0RMclYas9UUg6JkkLRMuV/xarTXpruWPZ+r/3m3v+W08roceaKoJz
|
||||
yzJmzPnEER0wCAtRUogApzRHnoDzyjOmXzsnN9U4eB/bE6UwpZh5ewm2MUMIDOHL
|
||||
SjGblsn4ykWUzUqxmOhFrjcyhCjbvTmUdvo5Kj7kwVLl0o1V0jSE1uyHCu5C8kls
|
||||
8zfg7IfyNfKHTZbXOe1gOem0fhhmfiS3hg65YDjVuTfWge4uFYq+gzNdUKAMOnHB
|
||||
yVvRB/SMswLTGsJt3/rN5LLNqOigFeyxbYhjpL+HGszu2FrQq46HBw9pOYxhj2YM
|
||||
KTo8ek7DnTb9X1flDrxeb7f67585gw0EMDBa8WeNRykk32Me2hOYA9mYYkYUNex2
|
||||
sSnthoyEmASn+vVM3T3QmBnNVNW8cOtI4dtlqLceStqhQ35tZXzouYOnFlZInCSp
|
||||
RTkwiD3In4XmP0UmQdiAe53THo6KfYSGKEGcza83kK/QiGzFpgCCMjHtXF6PIPoV
|
||||
186HmJYUqUdeyY+QCDRqWvgz+7T1zm73xT4Y2T06u5fJIivCZWnUVfueqC/UEJ5u
|
||||
tnxpFcL4yoQhz+sKAr62oArE09TQjgfaX2qw1v9Nfle9xWmXTVNkRuVPcpGrFO9f
|
||||
VWJY7asqUMq8sHCV+P8eWrcQb/rCmZrSE2JHenaOe6rNHF/MCs0=
|
||||
=H5JZ
|
||||
-----END PGP SIGNATURE-----
|
3
liblxqt-0.14.1.tar.xz
Normal file
3
liblxqt-0.14.1.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1aa7325654d20d3060a0ef0ffc27febfd58ee66704ee690727dc1a77ad1069bd
|
||||
size 81704
|
16
liblxqt-0.14.1.tar.xz.asc
Normal file
16
liblxqt-0.14.1.tar.xz.asc
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCgAdFiEEfHM7pfWFqtZp5NI6QsnI069epeMFAlxyySAACgkQQsnI069e
|
||||
peOEBxAAlBHXTzY3Kd0JX62NojA4+myE8ruGMbA7W2qC9FlKxC7wFkLXqRUqky3B
|
||||
alUayJc0+CY4ZjXN5jwuVtvjWpVEThj8Aon0klmh+VRqakQI33VbT8jaEERQtbyh
|
||||
+4o0isu6roA9IeoEpj8wpJ3XCuDJ/lNXxlMRowRViWdpR0SMWogGaBeGFsO22g8U
|
||||
6/54XJ4QqJkLBnfbzLgm9yb/pA/AHJsmNUMBlm/lt6Q81i05pkcOMe1tfBCpegxQ
|
||||
Cnc47mtma8vKS7cB1Yj7utfdr7vzCrW9hman3jSADGphfKFZY7zBlTVLIErr9EY/
|
||||
5yLodUSyPbBCfZkx9aVU3qqGie/59AnxFBrJ6W+6lLZFdqnUuyBT8gxwujl3EqLF
|
||||
D6oAk/JhUMWWx0u/3YFJYZwQFC9ZCqe/s81Rq7dJ+FPjkUD0Xp/e0EIrRab+7Cny
|
||||
DBbEOEySlzTwD9ubcRk585czixuajOq2W7NPxPaq9RH2e/xGzE0lKPVnjwtEHrNx
|
||||
1ElNuXXxoXqPtRSiEhGSfUt8SqPEUIzh8orC0lFNdhMsmLhOZC9cSP+9VEON95WZ
|
||||
wE67FAJi7mX70noZkMuuvS3MLSnvcEx9AUyIbrujw8zvHlxqdE1ko5AQGc0V1nCl
|
||||
V4wcUQqOwLU3rgvfeCbNpiDD8xwQcj7Fiit4+2mzzlwrAJISY+0=
|
||||
=C8rm
|
||||
-----END PGP SIGNATURE-----
|
@ -1,3 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 25 10:06:01 UTC 2019 - mvetter@suse.com
|
||||
|
||||
- Update to 0.14.1:
|
||||
* Bumped version to 0.14.1
|
||||
* Enable/disable a standard button if it exists. This is needed for adding
|
||||
Apply button later because Apply button should be enabled/disabled
|
||||
appropriately.
|
||||
* Updated translations
|
||||
* Note for packagers: liblxqt now depend on libqtxdg 3.3.1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 31 09:39:31 UTC 2019 - Michael Vetter <mvetter@suse.com>
|
||||
|
||||
- Update to 0.14.0:
|
||||
* Added missing text color of our HTML delegate
|
||||
* lxqtbacklight: fix and improve command line parameter handling
|
||||
* lxqthtmldelegate: Position, alignment and size fixes for HTML delegate
|
||||
* lxqtpageselectwidget: Fix config dialog cell height
|
||||
* lxqtpageselectwidget: Fixed config dialog select widget cells
|
||||
- Remove liblxqt-0.13.0-backlight.patch: upstreamed
|
||||
- Move translation from lxqt-l10n into package
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 20 13:17:20 UTC 2018 - mvetter@suse.com
|
||||
|
||||
|
27
liblxqt.spec
27
liblxqt.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package liblxqt
|
||||
#
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,36 +17,39 @@
|
||||
|
||||
|
||||
Name: liblxqt
|
||||
Version: 0.13.0
|
||||
Version: 0.14.1
|
||||
Release: 0
|
||||
Summary: Core utility library for LXQt
|
||||
License: LGPL-2.1+
|
||||
License: LGPL-2.1-or-later
|
||||
Group: Development/Libraries/C and C++
|
||||
Url: http://www.lxqt.org
|
||||
Source: https://github.com/lxqt/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
|
||||
Source1: https://github.com/lxqt/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc
|
||||
Source2: %{name}.keyring
|
||||
Patch0: liblxqt-0.13.0-backlight.patch
|
||||
BuildRequires: cmake >= 3.0.2
|
||||
BuildRequires: cmake >= 3.1.0
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: lxqt-build-tools-devel >= 0.5.0
|
||||
BuildRequires: cmake(KF5WindowSystem)
|
||||
BuildRequires: libqt5xdg-devel >= 3.3.1
|
||||
BuildRequires: lxqt-build-tools-devel >= 0.6.0
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: cmake(KF5WindowSystem)
|
||||
BuildRequires: pkgconfig(Qt5DBus)
|
||||
BuildRequires: pkgconfig(Qt5UiTools)
|
||||
BuildRequires: pkgconfig(polkit-qt5-1)
|
||||
BuildRequires: pkgconfig(Qt5X11Extras)
|
||||
BuildRequires: pkgconfig(Qt5Xdg) >= 3.1.0
|
||||
BuildRequires: pkgconfig(polkit-qt5-1)
|
||||
BuildRequires: pkgconfig(x11)
|
||||
BuildRequires: pkgconfig(xscrnsaver)
|
||||
Obsoletes: liblxqt-qt5 < %{version}
|
||||
Provides: liblxqt-qt5 = %{version}
|
||||
Recommends: %{name}-lang
|
||||
|
||||
%description
|
||||
liblxqt represents the core library of LXQt providing essential
|
||||
functionality needed by nearly all of its components.
|
||||
|
||||
%lang_package
|
||||
|
||||
%package -n liblxqt0
|
||||
Summary: LXQt core library
|
||||
Group: System/Libraries
|
||||
@ -73,7 +76,6 @@ applications that want to make use of liblxqt.
|
||||
|
||||
%prep
|
||||
%setup -q -n liblxqt-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%cmake -DPULL_TRANSLATIONS=No
|
||||
@ -82,6 +84,8 @@ make %{?_smp_mflags}
|
||||
%install
|
||||
%cmake_install
|
||||
|
||||
%find_lang %{name} --with-qt
|
||||
|
||||
%post -n liblxqt0 -p /sbin/ldconfig
|
||||
|
||||
%postun -n liblxqt0 -p /sbin/ldconfig
|
||||
@ -103,4 +107,9 @@ make %{?_smp_mflags}
|
||||
%{_libdir}/pkgconfig/lxqt.pc
|
||||
%{_libdir}/%{name}.so
|
||||
|
||||
%files lang -f %{name}.lang
|
||||
%dir %{_datadir}/lxqt
|
||||
%dir %{_datadir}/lxqt/translations
|
||||
%dir %{_datadir}/lxqt/translations/liblxqt
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user