Compare commits
2 Commits
translatio
...
area-align
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92fa96b8c7 | ||
|
|
ca862025d6 |
1
AUTHORS
1
AUTHORS
@@ -5,7 +5,6 @@ tint2 is developped by :
|
|||||||
- Euan Freeman <euan04@gmail.com> (tintwizard)
|
- Euan Freeman <euan04@gmail.com> (tintwizard)
|
||||||
- Christian Ruppert <Spooky85@gmail.com> (autotools build system)
|
- Christian Ruppert <Spooky85@gmail.com> (autotools build system)
|
||||||
- Ovidiu M <mrovi9000 at gmail.com> : launcher, bug fixes
|
- Ovidiu M <mrovi9000 at gmail.com> : launcher, bug fixes
|
||||||
- Mishael A Sibiryakov (death@junki.org) : freespace
|
|
||||||
|
|
||||||
tint2 is based on ttm source code (http://code.google.com/p/ttm/)
|
tint2 is based on ttm source code (http://code.google.com/p/ttm/)
|
||||||
- 2007-2008 Pål Staurland <staura@gmail.com>
|
- 2007-2008 Pål Staurland <staura@gmail.com>
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ include_directories( ${PROJECT_BINARY_DIR}
|
|||||||
src/launcher
|
src/launcher
|
||||||
src/tooltip
|
src/tooltip
|
||||||
src/util
|
src/util
|
||||||
src/freespace
|
|
||||||
${X11_INCLUDE_DIRS}
|
${X11_INCLUDE_DIRS}
|
||||||
${PANGOCAIRO_INCLUDE_DIRS}
|
${PANGOCAIRO_INCLUDE_DIRS}
|
||||||
${PANGO_INCLUDE_DIRS}
|
${PANGO_INCLUDE_DIRS}
|
||||||
@@ -68,8 +67,7 @@ set( SOURCES src/config.c
|
|||||||
src/taskbar/taskbar.c
|
src/taskbar/taskbar.c
|
||||||
src/taskbar/taskbarname.c
|
src/taskbar/taskbarname.c
|
||||||
src/tooltip/tooltip.c
|
src/tooltip/tooltip.c
|
||||||
src/freespace/freespace.c
|
src/util/area.c
|
||||||
src/util/area.c
|
|
||||||
src/util/common.c
|
src/util/common.c
|
||||||
src/util/strnatcmp.c
|
src/util/strnatcmp.c
|
||||||
src/util/timer.c
|
src/util/timer.c
|
||||||
|
|||||||
36
ChangeLog
36
ChangeLog
@@ -1,4 +1,4 @@
|
|||||||
2015-05-23 master
|
2015-05-03 master
|
||||||
- Note: the changes listed here are based on the previous release tint2 0.11, however some distributions (e.g. Debian)
|
- Note: the changes listed here are based on the previous release tint2 0.11, however some distributions (e.g. Debian)
|
||||||
offered packages using newer commits and/or patches; thus from the user's perspective some of these features are
|
offered packages using newer commits and/or patches; thus from the user's perspective some of these features are
|
||||||
already present. They are marked with '(already released by distros)'.
|
already present. They are marked with '(already released by distros)'.
|
||||||
@@ -11,10 +11,6 @@
|
|||||||
- Experimental, testing/feedback needed
|
- Experimental, testing/feedback needed
|
||||||
- Icons (system tray, task buttons, launcher):
|
- Icons (system tray, task buttons, launcher):
|
||||||
- Changed rendering method to fix icon corruptions (please report any problems)
|
- Changed rendering method to fix icon corruptions (please report any problems)
|
||||||
- System tray:
|
|
||||||
- Icon rendering is faster
|
|
||||||
- Several kinds of graphical corruptions have been fixed
|
|
||||||
- Added workaround for misbehaving applications leaving empty tray icons
|
|
||||||
- Many bugfixes
|
- Many bugfixes
|
||||||
- New config options (see https://gitlab.com/o9000/tint2/wikis/Configure):
|
- New config options (see https://gitlab.com/o9000/tint2/wikis/Configure):
|
||||||
- Panel:
|
- Panel:
|
||||||
@@ -27,7 +23,6 @@
|
|||||||
- taskbar_hide_inactive_tasks
|
- taskbar_hide_inactive_tasks
|
||||||
- taskbar_sort_order
|
- taskbar_sort_order
|
||||||
- taskbar_name (already released by distros)
|
- taskbar_name (already released by distros)
|
||||||
- task_align (already released by distros)
|
|
||||||
- Launcher:
|
- Launcher:
|
||||||
- launcher* (already released by distros)
|
- launcher* (already released by distros)
|
||||||
- launcher_apps_dir (previously patched in by some distros)
|
- launcher_apps_dir (previously patched in by some distros)
|
||||||
@@ -35,7 +30,6 @@
|
|||||||
- launcher_icon_theme_override
|
- launcher_icon_theme_override
|
||||||
- System tray:
|
- System tray:
|
||||||
- systray_monitor
|
- systray_monitor
|
||||||
- Freespace (already released by distros)
|
|
||||||
- Config options with changed behavior:
|
- Config options with changed behavior:
|
||||||
- Panel:
|
- Panel:
|
||||||
- panel_dock: previously, 'panel_dock = 1' was actually not placing the panel into the dock. This option now
|
- panel_dock: previously, 'panel_dock = 1' was actually not placing the panel into the dock. This option now
|
||||||
@@ -50,36 +44,8 @@
|
|||||||
Reason for change: legibility improved for transparent panels.
|
Reason for change: legibility improved for transparent panels.
|
||||||
- Launcher:
|
- Launcher:
|
||||||
- launcher_item_app: now it expands leading ~ to the path to the user's home directory.
|
- launcher_item_app: now it expands leading ~ to the path to the user's home directory.
|
||||||
- Known issues:
|
|
||||||
- tint2 might close unexpectedly and/or cause X to freeze on certain ATI graphics cards.
|
|
||||||
Workaround: set 'disable_transparency = 1' in the config.
|
|
||||||
Reference: https://gitlab.com/o9000/tint2/issues/497
|
|
||||||
- Project hosting:
|
- Project hosting:
|
||||||
- Migrated from https://code.google.com/p/tint2 to https://gitlab.com/o9000/tint2 and switched from svn to git
|
- Migrated from https://code.google.com/p/tint2 to https://gitlab.com/o9000/tint2 and switched from svn to git
|
||||||
- Bugfixes:
|
|
||||||
- task switching from tint2 using the mouse wheel (mouse_scroll_up = prev_task and mouse_scroll_down = next_task) with
|
|
||||||
multiple desktops and taskbar_mode = multi_desktop when hovering over the first/last window in the taskbar was broken;
|
|
||||||
also when a window is set to appear on all desktops;
|
|
||||||
- the launcher was not loading an icon if the icon theme was not providing it in a size close to the value of launcher_icon_size;
|
|
||||||
- the launcher was not loading an icon if the extension was incorrect (e.g. file contents were PNG but the file name
|
|
||||||
had extension SVG);
|
|
||||||
- some launcher icons (PNG files saved with an indexed colormap and alpha mask) were sometimes rendered with white instead of
|
|
||||||
transparency;
|
|
||||||
- icons looked washed out when the panel was very transparent;
|
|
||||||
- the panel border was rendered in the background of every systray icon; sometimes systray icons were rendered in the
|
|
||||||
background of other icons;
|
|
||||||
- a crash caused by a change that prevents Google Chrome (and possibly other misbehaving applications) from leaving a large
|
|
||||||
number of empty icons in the system tray;
|
|
||||||
- the panel window had a shadow;
|
|
||||||
- some ATI drivers return an extra monitor with size zero which should be ignored when using panel_monitor = all;
|
|
||||||
- the battery applet was sometimes working incorrectly with certain laptop models (the battery applet stopped updating after
|
|
||||||
suspend with the battery unplugged);
|
|
||||||
- crashed caused by incomplete or malformed config files;
|
|
||||||
- with the fvwm window manager, the window title was sometimes not displayed correctly if it changed right after an
|
|
||||||
application was started;
|
|
||||||
- seconds were not updating in the clock;
|
|
||||||
- tint2 hang triggered when an application started from the launcher was closed and startup notifications were enabled;
|
|
||||||
- the code that loads SVG icons was using a lot of memory.
|
|
||||||
|
|
||||||
2010-06-26
|
2010-06-26
|
||||||
- unhide tint2 panel when dragging something
|
- unhide tint2 panel when dragging something
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -1,14 +1,14 @@
|
|||||||
### New unstable release: 0.12-rc5
|
### New unstable release: 0.12-rc3
|
||||||
Changes: https://gitlab.com/o9000/tint2/blob/master/ChangeLog
|
Changes: https://gitlab.com/o9000/tint2/blob/master/ChangeLog
|
||||||
|
|
||||||
Documentation: https://gitlab.com/o9000/tint2/wikis/home
|
Documentation: https://gitlab.com/o9000/tint2/wikis/home
|
||||||
|
|
||||||
Try it out with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/Install#dependencies)):
|
Try it out with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/Install#dependencies)):
|
||||||
```
|
```
|
||||||
mkdir tint2-0.12-rc5
|
mkdir tint2-0.12-rc3
|
||||||
cd tint2-0.12-rc5
|
cd tint2-0.12-rc3
|
||||||
wget 'https://gitlab.com/o9000/tint2/repository/archive.tar.gz?ref=v0.12-rc5' --output-document tint2-0.12-rc5.tar.gz
|
wget 'https://gitlab.com/o9000/tint2/repository/archive.tar.gz?ref=v0.12-rc3' --output-document tint2-0.12-rc3.tar.gz
|
||||||
tar -xzf tint2-0.12-rc5.tar.gz
|
tar -xzf tint2-0.12-rc3.tar.gz
|
||||||
cd tint2.git
|
cd tint2.git
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -49,7 +49,7 @@ tint2 is a simple panel/taskbar made for modern X window managers. It was specif
|
|||||||
* [Configure](https://gitlab.com/o9000/tint2/wikis/Configure)
|
* [Configure](https://gitlab.com/o9000/tint2/wikis/Configure)
|
||||||
* [Add applet not supported by tint2](https://gitlab.com/o9000/tint2/wikis/ThirdPartyApplets)
|
* [Add applet not supported by tint2](https://gitlab.com/o9000/tint2/wikis/ThirdPartyApplets)
|
||||||
* [Other frequently asked questions](https://gitlab.com/o9000/tint2/wikis/FAQ)
|
* [Other frequently asked questions](https://gitlab.com/o9000/tint2/wikis/FAQ)
|
||||||
* [Debug](https://gitlab.com/o9000/tint2/wikis/Debug)
|
* [Debug](https://gitlab.com/o9000/tint2/wikis/Debug)
|
||||||
|
|
||||||
### How can I help out?
|
### How can I help out?
|
||||||
|
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ void update_battery_tick(void* arg)
|
|||||||
int16_t old_hours = battery_state.time.hours;
|
int16_t old_hours = battery_state.time.hours;
|
||||||
int8_t old_minutes = battery_state.time.minutes;
|
int8_t old_minutes = battery_state.time.minutes;
|
||||||
|
|
||||||
if (!battery_found) {
|
|
||||||
init_battery();
|
|
||||||
}
|
|
||||||
if (update_battery() != 0) {
|
if (update_battery() != 0) {
|
||||||
// Reconfigure
|
// Reconfigure
|
||||||
init_battery();
|
init_battery();
|
||||||
@@ -106,23 +103,15 @@ void update_battery_tick(void* arg)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nb_panel; i++) {
|
for (i = 0; i < nb_panel; i++) {
|
||||||
if (!battery_found) {
|
if (!battery_found && panel1[i].battery.area.on_screen == 1) {
|
||||||
if (panel1[i].battery.area.on_screen == 1) {
|
hide(&panel1[i].battery.area);
|
||||||
hide(&panel1[i].battery.area);
|
panel_refresh = 1;
|
||||||
panel_refresh = 1;
|
} else if (battery_state.percentage >= percentage_hide && panel1[i].battery.area.on_screen == 1) {
|
||||||
}
|
hide(&panel1[i].battery.area);
|
||||||
} else {
|
panel_refresh = 1;
|
||||||
if (battery_state.percentage >= percentage_hide) {
|
} else if (battery_state.percentage < percentage_hide && panel1[i].battery.area.on_screen == 0) {
|
||||||
if (panel1[i].battery.area.on_screen == 1) {
|
show(&panel1[i].battery.area);
|
||||||
hide(&panel1[i].battery.area);
|
panel_refresh = 1;
|
||||||
panel_refresh = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (panel1[i].battery.area.on_screen == 0) {
|
|
||||||
show(&panel1[i].battery.area);
|
|
||||||
panel_refresh = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (panel1[i].battery.area.on_screen == 1) {
|
if (panel1[i].battery.area.on_screen == 1) {
|
||||||
panel1[i].battery.area.resize = 1;
|
panel1[i].battery.area.resize = 1;
|
||||||
@@ -290,7 +279,7 @@ void init_battery()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!battery_timeout)
|
if (!battery_timeout)
|
||||||
battery_timeout = add_timeout(10, 30000, update_battery_tick, 0, &battery_timeout);
|
battery_timeout = add_timeout(10, 10000, update_battery_tick, 0, &battery_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -485,7 +474,7 @@ int update_battery() {
|
|||||||
battery_state.time.seconds = seconds;
|
battery_state.time.seconds = seconds;
|
||||||
|
|
||||||
if (energy_full > 0)
|
if (energy_full > 0)
|
||||||
new_percentage = 0.5 + ((energy_now <= energy_full ? energy_now : energy_full) * 100.0) / energy_full;
|
new_percentage = ((energy_now <= energy_full ? energy_now : energy_full) * 100) / energy_full;
|
||||||
|
|
||||||
battery_state.percentage = new_percentage;
|
battery_state.percentage = new_percentage;
|
||||||
|
|
||||||
|
|||||||
57
src/config.c
57
src/config.c
@@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "strnatcmp.h"
|
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "taskbar.h"
|
#include "taskbar.h"
|
||||||
@@ -154,48 +153,23 @@ int config_get_monitor(char* monitor)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint compare_strings(gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
return strnatcasecmp((const char*)a, (const char*)b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void load_launcher_app_dir(const char *path)
|
void load_launcher_app_dir(const char *path)
|
||||||
{
|
{
|
||||||
GList *subdirs = NULL;
|
GDir *d = g_dir_open(path, 0, NULL);
|
||||||
GList *files = NULL;
|
|
||||||
|
|
||||||
GDir *d = g_dir_open(path, 0, NULL);
|
|
||||||
if (d) {
|
if (d) {
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
while ((name = g_dir_read_name(d))) {
|
while ((name = g_dir_read_name(d))) {
|
||||||
gchar *file = g_build_filename(path, name, NULL);
|
gchar *file = g_build_filename(path, name, NULL);
|
||||||
if (!g_file_test(file, G_FILE_TEST_IS_DIR) && g_str_has_suffix(file, ".desktop")) {
|
if (!g_file_test(file, G_FILE_TEST_IS_DIR) &&
|
||||||
files = g_list_append(files, file);
|
g_str_has_suffix(file, ".desktop")) {
|
||||||
|
panel_config.launcher.list_apps = g_slist_append(panel_config.launcher.list_apps, strdup(file));
|
||||||
} else if (g_file_test(file, G_FILE_TEST_IS_DIR)) {
|
} else if (g_file_test(file, G_FILE_TEST_IS_DIR)) {
|
||||||
subdirs = g_list_append(subdirs, file);
|
load_launcher_app_dir(file);
|
||||||
} else {
|
}
|
||||||
g_free(file);
|
g_free(file);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_dir_close(d);
|
g_dir_close(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
subdirs = g_list_sort(subdirs, compare_strings);
|
|
||||||
GList *l;
|
|
||||||
for (l = subdirs; l; l = g_list_next(l)) {
|
|
||||||
gchar *dir = (gchar *)l->data;
|
|
||||||
load_launcher_app_dir(dir);
|
|
||||||
g_free(dir);
|
|
||||||
}
|
|
||||||
g_list_free(subdirs);
|
|
||||||
|
|
||||||
files = g_list_sort(files, compare_strings);
|
|
||||||
for (l = files; l; l = g_list_next(l)) {
|
|
||||||
gchar *file = (gchar *)l->data;
|
|
||||||
panel_config.launcher.list_apps = g_slist_append(panel_config.launcher.list_apps, strdup(file));
|
|
||||||
g_free(file);
|
|
||||||
}
|
|
||||||
g_list_free(files);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_entry (char *key, char *value)
|
void add_entry (char *key, char *value)
|
||||||
@@ -544,15 +518,6 @@ void add_entry (char *key, char *value)
|
|||||||
taskbar_sort_method = TASKBAR_NOSORT;
|
taskbar_sort_method = TASKBAR_NOSORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "task_align") == 0) {
|
|
||||||
if (strcmp(value, "center") == 0) {
|
|
||||||
taskbar_alignment = ALIGN_CENTER;
|
|
||||||
} else if (strcmp(value, "right") == 0) {
|
|
||||||
taskbar_alignment = ALIGN_RIGHT;
|
|
||||||
} else {
|
|
||||||
taskbar_alignment = ALIGN_LEFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Task */
|
/* Task */
|
||||||
else if (strcmp (key, "task_text") == 0)
|
else if (strcmp (key, "task_text") == 0)
|
||||||
@@ -648,13 +613,13 @@ void add_entry (char *key, char *value)
|
|||||||
}
|
}
|
||||||
else if (strcmp(key, "systray_sort") == 0) {
|
else if (strcmp(key, "systray_sort") == 0) {
|
||||||
if (strcmp(value, "descending") == 0)
|
if (strcmp(value, "descending") == 0)
|
||||||
systray.sort = SYSTRAY_SORT_DESCENDING;
|
systray.sort = -1;
|
||||||
else if (strcmp(value, "ascending") == 0)
|
else if (strcmp(value, "ascending") == 0)
|
||||||
systray.sort = SYSTRAY_SORT_ASCENDING;
|
systray.sort = 1;
|
||||||
else if (strcmp(value, "left2right") == 0)
|
else if (strcmp(value, "left2right") == 0)
|
||||||
systray.sort = SYSTRAY_SORT_LEFT2RIGHT;
|
systray.sort = 2;
|
||||||
else if (strcmp(value, "right2left") == 0)
|
else if (strcmp(value, "right2left") == 0)
|
||||||
systray.sort = SYSTRAY_SORT_RIGHT2LEFT;
|
systray.sort = 3;
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "systray_icon_size") == 0) {
|
else if (strcmp(key, "systray_icon_size") == 0) {
|
||||||
systray_max_icon_size = atoi(value);
|
systray_max_icon_size = atoi(value);
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* Tint2 : freespace
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 Mishael A Sibiryakov (death@junki.org)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License version 2
|
|
||||||
* as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <cairo-xlib.h>
|
|
||||||
#include <pango/pangocairo.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "window.h"
|
|
||||||
#include "server.h"
|
|
||||||
#include "panel.h"
|
|
||||||
#include "freespace.h"
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
void init_freespace_panel(void *p)
|
|
||||||
{
|
|
||||||
Panel *panel = (Panel*)p;
|
|
||||||
FreeSpace *freespace = &panel->freespace;
|
|
||||||
|
|
||||||
if (freespace->area.bg == 0)
|
|
||||||
freespace->area.bg = &g_array_index(backgrounds, Background, 0);
|
|
||||||
freespace->area.parent = p;
|
|
||||||
freespace->area.panel = p;
|
|
||||||
freespace->area.size_mode = SIZE_BY_CONTENT;
|
|
||||||
freespace->area.resize = 1;
|
|
||||||
freespace->area.on_screen = 1;
|
|
||||||
freespace->area._resize = resize_freespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
int freespace_get_max_size(Panel *p) {
|
|
||||||
// Get space used by every element except the freespace
|
|
||||||
GList *walk;
|
|
||||||
int size = 0;
|
|
||||||
for (walk = p->area.list; walk; walk = g_list_next(walk)) {
|
|
||||||
Area *a = (Area *)walk->data;
|
|
||||||
|
|
||||||
if (a->_resize == resize_freespace || !a->on_screen)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (panel_horizontal)
|
|
||||||
size += a->width + (a->bg->border.width * 2) + p->area.paddingx;
|
|
||||||
else
|
|
||||||
size += a->height + (a->bg->border.width * 2) + p->area.paddingy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (panel_horizontal)
|
|
||||||
size = p->area.width - size - (p->area.bg->border.width * 2) - p->area.paddingxlr;
|
|
||||||
else
|
|
||||||
size = p->area.height - size - (p->area.bg->border.width * 2) - p->area.paddingxlr;
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
int resize_freespace(void *obj) {
|
|
||||||
FreeSpace *freespace = (FreeSpace*)obj;
|
|
||||||
Panel *panel = (Panel*)freespace->area.panel;
|
|
||||||
if (!freespace->area.on_screen)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int old_size = panel_horizontal ? freespace->area.width : freespace->area.height;
|
|
||||||
int size = freespace_get_max_size(panel);
|
|
||||||
if (old_size == size)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (panel_horizontal) {
|
|
||||||
freespace->area.width = size;
|
|
||||||
} else {
|
|
||||||
freespace->area.height = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
freespace->area.redraw = 1;
|
|
||||||
panel_refresh = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
* Copyright (C) 2011 Mishael A Sibiryakov (death@junki.org)
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef FREESPACE_H
|
|
||||||
#define FREESPACE_H
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "area.h"
|
|
||||||
|
|
||||||
typedef struct FreeSpace {
|
|
||||||
Area area;
|
|
||||||
} FreeSpace;
|
|
||||||
|
|
||||||
void cleanup_freespace();
|
|
||||||
void init_freespace_panel(void *panel);
|
|
||||||
|
|
||||||
int resize_freespace(void *obj);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -536,9 +536,6 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
|||||||
char *next_larger = NULL;
|
char *next_larger = NULL;
|
||||||
GSList *next_larger_theme = NULL;
|
GSList *next_larger_theme = NULL;
|
||||||
|
|
||||||
int file_name_size = 4096;
|
|
||||||
char *file_name = calloc(file_name_size, 1);
|
|
||||||
|
|
||||||
for (theme = themes; theme; theme = g_slist_next(theme)) {
|
for (theme = themes; theme; theme = g_slist_next(theme)) {
|
||||||
((IconTheme*)theme->data)->list_directories = g_slist_sort_with_data(((IconTheme*)theme->data)->list_directories,
|
((IconTheme*)theme->data)->list_directories = g_slist_sort_with_data(((IconTheme*)theme->data)->list_directories,
|
||||||
compare_theme_directories,
|
compare_theme_directories,
|
||||||
@@ -563,13 +560,8 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
|||||||
char *theme_name = ((IconTheme*)theme->data)->name;
|
char *theme_name = ((IconTheme*)theme->data)->name;
|
||||||
char *dir_name = ((IconThemeDir*)dir->data)->name;
|
char *dir_name = ((IconThemeDir*)dir->data)->name;
|
||||||
char *extension = (char*) ext->data;
|
char *extension = (char*) ext->data;
|
||||||
if (strlen(base_name) + strlen(theme_name) +
|
char *file_name = calloc(strlen(base_name) + strlen(theme_name) +
|
||||||
strlen(dir_name) + strlen(icon_name) + strlen(extension) + 100 > file_name_size) {
|
strlen(dir_name) + strlen(icon_name) + strlen(extension) + 100, 1);
|
||||||
file_name_size = strlen(base_name) + strlen(theme_name) +
|
|
||||||
strlen(dir_name) + strlen(icon_name) + strlen(extension) + 100;
|
|
||||||
file_name = realloc(file_name, file_name_size);
|
|
||||||
}
|
|
||||||
file_name[0] = 0;
|
|
||||||
// filename = directory/$(themename)/subdirectory/iconname.extension
|
// filename = directory/$(themename)/subdirectory/iconname.extension
|
||||||
sprintf(file_name, "%s/%s/%s/%s%s", base_name, theme_name, dir_name, icon_name, extension);
|
sprintf(file_name, "%s/%s/%s/%s%s", base_name, theme_name, dir_name, icon_name, extension);
|
||||||
if (DEBUG_ICON_SEARCH)
|
if (DEBUG_ICON_SEARCH)
|
||||||
@@ -604,12 +596,11 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
|||||||
printf("next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size);
|
printf("next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(file_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(file_name);
|
|
||||||
file_name = NULL;
|
|
||||||
if (next_larger) {
|
if (next_larger) {
|
||||||
g_slist_free(extensions);
|
g_slist_free(extensions);
|
||||||
free(best_file_name);
|
free(best_file_name);
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_RSVG
|
#ifdef HAVE_RSVG
|
||||||
#include <librsvg/rsvg.h>
|
#include <librsvg/rsvg.h>
|
||||||
@@ -152,7 +150,8 @@ void cleanup_launcher_theme(Launcher *launcher)
|
|||||||
for (l = launcher->list_icons; l ; l = l->next) {
|
for (l = launcher->list_icons; l ; l = l->next) {
|
||||||
LauncherIcon *launcherIcon = (LauncherIcon*)l->data;
|
LauncherIcon *launcherIcon = (LauncherIcon*)l->data;
|
||||||
if (launcherIcon) {
|
if (launcherIcon) {
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->icon_scaled);
|
||||||
|
free_icon(launcherIcon->icon_original);
|
||||||
free(launcherIcon->icon_name);
|
free(launcherIcon->icon_name);
|
||||||
free(launcherIcon->icon_path);
|
free(launcherIcon->icon_path);
|
||||||
free(launcherIcon->cmd);
|
free(launcherIcon->cmd);
|
||||||
@@ -187,7 +186,7 @@ int resize_launcher(void *obj)
|
|||||||
// Resize icons if necessary
|
// Resize icons if necessary
|
||||||
for (l = launcher->list_icons; l ; l = l->next) {
|
for (l = launcher->list_icons; l ; l = l->next) {
|
||||||
LauncherIcon *launcherIcon = (LauncherIcon *)l->data;
|
LauncherIcon *launcherIcon = (LauncherIcon *)l->data;
|
||||||
if (launcherIcon->icon_size != icon_size || !launcherIcon->image) {
|
if (launcherIcon->icon_size != icon_size || !launcherIcon->icon_original) {
|
||||||
launcherIcon->icon_size = icon_size;
|
launcherIcon->icon_size = icon_size;
|
||||||
launcherIcon->area.width = launcherIcon->icon_size;
|
launcherIcon->area.width = launcherIcon->icon_size;
|
||||||
launcherIcon->area.height = launcherIcon->icon_size;
|
launcherIcon->area.height = launcherIcon->icon_size;
|
||||||
@@ -196,69 +195,69 @@ int resize_launcher(void *obj)
|
|||||||
char *new_icon_path = get_icon_path(launcher->list_themes, launcherIcon->icon_name, launcherIcon->icon_size);
|
char *new_icon_path = get_icon_path(launcher->list_themes, launcherIcon->icon_name, launcherIcon->icon_size);
|
||||||
if (!new_icon_path) {
|
if (!new_icon_path) {
|
||||||
// Draw a blank icon
|
// Draw a blank icon
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->icon_original);
|
||||||
launcherIcon->image = NULL;
|
launcherIcon->icon_original = NULL;
|
||||||
|
free_icon(launcherIcon->icon_scaled);
|
||||||
|
launcherIcon->icon_scaled = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (launcherIcon->icon_path && strcmp(new_icon_path, launcherIcon->icon_path) == 0) {
|
||||||
// Free the old files
|
// If it's the same file just rescale
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->icon_scaled);
|
||||||
launcherIcon->image = NULL;
|
launcherIcon->icon_scaled = scale_icon(launcherIcon->icon_original, icon_size);
|
||||||
// Load the new file and scale
|
free(new_icon_path);
|
||||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
|
||||||
|
} else {
|
||||||
|
// Free the old files
|
||||||
|
free_icon(launcherIcon->icon_original);
|
||||||
|
free_icon(launcherIcon->icon_scaled);
|
||||||
|
launcherIcon->icon_original = launcherIcon->icon_scaled = NULL;
|
||||||
|
// Load the new file and scale
|
||||||
|
launcherIcon->icon_original = imlib_load_image_immediately(new_icon_path);
|
||||||
#ifdef HAVE_RSVG
|
#ifdef HAVE_RSVG
|
||||||
if (!launcherIcon->image && g_str_has_suffix(new_icon_path, ".svg")) {
|
if (!launcherIcon->icon_original && g_str_has_suffix(new_icon_path, ".svg")) {
|
||||||
char suffix[128];
|
|
||||||
sprintf(suffix, "tmpicon-%d.png", getpid());
|
|
||||||
// We fork here because librsvg allocates memory like crazy
|
|
||||||
pid_t pid = fork();
|
|
||||||
if (pid == 0) {
|
|
||||||
// Child
|
|
||||||
GError* err = NULL;
|
GError* err = NULL;
|
||||||
RsvgHandle* svg = rsvg_handle_new_from_file(new_icon_path, &err);
|
RsvgHandle* svg = rsvg_handle_new_from_file(new_icon_path, &err);
|
||||||
|
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
fprintf(stderr, "Could not load svg image!: %s", err->message);
|
fprintf(stderr, "Could not load svg image!: %s", err->message);
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
launcherIcon->image = NULL;
|
launcherIcon->icon_original = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
char suffix[128];
|
||||||
|
sprintf(suffix, "tmpicon-%d.png", getpid());
|
||||||
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
||||||
GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg);
|
GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg);
|
||||||
gdk_pixbuf_save(pixbuf, name, "png", NULL, NULL);
|
gdk_pixbuf_save(pixbuf, name, "png", NULL, NULL);
|
||||||
|
launcherIcon->icon_original = imlib_load_image_immediately_without_cache(name);
|
||||||
|
g_remove(name);
|
||||||
|
g_free(name);
|
||||||
|
g_object_unref(G_OBJECT(pixbuf));
|
||||||
|
g_object_unref(G_OBJECT(svg));
|
||||||
}
|
}
|
||||||
exit(0);
|
} else
|
||||||
} else {
|
|
||||||
// Parent
|
|
||||||
waitpid(pid, 0, 0);
|
|
||||||
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
|
||||||
launcherIcon->image = imlib_load_image_immediately_without_cache(name);
|
|
||||||
g_remove(name);
|
|
||||||
g_free(name);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
launcherIcon->icon_original = imlib_load_image_immediately(new_icon_path);
|
||||||
}
|
}
|
||||||
// On loading error, fallback to default
|
// On loading error, fallback to default
|
||||||
if (!launcherIcon->image) {
|
if (!launcherIcon->icon_original) {
|
||||||
free(new_icon_path);
|
free(new_icon_path);
|
||||||
new_icon_path = get_icon_path(launcher->list_themes, DEFAULT_ICON, launcherIcon->icon_size);
|
new_icon_path = get_icon_path(launcher->list_themes, DEFAULT_ICON, launcherIcon->icon_size);
|
||||||
if (new_icon_path)
|
if (new_icon_path)
|
||||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
launcherIcon->icon_original = imlib_load_image_immediately(new_icon_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!launcherIcon->image) {
|
if (!launcherIcon->icon_original) {
|
||||||
// Loading default icon failed, draw a blank icon
|
// Loading default icon failed, draw a blank icon
|
||||||
free(new_icon_path);
|
free(new_icon_path);
|
||||||
} else {
|
} else {
|
||||||
// Loaded icon successfully
|
// Loaded icon successfully
|
||||||
Imlib_Image original = launcherIcon->image;
|
launcherIcon->icon_scaled = scale_icon(launcherIcon->icon_original, launcherIcon->icon_size);
|
||||||
launcherIcon->image = scale_icon(launcherIcon->image, launcherIcon->icon_size);
|
free(launcherIcon->icon_path);
|
||||||
free_icon(original);
|
launcherIcon->icon_path = new_icon_path;
|
||||||
free(launcherIcon->icon_path);
|
fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
|
||||||
launcherIcon->icon_path = new_icon_path;
|
}
|
||||||
fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,7 +331,6 @@ int resize_launcher(void *obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,8 +355,9 @@ void draw_launcher_icon(void *obj, cairo_t *c)
|
|||||||
{
|
{
|
||||||
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
||||||
|
|
||||||
|
Imlib_Image icon_scaled = launcherIcon->icon_scaled;
|
||||||
// Render
|
// Render
|
||||||
imlib_context_set_image(launcherIcon->image);
|
imlib_context_set_image(icon_scaled);
|
||||||
if (server.real_transparency) {
|
if (server.real_transparency) {
|
||||||
render_image(launcherIcon->area.pix, 0, 0);
|
render_image(launcherIcon->area.pix, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -404,7 +403,7 @@ void launcher_action(LauncherIcon *icon, XEvent* evt)
|
|||||||
char *cmd = calloc(strlen(icon->cmd) + 10, 1);
|
char *cmd = calloc(strlen(icon->cmd) + 10, 1);
|
||||||
sprintf(cmd, "(%s&)", icon->cmd);
|
sprintf(cmd, "(%s&)", icon->cmd);
|
||||||
#if HAVE_SN
|
#if HAVE_SN
|
||||||
SnLauncherContext* ctx = 0;
|
SnLauncherContext* ctx;
|
||||||
Time time;
|
Time time;
|
||||||
if (startup_notifications) {
|
if (startup_notifications) {
|
||||||
ctx = sn_launcher_context_new(server.sn_dsp, server.screen);
|
ctx = sn_launcher_context_new(server.sn_dsp, server.screen);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ typedef struct Launcher {
|
|||||||
typedef struct LauncherIcon {
|
typedef struct LauncherIcon {
|
||||||
// always start with area
|
// always start with area
|
||||||
Area area;
|
Area area;
|
||||||
Imlib_Image image;
|
Imlib_Image icon_scaled;
|
||||||
|
Imlib_Image icon_original;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
char *icon_name;
|
char *icon_name;
|
||||||
char *icon_path;
|
char *icon_path;
|
||||||
|
|||||||
11
src/panel.c
11
src/panel.c
@@ -204,8 +204,6 @@ void init_panel()
|
|||||||
}
|
}
|
||||||
if (panel_items_order[k] == 'C')
|
if (panel_items_order[k] == 'C')
|
||||||
init_clock_panel(p);
|
init_clock_panel(p);
|
||||||
if (panel_items_order[k] == 'F' && !strstr(panel_items_order, "T"))
|
|
||||||
init_freespace_panel(p);
|
|
||||||
}
|
}
|
||||||
set_panel_items_order(p);
|
set_panel_items_order(p);
|
||||||
|
|
||||||
@@ -324,13 +322,13 @@ void init_panel_size_and_position(Panel *panel)
|
|||||||
|
|
||||||
int resize_panel(void *obj)
|
int resize_panel(void *obj)
|
||||||
{
|
{
|
||||||
Panel *panel = (Panel*)obj;
|
resize_by_layout(obj, 0);
|
||||||
resize_by_layout(panel, 0);
|
|
||||||
|
|
||||||
//printf("resize_panel\n");
|
//printf("resize_panel\n");
|
||||||
if (panel_mode != MULTI_DESKTOP && taskbar_enabled) {
|
if (panel_mode != MULTI_DESKTOP && taskbar_enabled) {
|
||||||
// propagate width/height on hidden taskbar
|
// propagate width/height on hidden taskbar
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
|
Panel *panel = (Panel*)obj;
|
||||||
width = panel->taskbar[server.desktop].area.width;
|
width = panel->taskbar[server.desktop].area.width;
|
||||||
height = panel->taskbar[server.desktop].area.height;
|
height = panel->taskbar[server.desktop].area.height;
|
||||||
for (i=0 ; i < panel->nb_desktop ; i++) {
|
for (i=0 ; i < panel->nb_desktop ; i++) {
|
||||||
@@ -341,6 +339,7 @@ int resize_panel(void *obj)
|
|||||||
}
|
}
|
||||||
if (panel_mode == MULTI_DESKTOP && taskbar_enabled && taskbar_distribute_size) {
|
if (panel_mode == MULTI_DESKTOP && taskbar_enabled && taskbar_distribute_size) {
|
||||||
// Distribute the available space between taskbars
|
// Distribute the available space between taskbars
|
||||||
|
Panel *panel = (Panel*)obj;
|
||||||
|
|
||||||
// Compute the total available size, and the total size requested by the taskbars
|
// Compute the total available size, and the total size requested by the taskbars
|
||||||
int total_size = 0;
|
int total_size = 0;
|
||||||
@@ -419,8 +418,6 @@ int resize_panel(void *obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (panel->freespace.area.on_screen)
|
|
||||||
resize_freespace(&panel->freespace);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,8 +505,6 @@ void set_panel_items_order(Panel *p)
|
|||||||
}
|
}
|
||||||
if (panel_items_order[k] == 'C')
|
if (panel_items_order[k] == 'C')
|
||||||
p->area.list = g_list_append(p->area.list, &p->clock);
|
p->area.list = g_list_append(p->area.list, &p->clock);
|
||||||
if (panel_items_order[k] == 'F')
|
|
||||||
p->area.list = g_list_append(p->area.list, &p->freespace);
|
|
||||||
}
|
}
|
||||||
init_rendering(&p->area, 0);
|
init_rendering(&p->area, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "taskbar.h"
|
#include "taskbar.h"
|
||||||
#include "systraybar.h"
|
#include "systraybar.h"
|
||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
#include "freespace.h"
|
|
||||||
|
|
||||||
#ifdef ENABLE_BATTERY
|
#ifdef ENABLE_BATTERY
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
@@ -117,8 +116,6 @@ typedef struct {
|
|||||||
|
|
||||||
Launcher launcher;
|
Launcher launcher;
|
||||||
|
|
||||||
FreeSpace freespace;
|
|
||||||
|
|
||||||
// autohide
|
// autohide
|
||||||
int is_hidden;
|
int is_hidden;
|
||||||
int hidden_width, hidden_height;
|
int hidden_width, hidden_height;
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ void server_init_atoms ()
|
|||||||
server.atom._NET_SYSTEM_TRAY_ORIENTATION = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
server.atom._NET_SYSTEM_TRAY_ORIENTATION = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
||||||
server.atom._XEMBED = XInternAtom(server.dsp, "_XEMBED", False);
|
server.atom._XEMBED = XInternAtom(server.dsp, "_XEMBED", False);
|
||||||
server.atom._XEMBED_INFO = XInternAtom(server.dsp, "_XEMBED_INFO", False);
|
server.atom._XEMBED_INFO = XInternAtom(server.dsp, "_XEMBED_INFO", False);
|
||||||
server.atom._NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
|
|
||||||
|
|
||||||
// drag 'n' drop
|
// drag 'n' drop
|
||||||
server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
|
server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
|
||||||
|
|||||||
@@ -15,8 +15,9 @@
|
|||||||
|
|
||||||
#ifdef HAVE_SN
|
#ifdef HAVE_SN
|
||||||
#include <libsn/sn.h>
|
#include <libsn/sn.h>
|
||||||
#endif
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct Global_atom
|
typedef struct Global_atom
|
||||||
{
|
{
|
||||||
@@ -73,7 +74,6 @@ typedef struct Global_atom
|
|||||||
Atom _NET_SYSTEM_TRAY_ORIENTATION;
|
Atom _NET_SYSTEM_TRAY_ORIENTATION;
|
||||||
Atom _XEMBED;
|
Atom _XEMBED;
|
||||||
Atom _XEMBED_INFO;
|
Atom _XEMBED_INFO;
|
||||||
Atom _NET_WM_PID;
|
|
||||||
Atom _XSETTINGS_SCREEN;
|
Atom _XSETTINGS_SCREEN;
|
||||||
Atom _XSETTINGS_SETTINGS;
|
Atom _XSETTINGS_SETTINGS;
|
||||||
Atom XdndAware;
|
Atom XdndAware;
|
||||||
@@ -154,4 +154,4 @@ void get_monitors();
|
|||||||
void get_desktops();
|
void get_desktops();
|
||||||
int server_get_number_of_desktops();
|
int server_get_number_of_desktops();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ GSList *icons;
|
|||||||
#define SYSTEM_TRAY_BEGIN_MESSAGE 1
|
#define SYSTEM_TRAY_BEGIN_MESSAGE 1
|
||||||
#define SYSTEM_TRAY_CANCEL_MESSAGE 2
|
#define SYSTEM_TRAY_CANCEL_MESSAGE 2
|
||||||
|
|
||||||
|
#define FORCE_COMPOSITED_RENDERING 1
|
||||||
|
|
||||||
// selection window
|
// selection window
|
||||||
Window net_sel_win = None;
|
Window net_sel_win = None;
|
||||||
|
|
||||||
@@ -50,8 +52,7 @@ int refresh_systray;
|
|||||||
int systray_enabled;
|
int systray_enabled;
|
||||||
int systray_max_icon_size;
|
int systray_max_icon_size;
|
||||||
int systray_monitor;
|
int systray_monitor;
|
||||||
int chrono;
|
|
||||||
int systray_composited;
|
|
||||||
// background pixmap if we render ourselves the icons
|
// background pixmap if we render ourselves the icons
|
||||||
static Pixmap render_background;
|
static Pixmap render_background;
|
||||||
|
|
||||||
@@ -60,9 +61,8 @@ void default_systray()
|
|||||||
{
|
{
|
||||||
memset(&systray, 0, sizeof(Systraybar));
|
memset(&systray, 0, sizeof(Systraybar));
|
||||||
render_background = 0;
|
render_background = 0;
|
||||||
chrono = 0;
|
|
||||||
systray.alpha = 100;
|
systray.alpha = 100;
|
||||||
systray.sort = SYSTRAY_SORT_LEFT2RIGHT;
|
systray.sort = 3;
|
||||||
systray.area._draw_foreground = draw_systray;
|
systray.area._draw_foreground = draw_systray;
|
||||||
systray.area._on_change_layout = on_change_systray;
|
systray.area._on_change_layout = on_change_systray;
|
||||||
systray.area.size_mode = SIZE_BY_CONTENT;
|
systray.area.size_mode = SIZE_BY_CONTENT;
|
||||||
@@ -85,19 +85,16 @@ void cleanup_systray()
|
|||||||
|
|
||||||
void init_systray()
|
void init_systray()
|
||||||
{
|
{
|
||||||
|
start_net();
|
||||||
|
|
||||||
if (!systray_enabled)
|
if (!systray_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
systray_composited = !server.disable_transparency && server.visual32 && server.colormap32;
|
if (!server.visual32 && (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)) {
|
||||||
printf("Systray composited rendering %s\n", systray_composited ? "on" : "off");
|
printf("No 32 bit visual for your X implementation. 'systray_asb = 100 0 0' will be forced\n");
|
||||||
|
|
||||||
if (!systray_composited) {
|
|
||||||
printf("systray_asb forced to 100 0 0\n");
|
|
||||||
systray.alpha = 100;
|
systray.alpha = 100;
|
||||||
systray.brightness = systray.saturation = 0;
|
systray.brightness = systray.saturation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
start_net();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,13 +108,12 @@ void init_systray_panel(void *p)
|
|||||||
GSList *l;
|
GSList *l;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (l = systray.list_icons; l ; l = l->next) {
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
if (((TrayWindow*)l->data)->hide)
|
if (!((TrayWindow*)l->data)->hide)
|
||||||
continue;
|
count++;
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
hide(&systray.area);
|
hide(&systray.area);
|
||||||
else
|
else
|
||||||
show(&systray.area);
|
show(&systray.area);
|
||||||
refresh_systray = 0;
|
refresh_systray = 0;
|
||||||
}
|
}
|
||||||
@@ -125,9 +121,8 @@ void init_systray_panel(void *p)
|
|||||||
|
|
||||||
void draw_systray(void *obj, cairo_t *c)
|
void draw_systray(void *obj, cairo_t *c)
|
||||||
{
|
{
|
||||||
if (systray_composited) {
|
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
||||||
if (render_background)
|
if (render_background) XFreePixmap(server.dsp, render_background);
|
||||||
XFreePixmap(server.dsp, render_background);
|
|
||||||
render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
|
render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
|
||||||
XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
|
XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
|
||||||
}
|
}
|
||||||
@@ -151,9 +146,8 @@ int resize_systray(void *obj)
|
|||||||
sysbar->icon_size = systray_max_icon_size;
|
sysbar->icon_size = systray_max_icon_size;
|
||||||
count = 0;
|
count = 0;
|
||||||
for (l = systray.list_icons; l ; l = l->next) {
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
if (((TrayWindow*)l->data)->hide)
|
if (!((TrayWindow*)l->data)->hide)
|
||||||
continue;
|
count++;
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
//printf("count %d\n", count);
|
//printf("count %d\n", count);
|
||||||
|
|
||||||
@@ -164,7 +158,8 @@ int resize_systray(void *obj)
|
|||||||
sysbar->marging = height - (sysbar->icons_per_column-1)*(sysbar->icon_size+sysbar->area.paddingx) - sysbar->icon_size;
|
sysbar->marging = height - (sysbar->icons_per_column-1)*(sysbar->icon_size+sysbar->area.paddingx) - sysbar->icon_size;
|
||||||
sysbar->icons_per_row = count / sysbar->icons_per_column + (count%sysbar->icons_per_column != 0);
|
sysbar->icons_per_row = count / sysbar->icons_per_column + (count%sysbar->icons_per_column != 0);
|
||||||
systray.area.width = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) + (sysbar->icon_size * sysbar->icons_per_row) + ((sysbar->icons_per_row-1) * systray.area.paddingx);
|
systray.area.width = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) + (sysbar->icon_size * sysbar->icons_per_row) + ((sysbar->icons_per_row-1) * systray.area.paddingx);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int width = sysbar->area.width - 2*sysbar->area.bg->border.width - 2*sysbar->area.paddingy;
|
int width = sysbar->area.width - 2*sysbar->area.bg->border.width - 2*sysbar->area.paddingy;
|
||||||
// here icons_per_row always higher than 0
|
// here icons_per_row always higher than 0
|
||||||
sysbar->icons_per_row = (width+sysbar->area.paddingx) / (sysbar->icon_size+sysbar->area.paddingx);
|
sysbar->icons_per_row = (width+sysbar->area.paddingx) / (sysbar->icon_size+sysbar->area.paddingx);
|
||||||
@@ -189,46 +184,44 @@ void on_change_systray (void *obj)
|
|||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
posy = start;
|
posy = start;
|
||||||
posx = systray.area.posx + systray.area.bg->border.width + systray.area.paddingxlr;
|
posx = systray.area.posx + systray.area.bg->border.width + systray.area.paddingxlr;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
posx = start;
|
posx = start;
|
||||||
posy = systray.area.posy + systray.area.bg->border.width + systray.area.paddingxlr;
|
posy = systray.area.posy + systray.area.bg->border.width + systray.area.paddingxlr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrayWindow *traywin;
|
TrayWindow *traywin;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
for (i = 1, l = systray.list_icons; l ; i++, l = l->next) {
|
for (i=1, l = systray.list_icons; l ; i++, l = l->next) {
|
||||||
traywin = (TrayWindow*)l->data;
|
traywin = (TrayWindow*)l->data;
|
||||||
if (traywin->hide)
|
if (traywin->hide) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
traywin->y = posy;
|
traywin->y = posy;
|
||||||
traywin->x = posx;
|
traywin->x = posx;
|
||||||
// printf("systray %d %d : pos %d, %d\n", traywin->parent, traywin->win, posx, posy);
|
//printf("systray %d : %d,%d\n", i, posx, posy);
|
||||||
traywin->width = sysbar->icon_size;
|
traywin->width = sysbar->icon_size;
|
||||||
traywin->height = sysbar->icon_size;
|
traywin->height = sysbar->icon_size;
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
if (i % sysbar->icons_per_column) {
|
if (i % sysbar->icons_per_column)
|
||||||
posy += sysbar->icon_size + sysbar->area.paddingx;
|
posy += sysbar->icon_size + sysbar->area.paddingx;
|
||||||
} else {
|
else {
|
||||||
posy = start;
|
posy = start;
|
||||||
posx += (sysbar->icon_size + systray.area.paddingx);
|
posx += (sysbar->icon_size + systray.area.paddingx);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (i % sysbar->icons_per_row) {
|
else {
|
||||||
|
if (i % sysbar->icons_per_row)
|
||||||
posx += sysbar->icon_size + systray.area.paddingx;
|
posx += sysbar->icon_size + systray.area.paddingx;
|
||||||
} else {
|
else {
|
||||||
posx = start;
|
posx = start;
|
||||||
posy += (sysbar->icon_size + systray.area.paddingx);
|
posy += (sysbar->icon_size + systray.area.paddingx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// position and size the icon window
|
// position and size the icon window
|
||||||
XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height);
|
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, sysbar->icon_size, sysbar->icon_size);
|
||||||
if (traywin->reparented) {
|
XResizeWindow(server.dsp, traywin->tray_id, sysbar->icon_size, sysbar->icon_size);
|
||||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
refresh_systray = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -242,10 +235,10 @@ void start_net()
|
|||||||
if (!systray_enabled)
|
if (!systray_enabled)
|
||||||
stop_net();
|
stop_net();
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
if (!systray_enabled)
|
if (!systray_enabled)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Window win = XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN);
|
Window win = XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN);
|
||||||
|
|
||||||
@@ -280,7 +273,7 @@ void start_net()
|
|||||||
long orient = 0;
|
long orient = 0;
|
||||||
XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1);
|
XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1);
|
||||||
VisualID vid;
|
VisualID vid;
|
||||||
if (systray_composited)
|
if (server.visual32 && (FORCE_COMPOSITED_RENDERING || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0))
|
||||||
vid = XVisualIDFromVisual(server.visual32);
|
vid = XVisualIDFromVisual(server.visual32);
|
||||||
else
|
else
|
||||||
vid = XVisualIDFromVisual(server.visual);
|
vid = XVisualIDFromVisual(server.visual);
|
||||||
@@ -330,9 +323,10 @@ void stop_net()
|
|||||||
gboolean error;
|
gboolean error;
|
||||||
int window_error_handler(Display *d, XErrorEvent *e)
|
int window_error_handler(Display *d, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
|
d=d;e=e;
|
||||||
error = TRUE;
|
error = TRUE;
|
||||||
if (e->error_code != BadWindow) {
|
if (e->error_code != BadWindow) {
|
||||||
printf("systray: error code %d\n", e->error_code);
|
printf("error_handler %d\n", e->error_code);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -342,201 +336,70 @@ static gint compare_traywindows(gconstpointer a, gconstpointer b)
|
|||||||
{
|
{
|
||||||
const TrayWindow * traywin_a = (TrayWindow*)a;
|
const TrayWindow * traywin_a = (TrayWindow*)a;
|
||||||
const TrayWindow * traywin_b = (TrayWindow*)b;
|
const TrayWindow * traywin_b = (TrayWindow*)b;
|
||||||
|
XTextProperty name_a, name_b;
|
||||||
|
|
||||||
if (traywin_a->empty && !traywin_b->empty)
|
if(XGetWMName(server.dsp, traywin_a->tray_id, &name_a) == 0) {
|
||||||
return 1 * (systray.sort == SYSTRAY_SORT_RIGHT2LEFT ? -1 : 1);
|
return -1;
|
||||||
if (!traywin_a->empty && traywin_b->empty)
|
|
||||||
return -1 * (systray.sort == SYSTRAY_SORT_RIGHT2LEFT ? -1 : 1);
|
|
||||||
|
|
||||||
if (systray.sort == SYSTRAY_SORT_ASCENDING ||
|
|
||||||
systray.sort == SYSTRAY_SORT_DESCENDING) {
|
|
||||||
XTextProperty name_a, name_b;
|
|
||||||
|
|
||||||
if (XGetWMName(server.dsp, traywin_a->win, &name_a) == 0) {
|
|
||||||
return -1;
|
|
||||||
} else if (XGetWMName(server.dsp, traywin_b->win, &name_b) == 0) {
|
|
||||||
XFree(name_a.value);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
gint retval = g_ascii_strncasecmp((char*)name_a.value, (char*)name_b.value, -1) *
|
|
||||||
(systray.sort == SYSTRAY_SORT_ASCENDING ? 1 : -1);
|
|
||||||
XFree(name_a.value);
|
|
||||||
XFree(name_b.value);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if(XGetWMName(server.dsp, traywin_b->tray_id, &name_b) == 0) {
|
||||||
if (systray.sort == SYSTRAY_SORT_LEFT2RIGHT ||
|
XFree(name_a.value);
|
||||||
systray.sort == SYSTRAY_SORT_RIGHT2LEFT) {
|
return 1;
|
||||||
return (traywin_a->chrono - traywin_b->chrono) *
|
}
|
||||||
(systray.sort == SYSTRAY_SORT_LEFT2RIGHT ? 1 : -1);
|
else {
|
||||||
|
gint retval = g_ascii_strncasecmp((char*)name_a.value, (char*)name_b.value, -1) * systray.sort;
|
||||||
|
XFree(name_a.value);
|
||||||
|
XFree(name_b.value);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean add_icon(Window win)
|
gboolean add_icon(Window id)
|
||||||
{
|
{
|
||||||
TrayWindow *traywin;
|
TrayWindow *traywin;
|
||||||
|
XErrorHandler old;
|
||||||
Panel *panel = systray.area.panel;
|
Panel *panel = systray.area.panel;
|
||||||
int hide = 0;
|
int hide = 0;
|
||||||
|
|
||||||
// Get the process ID of the application that created the window
|
|
||||||
int pid = 0;
|
|
||||||
{
|
|
||||||
Atom actual_type;
|
|
||||||
int actual_format;
|
|
||||||
unsigned long nitems;
|
|
||||||
unsigned long bytes_after;
|
|
||||||
unsigned char *prop = 0;
|
|
||||||
int ret = XGetWindowProperty(server.dsp, win, server.atom._NET_WM_PID, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop);
|
|
||||||
if (ret == Success && prop) {
|
|
||||||
pid = prop[1] * 256;
|
|
||||||
pid += prop[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the application leaves behind empty icons
|
|
||||||
GSList *l;
|
GSList *l;
|
||||||
int num_empty_same_pid = 0;
|
|
||||||
for (l = systray.list_icons; l; l = l->next) {
|
for (l = systray.list_icons; l; l = l->next) {
|
||||||
if (((TrayWindow*)l->data)->win == win)
|
if (((TrayWindow*)l->data)->tray_id == id)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (pid && ((TrayWindow*)l->data)->pid == pid && ((TrayWindow*)l->data)->empty)
|
|
||||||
num_empty_same_pid++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove empty icons if the application leaves behind more than 1
|
error = FALSE;
|
||||||
const int max_num_empty_same_pid = 0;
|
|
||||||
if (num_empty_same_pid > max_num_empty_same_pid) {
|
|
||||||
for (l = systray.list_icons; l; l = l->next) {
|
|
||||||
if (pid && ((TrayWindow*)l->data)->pid == pid && ((TrayWindow*)l->data)->empty) {
|
|
||||||
num_empty_same_pid++;
|
|
||||||
fprintf(stderr, "Removing tray icon %lu from misbehaving application with pid=%d\n", ((TrayWindow*)l->data)->win, pid);
|
|
||||||
remove_icon((TrayWindow*)l->data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//printf("add_icon: %d, pid %d, %d\n", win, pid, num_empty_same_pid);
|
|
||||||
|
|
||||||
// Create the parent window that will embed the icon
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
if (XGetWindowAttributes(server.dsp, win, &attr) == False)
|
if ( XGetWindowAttributes(server.dsp, id, &attr) == False ) return FALSE;
|
||||||
return FALSE;
|
|
||||||
unsigned long mask = 0;
|
unsigned long mask = 0;
|
||||||
XSetWindowAttributes set_attr;
|
XSetWindowAttributes set_attr;
|
||||||
Visual* visual = server.visual;
|
Visual* visual = server.visual;
|
||||||
//printf("icon with depth: %d, width %d, height %d\n", attr.depth, attr.width, attr.height);
|
//printf("icon with depth: %d, width %d, height %d\n", attr.depth, attr.width, attr.height);
|
||||||
if (systray_composited || attr.depth != server.depth) {
|
//printf("icon with depth: %d\n", attr.depth);
|
||||||
|
if (attr.depth != server.depth || FORCE_COMPOSITED_RENDERING || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
||||||
visual = attr.visual;
|
visual = attr.visual;
|
||||||
set_attr.colormap = attr.colormap;
|
set_attr.colormap = attr.colormap;
|
||||||
set_attr.background_pixel = 0;
|
set_attr.background_pixel = 0;
|
||||||
set_attr.border_pixel = 0;
|
set_attr.border_pixel = 0;
|
||||||
mask = CWColormap|CWBackPixel|CWBorderPixel;
|
mask = CWColormap|CWBackPixel|CWBorderPixel;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
set_attr.background_pixmap = ParentRelative;
|
set_attr.background_pixmap = ParentRelative;
|
||||||
mask = CWBackPixmap;
|
mask = CWBackPixmap;
|
||||||
}
|
}
|
||||||
Window parent = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr);
|
Window parent_window;
|
||||||
|
parent_window = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr);
|
||||||
// Add the icon to the list
|
|
||||||
traywin = g_new0(TrayWindow, 1);
|
|
||||||
traywin->parent = parent;
|
|
||||||
traywin->win = win;
|
|
||||||
traywin->hide = hide;
|
|
||||||
traywin->depth = attr.depth;
|
|
||||||
// Reparenting is done at the first paint event when the window is positioned correctly over its empty background,
|
|
||||||
// to prevent graphical corruptions in icons with fake transparency
|
|
||||||
traywin->reparented = 0;
|
|
||||||
traywin->damage = 0;
|
|
||||||
traywin->empty = 0;
|
|
||||||
traywin->pid = pid;
|
|
||||||
traywin->chrono = chrono;
|
|
||||||
chrono++;
|
|
||||||
|
|
||||||
if (systray.area.on_screen == 0)
|
|
||||||
show(&systray.area);
|
|
||||||
|
|
||||||
if (systray.sort == SYSTRAY_SORT_RIGHT2LEFT)
|
|
||||||
systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
|
|
||||||
else
|
|
||||||
systray.list_icons = g_slist_append(systray.list_icons, traywin);
|
|
||||||
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
|
|
||||||
// printf("add_icon win %lx, %d\n", win, g_slist_length(systray.list_icons));
|
|
||||||
|
|
||||||
// Resize and redraw the systray
|
|
||||||
systray.area.resize = 1;
|
|
||||||
systray.area.redraw = 1;
|
|
||||||
panel->area.resize = 1;
|
|
||||||
panel_refresh = 1;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean reparent_icon(TrayWindow *traywin)
|
|
||||||
{
|
|
||||||
if (traywin->reparented)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
Panel* panel = systray.area.panel;
|
|
||||||
|
|
||||||
// Reparent
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
error = FALSE;
|
|
||||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
|
||||||
XReparentWindow(server.dsp, traywin->win, traywin->parent, 0, 0);
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
if (error != FALSE) {
|
|
||||||
printf("systray %d: cannot embed icon for window %lu parent %lu pid %d\n", __LINE__, traywin->win, traywin->parent, traywin->pid);
|
|
||||||
remove_icon(traywin);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch for the icon trying to resize itself / closing again
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
error = FALSE;
|
|
||||||
old = XSetErrorHandler(window_error_handler);
|
old = XSetErrorHandler(window_error_handler);
|
||||||
XSelectInput(server.dsp, traywin->win, StructureNotifyMask);
|
XReparentWindow(server.dsp, id, parent_window, 0, 0);
|
||||||
|
// watch for the icon trying to resize itself / closing again!
|
||||||
|
XSelectInput(server.dsp, id, StructureNotifyMask);
|
||||||
XSync(server.dsp, False);
|
XSync(server.dsp, False);
|
||||||
XSetErrorHandler(old);
|
XSetErrorHandler(old);
|
||||||
if (error != FALSE) {
|
if (error != FALSE) {
|
||||||
printf("systray %d: cannot embed icon for window %lu parent %lu pid %d\n", __LINE__, traywin->win, traywin->parent, traywin->pid);
|
fprintf(stderr, "tint2 : not icon_swallow\n");
|
||||||
remove_icon(traywin);
|
XDestroyWindow(server.dsp, parent_window);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
traywin->reparented = 1;
|
|
||||||
|
|
||||||
// Embed into parent
|
|
||||||
{
|
|
||||||
XEvent e;
|
|
||||||
e.xclient.type = ClientMessage;
|
|
||||||
e.xclient.serial = 0;
|
|
||||||
e.xclient.send_event = True;
|
|
||||||
e.xclient.message_type = server.atom._XEMBED;
|
|
||||||
e.xclient.window = traywin->win;
|
|
||||||
e.xclient.format = 32;
|
|
||||||
e.xclient.data.l[0] = CurrentTime;
|
|
||||||
e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY;
|
|
||||||
e.xclient.data.l[2] = 0;
|
|
||||||
e.xclient.data.l[3] = traywin->parent;
|
|
||||||
e.xclient.data.l[4] = 0;
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
error = FALSE;
|
|
||||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
|
||||||
XSendEvent(server.dsp, traywin->win, False, 0xFFFFFF, &e);
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
if (error != FALSE) {
|
|
||||||
printf("systray %d: cannot embed icon for window %lu pid %d\n", __LINE__, traywin->win, traywin->pid);
|
|
||||||
remove_icon(traywin);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if window was embedded
|
|
||||||
{
|
{
|
||||||
Atom acttype;
|
Atom acttype;
|
||||||
int actfmt;
|
int actfmt;
|
||||||
@@ -544,7 +407,7 @@ gboolean reparent_icon(TrayWindow *traywin)
|
|||||||
unsigned char *data = 0;
|
unsigned char *data = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = XGetWindowProperty(server.dsp, traywin->win, server.atom._XEMBED_INFO, 0, 2, False, server.atom._XEMBED_INFO, &acttype, &actfmt, &nbitem, &bytes, &data);
|
ret = XGetWindowProperty(server.dsp, id, server.atom._XEMBED_INFO, 0, 2, False, server.atom._XEMBED_INFO, &acttype, &actfmt, &nbitem, &bytes, &data);
|
||||||
if (ret == Success) {
|
if (ret == Success) {
|
||||||
if (data) {
|
if (data) {
|
||||||
if (nbitem == 2) {
|
if (nbitem == 2) {
|
||||||
@@ -553,51 +416,84 @@ gboolean reparent_icon(TrayWindow *traywin)
|
|||||||
}
|
}
|
||||||
XFree(data);
|
XFree(data);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
fprintf(stderr, "tint2 : xembed error\n");
|
fprintf(stderr, "tint2 : xembed error\n");
|
||||||
remove_icon(traywin);
|
XDestroyWindow(server.dsp, parent_window);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
// Redirect rendering when using compositing
|
XEvent e;
|
||||||
if (systray_composited) {
|
e.xclient.type = ClientMessage;
|
||||||
traywin->damage = XDamageCreate(server.dsp, traywin->parent, XDamageReportRawRectangles);
|
e.xclient.serial = 0;
|
||||||
XCompositeRedirectWindow(server.dsp, traywin->parent, CompositeRedirectManual);
|
e.xclient.send_event = True;
|
||||||
|
e.xclient.message_type = server.atom._XEMBED;
|
||||||
|
e.xclient.window = id;
|
||||||
|
e.xclient.format = 32;
|
||||||
|
e.xclient.data.l[0] = CurrentTime;
|
||||||
|
e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY;
|
||||||
|
e.xclient.data.l[2] = 0;
|
||||||
|
e.xclient.data.l[3] = parent_window;
|
||||||
|
e.xclient.data.l[4] = 0;
|
||||||
|
XSendEvent(server.dsp, id, False, 0xFFFFFF, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the icon visible
|
traywin = g_new0(TrayWindow, 1);
|
||||||
|
traywin->id = parent_window;
|
||||||
|
traywin->tray_id = id;
|
||||||
|
traywin->hide = hide;
|
||||||
|
traywin->depth = attr.depth;
|
||||||
|
traywin->damage = 0;
|
||||||
|
|
||||||
|
if (systray.area.on_screen == 0)
|
||||||
|
show(&systray.area);
|
||||||
|
|
||||||
|
if (systray.sort == 3)
|
||||||
|
systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
|
||||||
|
else if (systray.sort == 2)
|
||||||
|
systray.list_icons = g_slist_append(systray.list_icons, traywin);
|
||||||
|
else
|
||||||
|
systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows);
|
||||||
|
//printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons));
|
||||||
|
|
||||||
|
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
||||||
|
traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles);
|
||||||
|
XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show the window
|
||||||
if (!traywin->hide)
|
if (!traywin->hide)
|
||||||
XMapWindow(server.dsp, traywin->win);
|
XMapWindow(server.dsp, traywin->tray_id);
|
||||||
if (!traywin->hide && !panel->is_hidden)
|
if (!traywin->hide && !panel->is_hidden)
|
||||||
XMapRaised(server.dsp, traywin->parent);
|
XMapRaised(server.dsp, traywin->id);
|
||||||
|
|
||||||
XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height);
|
|
||||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
|
||||||
|
|
||||||
XFlush(server.dsp);
|
|
||||||
|
|
||||||
|
// changed in systray
|
||||||
|
systray.area.resize = 1;
|
||||||
|
panel_refresh = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void remove_icon(TrayWindow *traywin)
|
void remove_icon(TrayWindow *traywin)
|
||||||
{
|
{
|
||||||
|
XErrorHandler old;
|
||||||
|
|
||||||
// remove from our list
|
// remove from our list
|
||||||
systray.list_icons = g_slist_remove(systray.list_icons, traywin);
|
systray.list_icons = g_slist_remove(systray.list_icons, traywin);
|
||||||
printf("remove_icon: %lu\n", traywin->win);
|
//printf("remove_icon id %lx, %d\n", traywin->id);
|
||||||
|
|
||||||
XSelectInput(server.dsp, traywin->win, NoEventMask);
|
XSelectInput(server.dsp, traywin->tray_id, NoEventMask);
|
||||||
if (traywin->damage)
|
if (traywin->damage)
|
||||||
XDamageDestroy(server.dsp, traywin->damage);
|
XDamageDestroy(server.dsp, traywin->damage);
|
||||||
|
|
||||||
// reparent to root
|
// reparent to root
|
||||||
XSync(server.dsp, False);
|
|
||||||
error = FALSE;
|
error = FALSE;
|
||||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
old = XSetErrorHandler(window_error_handler);
|
||||||
if (!traywin->hide)
|
if (!traywin->hide)
|
||||||
XUnmapWindow(server.dsp, traywin->win);
|
XUnmapWindow(server.dsp, traywin->tray_id);
|
||||||
XReparentWindow(server.dsp, traywin->win, server.root_win, 0, 0);
|
XReparentWindow(server.dsp, traywin->tray_id, server.root_win, 0, 0);
|
||||||
XDestroyWindow(server.dsp, traywin->parent);
|
XDestroyWindow(server.dsp, traywin->id);
|
||||||
XSync(server.dsp, False);
|
XSync(server.dsp, False);
|
||||||
XSetErrorHandler(old);
|
XSetErrorHandler(old);
|
||||||
stop_timeout(traywin->render_timeout);
|
stop_timeout(traywin->render_timeout);
|
||||||
@@ -607,13 +503,12 @@ void remove_icon(TrayWindow *traywin)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
for (l = systray.list_icons; l; l = l->next) {
|
for (l = systray.list_icons; l; l = l->next) {
|
||||||
if (((TrayWindow*)l->data)->hide)
|
if (!((TrayWindow*)l->data)->hide)
|
||||||
continue;
|
count++;
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
hide(&systray.area);
|
hide(&systray.area);
|
||||||
|
|
||||||
// changed in systray
|
// changed in systray
|
||||||
systray.area.resize = 1;
|
systray.area.resize = 1;
|
||||||
panel_refresh = 1;
|
panel_refresh = 1;
|
||||||
@@ -623,119 +518,41 @@ void remove_icon(TrayWindow *traywin)
|
|||||||
void net_message(XClientMessageEvent *e)
|
void net_message(XClientMessageEvent *e)
|
||||||
{
|
{
|
||||||
unsigned long opcode;
|
unsigned long opcode;
|
||||||
Window win;
|
Window id;
|
||||||
|
|
||||||
opcode = e->data.l[1];
|
opcode = e->data.l[1];
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case SYSTEM_TRAY_REQUEST_DOCK:
|
case SYSTEM_TRAY_REQUEST_DOCK:
|
||||||
win = e->data.l[2];
|
id = e->data.l[2];
|
||||||
if (win)
|
if (id) add_icon(id);
|
||||||
add_icon(win);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_TRAY_BEGIN_MESSAGE:
|
case SYSTEM_TRAY_BEGIN_MESSAGE:
|
||||||
case SYSTEM_TRAY_CANCEL_MESSAGE:
|
case SYSTEM_TRAY_CANCEL_MESSAGE:
|
||||||
// we don't show baloons messages.
|
// we don't show baloons messages.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA)
|
if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA)
|
||||||
printf("message from dockapp: %s\n", e->data.b);
|
printf("message from dockapp: %s\n", e->data.b);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "SYSTEM_TRAY : unknown message type\n");
|
fprintf(stderr, "SYSTEM_TRAY : unknown message type\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Display *display = NULL;
|
void systray_render_icon_now(void* t)
|
||||||
XImage *tintXGetImage(Window win)
|
|
||||||
{
|
|
||||||
char *display_name = XDisplayName(NULL);
|
|
||||||
if (!display_name)
|
|
||||||
return NULL;
|
|
||||||
if (!display)
|
|
||||||
display = XOpenDisplay(display_name);
|
|
||||||
if (!display)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
unsigned int border_width;
|
|
||||||
int xpos, ypos;
|
|
||||||
unsigned int width, height, depth;
|
|
||||||
Window root;
|
|
||||||
if (!XGetGeometry(display, win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
|
||||||
fprintf(stderr, "Couldn't get geometry of window!\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return XGetImage(display, win, 0, 0, width, height, AllPlanes, XYPixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void systray_render_icon_composited(void* t)
|
|
||||||
{
|
{
|
||||||
// we end up in this function only in real transparency mode or if systray_task_asb != 100 0 0
|
// we end up in this function only in real transparency mode or if systray_task_asb != 100 0 0
|
||||||
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
||||||
TrayWindow* traywin = t;
|
TrayWindow* traywin = t;
|
||||||
|
traywin->render_timeout = 0;
|
||||||
// wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
|
|
||||||
struct timespec now;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
|
||||||
struct timespec earliest_render = add_msec_to_timespec(traywin->time_last_render, 50);
|
|
||||||
if (compare_timespecs(&earliest_render, &now) > 0) {
|
|
||||||
traywin->render_timeout = add_timeout(50, 0, systray_render_icon_composited, traywin, &traywin->render_timeout);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
traywin->time_last_render.tv_sec = now.tv_sec;
|
|
||||||
traywin->time_last_render.tv_nsec = now.tv_nsec;
|
|
||||||
|
|
||||||
if ( traywin->width == 0 || traywin->height == 0 ) {
|
if ( traywin->width == 0 || traywin->height == 0 ) {
|
||||||
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu)
|
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu)
|
||||||
traywin->render_timeout = add_timeout(50, 0, systray_render_icon_composited, traywin, &traywin->render_timeout);
|
systray_render_icon(traywin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (traywin->render_timeout) {
|
|
||||||
stop_timeout(traywin->render_timeout);
|
|
||||||
traywin->render_timeout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int empty = 1;
|
|
||||||
XImage *ximage = tintXGetImage(traywin->win);
|
|
||||||
if (ximage) {
|
|
||||||
if (ximage->width != traywin->width ||
|
|
||||||
ximage->height != traywin->height) {
|
|
||||||
XFree(ximage);
|
|
||||||
XCloseDisplay(display);
|
|
||||||
display = NULL;
|
|
||||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
XColor color;
|
|
||||||
if (ximage->width > 0 && ximage->height > 0) {
|
|
||||||
color.pixel = XGetPixel(ximage, ximage->width/2, ximage->height/2);
|
|
||||||
if (color.pixel != 0)
|
|
||||||
empty = 0;
|
|
||||||
int x, y;
|
|
||||||
for (x = 0; empty && x < ximage->width; x++) {
|
|
||||||
for (y = 0; empty && y < ximage->height; y++) {
|
|
||||||
color.pixel = XGetPixel(ximage, x, y);
|
|
||||||
if (color.pixel != 0)
|
|
||||||
empty = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XFree(ximage);
|
|
||||||
XCloseDisplay(display);
|
|
||||||
display = NULL;
|
|
||||||
}
|
|
||||||
if (traywin->empty != empty) {
|
|
||||||
traywin->empty = empty;
|
|
||||||
systray.area.resize = 1;
|
|
||||||
panel_refresh = 1;
|
|
||||||
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
|
|
||||||
}
|
|
||||||
//printf("systray_render_icon_now: %d empty %d\n", traywin->win, empty);
|
|
||||||
if (empty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// good systray icons support 32 bit depth, but some icons are still 24 bit.
|
// good systray icons support 32 bit depth, but some icons are still 24 bit.
|
||||||
// We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
|
// We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
|
||||||
// mask out all pixel with the same rgb value
|
// mask out all pixel with the same rgb value
|
||||||
@@ -744,46 +561,22 @@ void systray_render_icon_composited(void* t)
|
|||||||
// Very ugly hack, but somehow imlib2 is not able to get the image from the traywindow itself,
|
// Very ugly hack, but somehow imlib2 is not able to get the image from the traywindow itself,
|
||||||
// so we first render the tray window onto a pixmap, and then we tell imlib2 to use this pixmap as
|
// so we first render the tray window onto a pixmap, and then we tell imlib2 to use this pixmap as
|
||||||
// drawable. If someone knows why it does not work with the traywindow itself, please tell me ;)
|
// drawable. If someone knows why it does not work with the traywindow itself, please tell me ;)
|
||||||
Pixmap tmp_pmap = XCreatePixmap(server.dsp, traywin->win, traywin->width, traywin->height, 32);
|
Pixmap tmp_pmap = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, 32);
|
||||||
if (!tmp_pmap) {
|
XRenderPictFormat* f;
|
||||||
goto on_error;
|
if (traywin->depth == 24)
|
||||||
}
|
|
||||||
XRenderPictFormat *f;
|
|
||||||
if (traywin->depth == 24) {
|
|
||||||
f = XRenderFindStandardFormat(server.dsp, PictStandardRGB24);
|
f = XRenderFindStandardFormat(server.dsp, PictStandardRGB24);
|
||||||
} else if (traywin->depth == 32) {
|
else if (traywin->depth == 32)
|
||||||
f = XRenderFindStandardFormat(server.dsp, PictStandardARGB32);
|
f = XRenderFindStandardFormat(server.dsp, PictStandardARGB32);
|
||||||
} else {
|
else {
|
||||||
printf("Strange tray icon found with depth: %d\n", traywin->depth);
|
printf("Strange tray icon found with depth: %d\n", traywin->depth);
|
||||||
XFreePixmap(server.dsp, tmp_pmap);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XRenderPictFormat *f32 = XRenderFindVisualFormat(server.dsp, server.visual32);
|
Picture pict_image;
|
||||||
if (!f || !f32) {
|
|
||||||
XFreePixmap(server.dsp, tmp_pmap);
|
|
||||||
goto on_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
error = FALSE;
|
|
||||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
|
||||||
|
|
||||||
//if (server.real_transparency)
|
//if (server.real_transparency)
|
||||||
//Picture pict_image = XRenderCreatePicture(server.dsp, traywin->parent, f, 0, 0);
|
//pict_image = XRenderCreatePicture(server.dsp, traywin->id, f, 0, 0);
|
||||||
// reverted Rev 407 because here it's breaking alls icon with systray + xcompmgr
|
// reverted Rev 407 because here it's breaking alls icon with systray + xcompmgr
|
||||||
Picture pict_image = XRenderCreatePicture(server.dsp, traywin->win, f, 0, 0);
|
pict_image = XRenderCreatePicture(server.dsp, traywin->tray_id, f, 0, 0);
|
||||||
if (!pict_image) {
|
|
||||||
XFreePixmap(server.dsp, tmp_pmap);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
goto on_error;
|
|
||||||
}
|
|
||||||
Picture pict_drawable = XRenderCreatePicture(server.dsp, tmp_pmap, XRenderFindVisualFormat(server.dsp, server.visual32), 0, 0);
|
Picture pict_drawable = XRenderCreatePicture(server.dsp, tmp_pmap, XRenderFindVisualFormat(server.dsp, server.visual32), 0, 0);
|
||||||
if (!pict_drawable) {
|
|
||||||
XRenderFreePicture(server.dsp, pict_image);
|
|
||||||
XFreePixmap(server.dsp, tmp_pmap);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
goto on_error;
|
|
||||||
}
|
|
||||||
XRenderComposite(server.dsp, PictOpSrc, pict_image, None, pict_drawable, 0, 0, 0, 0, 0, 0, traywin->width, traywin->height);
|
XRenderComposite(server.dsp, PictOpSrc, pict_image, None, pict_drawable, 0, 0, 0, 0, 0, 0, traywin->width, traywin->height);
|
||||||
XRenderFreePicture(server.dsp, pict_image);
|
XRenderFreePicture(server.dsp, pict_image);
|
||||||
XRenderFreePicture(server.dsp, pict_drawable);
|
XRenderFreePicture(server.dsp, pict_drawable);
|
||||||
@@ -793,17 +586,12 @@ void systray_render_icon_composited(void* t)
|
|||||||
imlib_context_set_colormap(server.colormap32);
|
imlib_context_set_colormap(server.colormap32);
|
||||||
imlib_context_set_drawable(tmp_pmap);
|
imlib_context_set_drawable(tmp_pmap);
|
||||||
Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, traywin->width, traywin->height, 1);
|
Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, traywin->width, traywin->height, 1);
|
||||||
if (!image) {
|
if (image == 0)
|
||||||
imlib_context_set_visual(server.visual);
|
return;
|
||||||
imlib_context_set_colormap(server.colormap);
|
|
||||||
XFreePixmap(server.dsp, tmp_pmap);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
goto on_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
imlib_context_set_image(image);
|
imlib_context_set_image(image);
|
||||||
//if (traywin->depth == 24)
|
//if (traywin->depth == 24)
|
||||||
//imlib_save_image("/home/thil77/test.jpg");
|
//imlib_save_image("/home/thil77/test.jpg");
|
||||||
imlib_image_set_has_alpha(1);
|
imlib_image_set_has_alpha(1);
|
||||||
DATA32* data = imlib_image_get_data();
|
DATA32* data = imlib_image_get_data();
|
||||||
if (traywin->depth == 24) {
|
if (traywin->depth == 24) {
|
||||||
@@ -823,36 +611,21 @@ void systray_render_icon_composited(void* t)
|
|||||||
if (traywin->damage)
|
if (traywin->damage)
|
||||||
XDamageSubtract(server.dsp, traywin->damage, None, None);
|
XDamageSubtract(server.dsp, traywin->damage, None, None);
|
||||||
XFlush(server.dsp);
|
XFlush(server.dsp);
|
||||||
|
|
||||||
XSync(server.dsp, False);
|
|
||||||
XSetErrorHandler(old);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
goto on_error;
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
on_error:
|
|
||||||
printf("systray: rendering error. Disabling compositing and restarting systray...\n");
|
|
||||||
systray_composited = 0;
|
|
||||||
stop_net();
|
|
||||||
start_net();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void systray_render_icon(TrayWindow* traywin)
|
void systray_render_icon(TrayWindow* traywin)
|
||||||
{
|
{
|
||||||
if (!reparent_icon(traywin))
|
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
||||||
return;
|
// wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
|
||||||
|
|
||||||
if (systray_composited) {
|
|
||||||
if (!traywin->render_timeout)
|
if (!traywin->render_timeout)
|
||||||
systray_render_icon_composited(traywin);
|
traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin, &traywin->render_timeout);
|
||||||
} else {
|
}
|
||||||
// Trigger window repaint
|
else {
|
||||||
XClearArea(server.dsp, traywin->parent, 0, 0, traywin->width, traywin->height, True);
|
// Pixmap pix = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, server.depth);
|
||||||
XClearArea(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height, True);
|
// XCopyArea(server.dsp, panel->temp_pmap, pix, server.gc, traywin->x, traywin->y, traywin->width, traywin->height, 0, 0);
|
||||||
|
// XSetWindowBackgroundPixmap(server.dsp, traywin->id, pix);
|
||||||
|
XClearArea(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,8 +636,7 @@ void refresh_systray_icon()
|
|||||||
GSList *l;
|
GSList *l;
|
||||||
for (l = systray.list_icons; l ; l = l->next) {
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
traywin = (TrayWindow*)l->data;
|
traywin = (TrayWindow*)l->data;
|
||||||
if (traywin->hide)
|
if (traywin->hide) continue;
|
||||||
continue;
|
|
||||||
systray_render_icon(traywin);
|
systray_render_icon(traywin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
// Flags for _XEMBED_INFO
|
// Flags for _XEMBED_INFO
|
||||||
#define XEMBED_MAPPED (1 << 0)
|
#define XEMBED_MAPPED (1 << 0)
|
||||||
|
|
||||||
enum { SYSTRAY_SORT_ASCENDING, SYSTRAY_SORT_DESCENDING, SYSTRAY_SORT_LEFT2RIGHT, SYSTRAY_SORT_RIGHT2LEFT };
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// always start with area
|
// always start with area
|
||||||
@@ -35,8 +34,8 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Window parent;
|
Window id;
|
||||||
Window win;
|
Window tray_id;
|
||||||
int x, y;
|
int x, y;
|
||||||
int width, height;
|
int width, height;
|
||||||
// TODO: manage icon's show/hide
|
// TODO: manage icon's show/hide
|
||||||
@@ -44,11 +43,6 @@ typedef struct
|
|||||||
int depth;
|
int depth;
|
||||||
Damage damage;
|
Damage damage;
|
||||||
timeout* render_timeout;
|
timeout* render_timeout;
|
||||||
int empty;
|
|
||||||
int pid;
|
|
||||||
int chrono;
|
|
||||||
struct timespec time_last_render;
|
|
||||||
int reparented;
|
|
||||||
} TrayWindow;
|
} TrayWindow;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ Task *add_task (Window win)
|
|||||||
if (!win) return 0;
|
if (!win) return 0;
|
||||||
if (window_is_hidden(win)) return 0;
|
if (window_is_hidden(win)) return 0;
|
||||||
|
|
||||||
XSelectInput(server.dsp, win, PropertyChangeMask|StructureNotifyMask);
|
|
||||||
XFlush(server.dsp);
|
|
||||||
|
|
||||||
int monitor;
|
int monitor;
|
||||||
if (nb_panel > 1) {
|
if (nb_panel > 1) {
|
||||||
monitor = window_get_monitor (win);
|
monitor = window_get_monitor (win);
|
||||||
@@ -78,7 +75,8 @@ Task *add_task (Window win)
|
|||||||
get_title(&new_tsk);
|
get_title(&new_tsk);
|
||||||
get_icon(&new_tsk);
|
get_icon(&new_tsk);
|
||||||
|
|
||||||
//printf("new task %s win %u: desktop %d, monitor %d\n", new_tsk.title, win, new_tsk.desktop, monitor);
|
//printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor);
|
||||||
|
XSelectInput (server.dsp, new_tsk.win, PropertyChangeMask|StructureNotifyMask);
|
||||||
|
|
||||||
GPtrArray* task_group = g_ptr_array_new();
|
GPtrArray* task_group = g_ptr_array_new();
|
||||||
Taskbar *tskbar;
|
Taskbar *tskbar;
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ int taskbar_distribute_size;
|
|||||||
int hide_inactive_tasks;
|
int hide_inactive_tasks;
|
||||||
int hide_task_diff_monitor;
|
int hide_task_diff_monitor;
|
||||||
int taskbar_sort_method;
|
int taskbar_sort_method;
|
||||||
int taskbar_alignment;
|
|
||||||
|
|
||||||
guint win_hash(gconstpointer key) { return (guint)*((Window*)key); }
|
guint win_hash(gconstpointer key) { return (guint)*((Window*)key); }
|
||||||
gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }
|
gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }
|
||||||
@@ -64,7 +63,6 @@ void default_taskbar()
|
|||||||
hide_inactive_tasks = 0;
|
hide_inactive_tasks = 0;
|
||||||
hide_task_diff_monitor = 0;
|
hide_task_diff_monitor = 0;
|
||||||
taskbar_sort_method = TASKBAR_NOSORT;
|
taskbar_sort_method = TASKBAR_NOSORT;
|
||||||
taskbar_alignment = ALIGN_LEFT;
|
|
||||||
default_taskbarname();
|
default_taskbarname();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +153,7 @@ void init_taskbar_panel(void *p)
|
|||||||
panel->g_taskbar.area.parent = panel;
|
panel->g_taskbar.area.parent = panel;
|
||||||
panel->g_taskbar.area.panel = panel;
|
panel->g_taskbar.area.panel = panel;
|
||||||
panel->g_taskbar.area.size_mode = SIZE_BY_LAYOUT;
|
panel->g_taskbar.area.size_mode = SIZE_BY_LAYOUT;
|
||||||
panel->g_taskbar.area.alignment = taskbar_alignment;
|
panel->g_taskbar.area.alignment = ALIGN_CENTER;
|
||||||
panel->g_taskbar.area._resize = resize_taskbar;
|
panel->g_taskbar.area._resize = resize_taskbar;
|
||||||
panel->g_taskbar.area._draw_foreground = draw_taskbar;
|
panel->g_taskbar.area._draw_foreground = draw_taskbar;
|
||||||
panel->g_taskbar.area._on_change_layout = on_change_taskbar;
|
panel->g_taskbar.area._on_change_layout = on_change_taskbar;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ extern int hide_inactive_tasks;
|
|||||||
extern int hide_task_diff_monitor;
|
extern int hide_task_diff_monitor;
|
||||||
enum { TASKBAR_NOSORT, TASKBAR_SORT_CENTER, TASKBAR_SORT_TITLE };
|
enum { TASKBAR_NOSORT, TASKBAR_SORT_CENTER, TASKBAR_SORT_TITLE };
|
||||||
extern int taskbar_sort_method;
|
extern int taskbar_sort_method;
|
||||||
extern int taskbar_alignment;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// always start with area
|
// always start with area
|
||||||
|
|||||||
198
src/tint.c
198
src/tint.c
@@ -117,12 +117,12 @@ void init (int argc, char *argv[])
|
|||||||
// BSD does not support pselect(), therefore we have to use select and hope that we do not
|
// BSD does not support pselect(), therefore we have to use select and hope that we do not
|
||||||
// end up in a race condition there (see 'man select()' on a linux machine for more information)
|
// end up in a race condition there (see 'man select()' on a linux machine for more information)
|
||||||
// block all signals, such that no race conditions occur before pselect in our main loop
|
// block all signals, such that no race conditions occur before pselect in our main loop
|
||||||
// sigset_t block_mask;
|
// sigset_t block_mask;
|
||||||
// sigaddset(&block_mask, SIGINT);
|
// sigaddset(&block_mask, SIGINT);
|
||||||
// sigaddset(&block_mask, SIGTERM);
|
// sigaddset(&block_mask, SIGTERM);
|
||||||
// sigaddset(&block_mask, SIGHUP);
|
// sigaddset(&block_mask, SIGHUP);
|
||||||
// sigaddset(&block_mask, SIGUSR1);
|
// sigaddset(&block_mask, SIGUSR1);
|
||||||
// sigprocmask(SIG_BLOCK, &block_mask, 0);
|
// sigprocmask(SIG_BLOCK, &block_mask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sn_pipe_valid = 0;
|
static int sn_pipe_valid = 0;
|
||||||
@@ -241,7 +241,7 @@ void init_X11_post_config()
|
|||||||
|
|
||||||
/* Catch events */
|
/* Catch events */
|
||||||
XSelectInput (server.dsp, server.root_win, PropertyChangeMask|StructureNotifyMask);
|
XSelectInput (server.dsp, server.root_win, PropertyChangeMask|StructureNotifyMask);
|
||||||
|
|
||||||
// load default icon
|
// load default icon
|
||||||
gchar *path;
|
gchar *path;
|
||||||
const gchar * const *data_dirs;
|
const gchar * const *data_dirs;
|
||||||
@@ -323,60 +323,60 @@ void window_action (Task *tsk, int action)
|
|||||||
if (!tsk) return;
|
if (!tsk) return;
|
||||||
int desk;
|
int desk;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
set_close (tsk->win);
|
set_close (tsk->win);
|
||||||
break;
|
break;
|
||||||
case TOGGLE:
|
case TOGGLE:
|
||||||
set_active(tsk->win);
|
set_active(tsk->win);
|
||||||
break;
|
break;
|
||||||
case ICONIFY:
|
case ICONIFY:
|
||||||
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
|
||||||
break;
|
|
||||||
case TOGGLE_ICONIFY:
|
|
||||||
if (task_active && tsk->win == task_active->win)
|
|
||||||
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||||
else
|
break;
|
||||||
set_active (tsk->win);
|
case TOGGLE_ICONIFY:
|
||||||
break;
|
if (task_active && tsk->win == task_active->win)
|
||||||
case SHADE:
|
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||||
window_toggle_shade (tsk->win);
|
else
|
||||||
break;
|
set_active (tsk->win);
|
||||||
case MAXIMIZE_RESTORE:
|
break;
|
||||||
window_maximize_restore (tsk->win);
|
case SHADE:
|
||||||
break;
|
window_toggle_shade (tsk->win);
|
||||||
case MAXIMIZE:
|
break;
|
||||||
window_maximize_restore (tsk->win);
|
case MAXIMIZE_RESTORE:
|
||||||
break;
|
window_maximize_restore (tsk->win);
|
||||||
case RESTORE:
|
break;
|
||||||
window_maximize_restore (tsk->win);
|
case MAXIMIZE:
|
||||||
break;
|
window_maximize_restore (tsk->win);
|
||||||
case DESKTOP_LEFT:
|
break;
|
||||||
if ( tsk->desktop == 0 ) break;
|
case RESTORE:
|
||||||
desk = tsk->desktop - 1;
|
window_maximize_restore (tsk->win);
|
||||||
windows_set_desktop(tsk->win, desk);
|
break;
|
||||||
if (desk == server.desktop)
|
case DESKTOP_LEFT:
|
||||||
set_active(tsk->win);
|
if ( tsk->desktop == 0 ) break;
|
||||||
break;
|
desk = tsk->desktop - 1;
|
||||||
case DESKTOP_RIGHT:
|
windows_set_desktop(tsk->win, desk);
|
||||||
if (tsk->desktop == server.nb_desktop ) break;
|
if (desk == server.desktop)
|
||||||
desk = tsk->desktop + 1;
|
set_active(tsk->win);
|
||||||
windows_set_desktop(tsk->win, desk);
|
break;
|
||||||
if (desk == server.desktop)
|
case DESKTOP_RIGHT:
|
||||||
set_active(tsk->win);
|
if (tsk->desktop == server.nb_desktop ) break;
|
||||||
break;
|
desk = tsk->desktop + 1;
|
||||||
case NEXT_TASK:
|
windows_set_desktop(tsk->win, desk);
|
||||||
{
|
if (desk == server.desktop)
|
||||||
Task *tsk1;
|
set_active(tsk->win);
|
||||||
tsk1 = next_task(find_active_task(tsk, task_active));
|
break;
|
||||||
set_active(tsk1->win);
|
case NEXT_TASK:
|
||||||
}
|
{
|
||||||
break;
|
Task *tsk1;
|
||||||
case PREV_TASK:
|
tsk1 = next_task(find_active_task(tsk, task_active));
|
||||||
{
|
set_active(tsk1->win);
|
||||||
Task *tsk1;
|
}
|
||||||
tsk1 = prev_task(find_active_task(tsk, task_active));
|
break;
|
||||||
set_active(tsk1->win);
|
case PREV_TASK:
|
||||||
}
|
{
|
||||||
|
Task *tsk1;
|
||||||
|
tsk1 = prev_task(find_active_task(tsk, task_active));
|
||||||
|
set_active(tsk1->win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,10 +386,10 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e)
|
|||||||
Task* task = click_task(panel, e->x, e->y);
|
Task* task = click_task(panel, e->x, e->y);
|
||||||
if (task) {
|
if (task) {
|
||||||
if( (e->button == 1 && mouse_left != 0)
|
if( (e->button == 1 && mouse_left != 0)
|
||||||
|| (e->button == 2 && mouse_middle != 0)
|
|| (e->button == 2 && mouse_middle != 0)
|
||||||
|| (e->button == 3 && mouse_right != 0)
|
|| (e->button == 3 && mouse_right != 0)
|
||||||
|| (e->button == 4 && mouse_scroll_up != 0)
|
|| (e->button == 4 && mouse_scroll_up != 0)
|
||||||
|| (e->button == 5 && mouse_scroll_down !=0) )
|
|| (e->button == 5 && mouse_scroll_down !=0) )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -530,27 +530,27 @@ void event_button_release (XEvent *e)
|
|||||||
|
|
||||||
int action = TOGGLE_ICONIFY;
|
int action = TOGGLE_ICONIFY;
|
||||||
switch (e->xbutton.button) {
|
switch (e->xbutton.button) {
|
||||||
case 1:
|
case 1:
|
||||||
action = mouse_left;
|
action = mouse_left;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
action = mouse_middle;
|
action = mouse_middle;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
action = mouse_right;
|
action = mouse_right;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
action = mouse_scroll_up;
|
action = mouse_scroll_up;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
action = mouse_scroll_down;
|
action = mouse_scroll_down;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
action = mouse_tilt_left;
|
action = mouse_tilt_left;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
action = mouse_tilt_right;
|
action = mouse_tilt_right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( click_clock(panel, e->xbutton.x, e->xbutton.y)) {
|
if ( click_clock(panel, e->xbutton.x, e->xbutton.y)) {
|
||||||
@@ -619,7 +619,8 @@ void event_property_notify (XEvent *e)
|
|||||||
// Change name of desktops
|
// Change name of desktops
|
||||||
else if (at == server.atom._NET_DESKTOP_NAMES) {
|
else if (at == server.atom._NET_DESKTOP_NAMES) {
|
||||||
if (!taskbarname_enabled) return;
|
if (!taskbarname_enabled) return;
|
||||||
GSList *l, *list = server_get_name_of_desktop();
|
GSList *list = server_get_name_of_desktop();
|
||||||
|
GSList *l;
|
||||||
int j;
|
int j;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
Taskbar *tskbar;
|
Taskbar *tskbar;
|
||||||
@@ -726,7 +727,6 @@ void event_property_notify (XEvent *e)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tsk = task_get_task (win);
|
tsk = task_get_task (win);
|
||||||
//printf("change win = %u, task = %p\n", win, tsk);
|
|
||||||
if (!tsk) {
|
if (!tsk) {
|
||||||
if (at != server.atom._NET_WM_STATE)
|
if (at != server.atom._NET_WM_STATE)
|
||||||
return;
|
return;
|
||||||
@@ -830,13 +830,11 @@ void event_configure_notify (Window win)
|
|||||||
GSList *l;
|
GSList *l;
|
||||||
for (l = systray.list_icons; l ; l = l->next) {
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
traywin = (TrayWindow*)l->data;
|
traywin = (TrayWindow*)l->data;
|
||||||
if (traywin->win == win) {
|
if (traywin->tray_id == win) {
|
||||||
//printf("move tray %d\n", traywin->x);
|
//printf("move tray %d\n", traywin->x);
|
||||||
XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height);
|
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height);
|
||||||
if (traywin->reparented)
|
XResizeWindow(server.dsp, traywin->tray_id, traywin->width, traywin->height);
|
||||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
|
||||||
panel_refresh = 1;
|
panel_refresh = 1;
|
||||||
refresh_systray = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -896,8 +894,8 @@ struct Property read_property(Display* disp, Window w, Atom property)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
XFree(ret);
|
XFree(ret);
|
||||||
XGetWindowProperty(disp, w, property, 0, read_bytes, False, AnyPropertyType,
|
XGetWindowProperty(disp, w, property, 0, read_bytes, False, AnyPropertyType,
|
||||||
&actual_type, &actual_format, &nitems, &bytes_after,
|
&actual_type, &actual_format, &nitems, &bytes_after,
|
||||||
&ret);
|
&ret);
|
||||||
read_bytes *= 2;
|
read_bytes *= 2;
|
||||||
} while (bytes_after != 0);
|
} while (bytes_after != 0);
|
||||||
|
|
||||||
@@ -1127,8 +1125,8 @@ start:
|
|||||||
dnd_sent_request = 0;
|
dnd_sent_request = 0;
|
||||||
dnd_launcher_exec = 0;
|
dnd_launcher_exec = 0;
|
||||||
|
|
||||||
// sigset_t empty_mask;
|
// sigset_t empty_mask;
|
||||||
// sigemptyset(&empty_mask);
|
// sigemptyset(&empty_mask);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (panel_refresh) {
|
if (panel_refresh) {
|
||||||
@@ -1269,8 +1267,8 @@ start:
|
|||||||
if (e.xany.window == g_tooltip.window || !systray_enabled)
|
if (e.xany.window == g_tooltip.window || !systray_enabled)
|
||||||
break;
|
break;
|
||||||
for (it = systray.list_icons; it; it = g_slist_next(it)) {
|
for (it = systray.list_icons; it; it = g_slist_next(it)) {
|
||||||
if (((TrayWindow*)it->data)->win == e.xany.window) {
|
if (((TrayWindow*)it->data)->tray_id == e.xany.window) {
|
||||||
remove_icon((TrayWindow*)it->data);
|
remove_icon((TrayWindow*)it->data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1414,8 +1412,8 @@ start:
|
|||||||
XDamageNotifyEvent* de = &event_union.de;
|
XDamageNotifyEvent* de = &event_union.de;
|
||||||
for (l = systray.list_icons; l ; l = l->next) {
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
traywin = (TrayWindow*)l->data;
|
traywin = (TrayWindow*)l->data;
|
||||||
if ( traywin->parent == de->drawable ) {
|
if ( traywin->id == de->drawable ) {
|
||||||
systray_render_icon(traywin);
|
systray_render_icon(traywin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,17 +56,13 @@ target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
|
|||||||
${RSVG_LIBRARIES} )
|
${RSVG_LIBRARIES} )
|
||||||
|
|
||||||
if ( NOT DATADIR )
|
if ( NOT DATADIR )
|
||||||
set(DATADIR share)
|
set( DATADIR share )
|
||||||
endif( NOT DATADIR )
|
endif( NOT DATADIR )
|
||||||
|
|
||||||
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
|
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
|
||||||
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${DATADIR}/locale\" )
|
|
||||||
add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" )
|
|
||||||
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread" )
|
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread" )
|
||||||
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
|
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
|
||||||
|
|
||||||
add_subdirectory(po)
|
|
||||||
|
|
||||||
install( TARGETS tint2conf DESTINATION bin )
|
install( TARGETS tint2conf DESTINATION bin )
|
||||||
install( FILES tint2conf.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
|
install( FILES tint2conf.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
|
||||||
install( FILES tint2conf.desktop DESTINATION ${DATADIR}/applications )
|
install( FILES tint2conf.desktop DESTINATION ${DATADIR}/applications )
|
||||||
|
|||||||
@@ -119,12 +119,26 @@ static const char *global_ui =
|
|||||||
" </popup>"
|
" </popup>"
|
||||||
"</ui>";
|
"</ui>";
|
||||||
|
|
||||||
|
|
||||||
|
// define menubar and toolbar action
|
||||||
|
static GtkActionEntry entries[] = {
|
||||||
|
{"ThemeMenu", NULL, _("Theme"), NULL, NULL, NULL},
|
||||||
|
{"ThemeAdd", GTK_STOCK_ADD, _("_Import theme..."), "<Control>N", _("Import theme"), G_CALLBACK(menuImport)},
|
||||||
|
{"ThemeDefault", GTK_STOCK_NEW, _("_Import default theme..."), NULL, _("Import default theme"), G_CALLBACK(menuImportDefault)},
|
||||||
|
{"ThemeSaveAs", GTK_STOCK_SAVE_AS, _("_Save as..."), NULL, _("Save theme as"), G_CALLBACK(menuSaveAs)},
|
||||||
|
{"ThemeDelete", GTK_STOCK_DELETE, _("_Delete"), NULL, _("Delete theme"), G_CALLBACK(menuDelete)},
|
||||||
|
{"ThemeProperties", GTK_STOCK_PROPERTIES, _("_Edit theme..."), NULL, _("Edit selected theme"), G_CALLBACK(edit_current_theme)},
|
||||||
|
{"ThemeQuit", GTK_STOCK_QUIT, _("_Quit"), "<control>Q", _("Quit"), G_CALLBACK(gtk_main_quit)},
|
||||||
|
{"EditMenu", NULL, "Edit", NULL, NULL, NULL},
|
||||||
|
{"EditRefresh", GTK_STOCK_REFRESH, _("Refresh"), NULL, _("Refresh"), G_CALLBACK(refresh_current_theme)},
|
||||||
|
{"EditRefreshAll", GTK_STOCK_REFRESH, _("Refresh all"), NULL, _("Refresh all"), G_CALLBACK(load_all_themes)},
|
||||||
|
{"HelpMenu", NULL, _("Help"), NULL, NULL, NULL},
|
||||||
|
{"HelpAbout", GTK_STOCK_ABOUT, _("_About"), "<Control>A", _("About"), G_CALLBACK(menuAbout)}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
|
||||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
|
||||||
textdomain(GETTEXT_PACKAGE);
|
|
||||||
|
|
||||||
GtkWidget *vBox = NULL, *scrollbar = NULL;
|
GtkWidget *vBox = NULL, *scrollbar = NULL;
|
||||||
GtkActionGroup *actionGroup;
|
GtkActionGroup *actionGroup;
|
||||||
|
|
||||||
@@ -153,23 +167,6 @@ int main(int argc, char **argv)
|
|||||||
gtk_container_add(GTK_CONTAINER(g_window), vBox);
|
gtk_container_add(GTK_CONTAINER(g_window), vBox);
|
||||||
|
|
||||||
actionGroup = gtk_action_group_new("menuActionGroup");
|
actionGroup = gtk_action_group_new("menuActionGroup");
|
||||||
|
|
||||||
// Menubar and toolbar entries
|
|
||||||
GtkActionEntry entries[] = {
|
|
||||||
{"ThemeMenu", NULL, _("Theme"), NULL, NULL, NULL},
|
|
||||||
{"ThemeAdd", GTK_STOCK_ADD, _("_Import theme..."), "<Control>N", _("Import theme"), G_CALLBACK(menuImport)},
|
|
||||||
{"ThemeDefault", GTK_STOCK_NEW, _("_Import default theme..."), NULL, _("Import default theme"), G_CALLBACK(menuImportDefault)},
|
|
||||||
{"ThemeSaveAs", GTK_STOCK_SAVE_AS, _("_Save as..."), NULL, _("Save theme as"), G_CALLBACK(menuSaveAs)},
|
|
||||||
{"ThemeDelete", GTK_STOCK_DELETE, _("_Delete"), NULL, _("Delete theme"), G_CALLBACK(menuDelete)},
|
|
||||||
{"ThemeProperties", GTK_STOCK_PROPERTIES, _("_Edit theme..."), NULL, _("Edit selected theme"), G_CALLBACK(edit_current_theme)},
|
|
||||||
{"ThemeQuit", GTK_STOCK_QUIT, _("_Quit"), "<control>Q", _("Quit"), G_CALLBACK(gtk_main_quit)},
|
|
||||||
{"EditMenu", NULL, _("Edit"), NULL, NULL, NULL},
|
|
||||||
{"EditRefresh", GTK_STOCK_REFRESH, _("Refresh"), NULL, _("Refresh"), G_CALLBACK(refresh_current_theme)},
|
|
||||||
{"EditRefreshAll", GTK_STOCK_REFRESH, _("Refresh all"), NULL, _("Refresh all"), G_CALLBACK(load_all_themes)},
|
|
||||||
{"HelpMenu", NULL, _("Help"), NULL, NULL, NULL},
|
|
||||||
{"HelpAbout", GTK_STOCK_ABOUT, _("_About"), "<Control>A", _("About"), G_CALLBACK(menuAbout)}
|
|
||||||
};
|
|
||||||
|
|
||||||
gtk_action_group_add_actions(actionGroup, entries, G_N_ELEMENTS(entries), NULL);
|
gtk_action_group_add_actions(actionGroup, entries, G_N_ELEMENTS(entries), NULL);
|
||||||
globalUIManager = gtk_ui_manager_new();
|
globalUIManager = gtk_ui_manager_new();
|
||||||
gtk_ui_manager_insert_action_group(globalUIManager, actionGroup, 0);
|
gtk_ui_manager_insert_action_group(globalUIManager, actionGroup, 0);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#else
|
#else
|
||||||
#define _(String) String
|
#define _(String) String
|
||||||
#define GETTEXT_PACKAGE "tint2conf"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SNAPSHOT_TICK 190
|
#define SNAPSHOT_TICK 190
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
include(FindGettext)
|
|
||||||
if (GETTEXT_FOUND)
|
|
||||||
set(GETTEXT_PACKAGE tint2conf)
|
|
||||||
file(GLOB POTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po")
|
|
||||||
string(REPLACE ".po" " " LANGUAGES ${POTFILES})
|
|
||||||
message(STATUS "gettext found languages: ${LANGUAGES}")
|
|
||||||
string(REPLACE " " ";" LANGUAGES ${LANGUAGES})
|
|
||||||
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.8")
|
|
||||||
GETTEXT_CREATE_TRANSLATIONS("${CMAKE_CURRENT_SOURCE_DIR}/tint2conf.pot" ALL ${POTFILES})
|
|
||||||
else()
|
|
||||||
foreach(LANG ${LANGUAGES})
|
|
||||||
GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${LANG}.po)
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${DATADIR}/locale/${LANG}/LC_MESSAGES"
|
|
||||||
RENAME "${GETTEXT_PACKAGE}.mo")
|
|
||||||
endforeach ()
|
|
||||||
endif()
|
|
||||||
else ()
|
|
||||||
message(STATUS "gettext not found")
|
|
||||||
endif ()
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@ extern GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor;
|
|||||||
extern GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name_inactive_color, *taskbar_name_active_color, *taskbar_name_font;
|
extern GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name_inactive_color, *taskbar_name_active_color, *taskbar_name_font;
|
||||||
extern GtkWidget *taskbar_active_background, *taskbar_inactive_background;
|
extern GtkWidget *taskbar_active_background, *taskbar_inactive_background;
|
||||||
extern GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;
|
extern GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;
|
||||||
extern GtkWidget *taskbar_distribute_size, *taskbar_sort_order, *taskbar_alignment;
|
extern GtkWidget *taskbar_distribute_size, *taskbar_sort_order;
|
||||||
|
|
||||||
// task
|
// task
|
||||||
extern GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
|
extern GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
|
||||||
|
|||||||
@@ -272,16 +272,6 @@ void config_write_taskbar(FILE *fp)
|
|||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
|
|
||||||
fprintf(fp, "task_align = ");
|
|
||||||
if (gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_alignment)) <= 0) {
|
|
||||||
fprintf(fp, "left");
|
|
||||||
} else if (gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_alignment)) == 1) {
|
|
||||||
fprintf(fp, "center");
|
|
||||||
} else {
|
|
||||||
fprintf(fp, "right");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
|
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1008,16 +998,6 @@ void add_entry(char *key, char *value)
|
|||||||
else
|
else
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "task_align") == 0) {
|
|
||||||
if (strcmp(value, "left") == 0)
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0);
|
|
||||||
else if (strcmp(value, "center") == 0)
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 1);
|
|
||||||
else if (strcmp(value, "right") == 0)
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 2);
|
|
||||||
else
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0);
|
|
||||||
}
|
|
||||||
else if (strcmp(key, "taskbar_padding") == 0) {
|
else if (strcmp(key, "taskbar_padding") == 0) {
|
||||||
extract_values(value, &value1, &value2, &value3);
|
extract_values(value, &value1, &value2, &value3);
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_padding_x), atoi(value1));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_padding_x), atoi(value1));
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Name[nb]=Panelbehandler
|
|||||||
Name[nl]=Paneel Manager
|
Name[nl]=Paneel Manager
|
||||||
Name[nn]=Panelhandsamar
|
Name[nn]=Panelhandsamar
|
||||||
Name[pa]=ਪੈਨਲ ਮੈਨੇਜਰ
|
Name[pa]=ਪੈਨਲ ਮੈਨੇਜਰ
|
||||||
Name[pl]=Ustawienia panelu
|
Name[pl]=Panel
|
||||||
Name[pt]=Gestor do Painel
|
Name[pt]=Gestor do Painel
|
||||||
Name[pt_BR]=Gerenciador do painel
|
Name[pt_BR]=Gerenciador do painel
|
||||||
Name[ro]=Manager de panouri
|
Name[ro]=Manager de panouri
|
||||||
|
|||||||
@@ -141,6 +141,12 @@ void size_by_layout (Area *a, int level)
|
|||||||
if (!a->on_screen)
|
if (!a->on_screen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (a == &panel1->taskbar[0]) {
|
||||||
|
printf("%s %d: Taskbar 0: y=%d, h=%d, b=%d\n", __FUNCTION__, __LINE__, a->posy, a->height, a->posy + a->height);
|
||||||
|
} else if (a == &panel1->taskbar[1]) {
|
||||||
|
printf("%s %d: Taskbar 1: y=%d, h=%d, b=%d\n", __FUNCTION__, __LINE__, a->posy, a->height, a->posy + a->height);
|
||||||
|
}
|
||||||
|
|
||||||
// parent node is resized before its children
|
// parent node is resized before its children
|
||||||
// calculate area's size
|
// calculate area's size
|
||||||
GList *l;
|
GList *l;
|
||||||
@@ -216,21 +222,21 @@ void size_by_layout (Area *a, int level)
|
|||||||
}
|
}
|
||||||
} else if (a->alignment == ALIGN_CENTER) {
|
} else if (a->alignment == ALIGN_CENTER) {
|
||||||
|
|
||||||
int children_size = 0;
|
int children_size = 0;
|
||||||
|
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->list; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
children_size += panel_horizontal ? child->width : child->height;
|
children_size += panel_horizontal ? child->width : child->height;
|
||||||
children_size += (l == a->list) ? 0 : a->paddingx;
|
children_size += (l == a->list) ? 0 : a->paddingx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
||||||
pos += ((panel_horizontal ? a->width : a->height) - children_size) / 2;
|
pos += ((panel_horizontal ? a->width : a->height) - children_size) / 2;
|
||||||
|
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->list; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
@@ -274,7 +280,7 @@ void refresh (Area *a)
|
|||||||
if (a->redraw) {
|
if (a->redraw) {
|
||||||
a->redraw = 0;
|
a->redraw = 0;
|
||||||
// force redraw of child
|
// force redraw of child
|
||||||
//GList *l;
|
//GSList *l;
|
||||||
//for (l = a->list ; l ; l = l->next)
|
//for (l = a->list ; l ; l = l->next)
|
||||||
//((Area*)l->data)->redraw = 1;
|
//((Area*)l->data)->redraw = 1;
|
||||||
|
|
||||||
@@ -372,6 +378,11 @@ int resize_by_layout(void *obj, int maximum_size)
|
|||||||
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
||||||
int old_height = child->height;
|
int old_height = child->height;
|
||||||
child->height = height;
|
child->height = height;
|
||||||
|
if (child == &panel1->taskbar[0]) {
|
||||||
|
printf("Taskbar 0: y=%d, h=%d, b=%d\n", child->posy, child->height, child->posy + child->height);
|
||||||
|
} else if (child == &panel1->taskbar[1]) {
|
||||||
|
printf("Taskbar 1: y=%d, h=%d, b=%d\n", child->posy, child->height, child->posy + child->height);
|
||||||
|
}
|
||||||
if (modulo) {
|
if (modulo) {
|
||||||
child->height++;
|
child->height++;
|
||||||
modulo--;
|
modulo--;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ typedef struct
|
|||||||
// SIZE_BY_LAYOUT objects : taskbar and task
|
// SIZE_BY_LAYOUT objects : taskbar and task
|
||||||
// SIZE_BY_CONTENT objects : clock, battery, launcher, systray
|
// SIZE_BY_CONTENT objects : clock, battery, launcher, systray
|
||||||
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
||||||
|
|
||||||
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ struct _timeout {
|
|||||||
|
|
||||||
void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(void*), void* arg, timeout* t);
|
void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(void*), void* arg, timeout* t);
|
||||||
gint compare_timeouts(gconstpointer t1, gconstpointer t2);
|
gint compare_timeouts(gconstpointer t1, gconstpointer t2);
|
||||||
|
gint compare_timespecs(const struct timespec* t1, const struct timespec* t2);
|
||||||
int timespec_subtract(struct timespec* result, struct timespec* x, struct timespec* y);
|
int timespec_subtract(struct timespec* result, struct timespec* x, struct timespec* y);
|
||||||
|
struct timespec add_msec_to_timespec(struct timespec ts, int msec);
|
||||||
|
|
||||||
|
|
||||||
int align_with_existing_timeouts(timeout* t);
|
int align_with_existing_timeouts(timeout* t);
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#define TIMER_H
|
#define TIMER_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <time.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
extern struct timeval next_timeout;
|
extern struct timeval next_timeout;
|
||||||
|
|
||||||
@@ -68,9 +66,4 @@ void update_next_timeout();
|
|||||||
/** Callback of all expired timeouts **/
|
/** Callback of all expired timeouts **/
|
||||||
void callback_timeout_expired();
|
void callback_timeout_expired();
|
||||||
|
|
||||||
/** Returns -1 if t1 < t2, 0 if t1 == t2, 1 if t1 > t2 **/
|
|
||||||
gint compare_timespecs(const struct timespec* t1, const struct timespec* t2);
|
|
||||||
|
|
||||||
struct timespec add_msec_to_timespec(struct timespec ts, int msec);
|
|
||||||
|
|
||||||
#endif // TIMER_H
|
#endif // TIMER_H
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ Name[zh_CN]=面板 tint2
|
|||||||
Name[zh_TW]=面板 tint2
|
Name[zh_TW]=面板 tint2
|
||||||
Comment=Lightweight panel
|
Comment=Lightweight panel
|
||||||
Comment[fr_FR]=Panel léger
|
Comment[fr_FR]=Panel léger
|
||||||
Comment[pl]=Lekki panel
|
|
||||||
Exec=tint2
|
Exec=tint2
|
||||||
Icon=taskbar
|
Icon=taskbar
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
|||||||
Reference in New Issue
Block a user