|
@@ -51,6 +51,20 @@ static int bar_temp_c = -1;
|
|
|
static int bar_batt_pct = -1;
|
|
static int bar_batt_pct = -1;
|
|
|
static int bar_batt_charging;
|
|
static int bar_batt_charging;
|
|
|
static int bar_ac_online = -1;
|
|
static int bar_ac_online = -1;
|
|
|
|
|
+/* Battery/AC status icon: a plug on AC, a level-filled battery otherwise.
|
|
|
|
|
+ * The rightmost bar item; hovering it shows a percentage tooltip below it. */
|
|
|
|
|
+#define BAR_PWR_W 24
|
|
|
|
|
+#define BAR_PWR_Y 6
|
|
|
|
|
+#define BAR_TIP_H 20
|
|
|
|
|
+static int bar_pwr_x = -1;
|
|
|
|
|
+static int bar_pwr_hot;
|
|
|
|
|
+static int bar_pwr_tip_x = -1;
|
|
|
|
|
+static int bar_pwr_tip_y;
|
|
|
|
|
+static unsigned int bar_pwr_tip_w, bar_pwr_tip_h;
|
|
|
|
|
+static int bar_pwr_tip_want; /* tooltip computed for this frame */
|
|
|
|
|
+static int bar_pwr_tip_on; /* tooltip pixels currently on screen */
|
|
|
|
|
+static int bar_pwr_tip_on_x, bar_pwr_tip_on_y;
|
|
|
|
|
+static unsigned int bar_pwr_tip_on_w, bar_pwr_tip_on_h;
|
|
|
static char bar_msg[24];
|
|
static char bar_msg[24];
|
|
|
static unsigned int bar_msg_until;
|
|
static unsigned int bar_msg_until;
|
|
|
static int bar_msg_dirty;
|
|
static int bar_msg_dirty;
|
|
@@ -277,15 +291,11 @@ static unsigned int temp_color(int c)
|
|
|
return 0x55FF55u;
|
|
return 0x55FF55u;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* "CPU 43C" (no libc printf here). */
|
|
|
|
|
|
|
+/* "43C" (no libc printf here). */
|
|
|
static unsigned int temp_text(char *b, int c)
|
|
static unsigned int temp_text(char *b, int c)
|
|
|
{
|
|
{
|
|
|
unsigned int n = 0, v = (unsigned int)c;
|
|
unsigned int n = 0, v = (unsigned int)c;
|
|
|
|
|
|
|
|
- b[n++] = 'C';
|
|
|
|
|
- b[n++] = 'P';
|
|
|
|
|
- b[n++] = 'U';
|
|
|
|
|
- b[n++] = ' ';
|
|
|
|
|
if (v >= 100)
|
|
if (v >= 100)
|
|
|
b[n++] = (char)('0' + (v / 100) % 10);
|
|
b[n++] = (char)('0' + (v / 100) % 10);
|
|
|
if (v >= 10)
|
|
if (v >= 10)
|
|
@@ -296,15 +306,11 @@ static unsigned int temp_text(char *b, int c)
|
|
|
return n;
|
|
return n;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* "BAT 87%" (no libc printf here). */
|
|
|
|
|
-static unsigned int batt_text(char *b, int pct)
|
|
|
|
|
|
|
+/* "87%" (no libc printf here). */
|
|
|
|
|
+static unsigned int pct_text(char *b, int pct)
|
|
|
{
|
|
{
|
|
|
unsigned int n = 0, v = (unsigned int)pct;
|
|
unsigned int n = 0, v = (unsigned int)pct;
|
|
|
|
|
|
|
|
- b[n++] = 'B';
|
|
|
|
|
- b[n++] = 'A';
|
|
|
|
|
- b[n++] = 'T';
|
|
|
|
|
- b[n++] = ' ';
|
|
|
|
|
if (v >= 100)
|
|
if (v >= 100)
|
|
|
b[n++] = (char)('0' + (v / 100) % 10);
|
|
b[n++] = (char)('0' + (v / 100) % 10);
|
|
|
if (v >= 10)
|
|
if (v >= 10)
|
|
@@ -326,29 +332,75 @@ static unsigned int batt_color(int pct, int charging, int ac)
|
|
|
return 0x55D2FFu;
|
|
return 0x55D2FFu;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* "AC on" / "AC off" (no libc printf here). Only drawn on machines whose
|
|
|
|
|
- * ThinkPad EC reported the adapter state. */
|
|
|
|
|
-static unsigned int ac_text(char *b, int online)
|
|
|
|
|
|
|
+/* Battery pictogram: outline, terminal and a fill proportional to the
|
|
|
|
|
+ * percentage. A critical charge turns the outline red as well. */
|
|
|
|
|
+static void bar_icon_battery(int x, int y, int pct, unsigned int c)
|
|
|
{
|
|
{
|
|
|
- unsigned int n = 0;
|
|
|
|
|
|
|
+ unsigned int frame = pct <= 10 ? c : 0xD2D2D2u;
|
|
|
|
|
+ unsigned int fill = (unsigned int)((14 * pct + 99) / 100);
|
|
|
|
|
+
|
|
|
|
|
+ usurf_fill(&screen, x + 1, y + 2, 18, 2, frame);
|
|
|
|
|
+ usurf_fill(&screen, x + 1, y + 14, 18, 2, frame);
|
|
|
|
|
+ usurf_fill(&screen, x + 1, y + 2, 2, 14, frame);
|
|
|
|
|
+ usurf_fill(&screen, x + 17, y + 2, 2, 14, frame);
|
|
|
|
|
+ usurf_fill(&screen, x + 19, y + 6, 3, 6, frame);
|
|
|
|
|
+ if (fill > 14)
|
|
|
|
|
+ fill = 14;
|
|
|
|
|
+ if (fill)
|
|
|
|
|
+ usurf_fill(&screen, x + 3, y + 4, fill, 8, c);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- b[n++] = 'A';
|
|
|
|
|
- b[n++] = 'C';
|
|
|
|
|
- b[n++] = ' ';
|
|
|
|
|
- b[n++] = 'o';
|
|
|
|
|
- if (online) {
|
|
|
|
|
- b[n++] = 'n';
|
|
|
|
|
- } else {
|
|
|
|
|
- b[n++] = 'f';
|
|
|
|
|
- b[n++] = 'f';
|
|
|
|
|
- }
|
|
|
|
|
- b[n] = '\0';
|
|
|
|
|
- return n;
|
|
|
|
|
|
|
+/* AC plug pictogram: two prongs and the body, kept compact in height. */
|
|
|
|
|
+static void bar_icon_plug(int x, int y, unsigned int c)
|
|
|
|
|
+{
|
|
|
|
|
+ usurf_fill(&screen, x + 7, y + 2, 3, 5, c);
|
|
|
|
|
+ usurf_fill(&screen, x + 14, y + 2, 3, 5, c);
|
|
|
|
|
+ usurf_fill(&screen, x + 5, y + 7, 14, 7, c);
|
|
|
|
|
+ usurf_fill(&screen, x + 7, y + 9, 10, 3, COL_BG);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Percentage tooltip: a small box below the status icon. It is drawn after
|
|
|
|
|
+ * the windows (see bar_tooltip_overlay), so it always sits on top. */
|
|
|
|
|
+static void bar_draw_tooltip(void)
|
|
|
|
|
+{
|
|
|
|
|
+ char lb[8];
|
|
|
|
|
+ unsigned int lw;
|
|
|
|
|
+ int tx;
|
|
|
|
|
+
|
|
|
|
|
+ if (!bar_pwr_tip_want || bar_pwr_tip_x < 0)
|
|
|
|
|
+ return;
|
|
|
|
|
+ usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
|
|
|
|
|
+ bar_pwr_tip_w, bar_pwr_tip_h, 0x161622u);
|
|
|
|
|
+ usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
|
|
|
|
|
+ bar_pwr_tip_w, 1, 0x646464u);
|
|
|
|
|
+ usurf_fill(&screen, bar_pwr_tip_x,
|
|
|
|
|
+ bar_pwr_tip_y + (int)bar_pwr_tip_h - 1,
|
|
|
|
|
+ bar_pwr_tip_w, 1, 0x646464u);
|
|
|
|
|
+ usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
|
|
|
|
|
+ 1, bar_pwr_tip_h, 0x646464u);
|
|
|
|
|
+ usurf_fill(&screen, bar_pwr_tip_x + (int)bar_pwr_tip_w - 1,
|
|
|
|
|
+ bar_pwr_tip_y, 1, bar_pwr_tip_h, 0x646464u);
|
|
|
|
|
+ (void)pct_text(lb, bar_batt_pct);
|
|
|
|
|
+ lw = usurf_text_width(&screen, lb);
|
|
|
|
|
+ tx = bar_pwr_tip_x + ((int)bar_pwr_tip_w - (int)lw) / 2;
|
|
|
|
|
+ usurf_text(&screen, tx, bar_pwr_tip_y + 3, lb,
|
|
|
|
|
+ batt_color(bar_batt_pct, bar_batt_charging, bar_ac_online),
|
|
|
|
|
+ 0, 0, fbw, fbh);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static unsigned int ac_color(int online)
|
|
|
|
|
|
|
+/* Publish the geometry computed by draw_bar() and redraw the tooltip. */
|
|
|
|
|
+static void bar_tooltip_commit(void)
|
|
|
{
|
|
{
|
|
|
- return online ? 0x55FF55u : 0xFFD250u;
|
|
|
|
|
|
|
+ if (bar_pwr_tip_want) {
|
|
|
|
|
+ bar_draw_tooltip();
|
|
|
|
|
+ bar_pwr_tip_on = 1;
|
|
|
|
|
+ bar_pwr_tip_on_x = bar_pwr_tip_x;
|
|
|
|
|
+ bar_pwr_tip_on_y = bar_pwr_tip_y;
|
|
|
|
|
+ bar_pwr_tip_on_w = bar_pwr_tip_w;
|
|
|
|
|
+ bar_pwr_tip_on_h = bar_pwr_tip_h;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bar_pwr_tip_on = 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void draw_bar(void)
|
|
static void draw_bar(void)
|
|
@@ -399,6 +451,9 @@ static void draw_bar(void)
|
|
|
bar_clock_hot = 0;
|
|
bar_clock_hot = 0;
|
|
|
bar_net_x = -1;
|
|
bar_net_x = -1;
|
|
|
bar_net_w = 0;
|
|
bar_net_w = 0;
|
|
|
|
|
+ bar_pwr_x = -1;
|
|
|
|
|
+ bar_pwr_tip_x = -1;
|
|
|
|
|
+ bar_pwr_tip_want = 0;
|
|
|
n = 0;
|
|
n = 0;
|
|
|
while (msg[n])
|
|
while (msg[n])
|
|
|
dt[n] = msg[n], n++;
|
|
dt[n] = msg[n], n++;
|
|
@@ -418,8 +473,51 @@ static void draw_bar(void)
|
|
|
bar_clock_w = 0;
|
|
bar_clock_w = 0;
|
|
|
bar_net_x = -1;
|
|
bar_net_x = -1;
|
|
|
bar_net_w = 0;
|
|
bar_net_w = 0;
|
|
|
- /* The network status is the rightmost item, so it survives
|
|
|
|
|
- * narrow screens and a full temperature/battery cluster. */
|
|
|
|
|
|
|
+ bar_pwr_x = -1;
|
|
|
|
|
+ bar_pwr_tip_x = -1;
|
|
|
|
|
+ bar_pwr_tip_want = 0;
|
|
|
|
|
+ /* The AC/battery status icon is the rightmost item. */
|
|
|
|
|
+ if (bar_batt_pct >= 0 || bar_ac_online > 0) {
|
|
|
|
|
+ int px = right - BAR_PWR_W;
|
|
|
|
|
+
|
|
|
|
|
+ if (px >= min_x) {
|
|
|
|
|
+ if (bar_pwr_hot)
|
|
|
|
|
+ usurf_fill(&screen, px - 3, 2,
|
|
|
|
|
+ BAR_PWR_W + 6,
|
|
|
|
|
+ WM_BAR_H - 7, 0x3A3A55u);
|
|
|
|
|
+ if (bar_ac_online > 0)
|
|
|
|
|
+ bar_icon_plug(px, BAR_PWR_Y, 0x55FF55u);
|
|
|
|
|
+ else
|
|
|
|
|
+ bar_icon_battery(px, BAR_PWR_Y,
|
|
|
|
|
+ bar_batt_pct,
|
|
|
|
|
+ batt_color(bar_batt_pct,
|
|
|
|
|
+ bar_batt_charging,
|
|
|
|
|
+ bar_ac_online));
|
|
|
|
|
+ bar_pwr_x = px;
|
|
|
|
|
+ right = px - 8;
|
|
|
|
|
+ if (bar_pwr_hot && bar_batt_pct >= 0) {
|
|
|
|
|
+ char lb[8];
|
|
|
|
|
+ unsigned int lw, bw;
|
|
|
|
|
+ int bx;
|
|
|
|
|
+
|
|
|
|
|
+ (void)pct_text(lb, bar_batt_pct);
|
|
|
|
|
+ lw = usurf_text_width(&screen, lb);
|
|
|
|
|
+ bw = lw + 10;
|
|
|
|
|
+ bx = px + BAR_PWR_W - (int)bw;
|
|
|
|
|
+ if (bx < 4)
|
|
|
|
|
+ bx = 4;
|
|
|
|
|
+ if (bx + (int)bw > (int)fbw - 4)
|
|
|
|
|
+ bx = (int)fbw - 4 - (int)bw;
|
|
|
|
|
+ bar_pwr_tip_x = bx;
|
|
|
|
|
+ bar_pwr_tip_y = WM_BAR_H + 2;
|
|
|
|
|
+ bar_pwr_tip_w = bw;
|
|
|
|
|
+ bar_pwr_tip_h = BAR_TIP_H;
|
|
|
|
|
+ bar_pwr_tip_want = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /* The network status sits to the left of the power icon, so it
|
|
|
|
|
+ * survives narrow screens and a full temperature cluster. */
|
|
|
{
|
|
{
|
|
|
int nx = right - BAR_NET_W;
|
|
int nx = right - BAR_NET_W;
|
|
|
|
|
|
|
@@ -427,7 +525,7 @@ static void draw_bar(void)
|
|
|
if (bar_net_hot)
|
|
if (bar_net_hot)
|
|
|
usurf_fill(&screen, nx - 3, 2,
|
|
usurf_fill(&screen, nx - 3, 2,
|
|
|
BAR_NET_W + 6,
|
|
BAR_NET_W + 6,
|
|
|
- WM_BAR_H - 4, 0x3A3A55u);
|
|
|
|
|
|
|
+ WM_BAR_H - 7, 0x3A3A55u);
|
|
|
bar_draw_net_icon(nx, BAR_NET_Y);
|
|
bar_draw_net_icon(nx, BAR_NET_Y);
|
|
|
bar_net_x = nx;
|
|
bar_net_x = nx;
|
|
|
bar_net_w = BAR_NET_W;
|
|
bar_net_w = BAR_NET_W;
|
|
@@ -446,7 +544,7 @@ static void draw_bar(void)
|
|
|
if (bar_clock_hot)
|
|
if (bar_clock_hot)
|
|
|
usurf_fill(&screen, tx - 5, 2,
|
|
usurf_fill(&screen, tx - 5, 2,
|
|
|
(unsigned int)tw + 10,
|
|
(unsigned int)tw + 10,
|
|
|
- WM_BAR_H - 4, 0x3A3A55u);
|
|
|
|
|
|
|
+ WM_BAR_H - 7, 0x3A3A55u);
|
|
|
usurf_text(&screen, tx, 5, dt, COL_BANNER, 0, 0,
|
|
usurf_text(&screen, tx, 5, dt, COL_BANNER, 0, 0,
|
|
|
fbw, WM_BAR_H);
|
|
fbw, WM_BAR_H);
|
|
|
clock_chars = (unsigned int)tw;
|
|
clock_chars = (unsigned int)tw;
|
|
@@ -467,36 +565,6 @@ static void draw_bar(void)
|
|
|
right = tx - 8;
|
|
right = tx - 8;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (bar_batt_pct >= 0) {
|
|
|
|
|
- char bb[10];
|
|
|
|
|
- int bx;
|
|
|
|
|
-
|
|
|
|
|
- (void)batt_text(bb, bar_batt_pct);
|
|
|
|
|
- bx = right - (int)usurf_text_width(&screen, bb);
|
|
|
|
|
-
|
|
|
|
|
- if (bx >= min_x) {
|
|
|
|
|
- usurf_text(&screen, bx, 5, bb,
|
|
|
|
|
- batt_color(bar_batt_pct,
|
|
|
|
|
- bar_batt_charging,
|
|
|
|
|
- bar_ac_online),
|
|
|
|
|
- 0, 0, fbw, WM_BAR_H);
|
|
|
|
|
- right = bx - 8;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (bar_ac_online >= 0) {
|
|
|
|
|
- char ab[8];
|
|
|
|
|
- int ax;
|
|
|
|
|
-
|
|
|
|
|
- (void)ac_text(ab, bar_ac_online);
|
|
|
|
|
- ax = right - (int)usurf_text_width(&screen, ab);
|
|
|
|
|
-
|
|
|
|
|
- if (ax >= min_x) {
|
|
|
|
|
- usurf_text(&screen, ax, 5, ab,
|
|
|
|
|
- ac_color(bar_ac_online), 0, 0,
|
|
|
|
|
- fbw, WM_BAR_H);
|
|
|
|
|
- right = ax - 8;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -794,6 +862,16 @@ static void add_rect(struct wm_present_info *p, int x, int y,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* Redraw the power tooltip above whatever a render pass just painted. */
|
|
|
|
|
+static void bar_tooltip_overlay(struct wm_present_info *p)
|
|
|
|
|
+{
|
|
|
|
|
+ if (!bar_pwr_tip_on || !bar_pwr_tip_want)
|
|
|
|
|
+ return;
|
|
|
|
|
+ bar_draw_tooltip();
|
|
|
|
|
+ add_rect(p, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
|
|
|
|
|
+ bar_pwr_tip_on_w, bar_pwr_tip_on_h);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/* A focused window is topmost, so the shadow contains exactly its pixels in
|
|
/* A focused window is topmost, so the shadow contains exactly its pixels in
|
|
|
* the old rectangle. Move that block and repaint only the old part the new
|
|
* the old rectangle. Move that block and repaint only the old part the new
|
|
|
* rectangle does not cover. When either rectangle is partly off-screen the
|
|
* rectangle does not cover. When either rectangle is partly off-screen the
|
|
@@ -833,6 +911,7 @@ static void move_window_pixels(struct uwin *u, int ox, int oy, int nx, int ny)
|
|
|
for (k = 0; k < np; k++)
|
|
for (k = 0; k < np; k++)
|
|
|
add_rect(&present, pieces[k].x, pieces[k].y,
|
|
add_rect(&present, pieces[k].x, pieces[k].y,
|
|
|
pieces[k].w, pieces[k].h);
|
|
pieces[k].w, pieces[k].h);
|
|
|
|
|
+ bar_tooltip_overlay(&present);
|
|
|
u_wm_present(&present);
|
|
u_wm_present(&present);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -856,6 +935,7 @@ static void redraw_geom(struct uwin *u, int ox, int oy,
|
|
|
for (i = 0; i < present.count; i++)
|
|
for (i = 0; i < present.count; i++)
|
|
|
draw_rect(present.rect[i].x, present.rect[i].y,
|
|
draw_rect(present.rect[i].x, present.rect[i].y,
|
|
|
present.rect[i].w, present.rect[i].h);
|
|
present.rect[i].w, present.rect[i].h);
|
|
|
|
|
+ bar_tooltip_overlay(&present);
|
|
|
u_wm_present(&present);
|
|
u_wm_present(&present);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -927,6 +1007,21 @@ static int bar_net_hit(unsigned int mx, unsigned int my)
|
|
|
(int)mx < bar_net_x + (int)bar_net_w + 3;
|
|
(int)mx < bar_net_x + (int)bar_net_w + 3;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* The AC/battery icon has no click action, but hovering it reveals the
|
|
|
|
|
+ * percentage tooltip below it; the tooltip area keeps the hover alive. */
|
|
|
|
|
+static int bar_pwr_hit(unsigned int mx, unsigned int my)
|
|
|
|
|
+{
|
|
|
|
|
+ if (my >= WM_BAR_H)
|
|
|
|
|
+ return bar_pwr_tip_on &&
|
|
|
|
|
+ (int)mx >= bar_pwr_tip_on_x &&
|
|
|
|
|
+ (int)mx < bar_pwr_tip_on_x + (int)bar_pwr_tip_on_w &&
|
|
|
|
|
+ (int)my >= bar_pwr_tip_on_y &&
|
|
|
|
|
+ (int)my < bar_pwr_tip_on_y + (int)bar_pwr_tip_on_h;
|
|
|
|
|
+ return bar_pwr_x >= 0 &&
|
|
|
|
|
+ (int)mx >= bar_pwr_x - 3 &&
|
|
|
|
|
+ (int)mx < bar_pwr_x + BAR_PWR_W + 3;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void do_update(struct wm_status *st)
|
|
static void do_update(struct wm_status *st)
|
|
|
{
|
|
{
|
|
|
struct wm_present_info present;
|
|
struct wm_present_info present;
|
|
@@ -984,6 +1079,14 @@ static void do_update(struct wm_status *st)
|
|
|
bar_dirty = 1;
|
|
bar_dirty = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ {
|
|
|
|
|
+ int hot = bar_pwr_hit(st->mouse.x, st->mouse.y);
|
|
|
|
|
+
|
|
|
|
|
+ if (hot != bar_pwr_hot) {
|
|
|
|
|
+ bar_pwr_hot = hot;
|
|
|
|
|
+ bar_dirty = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/* Refresh cached window state and mappings before opening a frame:
|
|
/* Refresh cached window state and mappings before opening a frame:
|
|
|
* MAP may unmap/remap content. */
|
|
* MAP may unmap/remap content. */
|
|
@@ -1129,6 +1232,7 @@ static void do_update(struct wm_status *st)
|
|
|
{
|
|
{
|
|
|
draw_rect(0, 0, fbw, fbh);
|
|
draw_rect(0, 0, fbw, fbh);
|
|
|
draw_bar();
|
|
draw_bar();
|
|
|
|
|
+ bar_tooltip_commit();
|
|
|
present.count = 0;
|
|
present.count = 0;
|
|
|
add_rect(&present, 0, 0, fbw, fbh);
|
|
add_rect(&present, 0, 0, fbw, fbh);
|
|
|
present.immediate = 0;
|
|
present.immediate = 0;
|
|
@@ -1169,6 +1273,15 @@ static void do_update(struct wm_status *st)
|
|
|
need = 1;
|
|
need = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* Repaint the previous tooltip area so hiding or moving it restores
|
|
|
|
|
+ * the window/desktop underneath; the new one is drawn after the
|
|
|
|
|
+ * windows below. */
|
|
|
|
|
+ if (bar_pwr_tip_on) {
|
|
|
|
|
+ need = 1;
|
|
|
|
|
+ add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
|
|
|
|
|
+ bar_pwr_tip_on_w, bar_pwr_tip_on_h);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!need) {
|
|
if (!need) {
|
|
|
/* Drag movement is handled below; a stationary mouse can be
|
|
/* Drag movement is handled below; a stationary mouse can be
|
|
|
* left to the kernel's cursor overlay. */
|
|
* left to the kernel's cursor overlay. */
|
|
@@ -1182,6 +1295,13 @@ static void do_update(struct wm_status *st)
|
|
|
present.rect[i].w, present.rect[i].h);
|
|
present.rect[i].w, present.rect[i].h);
|
|
|
if (bar_dirty)
|
|
if (bar_dirty)
|
|
|
draw_bar();
|
|
draw_bar();
|
|
|
|
|
+ if (bar_pwr_tip_want) {
|
|
|
|
|
+ bar_tooltip_commit();
|
|
|
|
|
+ add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
|
|
|
|
|
+ bar_pwr_tip_on_w, bar_pwr_tip_on_h);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bar_pwr_tip_on = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
for (i = 0; i < WM_MAX_WINDOWS; i++) {
|
|
for (i = 0; i < WM_MAX_WINDOWS; i++) {
|
|
|
struct uwin *u = &wins[i];
|
|
struct uwin *u = &wins[i];
|
|
@@ -1433,6 +1553,7 @@ static void handle_mouse(struct wm_status *st)
|
|
|
present.rect[i].y,
|
|
present.rect[i].y,
|
|
|
present.rect[i].w,
|
|
present.rect[i].w,
|
|
|
present.rect[i].h);
|
|
present.rect[i].h);
|
|
|
|
|
+ bar_tooltip_overlay(&present);
|
|
|
u_wm_present(&present);
|
|
u_wm_present(&present);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|