Compare commits

..

21 Commits
v16.7 ... 17.0

Author SHA1 Message Date
Chris Lee
7737edff47 Release 17.0 2021-04-18 19:43:11 -07:00
Chris Lee
b7e7743b21 update changelog 2021-04-18 19:42:58 -07:00
Chris Lee
7232feee5a fix incorrect timeout microsecond computation 2021-04-14 23:38:36 +02:00
Chris
6b127f9661 Merge branch 'imlib-leak' into 'master'
Fix imlib image leak

Closes #704

See merge request o9000/tint2!39
2021-03-23 23:00:58 +00:00
Adam M. Trofa
e2641092b8 Fix imlib image leak
Double-adding the image caused imlib's reference count to increment
twice, requiring us to free it twice to actually release the cached
image, but we only ever free it once.

Fixes #704, likely #721 (leak is not present with -DENABLE_RSVG=OFF),
possibly #650 based on connection to execp, maybe others since this was
introduced nearly 6 years ago in 1d02b858 in launcher-specific code.
2021-03-19 19:44:25 -04:00
Chris Lee
49e7f54d2f preserve item order when skipping executors #799 2021-02-25 00:01:39 +01:00
Chris Lee
0f00212c58 add execp_monitor config #799 2021-02-24 22:08:20 +01:00
Chris Lee
dba0e66646 add scrollbars to fix issue #796 2021-01-26 23:15:51 +01:00
Chris Lee
2ed7ecb08d revert change to cmakefile 2021-01-04 22:21:50 +01:00
Chris Lee
f9cb16a0f0 attempt to port to gtk3 2021-01-04 22:06:31 +01:00
Chris Lee
06bcb3f2da attempt to fix #786 2021-01-02 23:22:22 +01:00
Chris
03b86f5f2c Merge branch 'big_icon_crash' into 'master'
Fix crashing when a window icon is large

See merge request o9000/tint2!35
2020-12-24 18:14:26 +00:00
Chris
b56147efb7 Merge branch 'executor-example-memusage' into 'master'
Enhanced example for memusage executor

Closes #787

See merge request o9000/tint2!38
2020-12-24 18:10:22 +00:00
Nikita Zlobin
ca3588cab0 Improve network bandwidth executor example too (stdbuf -oL)
If memusage example got stdbuf -oL awk, why further examples
can't use same?
2020-12-24 00:25:41 +05:00
Nikita Zlobin
795302fbaf More reasonable comment about stdbuf -oL 2020-12-24 00:22:48 +05:00
Nikita Zlobin
60ee870ae5 Oops, avoid gawk coprocess extension 2020-12-24 00:16:00 +05:00
Nikita Zlobin
975149642f Use numfmt to get back human output in memory usage executor 2020-12-05 23:48:33 +05:00
Nikita Zlobin
bba945b3b9 Enhanced example for memory usage executor, sync for all docs
It seems, html help already had one free instance with -s option for persistance,
though still used inner non-persistant chain for humanized output.
2020-11-30 13:00:21 +05:00
Chris Lee
5b3f9c4662 fix help message 2020-06-27 13:55:55 +00:00
Chris Lee
3bdb0e03f2 #643 Hide/unhide programatically 2020-06-27 12:02:00 +00:00
santouits
27a8ea013e Fix crashing when a window icon is large
If an icon of a window is large tint2 crashes with segmentation fault, I guess because of stack overflow. This changes the allocation of icon_data from stack to heap.
2019-10-29 21:22:23 +02:00
28 changed files with 606 additions and 420 deletions

View File

