add support for _NET_WM_STATE_FULLSCREEN

This commit also drop the handle_event_configurerequest() because it seems
totally unuseful now. This can cause problem, and if so, report it.
This commit is contained in:
Julien Danjou 2007-12-28 18:31:31 +01:00
parent 88ee1e037e
commit f37c71c162
4 changed files with 53 additions and 35 deletions

View File

@ -135,6 +135,7 @@ handle_event_configurerequest(XEvent * e)
XWindowChanges wc;
int old_screen;
Tag **curtags;
return;
if((c = get_client_bywin(globalconf.clients, ev->window)))
{
@ -146,9 +147,9 @@ handle_event_configurerequest(XEvent * e)
|| curtags[0]->layout->arrange == layout_floating)
{
if(ev->value_mask & CWX)
c->rx = c->x = ev->x;
c->rx = c->x = ev->x - c->border;
if(ev->value_mask & CWY)
c->ry = c->y = ev->y;
c->ry = c->y = ev->y - c->border;
if(ev->value_mask & CWWidth)
c->rw = c->w = ev->width;
if(ev->value_mask & CWHeight)
@ -165,6 +166,7 @@ handle_event_configurerequest(XEvent * e)
statusbar_draw(c->screen);
}
tag_client_with_rules(c);
c->isfloating = True;
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
arrange(c->screen);
}

27
ewmh.c
View File

@ -26,6 +26,8 @@
#include "util.h"
#include "tag.h"
#include "focus.h"
#include "screen.h"
#include "layout.h"
extern AwesomeConf globalconf;
@ -42,6 +44,7 @@ static Atom net_wm_name;
static Atom net_wm_icon;
static Atom net_wm_state;
static Atom net_wm_state_sticky;
static Atom net_wm_state_fullscreen;
static Atom utf8_string;
@ -66,12 +69,17 @@ static AtomItem AtomNames[] =
{ "_NET_WM_ICON", &net_wm_icon },
{ "_NET_WM_STATE", &net_wm_state },
{ "_NET_WM_STATE_STICKY", &net_wm_state_sticky },
{ "_NET_WM_STATE_FULLSCREEN", &net_wm_state_fullscreen },
{ "UTF8_STRING", &utf8_string },
};
#define ATOM_NUMBER (sizeof(AtomNames)/sizeof(AtomItem))
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2
void
ewmh_init_atoms(void)
{
@ -105,6 +113,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_wm_icon;
atom[i++] = net_wm_state;
atom[i++] = net_wm_state_sticky;
atom[i++] = net_wm_state_fullscreen;
XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen),
net_supported, XA_ATOM, 32,
@ -197,7 +206,7 @@ ewmh_update_net_active_window(int phys_screen)
}
static void
ewmh_process_state_atom(Client *c, Atom state)
ewmh_process_state_atom(Client *c, Atom state, int set)
{
if(state == net_wm_state_sticky)
{
@ -205,6 +214,16 @@ ewmh_process_state_atom(Client *c, Atom state)
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
tag_client(c, tag);
}
else if(state == net_wm_state_fullscreen)
{
Area area = get_screen_area(c->screen, NULL, NULL);
/* reset max attribute */
if(set == _NET_WM_STATE_REMOVE)
c->ismax = True;
else if(set == _NET_WM_STATE_ADD)
c->ismax = False;
client_maximize(c, area.x, area.y, area.width, area.height);
}
}
void
@ -221,9 +240,9 @@ ewmh_process_client_message(XClientMessageEvent *ev)
{
if((c = get_client_bywin(globalconf.clients, ev->window)))
{
ewmh_process_state_atom(c, (Atom) ev->data.l[1]);
ewmh_process_state_atom(c, (Atom) ev->data.l[1], ev->data.l[0]);
if(ev->data.l[2])
ewmh_process_state_atom(c, (Atom) ev->data.l[2]);
ewmh_process_state_atom(c, (Atom) ev->data.l[2], ev->data.l[0]);
}
}
}
@ -243,7 +262,7 @@ ewmh_check_client_hints(Client *c)
state = (Atom *) data;
for(i = 0; i < n; i++)
ewmh_process_state_atom(c, state[i]);
ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD);
XFree(data);
}

View File

@ -252,26 +252,25 @@ uicb_tag_setlayout(int screen, char *arg)
saveawesomeprops(screen);
}
static void
maximize(int x, int y, int w, int h, int screen)
void
client_maximize(Client *c, int x, int y, int w, int h)
{
Client *sel = globalconf.focus->client;
if(!sel)
return;
if((sel->ismax = !sel->ismax))
if((c->ismax = !c->ismax))
{
sel->wasfloating = sel->isfloating;
sel->isfloating = True;
client_resize(sel, x, y, w, h, True, True);
c->oldborder = c->border;
c->border = 0;
c->wasfloating = c->isfloating;
c->isfloating = True;
client_resize(c, x, y, w, h, False, True);
}
else if(sel->wasfloating)
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True, False);
else if(c->wasfloating)
client_resize(c, c->rx, c->ry, c->rw, c->rh, True, False);
else
sel->isfloating = False;
c->isfloating = False;
arrange(screen);
c->border = c->oldborder;
arrange(c->screen);
}
/** Toggle maximize for client
@ -282,13 +281,14 @@ maximize(int x, int y, int w, int h, int screen)
void
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
{
Client *sel = globalconf.focus->client;
Area area = get_screen_area(screen,
globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding);
maximize(area.x, area.y,
if(sel)
client_maximize(sel, area.x, area.y,
area.width - 2 * globalconf.screens[screen].borderpx,
area.height - 2 * globalconf.screens[screen].borderpx,
screen);
area.height - 2 * globalconf.screens[screen].borderpx);
}
/** Toggle vertical maximize for client
@ -305,11 +305,9 @@ uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
&globalconf.screens[screen].padding);
if(sel)
maximize(sel->x,
area.y,
client_maximize(sel, sel->x, area.y,
sel->w,
area.height - 2 * globalconf.screens[screen].borderpx,
screen);
area.height - 2 * globalconf.screens[screen].borderpx);
}
@ -327,11 +325,9 @@ uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
&globalconf.screens[screen].padding);
if(sel)
maximize(area.x,
sel->y,
client_maximize(sel, area.x, sel->y,
area.height - 2 * globalconf.screens[screen].borderpx,
sel->h,
screen);
sel->h);
}
/** Zoom client

View File

@ -30,6 +30,7 @@ void arrange(int);
void restack(int);
void loadawesomeprops(int);
void saveawesomeprops(int);
void client_maximize(Client *c, int, int, int, int);
UICB_PROTO(uicb_client_focusnext);
UICB_PROTO(uicb_client_focusprev);