From bd0a1d7ae6a262dde107e520a4445e49a0787dc6 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Jun 2007 22:23:14 +0000 Subject: [PATCH] set _NET_WM_ICON_GEOMETRY add tb.x/y vars --- rspanel.c | 37 +++++++++++++++++++++++++++++-------- rspanel.h | 2 ++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/rspanel.c b/rspanel.c index c30ad67..30692c4 100644 --- a/rspanel.c +++ b/rspanel.c @@ -94,6 +94,7 @@ char *atom_names[] = { "_NET_ACTIVE_WINDOW", "_NET_RESTACK_WINDOW", "_OB_FOCUS", + "_NET_WM_ICON_GEOMETRY" }; typedef enum { @@ -120,6 +121,7 @@ STRING_UTF8, _NET_ACTIVE_WINDOW, _NET_RESTACK_WINDOW, _OB_FOCUS, +_NET_WM_ICON_GEOMETRY, ATOM_COUNT, } atom_t; @@ -269,10 +271,13 @@ static Window gui_create_taskbar(void) att.event_mask = ButtonPressMask; + tb.x = 0; + tb.y = scr_height - WINHEIGHT; + win = rspanelwin = XCreateWindow(/* display */ dd, /* parent */ root_win, - /* x */ 0, - /* y */ scr_height - WINHEIGHT, + /* x */ tb.x, + /* y */ tb.y, /* XXX Maybe just use scr_width here? */ /* width */ WINWIDTH, /* height */ WINHEIGHT, @@ -420,6 +425,21 @@ static void netwm_action(Window win, atom_t atom, Time time, long l) |SubstructureRedirectMask, (XEvent *)&xev); } +static void set_icon_geometry(task *tk) +{ + long coords[4]; + + coords[0] = tb.x + tk->pos_x; + coords[1] = tb.y; + coords[2] = MAX(tk->width, 1); + coords[3] = WINHEIGHT; + + XChangeProperty(dd, tk->win, + atoms[_NET_WM_ICON_GEOMETRY], XA_CARDINAL, + 32, PropModeReplace, (unsigned char*) &coords, 4); +} + + #ifdef PAGER static void switch_desk(int new_desk, Time time) @@ -513,6 +533,7 @@ static void gui_draw_taskbar(void) tk->pos_x = x; tk->width = taskw - 1; gui_draw_task(tk, FALSE); + set_icon_geometry(tk); x += taskw; tk = tk->next; } @@ -563,17 +584,15 @@ static void del_task(Window win) static void move_taskbar(void) { - int x, y; - - x = y = 0; + tb.x = tb.y = 0; if (tb.hidden) - x = TEXTPAD - WINWIDTH; + tb.x = TEXTPAD - WINWIDTH; if (!tb.at_top) - y = scr_height - WINHEIGHT; + tb.y = scr_height - WINHEIGHT; - XMoveWindow(dd, tb.win, x, y); + XMoveWindow(dd, tb.win, tb.x, tb.y); } static void taskbar_read_clientlist(void) @@ -582,6 +601,7 @@ static void taskbar_read_clientlist(void) int num, i, desk, new_desk = 0; task *list, *next; desk = get_current_desktop(); + #ifdef MIKACHU if (desk == 0) WINWIDTH = 827; @@ -590,6 +610,7 @@ static void taskbar_read_clientlist(void) XResizeWindow(dd, rspanelwin, WINWIDTH, WINHEIGHT); #endif + if (desk != tb.my_desktop) { new_desk = 1; tb.my_desktop = desk; diff --git a/rspanel.h b/rspanel.h index 22da1f2..da6bfc1 100644 --- a/rspanel.h +++ b/rspanel.h @@ -23,6 +23,8 @@ typedef struct taskbar int num_tasks; int num_shown_tasks; int my_desktop; + int x; + int y; unsigned int hidden:1; unsigned int at_top:1; } -- 2.39.2