From f5e97022397c3c2f5fb3e1525bf65116de53a393 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 6 Jan 2018 12:10:59 +0100 Subject: Minor improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- LICENSE | 26 ++++++++++++++++++++++++-- xcman.c | 20 ++++++-------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/LICENSE b/LICENSE index c90c31e..4eab4f3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,11 @@ -Copyright © 2018 Mattias Andrée -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 + +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. diff --git a/xcman.c b/xcman.c index d6a501a..ecc3098 100644 --- a/xcman.c +++ b/xcman.c @@ -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); -- cgit v1.2.3-70-g09d2