Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zzndb
unclutter-xfixes
_service:obs_scm:unclutter-xfixes-1.6.1~git.202...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:unclutter-xfixes-1.6.1~git.20210825.obscpio of Package unclutter-xfixes
07070100000000000081A40000000000000000000000016125D8DC0000002F000000000000000000000000000000000000002F00000000unclutter-xfixes-1.6.1~git.20210825/.gitignoreunclutter obj/*.o man/*.1 man/*.xml test/GLOB* 07070100000001000081A40000000000000000000000016125D8DC000000F8000000000000000000000000000000000000003000000000unclutter-xfixes-1.6.1~git.20210825/.travis.ymllanguage: c compiler: - gcc branches: only: - master install: - sudo apt-get update - sudo apt-get install asciidoc - sudo apt-get install libx11-dev libxi-dev libxfixes-dev libev-dev xsltproc script: - make -j8 all 07070100000002000081A40000000000000000000000016125D8DC00000065000000000000000000000000000000000000003100000000unclutter-xfixes-1.6.1~git.20210825/DEPENDENCIESThe following list contains the dependencies for unclutter-xfixes: ev X11 xfixes xi asciidoc (make) 07070100000003000081A40000000000000000000000016125D8DC00000439000000000000000000000000000000000000002C00000000unclutter-xfixes-1.6.1~git.20210825/LICENSEThe MIT License (MIT) Copyright (c) [2015] [Ingo Bürk] 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. 07070100000004000081A40000000000000000000000016125D8DC00000573000000000000000000000000000000000000002D00000000unclutter-xfixes-1.6.1~git.20210825/MakefileTARGET = unclutter VERSION = 1.7 SDIR = src IDIR = include ODIR = obj INSTALL = install PREFIX = /usr BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 LICENSEDIR = $(PREFIX)/share/licenses/$(TARGET) CC = gcc LD = $(CC) PKG_CONFIG = pkg-config CPPFLAGS += -D'__VERSION="${VERSION}"' "-I$(IDIR)" CFLAGS += -std=gnu99 CFLAGS += -Wall -Wundef -Wshadow -Wformat-security LDFLAGS += $(shell $(PKG_CONFIG) --libs x11 xi xfixes) # libev has no pkg-config support LDFLAGS += -lev INCS = $(wildcard $(IDIR)/*.h) SRCS = $(wildcard $(SDIR)/*.c) OBJS = $(patsubst %,$(ODIR)/%,$(notdir $(SRCS:.c=.o))) MANS = man/unclutter-xfixes.1 .NOTPARALLEL: .PHONY: all all: clean $(TARGET) mans .PHONY: $(TARGET) $(TARGET): $(OBJS) $(LD) $(OBJS) $(LDFLAGS) -o "$(TARGET)" $(ODIR)/%.o: $(SDIR)/%.c $(INCS) $(CC) $(CPPFLAGS) $(CFLAGS) -o "$@" -c "$<" .PHONY: install install: $(TARGET) mans $(INSTALL) -Dm 0755 "$(TARGET)" "$(DESTDIR)$(BINDIR)/$(TARGET)" $(INSTALL) -Dm 0644 man/unclutter-xfixes.1 "$(DESTDIR)$(MANDIR)/unclutter.1" $(INSTALL) -Dm 0644 -t "$(DESTDIR)$(LICENSEDIR)/" LICENSE .PHONY: uninstall uninstall: $(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" $(RM) "$(DESTDIR)$(MANDIR)/unclutter.1" $(RM) "$(DESTDIR)$(LICENSEDIR)/LICENSE" .PHONY: mans mans: $(MANS) $(MANS): %.1: %.man a2x --no-xmllint -f manpage "$<" .PHONY: clean clean: $(RM) $(TARGET) $(OBJS) $(RM) man/*.1 man/*.xml 07070100000005000081A40000000000000000000000016125D8DC0000059A000000000000000000000000000000000000002E00000000unclutter-xfixes-1.6.1~git.20210825/README.md[![Issues](https://img.shields.io/github/issues/Airblader/unclutter-xfixes.svg)](https://github.com/Airblader/unclutter-xfixes/issues) [![Forks](https://img.shields.io/github/forks/Airblader/unclutter-xfixes.svg)](https://github.com/Airblader/unclutter-xfixes/network) [![Stars](https://img.shields.io/github/stars/Airblader/unclutter-xfixes.svg)](https://github.com/Airblader/unclutter-xfixes/stargazers) # unclutter-xfixes ## About This is a rewrite of the popular tool unclutter, but using the x11-xfixes extension. This means that this rewrite doesn't use fake windows or pointer grabbing and hence causes less problems with window managers and/or applications. ## Installation ### Arch / Manjaro ``` pacman -S unclutter ``` unclutter-xfixes is also available in the AUR as [unclutter-xfixes-git](https://aur.archlinux.org/packages/unclutter-xfixes-git/). ### Fedora unclutter-xfixes is available [via a copr repository](https://copr.fedorainfracloud.org/coprs/nbeernink/unclutter-xfixes/). ### FreeBSD unclutter-xfixes is available in the FreeBSD Ports Collection as [misc/unclutter-xfixes](https://www.freshports.org/misc/unclutter-xfixes/). ### Manual unclutter-xfixes is make-based. Hence, you can clone the git repository and compile and install it via ``` git clone https://github.com/Airblader/unclutter-xfixes cd unclutter-xfixes make sudo make install ``` ## Usage See `man unclutter` after installation. 07070100000006000041ED0000000000000000000000026125D8DC00000000000000000000000000000000000000000000002C00000000unclutter-xfixes-1.6.1~git.20210825/include07070100000007000081A40000000000000000000000016125D8DC000000BA000000000000000000000000000000000000003200000000unclutter-xfixes-1.6.1~git.20210825/include/all.h// vim:ts=4:sw=4:expandtab #pragma once #include "externals.h" #include "cursor.h" #include "extensions.h" #include "event.h" #include "globals.h" #include "types.h" #include "util.h" 07070100000008000081A40000000000000000000000016125D8DC000000AD000000000000000000000000000000000000003500000000unclutter-xfixes-1.6.1~git.20210825/include/cursor.h// vim:ts=4:sw=4:expandtab #pragma once #include <X11/Xlib.h> void cursor_show(void); void cursor_hide(void); void cursor_find(Window *child, int *root_x, int *root_y); 07070100000009000081A40000000000000000000000016125D8DC00000040000000000000000000000000000000000000003400000000unclutter-xfixes-1.6.1~git.20210825/include/event.h// vim:ts=4:sw=4:expandtab #pragma once void event_init(void); 0707010000000A000081A40000000000000000000000016125D8DC00000045000000000000000000000000000000000000003900000000unclutter-xfixes-1.6.1~git.20210825/include/extensions.h// vim:ts=4:sw=4:expandtab #pragma once void extensions_init(void); 0707010000000B000081A40000000000000000000000016125D8DC00000122000000000000000000000000000000000000003800000000unclutter-xfixes-1.6.1~git.20210825/include/externals.h// vim:ts=4:sw=4:expandtab #pragma once #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <string.h> #include <err.h> #include <ev.h> #include <float.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/extensions/XInput2.h> #include <X11/extensions/Xfixes.h> 0707010000000C000081A40000000000000000000000016125D8DC0000011F000000000000000000000000000000000000003600000000unclutter-xfixes-1.6.1~git.20210825/include/globals.h// vim:ts=4:sw=4:expandtab #pragma once #include <X11/Xlib.h> #include "types.h" extern Display *display; extern int xi_ext_opcode; extern Config config; extern int num_screens; extern Window *roots; extern int active_screen; extern Window active_root; extern int default_screen; 0707010000000D000081A40000000000000000000000016125D8DC0000024D000000000000000000000000000000000000003400000000unclutter-xfixes-1.6.1~git.20210825/include/types.h// vim:ts=4:sw=4:expandtab #pragma once typedef struct match_t { char *name; int len; } match_t; typedef struct ignore_buttons_t { unsigned char count; unsigned int *buttons; } ignore_buttons_t; typedef struct Config { double timeout; long jitter; bool exclude_root; bool ignore_scrolling; ignore_buttons_t ignore_buttons; bool hide_on_touch; bool fork; bool debug; bool onescreen; bool ignore_matches; match_t *matches; bool start_hidden; } Config; typedef struct coordinates_t { int x; int y; } coordinates_t; 0707010000000E000081A40000000000000000000000016125D8DC0000045D000000000000000000000000000000000000003300000000unclutter-xfixes-1.6.1~git.20210825/include/util.h// vim:ts=4:sw=4:expandtab #pragma once #include <stdlib.h> #include <stdio.h> #include <limits.h> #define FREE(p) \ do { \ if (p != NULL) { \ free(p); \ p = NULL; \ } \ } while (0) #define DLOG(message, ...) \ do { \ if (config.debug) \ printf("[%s:%d] DEBUG: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__); \ } while (0) #define ELOG(message, ...) \ do { \ fprintf(stderr, "[%s:%d] ERROR: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__); \ } while (0) void bail(char *message); long int parse_int(char *str); double parse_double(char *str); void parse_buttons_numbers(char *str, ignore_buttons_t *ignore_buttons); 0707010000000F000041ED0000000000000000000000026125D8DC00000000000000000000000000000000000000000000002800000000unclutter-xfixes-1.6.1~git.20210825/man07070100000010000081A40000000000000000000000016125D8DC00000E6B000000000000000000000000000000000000003D00000000unclutter-xfixes-1.6.1~git.20210825/man/unclutter-xfixes.manunclutter-xfixes(1) =================== Ingo Bürk <ingo.buerk@airblader.de> == NAME unclutter-xfixes - rewrite of unclutter using the X11-Xfixes extension == SYNOPSIS unclutter [*--timeout* _seconds_] [*--jitter* _radius_] [*--exclude-root*] [*--ignore-scrolling*] [*--ignore-buttons* _buttons_] [*--hide-on-touch*] [*--fork*|*-b*] [*--help*|*-h*] [*--version*|*-v*] [*--start-hidden*] Compatibility arguments: unclutter [*--display*|*-d* _display_] [*--idle* _seconds_] [*--keystroke*] [*--grab*] [*--noevents*] [*--reset*] [*--root*] [*--onescreen*] [*--not*] _name …_ == DESCRIPTION Hide the mouse cursor if it isn't being used. This version of unclutter is a rewrite of the original and uses the x11-xfixes extension, which means that no fake windows or pointer grabbing is needed. This should work better with window managers and applications. == OPTIONS *--timeout* _seconds_:: Specifies the number of seconds after which the cursor should be hidden if it was neither moved nor any button was pressed. (Default: 5) *--jitter* _radius_:: Ignore cursor movements if the cursor hasn't moved at least _radius_ pixels. *--exclude-root*:: Don't hide the mouse cursor if it is idling over the root window and not an actual window since in this case it isn't obscuring anything important, but rather just the desktop background. *--ignore-scrolling*:: Ignore mouse scroll events (buttons 4 and 5) so that scrolling doesn't unhide the cursor. This is a shortcut for *--ignore-buttons* '4,5'. If you want to ignore horizontal scrolling as well, use *--ignore-buttons* instead by specifying all buttons manually (e.g. '4,5,6,7'). *--ignore-buttons*:: Defines the mouse buttons which do not unhide the cursor when clicked. You can pass multiple button numbers by separating them with ','. *--hide-on-touch*:: Hides the mouse cursor on touch events. *--start-hidden*:: Starts the cursor hidden. *--fork*|*-b*:: Fork unclutter to the background. *--help|-h*:: Display the usage and exit. *--version*|*-v*:: Display the version and exit. == TROUBLESHOOTING === *--ignore-scrolling* doesn't work This can happen, especially on trackpoints, if other button events, e.g. for horizontal scrolling, are sent as well. You can try adding some jitter, or verify by using *xev -event button*. If you want to ignore horizontal scrolling as well, use *--ignore-buttons* instead of *--ignore-scrolling*. == COMPATIBILITY In order to be used as a drop-in replacement of unclutter, unclutter-xfixes accepts all command line arguments of unclutter, but ignores most of them. *--display*|*-d* _display_:: Specifies the X display to use. The same effect can be achieved by setting the *DISPLAY* environment variable. *--idle* _seconds_:: This argument is mapped to *--timeout*. *--keystroke*:: This argument is ignored. *--grab*:: This argument is ignored. *--noevents*:: This argument is ignored. *--reset*:: This argument is ignored. *--root*:: This argument does the opposite of *--exclude-root*. Shouldn't need to be given, as this is the default behavior in unclutter-xfixes. *--onescreen*:: This argument restricts unclutter to the single screen specified in *--display* or to the default screen of the display. *--not*:: This argument will result in all arguments that aren't options or option arguments, to be collected into a list that specifies windows where the cursor shall not be removed. These will be the windows where an element of the list matches, in a case insensitive comparison, the starting characters of either the WM_NAME, or the name or class of the WM_CLASS, properties of the window. (Note that this argument can be given anywhere on the command line.) 07070100000011000041ED0000000000000000000000026125D8DC00000000000000000000000000000000000000000000002800000000unclutter-xfixes-1.6.1~git.20210825/obj07070100000012000081A40000000000000000000000016125D8DC00000000000000000000000000000000000000000000003100000000unclutter-xfixes-1.6.1~git.20210825/obj/.gitkeep07070100000013000041ED0000000000000000000000026125D8DC00000000000000000000000000000000000000000000002800000000unclutter-xfixes-1.6.1~git.20210825/src07070100000014000081A40000000000000000000000016125D8DC0000034D000000000000000000000000000000000000003100000000unclutter-xfixes-1.6.1~git.20210825/src/cursor.c// vim:ts=4:sw=4:expandtab #include "all.h" static bool hidden = false; void cursor_show(void) { if (!hidden) return; DLOG("Showing the cursor."); XFixesShowCursor(display, active_root); XFlush(display); hidden = false; } void cursor_hide(void) { if (hidden) return; DLOG("Hiding the cursor."); XFixesHideCursor(display, active_root); XFlush(display); hidden = true; } void cursor_find(Window *child, int *root_x, int *root_y) { Window root; int win_x, win_y; unsigned int mask; int screen; for (screen = 0; screen < num_screens; screen++) { if (XQueryPointer(display, roots[screen], &root, child, root_x, root_y, &win_x, &win_y, &mask)) { active_screen = screen; active_root = roots[screen]; break; } } } 07070100000015000081A40000000000000000000000016125D8DC000015F8000000000000000000000000000000000000003000000000unclutter-xfixes-1.6.1~git.20210825/src/event.c// vim:ts=4:sw=4:expandtab #include "all.h" static struct ev_loop *loop; static struct ev_timer *idle_watcher; static struct ev_io *x_watcher; static struct ev_check *x_check; static coordinates_t last_cursor_pos; static Window last_avoided = None; /* Forward declarations */ static void event_init_x_loop(void); static void event_init_timer(void); static void x_cb(EV_P_ ev_io *w, int revents); static void x_check_cb(EV_P_ ev_check *w, int revents); static void idle_cb(EV_P_ ev_timer *w, int revents); static void event_select_xi(void); void event_init(void) { event_select_xi(); loop = EV_DEFAULT; event_init_x_loop(); event_init_timer(); ev_run(loop, 0); } static void event_init_x_loop(void) { x_watcher = calloc(sizeof(struct ev_io), 1); ev_io_init(x_watcher, x_cb, XConnectionNumber(display), EV_READ); ev_io_start(loop, x_watcher); x_check = calloc(sizeof(struct ev_check), 1); ev_check_init(x_check, x_check_cb); ev_check_start(loop, x_check); } static void event_init_timer(void) { idle_watcher = calloc(sizeof(struct ev_timer), 1); ev_timer_init(idle_watcher, idle_cb, config.timeout, config.timeout); ev_timer_start(loop, idle_watcher); } static void x_cb(EV_P_ ev_io *w, int revents) { /* Deliberately empty. */ } static bool is_button_ignored(const XIRawEvent *data) { if (config.ignore_scrolling && (data->detail == 4 || data->detail == 5)) { return true; } for (int i = 0; i < config.ignore_buttons.count; ++i) { if (data->detail == config.ignore_buttons.buttons[i]) { return true; } } return false; } static void x_check_cb(EV_P_ ev_check *w, int revents) { XEvent ev; while (XPending(display) > 0) { XNextEvent(display, &ev); XGenericEventCookie *cookie = &ev.xcookie; if (cookie->type != GenericEvent || cookie->extension != xi_ext_opcode || !XGetEventData(display, cookie)) { continue; } if (cookie->evtype == XI_RawButtonPress) { const XIRawEvent *data = (const XIRawEvent *) cookie->data; if (is_button_ignored(data)) { XFreeEventData(display, cookie); continue; } } XFreeEventData(display, cookie); if (config.jitter > 0 && cookie->evtype == XI_RawMotion) { Window child; int root_x, root_y; cursor_find(&child, &root_x, &root_y); int dx = last_cursor_pos.x - root_x; int dy = last_cursor_pos.y - root_y; if (dx * dx + dy * dy < config.jitter * config.jitter) { continue; } last_cursor_pos.x = root_x; last_cursor_pos.y = root_y; } if (config.hide_on_touch && (cookie->evtype == XI_RawTouchBegin || cookie->evtype == XI_RawTouchUpdate)) { cursor_hide(); } else { /* We don't bother checking the exact event since we only select events that interest us. */ cursor_show(); } ev_timer_again(loop, idle_watcher); } } static bool name_matches(Window win) { match_t *ignored; XClassHint hint; char *name; bool found = false; if (XFetchName(display, win, &name)) { for (ignored = config.matches; ignored->name; ignored++) if((found = strncasecmp(ignored->name, name, ignored->len)==0)) break; XFree(name); if (found) return true; } if (XGetClassHint(display, win, &hint)) { for (ignored = config.matches; ignored->name; ignored++) if((found = strncasecmp(ignored->name, hint.res_name, ignored->len) == 0 || strncasecmp(ignored->name, hint.res_class, ignored->len) == 0)) break; XFree(hint.res_name); XFree(hint.res_class); if (found) return true; } return false; } static bool is_on_ignore_list(Window win) { Window child_in; Window win_in; Window win_dummy; int root_x, root_y; int win_x, win_y; unsigned int mask; if (win == last_avoided) return true; last_avoided = None; child_in = win_in = win; do { win_in = child_in; if (name_matches(win_in)) { last_avoided = win; return true; } } while (XQueryPointer(display, win_in, &win_dummy, &child_in, &root_x, &root_y, &win_x, &win_y, &mask) && child_in != None); return false; } static void idle_cb(EV_P_ ev_timer *w, int revents) { Window child; int root_x, root_y; cursor_find(&child, &root_x, &root_y); if (child) { // not on root if (!config.onescreen || active_screen == default_screen) if (!config.ignore_matches || !is_on_ignore_list(child)) cursor_hide(); } else { // on root if (!config.exclude_root) if (!config.onescreen || active_screen == default_screen) cursor_hide(); } } static void event_select_xi(void) { XIEventMask masks[1]; unsigned char mask[(XI_LASTEVENT + 7)/8]; memset(mask, 0, sizeof(mask)); XISetMask(mask, XI_RawMotion); XISetMask(mask, XI_RawButtonPress); XISetMask(mask, XI_RawTouchUpdate); if (config.hide_on_touch) { XISetMask(mask, XI_RawTouchBegin); XISetMask(mask, XI_RawTouchUpdate); } masks[0].deviceid = XIAllMasterDevices; masks[0].mask_len = sizeof(mask); masks[0].mask = mask; XISelectEvents(display, active_root, masks, 1); XFlush(display); } 07070100000016000081A40000000000000000000000016125D8DC0000022C000000000000000000000000000000000000003500000000unclutter-xfixes-1.6.1~git.20210825/src/extensions.c// vim:ts=4:sw=4:expandtab #include "all.h" int xi_ext_opcode = -1; void extensions_init(void) { int event, error; if (!XQueryExtension(display, "XInputExtension", &xi_ext_opcode, &event, &error)) bail("XInput extension is not available."); int major_op = 2; int minor_op = 2; int result = XIQueryVersion(display, &major_op, &minor_op); if (result == BadRequest) bail("XI2 is not supported in a sufficient version (or at all)."); else if (result != Success) bail("Failed to query XI2 extension."); } 07070100000017000081A40000000000000000000000016125D8DC00001CCD000000000000000000000000000000000000003400000000unclutter-xfixes-1.6.1~git.20210825/src/unclutter.c// vim:ts=4:sw=4:expandtab #include "all.h" #include <getopt.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #ifndef __VERSION #define __VERSION "unknown" #endif typedef void (*callback)(void); /* Forward declarations */ static void run(void); static void on_exit_hook(void); static void parse_args(int argc, char *argv[]); static void print_usage(char *argv[]); static void safe_fork(callback child_callback); static void display_init(); Display *display; int num_screens; Window *roots; // root of each screen // screen and root window the cursor is in, as set in cursor_find int active_screen; Window active_root; // the screen to use with the onescreen option int default_screen; Config config = { .timeout = 5, .jitter = 0, .exclude_root = false, .ignore_scrolling = false, .ignore_buttons.count = 0, .ignore_buttons.buttons = NULL, .hide_on_touch = false, .fork = false, .debug = false, .onescreen = false, .ignore_matches = false, .matches = NULL, .start_hidden = false }; int main(int argc, char *argv[]) { atexit(on_exit_hook); parse_args(argc, argv); if (config.fork) { DLOG("Forking to background."); safe_fork(run); } else run(); } static void run(void) { display = XOpenDisplay(NULL); if (display == NULL) bail("Failed to connect to the X server."); display_init(); extensions_init(); if (config.start_hidden) cursor_hide(); event_init(); exit(EXIT_SUCCESS); } static void on_exit_hook(void) { cursor_show(); if (display != NULL) XCloseDisplay(display); } static void parse_args(int argc, char *argv[]) { int c, opt_index = 0; static struct option long_options[] = { /* Compatibility options */ { "display", required_argument, 0, 0 }, { "idle", required_argument, 0, 0 }, { "keystroke", no_argument, 0, 0 }, { "grab", no_argument, 0, 0 }, { "noevents", no_argument, 0, 0 }, { "reset", no_argument, 0, 0 }, { "root", no_argument, 0, 0 }, { "onescreen", no_argument, 0, 0 }, { "not", no_argument, 0, 0 }, /* unclutter-xfixes options */ { "timeout", required_argument, 0, 0 }, { "jitter", required_argument, 0, 0 }, { "exclude-root", no_argument, 0, 0 }, { "ignore-scrolling", no_argument, 0, 0 }, { "ignore-buttons", required_argument, 0, 0 }, { "hide-on-touch", no_argument, 0, 0 }, { "fork", no_argument, 0, 'b' }, { "version", no_argument, 0, 'v' }, { "help", no_argument, 0, 'h' }, { "debug", no_argument, 0, 0 }, { "start-hidden", no_argument, 0, 0}, { 0, 0, 0, 0 } }; while ((c = getopt_long_only(argc, argv, "t:j:bvhd:", long_options, &opt_index)) != -1) { long value; double value_double; const char *opt_name = long_options[opt_index].name; #define OPT_NAME_IS(name) (strcmp(opt_name, (name)) == 0) switch (c) { case 0: if (OPT_NAME_IS("display")) { setenv("DISPLAY", optarg, true); break; } else if (OPT_NAME_IS("timeout") || OPT_NAME_IS("idle")) { value_double = parse_double(optarg); if (value_double < 0) ELOG("Invalid timeout specified."); else config.timeout = value_double; break; } else if (OPT_NAME_IS("jitter")) { value = parse_int(optarg); if (value < 0) ELOG("Invalid jitter value specified."); else config.jitter = value; break; } else if (OPT_NAME_IS("exclude-root")) { config.exclude_root = true; break; } else if (OPT_NAME_IS("hide-on-touch")) { config.hide_on_touch = true; break; } else if (OPT_NAME_IS("root")) { config.exclude_root = false; break; } else if (OPT_NAME_IS("onescreen")) { config.onescreen = true; break; } else if (OPT_NAME_IS("not")) { config.ignore_matches = true; break; } else if (OPT_NAME_IS("ignore-scrolling")) { config.ignore_scrolling = true; break; } else if (OPT_NAME_IS("ignore-buttons")) { parse_buttons_numbers(optarg, &config.ignore_buttons); break; } else if (OPT_NAME_IS("debug")) { config.debug = true; break; } else if (OPT_NAME_IS("keystroke") || OPT_NAME_IS("grab") || OPT_NAME_IS("noevents") || OPT_NAME_IS("reset")) { ELOG("Using unsupported unclutter argument \"%s\", ignoring.", opt_name); break; } else if (OPT_NAME_IS("start-hidden")) { config.start_hidden = true; break; } print_usage(argv); break; case 'b': config.fork = true; break; case 'v': fprintf(stderr, "unclutter-xfixes version %s\n", __VERSION); exit(EXIT_SUCCESS); break; case 'd': setenv("DISPLAY", optarg, true); break; case 'h': default: print_usage(argv); break; } } if (config.ignore_matches) { config.matches = calloc(sizeof(match_t), argc - optind + 1); if (config.matches == NULL) bail("Failed to allocate space for matches"); for (c = 0; optind < argc; c++, optind++) { char *name = argv[optind]; config.matches[c].name = name; config.matches[c].len = name ? strlen(name) : 0; } } #undef OPT_NAME_IS } static void print_usage(char *argv[]) { fprintf(stderr, "Usage: %s [--timeout <n>] [--jitter <radius>] [--exclude-root] [--ignore-scrolling] [--ignore-buttons <buttons>] [--hide-on-touch] [-b|--fork] [-v|--version] [-h|--help] [--start-hidden]", argv[0]); fprintf(stderr, "\n"); exit(EXIT_FAILURE); } static void safe_fork(callback child_callback) { pid_t pid = fork(); if (!pid) { if (!fork()) { (*child_callback)(); } else { exit(EXIT_SUCCESS); } } else { waitpid(pid, NULL, 0); } } static void display_init() { int screen; Window child; int root_x, root_y; num_screens = ScreenCount(display); roots = calloc(sizeof(Window), num_screens); if (roots == NULL) bail("Failed to allocate root windows."); for (screen = 0; screen < num_screens; screen++) roots[screen] = XRootWindow(display, screen); active_screen = DefaultScreen(display); active_root = RootWindow(display, active_screen); default_screen = active_screen; cursor_find(&child, &root_x, &root_y); } 07070100000018000081A40000000000000000000000016125D8DC000005E2000000000000000000000000000000000000002F00000000unclutter-xfixes-1.6.1~git.20210825/src/util.c// vim:ts=4:sw=4:expandtab #include "all.h" void bail(char *message) { ELOG("Received error: %s", message); errx(EXIT_FAILURE, "%s", message); } long parse_int(char *str) { char *endptr = NULL; long parsed = strtol(str, &endptr, 10); if (parsed == LONG_MIN || parsed == LONG_MAX || parsed < 0 || endptr == str) { return -1; } return parsed; } double parse_double(char *str) { char *endptr = NULL; double parsed = strtod(str, &endptr); if (parsed == -DBL_MAX || parsed == DBL_MAX || parsed < 0 || endptr == str) { return -1; } return parsed; } void parse_buttons_numbers(char *str, ignore_buttons_t *ignore_buttons) { char *button = strtok(str, ","); while (button != NULL) { long number = parse_int(button); button = strtok(NULL, ","); if (number == -1) { continue; } ignore_buttons->count++; unsigned int *buttons = (unsigned int *)realloc(ignore_buttons->buttons, ignore_buttons->count * sizeof(unsigned int)); if (buttons == NULL) { free(ignore_buttons->buttons); bail("Cannot reallocate memory for ignore-buttons"); } else { ignore_buttons->buttons = buttons; } ignore_buttons->buttons[ignore_buttons->count - 1] = number; } if (ignore_buttons->count == 0) { bail("--ignore-buttons was specified, but no button could be parsed."); } } 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!61 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor