systray: set orientation

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-24 19:56:10 +02:00
parent 104df8912b
commit ec414ae39b
3 changed files with 27 additions and 3 deletions

View File

@ -387,8 +387,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
if(rettrans || c->isfixed) if(rettrans || c->isfixed)
client_setfloating(c, true, c->layer != LAYER_TILE ? c->layer : LAYER_FLOAT); client_setfloating(c, true, c->layer != LAYER_TILE ? c->layer : LAYER_FLOAT);
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, select_input_val);
select_input_val);
/* Push client in client list */ /* Push client in client list */
client_list_push(&globalconf.clients, c); client_list_push(&globalconf.clients, c);

View File

@ -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_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); 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) if(ev->type == atom_xem)
return xembed_process_client_message(ev); return xembed_process_client_message(ev);
else if(ev->type == atom_systray) else if(ev->type == atom_systray)

View File

@ -20,11 +20,15 @@
*/ */
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include "widget.h" #include "widget.h"
#include "screen.h" #include "screen.h"
#include "common/xembed.h" #include "common/xembed.h"
#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1
extern awesome_t globalconf; extern awesome_t globalconf;
static int static int
@ -36,12 +40,18 @@ systray_draw(draw_context_t *ctx,
{ {
int i = 0, phys_screen; int i = 0, phys_screen;
xembed_window_t *em; 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 */ /* p is always a statusbar, titlebars are forbidden */
statusbar_t *sb = (statusbar_t *) p; 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); 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) for(em = globalconf.embedded; em; em = em->next)
if(em->phys_screen == phys_screen) if(em->phys_screen == phys_screen)
i++; 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[0] = sb->sw->geometry.x + w->area.y;
config_win_vals[1] = sb->sw->geometry.y + sb->sw->geometry.height config_win_vals[1] = sb->sw->geometry.y + sb->sw->geometry.height
- w->area.x - config_win_vals[3]; - w->area.x - config_win_vals[3];
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
for(em = globalconf.embedded; em; em = em->next) for(em = globalconf.embedded; em; em = em->next)
if(em->phys_screen == phys_screen) if(em->phys_screen == phys_screen)
{ {
@ -87,6 +98,7 @@ systray_draw(draw_context_t *ctx,
} }
break; break;
case Right: case Right:
orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT;
config_win_vals[0] = sb->sw->geometry.x - w->area.y; config_win_vals[0] = sb->sw->geometry.x - w->area.y;
config_win_vals[1] = sb->sw->geometry.y + w->area.x; config_win_vals[1] = sb->sw->geometry.y + w->area.x;
for(em = globalconf.embedded; em; em = em->next) for(em = globalconf.embedded; em; em = em->next)
@ -108,6 +120,7 @@ systray_draw(draw_context_t *ctx,
} }
break; break;
default: default:
orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
/* x */ /* x */
config_win_vals[0] = sb->sw->geometry.x + w->area.x; config_win_vals[0] = sb->sw->geometry.x + w->area.x;
/* y */ /* y */
@ -137,6 +150,16 @@ systray_draw(draw_context_t *ctx,
/* inform that there's a widget */ /* inform that there's a widget */
globalconf.screens[phys_screen].systray.has_systray_widget = true; 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; return w->area.width;
} }