diff options
author | Mattias Andrée <maandree@kth.se> | 2018-01-06 12:10:59 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-01-06 12:14:31 +0100 |
commit | f5e97022397c3c2f5fb3e1525bf65116de53a393 (patch) | |
tree | 4c3b577197ea129392733f7cba76ef25d913c6f2 | |
parent | Remove XShape support, doesn't seem to be necessary as long as you start the compositor first (diff) | |
download | xcman-1.1.tar.gz xcman-1.1.tar.bz2 xcman-1.1.tar.xz |
Minor improvements1.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | LICENSE | 26 | ||||
-rw-r--r-- | xcman.c | 20 |
2 files changed, 30 insertions, 16 deletions
@@ -1,5 +1,11 @@ -Copyright © 2018 Mattias Andrée <maandree@kth.se> -Copyright © 2003 Keith Packard (xcompmgr) +Based on xcompmgr, originally written by Keith Packard, with modifications +from several contributors (according to the xcompmgr man page): Matthew Allum, +Eric Anholt, Dan Doel, Thomas Luebking, Matthew Hawn, Ely Levy, Phil Blundell, +and Carl Worth. + +xcompmgr + +Copyright © 2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -18,3 +24,19 @@ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +xcman + +Copyright © 2018 Mattias Andrée <maandree@kth.se> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. @@ -75,20 +75,15 @@ solid_picture(double a) Pixmap pixmap; Picture picture; XRenderPictureAttributes pa; - pixmap = XCreatePixmap(dpy, root, 1, 1, 8); if (!pixmap) return None; - pa.repeat = 1; picture = XRenderCreatePicture(dpy, pixmap, XRenderFindStandardFormat(dpy, PictStandardA8), CPRepeat, &pa); - if (!picture) { - XFreePixmap(dpy, pixmap); - return None; + if (picture) { + alpha_colour.alpha = a * 0xFFFF; + XRenderFillRectangle(dpy, PictOpSrc, picture, &alpha_colour, 0, 0, 1, 1); } - - alpha_colour.alpha = a * 0xFFFF; - XRenderFillRectangle(dpy, PictOpSrc, picture, &alpha_colour, 0, 0, 1, 1); XFreePixmap(dpy, pixmap); return picture; } @@ -302,7 +297,7 @@ get_opacity_prop(struct window *w, unsigned int def) int format; unsigned long int n, left; unsigned char *data; - int err = XGetWindowProperty(dpy, w->id, opacity_atom, 0L, 1L, 0, XA_CARDINAL, &actual, &format, &n, &left, &data); + int err = XGetWindowProperty(dpy, w->id, opacity_atom, 0, 1, 0, XA_CARDINAL, &actual, &format, &n, &left, &data); if (!err && data) { i = *(uint32_t *)data; XFree(data); @@ -566,7 +561,7 @@ error(Display *display, XErrorEvent *ev) } fprintf(stderr, "error %i: %s request %i minor %i serial %lu\n", - ev->error_code, (strlen(name) > 0) ? name : "unknown", + ev->error_code, *name ? name : "unknown", ev->request_code, ev->minor_code, ev->serial); return 0; @@ -581,12 +576,10 @@ register_composite_manager(void) XTextProperty tp; char **strs; int count; - sprintf(net_wm_cm, "_NET_WM_CM_S%i", screen); a = XInternAtom(dpy, net_wm_cm, 0); w = XGetSelectionOwner(dpy, a); - - if (w != None) { + if (w) { winNameAtom = XInternAtom(dpy, "_NET_WM_NAME", 0); if (!XGetTextProperty(dpy, w, &tp, winNameAtom) && !XGetTextProperty(dpy, w, &tp, XA_WM_NAME)) { @@ -599,7 +592,6 @@ register_composite_manager(void) XFree(tp.value); exit(1); } - w = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, None, None); Xutf8SetWMProperties(dpy, w, "xcman", "xcman", NULL, 0, NULL, NULL, NULL); XSetSelectionOwner(dpy, a, w, 0); |