systray: set orientation
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
104df8912b
commit
ec414ae39b
3
client.c
3
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);
|
||||
|
|
2
event.c
2
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)
|
||||
|
|
|
@ -20,11 +20,15 @@
|
|||
*/
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_atom.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue