Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wmenu for openSUSE:Factory checked in at 2024-09-19 21:17:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wmenu (Old) and /work/SRC/openSUSE:Factory/.wmenu.new.29891 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wmenu" Thu Sep 19 21:17:09 2024 rev:5 rq:1201841 version:0.1.9 Changes: -------- --- /work/SRC/openSUSE:Factory/wmenu/wmenu.changes 2024-05-13 17:58:29.462792787 +0200 +++ /work/SRC/openSUSE:Factory/.wmenu.new.29891/wmenu.changes 2024-09-19 21:17:27.342752108 +0200 @@ -1,0 +2,10 @@ +Wed Sep 18 18:29:56 UTC 2024 - llyyr <ll...@yukari.in> + +- Update to new upstream host +- Update to version 0.1.9: + * Revert "Remove wmenu -P flag" + * Don't ignore stdin in password mode + * Make wmenu-run behave like dmenu_run + * Streamline menu callbacks + +------------------------------------------------------------------- Old: ---- 0.1.8.tar.gz New: ---- 0.1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wmenu.spec ++++++ --- /var/tmp/diff_new_pack.iHTDjp/_old 2024-09-19 21:17:28.302791904 +0200 +++ /var/tmp/diff_new_pack.iHTDjp/_new 2024-09-19 21:17:28.306792070 +0200 @@ -17,13 +17,13 @@ Name: wmenu -Version: 0.1.8 +Version: 0.1.9 Release: 0 Summary: A dynamic menu for Sway and wlroots-based Wayland compositors License: MIT Group: System/X11/Utilities -URL: https://sr.ht/~adnano/wmenu -Source: https://git.sr.ht/~adnano/wmenu/archive/%{version}.tar.gz +URL: https://codeberg.org/adnano/wmenu +Source: https://codeberg.org/adnano/wmenu/archive/%{version}.tar.gz BuildRequires: meson BuildRequires: pkgconfig BuildRequires: scdoc @@ -33,15 +33,13 @@ BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(wayland-protocols) BuildRequires: pkgconfig(xkbcommon) -# wmenu wants dmenu_run -Recommends: dmenu %description An dynamic menu for Sway and wlroots based Wayland compositors (requires wlr_layer_shell_v1 support). %prep -%autosetup +%autosetup -n wmenu %build export CFLAGS="%{optflags}" ++++++ 0.1.8.tar.gz -> 0.1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/LICENSE new/wmenu/LICENSE --- old/wmenu-0.1.8/LICENSE 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/LICENSE 2024-06-10 02:33:37.000000000 +0200 @@ -11,7 +11,7 @@ © 2014-2020 Hiltjo Posthuma <hil...@codemadness.org> © 2015-2019 Quentin Rameau <quinq@fifth.space> © 2018-2019 Henrik Nyman <h...@nyymanni.com> -© 2022 Adnan Maolood +© 2022 adnano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/README.md new/wmenu/README.md --- old/wmenu-0.1.8/README.md 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/README.md 2024-06-10 02:33:37.000000000 +0200 @@ -30,14 +30,3 @@ set $menu wmenu-run bindsym $mod+d exec $menu ``` - -## Contributing - -Send patches and questions to [~adnano/wmenu-devel](https://lists.sr.ht/~adnano/wmenu-devel). - -Subscribe to release announcements on [~adnano/wmenu-announce](https://lists.sr.ht/~adnano/wmenu-announce). - -## Credits - -This project started as a fork of [dmenu-wl](https://github.com/nyyManni/dmenu-wayland). -However, most of the code was rewritten from scratch. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/docs/wmenu.1.scd new/wmenu/docs/wmenu.1.scd --- old/wmenu-0.1.8/docs/wmenu.1.scd 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/docs/wmenu.1.scd 2024-06-10 02:33:37.000000000 +0200 @@ -6,7 +6,7 @@ # SYNOPSIS -*wmenu* [-biv] \ +*wmenu* [-biPv] \ [-f _font_] \ [-l _lines_] \ [-o _output_] \ @@ -35,6 +35,10 @@ *-i* wmenu matches menu items case insensitively. +*-P* + wmenu will not directly display the keyboard input, but instead replace it + with asterisks. + *-v* prints version information to stdout, then exits. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/menu.c new/wmenu/menu.c --- old/wmenu-0.1.8/menu.c 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/menu.c 2024-06-10 02:33:37.000000000 +0200 @@ -22,7 +22,7 @@ #include "wayland.h" // Creates and returns a new menu. -struct menu *menu_create() { +struct menu *menu_create(menu_callback callback) { struct menu *menu = calloc(1, sizeof(struct menu)); menu->strncmp = strncmp; menu->font = "monospace 10"; @@ -32,6 +32,7 @@ menu->promptfg = 0xeeeeeeff; menu->selectionbg = 0x005577ff; menu->selectionfg = 0xeeeeeeff; + menu->callback = callback; return menu; } @@ -85,11 +86,11 @@ // Parse menu options from command line arguments. void menu_getopts(struct menu *menu, int argc, char *argv[]) { const char *usage = - "Usage: wmenu [-biPvx] [-f font] [-l lines] [-o output] [-p prompt]\n" + "Usage: wmenu [-biPv] [-f font] [-l lines] [-o output] [-p prompt]\n" "\t[-N color] [-n color] [-M color] [-m color] [-S color] [-s color]\n"; int opt; - while ((opt = getopt(argc, argv, "bhivf:l:o:p:N:n:M:m:S:s:")) != -1) { + while ((opt = getopt(argc, argv, "bhiPvf:l:o:p:N:n:M:m:S:s:")) != -1) { switch (opt) { case 'b': menu->bottom = true; @@ -97,6 +98,9 @@ case 'i': menu->strncmp = strncasecmp; break; + case 'P': + menu->passwd = true; + break; case 'v': puts("wmenu " VERSION); exit(EXIT_SUCCESS); @@ -568,18 +572,10 @@ case XKB_KEY_Return: case XKB_KEY_KP_Enter: if (shift) { - puts(menu->input); - fflush(stdout); - menu->exit = true; - } else if (menu->callback) { - menu->callback(menu); + menu->callback(menu, menu->input, true); } else { char *text = menu->sel ? menu->sel->text : menu->input; - puts(text); - fflush(stdout); - if (!ctrl) { - menu->exit = true; - } + menu->callback(menu, text, !ctrl); } break; case XKB_KEY_Left: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/menu.h new/wmenu/menu.h --- old/wmenu-0.1.8/menu.h 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/menu.h 2024-06-10 02:33:37.000000000 +0200 @@ -6,6 +6,9 @@ #include <xkbcommon/xkbcommon.h> #include <wayland-client.h> +struct menu; +typedef void (*menu_callback)(struct menu *menu, char *text, bool exit); + // A menu item. struct item { char *text; @@ -30,6 +33,8 @@ bool bottom; // The function used to match menu items int (*strncmp)(const char *, const char *, size_t); + // Whether the input is a password + bool passwd; // The font used to display the menu char *font; // The number of lines to list items vertically @@ -66,12 +71,12 @@ struct item *sel; // selected item struct page *pages; // list of pages - void (*callback)(struct menu *menu); + menu_callback callback; bool exit; bool failure; }; -struct menu *menu_create(); +struct menu *menu_create(menu_callback callback); void menu_destroy(struct menu *menu); void menu_getopts(struct menu *menu, int argc, char *argv[]); void menu_add_item(struct menu *menu, char *text, bool sort); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/meson.build new/wmenu/meson.build --- old/wmenu-0.1.8/meson.build 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/meson.build 2024-06-10 02:33:37.000000000 +0200 @@ -1,7 +1,7 @@ project( 'wmenu', 'c', - version: '0.1.8', + version: '0.1.9', license: 'MIT', default_options: [ 'c_std=c11', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/render.c new/wmenu/render.c --- old/wmenu-0.1.8/render.c 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/render.c 2024-06-10 02:33:37.000000000 +0200 @@ -79,8 +79,22 @@ // Renders the input text. static void render_input(struct menu *menu, cairo_t *cairo) { - render_text(menu, cairo, menu->input, menu->promptw, 0, 0, - 0, menu->normalfg, menu->padding, menu->padding); + char *censort = NULL; + + if (menu->passwd) { + censort = calloc(1, sizeof(menu->input)); + if (!censort) { + return; + } + memset(censort, '*', strlen(menu->input)); + } + + render_text(menu, cairo, menu->passwd ? censort : menu->input, + menu->promptw, 0, 0, 0, menu->normalfg, menu->padding, menu->padding); + + if (censort) { + free(censort); + } } // Renders a cursor for the input field. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/wayland.c new/wmenu/wayland.c --- old/wmenu-0.1.8/wayland.c 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/wayland.c 2024-06-10 02:33:37.000000000 +0200 @@ -494,11 +494,10 @@ } } - bool failure = menu->failure; context_destroy(context); menu->context = NULL; - if (failure) { + if (menu->failure) { return EXIT_FAILURE; } return EXIT_SUCCESS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/wmenu-run.c new/wmenu/wmenu-run.c --- old/wmenu-0.1.8/wmenu-run.c 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/wmenu-run.c 2024-06-10 02:33:37.000000000 +0200 @@ -1,6 +1,6 @@ #define _POSIX_C_SOURCE 200809L #include <dirent.h> -#include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -27,49 +27,48 @@ free(path); } -struct executable { +struct command { struct menu *menu; - char *name; + char *text; + bool exit; }; static void activation_token_done(void *data, struct xdg_activation_token_v1 *activation_token, const char *token) { - struct executable *exe = data; + struct command *cmd = data; xdg_activation_token_v1_destroy(activation_token); - menu_destroy(exe->menu); - setenv("XDG_ACTIVATION_TOKEN", token, true); - execlp(exe->name, exe->name, NULL); - - fprintf(stderr, "Failed to execute selection: %s\n", strerror(errno)); - free(exe->name); - free(exe); - exit(EXIT_FAILURE); + int pid = fork(); + if (pid == 0) { + setenv("XDG_ACTIVATION_TOKEN", token, true); + char *argv[] = {"/bin/sh", "-c", cmd->text, NULL}; + execvp(argv[0], (char**)argv); + } else { + if (cmd->exit) { + cmd->menu->exit = true; + } + } } static const struct xdg_activation_token_v1_listener activation_token_listener = { .done = activation_token_done, }; -static void exec(struct menu *menu) { - if (!menu->sel) { - return; - } - - struct executable *exe = calloc(1, sizeof(struct executable)); - exe->menu = menu; - exe->name = strdup(menu->sel->text); +static void exec_item(struct menu *menu, char *text, bool exit) { + struct command *cmd = calloc(1, sizeof(struct command)); + cmd->menu = menu; + cmd->text = strdup(text); + cmd->exit = exit; struct xdg_activation_v1 *activation = context_get_xdg_activation(menu->context); struct xdg_activation_token_v1 *activation_token = xdg_activation_v1_get_activation_token(activation); xdg_activation_token_v1_set_surface(activation_token, context_get_surface(menu->context)); - xdg_activation_token_v1_add_listener(activation_token, &activation_token_listener, exe); + xdg_activation_token_v1_add_listener(activation_token, &activation_token_listener, cmd); xdg_activation_token_v1_commit(activation_token); } int main(int argc, char *argv[]) { - struct menu *menu = menu_create(); - menu->callback = exec; + struct menu *menu = menu_create(exec_item); menu_getopts(menu, argc, argv); read_items(menu); int status = menu_run(menu); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wmenu-0.1.8/wmenu.c new/wmenu/wmenu.c --- old/wmenu-0.1.8/wmenu.c 2024-05-05 03:42:31.000000000 +0200 +++ new/wmenu/wmenu.c 2024-06-10 02:33:37.000000000 +0200 @@ -1,5 +1,6 @@ #define _POSIX_C_SOURCE 200809L +#include <stdio.h> #include <string.h> #include "menu.h" @@ -16,8 +17,16 @@ } } +static void print_item(struct menu *menu, char *text, bool exit) { + puts(text); + fflush(stdout); + if (exit) { + menu->exit = true; + } +} + int main(int argc, char *argv[]) { - struct menu *menu = menu_create(); + struct menu *menu = menu_create(print_item); menu_getopts(menu, argc, argv); read_items(menu); int status = menu_run(menu);