@@ -1,3 +1,15 @@
2021-04-18 17.0
- Fixes:
- Crash when a window icon is large (issue #786) (santouits)
- Minute clock doesn't update (issue #786)
- Scrollbars in tint2conf (issue #796)
- Preserve item order when skipping executors (issue #799)
- Image memory leak (issues #704, #721) (Adam M. Trofa)
- Incorrect timeout microsecond computation leading to high CPU usage (issue #800)
- Enhancements:
- Port tint2conf to gtk3 (issue #380)
- execp_monitor config (issue #799)
- Improved executor examples (Nikita Zlobin)
2019-07-14 16.7
- Fixes:
- Fix spacing around icons in executor without text in vertical panels (issue #716)
@@ -1031,3 +1043,4 @@ released tint-0.2
.
.
.
.

View File

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

View File

@@ -609,6 +609,7 @@ panel_size = 94% 30
<li><p><code>execp_background_id = integer</code> : Which background to use. <em>(since 0.12.4)</em></p></li>
<li><p><code>execp_centered = boolean (0 or 1)</code> : Whether to center the text. <em>(since 0.12.4)</em></p></li>
<li><p><code>execp_padding = horizontal_padding vertical_padding spacing_between_icon_and_text</code> <em>(since 0.12.4)</em></p></li>
<li><p><code>execp_monitor = integer (1, 2, ...), primary or all</code> : On which monitor to draw the executor. The first monitor is <code>1</code>. <em>(since 17.0)</em></p></li>
<li><p><code>execp_lclick_command = text</code> : Command to execute on left click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.12.4)</em></p></li>
<li><p><code>execp_mclick_command = text</code> : Command to execute on right click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.12.4)</em></p></li>
<li><p><code>execp_rclick_command = text</code> : Command to execute on middle click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.12.4)</em></p></li>
@@ -647,13 +648,13 @@ execp_command = ping -i 1 -c 1 -W 1 -O -D -n $(ip route | grep default | grep vi
execp_continuous = 0
execp_interval = 1
execp_markup = 1
</code></pre></div><h5 id="memory-usage">Memory usage<a name="memory-usage" href="#memory-usage" class="md2man-permalink" title="permalink"></a></h5><div class="highlight"><pre class="highlight plaintext"><code>execp = new
execp_command = free | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%%\n", 100*$3/($3+$4); fflush(stdout) }'
execp_interval = 5
execp_continuous = 0
</code></pre></div><h5 id="network-load">Network load<a name="network-load" href="#network-load" class="md2man-permalink" title="permalink"></a></h5><div class="highlight"><pre class="highlight plaintext"><code># Note the use of "stdbuf -oL" to force the program to flush the output line by line.
</code></pre></div><h5 id="memory-usage">Memory usage<a name="memory-usage" href="#memory-usage" class="md2man-permalink" title="permalink"></a></h5><div class="highlight"><pre class="highlight plaintext"><code># Note the use of "stdbuf -oL" to force the program to flush the output line by line.
execp = new
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }; fflush(stdout)'
execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %s %.0f%%\n", $2, 100 * ($2 - $7) / $2 }' | stdbuf -oL numfmt --to=iec-i --field=2 -d' '
execp_interval = 1
execp_continuous = 1
</code></pre></div><h5 id="network-load">Network load<a name="network-load" href="#network-load" class="md2man-permalink" title="permalink"></a></h5><div class="highlight"><pre class="highlight plaintext"><code>execp = new
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | stdbuf -oL awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }'
execp_continuous = 1
execp_interval = 1
</code></pre></div><h3 id="button">Button<a name="button" href="#button" class="md2man-permalink" title="permalink"></a></h3>

View File

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

View File

@@ -1,4 +1,4 @@
.TH TINT2 1 "2019\-07\-14" 16.7
.TH TINT2 1 "2021\-04\-18" 17.0
.SH NAME
.PP
tint2 \- lightweight panel/taskbar
@@ -748,6 +748,8 @@ To hide the clock, comment \fB\fCtime1_format\fR and \fB\fCtime2_format\fR\&.
.IP \(bu 2
\fB\fCexecp_padding = horizontal_padding vertical_padding spacing_between_icon_and_text\fR \fI(since 0.12.4)\fP
.IP \(bu 2
\fB\fCexecp_monitor = integer (1, 2, ...), primary or all\fR : On which monitor to draw the executor. The first monitor is \fB\fC1\fR\&. \fI(since 17.0)\fP
.IP \(bu 2
\fB\fCexecp_lclick_command = text\fR : Command to execute on left click. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.12.4)\fP
.IP \(bu 2
\fB\fCexecp_mclick_command = text\fR : Command to execute on right click. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.12.4)\fP
@@ -831,19 +833,19 @@ execp_markup = 1
.PP
.RS
.nf
# Note the use of "stdbuf \-oL" to force the program to flush the output line by line.
execp = new
execp_command = free | awk '/^\-/ { printf "Mem: '$(free \-h | awk '/^Mem:/ { print $2 }')' %.0f%%\\n", 100*$3/($3+$4); fflush(stdout) }'
execp_interval = 5
execp_continuous = 0
execp_command = free \-b \-s1 | stdbuf \-oL awk '/^Mem:/ { printf "Mem: %s %.0f%%\\n", $2, 100 * ($2 \- $7) / $2 }' | stdbuf \-oL numfmt \-\-to=iec\-i \-\-field=2 \-d' '
execp_interval = 1
execp_continuous = 1
.fi
.RE
.SS Network load
.PP
.RS
.nf
# Note the use of "stdbuf \-oL" to force the program to flush the output line by line.
execp = new
execp_command = stdbuf \-oL bwm\-ng \-o csv \-t 1000 | awk \-F ';' '/total/ { printf "Net: %.0f Mb/s\\n", ($5*8/1.0e6) }; fflush(stdout)'
execp_command = stdbuf \-oL bwm\-ng \-o csv \-t 1000 | stdbuf \-oL awk \-F ';' '/total/ { printf "Net: %.0f Mb/s\\n", ($5*8/1.0e6) }'
execp_continuous = 1
execp_interval = 1
.fi

View File

@@ -372,14 +372,14 @@ execp_continuous = 1
execp_interval = 1
execp_markup = 1
</code></pre>
<h5 id="memory-usage">Memory usage<a name="memory-usage" href="#memory-usage" class="md2man-permalink" title="permalink"></a></h5><pre class="highlight plaintext"><code>execp = new
execp_command = free -s 2 | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%\n", 100*$3/($3+$4); fflush(stdout) }'
<h5 id="memory-usage">Memory usage<a name="memory-usage" href="#memory-usage" class="md2man-permalink" title="permalink"></a></h5><pre class="highlight plaintext"><code># Note the use of "stdbuf -oL" to force the program to flush the output line by line.
execp = new
execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %s %.0f%%\n", $2, 100 * ($2 - $7) / $2 }' | stdbuf -oL numfmt --to=iec-i --field=2 -d' '
execp_interval = 1
execp_continuous = 1
</code></pre>
<h5 id="network-load">Network load<a name="network-load" href="#network-load" class="md2man-permalink" title="permalink"></a></h5><pre class="highlight plaintext"><code># Note the use of "stdbuf -oL" to force the program to flush the output line by line.
execp = new
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }; fflush(stdout)'
<h5 id="network-load">Network load<a name="network-load" href="#network-load" class="md2man-permalink" title="permalink"></a></h5><pre class="highlight plaintext"><code>execp = new
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | stdbuf -oL awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }'
execp_continuous = 1
execp_interval = 1
</code></pre>

View File

@@ -1,4 +1,4 @@
# TINT2 1 "2019-07-14" 16.7
# TINT2 1 "2021-04-18" 17.0
## NAME
tint2 - lightweight panel/taskbar
@@ -621,6 +621,8 @@ The action semantics:
* `execp_padding = horizontal_padding vertical_padding spacing_between_icon_and_text` *(since 0.12.4)*
* `execp_monitor = integer (1, 2, ...), primary or all` : On which monitor to draw the executor. The first monitor is `1`. *(since 17.0)*
* `execp_lclick_command = text` : Command to execute on left click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)*
* `execp_mclick_command = text` : Command to execute on right click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)*
* `execp_rclick_command = text` : Command to execute on middle click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)*
@@ -694,18 +696,18 @@ execp_markup = 1
##### Memory usage
```
# Note the use of "stdbuf -oL" to force the program to flush the output line by line.
execp = new
execp_command = free | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%%\n", 100*$3/($3+$4); fflush(stdout) }'
execp_interval = 5
execp_continuous = 0
execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %s %.0f%%\n", $2, 100 * ($2 - $7) / $2 }' | stdbuf -oL numfmt --to=iec-i --field=2 -d' '
execp_interval = 1
execp_continuous = 1
```
##### Network load
```
# Note the use of "stdbuf -oL" to force the program to flush the output line by line.
execp = new
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }; fflush(stdout)'
execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | stdbuf -oL awk -F ';' '/total/ { printf "Net: %.0f Mb/s\n", ($5*8/1.0e6) }'
execp_continuous = 1
execp_interval = 1
```

View File

@@ -6,7 +6,7 @@ Build-Depends: cmake,
debhelper (>= 9),
libcairo2-dev,
libglib2.0-dev,
libgtk2.0-dev,
libgtk-3-dev,
libimlib2-dev,
libpango1.0-dev,
librsvg2-dev,

View File

@@ -129,17 +129,28 @@ struct tm *clock_gettime_for_tz(const char *timezone)
}
}
void update_clock_text(char *dst, size_t size, const char *format,
const char *timezone, bool *changed)
{
if (!dst || !format) {
return;
}
char tmp[256] = "";
strncpy(tmp, dst, sizeof(tmp) - 1);
strftime(dst, size, format, clock_gettime_for_tz(timezone));
*changed = *changed || strcmp(dst, tmp) != 0;
}
void update_clocks()
{
if (time1_format)
strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone));
if (time2_format)
strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone));
if (time1_format || time2_format) {
bool changed = false;
update_clock_text(buf_time, sizeof(buf_time), time1_format, time1_timezone, &changed);
update_clock_text(buf_date, sizeof(buf_date), time2_format, time2_timezone, &changed);
if (changed) {
for (int i = 0; i < num_panels; i++)
panels[i].clock.area.resize_needed = 1;
schedule_panel_redraw();
}
schedule_panel_redraw();
}
int ms_until_second_change(struct timeval* tm)
@@ -157,33 +168,6 @@ void update_clocks_sec(void *arg)
change_timer(&clock_timer, true, ms_until_second_change(&time_clock), 0, update_clocks_sec, 0);
}
void update_clocks_min(void *arg)
{
// remember old_sec because after suspend/hibernate the clock should be updated directly, and not
// on next minute change
static time_t old_sec = 0;
gettimeofday(&time_clock, 0);
if (time_clock.tv_sec % 60 == 0 || time_clock.tv_sec - old_sec > 60 || (time1_format && !buf_time[0]) || (time2_format && !buf_date[0]))
update_clocks();
old_sec = time_clock.tv_sec;
change_timer(&clock_timer, true, ms_until_second_change(&time_clock), 0, update_clocks_min, 0);
}
gboolean time_format_needs_sec_ticks(char *time_format)
{
if (!time_format)
return FALSE;
if (strchr(time_format, 'c') ||
strchr(time_format, 'r') ||
strchr(time_format, 's') ||
strchr(time_format, 'S') ||
strchr(time_format, 'T') ||
strchr(time_format, 'X') ||
strchr(time_format, '+'))
return TRUE;
return FALSE;
}
void init_clock()
{
}
@@ -222,11 +206,7 @@ void init_clock_panel(void *p)
}
if (!clock_timer.enabled_) {
if (time_format_needs_sec_ticks(time1_format) || time_format_needs_sec_ticks(time2_format)) {
update_clocks_sec(NULL);
} else {
update_clocks_min(NULL);
}
update_clocks_sec(NULL);
}
}

