Add key_modifier option in [client]

This commit is contained in:
Martin Duquesnoy 2012-01-26 03:44:01 +01:00
parent a6aa4edbd7
commit 7c4e9d8dbc
4 changed files with 13 additions and 7 deletions

View File

@ -14,8 +14,6 @@
#include "screen.h" #include "screen.h"
#include "mouse.h" #include "mouse.h"
#define CLIENT_MOUSE_MOD Mod1Mask
#define CLIENT_RESIZE_DIR(D) \ #define CLIENT_RESIZE_DIR(D) \
void uicb_client_resize_##D(Uicb cmd) \ void uicb_client_resize_##D(Uicb cmd) \
{ \ { \
@ -322,13 +320,13 @@ client_grabbuttons(struct client *c, bool focused)
while(i++ != Button5) while(i++ != Button5)
{ {
XGrabButton(W->dpy, i, CLIENT_MOUSE_MOD, c->win, False, XGrabButton(W->dpy, i, W->client_mod, c->win, False,
ButtonMask, GrabModeAsync, GrabModeSync, None, None); ButtonMask, GrabModeAsync, GrabModeSync, None, None);
XGrabButton(W->dpy, i, CLIENT_MOUSE_MOD | LockMask, c->win, False, XGrabButton(W->dpy, i, W->client_mod | LockMask, c->win, False,
ButtonMask, GrabModeAsync, GrabModeSync, None, None); ButtonMask, GrabModeAsync, GrabModeSync, None, None);
XGrabButton(W->dpy, i, CLIENT_MOUSE_MOD | W->numlockmask, c->win, False, XGrabButton(W->dpy, i, W->client_mod | W->numlockmask, c->win, False,
ButtonMask, GrabModeAsync, GrabModeSync, None, None); ButtonMask, GrabModeAsync, GrabModeSync, None, None);
XGrabButton(W->dpy, i, CLIENT_MOUSE_MOD | LockMask | W->numlockmask, c->win, False, XGrabButton(W->dpy, i, W->client_mod | LockMask | W->numlockmask, c->win, False,
ButtonMask, GrabModeAsync, GrabModeSync, None, None); ButtonMask, GrabModeAsync, GrabModeSync, None, None);
} }
@ -735,6 +733,7 @@ static void
client_frame_new(struct client *c) client_frame_new(struct client *c)
{ {
struct barwin *frameb; struct barwin *frameb;
struct barwin *clientb;
XSetWindowAttributes at = XSetWindowAttributes at =
{ {
.background_pixel = c->ncol.bg, .background_pixel = c->ncol.bg,
@ -745,6 +744,7 @@ client_frame_new(struct client *c)
/* Use a fake barwin only to store mousebinds of frame win */ /* Use a fake barwin only to store mousebinds of frame win */
frameb = barwin_new(W->root, 0, 0, 1, 1, 0, 0, false); frameb = barwin_new(W->root, 0, 0, 1, 1, 0, 0, false);
clientb = barwin_new(W->root, 0, 0, 1, 1, 0, 0, false);
frameb->win = frameb->win =
c->frame = XCreateWindow(W->dpy, W->root, c->frame = XCreateWindow(W->dpy, W->root,
@ -755,8 +755,10 @@ client_frame_new(struct client *c)
CopyFromParent, CopyFromParent,
(CWOverrideRedirect | CWBackPixmap (CWOverrideRedirect | CWBackPixmap
| CWBackPixel | CWEventMask), &at); | CWBackPixel | CWEventMask), &at);
clientb->win = c->win;
frameb->mousebinds = W->tmp_head.client; frameb->mousebinds = W->tmp_head.client;
clientb->mousebinds = W->tmp_head.client;
if(c->tbarw > c->border) if(c->tbarw > c->border)
{ {

View File

@ -83,7 +83,6 @@ config_theme(void)
t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str); t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str);
t->tags_border_width = fetch_opt_first(ks[i], "0", "tags_border_width").num; t->tags_border_width = fetch_opt_first(ks[i], "0", "tags_border_width").num;
/* status line */ /* status line */
t->tags_n_sl = status_new_ctx(NULL, t); t->tags_n_sl = status_new_ctx(NULL, t);
t->tags_s_sl = status_new_ctx(NULL, t); t->tags_s_sl = status_new_ctx(NULL, t);
@ -207,6 +206,8 @@ config_client(void)
/* [client] */ /* [client] */
sec = fetch_section_first(NULL, "client"); sec = fetch_section_first(NULL, "client");
W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
/* [mouse] */ /* [mouse] */
/* for client frame AND titlebar */ /* for client frame AND titlebar */
if((mb = fetch_section(sec, "mouse"))) if((mb = fetch_section(sec, "mouse")))

View File

@ -305,6 +305,7 @@ struct wmfs
int xscreen, xdepth; int xscreen, xdepth;
int xmaxw, xmaxh; int xmaxw, xmaxh;
int nscreen; int nscreen;
unsigned int client_mod;
Flags numlockmask; Flags numlockmask;
#define WMFS_SCAN 0x01 #define WMFS_SCAN 0x01
#define WMFS_RUNNING 0x02 #define WMFS_RUNNING 0x02

2
wmfsrc
View File

@ -112,6 +112,8 @@
[client] [client]
key_modifier = "Super"
[mouse] button = "1" func = "client_focus_click" [/mouse] [mouse] button = "1" func = "client_focus_click" [/mouse]
[mouse] button = "1" func = "mouse_swap" [/mouse] [mouse] button = "1" func = "mouse_swap" [/mouse]
[mouse] button = "2" func = "mouse_tab" [/mouse] [mouse] button = "2" func = "mouse_tab" [/mouse]