From ec414ae39b841f4fa0f73da50fbaed31eac57831 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 24 Jun 2008 19:56:10 +0200 Subject: [PATCH] systray: set orientation Signed-off-by: Julien Danjou --- client.c | 3 +-- event.c | 2 ++ widgets/systray.c | 25 ++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index dc8a567b..345b2b4f 100644 --- a/client.c +++ b/client.c @@ -387,8 +387,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen) if(rettrans || c->isfixed) client_setfloating(c, true, c->layer != LAYER_TILE ? c->layer : LAYER_FLOAT); - xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, - select_input_val); + xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, select_input_val); /* Push client in client list */ client_list_push(&globalconf.clients, c); diff --git a/event.c b/event.c index f9d65040..e1d755f3 100644 --- a/event.c +++ b/event.c @@ -620,6 +620,8 @@ event_handle_clientmessage(void *data __attribute__ ((unused)), atom_xem = xutil_intern_atom_reply(globalconf.connection, &globalconf.atoms, atom_xem_q); atom_systray = xutil_intern_atom_reply(globalconf.connection, &globalconf.atoms, atom_systray_q); + printf("msg %d to %d\n", ev->type, ev->window); + if(ev->type == atom_xem) return xembed_process_client_message(ev); else if(ev->type == atom_systray) diff --git a/widgets/systray.c b/widgets/systray.c index cb0af42c..9830f60c 100644 --- a/widgets/systray.c +++ b/widgets/systray.c @@ -20,11 +20,15 @@ */ #include +#include #include "widget.h" #include "screen.h" #include "common/xembed.h" +#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0 +#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1 + extern awesome_t globalconf; static int @@ -36,12 +40,18 @@ systray_draw(draw_context_t *ctx, { int i = 0, phys_screen; xembed_window_t *em; - uint32_t config_win_vals[4]; + uint32_t orient, config_win_vals[4]; /* p is always a statusbar, titlebars are forbidden */ statusbar_t *sb = (statusbar_t *) p; + xutil_intern_atom_request_t net_system_tray_orientation_q; + xcb_atom_t net_system_tray_orientation; phys_screen = screen_virttophys(screen); + net_system_tray_orientation_q = xutil_intern_atom(globalconf.connection, + &globalconf.atoms, + "_NET_SYSTEM_TRAY_ORIENTATION"); + for(em = globalconf.embedded; em; em = em->next) if(em->phys_screen == phys_screen) i++; @@ -68,6 +78,7 @@ systray_draw(draw_context_t *ctx, config_win_vals[0] = sb->sw->geometry.x + w->area.y; config_win_vals[1] = sb->sw->geometry.y + sb->sw->geometry.height - w->area.x - config_win_vals[3]; + orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT; for(em = globalconf.embedded; em; em = em->next) if(em->phys_screen == phys_screen) { @@ -87,6 +98,7 @@ systray_draw(draw_context_t *ctx, } break; case Right: + orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT; config_win_vals[0] = sb->sw->geometry.x - w->area.y; config_win_vals[1] = sb->sw->geometry.y + w->area.x; for(em = globalconf.embedded; em; em = em->next) @@ -108,6 +120,7 @@ systray_draw(draw_context_t *ctx, } break; default: + orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ; /* x */ config_win_vals[0] = sb->sw->geometry.x + w->area.x; /* y */ @@ -137,6 +150,16 @@ systray_draw(draw_context_t *ctx, /* inform that there's a widget */ globalconf.screens[phys_screen].systray.has_systray_widget = true; + /* set statusbar orientation */ + /** \todo stop setting that property on each redraw */ + net_system_tray_orientation = xutil_intern_atom_reply(globalconf.connection, + &globalconf.atoms, + net_system_tray_orientation_q); + + xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, + globalconf.screens[phys_screen].systray.window, + net_system_tray_orientation, CARDINAL, 32, 1, &orient); + return w->area.width; }