View File

@@ -697,6 +697,9 @@ void add_entry(char *key, char *value)
} else {
execp->backend->interval = v;
}
} else if (strcmp(key, "execp_monitor") == 0) {
Execp *execp = get_or_create_last_execp();
execp->backend->monitor = config_get_monitor(value);
} else if (strcmp(key, "execp_has_icon") == 0) {
Execp *execp = get_or_create_last_execp();
execp->backend->has_icon = atoi(value);

View File

@@ -43,13 +43,35 @@ Execp *create_execp()
execp->backend->cache_icon = TRUE;
execp->backend->centered = TRUE;
execp->backend->font_color.alpha = 0.5;
execp->backend->monitor = -1;
INIT_TIMER(execp->backend->timer);
execp->backend->bg = &g_array_index(backgrounds, Background, 0);
execp->backend->buf_stdout_capacity = 1024;
execp->backend->buf_stdout = calloc(execp->backend->buf_stdout_capacity, 1);
execp->backend->buf_stderr_capacity = 1024;
execp->backend->buf_stderr = calloc(execp->backend->buf_stderr_capacity, 1);
execp->backend->text = strdup("");
execp->backend->icon_path = NULL;
return execp;
}
gpointer create_execp_frontend(gconstpointer arg, gpointer data)
{
Execp *execp_backend = (Execp *)arg;
Panel *panel = data;
if (execp_backend->backend->monitor >= 0 &&
panel->monitor != execp_backend->backend->monitor) {
printf("Skipping executor '%s' with monitor %d for panel on monitor %d\n",
execp_backend->backend->command,
execp_backend->backend->monitor, panel->monitor);
Execp *dummy = create_execp();
dummy->frontend = (ExecpFrontend *)calloc(1, sizeof(ExecpFrontend));
dummy->backend->instances = g_list_append(execp_backend->backend->instances, dummy);
return dummy;
}
printf("Creating executor '%s' with monitor %d for panel on monitor %d\n",
execp_backend->backend->command,
execp_backend->backend->monitor, panel->monitor);
Execp *execp_frontend = (Execp *)calloc(1, sizeof(Execp));
execp_frontend->backend = execp_backend->backend;
@@ -144,12 +166,6 @@ void init_execp()
// Set missing config options
if (!execp->backend->bg)
execp->backend->bg = &g_array_index(backgrounds, Background, 0);
execp->backend->buf_stdout_capacity = 1024;
execp->backend->buf_stdout = calloc(execp->backend->buf_stdout_capacity, 1);
execp->backend->buf_stderr_capacity = 1024;
execp->backend->buf_stderr = calloc(execp->backend->buf_stderr_capacity, 1);
execp->backend->text = strdup("");
execp->backend->icon_path = NULL;
}
}
@@ -163,7 +179,7 @@ void init_execp_panel(void *p)
// panel->execp_list is now a copy of the pointer panel_config.execp_list
// We make it a deep copy
panel->execp_list = g_list_copy_deep(panel_config.execp_list, create_execp_frontend, NULL);
panel->execp_list = g_list_copy_deep(panel_config.execp_list, create_execp_frontend, panel);
for (GList *l = panel->execp_list; l; l = l->next) {
Execp *execp = l->data;

View File

@@ -24,6 +24,7 @@ typedef struct ExecpBackend {
char *command;
// Interval in seconds
int interval;
int monitor;
// 1 if first line of output is an icon path
gboolean has_icon;
gboolean cache_icon;

View File

@@ -389,9 +389,9 @@ gboolean handle_x_event_autohide(XEvent *e)
Panel *panel = get_panel(e->xany.window);
if (panel && panel_autohide) {
if (e->type == EnterNotify)
autohide_trigger_show(panel);
autohide_trigger_show(panel, e->xany.send_event);
else if (e->type == LeaveNotify)
autohide_trigger_hide(panel);
autohide_trigger_hide(panel, e->xany.send_event);
if (panel->is_hidden) {
if (e->type == ClientMessage && e->xclient.message_type == server.atom.XdndPosition) {
hidden_panel_shown_for_dnd = TRUE;

View File

@@ -269,8 +269,9 @@ void init_panel()
init_freespace_panel(p);
if (panel_items_order[k] == ':')
init_separator_panel(p);
if (panel_items_order[k] == 'E')
if (panel_items_order[k] == 'E') {
init_execp_panel(p);
}
if (panel_items_order[k] == 'P')
init_button_panel(p);
}
@@ -316,7 +317,7 @@ void init_panel()
}
if (panel_autohide)
autohide_trigger_hide(p);
autohide_trigger_hide(p, false);
}
taskbar_refresh_tasklist();
@@ -1139,26 +1140,27 @@ void autohide_hide(void *p)
schedule_panel_redraw();
}
void autohide_trigger_show(Panel *p)
void autohide_trigger_show(Panel *p, bool forced)
{
if (!p)
return;
change_timer(&p->autohide_timer, true, panel_autohide_show_timeout, 0, autohide_show, p);
change_timer(&p->autohide_timer, true, forced ? 0 : panel_autohide_show_timeout, 0, autohide_show, p);
}
void autohide_trigger_hide(Panel *p)
void autohide_trigger_hide(Panel *p, bool forced)
{
if (!p)
return;
Window root, child;
int xr, yr, xw, yw;
unsigned int mask;
if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
if (child)
return; // mouse over one of the system tray icons
change_timer(&p->autohide_timer, true, panel_autohide_hide_timeout, 0, autohide_hide, p);
if (!forced) {
Window root, child;
int xr, yr, xw, yw;
unsigned int mask;
if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
if (child)
return; // mouse over one of the system tray icons
}
change_timer(&p->autohide_timer, true, forced ? 0 : panel_autohide_hide_timeout, 0, autohide_hide, p);
}
void shrink_panel(Panel *panel)

View File

@@ -203,8 +203,8 @@ Button *click_button(Panel *panel, int x, int y);
void autohide_show(void *p);
void autohide_hide(void *p);
void autohide_trigger_show(Panel *p);
void autohide_trigger_hide(Panel *p);
void autohide_trigger_show(Panel *p, bool forced);
void autohide_trigger_hide(Panel *p, bool forced);
const char *get_default_font();

View File

@@ -312,10 +312,16 @@ Imlib_Image task_get_icon(Window win, int icon_size)
int w, h;
gulong *tmp_data = get_best_icon(data, get_icon_count(data, len), len, &w, &h, icon_size);
if (tmp_data) {
DATA32 icon_data[w * h];
for (int j = 0; j < w * h; ++j)
icon_data[j] = tmp_data[j];
img = imlib_create_image_using_copied_data(w, h, icon_data);
int array_size = w * h;
// imlib needs the array in DATA32 type
// using malloc for the array to protect from stack overflow
DATA32 *icon_data = (DATA32*) g_try_malloc(sizeof(*icon_data) * array_size);
if (icon_data) {
for (int j = 0; j < array_size; ++j)
icon_data[j] = tmp_data[j];
img = imlib_create_image_using_copied_data(w, h, icon_data);
g_free(icon_data);
}
}
}
XFree(data);

