Compare commits
7 Commits
17.0.1
...
refresh-ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1a3cc7977 | ||
|
|
f8f9c18cef | ||
|
|
56bccf2b4f | ||
|
|
ec4eccd769 | ||
|
|
2ed026ba32 | ||
|
|
a4996c84bd | ||
|
|
7b42055a20 |
34
.gitlab-ci.yml
Normal file
34
.gitlab-ci.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
DEBIAN_FRONTEND: 'noninteractive'
|
||||||
|
|
||||||
|
job-build:
|
||||||
|
stage: build
|
||||||
|
image: ubuntu:rolling
|
||||||
|
script:
|
||||||
|
- sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
|
||||||
|
- apt-get update
|
||||||
|
- apt-get build-dep -y tint2
|
||||||
|
- apt-get install -y libgtk-3-dev git
|
||||||
|
- git clean -ffdx
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake ..
|
||||||
|
- make -j
|
||||||
|
|
||||||
|
job-release:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG =~ /^v.*/
|
||||||
|
script:
|
||||||
|
- echo 'running release_job'
|
||||||
|
release:
|
||||||
|
name: 'Release $CI_COMMIT_TAG'
|
||||||
|
description: 'Release $CI_COMMIT_TAG / $CI_COMMIT_SHA'
|
||||||
|
tag_name: '$CI_COMMIT_TAG'
|
||||||
|
ref: '$CI_COMMIT_SHA'
|
||||||
@@ -286,6 +286,9 @@ add_dependencies( tint2 version )
|
|||||||
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=${CSTD} ${ASAN_C_FLAGS} ${TRACING_C_FLAGS}" )
|
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=${CSTD} ${ASAN_C_FLAGS} ${TRACING_C_FLAGS}" )
|
||||||
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS} ${BACKTRACE_L_FLAGS} ${TRACING_L_FLAGS}" )
|
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS} ${BACKTRACE_L_FLAGS} ${TRACING_L_FLAGS}" )
|
||||||
|
|
||||||
|
add_executable(tint2-send src/tint2-send/tint2-send.c)
|
||||||
|
target_link_libraries(tint2-send ${X11_LIBRARIES})
|
||||||
|
|
||||||
install( TARGETS tint2 DESTINATION bin )
|
install( TARGETS tint2 DESTINATION bin )
|
||||||
install( FILES tint2.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
|
install( FILES tint2.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
|
||||||
install( FILES tint2.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
|
install( FILES tint2.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
2021-12-04 17.0.2
|
||||||
|
- Fixes:
|
||||||
|
- On dual monitor, when minimizing Chrome window it minimizes on the wrong monitor panel (issue #818)
|
||||||
2021-05-29 17.0.1
|
2021-05-29 17.0.1
|
||||||
- Fixes:
|
- Fixes:
|
||||||
- Crash on panel cleanup in single-monitor execp (issue #801)
|
- Crash on panel cleanup in single-monitor execp (issue #801)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Latest stable release: 17.0.1
|
# Latest stable release: 17.0.2
|
||||||
Changes: https://gitlab.com/o9000/tint2/blob/17.0.1/ChangeLog
|
Changes: https://gitlab.com/o9000/tint2/blob/17.0.2/ChangeLog
|
||||||
|
|
||||||
Documentation: [doc/tint2.md](doc/tint2.md)
|
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
|
git clone https://gitlab.com/o9000/tint2.git
|
||||||
cd tint2
|
cd tint2
|
||||||
git checkout 17.0.1
|
git checkout 17.0.2
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ pre {
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="latest-stable-release-17-0-1"><span class="md2man-title">Latest</span> <span class="md2man-section">stable</span> <span class="md2man-date">release:</span> <span class="md2man-source">17.0.1</span><a name="latest-stable-release-17-0-1" href="#latest-stable-release-17-0-1" class="md2man-permalink" title="permalink"></a></h1><p>Changes: <a href="https://gitlab.com/o9000/tint2/blob/17.0.1/ChangeLog">https://gitlab.com/o9000/tint2/blob/17.0.1/ChangeLog</a></p><p>Documentation: <a href="manual.html">manual.html</a></p><p>Compile it with (after you install the <a href="https://gitlab.com/o9000/tint2/wikis/Install#dependencies">dependencies</a>):</p><div class="highlight"><pre class="highlight plaintext"><code>git clone https://gitlab.com/o9000/tint2.git
|
<h1 id="latest-stable-release-17-0-2"><span class="md2man-title">Latest</span> <span class="md2man-section">stable</span> <span class="md2man-date">release:</span> <span class="md2man-source">17.0.2</span><a name="latest-stable-release-17-0-2" href="#latest-stable-release-17-0-2" class="md2man-permalink" title="permalink"></a></h1><p>Changes: <a href="https://gitlab.com/o9000/tint2/blob/17.0.2/ChangeLog">https://gitlab.com/o9000/tint2/blob/17.0.2/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
|
cd tint2
|
||||||
git checkout 17.0.1
|
git checkout 17.0.2
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH TINT2 1 "2021\-05\-29" 17.0.1
|
.TH TINT2 1 "2021\-12\-04" 17.0.2
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
tint2 \- lightweight panel/taskbar
|
tint2 \- lightweight panel/taskbar
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# TINT2 1 "2021-05-29" 17.0.1
|
# TINT2 1 "2021-12-04" 17.0.2
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
tint2 - lightweight panel/taskbar
|
tint2 - lightweight panel/taskbar
|
||||||
|
|||||||
@@ -545,6 +545,11 @@ void handle_x_event(XEvent *e)
|
|||||||
handle_dnd_position(&e->xclient);
|
handle_dnd_position(&e->xclient);
|
||||||
} else if (e->xclient.message_type == server.atom.XdndDrop) {
|
} else if (e->xclient.message_type == server.atom.XdndDrop) {
|
||||||
handle_dnd_drop(&e->xclient);
|
handle_dnd_drop(&e->xclient);
|
||||||
|
} else if (e->xclient.message_type == server.atom.TINT2_REFRESH_EXECP &&
|
||||||
|
e->xclient.format == 8) {
|
||||||
|
char name[sizeof(e->xclient.data.b) + 1] = {};
|
||||||
|
memcpy(name, e->xclient.data.b, sizeof(e->xclient.data.b));
|
||||||
|
printf("TODO: refresh execp: %s\n", name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -60,11 +60,10 @@ int is_tint2(Window window)
|
|||||||
return class_match;
|
return class_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_tint2_window(Window window, void *arg)
|
void handle_tint2_window(Window window, char *action, char **args)
|
||||||
{
|
{
|
||||||
if (!is_tint2(window))
|
if (!is_tint2(window))
|
||||||
return;
|
return;
|
||||||
char *action = (char *)arg;
|
|
||||||
if (strcmp(action, "show") == 0) {
|
if (strcmp(action, "show") == 0) {
|
||||||
fprintf(stderr, "Showing tint2 window: %lx\n", window);
|
fprintf(stderr, "Showing tint2 window: %lx\n", window);
|
||||||
XEvent event = {};
|
XEvent event = {};
|
||||||
@@ -85,16 +84,40 @@ void handle_tint2_window(Window window, void *arg)
|
|||||||
event.xcrossing.same_screen = True;
|
event.xcrossing.same_screen = True;
|
||||||
XSendEvent(display, window, False, 0, &event);
|
XSendEvent(display, window, False, 0, &event);
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
} else if (strcmp(action, "refresh-execp") == 0) {
|
||||||
|
XEvent event = {};
|
||||||
|
char *name = args[0];
|
||||||
|
if (!name) {
|
||||||
|
fprintf(stderr, "Error: missing execp name\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!name[0]) {
|
||||||
|
fprintf(stderr, "Error: empty execp name\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (strlen(name) > sizeof(event.xclient.data.b)) {
|
||||||
|
fprintf(stderr, "Error: execp name too long\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "Refreshing execp '%s' for window: %lx\n", name, window);
|
||||||
|
event.xclient.type = ClientMessage;
|
||||||
|
event.xclient.window = window;
|
||||||
|
event.xclient.send_event = True;
|
||||||
|
event.xclient.message_type = XInternAtom(display, "_TINT2_REFRESH_EXECP", False);
|
||||||
|
event.xclient.format = 8;
|
||||||
|
strncpy(event.xclient.data.b, name, sizeof(event.xclient.data.b));
|
||||||
|
XSendEvent(display, window, False, 0, &event);
|
||||||
|
XFlush(display);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error: unknown action %s\n", action);
|
fprintf(stderr, "Error: unknown action %s\n", action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void window_callback_t(Window window, void *arg);
|
typedef void window_callback_t(Window window, char *action, char **args);
|
||||||
|
|
||||||
void walk_windows(Window node, window_callback_t *callback, void *arg)
|
void walk_windows(Window node, window_callback_t *callback, char *action, char **args)
|
||||||
{
|
{
|
||||||
callback(node, arg);
|
callback(node, action, args);
|
||||||
Window root = 0;
|
Window root = 0;
|
||||||
Window parent = 0;
|
Window parent = 0;
|
||||||
Window *children = 0;
|
Window *children = 0;
|
||||||
@@ -104,7 +127,7 @@ void walk_windows(Window node, window_callback_t *callback, void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < nchildren; i++) {
|
for (unsigned int i = 0; i < nchildren; i++) {
|
||||||
walk_windows(children[i], callback, arg);
|
walk_windows(children[i], callback, action, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,11 +141,12 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
if (!argc) {
|
if (!argc) {
|
||||||
fprintf(stderr, "Usage: tint2-show [show|hide]\n");
|
fprintf(stderr, "Usage: tint2-show [show|hide|refresh-execp]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
char *action = argv[0];
|
char *action = argv[0];
|
||||||
walk_windows(DefaultRootWindow(display), handle_tint2_window, action);
|
char **args = argv + 1;
|
||||||
|
walk_windows(DefaultRootWindow(display), handle_tint2_window, action, args);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,9 @@ void server_init_atoms()
|
|||||||
server.atom.XdndActionCopy = XInternAtom(server.display, "XdndActionCopy", False);
|
server.atom.XdndActionCopy = XInternAtom(server.display, "XdndActionCopy", False);
|
||||||
server.atom.XdndFinished = XInternAtom(server.display, "XdndFinished", False);
|
server.atom.XdndFinished = XInternAtom(server.display, "XdndFinished", False);
|
||||||
server.atom.TARGETS = XInternAtom(server.display, "TARGETS", False);
|
server.atom.TARGETS = XInternAtom(server.display, "TARGETS", False);
|
||||||
|
|
||||||
|
// tint2 atoms
|
||||||
|
server.atom.TINT2_REFRESH_EXECP = XInternAtom(server.display, "_TINT2_REFRESH_EXECP", False);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetAtomName(Display *disp, Atom a)
|
const char *GetAtomName(Display *disp, Atom a)
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ typedef struct Global_atom {
|
|||||||
Atom XdndActionCopy;
|
Atom XdndActionCopy;
|
||||||
Atom XdndFinished;
|
Atom XdndFinished;
|
||||||
Atom TARGETS;
|
Atom TARGETS;
|
||||||
|
Atom TINT2_REFRESH_EXECP;
|
||||||
} Global_atom;
|
} Global_atom;
|
||||||
|
|
||||||
typedef struct Property {
|
typedef struct Property {
|
||||||
|
|||||||
@@ -169,31 +169,40 @@ int get_window_desktop(Window win)
|
|||||||
return best_match;
|
return best_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define swap(a, b) do { __typeof__(a) _tmp = (a); (a) = (b); (b) = _tmp; } while(0)
|
||||||
|
|
||||||
|
int get_interval_overlap(int a1, int a2, int b1, int b2)
|
||||||
|
{
|
||||||
|
if (a1 > b1) {
|
||||||
|
swap(a1, b1);
|
||||||
|
swap(a2, b2);
|
||||||
|
}
|
||||||
|
if (b1 <= a2)
|
||||||
|
return a2 - b1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int get_window_monitor(Window win)
|
int get_window_monitor(Window win)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
get_window_coordinates(win, &x, &y, &w, &h);
|
get_window_coordinates(win, &x, &y, &w, &h);
|
||||||
|
|
||||||
int best_match = -1;
|
int best_match = 0;
|
||||||
int match_right = 0;
|
int best_area = -1;
|
||||||
int match_bottom = 0;
|
|
||||||
// There is an ambiguity when a window is right on the edge between screens.
|
|
||||||
// In that case, prefer the monitor which is on the right and bottom of the window's top-left corner.
|
|
||||||
for (int i = 0; i < server.num_monitors; i++) {
|
for (int i = 0; i < server.num_monitors; i++) {
|
||||||
if (x >= server.monitors[i].x && x <= (server.monitors[i].x + server.monitors[i].width) &&
|
int commonx = get_interval_overlap(x, x + w, server.monitors[i].x, server.monitors[i].x + server.monitors[i].width);
|
||||||
y >= server.monitors[i].y && y <= (server.monitors[i].y + server.monitors[i].height)) {
|
int commony = get_interval_overlap(y, y + h, server.monitors[i].y, server.monitors[i].y + server.monitors[i].height);
|
||||||
int current_right = x < (server.monitors[i].x + server.monitors[i].width);
|
int area = commonx * commony;
|
||||||
int current_bottom = y < (server.monitors[i].y + server.monitors[i].height);
|
if (0)
|
||||||
if (best_match < 0 || (!match_right && current_right) || (!match_bottom && current_bottom)) {
|
printf("Monitor %d (%dx%d+%dx%d): win (%dx%d+%dx%d) area %dx%d=%d\n",
|
||||||
|
i, server.monitors[i].x, server.monitors[i].y, server.monitors[i].width, server.monitors[i].height,
|
||||||
|
x, y, w, h,
|
||||||
|
commonx, commony, area);
|
||||||
|
if (area > best_area) {
|
||||||
|
best_area = area;
|
||||||
best_match = i;
|
best_match = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (best_match < 0)
|
|
||||||
best_match = 0;
|
|
||||||
// fprintf(stderr, "tint2: desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win,
|
|
||||||
// get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
|
||||||
return best_match;
|
return best_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user