Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97a8eade1d | ||
|
|
06bcb3f2da | ||
|
|
03b86f5f2c | ||
|
|
b56147efb7 | ||
|
|
ca3588cab0 | ||
|
|
795302fbaf | ||
|
|
60ee870ae5 | ||
|
|
975149642f | ||
|
|
bba945b3b9 | ||
|
|
5b3f9c4662 | ||
|
|
3bdb0e03f2 | ||
|
|
27a8ea013e |
10
doc/tint2.1
10
doc/tint2.1
@@ -831,19 +831,19 @@ execp_markup = 1
|
|||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
# Note the use of "stdbuf \-oL" to force the program to flush the output line by line.
|
||||||
execp = new
|
execp = new
|
||||||
execp_command = free | awk '/^\-/ { printf "Mem: '$(free \-h | awk '/^Mem:/ { print $2 }')' %.0f%%\\n", 100*$3/($3+$4); 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 = 5
|
execp_interval = 1
|
||||||
execp_continuous = 0
|
execp_continuous = 1
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.SS Network load
|
.SS Network load
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
# Note the use of "stdbuf \-oL" to force the program to flush the output line by line.
|
|
||||||
execp = new
|
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_continuous = 1
|
||||||
execp_interval = 1
|
execp_interval = 1
|
||||||
.fi
|
.fi
|
||||||
|
|||||||
@@ -372,14 +372,14 @@ execp_continuous = 1
|
|||||||
execp_interval = 1
|
execp_interval = 1
|
||||||
execp_markup = 1
|
execp_markup = 1
|
||||||
</code></pre>
|
</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
|
<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_command = free -s 2 | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%\n", 100*$3/($3+$4); fflush(stdout) }'
|
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_interval = 1
|
||||||
execp_continuous = 1
|
execp_continuous = 1
|
||||||
</code></pre>
|
</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.
|
<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 = 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_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_continuous = 1
|
execp_continuous = 1
|
||||||
execp_interval = 1
|
execp_interval = 1
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|||||||
10
doc/tint2.md
10
doc/tint2.md
@@ -694,18 +694,18 @@ execp_markup = 1
|
|||||||
##### Memory usage
|
##### Memory usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Note the use of "stdbuf -oL" to force the program to flush the output line by line.
|
||||||
execp = new
|
execp = new
|
||||||
execp_command = free | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%%\n", 100*$3/($3+$4); 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 = 5
|
execp_interval = 1
|
||||||
execp_continuous = 0
|
execp_continuous = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Network load
|
##### Network load
|
||||||
|
|
||||||
```
|
```
|
||||||
# Note the use of "stdbuf -oL" to force the program to flush the output line by line.
|
|
||||||
execp = new
|
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_continuous = 1
|
||||||
execp_interval = 1
|
execp_interval = 1
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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()
|
void update_clocks()
|
||||||
{
|
{
|
||||||
if (time1_format)
|
bool changed = false;
|
||||||
strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone));
|
update_clock_text(buf_time, sizeof(buf_time), time1_format, time1_timezone, &changed);
|
||||||
if (time2_format)
|
update_clock_text(buf_date, sizeof(buf_date), time2_format, time2_timezone, &changed);
|
||||||
strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone));
|
if (changed) {
|
||||||
if (time1_format || time2_format) {
|
|
||||||
for (int i = 0; i < num_panels; i++)
|
for (int i = 0; i < num_panels; i++)
|
||||||
panels[i].clock.area.resize_needed = 1;
|
panels[i].clock.area.resize_needed = 1;
|
||||||
}
|
|
||||||
schedule_panel_redraw();
|
schedule_panel_redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ms_until_second_change(struct timeval* tm)
|
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);
|
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()
|
void init_clock()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -222,11 +206,7 @@ void init_clock_panel(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!clock_timer.enabled_) {
|
if (!clock_timer.enabled_) {
|
||||||
if (time_format_needs_sec_ticks(time1_format) || time_format_needs_sec_ticks(time2_format)) {
|
|
||||||
update_clocks_sec(NULL);
|
update_clocks_sec(NULL);
|
||||||
} else {
|
|
||||||
update_clocks_min(NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -389,9 +389,9 @@ gboolean handle_x_event_autohide(XEvent *e)
|
|||||||
Panel *panel = get_panel(e->xany.window);
|
Panel *panel = get_panel(e->xany.window);
|
||||||
if (panel && panel_autohide) {
|
if (panel && panel_autohide) {
|
||||||
if (e->type == EnterNotify)
|
if (e->type == EnterNotify)
|
||||||
autohide_trigger_show(panel);
|
autohide_trigger_show(panel, e->xany.send_event);
|
||||||
else if (e->type == LeaveNotify)
|
else if (e->type == LeaveNotify)
|
||||||
autohide_trigger_hide(panel);
|
autohide_trigger_hide(panel, e->xany.send_event);
|
||||||
if (panel->is_hidden) {
|
if (panel->is_hidden) {
|
||||||
if (e->type == ClientMessage && e->xclient.message_type == server.atom.XdndPosition) {
|
if (e->type == ClientMessage && e->xclient.message_type == server.atom.XdndPosition) {
|
||||||
hidden_panel_shown_for_dnd = TRUE;
|
hidden_panel_shown_for_dnd = TRUE;
|
||||||
|
|||||||
13
src/panel.c
13
src/panel.c
@@ -316,7 +316,7 @@ void init_panel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel_autohide)
|
if (panel_autohide)
|
||||||
autohide_trigger_hide(p);
|
autohide_trigger_hide(p, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
taskbar_refresh_tasklist();
|
taskbar_refresh_tasklist();
|
||||||
@@ -1139,26 +1139,27 @@ void autohide_hide(void *p)
|
|||||||
schedule_panel_redraw();
|
schedule_panel_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void autohide_trigger_show(Panel *p)
|
void autohide_trigger_show(Panel *p, bool forced)
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
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)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!forced) {
|
||||||
Window root, child;
|
Window root, child;
|
||||||
int xr, yr, xw, yw;
|
int xr, yr, xw, yw;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
|
if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
|
||||||
if (child)
|
if (child)
|
||||||
return; // mouse over one of the system tray icons
|
return; // mouse over one of the system tray icons
|
||||||
|
}
|
||||||
change_timer(&p->autohide_timer, true, panel_autohide_hide_timeout, 0, autohide_hide, p);
|
change_timer(&p->autohide_timer, true, forced ? 0 : panel_autohide_hide_timeout, 0, autohide_hide, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shrink_panel(Panel *panel)
|
void shrink_panel(Panel *panel)
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ Button *click_button(Panel *panel, int x, int y);
|
|||||||
|
|
||||||
void autohide_show(void *p);
|
void autohide_show(void *p);
|
||||||
void autohide_hide(void *p);
|
void autohide_hide(void *p);
|
||||||
void autohide_trigger_show(Panel *p);
|
void autohide_trigger_show(Panel *p, bool forced);
|
||||||
void autohide_trigger_hide(Panel *p);
|
void autohide_trigger_hide(Panel *p, bool forced);
|
||||||
|
|
||||||
const char *get_default_font();
|
const char *get_default_font();
|
||||||
|
|
||||||
|
|||||||
@@ -312,10 +312,16 @@ Imlib_Image task_get_icon(Window win, int icon_size)
|
|||||||
int w, h;
|
int w, h;
|
||||||
gulong *tmp_data = get_best_icon(data, get_icon_count(data, len), len, &w, &h, icon_size);
|
gulong *tmp_data = get_best_icon(data, get_icon_count(data, len), len, &w, &h, icon_size);
|
||||||
if (tmp_data) {
|
if (tmp_data) {
|
||||||
DATA32 icon_data[w * h];
|
int array_size = w * h;
|
||||||
for (int j = 0; j < w * h; ++j)
|
// 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];
|
icon_data[j] = tmp_data[j];
|
||||||
img = imlib_create_image_using_copied_data(w, h, icon_data);
|
img = imlib_create_image_using_copied_data(w, h, icon_data);
|
||||||
|
g_free(icon_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFree(data);
|
XFree(data);
|
||||||
|
|||||||
12
src/tint2-send/Makefile
Normal file
12
src/tint2-send/Makefile
Normal 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
128
src/tint2-send/tint2-send.c
Normal 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;
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
|
|||||||
pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
|
pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
|
||||||
pkg_check_modules( IMLIB2 REQUIRED imlib2 )
|
pkg_check_modules( IMLIB2 REQUIRED imlib2 )
|
||||||
pkg_check_modules( GTHREAD2 REQUIRED gthread-2.0 )
|
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 )
|
pkg_check_modules( RSVG librsvg-2.0>=2.36.0 )
|
||||||
|
|
||||||
include_directories( ../util
|
include_directories( ../util
|
||||||
@@ -16,7 +16,7 @@ include_directories( ../util
|
|||||||
${GOBJECT2_INCLUDE_DIRS}
|
${GOBJECT2_INCLUDE_DIRS}
|
||||||
${IMLIB2_INCLUDE_DIRS}
|
${IMLIB2_INCLUDE_DIRS}
|
||||||
${GTHREAD2_INCLUDE_DIRS}
|
${GTHREAD2_INCLUDE_DIRS}
|
||||||
${GTK2_INCLUDE_DIRS}
|
${GTK3_INCLUDE_DIRS}
|
||||||
${RSVG_INCLUDE_DIRS} )
|
${RSVG_INCLUDE_DIRS} )
|
||||||
|
|
||||||
set(SOURCES ../util/common.c
|
set(SOURCES ../util/common.c
|
||||||
@@ -55,7 +55,7 @@ link_directories( ${X11_T2C_LIBRARY_DIRS}
|
|||||||
${GOBJECT2_LIBRARY_DIRS}
|
${GOBJECT2_LIBRARY_DIRS}
|
||||||
${IMLIB2_LIBRARY_DIRS}
|
${IMLIB2_LIBRARY_DIRS}
|
||||||
${GTHREAD2_LIBRARY_DIRS}
|
${GTHREAD2_LIBRARY_DIRS}
|
||||||
${GTK2_LIBRARY_DIRS}
|
${GTK3_LIBRARY_DIRS}
|
||||||
${RSVG_LIBRARY_DIRS} )
|
${RSVG_LIBRARY_DIRS} )
|
||||||
add_executable( tint2conf ${SOURCES} )
|
add_executable( tint2conf ${SOURCES} )
|
||||||
target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
|
target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
|
||||||
@@ -63,13 +63,14 @@ target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
|
|||||||
${GOBJECT2_LIBRARIES}
|
${GOBJECT2_LIBRARIES}
|
||||||
${IMLIB2_LIBRARIES}
|
${IMLIB2_LIBRARIES}
|
||||||
${GTHREAD2_LIBRARIES}
|
${GTHREAD2_LIBRARIES}
|
||||||
${GTK2_LIBRARIES}
|
${GTK3_LIBRARIES}
|
||||||
${RSVG_LIBRARIES} )
|
${RSVG_LIBRARIES} )
|
||||||
|
|
||||||
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
|
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
|
||||||
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" )
|
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" )
|
||||||
add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" )
|
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 -Wextra -Wno-unused-parameter -Wno-sign-compare -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" )
|
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
|
||||||
|
|
||||||
add_subdirectory(po)
|
add_subdirectory(po)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void create_background(GtkWidget *parent)
|
|||||||
backgrounds = gtk_list_store_new(bgNumCols,
|
backgrounds = gtk_list_store_new(bgNumCols,
|
||||||
GDK_TYPE_PIXBUF,
|
GDK_TYPE_PIXBUF,
|
||||||
GDK_TYPE_COLOR,
|
GDK_TYPE_COLOR,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_SHADOW_TYPE,
|
||||||
GDK_TYPE_COLOR,
|
GDK_TYPE_COLOR,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
@@ -121,7 +121,6 @@ void create_background(GtkWidget *parent)
|
|||||||
|
|
||||||
GtkWidget *table, *label, *button;
|
GtkWidget *table, *label, *button;
|
||||||
int row, col;
|
int row, col;
|
||||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
|
||||||
|
|
||||||
table = gtk_table_new(1, 4, FALSE);
|
table = gtk_table_new(1, 4, FALSE);
|
||||||
gtk_widget_show(table);
|
gtk_widget_show(table);
|
||||||
@@ -141,21 +140,21 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(current_background);
|
gtk_widget_show(current_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), current_background, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), current_background, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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);
|
table = gtk_table_new(4, 4, FALSE);
|
||||||
gtk_widget_show(table);
|
gtk_widget_show(table);
|
||||||
@@ -175,7 +174,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_fill_color);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_fill_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Fill tint"));
|
label = gtk_label_new(_("Fill tint"));
|
||||||
@@ -188,7 +187,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_fill_content_tint_weight);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_fill_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border color"));
|
label = gtk_label_new(_("Border color"));
|
||||||
@@ -202,7 +201,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_border_color);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_border_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border tint"));
|
label = gtk_label_new(_("Border tint"));
|
||||||
@@ -215,7 +214,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_border_content_tint_weight);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_border_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Gradient"));
|
label = gtk_label_new(_("Gradient"));
|
||||||
@@ -241,10 +240,8 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_fill_color_over);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips,
|
gtk_widget_set_tooltip_text(background_fill_color_over,
|
||||||
background_fill_color_over,
|
_("The fill color of the current background on mouse over"));
|
||||||
_("The fill color of the current background on mouse over"),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border color (mouse over)"));
|
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_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);
|
gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips,
|
gtk_widget_set_tooltip_text(
|
||||||
background_border_color_over,
|
background_border_color_over,
|
||||||
_("The border color of the current background on mouse over"),
|
_("The border color of the current background on mouse over"));
|
||||||
NULL);
|
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Gradient (mouse over)"));
|
label = gtk_label_new(_("Gradient (mouse over)"));
|
||||||
@@ -287,10 +283,8 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_fill_color_press);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_fill_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips,
|
gtk_widget_set_tooltip_text(background_fill_color_press,
|
||||||
background_fill_color_press,
|
_("The fill color of the current background on mouse button press"));
|
||||||
_("The fill color of the current background on mouse button press"),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border color (pressed)"));
|
label = gtk_label_new(_("Border color (pressed)"));
|
||||||
@@ -304,10 +298,8 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_border_color_press);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_border_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips,
|
gtk_widget_set_tooltip_text(background_border_color_press,
|
||||||
background_border_color_press,
|
_("The border color of the current background on mouse button press"));
|
||||||
_("The border color of the current background on mouse button press"),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Gradient (pressed)"));
|
label = gtk_label_new(_("Gradient (pressed)"));
|
||||||
@@ -332,10 +324,8 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_border_width);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_border_width, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips,
|
gtk_widget_set_tooltip_text(background_border_width,
|
||||||
background_border_width,
|
_("The width of the border of the current background, in pixels"));
|
||||||
_("The width of the border of the current background, in pixels"),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Corner radius"));
|
label = gtk_label_new(_("Corner radius"));
|
||||||
@@ -348,7 +338,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_widget_show(background_corner_radius);
|
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);
|
gtk_table_attach(GTK_TABLE(table), background_corner_radius, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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++;
|
row++;
|
||||||
col = 2;
|
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, fillColor);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
||||||
|
|
||||||
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24);
|
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
|
||||||
|
cairo_t *cr = cairo_create(s);
|
||||||
cairo_t *cr = gdk_cairo_create(pixmap);
|
|
||||||
cairo_set_line_width(cr, b);
|
cairo_set_line_width(cr, b);
|
||||||
|
|
||||||
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
|
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
|
||||||
@@ -744,13 +733,12 @@ void background_update_image(int index)
|
|||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
cr = NULL;
|
cr = NULL;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h);
|
pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
|
||||||
if (pixmap)
|
|
||||||
g_object_unref(pixmap);
|
|
||||||
|
|
||||||
gtk_list_store_set(backgrounds, &iter, bgColPixbuf, pixbuf, -1);
|
gtk_list_store_set(backgrounds, &iter, bgColPixbuf, pixbuf, -1);
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
g_object_unref(pixbuf);
|
g_object_unref(pixbuf);
|
||||||
|
cairo_surface_destroy(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_force_update()
|
void background_force_update()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ GtkWidget *create_gradient_combo()
|
|||||||
|
|
||||||
void create_gradient(GtkWidget *parent)
|
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;
|
gradients = NULL;
|
||||||
|
|
||||||
gradient_stop_ids = gtk_list_store_new(grStopNumCols, GDK_TYPE_PIXBUF);
|
gradient_stop_ids = gtk_list_store_new(grStopNumCols, GDK_TYPE_PIXBUF);
|
||||||
@@ -61,13 +61,13 @@ void create_gradient(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
button = gtk_button_new_from_stock("gtk-add");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
button = gtk_button_new_from_stock("gtk-remove");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
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);
|
gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
gradient_combo_type = gtk_combo_box_new_text();
|
gradient_combo_type = gtk_combo_box_text_new();
|
||||||
gtk_widget_show(gradient_combo_type);
|
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);
|
gtk_table_attach(GTK_TABLE(table), gradient_combo_type, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Vertical"));
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Vertical"));
|
||||||
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Horizontal"));
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(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), _("Radial"));
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(gradient_combo_type), 0);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(gradient_combo_type), 0);
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
@@ -142,13 +142,13 @@ void create_gradient(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
button = gtk_button_new_from_stock("gtk-add");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
button = gtk_button_new_from_stock("gtk-remove");
|
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_widget_show(button);
|
||||||
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -327,18 +327,17 @@ void gradient_update_image(int index)
|
|||||||
|
|
||||||
int w = 70;
|
int w = 70;
|
||||||
int h = 30;
|
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_set_source_rgb(cr, 0.5, 0.5, 0.5);
|
||||||
cairo_rectangle(cr, 0, 0, w, h);
|
cairo_rectangle(cr, 0, 0, w, h);
|
||||||
cairo_fill(cr);
|
cairo_fill(cr);
|
||||||
|
|
||||||
gradient_draw(cr, g, w, h, FALSE);
|
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);
|
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(pixmap, 0, 0, w, h);
|
||||||
if (pixmap)
|
cairo_surface_destroy(pixmap);
|
||||||
g_object_unref(pixmap);
|
|
||||||
|
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@@ -528,16 +527,14 @@ void gradient_stop_update_image(int index)
|
|||||||
|
|
||||||
int w = 70;
|
int w = 70;
|
||||||
int h = 30;
|
int h = 30;
|
||||||
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24);
|
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
|
||||||
|
cairo_t *cr = cairo_create(s);
|
||||||
cairo_t *cr = gdk_cairo_create(pixmap);
|
|
||||||
cairo_set_source_rgba(cr, stop->color.rgb[0], stop->color.rgb[1], stop->color.rgb[2], stop->color.alpha);
|
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_rectangle(cr, 0, 0, w, h);
|
||||||
cairo_fill(cr);
|
cairo_fill(cr);
|
||||||
|
|
||||||
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h);
|
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
|
||||||
if (pixmap)
|
cairo_surface_destroy(s);
|
||||||
g_object_unref(pixmap);
|
|
||||||
|
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|||||||
@@ -14,6 +14,27 @@
|
|||||||
#define GETTEXT_PACKAGE "tint2conf"
|
#define GETTEXT_PACKAGE "tint2conf"
|
||||||
#endif
|
#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
|
#define SNAPSHOT_TICK 190
|
||||||
gboolean update_snapshot(gpointer ignored);
|
gboolean update_snapshot(gpointer ignored);
|
||||||
void menuApply();
|
void menuApply();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1855,10 +1855,12 @@ void add_entry(char *key, char *value)
|
|||||||
} else if (strcmp(key, "launcher_apps_dir") == 0) {
|
} else if (strcmp(key, "launcher_apps_dir") == 0) {
|
||||||
char *path = expand_tilde(value);
|
char *path = expand_tilde(value);
|
||||||
|
|
||||||
if (gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs)) > 0) {
|
int position = gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs));
|
||||||
gtk_entry_append_text(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);
|
free(path);
|
||||||
} else if (strcmp(key, "launcher_icon_theme") == 0) {
|
} else if (strcmp(key, "launcher_icon_theme") == 0) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
/usr/include/librsvg-2.0
|
/usr/include/librsvg-2.0
|
||||||
/usr/include/gdk-pixbuf-2.0
|
/usr/include/gdk-pixbuf-2.0
|
||||||
/usr/include/startup-notification-1.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/lib/x86_64-linux-gnu/gtk-2.0/include
|
||||||
/usr/include/atk-1.0
|
/usr/include/atk-1.0
|
||||||
/usr/include/gio-unix-2.0
|
/usr/include/gio-unix-2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user