12
src/tint2-send/Makefile Normal file
View File

@@ -0,0 +1,12 @@
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
tint2-send: tint2-send.c
$(CC) tint2-send.c -lX11 -o tint2-send
install: tint2-send
install -m 755 tint2-send $(DESTDIR)/$(PREFIX)/bin/
clean:
rm -f tint2-send

128
src/tint2-send/tint2-send.c Normal file
View File

@@ -0,0 +1,128 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static Display *display = 0;
/* From wmctrl */
char *get_property(Window window, Atom xa_prop_type, const char *prop_name) {
Atom xa_prop_name = XInternAtom(display, prop_name, False);
Atom xa_ret_type;
int ret_format;
unsigned long ret_nitems;
unsigned long ret_bytes_after;
unsigned long tmp_size;
unsigned char *ret_prop;
if (XGetWindowProperty(display, window, xa_prop_name, 0, 1024,
False, xa_prop_type, &xa_ret_type, &ret_format,
&ret_nitems, &ret_bytes_after, &ret_prop) != Success) {
return NULL;
}
if (xa_ret_type != xa_prop_type) {
XFree(ret_prop);
return NULL;
}
/* Correct 64 Architecture implementation of 32 bit data */
tmp_size = (ret_format / 8) * ret_nitems;
if (ret_format == 32)
tmp_size *= sizeof(long) / 4;
char *ret = (char *)calloc(1, tmp_size + 1);
memcpy(ret, ret_prop, tmp_size);
XFree(ret_prop);
return ret;
}
int is_tint2(Window window)
{
XWindowAttributes attr = {};
if (!XGetWindowAttributes(display, window, &attr))
return 0;
if (attr.map_state != IsViewable)
return 0;
char *wm_class = get_property(window, XA_STRING, "WM_NAME");
if (!wm_class) {
return 0;
}
int class_match = 0;
if (strcmp(wm_class, "tint2") == 0) {
class_match = 1;
}
free(wm_class);
return class_match;
}
void handle_tint2_window(Window window, void *arg)
{
if (!is_tint2(window))
return;
char *action = (char *)arg;
if (strcmp(action, "show") == 0) {
fprintf(stderr, "Showing tint2 window: %lx\n", window);
XEvent event = {};
event.xcrossing.type = EnterNotify;
event.xcrossing.window = window;
event.xcrossing.mode = NotifyNormal;
event.xcrossing.detail = NotifyVirtual;
event.xcrossing.same_screen = True;
XSendEvent(display, window, False, 0, &event);
XFlush(display);
} else if (strcmp(action, "hide") == 0) {
fprintf(stderr, "Hiding tint2 window: %lx\n", window);
XEvent event = {};
event.xcrossing.type = LeaveNotify;
event.xcrossing.window = window;
event.xcrossing.mode = NotifyNormal;
event.xcrossing.detail = NotifyVirtual;
event.xcrossing.same_screen = True;
XSendEvent(display, window, False, 0, &event);
XFlush(display);
} else {
fprintf(stderr, "Error: unknown action %s\n", action);
}
}
typedef void window_callback_t(Window window, void *arg);
void walk_windows(Window node, window_callback_t *callback, void *arg)
{
callback(node, arg);
Window root = 0;
Window parent = 0;
Window *children = 0;
unsigned int nchildren = 0;
if (!XQueryTree(display, node,
&root, &parent, &children, &nchildren)) {
return;
}
for (unsigned int i = 0; i < nchildren; i++) {
walk_windows(children[i], callback, arg);
}
}
int main(int argc, char **argv)
{
display = XOpenDisplay(NULL);
if (!display ) {
fprintf(stderr, "Failed to open X11 connection\n");
exit(1);
}
argc--, argv++;
if (!argc) {
fprintf(stderr, "Usage: tint2-show [show|hide]\n");
exit(1);
}
char *action = argv[0];
walk_windows(DefaultRootWindow(display), handle_tint2_window, action);
return 0;
}

