diff options
author | Michael Cardell Widerkrantz <mc@hack.org> | 2012-02-16 14:06:42 +0100 |
---|---|---|
committer | Michael Cardell Widerkrantz <mc@hack.org> | 2012-02-16 14:06:42 +0100 |
commit | e1ba6dc56a411ee2df35f97fb93e11b7fbe53d16 (patch) | |
tree | a0cd13e64c0f32c1d87b035be4c20d5805653cd7 /mcwm.c | |
parent | a30f469abdac71f9545f45a22b0b60c9ae4880ee (diff) | |
download | mcwm-e1ba6dc56a411ee2df35f97fb93e11b7fbe53d16.zip |
Added iconify/hide key, MODKEY + i.
Changed manual. Group together window operations in manual.
Diffstat (limited to 'mcwm.c')
-rw-r--r-- | mcwm.c | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -127,6 +127,7 @@ typedef enum { KEY_END, KEY_PREVSCR, KEY_NEXTSCR, + KEY_ICONIFY, KEY_MAX } key_enum_t; @@ -254,7 +255,8 @@ struct keys { USERKEY_BOTRIGHT, 0 }, { USERKEY_DELETE, 0 }, { USERKEY_PREVSCREEN, 0 }, - { USERKEY_NEXTSCREEN, 0 }, + { USERKEY_NEXTSCREEN, 0 }, + { USERKEY_ICONIFY, 0 }, }; /* All keycodes generating our MODKEY mask. */ @@ -346,6 +348,7 @@ static void setborders(struct client *client, int width); static void unmax(struct client *client); static void maximize(struct client *client); static void maxvert(struct client *client); +static void hide(struct client *client); static bool getpointer(xcb_drawable_t win, int16_t *x, int16_t *y); static bool getgeom(xcb_drawable_t win, int16_t *x, int16_t *y, uint16_t *width, uint16_t *height); @@ -2624,6 +2627,22 @@ void maxvert(struct client *client) client->vertmaxed = true; } +void hide(struct client *client) +{ + long data[] = { XCB_ICCCM_WM_STATE_ICONIC, XCB_NONE }; + + /* + * Unmap window and declare iconic. + * + * Unmapping will generate an even UnmapNotify event so we can + * forget about the window later. + */ + xcb_unmap_window(conn, client->id); + xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->id, + wm_state, wm_state, 32, 2, data); + xcb_flush(conn); +} + bool getpointer(xcb_drawable_t win, int16_t *x, int16_t *y) { xcb_query_pointer_reply_t *pointer; @@ -3112,6 +3131,13 @@ void handle_keypress(xcb_key_press_event_t *ev) nextscreen(); break; + case KEY_ICONIFY: + if (conf.allowicons) + { + hide(focuswin); + } + break; + default: /* Ignore other keys. */ break; |