systray: Sort icons in the correct order when an icon is empty and order is right2left
This commit is contained in:
parent
ea67f24051
commit
cb17e5a662
4 changed files with 22 additions and 10 deletions
|
@ -29,7 +29,6 @@
|
||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
|
|
||||||
|
|
||||||
#include "systraybar.h"
|
#include "systraybar.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
|
@ -342,9 +341,9 @@ static gint compare_traywindows(gconstpointer a, gconstpointer b)
|
||||||
const TrayWindow * traywin_b = (TrayWindow*)b;
|
const TrayWindow * traywin_b = (TrayWindow*)b;
|
||||||
|
|
||||||
if (traywin_a->empty && !traywin_b->empty)
|
if (traywin_a->empty && !traywin_b->empty)
|
||||||
return 1;
|
return 1 * (systray.sort == SYSTRAY_SORT_RIGHT2LEFT ? -1 : 1);
|
||||||
if (!traywin_a->empty && traywin_b->empty)
|
if (!traywin_a->empty && traywin_b->empty)
|
||||||
return -1;
|
return -1 * (systray.sort == SYSTRAY_SORT_RIGHT2LEFT ? -1 : 1);
|
||||||
|
|
||||||
if (systray.sort == SYSTRAY_SORT_ASCENDING ||
|
if (systray.sort == SYSTRAY_SORT_ASCENDING ||
|
||||||
systray.sort == SYSTRAY_SORT_DESCENDING) {
|
systray.sort == SYSTRAY_SORT_DESCENDING) {
|
||||||
|
@ -603,7 +602,18 @@ void systray_render_icon_now(void* t)
|
||||||
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
||||||
TrayWindow* traywin = t;
|
TrayWindow* traywin = t;
|
||||||
|
|
||||||
traywin->render_timeout = 0;
|
// wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
|
||||||
|
struct timespec now;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
struct timespec earliest_render = add_msec_to_timespec(traywin->time_last_render, 50);
|
||||||
|
if (compare_timespecs(&earliest_render, &now) > 0) {
|
||||||
|
traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin, &traywin->render_timeout);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
traywin->time_last_render.tv_sec = now.tv_sec;
|
||||||
|
traywin->time_last_render.tv_nsec = now.tv_nsec;
|
||||||
|
traywin->render_timeout = NULL;
|
||||||
|
|
||||||
if ( traywin->width == 0 || traywin->height == 0 ) {
|
if ( traywin->width == 0 || traywin->height == 0 ) {
|
||||||
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu)
|
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu)
|
||||||
systray_render_icon(traywin);
|
systray_render_icon(traywin);
|
||||||
|
@ -698,9 +708,8 @@ void systray_render_icon_now(void* t)
|
||||||
void systray_render_icon(TrayWindow* traywin)
|
void systray_render_icon(TrayWindow* traywin)
|
||||||
{
|
{
|
||||||
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
|
||||||
// wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
|
|
||||||
if (!traywin->render_timeout)
|
if (!traywin->render_timeout)
|
||||||
traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin, &traywin->render_timeout);
|
systray_render_icon_now(traywin);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Pixmap pix = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, server.depth);
|
// Pixmap pix = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, server.depth);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "area.h"
|
#include "area.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
// XEMBED messages
|
// XEMBED messages
|
||||||
#define XEMBED_EMBEDDED_NOTIFY 0
|
#define XEMBED_EMBEDDED_NOTIFY 0
|
||||||
|
@ -47,6 +49,7 @@ typedef struct
|
||||||
int empty;
|
int empty;
|
||||||
int pid;
|
int pid;
|
||||||
int chrono;
|
int chrono;
|
||||||
|
struct timespec time_last_render;
|
||||||
} TrayWindow;
|
} TrayWindow;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,7 @@ struct _timeout {
|
||||||
|
|
||||||
void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(void*), void* arg, timeout* t);
|
void add_timeout_intern(int value_msec, int interval_msec, void(*_callback)(void*), void* arg, timeout* t);
|
||||||
gint compare_timeouts(gconstpointer t1, gconstpointer t2);
|
gint compare_timeouts(gconstpointer t1, gconstpointer t2);
|
||||||
gint compare_timespecs(const struct timespec* t1, const struct timespec* t2);
|
|
||||||
int timespec_subtract(struct timespec* result, struct timespec* x, struct timespec* y);
|
int timespec_subtract(struct timespec* result, struct timespec* x, struct timespec* y);
|
||||||
struct timespec add_msec_to_timespec(struct timespec ts, int msec);
|
|
||||||
|
|
||||||
|
|
||||||
int align_with_existing_timeouts(timeout* t);
|
int align_with_existing_timeouts(timeout* t);
|
||||||
void create_multi_timeout(timeout* t1, timeout* t2);
|
void create_multi_timeout(timeout* t1, timeout* t2);
|
||||||
|
|
|
@ -66,4 +66,7 @@ void update_next_timeout();
|
||||||
/** Callback of all expired timeouts **/
|
/** Callback of all expired timeouts **/
|
||||||
void callback_timeout_expired();
|
void callback_timeout_expired();
|
||||||
|
|
||||||
|
gint compare_timespecs(const struct timespec* t1, const struct timespec* t2);
|
||||||
|
struct timespec add_msec_to_timespec(struct timespec ts, int msec);
|
||||||
|
|
||||||
#endif // TIMER_H
|
#endif // TIMER_H
|
||||||
|
|
Loading…
Reference in a new issue