summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2018-10-07 14:59:16 +0200
committerMichael Cardell Widerkrantz <mc@hack.org>2018-10-07 14:59:16 +0200
commitb771a1e219bb40eaeaf4e68eb777d3ee04e9ed2f (patch)
tree49267bc4452582eb6d217e76b93e7a9f242d4208
parentfaac8aa40f8cae2880111c7b20fe06b1b7280afa (diff)
downloadmcwm-b771a1e219bb40eaeaf4e68eb777d3ee04e9ed2f.zip
Delete trailing whitespace.
-rw-r--r--hidden.c30
-rw-r--r--list.c68
-rw-r--r--list.h4
-rw-r--r--mcwm.c568
4 files changed, 335 insertions, 335 deletions
diff --git a/hidden.c b/hidden.c
index 372e52a..8f9a948 100644
--- a/hidden.c
+++ b/hidden.c
@@ -1,7 +1,7 @@
/*
* hidden - A small program to listen all windows with WM_STATE set to
* Iconic.
- *
+ *
* Copyright (c) 2012 Michael Cardell Widerkrantz, mc at the domain
* hack.org.
*
@@ -47,7 +47,7 @@ uint32_t get_wm_state(xcb_drawable_t win)
xcb_get_property_cookie_t cookie;
uint32_t *statep;
uint32_t state = 0;
-
+
cookie = xcb_get_property(conn, false, win, wm_state, wm_state, 0,
sizeof (int32_t));
@@ -63,7 +63,7 @@ uint32_t get_wm_state(xcb_drawable_t win)
{
goto bad;
}
-
+
statep = xcb_get_property_value(reply);
state = *statep;
@@ -87,7 +87,7 @@ int findhidden(void)
xcb_get_property_cookie_t cookie;
xcb_icccm_get_text_property_reply_t prop;
xcb_generic_error_t *error;
-
+
/* Get all children. */
reply = xcb_query_tree_reply(conn,
xcb_query_tree(conn, screen->root), 0);
@@ -96,9 +96,9 @@ int findhidden(void)
return -1;
}
- len = xcb_query_tree_children_length(reply);
+ len = xcb_query_tree_children_length(reply);
children = xcb_query_tree_children(reply);
-
+
/* List all hidden windows on this root. */
for (i = 0; i < len; i ++)
{
@@ -126,7 +126,7 @@ int findhidden(void)
{
/*
* Example names:
- *
+ *
* _NET_WM_ICON_NAME(UTF8_STRING) = 0x75, 0x72, 0x78,
* 0x76, 0x74 WM_ICON_NAME(STRING) = "urxvt"
* _NET_WM_NAME(UTF8_STRING) = 0x75, 0x72, 0x78, 0x76,
@@ -148,7 +148,7 @@ int findhidden(void)
}
}
}
-
+
free(attr);
}
@@ -161,7 +161,7 @@ void init(void)
{
int scrno;
xcb_screen_iterator_t iter;
-
+
conn = xcb_connect(NULL, &scrno);
if (!conn)
{
@@ -188,18 +188,18 @@ void init(void)
void cleanup(void)
{
- xcb_disconnect(conn);
+ xcb_disconnect(conn);
}
/*
* Get a defined atom from the X server.
- */
+ */
xcb_atom_t getatom(char *atom_name)
{
xcb_intern_atom_cookie_t atom_cookie;
xcb_atom_t atom;
xcb_intern_atom_reply_t *rep;
-
+
atom_cookie = xcb_intern_atom(conn, 0, strlen(atom_name), atom_name);
rep = xcb_intern_atom_reply(conn, atom_cookie, NULL);
if (NULL != rep)
@@ -239,13 +239,13 @@ int main(int argc, char **argv)
case 'c':
printcommand = true;
break;
-
+
default:
printhelp();
- exit(0);
+ exit(0);
} /* switch ch */
} /* while 1 */
-
+
init();
wm_state = getatom("WM_STATE");
findhidden();
diff --git a/list.c b/list.c
index d331e24..ddd3775 100644
--- a/list.c
+++ b/list.c
@@ -17,14 +17,14 @@
/*
* Move element in item to the head of list mainlist.
- */
+ */
void movetohead(struct item **mainlist, struct item *item)
{
if (NULL == item || NULL == mainlist || NULL == *mainlist)
{
return;
}
-
+
if (*mainlist == item)
{
/* item is NULL or we're already at head. Do nothing. */
@@ -50,7 +50,7 @@ void movetohead(struct item **mainlist, struct item *item)
/* Old head needs to know about us. */
item->next->prev = item;
-
+
/* Remember the new head. */
*mainlist = item;
}
@@ -63,12 +63,12 @@ void movetohead(struct item **mainlist, struct item *item)
struct item *additem(struct item **mainlist)
{
struct item *item;
-
+
if (NULL == (item = (struct item *) malloc(sizeof (struct item))))
{
return NULL;
}
-
+
if (NULL == *mainlist)
{
/* First in the list. */
@@ -86,14 +86,14 @@ struct item *additem(struct item **mainlist)
}
*mainlist = item;
-
+
return item;
}
void delitem(struct item **mainlist, struct item *item)
{
struct item *ml = *mainlist;
-
+
if (NULL == mainlist || NULL == *mainlist || NULL == item)
{
return;
@@ -125,7 +125,7 @@ void freeitem(struct item **list, int *stored,
{
return;
}
-
+
if (NULL != item->data)
{
free(item->data);
@@ -142,12 +142,12 @@ void freeitem(struct item **list, int *stored,
/*
* Delete all elements in list and free memory resources.
- */
+ */
void delallitems(struct item **list, int *stored)
{
struct item *item;
struct item *next;
-
+
for (item = *list; item != NULL; item = next)
{
next = item->next;
@@ -158,14 +158,14 @@ void delallitems(struct item **list, int *stored)
if (NULL != stored)
{
(*stored) = 0;
- }
+ }
}
void listitems(struct item *mainlist)
{
struct item *item;
int i;
-
+
for (item = mainlist, i = 1; item != NULL; item = item->next, i ++)
{
printf("item #%d (stored at %p).\n", i, (void *)item);
@@ -180,7 +180,7 @@ void listall(struct item *mainlist)
int i;
printf("Listing all:\n");
-
+
for (item = mainlist, i = 1; item != NULL; item = item->next, i ++)
{
printf("%d at %p: %s.\n", i, (void *)item, (char *)item->data);
@@ -203,7 +203,7 @@ int main(void)
char *foo2 = "2";
char *foo3 = "3";
char *foo4 = "4";
-
+
item1 = additem(&mainlist);
if (NULL == item1)
{
@@ -213,7 +213,7 @@ int main(void)
item1->data = foo1;
printf("Current elements:\n");
listall(mainlist);
-
+
item2 = additem(&mainlist);
if (NULL == item2)
{
@@ -221,9 +221,9 @@ int main(void)
exit(1);
}
item2->data = foo2;
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
-
+
item3 = additem(&mainlist);
if (NULL == item3)
{
@@ -231,7 +231,7 @@ int main(void)
exit(1);
}
item3->data = foo3;
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
item4 = additem(&mainlist);
@@ -241,25 +241,25 @@ int main(void)
exit(1);
}
item4->data = foo4;
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
printf("----------------------------------------------------------------------\n");
printf("Moving item3 to be after item2\n");
movetonext(&mainlist, item2, item3);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
printf("----------------------------------------------------------------------\n");
printf("Moving head! item4 to be after item2\n");
movetonext(&mainlist, item2, item4);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
printf("----------------------------------------------------------------------\n");
-
+
printf("Moving tail! item1 to be after item2\n");
movetonext(&mainlist, item2, item1);
printf("Current elements:\n");
@@ -271,7 +271,7 @@ int main(void)
movetonext(&mainlist, item3, item2);
printf("Current elements:\n");
listall(mainlist);
-
+
printf("Moving all the items after each other.\n");
/* item3 is tail. work backwards. */
for (item = mainlist, i = 1;
@@ -285,38 +285,38 @@ int main(void)
listall(mainlist);
}
}
-
+
printf("----------------------------------------------------------------------\n");
-#if 0
+#if 0
movetohead(&mainlist, item2);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
-
+
printf("----------------------------------------------------------------------\n");
#endif
-
+
printf("Deleting item stored at %p\n", item3);
delitem(&mainlist, item3);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
puts("");
-
+
delitem(&mainlist, item2);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
puts("");
-
+
delitem(&mainlist, item1);
- printf("Current elements:\n");
+ printf("Current elements:\n");
listall(mainlist);
puts("");
printf("----------------------------------------------------------------------\n");
-
+
exit(0);
}
#endif
diff --git a/list.h b/list.h
index 7c9a94d..b31c439 100644
--- a/list.h
+++ b/list.h
@@ -19,7 +19,7 @@ struct item *additem(struct item **mainlist);
/*
* Delete item from list mainlist.
- */
+ */
void delitem(struct item **mainlist, struct item *item);
/*
@@ -37,5 +37,5 @@ void delallitems(struct item **list, int *stored);
/*
* Print all items in mainlist on stdout.
- */
+ */
void listitems(struct item *mainlist);
diff --git a/mcwm.c b/mcwm.c
index c99630f..4cd773f 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -128,7 +128,7 @@ typedef enum {
KEY_END,
KEY_PREVSCR,
KEY_NEXTSCR,
- KEY_ICONIFY,
+ KEY_ICONIFY,
KEY_PREVWS,
KEY_NEXTWS,
KEY_MAX
@@ -139,10 +139,10 @@ struct monitor
xcb_randr_output_t id;
char *name;
int16_t x; /* X and Y. */
- int16_t y;
+ int16_t y;
uint16_t width; /* Width in pixels. */
uint16_t height; /* Height in pixels. */
- struct item *item; /* Pointer to our place in output list. */
+ struct item *item; /* Pointer to our place in output list. */
};
struct sizepos
@@ -152,7 +152,7 @@ struct sizepos
uint16_t width;
uint16_t height;
};
-
+
/* Everything we know about a window. */
struct client
{
@@ -184,7 +184,7 @@ struct winconf
uint16_t width;
uint16_t height;
uint8_t stackmode;
- xcb_window_t sibling;
+ xcb_window_t sibling;
uint16_t borderwidth;
};
@@ -259,10 +259,10 @@ struct keys
{ USERKEY_DELETE, 0 },
{ USERKEY_PREVSCREEN, 0 },
{ USERKEY_NEXTSCREEN, 0 },
- { USERKEY_ICONIFY, 0 },
+ { USERKEY_ICONIFY, 0 },
{ USERKEY_PREVWS, 0 },
{ USERKEY_NEXTWS, 0 },
-};
+};
/* All keycodes generating our MODKEY mask. */
struct modkeycodes
@@ -278,13 +278,13 @@ struct modkeycodes
/* Global configuration. */
struct conf
{
- int borderwidth; /* Do we draw borders? If so, how large? */
+ int borderwidth; /* Do we draw borders? If so, how large? */
int snapmargin; /* Do we have snap margin? If so, how large? */
char *terminal; /* Path to terminal to start. */
uint32_t focuscol; /* Focused border colour. */
uint32_t unfocuscol; /* Unfocused border colour. */
uint32_t fixedcol; /* Fixed windows border colour. */
- bool allowicons; /* Allow windows to be unmapped. */
+ bool allowicons; /* Allow windows to be unmapped. */
} conf;
xcb_atom_t atom_desktop; /*
@@ -330,7 +330,7 @@ static struct monitor *findmonitor(xcb_randr_output_t id);
static struct monitor *findclones(xcb_randr_output_t id, int16_t x, int16_t y);
static struct monitor *findmonbycoord(int16_t x, int16_t y);
static void delmonitor(struct monitor *mon);
-static struct monitor *addmonitor(xcb_randr_output_t id, char *name,
+static struct monitor *addmonitor(xcb_randr_output_t id, char *name,
uint32_t x, uint32_t y, uint16_t width,
uint16_t height);
static void raisewindow(xcb_drawable_t win);
@@ -391,13 +391,13 @@ static xcb_atom_t getatom(char *atom_name);
void finishtabbing(void)
{
mode = 0;
-
+
if (NULL != lastfocuswin)
{
movetohead(&wslist[curws], lastfocuswin->wsitem[curws]);
- lastfocuswin = NULL;
+ lastfocuswin = NULL;
}
-
+
movetohead(&wslist[curws], focuswin->wsitem[curws]);
}
@@ -438,7 +438,7 @@ struct modkeycodes getmodkeys(xcb_mod_mask_t modmask)
PDEBUG("Out of memory.\n");
return keycodes;
}
-
+
modmap = xcb_get_modifier_mapping_keycodes(reply);
/*
@@ -468,13 +468,13 @@ struct modkeycodes getmodkeys(xcb_mod_mask_t modmask)
keycodes.len ++;
}
}
-
+
PDEBUG("Got %d keycodes.\n", keycodes.len);
}
}
-
+
free(reply);
-
+
return keycodes;
}
@@ -491,13 +491,13 @@ void cleanup(int code)
XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_CURRENT_TIME);
xcb_flush(conn);
- xcb_disconnect(conn);
+ xcb_disconnect(conn);
exit(code);
}
/*
* Rearrange windows to fit new screen size.
- */
+ */
void arrangewindows(void)
{
struct item *item;
@@ -518,7 +518,7 @@ void arrangewindows(void)
void setwmdesktop(xcb_drawable_t win, uint32_t ws)
{
PDEBUG("Changing _NET_WM_DESKTOP on window %d to %d\n", win, ws);
-
+
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win,
atom_desktop, XCB_ATOM_CARDINAL, 32, 1,
&ws);
@@ -537,7 +537,7 @@ int32_t getwmdesktop(xcb_drawable_t win)
xcb_get_property_cookie_t cookie;
uint32_t *wsp;
uint32_t ws;
-
+
cookie = xcb_get_property(conn, false, win, atom_desktop,
XCB_GET_PROPERTY_TYPE_ANY, 0,
sizeof (int32_t));
@@ -555,13 +555,13 @@ int32_t getwmdesktop(xcb_drawable_t win)
PDEBUG("_NET_WM_DESKTOP reply was 0 length.\n");
goto bad;
}
-
+
wsp = xcb_get_property_value(reply);
ws = *wsp;
PDEBUG("got _NET_WM_DESKTOP: %d stored at %p.\n", ws, (void *)wsp);
-
+
free(reply);
return ws;
@@ -575,7 +575,7 @@ bad:
void addtoworkspace(struct client *client, uint32_t ws)
{
struct item *item;
-
+
item = additem(&wslist[ws]);
if (NULL == item)
{
@@ -591,7 +591,7 @@ void addtoworkspace(struct client *client, uint32_t ws)
/*
* Set window hint property so we can survive a crash.
- *
+ *
* Fixed windows have their own special WM hint. We don't want to
* mess with that.
*/
@@ -615,7 +615,7 @@ void changeworkspace(uint32_t ws)
{
struct item *item;
struct client *client;
-
+
if (ws == curws)
{
PDEBUG("Changing to same workspace!\n");
@@ -633,7 +633,7 @@ void changeworkspace(uint32_t ws)
setunfocus(focuswin->id);
focuswin = NULL;
}
-
+
/* Go through list of current ws. Unmap everything that isn't fixed. */
for (item = wslist[curws]; item != NULL; item = item->next)
{
@@ -652,7 +652,7 @@ void changeworkspace(uint32_t ws)
xcb_unmap_window(conn, client->id);
}
}
-
+
/* Go through list of new ws. Map everything that isn't fixed. */
for (item = wslist[ws]; item != NULL; item = item->next)
{
@@ -681,12 +681,12 @@ void fixwindow(struct client *client, bool setcolour)
{
uint32_t values[1];
uint32_t ws;
-
+
if (NULL == client)
{
return;
}
-
+
if (client->fixed)
{
client->fixed = false;
@@ -717,7 +717,7 @@ void fixwindow(struct client *client, bool setcolour)
* something else.
*/
raisewindow(client->id);
-
+
client->fixed = true;
setwmdesktop(client->id, NET_WM_FIXED);
@@ -739,7 +739,7 @@ void fixwindow(struct client *client, bool setcolour)
}
}
- xcb_flush(conn);
+ xcb_flush(conn);
}
/*
@@ -749,8 +749,8 @@ void fixwindow(struct client *client, bool setcolour)
* */
uint32_t getcolor(const char *colstr)
{
- xcb_alloc_named_color_reply_t *col_reply;
- xcb_colormap_t colormap;
+ xcb_alloc_named_color_reply_t *col_reply;
+ xcb_colormap_t colormap;
xcb_generic_error_t *error;
xcb_alloc_named_color_cookie_t colcookie;
@@ -773,7 +773,7 @@ uint32_t getcolor(const char *colstr)
void forgetclient(struct client *client)
{
uint32_t ws;
-
+
if (NULL == client)
{
PDEBUG("forgetclient: client was NULL\n");
@@ -789,7 +789,7 @@ void forgetclient(struct client *client)
{
if (NULL != client->wsitem[ws])
{
- delfromworkspace(client, ws);
+ delfromworkspace(client, ws);
}
}
@@ -803,7 +803,7 @@ void forgetwin(xcb_window_t win)
struct item *item;
struct client *client;
uint32_t ws;
-
+
/* Find this window in the global window list. */
for (item = winlist; item != NULL; item = item->next)
{
@@ -837,10 +837,10 @@ void forgetwin(xcb_window_t win)
else
{
PDEBUG(" found it here. Deleting!\n");
- delfromworkspace(client, ws);
+ delfromworkspace(client, ws);
}
}
-
+
free(item->data);
delitem(&winlist, item);
@@ -868,7 +868,7 @@ void fitonscreen(struct client *client)
client->maxed = false;
setborders(client, conf.borderwidth);
}
-
+
if (NULL == client->monitor)
{
/*
@@ -886,13 +886,13 @@ void fitonscreen(struct client *client)
mon_x = client->monitor->x;
mon_y = client->monitor->y;
mon_width = client->monitor->width;
- mon_height = client->monitor->height;
+ mon_height = client->monitor->height;
}
PDEBUG("Is window outside monitor?\n");
PDEBUG("x: %d between %d and %d?\n", client->x, mon_x, mon_x + mon_width);
PDEBUG("y: %d between %d and %d?\n", client->y, mon_y, mon_y + mon_height);
-
+
/* Is it outside the physical monitor? */
if (client->x > mon_x + mon_width)
{
@@ -902,9 +902,9 @@ void fitonscreen(struct client *client)
if (client->y > mon_y + mon_height)
{
client->y = mon_y + mon_height - client->height;
- willmove = true;
+ willmove = true;
}
-
+
if (client->x < mon_x)
{
client->x = mon_x;
@@ -915,7 +915,7 @@ void fitonscreen(struct client *client)
client->y = mon_y;
willmove = true;
}
-
+
/* Is it smaller than it wants to be? */
if (0 != client->min_height && client->height < client->min_height)
{
@@ -926,7 +926,7 @@ void fitonscreen(struct client *client)
if (0 != client->min_width && client->width < client->min_width)
{
client->width = client->min_width;
- willresize = true;
+ willresize = true;
}
/*
@@ -993,7 +993,7 @@ void newwin(xcb_window_t win)
*/
return;
}
-
+
/*
* Set up stuff, like borders, add the window to the client list,
* et cetera.
@@ -1015,7 +1015,7 @@ void newwin(xcb_window_t win)
if (!client->usercoord)
{
int16_t pointx;
- int16_t pointy;
+ int16_t pointy;
PDEBUG("Coordinates not set by user. Using pointer: %d,%d.\n",
pointx, pointy);
@@ -1026,7 +1026,7 @@ void newwin(xcb_window_t win)
pointx = 0;
pointy = 0;
}
-
+
client->x = pointx;
client->y = pointy;
@@ -1036,7 +1036,7 @@ void newwin(xcb_window_t win)
{
PDEBUG("User set coordinates.\n");
}
-
+
/* Find the physical output this window will be on if RANDR is active. */
if (-1 != randrbase)
{
@@ -1053,9 +1053,9 @@ void newwin(xcb_window_t win)
}
}
}
-
+
fitonscreen(client);
-
+
/* Show window on screen. */
xcb_map_window(conn, client->id);
@@ -1071,19 +1071,19 @@ void newwin(xcb_window_t win)
xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0,
client->width / 2, client->height / 2);
- xcb_flush(conn);
+ xcb_flush(conn);
}
/* Set border colour, width and event mask for window. */
struct client *setupwin(xcb_window_t win)
{
- uint32_t mask = 0;
+ uint32_t mask = 0;
uint32_t values[2];
struct item *item;
struct client *client;
xcb_size_hints_t hints;
uint32_t ws;
-
+
/* Set default border color. */
values[0] = conf.unfocuscol;
xcb_change_window_attributes(conn, win, XCB_CW_BORDER_PIXEL, values);
@@ -1100,11 +1100,11 @@ struct client *setupwin(xcb_window_t win)
xcb_change_save_set(conn, XCB_SET_MODE_INSERT, win);
xcb_flush(conn);
-
+
/* Remember window and store a few things about it. */
-
+
item = additem(&winlist);
-
+
if (NULL == item)
{
PDEBUG("newwin: Out of memory.\n");
@@ -1119,7 +1119,7 @@ struct client *setupwin(xcb_window_t win)
}
item->data = client;
-
+
/* Initialize client. */
client->id = win;
client->usercoord = false;
@@ -1146,7 +1146,7 @@ struct client *setupwin(xcb_window_t win)
{
client->wsitem[ws] = NULL;
}
-
+
PDEBUG("Adding window %d\n", client->id);
setborders(client, conf.borderwidth);
@@ -1157,7 +1157,7 @@ struct client *setupwin(xcb_window_t win)
{
fprintf(stderr, "Couldn't get geometry in initial setup of window.\n");
}
-
+
/*
* Get the window's incremental size step, if any.
*/
@@ -1182,14 +1182,14 @@ struct client *setupwin(xcb_window_t win)
client->min_width = hints.min_width;
client->min_height = hints.min_height;
}
-
+
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
{
-
+
client->max_width = hints.max_width;
client->max_height = hints.max_height;
}
-
+
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
{
client->width_inc = hints.width_inc;
@@ -1211,7 +1211,7 @@ struct client *setupwin(xcb_window_t win)
/*
* Get a keycode from a keysym.
*
- * Returns keycode value.
+ * Returns keycode value.
*/
xcb_keycode_t keysymtokeycode(xcb_keysym_t keysym, xcb_key_symbols_t *keysyms)
{
@@ -1229,20 +1229,20 @@ xcb_keycode_t keysymtokeycode(xcb_keysym_t keysym, xcb_key_symbols_t *keysyms)
key = *keyp;
free(keyp);
-
+
return key;
}
/*
* Set up all shortcut keys.
*
- * Returns 0 on success, non-zero otherwise.
+ * Returns 0 on success, non-zero otherwise.
*/
int setupkeys(void)
{
xcb_key_symbols_t *keysyms;
unsigned i;
-
+
/* Get all the keysymbols. */
keysyms = xcb_key_symbols_alloc(conn);
@@ -1271,9 +1271,9 @@ int setupkeys(void)
*/
xcb_grab_key(conn, 1, screen->root, XCB_MOD_MASK_ANY,
modkeys.keycodes[i],
- XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
+ XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
}
-
+
/* Now grab the rest of the keys with the MODKEY modifier. */
for (i = KEY_F; i < KEY_MAX; i ++)
{
@@ -1283,17 +1283,17 @@ int setupkeys(void)
continue;
}
- keys[i].keycode = keysymtokeycode(keys[i].keysym, keysyms);
+ keys[i].keycode = keysymtokeycode(keys[i].keysym, keysyms);
if (0 == keys[i].keycode)
{
/* Couldn't set up keys! */
-
+
/* Get rid of key symbols. */
xcb_key_symbols_free(keysyms);
return -1;
}
-
+
/* Grab other keys with a modifier mask. */
xcb_grab_key(conn, 1, screen->root, MODKEY, keys[i].keycode,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
@@ -1309,17 +1309,17 @@ int setupkeys(void)
/* Need this to take effect NOW! */
xcb_flush(conn);
-
+
/* Get rid of the key symbols table. */
xcb_key_symbols_free(keysyms);
-
+
return 0;
}
/*
* Walk through all existing windows and set them up.
*
- * Returns 0 on success.
+ * Returns 0 on success.
*/
int setupscreen(void)
{
@@ -1331,7 +1331,7 @@ int setupscreen(void)
xcb_get_window_attributes_reply_t *attr;
struct client *client;
uint32_t ws;
-
+
/* Get all children. */
reply = xcb_query_tree_reply(conn,
xcb_query_tree(conn, screen->root), 0);
@@ -1340,9 +1340,9 @@ int setupscreen(void)
return -1;
}
- len = xcb_query_tree_children_length(reply);
+ len = xcb_query_tree_children_length(reply);
children = xcb_query_tree_children(reply);
-
+
/* Set up all windows on this root. */
for (i = 0; i < len; i ++)
{
@@ -1364,8 +1364,8 @@ int setupscreen(void)
* with a MapRequest if we had been running, so in the
* normal case we wouldn't have seen them.
*
- * Only handle visible windows.
- */
+ * Only handle visible windows.
+ */
if (!attr->override_redirect
&& attr->map_state == XCB_MAP_STATE_VIEWABLE)
{
@@ -1393,10 +1393,10 @@ int setupscreen(void)
}
#endif
}
-
+
/* Fit window on physical screen. */
fitonscreen(client);
-
+
/*
* Check if this window has a workspace set already as
* a WM hint.
@@ -1407,7 +1407,7 @@ int setupscreen(void)
if (ws == NET_WM_FIXED)
{
/* Add to current workspace. */
- addtoworkspace(client, curws);
+ addtoworkspace(client, curws);
/* Add to all other workspaces. */
fixwindow(client, false);
}
@@ -1430,12 +1430,12 @@ int setupscreen(void)
}
}
}
-
+
free(attr);
}
changeworkspace(0);
-
+
/*
* Get pointer position so we can set focus on any window which
* might be under it.
@@ -1452,11 +1452,11 @@ int setupscreen(void)
setfocus(findclient(pointer->child));
free(pointer);
}
-
+
xcb_flush(conn);
-
+
free(reply);
-
+
return 0;
}
@@ -1468,7 +1468,7 @@ int setuprandr(void)
{
const xcb_query_extension_reply_t *extension;
int base;
-
+
extension = xcb_get_extension_data(conn, &xcb_randr_id);
if (!extension->present)
{
@@ -1482,7 +1482,7 @@ int setuprandr(void)
base = extension->first_event;
PDEBUG("randrbase is %d.\n", base);
-
+
xcb_randr_select_input(conn, screen->root,
XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE |
XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE |
@@ -1496,15 +1496,15 @@ int setuprandr(void)
/*
* Get RANDR resources and figure out how many outputs there are.
- */
+ */
void getrandr(void)
{
xcb_randr_get_screen_resources_current_cookie_t rcookie;
xcb_randr_get_screen_resources_current_reply_t *res;
xcb_randr_output_t *outputs;
- int len;
+ int len;
xcb_timestamp_t timestamp;
-
+
rcookie = xcb_randr_get_screen_resources_current(conn, screen->root);
res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL);
if (NULL == res)
@@ -1518,7 +1518,7 @@ void getrandr(void)
outputs = xcb_randr_get_screen_resources_current_outputs(res);
PDEBUG("Found %d outputs.\n", len);
-
+
/* Request information for all outputs. */
getoutputs(outputs, len, timestamp);
@@ -1539,7 +1539,7 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
struct monitor *clonemon;
xcb_randr_get_output_info_cookie_t ocookie[len];
int i;
-
+
for (i = 0; i < len; i++)
{
ocookie[i] = xcb_randr_get_output_info(conn, outputs[i], timestamp);
@@ -1549,7 +1549,7 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
for (i = 0; i < len; i ++)
{
output = xcb_randr_get_output_info_reply(conn, ocookie[i], NULL);
-
+
if (output == NULL)
{
continue;
@@ -1571,7 +1571,7 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
{
return;
}
-
+
PDEBUG("CRTC: at %d, %d, size: %d x %d.\n", crtc->x, crtc->y,
crtc->width, crtc->height);
@@ -1595,7 +1595,7 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
else
{
bool changed = false;
-
+
/*
* We know this monitor. Update information. If it's
* smaller than before, rearrange windows.
@@ -1615,15 +1615,15 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
if (crtc->width != mon->width)
{
- mon->width = crtc->width;
+ mon->width = crtc->width;
changed = true;
}
if (crtc->height != mon->height)
{
- mon->height = crtc->height;
+ mon->height = crtc->height;
changed = true;
}
-
+
if (changed)
{
arrbymon(mon);
@@ -1675,7 +1675,7 @@ void getoutputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
fitonscreen(client);
}
}
-
+
/* It's not active anymore. Forget about it. */
delmonitor(mon);
}
@@ -1728,7 +1728,7 @@ struct monitor *findmonitor(xcb_randr_output_t id)
return NULL;
}
-struct monitor *findclones(xcb_randr_output_t id, int16_t x, int16_t y)
+struct monitor *findclones(xcb_randr_output_t id, int16_t x, int16_t y)
{
struct monitor *clonemon;
struct item *item;
@@ -1767,7 +1767,7 @@ struct monitor *findmonbycoord(int16_t x, int16_t y)
mon->y, mon->y + mon->height);
PDEBUG("Is %d,%d between them?\n", x, y);
-
+
if (x >= mon->x && x <= mon->x + mon->width
&& y >= mon->y && y <= mon->y + mon->height)
{
@@ -1787,13 +1787,13 @@ void delmonitor(struct monitor *mon)
freeitem(&monlist, NULL, mon->item);
}
-struct monitor *addmonitor(xcb_randr_output_t id, char *name,
+struct monitor *addmonitor(xcb_randr_output_t id, char *name,
uint32_t x, uint32_t y, uint16_t width,
uint16_t height)
{
struct item *item;
struct monitor *mon;
-
+
if (NULL == (item = additem(&monlist)))
{
fprintf(stderr, "Out of memory.\n");
@@ -1804,11 +1804,11 @@ struct monitor *addmonitor(xcb_randr_output_t id, char *name,
if (NULL == mon)
{
fprintf(stderr, "Out of memory.\n");
- return NULL;
+ return NULL;
}
item->data = mon;
-
+
mon->id = id;
mon->name = name;
mon->x = x;
@@ -1829,7 +1829,7 @@ void raisewindow(xcb_drawable_t win)
{
return;
}
-
+
xcb_configure_window(conn, win,
XCB_CONFIG_WINDOW_STACK_MODE,
values);
@@ -1844,14 +1844,14 @@ void raiseorlower(struct client *client)
{
uint32_t values[] = { XCB_STACK_MODE_OPPOSITE };
xcb_drawable_t win;
-
+
if (NULL == client)
{
return;
}
win = client->id;
-
+
xcb_configure_window(conn, win,
XCB_CONFIG_WINDOW_STACK_MODE,
values);
@@ -1864,7 +1864,7 @@ void movelim(struct client *client)
int16_t mon_y;
uint16_t mon_width;
uint16_t mon_height;
-
+
if (NULL == client->monitor)
{
mon_x = 0;
@@ -1877,7 +1877,7 @@ void movelim(struct client *client)
mon_x = client->monitor->x;
mon_y = client->monitor->y;
mon_width = client->monitor->width;
- mon_height = client->monitor->height;
+ mon_height = client->monitor->height;
}
/* Is it outside the physical monitor? */
@@ -1899,7 +1899,7 @@ void movelim(struct client *client)
{
client->y = (mon_y + mon_height - conf.borderwidth * 2)
- client->height;
- }
+ }
movewindow(client->id, client->x, client->y);
}
@@ -1914,13 +1914,13 @@ void movewindow(xcb_drawable_t win, uint16_t x, uint16_t y)
/* Can't move root. */
return;
}
-
+
values[0] = x;
values[1] = y;
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y, values);
-
+
xcb_flush(conn);
}
@@ -1928,7 +1928,7 @@ void movewindow(xcb_drawable_t win, uint16_t x, uint16_t y)
void focusnext(bool reverse)
{
struct client *client = NULL;
-
+
#if DEBUG
if (NULL != focuswin)
{
@@ -1941,20 +1941,20 @@ void focusnext(bool reverse)
PDEBUG("No windows to focus on in this workspace.\n");
return;
}
-
+
if (MCWM_TABBING != mode)
{
/*
* Remember what we last focused on. We need this when the
* MODKEY is released and we move the last focused window in
* the tabbing order list.
- */
+ */
lastfocuswin = focuswin;
mode = MCWM_TABBING;
- PDEBUG("Began tabbing.\n");
+ PDEBUG("Began tabbing.\n");
}
-
+
/* If we currently have no focus focus first in list. */
if (NULL == focuswin || NULL == focuswin->wsitem[curws])
{
@@ -2014,7 +2014,7 @@ void focusnext(bool reverse)
{
/* Otherwise, focus the next in list. */
PDEBUG("Tabbing. Focusing next: %p.\n",
- focuswin->wsitem[curws]->next);
+ focuswin->wsitem[curws]->next);
client = focuswin->wsitem[curws]->next->data;
}
}
@@ -2026,7 +2026,7 @@ void focusnext(bool reverse)
* Raise window if it's occluded, then warp pointer into it and
* set keyboard focus to it.
*/
- uint32_t values[] = { XCB_STACK_MODE_TOP_IF };
+ uint32_t values[] = { XCB_STACK_MODE_TOP_IF };
xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_STACK_MODE,
values);
@@ -2045,7 +2045,7 @@ void setunfocus(xcb_drawable_t win)
{
return;
}
-
+
if (focuswin->id == screen->root)
{
return;
@@ -2102,10 +2102,10 @@ void setfocus(struct client *client)
xcb_set_input_focus(conn, XCB_NONE, XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_CURRENT_TIME);
xcb_flush(conn);
-
+
return;
}
-
+
/*
* Don't bother focusing on the root window or on the same window
* that already has focus.
@@ -2118,7 +2118,7 @@ void setfocus(struct client *client)
/* Set new border colour. */
if (client->fixed)
{
- values[0] = conf.fixedcol;
+ values[0] = conf.fixedcol;
}
else
{
@@ -2140,7 +2140,7 @@ void setfocus(struct client *client)
XCB_CURRENT_TIME);
xcb_flush(conn);
-
+
/* Remember the new window as the current focused window. */
focuswin = client;
}
@@ -2148,7 +2148,7 @@ void setfocus(struct client *client)
int start(char *program)
{
pid_t pid;
-
+
pid = fork();
if (-1 == pid)
{
@@ -2160,7 +2160,7 @@ int start(char *program)
char *argv[2];
/* In the child. */
-
+
/*
* Make this process a new process leader, otherwise the
* terminal will die when the wm dies. Also, this makes any
@@ -2171,13 +2171,13 @@ int start(char *program)
perror("setsid");
exit(1);
}
-
+
argv[0] = program;
argv[1] = NULL;
if (-1 == execvp(program, argv))
{
- perror("execve");
+ perror("execve");
exit(1);
}
exit(0);
@@ -2193,7 +2193,7 @@ void resizelim(struct client *client)
int16_t mon_y;
uint16_t mon_width;
uint16_t mon_height;
-
+
if (NULL == client->monitor)
{
mon_x = 0;
@@ -2206,9 +2206,9 @@ void resizelim(struct client *client)
mon_x = client->monitor->x;
mon_y = client->monitor->y;
mon_width = client->monitor->width;
- mon_height = client->monitor->height;
+ mon_height = client->monitor->height;
}
-
+
/* Is it smaller than it wants to be? */
if (0 != client->min_height && client->height < client->min_height)
{
@@ -2225,13 +2225,13 @@ void resizelim(struct client *client)
client->width = mon_width - ((client->x - mon_x) + conf.borderwidth
* 2);
}
-
+
if (client->y + client->height + conf.borderwidth * 2 > mon_y + mon_height)
{
client->height = mon_height - ((client->y - mon_y) + conf.borderwidth
* 2);
}
-
+
resize(client->id, client->width, client->height);
}
@@ -2239,7 +2239,7 @@ void moveresize(xcb_drawable_t win, uint16_t x, uint16_t y,
uint16_t width, uint16_t height)
{
uint32_t values[4];
-
+
if (screen->root == win || 0 == win)
{
/* Can't move or resize root. */
@@ -2252,7 +2252,7 @@ void moveresize(xcb_drawable_t win, uint16_t x, uint16_t y,
values[1] = y;
values[2] = width;
values[3] = height;
-
+
xcb_configure_window(conn, win,
XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
@@ -2273,10 +2273,10 @@ void resize(xcb_drawable_t win, uint16_t width, uint16_t height)
}
PDEBUG("Resizing to %d x %d.\n", width, height);
-
+
values[0] = width;
values[1] = height;
-
+
xcb_configure_window(conn, win,
XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT, values);
@@ -2298,7 +2298,7 @@ void resizestep(struct client *client, char direction)
{
int step_x = MOVE_STEP;
int step_y = MOVE_STEP;
-
+
if (NULL == client)
{
return;
@@ -2309,9 +2309,9 @@ void resizestep(struct client *client, char direction)
/* Can't resize a fully maximized window. */
return;
}
-
+
raisewindow(client->id);
-
+
if (client->width_inc > 1)
{
step_x = client->width_inc;
@@ -2327,7 +2327,7 @@ void resizestep(struct client *client, char direction)
}
else
{
- step_y = MOVE_STEP;
+ step_y = MOVE_STEP;
}
switch (direction)
@@ -2352,9 +2352,9 @@ void resizestep(struct client *client, char direction)
PDEBUG("resizestep in unknown direction.\n");
break;
} /* switch direction */
-
+
resizelim(client);
-
+
/* If this window was vertically maximized, remember that it isn't now. */
if (client->vertmaxed)
{
@@ -2531,18 +2531,18 @@ void mouseresize(struct client *client, int rel_x, int rel_y)
client->width -= (client->width - client->base_width) % client->width_inc;
client->height -= (client->height - client->base_height)
% client->height_inc;
-
+
PDEBUG("Trying to resize to %dx%d (%dx%d)\n", client->width, client->height,
(client->width - client->base_width) / client->width_inc,
(client->height - client->base_height) / client->height_inc);
if (conf.snapmargin > 0)
- {
+ {
snapwindow(client, MCWM_RESIZE);
}
-
+
resizelim(client);
-
+
/* If this window was vertically maximized, remember that it isn't now. */
if (client->vertmaxed)
{
@@ -2554,7 +2554,7 @@ void movestep(struct client *client, char direction)
{
int16_t start_x;
int16_t start_y;
-
+
if (NULL == client)
{
return;
@@ -2595,9 +2595,9 @@ void movestep(struct client *client, char direction)
PDEBUG("movestep: Moving in unknown direction.\n");
break;
} /* switch direction */
-
+
movelim(client);
-
+
/*
* If the pointer was inside the window to begin with, move
* pointer back to where it was, relative to the window.
@@ -2608,7 +2608,7 @@ void movestep(struct client *client, char direction)
{
xcb_warp_pointer(conn, XCB_NONE, client->id, 0, 0, 0, 0,
start_x, start_y);
- xcb_flush(conn);
+ xcb_flush(conn);
}
}
@@ -2616,7 +2616,7 @@ void setborders(struct client *client, int width)
{
uint32_t values[1];
uint32_t mask = 0;
-
+
values[0] = width;
mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
@@ -2639,7 +2639,7 @@ void unmax(struct client *client)
client->y = client->origsize.y;
client->width = client->origsize.width;
client->height = client->origsize.height;
-
+
/* Restore geometry. */
if (client->maxed)
{
@@ -2650,7 +2650,7 @@ void unmax(struct client *client)
/* Set borders again. */
values[4] = conf.borderwidth;
-
+
mask =
XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
@@ -2686,7 +2686,7 @@ void maximize(struct client *client)
int16_t mon_y;
uint16_t mon_width;
uint16_t mon_height;
-
+
if (NULL == client)
{
PDEBUG("maximize: client was NULL!\n");
@@ -2705,7 +2705,7 @@ void maximize(struct client *client)
mon_x = client->monitor->x;
mon_y = client->monitor->y;
mon_width = client->monitor->width;
- mon_height = client->monitor->height;
+ mon_height = client->monitor->height;
}
/*
@@ -2721,24 +2721,24 @@ void maximize(struct client *client)
/* Raise first. Pretty silly to maximize below something else. */
raisewindow(client->id);
-
+
/* FIXME: Store original geom in property as well? */
client->origsize.x = client->x;
client->origsize.y = client->y;
client->origsize.width = client->width;
client->origsize.height = client->height;
-
+
/* Remove borders. */
values[0] = 0;
mask = XCB_CONFIG_WINDOW_BORDER_WIDTH;
xcb_configure_window(conn, client->id, mask, values);
-
+
/* Move to top left and resize. */
client->x = mon_x;
client->y = mon_y;
client->width = mon_width;
client->height = mon_height;
-
+
values[0] = client->x;
values[1] = client->y;
values[2] = client->width;
@@ -2758,7 +2758,7 @@ void maxvert(struct client *client)
uint32_t values[2];
int16_t mon_y;
uint16_t mon_height;
-
+
if (NULL == client)
{
PDEBUG("maxvert: client was NULL\n");
@@ -2773,7 +2773,7 @@ void maxvert(struct client *client)
else
{
mon_y = client->monitor->y;
- mon_height = client->monitor->height;
+ mon_height = client->monitor->height;
}
/*
@@ -2788,7 +2788,7 @@ void maxvert(struct client *client)
/* Raise first. Pretty silly to maximize below something else. */
raisewindow(client->id);
-
+
/*
* Store original coordinates and geometry.
* FIXME: Store in property as well?
@@ -2807,13 +2807,13 @@ void maxvert(struct client *client)
/* Move to top of screen and resize. */
values[0] = client->y;
values[1] = client->height;
-
+
xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_HEIGHT, values);
xcb_flush(conn);
/* Remember that this client is vertically maximized. */
- client->vertmaxed = true;
+ client->vertmaxed = true;
}
void hide(struct client *client)
@@ -2822,20 +2822,20 @@ void hide(struct client *client)
/*
* Unmap window and declare iconic.
- *
+ *
* Unmapping will generate an 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);
+ 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;
-
+
pointer
= xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win), 0);
if (NULL == pointer)
@@ -2855,7 +2855,7 @@ bool getgeom(xcb_drawable_t win, int16_t *x, int16_t *y, uint16_t *width,
uint16_t *height)
{
xcb_get_geometry_reply_t *geom;
-
+
geom
= xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL);
if (NULL == geom)
@@ -2867,7 +2867,7 @@ bool getgeom(xcb_drawable_t win, int16_t *x, int16_t *y, uint16_t *width,
*y = geom->y;
*width = geom->width;
*height = geom->height;
-
+
free(geom);
return true;
@@ -2879,7 +2879,7 @@ void topleft(void)
int16_t pointy;
int16_t mon_x;
int16_t mon_y;
-
+
if (NULL == focuswin)
{
return;
@@ -2893,11 +2893,11 @@ void topleft(void)
else
{
mon_x = focuswin->monitor->x;
- mon_y = focuswin->monitor->y;
+ mon_y = focuswin->monitor->y;
}
-
+
raisewindow(focuswin->id);
-
+
if (!getpointer(focuswin->id, &pointx, &pointy))
{
return;
@@ -2915,10 +2915,10 @@ void topright(void)
{
int16_t pointx;
int16_t pointy;
- int16_t mon_x;
- uint16_t mon_y;
+ int16_t mon_x;
+ uint16_t mon_y;
uint16_t mon_width;
-
+
if (NULL == focuswin)
{
return;
@@ -2933,22 +2933,22 @@ void topright(void)
else
{
mon_width = focuswin->monitor->width;
- mon_x = focuswin->monitor->x;
+ mon_x = focuswin->monitor->x;
mon_y = focuswin->monitor->y;
}
raisewindow(focuswin->id);
-
+
if (!getpointer(focuswin->id, &pointx, &pointy))
{
return;
}
focuswin->x = mon_x + mon_width -
- (focuswin->width + conf.borderwidth * 2);
+ (focuswin->width + conf.borderwidth * 2);
focuswin->y = mon_y;
-
+
movewindow(focuswin->id, focuswin->x, focuswin->y);
xcb_warp_pointer(conn, XCB_NONE, focuswin->id, 0, 0, 0, 0,
@@ -2963,7 +2963,7 @@ void botleft(void)
int16_t mon_x;
int16_t mon_y;
uint16_t mon_height;
-
+
if (NULL == focuswin)
{
return;
@@ -2981,9 +2981,9 @@ void botleft(void)
mon_y = focuswin->monitor->y;
mon_height = focuswin->monitor->height;
}
-
+
raisewindow(focuswin->id);
-
+
if (!getpointer(focuswin->id, &pointx, &pointy))
{
return;
@@ -3016,7 +3016,7 @@ void botright(void)
{
mon_x = 0;
mon_y = 0;
- mon_width = screen->width_in_pixels;;
+ mon_width = screen->width_in_pixels;;
mon_height = screen->height_in_pixels;
}
else
@@ -3028,7 +3028,7 @@ void botright(void)
}
raisewindow(focuswin->id);
-
+
if (!getpointer(focuswin->id, &pointx, &pointy))
{
return;
@@ -3090,13 +3090,13 @@ void deletewin(void)
xcb_kill_client(conn, focuswin->id);
}
- xcb_flush(conn);
+ xcb_flush(conn);
}
void prevscreen(void)
{
struct item *item;
-
+
if (NULL == focuswin || NULL == focuswin->monitor)
{
return;
@@ -3108,22 +3108,22 @@ void prevscreen(void)
{
return;
}
-
+
focuswin->monitor = item->data;
- raisewindow(focuswin->id);
+ raisewindow(focuswin->id);
fitonscreen(focuswin);
movelim(focuswin);
xcb_warp_pointer(conn, XCB_NONE, focuswin->id, 0, 0, 0, 0,
0, 0);
- xcb_flush(conn);
+ xcb_flush(conn);
}
void nextscreen(void)
{
struct item *item;
-
+
if (NULL == focuswin || NULL == focuswin->monitor)
{
return;
@@ -3135,23 +3135,23 @@ void nextscreen(void)
{
return;
}
-
+
focuswin->monitor = item->data;
- raisewindow(focuswin->id);
+ raisewindow(focuswin->id);
fitonscreen(focuswin);
movelim(focuswin);
xcb_warp_pointer(conn, XCB_NONE, focuswin->id, 0, 0, 0, 0,
0, 0);
- xcb_flush(conn);
+ xcb_flush(conn);
}
void handle_keypress(xcb_key_press_event_t *ev)
{
int i;
key_enum_t key;
-
+
for (key = KEY_MAX, i = KEY_F; i < KEY_MAX; i ++)
{
if (ev->detail == keys[i].keycode && 0 != keys[i].keycode)
@@ -3179,7 +3179,7 @@ void handle_keypress(xcb_key_press_event_t *ev)
/* First finish tabbing around. Then deal with the next key. */
finishtabbing();
}
-
+
/* Is it shifted? */
if (ev->state & SHIFTMOD)
{
@@ -3221,7 +3221,7 @@ void handle_keypress(xcb_key_press_event_t *ev)
case KEY_F: /* f */
fixwindow(focuswin, true);
break;
-
+
case KEY_H: /* h */
movestep(focuswin, 'h');
break;
@@ -3253,7 +3253,7 @@ void handle_keypress(xcb_key_press_event_t *ev)
case KEY_R: /* r*/
raiseorlower(focuswin);
break;
-
+
case KEY_X: /* x */
maximize(focuswin);
break;
@@ -3261,41 +3261,41 @@ void handle_keypress(xcb_key_press_event_t *ev)
case KEY_1:
changeworkspace(0);
break;
-
+
case KEY_2:
- changeworkspace(1);
+ changeworkspace(1);
break;
case KEY_3:
- changeworkspace(2);
+ changeworkspace(2);
break;
case KEY_4:
- changeworkspace(3);
+ changeworkspace(3);
break;
case KEY_5:
- changeworkspace(4);
+ changeworkspace(4);
break;
case KEY_6:
- changeworkspace(5);
+ changeworkspace(5);
break;
case KEY_7:
- changeworkspace(6);
+ changeworkspace(6);
break;
case KEY_8:
- changeworkspace(7);
+ changeworkspace(7);
break;
case KEY_9:
- changeworkspace(8);
+ changeworkspace(8);
break;
case KEY_0:
- changeworkspace(9);
+ changeworkspace(9);
break;
case KEY_Y:
@@ -3323,7 +3323,7 @@ void handle_keypress(xcb_key_press_event_t *ev)
break;
case KEY_NEXTSCR:
- nextscreen();
+ nextscreen();
break;
case KEY_ICONIFY:
@@ -3350,7 +3350,7 @@ void handle_keypress(xcb_key_press_event_t *ev)
default:
/* Ignore other keys. */
- break;
+ break;
} /* switch unshifted */
}
} /* handle_keypress() */
@@ -3360,7 +3360,7 @@ void configwin(xcb_window_t win, uint16_t mask, struct winconf wc)
{
uint32_t values[7];
int i = -1;
-
+
if (mask & XCB_CONFIG_WINDOW_X)
{
mask |= XCB_CONFIG_WINDOW_X;
@@ -3393,7 +3393,7 @@ void configwin(xcb_window_t win, uint16_t mask, struct winconf wc)
{
mask |= XCB_CONFIG_WINDOW_SIBLING;
i ++;
- values[i] = wc.sibling;
+ values[i] = wc.sibling;
}
if (mask & XCB_CONFIG_WINDOW_STACK_MODE)
@@ -3407,7 +3407,7 @@ void configwin(xcb_window_t win, uint16_t mask, struct winconf wc)
{
xcb_configure_window(conn, win, mask, values);
xcb_flush(conn);
- }
+ }
}
void configurerequest(xcb_configure_request_event_t *e)
@@ -3449,7 +3449,7 @@ void configurerequest(xcb_configure_request_event_t *e)
* Code here if we ever change our minds or if you, dear user,
* wants this functionality.
*/
-
+
if (e->value_mask & XCB_CONFIG_WINDOW_X)
{
/* Don't move window if maximized. Don't move off the screen. */
@@ -3471,7 +3471,7 @@ void configurerequest(xcb_configure_request_event_t *e)
}
}
#endif
-
+
if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH)
{
/* Don't resize if maximized. */
@@ -3483,7 +3483,7 @@ void configurerequest(xcb_configure_request_event_t *e)
if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
{
- /* Don't resize if maximized. */
+ /* Don't resize if maximized. */
if (!client->maxed && !client->vertmaxed)
{
client->height = e->height;
@@ -3503,13 +3503,13 @@ void configurerequest(xcb_configure_request_event_t *e)
XCB_CONFIG_WINDOW_SIBLING,
values);
xcb_flush(conn);
-
+
}
if (e->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
{
uint32_t values[1];
-
+
values[0] = e->stack_mode;
xcb_configure_window(conn, e->window,
XCB_CONFIG_WINDOW_STACK_MODE,
@@ -3537,9 +3537,9 @@ void configurerequest(xcb_configure_request_event_t *e)
{
client->x = mon_x;
client->width = mon_width - 2 * conf.borderwidth;
- }
+ }
}
-
+
if (client->y + client->height + 2 * conf.borderwidth
> mon_y + mon_height)
{
@@ -3561,7 +3561,7 @@ void configurerequest(xcb_configure_request_event_t *e)
client->height = mon_height - 2 * conf.borderwidth;
}
}
-
+
moveresize(client->id, client->x, client->y, client->width,
client->height);
}
@@ -3662,7 +3662,7 @@ void events(void)
#endif
/* Note that we ignore XCB_RANDR_NOTIFY. */
- if (ev->response_type
+ if (ev->response_type
== randrbase + XCB_RANDR_SCREEN_CHANGE_NOTIFY)
{
PDEBUG("RANDR screen change notify. Checking outputs.\n");
@@ -3670,7 +3670,7 @@ void events(void)
free(ev);
continue;
}
-
+
switch (ev->response_type & ~0x80)
{
case XCB_MAP_REQUEST:
@@ -3682,7 +3682,7 @@ void events(void)
newwin(e->window);
}
break;
-
+
case XCB_DESTROY_NOTIFY:
{
xcb_destroy_notify_event_t *e;
@@ -3710,7 +3710,7 @@ void events(void)
lastfocuswin = NULL;
}
}
-
+
/*
* Find this window in list of clients and forget about
* it.
@@ -3718,7 +3718,7 @@ void events(void)
forgetwin(e->window);
}
break;
-
+
case XCB_BUTTON_PRESS:
{
xcb_button_press_event_t *e;
@@ -3740,7 +3740,7 @@ void events(void)
break;
case 2: /* Middle mouse button. */
- start(MOUSE2);
+ start(MOUSE2);
break;
case 3: /* Mouse button three. */
@@ -3754,7 +3754,7 @@ void events(void)
/* Break out of event switch. */
break;
}
-
+
/*
* If we don't have any currently focused window, we can't
* do anything. We don't want to do anything if the mouse
@@ -3796,7 +3796,7 @@ void events(void)
/* Raise window. */
raisewindow(focuswin->id);
-
+
/* Mouse button 1 was pressed. */
if (1 == e->detail)
{
@@ -3807,7 +3807,7 @@ void events(void)
* starting move.
*/
xcb_warp_pointer(conn, XCB_NONE, focuswin->id, 0, 0, 0, 0,
- 1, 1);
+ 1, 1);
}
else
{
@@ -3874,7 +3874,7 @@ void events(void)
PDEBUG("Couldn't get pointer position.\n");
break;
}
-
+
/*
* Our pointer is moving and since we even get this event
* we're either resizing or moving a window.
@@ -3892,9 +3892,9 @@ void events(void)
PDEBUG("Motion event when we're not moving our resizing!\n");
}
- free(pointer);
+ free(pointer);
}
-
+
break;
case XCB_BUTTON_RELEASE:
@@ -3912,7 +3912,7 @@ void events(void)
{
int16_t x;
int16_t y;
-
+
/* We're finished moving or resizing. */
if (NULL == focuswin)
@@ -3923,14 +3923,14 @@ void events(void)
*/
PDEBUG("No focused window when finished moving or "
"resizing!");
-
+
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
xcb_flush(conn); /* Important! */
-
+
mode = 0;
break;
}
-
+
/*
* We will get an EnterNotify and focus another window
* if the pointer just happens to be on top of another
@@ -3948,7 +3948,7 @@ void events(void)
{
x = 1;
}
-
+
}
else
{
@@ -3972,16 +3972,16 @@ void events(void)
x, y);
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
xcb_flush(conn); /* Important! */
-
+
mode = 0;
PDEBUG("mode now = %d\n", mode);
}
break;
-
+
case XCB_KEY_PRESS:
{
xcb_key_press_event_t *e = (xcb_key_press_event_t *)ev;
-
+
PDEBUG("Key %d pressed\n", e->detail);
handle_keypress(e);
@@ -3992,7 +3992,7 @@ void events(void)
{
xcb_key_release_event_t *e = (xcb_key_release_event_t *)ev;
unsigned i;
-
+
PDEBUG("Key %d released.\n", e->detail);
if (MCWM_TABBING == mode)
@@ -4004,7 +4004,7 @@ void events(void)
for (i = 0; i < modkeys.len; i ++)
{
PDEBUG("Is it %d?\n", modkeys.keycodes[i]);
-
+
if (e->detail == modkeys.keycodes[i])
{
finishtabbing();
@@ -4016,12 +4016,12 @@ void events(void)
}
}
break;
-
+
case XCB_ENTER_NOTIFY:
{
xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *)ev;
struct client *client;
-
+
PDEBUG("event: Enter notify eventwin %d, child %d, detail %d.\n",
e->event,
e->child,
@@ -4035,7 +4035,7 @@ void events(void)
* some reason presses a button on the root and then moves
* the pointer to our window and releases the button, we
* get an Ungrab EnterNotify.
- *
+ *
* The other cases means the pointer is grabbed and that
* either means someone is using it for menu selections or
* that we're moving or resizing. We don't want to change
@@ -4074,7 +4074,7 @@ void events(void)
{
movetohead(&wslist[curws],
focuswin->wsitem[curws]);
- lastfocuswin = NULL;
+ lastfocuswin = NULL;
}
movetohead(&wslist[curws], client->wsitem[curws]);
@@ -4086,13 +4086,13 @@ void events(void)
}
}
- break;
-
+ break;
+
case XCB_CONFIGURE_NOTIFY:
{
xcb_configure_notify_event_t *e
= (xcb_configure_notify_event_t *)ev;
-
+
if (e->window == screen->root)
{
/*
@@ -4136,7 +4136,7 @@ void events(void)
}
}
break;
-
+
case XCB_CONFIGURE_REQUEST:
configurerequest((xcb_configure_request_event_t *) ev);
break;
@@ -4155,7 +4155,7 @@ void events(void)
long data[] = { XCB_ICCCM_WM_STATE_ICONIC, XCB_NONE };
/* Unmap window and declare iconic. */
-
+
xcb_unmap_window(conn, e->window);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, e->window,
wm_state, wm_state, 32, 2, data);
@@ -4201,7 +4201,7 @@ void events(void)
{
break;
}
-
+
/* Forget old key bindings. */
xcb_ungrab_key(conn, XCB_GRAB_ANY, screen->root, XCB_MOD_MASK_ANY);
@@ -4209,7 +4209,7 @@ void events(void)
setupkeys();
}
break;
-
+
case XCB_UNMAP_NOTIFY:
{
xcb_unmap_notify_event_t *e =
@@ -4237,7 +4237,7 @@ void events(void)
for (item = wslist[curws]; item != NULL; item = item->next)
{
client = item->data;
-
+
if (client->id == e->window)
{
PDEBUG("Forgetting about %d\n", e->window);
@@ -4248,12 +4248,12 @@ void events(void)
forgetclient(client);
/* We're finished. Break out of for loop. */
- break;
+ break;
}
}
- }
+ }
break;
-
+
}
/* Forget about this event. */
@@ -4271,7 +4271,7 @@ void printhelp(void)
printf(" -f colour sets colour for focused window borders of focused "
"to a named color.\n");
printf(" -u colour sets colour for unfocused window borders.\n");
- printf(" -x color sets colour for fixed window borders.\n");
+ printf(" -x color sets colour for fixed window borders.\n");
}
void sigcatch(int sig)
@@ -4281,13 +4281,13 @@ void sigcatch(int sig)
/*
* Get a defined atom from the X server.
- */
+ */
xcb_atom_t getatom(char *atom_name)
{
xcb_intern_atom_cookie_t atom_cookie;
xcb_atom_t atom;
xcb_intern_atom_reply_t *rep;
-
+
atom_cookie = xcb_intern_atom(conn, 0, strlen(atom_name), atom_name);
rep = xcb_intern_atom_reply(conn, atom_cookie, NULL);
if (NULL != rep)
@@ -4314,10 +4314,10 @@ int main(int argc, char **argv)
xcb_drawable_t root;
char *focuscol;
char *unfocuscol;
- char *fixedcol;
+ char *fixedcol;
int scrno;
xcb_screen_iterator_t iter;
-
+
/* Install signal handlers. */
/* We ignore child exists. Don't create zombies. */
@@ -4338,9 +4338,9 @@ int main(int argc, char **argv)
perror("mcwm: signal");
exit(1);
}
-
+
/* Set up defaults. */
-
+
conf.borderwidth = BORDERWIDTH;
conf.snapmargin = SNAPMARGIN;
conf.terminal = TERMINAL;
@@ -4348,22 +4348,22 @@ int main(int argc, char **argv)
focuscol = FOCUSCOL;
unfocuscol = UNFOCUSCOL;
fixedcol = FIXEDCOL;
-
+
while (1)
{
ch = getopt(argc, argv, "b:s:it:f:u:x:");
if (-1 == ch)
{
-
+
/* No more options, break out of while loop. */
break;
}
-
+
switch (ch)
{
case 'b':
/* Border width */
- conf.borderwidth = atoi(optarg);
+ conf.borderwidth = atoi(optarg);
break;
case 's':
@@ -4374,7 +4374,7 @@ int main(int argc, char **argv)
case 'i':
conf.allowicons = true;
break;
-
+
case 't':
conf.terminal = optarg;
break;
@@ -4390,7 +4390,7 @@ int main(int argc, char **argv)
case 'x':
fixedcol = optarg;
break;
-
+
default:
printhelp();
exit(0);
@@ -4424,22 +4424,22 @@ int main(int argc, char **argv)
}
root = screen->root;
-
+
PDEBUG("Screen size: %dx%d\nRoot window: %d\n", screen->width_in_pixels,
screen->height_in_pixels, screen->root);
-
+
/* Get some colours. */
conf.focuscol = getcolor(focuscol);
conf.unfocuscol = getcolor(unfocuscol);
conf.fixedcol = getcolor(fixedcol);
-
+
/* Get some atoms. */
atom_desktop = getatom("_NET_WM_DESKTOP");
wm_delete_window = getatom("WM_DELETE_WINDOW");
wm_change_state = getatom("WM_CHANGE_STATE");
wm_state = getatom("WM_STATE");
wm_protocols = getatom("WM_PROTOCOLS");
-
+
/* Check for RANDR extension and configure. */
randrbase = setuprandr();
@@ -4466,7 +4466,7 @@ int main(int argc, char **argv)
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE,
1 /* left mouse button */,
MOUSEMODKEY);
-
+
xcb_grab_button(conn, 0, root, XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE,
@@ -4491,7 +4491,7 @@ int main(int argc, char **argv)
error = xcb_request_check(conn, cookie);
xcb_flush(conn);
-
+
if (NULL != error)
{
fprintf(stderr, "mcwm: Can't get SUBSTRUCTURE REDIRECT. "
@@ -4500,7 +4500,7 @@ int main(int argc, char **argv)
error->error_code);
xcb_disconnect(conn);
-
+
exit(1);
}