View File

@@ -7,7 +7,7 @@ pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
pkg_check_modules( IMLIB2 REQUIRED imlib2 )
pkg_check_modules( GTHREAD2 REQUIRED gthread-2.0 )
pkg_check_modules( GTK2 REQUIRED gtk+-x11-2.0 )
pkg_check_modules( GTK3 REQUIRED gtk+-x11-3.0 )
pkg_check_modules( RSVG librsvg-2.0>=2.36.0 )
include_directories( ../util
@@ -16,7 +16,7 @@ include_directories( ../util
${GOBJECT2_INCLUDE_DIRS}
${IMLIB2_INCLUDE_DIRS}
${GTHREAD2_INCLUDE_DIRS}
${GTK2_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
${RSVG_INCLUDE_DIRS} )
set(SOURCES ../util/common.c
@@ -55,7 +55,7 @@ link_directories( ${X11_T2C_LIBRARY_DIRS}
${GOBJECT2_LIBRARY_DIRS}
${IMLIB2_LIBRARY_DIRS}
${GTHREAD2_LIBRARY_DIRS}
${GTK2_LIBRARY_DIRS}
${GTK3_LIBRARY_DIRS}
${RSVG_LIBRARY_DIRS} )
add_executable( tint2conf ${SOURCES} )
target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
@@ -63,13 +63,14 @@ target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
${GOBJECT2_LIBRARIES}
${IMLIB2_LIBRARIES}
${GTHREAD2_LIBRARIES}
${GTK2_LIBRARIES}
${GTK3_LIBRARIES}
${RSVG_LIBRARIES} )
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" )
add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" )
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread -std=c99" )
add_definitions( -DDGLIB_DISABLE_DEPRECATION_WARNINGS=1 )
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=c99 -Werror-implicit-function-declaration -Wno-deprecated -Wno-deprecated-declarations" )
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
add_subdirectory(po)

View File

@@ -95,7 +95,7 @@ void create_background(GtkWidget *parent)
backgrounds = gtk_list_store_new(bgNumCols,
GDK_TYPE_PIXBUF,
GDK_TYPE_COLOR,
GTK_TYPE_INT,
GTK_TYPE_SHADOW_TYPE,
GDK_TYPE_COLOR,
GTK_TYPE_INT,
GTK_TYPE_INT,
@@ -121,7 +121,6 @@ void create_background(GtkWidget *parent)
GtkWidget *table, *label, *button;
int row, col;
GtkTooltips *tooltips = gtk_tooltips_new();
table = gtk_table_new(1, 4, FALSE);
gtk_widget_show(table);
@@ -141,21 +140,21 @@ void create_background(GtkWidget *parent)
gtk_widget_show(current_background);
gtk_table_attach(GTK_TABLE(table), current_background, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, current_background, _("Selects the background you would like to modify"), NULL);
gtk_widget_set_tooltip_text(current_background, _("Selects the background you would like to modify"));
button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(background_duplicate), NULL);
g_signal_connect(button, "clicked", G_CALLBACK(background_duplicate), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button, _("Creates a copy of the current background"), NULL);
gtk_widget_set_tooltip_text(button, _("Creates a copy of the current background"));
button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(background_delete), NULL);
g_signal_connect(button, "clicked", G_CALLBACK(background_delete), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button, _("Deletes the current background"), NULL);
gtk_widget_set_tooltip_text(button, _("Deletes the current background"));
table = gtk_table_new(4, 4, FALSE);
gtk_widget_show(table);
@@ -175,7 +174,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color);
gtk_table_attach(GTK_TABLE(table), background_fill_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, background_fill_color, _("The fill color of the current background"), NULL);
gtk_widget_set_tooltip_text(background_fill_color, _("The fill color of the current background"));
row++, col = 2;
label = gtk_label_new(_("Fill tint"));
@@ -188,7 +187,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_content_tint_weight);
gtk_table_attach(GTK_TABLE(table), background_fill_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, background_fill_content_tint_weight, _("How much the border color should be tinted with the content color"), NULL);
gtk_widget_set_tooltip_text(background_fill_content_tint_weight, _("How much the border color should be tinted with the content color"));
row++, col = 2;
label = gtk_label_new(_("Border color"));
@@ -202,7 +201,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color);
gtk_table_attach(GTK_TABLE(table), background_border_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL);
gtk_widget_set_tooltip_text(background_border_color, _("The border color of the current background"));
row++, col = 2;
label = gtk_label_new(_("Border tint"));
@@ -215,7 +214,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_content_tint_weight);
gtk_table_attach(GTK_TABLE(table), background_border_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, background_border_content_tint_weight, _("How much the border color should be tinted with the content color"), NULL);
gtk_widget_set_tooltip_text(background_border_content_tint_weight, _("How much the border color should be tinted with the content color"));
row++, col = 2;
label = gtk_label_new(_("Gradient"));
@@ -241,10 +240,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color_over);
gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
background_fill_color_over,
_("The fill color of the current background on mouse over"),
NULL);
gtk_widget_set_tooltip_text(background_fill_color_over,
_("The fill color of the current background on mouse over"));
row++, col = 2;
label = gtk_label_new(_("Border color (mouse over)"));
@@ -258,10 +255,9 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color_over);
gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
gtk_widget_set_tooltip_text(
background_border_color_over,
_("The border color of the current background on mouse over"),
NULL);
_("The border color of the current background on mouse over"));
row++, col = 2;
label = gtk_label_new(_("Gradient (mouse over)"));
@@ -287,10 +283,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color_press);
gtk_table_attach(GTK_TABLE(table), background_fill_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
background_fill_color_press,
_("The fill color of the current background on mouse button press"),
NULL);
gtk_widget_set_tooltip_text(background_fill_color_press,
_("The fill color of the current background on mouse button press"));
row++, col = 2;
label = gtk_label_new(_("Border color (pressed)"));
@@ -304,10 +298,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color_press);
gtk_table_attach(GTK_TABLE(table), background_border_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
background_border_color_press,
_("The border color of the current background on mouse button press"),
NULL);
gtk_widget_set_tooltip_text(background_border_color_press,
_("The border color of the current background on mouse button press"));
row++, col = 2;
label = gtk_label_new(_("Gradient (pressed)"));
@@ -332,10 +324,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_width);
gtk_table_attach(GTK_TABLE(table), background_border_width, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
background_border_width,
_("The width of the border of the current background, in pixels"),
NULL);
gtk_widget_set_tooltip_text(background_border_width,
_("The width of the border of the current background, in pixels"));
row++, col = 2;
label = gtk_label_new(_("Corner radius"));
@@ -348,7 +338,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_corner_radius);
gtk_table_attach(GTK_TABLE(table), background_corner_radius, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, background_corner_radius, _("The corner radius of the current background"), NULL);
gtk_widget_set_tooltip_text(background_corner_radius, _("The corner radius of the current background"));
row++;
col = 2;
@@ -712,9 +702,8 @@ void background_update_image(int index)
g_boxed_free(GDK_TYPE_COLOR, fillColor);
g_boxed_free(GDK_TYPE_COLOR, borderColor);
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24);
cairo_t *cr = gdk_cairo_create(pixmap);
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = cairo_create(s);
cairo_set_line_width(cr, b);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
@@ -744,13 +733,12 @@ void background_update_image(int index)
cairo_destroy(cr);
cr = NULL;
pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h);
if (pixmap)
g_object_unref(pixmap);
pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
gtk_list_store_set(backgrounds, &iter, bgColPixbuf, pixbuf, -1);
if (pixbuf)
g_object_unref(pixbuf);
cairo_surface_destroy(s);
}
void background_force_update()

