remember spot across fullscreen toggle

This commit is contained in:
seanpringle
2012-09-02 11:26:52 +10:00
parent 19703e33d0
commit 02035c5ffd
3 changed files with 14 additions and 10 deletions

View File

@@ -13,7 +13,6 @@ client* window_client(Window win);
int client_state(client *c, Atom state); int client_state(client *c, Atom state);
int client_add_state(client *c, Atom state); int client_add_state(client *c, Atom state);
int client_drop_state(client *c, Atom state); int client_drop_state(client *c, Atom state);
void client_toggle_state(client *c, Atom state);
void windows_visible(stack *s); void windows_visible(stack *s);
int window_message(Window target, Window subject, Atom atom, unsigned long protocol, unsigned long mask); int window_message(Window target, Window subject, Atom atom, unsigned long protocol, unsigned long mask);
void client_free(client *c); void client_free(client *c);

22
xoat.c
View File

@@ -249,14 +249,6 @@ int client_drop_state(client *c, Atom state)
return rc; return rc;
} }
void client_toggle_state(client *c, Atom state)
{
if (client_state(c, state))
client_drop_state(c, state);
else
client_add_state(c, state);
}
// build a list of visible windows // build a list of visible windows
void windows_visible(stack *s) void windows_visible(stack *s)
{ {
@@ -744,6 +736,7 @@ void key_press(XKeyEvent *e)
short act = ACTION_NONE; void *data = NULL; short act = ACTION_NONE; void *data = NULL;
KeySym key = XkbKeycodeToKeysym(display, e->keycode, 0, 0); KeySym key = XkbKeycodeToKeysym(display, e->keycode, 0, 0);
unsigned int state = e->state & ~(LockMask|NumlockMask); unsigned int state = e->state & ~(LockMask|NumlockMask);
unsigned long spot;
for (i = 0; i < sizeof(keys)/sizeof(binding); i++) for (i = 0; i < sizeof(keys)/sizeof(binding); i++)
{ {
@@ -794,7 +787,18 @@ void key_press(XKeyEvent *e)
} }
break; break;
case ACTION_FULLSCREEN_TOGGLE: case ACTION_FULLSCREEN_TOGGLE:
client_toggle_state(c, atoms[_NET_WM_STATE_FULLSCREEN]); spot = c->spot;
if (client_state(c, atoms[_NET_WM_STATE_FULLSCREEN]))
{
client_drop_state(c, atoms[_NET_WM_STATE_FULLSCREEN]);
if (window_get_cardinal_prop(c->window, atoms[XOAT_SPOT], &spot, 1))
c->spot = spot;
}
else
{
client_add_state(c, atoms[_NET_WM_STATE_FULLSCREEN]);
window_set_cardinal_prop(c->window, atoms[XOAT_SPOT], &spot, 1);
}
client_review(c); client_review(c);
client_spot(c, c->spot, 1); client_spot(c, c->spot, 1);
break; break;

1
xoat.h
View File

@@ -97,6 +97,7 @@ int struts[4] = { 0, 0, 0, 0 };
#define ATOM_CHAR(x) #x #define ATOM_CHAR(x) #x
#define GENERAL_ATOMS(X) \ #define GENERAL_ATOMS(X) \
X(XOAT_SPOT),\
X(_MOTIF_WM_HINTS),\ X(_MOTIF_WM_HINTS),\
X(WM_DELETE_WINDOW),\ X(WM_DELETE_WINDOW),\
X(WM_TAKE_FOCUS),\ X(WM_TAKE_FOCUS),\