foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit b443c2f037af9f6e0ae25164f1b8d7f5588b2f41
parent b0e3d93792675d863177e07eacca577b96429ce6
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Sat, 23 Jun 2012 09:19:10 -0400

Added Colors to spawned windows
Added LICENSE file and DWM's getColor function

Diffstat:
ALICENSE | 43+++++++++++++++++++++++++++++++++++++++++++
Mconfig.h | 2++
Mfifo-wm.c | 25+++++++++++++++++++++++++
3 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,43 @@ +Copyright (c) 2012 Miles Sandlar + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +Parts of DWM are also included in this project and licensed as follows: + +MIT/X Consortium License + +© 2006-2011 Anselm R Garbe <anselm@garbe.us> +© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com> +© 2010-2011 Connor Lane Smith <cls@lubutu.com> +© 2006-2009 Jukka Salmi <jukka at salmi dot ch> +© 2007-2009 Premysl Hruby <dfenze at gmail dot com> +© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com> +© 2007-2009 Christof Musik <christof at sendfax dot de> +© 2009 Mate Nagy <mnagy at port70 dot net> +© 2007-2008 Enno Gottox Boland <gottox at s01 dot de> +© 2008 Martin Hurton <martin dot hurton at gmail dot com> +© 2008 Neale Pickett <neale dot woozle dot org> +© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER diff --git a/config.h b/config.h @@ -1 +1,3 @@ #define FIFO "wm-fifo" +#define FOCUSEDCOLOR "rgb:37/ff/00" +#define UNFOCUSEDCOLOR "rgb:00/ff/ee" diff --git a/fifo-wm.c b/fifo-wm.c @@ -17,6 +17,8 @@ int lastOrientation; Display *display; Window root; struct timeval tv; +long unfocusedColor; +long focusedColor; /* Tracks the current container */ void crawlContainer(Container * container, int level) { @@ -164,6 +166,17 @@ int placeContainer(Container * container, int x, int y, int width, int height) { } } + +//Thank you DWM ;) +unsigned long getColor(const char *colstr) { + Colormap cmap = DefaultColormap(display, activeScreen); + XColor color; + + if(!XAllocNamedColor(display, cmap, colstr, &color, &color)) { return 0; } + return color.pixel; +} + + /* ==================== * Handling of X Events * ==================== */ @@ -185,6 +198,10 @@ void xMapRequest(XEvent *event) { lastContainer = newContainer; + + XSetWindowBorderWidth(display, newClient -> window, 5); + XSetWindowBorder(display, newClient -> window, unfocusedColor); + //Update view placeContainer( currentContainer, 0, 0, @@ -259,6 +276,8 @@ int main() { currentContainer = malloc(sizeof(Container)); currentContainer -> layout = 0; + + lastContainer = currentContainer; display = XOpenDisplay(NULL); @@ -267,6 +286,12 @@ int main() { root = RootWindow(display, activeScreen); activeScreen = DefaultScreen(display); + + focusedColor = getColor(FOCUSEDCOLOR); + unfocusedColor = getColor(UNFOCUSEDCOLOR); + + + XGrabButton( display, AnyButton, AnyModifier, root, True, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | OwnerGrabButtonMask,