View File

@@ -32,7 +32,7 @@ GtkWidget *create_gradient_combo()
void create_gradient(GtkWidget *parent)
{
gradient_ids = gtk_list_store_new(grNumCols, GDK_TYPE_PIXBUF, GTK_TYPE_INT, GTK_TYPE_STRING);
gradient_ids = gtk_list_store_new(grNumCols, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_STRING);
gradients = NULL;
gradient_stop_ids = gtk_list_store_new(grStopNumCols, GDK_TYPE_PIXBUF);
@@ -61,13 +61,13 @@ void create_gradient(GtkWidget *parent)
col++;
button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_duplicate), NULL);
g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_duplicate), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_delete), NULL);
g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_delete), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
@@ -85,13 +85,13 @@ void create_gradient(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gradient_combo_type = gtk_combo_box_new_text();
gradient_combo_type = gtk_combo_box_text_new();
gtk_widget_show(gradient_combo_type);
gtk_table_attach(GTK_TABLE(table), gradient_combo_type, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Vertical"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Horizontal"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Radial"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Vertical"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Horizontal"));
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Radial"));
gtk_combo_box_set_active(GTK_COMBO_BOX(gradient_combo_type), 0);
row++, col = 2;
@@ -142,13 +142,13 @@ void create_gradient(GtkWidget *parent)
col++;
button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_duplicate), NULL);
g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_duplicate), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_delete), NULL);
g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_delete), NULL);
gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
@@ -327,18 +327,17 @@ void gradient_update_image(int index)
int w = 70;
int h = 30;
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24);
cairo_surface_t *pixmap = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = gdk_cairo_create(pixmap);
cairo_t *cr = cairo_create(pixmap);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, 0, 0, w, h);
cairo_fill(cr);
gradient_draw(cr, g, w, h, FALSE);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h);
if (pixmap)
g_object_unref(pixmap);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(pixmap, 0, 0, w, h);
cairo_surface_destroy(pixmap);
GtkTreePath *path;
GtkTreeIter iter;
@@ -528,16 +527,14 @@ void gradient_stop_update_image(int index)
int w = 70;
int h = 30;
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24);
cairo_t *cr = gdk_cairo_create(pixmap);
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = cairo_create(s);
cairo_set_source_rgba(cr, stop->color.rgb[0], stop->color.rgb[1], stop->color.rgb[2], stop->color.alpha);
cairo_rectangle(cr, 0, 0, w, h);
cairo_fill(cr);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h);
if (pixmap)
g_object_unref(pixmap);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
cairo_surface_destroy(s);
GtkTreePath *path;
GtkTreeIter iter;

