Compare commits

...

60 Commits
v15.1 ... v15.3

Author SHA1 Message Date
o9000
d8770ed590 Release 15.3 2017-11-05 12:28:35 +01:00
o9000
be7873a688 Update release script 2017-11-05 12:28:02 +01:00
o9000
cf81f1c9f9 Update release script 2017-11-05 12:27:05 +01:00
o9000
cde05df1bc Update release script 2017-11-05 12:24:46 +01:00
o9000
5fee459945 Update changelog 2017-11-05 12:19:56 +01:00
o9000
6d67291928 Update release script 2017-11-05 12:18:24 +01:00
o9000
4171e23153 Do not run regression tests more than once for a commit 2017-10-16 11:09:56 +02:00
o9000
725f625aba Use correct whitespace in debian/rules (makefile) 2017-10-15 20:48:28 +02:00
o9000
a6ea1eb5a9 Packaging: Workaround cmake issues 2017-10-15 20:41:46 +02:00
o9000
14b983cd0c Packaging: Workaround cmake issues 2017-10-15 20:30:39 +02:00
o9000
23ddb47e0c Reset signal mask at startup 2017-10-15 13:07:12 +02:00
o9000
407aef3786 Reset signal mask before executing commands (issue #674) 2017-10-15 13:00:18 +02:00
o9000
50c7bf77de Do not hardcode path to /etc 2017-10-04 19:15:44 +02:00
o9000
9a7d5a1a51 Release 15.2 2017-10-01 18:45:36 +02:00
o9000
031bd23849 Print tint2: before geometry dumps 2017-10-01 18:33:53 +02:00
o9000
7e2dc91ce7 Silence warning 2017-10-01 14:04:34 +02:00
o9000
c7a81655c4 Merge branch 'warning' into 'master'
Fix warning ISO C does not support __FUNCTION__

See merge request o9000/tint2!28
2017-10-01 11:54:43 +00:00
fafryd
9aa50104db Fix warning ISO C does not support __FUNCTION__
"warning: ISO C does not support ‘__FUNCTION__’ predefined identifier"

Among others -Wpedantic now warns about non-standard predefined identifiers.
The fix is either to use the standard predefined identifier __func__ (since C99),
or to use the __extension__ keyword.
2017-10-01 09:37:05 +02:00
o9000
3320ee8e05 Regression testing 2017-09-29 10:32:24 +02:00
o9000
ec380e25ec Regression testing 2017-09-28 20:06:39 +02:00
o9000
e1b29d0204 Regression testing 2017-09-28 19:39:30 +02:00
o9000
13313f64c5 Regression testing 2017-09-28 19:18:34 +02:00
o9000
9cb64e9cf5 Regression testing 2017-09-28 19:10:10 +02:00
o9000
fd0a1bef65 Regression testing 2017-09-28 18:51:07 +02:00
o9000
ae9ae098cc Regression testing 2017-09-28 18:47:42 +02:00
o9000
18f49d0d52 Regression testing 2017-09-28 18:39:15 +02:00
o9000
a57b6a4706 Regression testing 2017-09-28 18:38:54 +02:00
o9000
f8aa84a91b Regression testing 2017-09-28 18:36:34 +02:00
o9000
0154fe6a5a Regression testing 2017-09-28 15:59:29 +02:00
o9000
6f96818438 Regression testing 2017-09-28 15:43:12 +02:00
o9000
6433767a98 Regression testing 2017-09-28 15:39:10 +02:00
o9000
f8037b7ff5 Regression testing 2017-09-28 15:19:51 +02:00
o9000
7dddd4a5a2 Regression testing 2017-09-28 15:15:00 +02:00
o9000
85ac37d019 Regression testing 2017-09-28 15:11:31 +02:00
o9000
499b2bd938 Regression testing 2017-09-28 15:09:57 +02:00
o9000
5302fb4ba7 Regression testing 2017-09-28 15:08:26 +02:00
o9000
b58a6512b3 Update changelog 2017-09-28 12:27:26 +02:00
o9000
e38ccf5376 Remember window order on panel restart (issue #615) 2017-09-28 12:26:46 +02:00
o9000
3c9a0ff2f7 Updated changelog 2017-09-28 11:28:17 +02:00
o9000
b8675fa208 Compute text size correctly (issue #671) 2017-09-28 11:23:31 +02:00
o9000
ddac8f7802 Battery: add data gathering script 2017-09-17 15:20:38 +02:00
o9000
c21930de2b Battery: check that data files are readable and non-empty 2017-09-17 14:26:29 +02:00
o9000
f2cc1b68c1 More battery data 2017-09-17 14:12:41 +02:00
o9000
fc61676732 Battery: Do not show time remaining if rate is zero 2017-09-17 14:09:48 +02:00
o9000
1772d0a894 More battery data 2017-09-17 14:04:07 +02:00
o9000
3de424b129 Allow batteries that do not provide the charging rate 2017-09-17 14:04:03 +02:00
o9000
d8c289e0cc More battery data 2017-09-17 13:50:58 +02:00
o9000
5a17bb2fda Update packaging info script 2017-09-12 23:41:06 +02:00
o9000
c45b06657a Update packaging info script 2017-09-12 23:38:21 +02:00
o9000
7666077c63 Update packaging info script 2017-09-12 23:34:53 +02:00
o9000
542aa56840 Update packaging info script 2017-09-12 23:28:49 +02:00
o9000
d2f990366b Update packaging info script 2017-09-12 23:26:27 +02:00
o9000
1480faf32f Update packaging info script 2017-09-12 23:15:12 +02:00
o9000
38ff3318eb Update packaging info script 2017-09-12 23:14:08 +02:00
o9000
5bd253c0da Update packaging info script 2017-09-12 23:07:57 +02:00
o9000
9e94ee15e4 Update packaging info script 2017-09-12 22:56:25 +02:00
o9000
a026cd91fe Update memory reporting script 2017-09-12 22:36:52 +02:00
o9000
a52c45bd08 Remove duplicate entry 2017-09-12 22:36:30 +02:00
o9000
88c91aae25 Update version checker 2017-09-12 22:36:13 +02:00
o9000
b793544cf8 Add memory analysis script 2017-09-11 19:02:02 +02:00
124 changed files with 874 additions and 126 deletions

View File

@@ -188,7 +188,6 @@ endif( ENABLE_SN)
if( ENABLE_UEVENT )
add_definitions( -DENABLE_UEVENT )
set( SOURCES ${SOURCES} src/util/uevent.c)
endif( ENABLE_UEVENT )
if(ENABLE_BACKTRACE)
@@ -274,7 +273,7 @@ set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasin
install( TARGETS tint2 DESTINATION bin )
install( FILES tint2.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
install( FILES tint2.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
install( FILES themes/tint2rc DESTINATION /etc/xdg/tint2 )
install( FILES themes/tint2rc DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/tint2 )
install( FILES default_icon.png DESTINATION ${CMAKE_INSTALL_DATADIR}/tint2 )
install( FILES AUTHORS ChangeLog README.md doc/tint2.md DESTINATION ${docdir} )
install( FILES doc/manual.html doc/readme.html DESTINATION ${htmldir} )

View File

@@ -1,3 +1,14 @@
2017-11-05 15.3
- Fixes:
- Launcher: Reset signal mask before executing commands (issue #674)
- cmake: Do not hardcode path to /etc
2017-10-01 15.2
- Fixes:
- Battery info is now again displayed even when current sensor is missing (https://github.com/jmc-88/tint3/issues/34)
- Text elements compute their size correctly (issue #671)
- Window order persists on panel restart (issue #615)
2017-09-08 15.1
- Fixes:
- Fixed build on non-Linux and non-x86 systems
@@ -952,3 +963,5 @@ released tint-0.2
while the projet is no longer in developpement, have not changed the name of 'tint'.
.
.
.
.

View File

@@ -1,5 +1,5 @@
# Latest stable release: 15.1
Changes: https://gitlab.com/o9000/tint2/blob/15.1/ChangeLog
# Latest stable release: 15.3
Changes: https://gitlab.com/o9000/tint2/blob/15.3/ChangeLog
Documentation: [doc/tint2.md](doc/tint2.md)
@@ -8,7 +8,7 @@ Compile it with (after you install the [dependencies](https://gitlab.com/o9000/t
```
git clone https://gitlab.com/o9000/tint2.git
cd tint2
git checkout 15.1
git checkout 15.3
mkdir build
cd build
cmake ..

View File

@@ -199,9 +199,9 @@ pre {
</style>
</head>
<body>
<h1 id="latest-stable-release-15-1"><span class="md2man-title">Latest</span> <span class="md2man-section">stable</span> <span class="md2man-date">release:</span> <span class="md2man-source">15.1</span><a name="latest-stable-release-15-1" href="#latest-stable-release-15-1" class="md2man-permalink" title="permalink"></a></h1><p>Changes: <a href="https://gitlab.com/o9000/tint2/blob/15.1/ChangeLog">https://gitlab.com/o9000/tint2/blob/15.1/ChangeLog</a></p><p>Documentation: <a href="manual.html">manual.html</a></p><p>Compile it with (after you install the <a href="https://gitlab.com/o9000/tint2/wikis/Install#dependencies">dependencies</a>):</p><pre class="highlight plaintext"><code>git clone https://gitlab.com/o9000/tint2.git
<h1 id="latest-stable-release-15-3"><span class="md2man-title">Latest</span> <span class="md2man-section">stable</span> <span class="md2man-date">release:</span> <span class="md2man-source">15.3</span><a name="latest-stable-release-15-3" href="#latest-stable-release-15-3" class="md2man-permalink" title="permalink"></a></h1><p>Changes: <a href="https://gitlab.com/o9000/tint2/blob/15.3/ChangeLog">https://gitlab.com/o9000/tint2/blob/15.3/ChangeLog</a></p><p>Documentation: <a href="manual.html">manual.html</a></p><p>Compile it with (after you install the <a href="https://gitlab.com/o9000/tint2/wikis/Install#dependencies">dependencies</a>):</p><pre class="highlight plaintext"><code>git clone https://gitlab.com/o9000/tint2.git
cd tint2
git checkout 15.1
git checkout 15.3
mkdir build
cd build
cmake ..

View File

@@ -1,4 +1,4 @@
.TH TINT2 1 "2017\-09\-08" 15.1
.TH TINT2 1 "2017\-11\-05" 15.3
.SH NAME
.PP
tint2 \- lightweight panel/taskbar

View File

@@ -1,4 +1,4 @@
# TINT2 1 "2017-09-08" 15.1
# TINT2 1 "2017-11-05" 15.3
## NAME
tint2 - lightweight panel/taskbar

View File

@@ -190,3 +190,7 @@ if __name__ == '__main__':
run("cd tint2-%s ; mkdir build ; cd build ; cmake .. ; make" % readable_version)
assert_equal(run("./tint2-%s/build/tint2 -v" % readable_version).strip(), "tint2 version %s" % readable_version)
os.system("git log -p -1 --word-diff")
print "Does this look correct? [y/n]"
choice = raw_input().lower()
if choice != "y":
run("git reset --hard HEAD~ ; git tag -d %s ; git tag -d %s" % (version, readable_version))

View File

@@ -4,7 +4,7 @@
dh $@
override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo
dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_SYSCONFDIR=/etc
override_dh_auto_install:
dh_auto_install --destdir=$(CURDIR)/debian/tmp

View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -e
set -x
[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :
exec > ~/tint2.runner-version.log
exec 2>&1
cd ~/tint2.wiki
git reset --hard
git pull
~/tint2/packaging/version_status.py > packaging.tmp.md
cat packaging.tmp.md > packaging.md
rm packaging.tmp.md
git commit -am 'Update packaging info'
git push origin master

View File

@@ -161,12 +161,14 @@ def get_debian_release_version(release):
def get_debian_versions():
print >> sys.stderr, "Debian ..."
return "Debian", "debian", [get_debian_release_version(release) for release in ["stable", "testing", "unstable", "experimental"]]
# Ubuntu
def get_ubuntu_versions():
print >> sys.stderr, "Ubuntu ..."
data = http_download_txt("https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&source_name=tint2&exact_match=true")
data = json.loads(data)["entries"]
data.reverse()
@@ -183,6 +185,7 @@ def get_ubuntu_versions():
# BunsenLabs
def get_bunsenlabs_versions():
print >> sys.stderr, "BunsenLabs ..."
dirs = http_list_dir("https://eu.pkg.bunsenlabs.org/debian/dists/")
versions = []
for d in dirs:
@@ -198,6 +201,7 @@ def get_bunsenlabs_versions():
# Arch
def get_arch_versions():
print >> sys.stderr, "Arch ..."
pkgbuild = http_download_txt("https://git.archlinux.org/svntogit/community.git/plain/trunk/PKGBUILD?h=packages/tint2")
version, maintainer = arch_pkgbuild_extract_version(pkgbuild)
return "Arch Linux", "archlinux", [("Community", version, maintainer)]
@@ -206,6 +210,7 @@ def get_arch_versions():
# Fedora
def get_fedora_versions():
print >> sys.stderr, "Fedora ..."
dirs = http_list_dir("http://mirror.switch.ch/ftp/mirror/fedora/linux/development/")
versions = []
for d in dirs:
@@ -224,6 +229,7 @@ def get_fedora_versions():
# Red Hat (EPEL)
def get_redhat_epel_versions():
print >> sys.stderr, "RedHat ..."
dirs = http_list_dir("http://mirror.switch.ch/ftp/mirror/epel/")
versions = []
for d in dirs:
@@ -242,12 +248,13 @@ def get_redhat_epel_versions():
# SUSE
def get_suse_versions():
print >> sys.stderr, "Suse ..."
ftp = ftplib.FTP("mirror.switch.ch")
ftp.login()
releases, _ = ftp_list_dir(ftp, "/mirror/opensuse/opensuse/distribution/leap/")
releases, _ = ftp_list_dir(ftp, "/mirror/opensuse/opensuse/ports/update/leap/")
versions = []
for release in releases:
root = "/mirror/opensuse/opensuse/distribution/leap/{0}/repo/oss/suse/repodata/".format(release)
root = "/mirror/opensuse/opensuse/ports/update/leap/{0}/oss/repodata/".format(release)
_, files = ftp_list_dir(ftp, root)
for fname in files:
if fname.endswith("-primary.xml.gz"):
@@ -266,6 +273,7 @@ def get_suse_versions():
# Gentoo
def get_gentoo_versions():
print >> sys.stderr, "Gentoo ..."
files = http_list_dir("https://gitweb.gentoo.org/repo/gentoo.git/tree/x11-misc/tint2")
versions = []
for f in files:
@@ -280,6 +288,7 @@ def get_gentoo_versions():
# Void
def get_void_versions():
print >> sys.stderr, "Void ..."
template = http_download_txt("https://raw.githubusercontent.com/voidlinux/void-packages/master/srcpkgs/tint2/template")
versions = []
version = None
@@ -297,6 +306,7 @@ def get_void_versions():
# Alpine
def get_alpine_versions():
print >> sys.stderr, "Alpine ..."
apkbuild = http_download_txt("https://git.alpinelinux.org/cgit/aports/plain/community/tint2/APKBUILD")
versions = []
version = None
@@ -314,6 +324,7 @@ def get_alpine_versions():
# Slackware
def get_slack_versions():
print >> sys.stderr, "Slackware ..."
dirs = http_list_dir("https://slackbuilds.org/slackbuilds/")
versions = []
for d in dirs:
@@ -337,6 +348,7 @@ def get_slack_versions():
# FreeBSD
def get_freebsd_versions():
print >> sys.stderr, "FreeBSD ..."
makefile = http_download_txt("https://svnweb.freebsd.org/ports/head/x11/tint/Makefile?view=co")
versions = []
version = None
@@ -354,6 +366,7 @@ def get_freebsd_versions():
# OpenBSD
def get_openbsd_versions():
print >> sys.stderr, "OpenBSD ..."
makefile = http_download_txt("http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/x11/tint2/Makefile?rev=1.5&content-type=text/plain")
versions = []
version = None
@@ -368,6 +381,7 @@ def get_openbsd_versions():
# Upstream
def get_tint2_version():
print >> sys.stderr, "Upstream ..."
readme = http_download_txt("https://gitlab.com/o9000/tint2/raw/master/README.md")
version = readme.split("\n", 1)[0].split(":", 1)[-1].strip()
return version
@@ -381,7 +395,7 @@ def main():
distros.append(get_ubuntu_versions())
distros.append(get_fedora_versions())
distros.append(get_redhat_epel_versions())
distros.append(get_suse_versions())
#distros.append(get_suse_versions())
distros.append(get_alpine_versions())
distros.append(get_slack_versions())
distros.append(get_arch_versions())

View File

@@ -197,7 +197,7 @@ void battery_update_text(char *dest, char *format)
if (battery_state.state == BATTERY_FULL) {
snprintf(buf, sizeof(buf), "Full");
strnappend(dest, buf, BATTERY_BUF_SIZE);
} else {
} else if (battery_state.time.hours > 0 && battery_state.time.minutes > 0) {
snprintf(buf, sizeof(buf), "%02d:%02d", battery_state.time.hours, battery_state.time.minutes);
strnappend(dest, buf, BATTERY_BUF_SIZE);
}

View File

@@ -60,6 +60,20 @@ struct psy_mains {
gboolean online;
};
static gboolean is_file_non_empty(const char *path)
{
FILE *f = fopen(path, "r");
if (!f)
return FALSE;
char buffer[1024];
size_t count = fread(buffer, 1, sizeof(buffer), f);
fclose(f);
if (count > 0)
return TRUE;
else
return FALSE;
}
static void uevent_battery_update()
{
update_battery_tick(NULL);
@@ -73,11 +87,11 @@ static void uevent_battery_plug()
}
static struct uevent_notify psy_plug = {UEVENT_ADD | UEVENT_REMOVE, "power_supply", NULL, uevent_battery_plug};
#define RETURN_ON_ERROR(err) \
if (err) { \
g_error_free(err); \
#define RETURN_ON_ERROR(err) \
if (err) { \
g_error_free(err); \
fprintf(stderr, RED "tint2: %s:%d: errror" RESET "\n", __FILE__, __LINE__); \
return FALSE; \
return FALSE; \
}
static GList *batteries = NULL;
@@ -96,12 +110,13 @@ static enum psy_type power_supply_get_type(const gchar *entryname)
gsize typelen;
g_file_get_contents(path_type, &type, &typelen, &error);
g_free(path_type);
if (error) {
fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__);
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, path_type);
g_free(path_type);
g_error_free(error);
return PSY_UNKNOWN;
}
g_free(path_type);
if (!g_strcmp0(type, "Battery\n")) {
g_free(type);
@@ -123,8 +138,8 @@ static gboolean init_linux_battery(struct psy_battery *bat)
const gchar *entryname = bat->name;
bat->path_present = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "present", NULL);
if (!g_file_test(bat->path_present, G_FILE_TEST_EXISTS)) {
fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__);
if (!is_file_non_empty(bat->path_present)) {
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, bat->path_present);
goto err0;
}
@@ -135,9 +150,8 @@ static gboolean init_linux_battery(struct psy_battery *bat)
bat->path_rate_now = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "power_now", NULL);
bat->unit = 'W';
if (!g_file_test(bat->path_level_now, G_FILE_TEST_EXISTS) ||
!g_file_test(bat->path_level_full, G_FILE_TEST_EXISTS) ||
!g_file_test(bat->path_rate_now, G_FILE_TEST_EXISTS)) {
if (!is_file_non_empty(bat->path_level_now) ||
!is_file_non_empty(bat->path_level_full)) {
g_free(bat->path_level_now);
g_free(bat->path_level_full);
g_free(bat->path_rate_now);
@@ -149,16 +163,18 @@ static gboolean init_linux_battery(struct psy_battery *bat)
g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "current_now", NULL);
bat->unit = 'A';
}
if (!g_file_test(bat->path_level_now, G_FILE_TEST_EXISTS) ||
!g_file_test(bat->path_level_full, G_FILE_TEST_EXISTS) ||
!g_file_test(bat->path_rate_now, G_FILE_TEST_EXISTS)) {
fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__);
if (!is_file_non_empty(bat->path_level_now)) {
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, bat->path_level_now);
goto err1;
}
if (!is_file_non_empty(bat->path_level_full)) {
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, bat->path_level_full);
goto err1;
}
bat->path_status = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "status", NULL);
if (!g_file_test(bat->path_status, G_FILE_TEST_EXISTS)) {
fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__);
if (!is_file_non_empty(bat->path_status)) {
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, bat->path_status);
goto err2;
}
@@ -181,8 +197,8 @@ static gboolean init_linux_mains(struct psy_mains *ac)
const gchar *entryname = ac->name;
ac->path_online = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "online", NULL);
if (!g_file_test(ac->path_online, G_FILE_TEST_EXISTS)) {
fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__);
if (!is_file_non_empty(ac->path_online)) {
fprintf(stderr, RED "tint2: %s:%d: read failed for %s" RESET "\n", __FILE__, __LINE__, ac->path_online);
g_free(ac->path_online);
return FALSE;
}

View File

@@ -488,7 +488,7 @@ void button_dump_geometry(void *obj, int indent)
Imlib_Image tmp = imlib_context_get_image();
imlib_context_set_image(button->frontend->icon);
fprintf(stderr,
"%*sIcon: x = %d, y = %d, w = %d, h = %d\n",
"tint2: %*sIcon: x = %d, y = %d, w = %d, h = %d\n",
indent,
"",
button->frontend->iconx,
@@ -499,7 +499,7 @@ void button_dump_geometry(void *obj, int indent)
imlib_context_set_image(tmp);
}
fprintf(stderr,
"%*sText: x = %d, y = %d, w = %d, align = %s, text = %s\n",
"tint2: %*sText: x = %d, y = %d, w = %d, align = %s, text = %s\n",
indent,
"",
button->frontend->textx,

View File

@@ -518,7 +518,7 @@ void execp_dump_geometry(void *obj, int indent)
Imlib_Image tmp = imlib_context_get_image();
imlib_context_set_image(execp->backend->icon);
fprintf(stderr,
"%*sIcon: x = %d, y = %d, w = %d, h = %d\n",
"tint2: %*sIcon: x = %d, y = %d, w = %d, h = %d\n",
indent,
"",
execp->frontend->iconx,
@@ -529,7 +529,7 @@ void execp_dump_geometry(void *obj, int indent)
imlib_context_set_image(tmp);
}
fprintf(stderr,
"%*sText: x = %d, y = %d, w = %d, align = %s, text = %s\n",
"tint2: %*sText: x = %d, y = %d, w = %d, align = %s, text = %s\n",
indent,
"",
execp->frontend->textx,

View File

@@ -104,7 +104,7 @@ void handle_event_property_notify(XEvent *e)
// Change name of desktops
else if (at == server.atom._NET_DESKTOP_NAMES) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __func__, __LINE__);
update_desktop_names();
}
// Change desktops
@@ -112,7 +112,7 @@ void handle_event_property_notify(XEvent *e)
at == server.atom._NET_DESKTOP_VIEWPORT || at == server.atom._NET_WORKAREA ||
at == server.atom._NET_CURRENT_DESKTOP) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = ?? desktops changed\n", __func__, __LINE__);
if (!taskbar_enabled)
return;
int old_num_desktops = server.num_desktops;
@@ -202,7 +202,7 @@ void handle_event_property_notify(XEvent *e)
// Window list
else if (at == server.atom._NET_CLIENT_LIST) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_CLIENT_LIST\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_CLIENT_LIST\n", __func__, __LINE__);
taskbar_refresh_tasklist();
update_all_taskbars_visibility();
schedule_panel_redraw();
@@ -210,12 +210,12 @@ void handle_event_property_notify(XEvent *e)
// Change active
else if (at == server.atom._NET_ACTIVE_WINDOW) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __func__, __LINE__);
reset_active_task();
schedule_panel_redraw();
} else if (at == server.atom._XROOTPMAP_ID || at == server.atom._XROOTMAP_ID) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _XROOTPMAP_ID\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _XROOTPMAP_ID\n", __func__, __LINE__);
// change Wallpaper
for (int i = 0; i < num_panels; i++) {
set_panel_background(&panels[i]);
@@ -234,7 +234,7 @@ void handle_event_property_notify(XEvent *e)
char *atom_name = XGetAtomName(server.display, at);
fprintf(stderr,
"%s %d: win = %ld, task = %s, atom = %s\n",
__FUNCTION__,
__func__,
__LINE__,
win,
task ? (task->title ? task->title : "??") : "null",
@@ -243,7 +243,7 @@ void handle_event_property_notify(XEvent *e)
}
if (!task) {
if (debug)
fprintf(stderr, "tint2: %s %d\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d\n", __func__, __LINE__);
if (at == server.atom._NET_WM_STATE) {
// xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
// if it is mapped and not set as skip_taskbar, we must add it to our task list
@@ -277,7 +277,7 @@ void handle_event_property_notify(XEvent *e)
Atom *atom_state = server_get_property(win, server.atom._NET_WM_STATE, XA_ATOM, &count);
for (int j = 0; j < count; j++) {
char *atom_state_name = XGetAtomName(server.display, atom_state[j]);
fprintf(stderr, "tint2: %s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name);
fprintf(stderr, "tint2: %s %d: _NET_WM_STATE = %s\n", __func__, __LINE__, atom_state_name);
XFree(atom_state_name);
}
XFree(atom_state);

View File

@@ -165,7 +165,7 @@ gboolean resize_panel(void *obj);
void render_panel(Panel *panel);
void shrink_panel(Panel *panel);
void _schedule_panel_redraw(const char *file, const char *function, const int line);
#define schedule_panel_redraw() _schedule_panel_redraw(__FILE__, __FUNCTION__, __LINE__)
#define schedule_panel_redraw() _schedule_panel_redraw(__FILE__, __func__, __LINE__)
void set_panel_items_order(Panel *p);
void place_panel_all_desktops(Panel *p);

View File

@@ -24,11 +24,23 @@ void signal_handler(int sig)
signal_pending = sig;
}
void reset_signals()
{
for (int sig = 1; sig < 32; sig++) {
signal(sig, SIG_DFL);
}
sigset_t signal_set;
sigemptyset(&signal_set);
sigprocmask(SIG_SETMASK, &signal_set, NULL);
}
void init_signals()
{
// Set signal handlers
signal_pending = 0;
reset_signals();
struct sigaction sa_chld = {.sa_handler = SIG_IGN};
sigaction(SIGCHLD, &sa_chld, 0);

View File

@@ -5,6 +5,7 @@ void init_signals();
void init_signals_postconfig();
void emit_self_restart(const char *reason);
int get_signal_pending();
void reset_signals();
void handle_sigchld_events();

View File

@@ -184,7 +184,7 @@ int systray_compute_desired_size(void *obj)
gboolean resize_systray(void *obj)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
int size;
systray_compute_geometry(&size);
@@ -227,7 +227,7 @@ gboolean resize_systray(void *obj)
void draw_systray(void *obj, cairo_t *c)
{
if (systray_profile)
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
if (systray_composited) {
if (render_background)
XFreePixmap(server.display, render_background);
@@ -257,7 +257,7 @@ void systray_dump_geometry(void *obj, int indent)
for (GSList *l = tray->list_icons; l; l = l->next) {
TrayWindow *traywin = (TrayWindow *)l->data;
fprintf(stderr,
"%*sIcon: x = %d, y = %d, w = %d, h = %d, name = %s\n",
"tint2: %*sIcon: x = %d, y = %d, w = %d, h = %d, name = %s\n",
indent,
"",
traywin->x,
@@ -271,7 +271,7 @@ void systray_dump_geometry(void *obj, int indent)
void on_change_systray(void *obj)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (systray.icons_per_column == 0 || systray.icons_per_row == 0)
return;
@@ -301,7 +301,7 @@ void on_change_systray(void *obj)
if (systray_profile)
fprintf(stderr,
"%s:%d win = %lu (%s), parent = %lu, x = %d, y = %d\n",
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name,
@@ -358,7 +358,7 @@ void on_change_systray(void *obj)
void start_net()
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (net_sel_win) {
// protocol already started
if (!systray_enabled)
@@ -464,7 +464,7 @@ void start_net()
fprintf(stderr, GREEN "tint2: systray started" RESET "\n");
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
XClientMessageEvent ev;
ev.type = ClientMessage;
ev.window = server.root_win;
@@ -481,7 +481,7 @@ void start_net()
void handle_systray_event(XClientMessageEvent *e)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
Window win;
unsigned long opcode = e->data.l[1];
@@ -509,7 +509,7 @@ void handle_systray_event(XClientMessageEvent *e)
void stop_net()
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (systray.list_icons) {
// remove_icon change systray.list_icons
while (systray.list_icons)
@@ -529,7 +529,7 @@ gboolean error;
int window_error_handler(Display *d, XErrorEvent *e)
{
if (systray_profile)
fprintf(stderr, RED "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, RED "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
error = TRUE;
if (e->error_code != BadWindow) {
fprintf(stderr, RED "tint2: systray: error code %d" RESET "\n", e->error_code);
@@ -623,7 +623,7 @@ gboolean add_icon(Window win)
char *name = get_window_name(win);
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name);
fprintf(stderr, "tint2: [%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __func__, __LINE__, win, name);
Panel *panel = systray.area.panel;
// Get the process ID of the application that created the window
@@ -679,7 +679,7 @@ gboolean add_icon(Window win)
win,
name,
pid,
attr.visual,
(void*)attr.visual,
attr.colormap,
attr.depth,
attr.width,
@@ -748,14 +748,14 @@ gboolean add_icon(Window win)
}
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
// Resize and redraw the systray
if (systray_profile)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
systray.area.resize_needed = TRUE;
panel->area.resize_needed = TRUE;
@@ -770,7 +770,7 @@ gboolean reparent_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -832,7 +832,7 @@ gboolean reparent_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -846,7 +846,7 @@ gboolean embed_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -903,7 +903,7 @@ gboolean embed_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -917,7 +917,7 @@ void remove_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -963,7 +963,7 @@ void remove_icon(TrayWindow *traywin)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
systray.area.resize_needed = TRUE;
panel->area.resize_needed = TRUE;
@@ -1086,7 +1086,7 @@ void systray_reconfigure_event(TrayWindow *traywin, XEvent *e)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
schedule_panel_redraw();
refresh_systray = TRUE;
@@ -1165,7 +1165,7 @@ void systray_resize_request_event(TrayWindow *traywin, XEvent *e)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
schedule_panel_redraw();
refresh_systray = TRUE;
@@ -1177,7 +1177,7 @@ void systray_destroy_event(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1212,7 +1212,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1230,7 +1230,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1250,7 +1250,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1381,7 +1381,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1419,7 +1419,7 @@ void systray_render_icon(void *t)
// fprintf(stderr,
// YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
// profiling_get_time(),
// __FUNCTION__,
// __func__,
// __LINE__,
// traywin->win,
// traywin->name);
@@ -1433,7 +1433,7 @@ void systray_render_icon(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1466,7 +1466,7 @@ void systray_render_icon(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@@ -1500,7 +1500,7 @@ void systray_render_icon(void *t)
void refresh_systray_icons()
{
if (systray_profile)
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
TrayWindow *traywin;
GSList *l;
for (l = systray.list_icons; l; l = l->next) {

View File

@@ -93,7 +93,7 @@ Task *add_task(Window win)
(int)win,
task_template.title ? task_template.title : "null");
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ?
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, win, task_template.title ?
// task_template.title : "??");
// fprintf(stderr, "tint2: new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor);
@@ -118,7 +118,7 @@ Task *add_task(Window win)
task_instance->win_h = task_template.win_h;
task_instance->current_state = TASK_UNDEFINED; // to update the current state later in set_task_state...
if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) {
// fprintf(stderr, "tint2: %s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win);
// fprintf(stderr, "tint2: %s %d: win = %ld hiding task: another desktop\n", __func__, __LINE__, win);
task_instance->area.on_screen = always_show_all_desktop_tasks;
}
task_instance->title = task_template.title;
@@ -186,7 +186,7 @@ void remove_task(Task *task)
if (!task)
return;
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title :
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, task->win, task->title ? task->title :
// "??");
if (taskbar_mode == MULTI_DESKTOP) {
@@ -292,7 +292,7 @@ void task_update_icon(Task *task)
if (0 && img)
fprintf(stderr,
"%s: Got %dx%d icon via _NET_WM_ICON for %s\n",
__FUNCTION__,
__func__,
w,
h,
task->title ? task->title : "task");
@@ -318,7 +318,7 @@ void task_update_icon(Task *task)
if (0 && img)
fprintf(stderr,
"%s: Got %dx%d pixmap icon via WM_HINTS for %s\n",
__FUNCTION__,
__func__,
w,
h,
task->title ? task->title : "task");
@@ -466,7 +466,7 @@ void task_dump_geometry(void *obj, int indent)
Panel *panel = (Panel *)task->area.panel;
fprintf(stderr,
"%*sText: x = %d, y = %d, w = %d, h = %d, align = %s, text = %s\n",
"tint2: %*sText: x = %d, y = %d, w = %d, h = %d, align = %s, text = %s\n",
indent,
"",
(int)panel->g_task.text_posx,
@@ -476,7 +476,7 @@ void task_dump_geometry(void *obj, int indent)
panel->g_task.centered ? "center" : "left",
task->title);
fprintf(stderr,
"%*sIcon: x = %d, y = %d, w = h = %d\n",
"tint2: %*sIcon: x = %d, y = %d, w = h = %d\n",
indent,
"",
task->_icon_x,
@@ -783,7 +783,7 @@ void task_handle_mouse_event(Task *task, MouseAction action)
void task_update_desktop(Task *task)
{
// fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__);
// fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__);
Window win = task->win;
remove_task(task);
task = add_task(win);

View File

@@ -47,6 +47,8 @@ gboolean always_show_all_desktop_tasks;
TaskbarSortMethod taskbar_sort_method;
Alignment taskbar_alignment;
static GList *taskbar_task_orderings = NULL;
void taskbar_init_fonts();
int taskbar_compute_desired_size(void *obj);
@@ -85,8 +87,40 @@ void default_taskbar()
default_taskbarname();
}
void taskbar_clear_orderings()
{
if (!taskbar_task_orderings)
return;
for (GList *order = taskbar_task_orderings; order; order = order->next) {
g_list_free_full((GList *)order->data, free);
}
g_list_free(taskbar_task_orderings);
taskbar_task_orderings = NULL;
}
void taskbar_save_orderings()
{
taskbar_clear_orderings();
taskbar_task_orderings = NULL;
for (int i = 0; i < num_panels; i++) {
Panel *panel = &panels[i];
for (int j = 0; j < panel->num_desktops; j++) {
Taskbar *taskbar = &panel->taskbar[j];
GList *task_order = NULL;
for (GList *c = (taskbar->area.children && taskbarname_enabled) ? taskbar->area.children->next : taskbar->area.children; c; c = c->next) {
Task *t = (Task *)c->data;
Window *window = calloc(1, sizeof(Window));
*window = t->win;
task_order = g_list_append(task_order, window);
}
taskbar_task_orderings = g_list_append(taskbar_task_orderings, task_order);
}
}
}
void cleanup_taskbar()
{
taskbar_save_orderings();
if (win_to_task) {
while (g_hash_table_size(win_to_task)) {
GHashTableIter iter;
@@ -381,14 +415,68 @@ GPtrArray *get_task_buttons(Window win)
return NULL;
}
static Window *sort_windows = NULL;
int compare_windows(const void *a, const void *b)
{
if (!sort_windows)
return 0;
int ia = *(int*)a;
int ib = *(int*)b;
Window wina = sort_windows[ia];
Window winb = sort_windows[ib];
for (GList *order = taskbar_task_orderings; order; order = order->next) {
int posa = -1;
int posb = -1;
int pos = 0;
for (GList *item = (GList *)order->data; item; item = item->next, pos++) {
Window win = *(Window*)item->data;
if (win == wina)
posa = pos;
if (win == winb)
posb = pos;
}
if (posa >= 0 && posb >= 0) {
return posa - posb;
}
}
return ia - ib;
}
void sort_win_list(Window *windows, int count)
{
int *indices = (int *)calloc(count, sizeof(int));
for (int i = 0; i < count; i++)
indices[i] = i;
sort_windows = windows;
qsort(indices, count, sizeof(int), compare_windows);
Window *result = (Window *)calloc(count, sizeof(Window));
for (int i = 0; i < count; i++)
result[i] = windows[indices[i]];
memcpy(windows, result, count * sizeof(Window));
free(result);
free(indices);
sort_windows = NULL;
}
void taskbar_refresh_tasklist()
{
if (!taskbar_enabled)
return;
// fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__);
// fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__);
int num_results;
Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results);
Window *sorted = (Window *)calloc(num_results, sizeof(Window));
memcpy(sorted, win, num_results * sizeof(Window));
if (taskbar_task_orderings) {
sort_win_list(sorted, num_results);
taskbar_clear_orderings();
}
if (!win)
return;
@@ -396,7 +484,7 @@ void taskbar_refresh_tasklist()
for (GList *it = win_list; it; it = it->next) {
int i;
for (i = 0; i < num_results; i++)
if (*((Window *)it->data) == win[i])
if (*((Window *)it->data) == sorted[i])
break;
if (i == num_results)
taskbar_remove_task(it->data);
@@ -405,10 +493,11 @@ void taskbar_refresh_tasklist()
// Add any new
for (int i = 0; i < num_results; i++)
if (!get_task(win[i]))
add_task(win[i]);
if (!get_task(sorted[i]))
add_task(sorted[i]);
XFree(win);
free(sorted);
}
int taskbar_compute_desired_size(void *obj)

View File

@@ -850,7 +850,7 @@ void area_dump_geometry(Area *area, int indent)
return;
}
fprintf(stderr,
"%*sBox: x = %d, y = %d, w = %d, h = %d, desired size = %d\n",
"tint2: %*sBox: x = %d, y = %d, w = %d, h = %d, desired size = %d\n",
indent,
"",
area->posx,
@@ -859,7 +859,7 @@ void area_dump_geometry(Area *area, int indent)
area->height,
compute_desired_size(area));
fprintf(stderr,
"%*sBorder: left = %d, right = %d, top = %d, bottom = %d\n",
"tint2: %*sBorder: left = %d, right = %d, top = %d, bottom = %d\n",
indent,
"",
left_border_width(area),
@@ -867,7 +867,7 @@ void area_dump_geometry(Area *area, int indent)
top_border_width(area),
bottom_border_width(area));
fprintf(stderr,
"%*sPadding: left = right = %d, top = bottom = %d, spacing = %d\n",
"tint2: %*sPadding: left = right = %d, top = bottom = %d, spacing = %d\n",
indent,
"",
area->paddingxlr,
@@ -883,6 +883,33 @@ void area_dump_geometry(Area *area, int indent)
}
}
void area_compute_available_size(Area *area,
int *available_w,
int *available_h)
{
Panel *panel = (Panel *)area->panel;
if (panel_horizontal) {
*available_w = panel->area.width;
*available_h = area->height - 2 * area->paddingy - left_right_border_width(area);
} else {
*available_w = area->width - 2 * area->paddingxlr - left_right_border_width(area);
*available_h = panel->area.height;
}
}
void area_compute_inner_size(Area *area,
int *inner_w,
int *inner_h)
{
if (panel_horizontal) {
*inner_w = area->width - 2 * area->paddingxlr - left_right_border_width(area);
*inner_h = area->height - 2 * area->paddingy - top_bottom_border_width(area);
} else {
*inner_w = area->width - 2 * area->paddingxlr - left_right_border_width(area);
*inner_h = area->height - 2 * area->paddingy - top_bottom_border_width(area);
}
}
void area_compute_text_geometry(Area *area,
const char *line1,
const char *line2,
@@ -895,15 +922,8 @@ void area_compute_text_geometry(Area *area,
int *line2_height,
int *line2_width)
{
Panel *panel = (Panel *)area->panel;
int available_w, available_h;
if (panel_horizontal) {
available_w = panel->area.width;
available_h = area->height - 2 * area->paddingy - left_right_border_width(area);
} else {
available_w = area->width - 2 * area->paddingxlr - left_right_border_width(area);
available_h = panel->area.height;
}
area_compute_available_size(area, &available_w, &available_h);
if (line1 && line1[0])
get_text_size2(line1_font_desc,
@@ -959,7 +979,7 @@ int text_area_compute_desired_size(Area *area,
int new_size = MAX(line1_width, line2_width) + 2 * area->paddingxlr + left_right_border_width(area);
return new_size;
} else {
int new_size = line1_height + line2_height + 2 * area->paddingxlr + top_bottom_border_width(area);
int new_size = line1_height + line2_height + 2 * area->paddingy + top_bottom_border_width(area);
return new_size;
}
}
@@ -1035,18 +1055,22 @@ void draw_text_area(Area *area,
int line2_posy,
Color *color)
{
int inner_w, inner_h;
area_compute_inner_size(area, &inner_w, &inner_h);
PangoLayout *layout = pango_cairo_create_layout(c);
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
pango_layout_set_width(layout, area->width * PANGO_SCALE);
pango_layout_set_width(layout, inner_w * PANGO_SCALE);
pango_layout_set_height(layout, inner_h * PANGO_SCALE);
cairo_set_source_rgba(c, color->rgb[0], color->rgb[1], color->rgb[2], color->alpha);
if (line1 && line1[0]) {
pango_layout_set_font_description(layout, line1_font_desc);
pango_layout_set_text(layout, line1, strlen(line1));
pango_cairo_update_layout(c, layout);
draw_text(layout, c, 0, line1_posy, color, ((Panel *)area->panel)->font_shadow);
draw_text(layout, c, (area->width - inner_w) / 2, line1_posy, color, ((Panel *)area->panel)->font_shadow);
}
if (line2 && line2[0]) {
@@ -1054,7 +1078,7 @@ void draw_text_area(Area *area,
pango_layout_set_indent(layout, 0);
pango_layout_set_text(layout, line2, strlen(line2));
pango_cairo_update_layout(c, layout);
draw_text(layout, c, 0, line2_posy, color, ((Panel *)area->panel)->font_shadow);
draw_text(layout, c, (area->width - inner_w) / 2, line2_posy, color, ((Panel *)area->panel)->font_shadow);
}
g_object_unref(layout);

View File

@@ -59,6 +59,7 @@
#include "../panel.h"
#include "timer.h"
#include "signals.h"
void write_string(int fd, const char *s)
{
@@ -398,6 +399,7 @@ pid_t tint_exec(const char *command,
if (dir)
chdir(dir);
close_all_fds();
reset_signals();
if (terminal) {
#if !defined(__OpenBSD__)
fprintf(stderr, "tint2: executing in x-terminal-emulator: %s\n", command);

View File

@@ -0,0 +1,130 @@
AC0/type:Mains
AC0/power/control:auto
AC0/power/wakeup_prevent_sleep_time_ms:0
AC0/power/async:disabled
AC0/power/wakeup_abort_count:0
AC0/power/wakeup_active:0
AC0/power/wakeup_total_time_ms:0
AC0/power/wakeup_active_count:4
AC0/power/runtime_enabled:disabled
AC0/power/runtime_active_kids:0
AC0/power/runtime_active_time:0
AC0/power/wakeup_max_time_ms:0
AC0/power/wakeup_count:4
AC0/power/wakeup_last_time_ms:18773802
AC0/power/wakeup:enabled
AC0/power/runtime_status:unsupported
AC0/power/runtime_usage:0
AC0/power/wakeup_expire_count:0
AC0/power/runtime_suspended_time:0
AC0/online:1
AC0/uevent:POWER_SUPPLY_NAME=AC0
AC0/uevent:POWER_SUPPLY_ONLINE=1
BAT0/temp:26
BAT0/type:Battery
BAT0/power/control:auto
BAT0/power/wakeup_prevent_sleep_time_ms:0
BAT0/power/async:disabled
BAT0/power/wakeup_abort_count:0
BAT0/power/wakeup_active:0
BAT0/power/wakeup_total_time_ms:0
BAT0/power/wakeup_active_count:4
BAT0/power/runtime_enabled:disabled
BAT0/power/runtime_active_kids:0
BAT0/power/runtime_active_time:0
BAT0/power/wakeup_max_time_ms:0
BAT0/power/wakeup_count:4
BAT0/power/wakeup_last_time_ms:18773802
BAT0/power/wakeup:enabled
BAT0/power/runtime_status:unsupported
BAT0/power/runtime_usage:0
BAT0/power/wakeup_expire_count:0
BAT0/power/runtime_suspended_time:0
BAT0/charge_full_design:100
BAT0/charge_now:17
BAT0/charge_full:100
BAT0/charge_type:Fast
BAT0/capacity:17
BAT0/health:Good
BAT0/capacity_level:Critical
BAT0/status:Charging
BAT0/voltage_now:3300
BAT0/uevent:POWER_SUPPLY_NAME=BAT0
BAT0/uevent:POWER_SUPPLY_STATUS=Charging
BAT0/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast
BAT0/uevent:POWER_SUPPLY_HEALTH=Good
BAT0/uevent:POWER_SUPPLY_PRESENT=1
BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100
BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=100
BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=17
BAT0/uevent:POWER_SUPPLY_CAPACITY=17
BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Critical
BAT0/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=612
BAT0/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=612
BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 1
BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Linux
BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678
BAT0/uevent:POWER_SUPPLY_TEMP=26
BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300
BAT0/model_name:Fake battery 1
BAT0/manufacturer:Linux
BAT0/technology:Li-ion
BAT0/time_to_full_now:612
BAT0/time_to_empty_avg:612
BAT0/serial_number:12345678
BAT0/present:1
BAT1/temp:26
BAT1/type:Battery
BAT1/power/control:auto
BAT1/power/wakeup_prevent_sleep_time_ms:0
BAT1/power/async:disabled
BAT1/power/wakeup_abort_count:0
BAT1/power/wakeup_active:0
BAT1/power/wakeup_total_time_ms:0
BAT1/power/wakeup_active_count:4
BAT1/power/runtime_enabled:disabled
BAT1/power/runtime_active_kids:0
BAT1/power/runtime_active_time:0
BAT1/power/wakeup_max_time_ms:0
BAT1/power/wakeup_count:4
BAT1/power/wakeup_last_time_ms:18773802
BAT1/power/wakeup:enabled
BAT1/power/runtime_status:unsupported
BAT1/power/runtime_usage:0
BAT1/power/wakeup_expire_count:0
BAT1/power/runtime_suspended_time:0
BAT1/charge_full_design:100
BAT1/charge_now:7
BAT1/charge_full:100
BAT1/charge_type:Fast
BAT1/capacity:7
BAT1/health:Good
BAT1/capacity_level:Low
BAT1/status:Charging
BAT1/voltage_now:3300
BAT1/uevent:POWER_SUPPLY_NAME=BAT1
BAT1/uevent:POWER_SUPPLY_STATUS=Charging
BAT1/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast
BAT1/uevent:POWER_SUPPLY_HEALTH=Good
BAT1/uevent:POWER_SUPPLY_PRESENT=1
BAT1/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
BAT1/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100
BAT1/uevent:POWER_SUPPLY_CHARGE_FULL=100
BAT1/uevent:POWER_SUPPLY_CHARGE_NOW=7
BAT1/uevent:POWER_SUPPLY_CAPACITY=7
BAT1/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Low
BAT1/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=252
BAT1/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=252
BAT1/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 2
BAT1/uevent:POWER_SUPPLY_MANUFACTURER=Linux
BAT1/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678
BAT1/uevent:POWER_SUPPLY_TEMP=26
BAT1/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300
BAT1/model_name:Fake battery 2
BAT1/manufacturer:Linux
BAT1/technology:Li-ion
BAT1/time_to_full_now:252
BAT1/time_to_empty_avg:252
BAT1/serial_number:12345678
BAT1/present:1

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
auto

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
unsupported

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
18773802

View File

@@ -0,0 +1 @@
Mains

View File

@@ -0,0 +1 @@
POWER_SUPPLY_ONLINE=1

View File

@@ -0,0 +1 @@
17

View File

@@ -0,0 +1 @@
Critical

View File

@@ -0,0 +1 @@
100

View File

@@ -0,0 +1 @@
17

View File

@@ -0,0 +1 @@
Fast

View File

@@ -0,0 +1 @@
Good

View File

@@ -0,0 +1 @@
Linux

View File

@@ -0,0 +1 @@
Fake battery 1

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
auto

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
unsupported

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
12345678

View File

@@ -0,0 +1 @@
Charging

View File

@@ -0,0 +1 @@
Li-ion

View File

@@ -0,0 +1 @@
26

View File

@@ -0,0 +1 @@
612

View File

@@ -0,0 +1 @@
Battery

View File

@@ -0,0 +1 @@
POWER_SUPPLY_VOLTAGE_NOW=3300

View File

@@ -0,0 +1 @@
3300

View File

@@ -0,0 +1 @@
7

View File

@@ -0,0 +1 @@
Low

View File

@@ -0,0 +1 @@
100

View File

@@ -0,0 +1 @@
7

View File

@@ -0,0 +1 @@
Fast

View File

@@ -0,0 +1 @@
Good

View File

@@ -0,0 +1 @@
Linux

View File

@@ -0,0 +1 @@
Fake battery 2

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
auto

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
unsupported

View File

@@ -0,0 +1 @@
enabled

Some files were not shown because too many files have changed in this diff Show More