View File

@@ -14,6 +14,27 @@
#define GETTEXT_PACKAGE "tint2conf"
#endif
#ifndef GTK_TYPE_INT
#define GTK_TYPE_INT G_TYPE_INT
#endif
#ifndef GTK_TYPE_STRING
#define GTK_TYPE_STRING G_TYPE_STRING
#endif
#ifndef GTK_TYPE_BOOL
#define GTK_TYPE_BOOL G_TYPE_BOOLEAN
#endif
#ifndef GTK_TYPE_DOUBLE
#define GTK_TYPE_DOUBLE G_TYPE_DOUBLE
#endif
#define gtk_tooltips_set_tip(t, widget, txt, arg) gtk_widget_set_tooltip_text(widget, txt)
#define GTK_OBJECT(x) (x)
#define GTK_SIGNAL_FUNC G_CALLBACK
#define SNAPSHOT_TICK 190
gboolean update_snapshot(gpointer ignored);
void menuApply();

File diff suppressed because it is too large Load Diff

View File

@@ -133,7 +133,7 @@ typedef struct Executor {
GtkWidget *page_execp;
GtkWidget *page_label;
GtkWidget *execp_command, *execp_interval, *execp_has_icon, *execp_cache_icon, *execp_show_tooltip;
GtkWidget *execp_continuous, *execp_markup, *execp_tooltip;
GtkWidget *execp_continuous, *execp_markup, *execp_tooltip, *execp_monitor;
GtkWidget *execp_left_command, *execp_right_command;
GtkWidget *execp_mclick_command, *execp_rclick_command, *execp_uwheel_command, *execp_dwheel_command;
GtkWidget *execp_font, *execp_font_set, *execp_font_color, *execp_padding_x, *execp_padding_y, *execp_centered;

View File

@@ -871,6 +871,16 @@ void config_write_execp(FILE *fp)
fprintf(fp,
"execp_markup = %d\n",
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_markup)) ? 1 : 0);
fprintf(fp, "execp_monitor = ");
if (gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) <= 0) {
fprintf(fp, "all");
} else if (gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) == 1) {
fprintf(fp, "primary");
} else {
fprintf(fp, "%d", MAX(1, gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) - 1));
}
fprintf(fp, "\n");
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_show_tooltip))) {
fprintf(fp, "execp_tooltip = \n");
} else {
@@ -1855,10 +1865,12 @@ void add_entry(char *key, char *value)
} else if (strcmp(key, "launcher_apps_dir") == 0) {
char *path = expand_tilde(value);
if (gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs)) > 0) {
gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), ",");
int position = gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs));
if (position > 0) {
gtk_editable_insert_text(GTK_EDITABLE(launcher_apps_dirs), ",", 1, &position);
}
gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), path);
position = gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs));
gtk_editable_insert_text(GTK_EDITABLE(launcher_apps_dirs), path, strlen(path), &position);
free(path);
} else if (strcmp(key, "launcher_icon_theme") == 0) {
@@ -1962,6 +1974,23 @@ void add_entry(char *key, char *value)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_continuous), atoi(value));
} else if (strcmp(key, "execp_markup") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_markup), atoi(value));
} else if (strcmp(key, "execp_monitor") == 0) {
if (strcmp(value, "all") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 0);
else if (strcmp(value, "primary") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 1);
else if (strcmp(value, "1") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 2);
else if (strcmp(value, "2") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 3);
else if (strcmp(value, "3") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 4);
else if (strcmp(value, "4") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 5);
else if (strcmp(value, "5") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 6);
else if (strcmp(value, "6") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 7);
} else if (strcmp(key, "execp_tooltip") == 0) {
if (strlen(value) > 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_show_tooltip), 1);

View File

@@ -794,8 +794,8 @@ Imlib_Image load_image(const char *path, int cached)
static unsigned long counter = 0;
if (debug_icons)
fprintf(stderr, "tint2: loading icon %s\n", path);
#ifdef HAVE_RSVG
image = imlib_load_image(path);
#ifdef HAVE_RSVG
if (!image && g_str_has_suffix(path, ".svg")) {
char tmp_filename[128];
snprintf(tmp_filename, sizeof(tmp_filename), "/tmp/tint2-%d-%lu.png", (int)getpid(), counter);
@@ -825,11 +825,8 @@ Imlib_Image load_image(const char *path, int cached)
unlink(tmp_filename);
}
}
} else
#endif
{
image = imlib_load_image(path);
}
#endif
imlib_context_set_image(image);
imlib_image_set_changes_on_disk();
return image;

View File

@@ -131,7 +131,8 @@ struct timeval *get_duration_to_next_timer_expiration()
next_timer->expiration_time_ms_,
next_timer->period_ms_);
result.tv_sec = duration / 1000;
result.tv_usec = 1000 * (duration - result.tv_sec);
duration -= result.tv_sec * 1000;
result.tv_usec = 1000 * duration;
return &result;
}

View File

@@ -22,7 +22,7 @@
/usr/include/librsvg-2.0
/usr/include/gdk-pixbuf-2.0
/usr/include/startup-notification-1.0
/usr/include/gtk-2.0
/usr/include/gtk-3.0
/usr/lib/x86_64-linux-gnu/gtk-2.0/include
/usr/include/atk-1.0
/usr/include/gio-unix-2.0