Compare commits
1 Commits
master
...
netbsd-lat
Author | SHA1 | Date | |
---|---|---|---|
f4d595988a |
32
ChangeLog
32
ChangeLog
@ -1,3 +1,35 @@
|
|||||||
|
2022-01-09 Mike Small <smallm@sdf.org>
|
||||||
|
First step to more Windows like alt-tab window selection.
|
||||||
|
(In this case alt is mod4 key instead later to be configurable.)
|
||||||
|
Also hard code the binding as a step towards more limited
|
||||||
|
configuration and more fixed behavior...
|
||||||
|
|
||||||
|
* src/menus.cc (ExecuteFunction): Change F_WARPRING function
|
||||||
|
to HF_WARPRING to make clear its only used in hard coded commands
|
||||||
|
not from config. Add handling of "reverse" argument to mean to warp
|
||||||
|
along the ring in the reverse order from last key press.
|
||||||
|
(HardCodeSomeKeys): hard coded bindings for mod4-tab, mod4-left,
|
||||||
|
and mod4-right. Should make the modifier key customizable later.
|
||||||
|
|
||||||
|
* src/gram.y: Remove parsing logic for F_WARPRING.
|
||||||
|
|
||||||
|
* src/menus.cc (ExecuteFunction): Remove uses of F_WARPNEXT and
|
||||||
|
F_WARPPREV in ExecuteFunction and code for doing this kind of warp.
|
||||||
|
Keep F_WARPRING
|
||||||
|
|
||||||
|
* src/events.c (HandleButtonRelease): Remove F_CIRCLE{UP,DOWN} as
|
||||||
|
causes for PopDownMenu() call. Still needed by F_REFRESH.
|
||||||
|
|
||||||
|
* src/menus.cc (ExecuteFunction): Remove calls to
|
||||||
|
XCirculateSubwindows{Up,Down} corresponding to F_CIRCLE{UP,DOWN}.
|
||||||
|
|
||||||
|
* src/parse.h (F_CIRCLEUP): remove F_CIRCLEUP, F_CIRCLEDOWN,
|
||||||
|
F_WARPNEXT, F_WARPPREV, F_WARPRING tokens.
|
||||||
|
|
||||||
|
* src/parse.c (keytable): remove f.circleup, f.circledown,
|
||||||
|
f.warpnext, f.warpprev, f.warpring as configure file
|
||||||
|
keywords.
|
||||||
|
|
||||||
2021-04-03 Mike Small <smallm@sdf.org>
|
2021-04-03 Mike Small <smallm@sdf.org>
|
||||||
|
|
||||||
* src/parse.c (keytable): remove function keyword form parse table
|
* src/parse.c (keytable): remove function keyword form parse table
|
||||||
|
8
README
8
README
@ -11,6 +11,11 @@ Features removed...
|
|||||||
3. default user defined functions: move-or-lower, move-or-raise,
|
3. default user defined functions: move-or-lower, move-or-raise,
|
||||||
and move-or-iconify (changed to builtins) and the ability to define
|
and move-or-iconify (changed to builtins) and the ability to define
|
||||||
user defined functions.
|
user defined functions.
|
||||||
|
4. f.CircleUp, f.CircleDown, f.warpnext, f.warpprev. f.warpring continues
|
||||||
|
to exist but can take no custom binding. Bindings for f.warpring "prev"
|
||||||
|
and f.warpring "next" are hardcode on mod4-Left and mod4-Right. A
|
||||||
|
new mod4-tab command is hardcoded to reverse the warpring order argument
|
||||||
|
with each use.
|
||||||
|
|
||||||
Changes ...
|
Changes ...
|
||||||
|
|
||||||
@ -21,6 +26,9 @@ Changes ...
|
|||||||
Additions ...
|
Additions ...
|
||||||
|
|
||||||
1. builtin functions: move-or-lower, move-or-raise, and move-or-iconify.
|
1. builtin functions: move-or-lower, move-or-raise, and move-or-iconify.
|
||||||
|
2. mod4-tab (modifier should be customizable at some point) cycles windows
|
||||||
|
like MS Windows alt-tab, reversing the order of f.warpring each use to
|
||||||
|
make it easy to flip back and forth between two windows.
|
||||||
|
|
||||||
The master development code repository can be found at:
|
The master development code repository can be found at:
|
||||||
|
|
||||||
|
@ -1550,8 +1550,6 @@ HandleButtonRelease(void)
|
|||||||
case F_WARPTOSCREEN:
|
case F_WARPTOSCREEN:
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case F_CIRCLEUP:
|
|
||||||
case F_CIRCLEDOWN:
|
|
||||||
case F_REFRESH:
|
case F_REFRESH:
|
||||||
PopDownMenu();
|
PopDownMenu();
|
||||||
break;
|
break;
|
||||||
|
2270
src/gram.c
2270
src/gram.c
File diff suppressed because it is too large
Load Diff
221
src/gram.h
221
src/gram.h
@ -1,8 +1,9 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
/* A Bison parser, made by GNU Bison 3.7.6. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -15,7 +16,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
/* As a special exception, you may create a larger work that contains
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
@ -30,6 +31,10 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
|
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||||
|
especially those whose name start with YY_ or yy_. They are
|
||||||
|
private implementation details that can be changed or removed. */
|
||||||
|
|
||||||
#ifndef YY_YY_GRAM_H_INCLUDED
|
#ifndef YY_YY_GRAM_H_INCLUDED
|
||||||
# define YY_YY_GRAM_H_INCLUDED
|
# define YY_YY_GRAM_H_INCLUDED
|
||||||
/* Debug traces. */
|
/* Debug traces. */
|
||||||
@ -40,70 +45,79 @@
|
|||||||
extern int yydebug;
|
extern int yydebug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Token type. */
|
/* Token kinds. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
enum yytokentype
|
enum yytokentype
|
||||||
{
|
{
|
||||||
LB = 258,
|
YYEMPTY = -2,
|
||||||
RB = 259,
|
YYEOF = 0, /* "end of file" */
|
||||||
LP = 260,
|
YYerror = 256, /* error */
|
||||||
RP = 261,
|
YYUNDEF = 257, /* "invalid token" */
|
||||||
MENUS = 262,
|
LB = 258, /* LB */
|
||||||
MENU = 263,
|
RB = 259, /* RB */
|
||||||
BUTTON = 264,
|
LP = 260, /* LP */
|
||||||
DEFAULT_FUNCTION = 265,
|
RP = 261, /* RP */
|
||||||
PLUS = 266,
|
MENUS = 262, /* MENUS */
|
||||||
MINUS = 267,
|
MENU = 263, /* MENU */
|
||||||
ALL = 268,
|
BUTTON = 264, /* BUTTON */
|
||||||
OR = 269,
|
DEFAULT_FUNCTION = 265, /* DEFAULT_FUNCTION */
|
||||||
CURSORS = 270,
|
PLUS = 266, /* PLUS */
|
||||||
ICONS = 271,
|
MINUS = 267, /* MINUS */
|
||||||
COLOR = 272,
|
ALL = 268, /* ALL */
|
||||||
SAVECOLOR = 273,
|
OR = 269, /* OR */
|
||||||
MONOCHROME = 274,
|
CURSORS = 270, /* CURSORS */
|
||||||
WINDOW_FUNCTION = 276,
|
ICONS = 271, /* ICONS */
|
||||||
MAKE_TITLE = 277,
|
COLOR = 272, /* COLOR */
|
||||||
GRAYSCALE = 278,
|
SAVECOLOR = 273, /* SAVECOLOR */
|
||||||
NO_TITLE = 279,
|
MONOCHROME = 274, /* MONOCHROME */
|
||||||
AUTO_RAISE = 280,
|
WINDOW_FUNCTION = 275, /* WINDOW_FUNCTION */
|
||||||
META = 281,
|
MAKE_TITLE = 276, /* MAKE_TITLE */
|
||||||
SHIFT = 282,
|
GRAYSCALE = 277, /* GRAYSCALE */
|
||||||
LOCK = 283,
|
NO_TITLE = 278, /* NO_TITLE */
|
||||||
CONTROL = 284,
|
AUTO_RAISE = 279, /* AUTO_RAISE */
|
||||||
WINDOW = 285,
|
META = 280, /* META */
|
||||||
TITLE = 286,
|
SHIFT = 281, /* SHIFT */
|
||||||
ICON = 287,
|
LOCK = 282, /* LOCK */
|
||||||
ROOT = 288,
|
CONTROL = 283, /* CONTROL */
|
||||||
FRAME = 289,
|
WINDOW = 284, /* WINDOW */
|
||||||
COLON = 290,
|
TITLE = 285, /* TITLE */
|
||||||
EQUALS = 291,
|
ICON = 286, /* ICON */
|
||||||
START_ICONIFIED = 292,
|
ROOT = 287, /* ROOT */
|
||||||
MOVE = 293,
|
FRAME = 288, /* FRAME */
|
||||||
RESIZE = 294,
|
COLON = 289, /* COLON */
|
||||||
WAIT = 295,
|
EQUALS = 290, /* EQUALS */
|
||||||
SELECT = 296,
|
START_ICONIFIED = 291, /* START_ICONIFIED */
|
||||||
KILL = 297,
|
MOVE = 292, /* MOVE */
|
||||||
LEFT_TITLEBUTTON = 298,
|
RESIZE = 293, /* RESIZE */
|
||||||
RIGHT_TITLEBUTTON = 299,
|
WAIT = 294, /* WAIT */
|
||||||
NUMBER = 300,
|
SELECT = 295, /* SELECT */
|
||||||
KEYWORD = 301,
|
KILL = 296, /* KILL */
|
||||||
NKEYWORD = 302,
|
LEFT_TITLEBUTTON = 297, /* LEFT_TITLEBUTTON */
|
||||||
CKEYWORD = 303,
|
RIGHT_TITLEBUTTON = 298, /* RIGHT_TITLEBUTTON */
|
||||||
CLKEYWORD = 304,
|
NUMBER = 299, /* NUMBER */
|
||||||
FKEYWORD = 305,
|
KEYWORD = 300, /* KEYWORD */
|
||||||
FSKEYWORD = 306,
|
NKEYWORD = 301, /* NKEYWORD */
|
||||||
SKEYWORD = 307,
|
CKEYWORD = 302, /* CKEYWORD */
|
||||||
DKEYWORD = 308,
|
CLKEYWORD = 303, /* CLKEYWORD */
|
||||||
JKEYWORD = 309,
|
FKEYWORD = 304, /* FKEYWORD */
|
||||||
WINDOW_RING = 310,
|
FSKEYWORD = 305, /* FSKEYWORD */
|
||||||
WARP_CURSOR = 311,
|
SKEYWORD = 306, /* SKEYWORD */
|
||||||
ERRORTOKEN = 312,
|
DKEYWORD = 307, /* DKEYWORD */
|
||||||
NO_STACKMODE = 313,
|
JKEYWORD = 308, /* JKEYWORD */
|
||||||
STRING = 314
|
WINDOW_RING = 309, /* WINDOW_RING */
|
||||||
|
WARP_CURSOR = 310, /* WARP_CURSOR */
|
||||||
|
ERRORTOKEN = 311, /* ERRORTOKEN */
|
||||||
|
NO_STACKMODE = 312, /* NO_STACKMODE */
|
||||||
|
STRING = 313 /* STRING */
|
||||||
};
|
};
|
||||||
|
typedef enum yytokentype yytoken_kind_t;
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Token kinds. */
|
||||||
|
#define YYEMPTY -2
|
||||||
|
#define YYEOF 0
|
||||||
|
#define YYerror 256
|
||||||
|
#define YYUNDEF 257
|
||||||
#define LB 258
|
#define LB 258
|
||||||
#define RB 259
|
#define RB 259
|
||||||
#define LP 260
|
#define LP 260
|
||||||
@ -121,59 +135,58 @@ extern int yydebug;
|
|||||||
#define COLOR 272
|
#define COLOR 272
|
||||||
#define SAVECOLOR 273
|
#define SAVECOLOR 273
|
||||||
#define MONOCHROME 274
|
#define MONOCHROME 274
|
||||||
#define WINDOW_FUNCTION 276
|
#define WINDOW_FUNCTION 275
|
||||||
#define MAKE_TITLE 277
|
#define MAKE_TITLE 276
|
||||||
#define GRAYSCALE 278
|
#define GRAYSCALE 277
|
||||||
#define NO_TITLE 279
|
#define NO_TITLE 278
|
||||||
#define AUTO_RAISE 280
|
#define AUTO_RAISE 279
|
||||||
#define META 281
|
#define META 280
|
||||||
#define SHIFT 282
|
#define SHIFT 281
|
||||||
#define LOCK 283
|
#define LOCK 282
|
||||||
#define CONTROL 284
|
#define CONTROL 283
|
||||||
#define WINDOW 285
|
#define WINDOW 284
|
||||||
#define TITLE 286
|
#define TITLE 285
|
||||||
#define ICON 287
|
#define ICON 286
|
||||||
#define ROOT 288
|
#define ROOT 287
|
||||||
#define FRAME 289
|
#define FRAME 288
|
||||||
#define COLON 290
|
#define COLON 289
|
||||||
#define EQUALS 291
|
#define EQUALS 290
|
||||||
#define START_ICONIFIED 292
|
#define START_ICONIFIED 291
|
||||||
#define MOVE 293
|
#define MOVE 292
|
||||||
#define RESIZE 294
|
#define RESIZE 293
|
||||||
#define WAIT 295
|
#define WAIT 294
|
||||||
#define SELECT 296
|
#define SELECT 295
|
||||||
#define KILL 297
|
#define KILL 296
|
||||||
#define LEFT_TITLEBUTTON 298
|
#define LEFT_TITLEBUTTON 297
|
||||||
#define RIGHT_TITLEBUTTON 299
|
#define RIGHT_TITLEBUTTON 298
|
||||||
#define NUMBER 300
|
#define NUMBER 299
|
||||||
#define KEYWORD 301
|
#define KEYWORD 300
|
||||||
#define NKEYWORD 302
|
#define NKEYWORD 301
|
||||||
#define CKEYWORD 303
|
#define CKEYWORD 302
|
||||||
#define CLKEYWORD 304
|
#define CLKEYWORD 303
|
||||||
#define FKEYWORD 305
|
#define FKEYWORD 304
|
||||||
#define FSKEYWORD 306
|
#define FSKEYWORD 305
|
||||||
#define SKEYWORD 307
|
#define SKEYWORD 306
|
||||||
#define DKEYWORD 308
|
#define DKEYWORD 307
|
||||||
#define JKEYWORD 309
|
#define JKEYWORD 308
|
||||||
#define WINDOW_RING 310
|
#define WINDOW_RING 309
|
||||||
#define WARP_CURSOR 311
|
#define WARP_CURSOR 310
|
||||||
#define ERRORTOKEN 312
|
#define ERRORTOKEN 311
|
||||||
#define NO_STACKMODE 313
|
#define NO_STACKMODE 312
|
||||||
#define STRING 314
|
#define STRING 313
|
||||||
|
|
||||||
/* Value type. */
|
/* Value type. */
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
|
|
||||||
union YYSTYPE
|
union YYSTYPE
|
||||||
{
|
{
|
||||||
#line 106 "gram.y" /* yacc.c:1909 */
|
#line 106 "gram.y"
|
||||||
|
|
||||||
int num;
|
int num;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
#line 177 "gram.h" /* yacc.c:1909 */
|
#line 188 "gram.h"
|
||||||
};
|
|
||||||
|
|
||||||
|
};
|
||||||
typedef union YYSTYPE YYSTYPE;
|
typedef union YYSTYPE YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
@ -480,14 +480,6 @@ action : FKEYWORD { $$ = $1; }
|
|||||||
pull = GetRoot ($2, NULLSTR,NULLSTR);
|
pull = GetRoot ($2, NULLSTR,NULLSTR);
|
||||||
pull->prev = root;
|
pull->prev = root;
|
||||||
break;
|
break;
|
||||||
case F_WARPRING:
|
|
||||||
if (!CheckWarpRingArg (Action)) {
|
|
||||||
twmrc_error_prefix();
|
|
||||||
fprintf (stderr,
|
|
||||||
"ignoring invalid f.warptoring argument \"%s\"\n",
|
|
||||||
Action);
|
|
||||||
$$ = F_NOP;
|
|
||||||
}
|
|
||||||
case F_WARPTOSCREEN:
|
case F_WARPTOSCREEN:
|
||||||
if (!CheckWarpScreenArg (Action)) {
|
if (!CheckWarpScreenArg (Action)) {
|
||||||
twmrc_error_prefix();
|
twmrc_error_prefix();
|
||||||
|
109
src/menus.cc
109
src/menus.cc
@ -65,6 +65,7 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include "twm.h"
|
#include "twm.h"
|
||||||
@ -157,7 +158,11 @@ InitMenus(void)
|
|||||||
{
|
{
|
||||||
for (key = Scr->FuncKeyRoot.next; key != NULL;)
|
for (key = Scr->FuncKeyRoot.next; key != NULL;)
|
||||||
{
|
{
|
||||||
free(key->name);
|
// This is a problem. In HardCodeSomeKeys() you're adding
|
||||||
|
// string literals in as key->name. Should change the
|
||||||
|
// structure to take string, but not in next checkin.
|
||||||
|
// Will have to change that code to strdup the literals.
|
||||||
|
free(const_cast<void*>(static_cast<const void*>(key->name)));
|
||||||
tmp = key;
|
tmp = key;
|
||||||
key = key->next;
|
key = key->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
@ -179,8 +184,8 @@ InitMenus(void)
|
|||||||
* \param win_name the window name (if any)
|
* \param win_name the window name (if any)
|
||||||
* \param action the action string associated with the function (if any)
|
* \param action the action string associated with the function (if any)
|
||||||
*/
|
*/
|
||||||
Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
Bool AddFuncKey(const char *name, int cont, int mods, int func,
|
||||||
char *action)
|
const char *win_name, const char *action)
|
||||||
{
|
{
|
||||||
FuncKey *fkey;
|
FuncKey *fkey;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
@ -205,9 +210,14 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fkey == NULL)
|
if (fkey == nullptr)
|
||||||
{
|
{
|
||||||
fkey = new FuncKey;
|
// This might be passed to free() still. See InitMenus() above.
|
||||||
|
fkey = static_cast<FuncKey*>(malloc(sizeof(FuncKey)));
|
||||||
|
if (!fkey) {
|
||||||
|
std::cerr << "Out of memory in AddFuncKey().\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
fkey->next = Scr->FuncKeyRoot.next;
|
fkey->next = Scr->FuncKeyRoot.next;
|
||||||
Scr->FuncKeyRoot.next = fkey;
|
Scr->FuncKeyRoot.next = fkey;
|
||||||
}
|
}
|
||||||
@ -224,6 +234,39 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int HF_WARPRING = 500;
|
||||||
|
|
||||||
|
struct HCKey {
|
||||||
|
const char* name;
|
||||||
|
int cont;
|
||||||
|
int func;
|
||||||
|
const char* action;
|
||||||
|
};
|
||||||
|
|
||||||
|
void HardCodeSomeKeys(int mods)
|
||||||
|
{
|
||||||
|
std::vector<HCKey> keys {
|
||||||
|
{ "Tab", C_WINDOW, HF_WARPRING, "reverse"},
|
||||||
|
{ "Left", C_WINDOW, HF_WARPRING, "prev"},
|
||||||
|
{ "Right", C_WINDOW, HF_WARPRING, "next"}
|
||||||
|
};
|
||||||
|
// The loop below will be inadequate if you ever use ORed context bits.
|
||||||
|
// See GotKey() in gram.y.
|
||||||
|
for (auto& k : keys) {
|
||||||
|
// TODO: push this into AddFuncKey, also see use in gram.y.
|
||||||
|
// maybe change to std::string in FuncKey struct and remove frees, mallocs.
|
||||||
|
// Now we can't give a pointer to string literal cause free() might be called on it.
|
||||||
|
const char* nm = strdup(k.name);
|
||||||
|
if (!nm) {
|
||||||
|
std::cerr << "Out of memory in HardCodeSomeKeys().\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!AddFuncKey(nm, k.cont, mods, k.func, nullptr, k.action))
|
||||||
|
std::cerr << "Failed to hard code key " << k.name << " to action "
|
||||||
|
<< k.func << " with argument " << k.action << '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CreateTitleButton(const char *name, int func, const char *action,
|
int CreateTitleButton(const char *name, int func, const char *action,
|
||||||
@ -1272,9 +1315,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
case F_RAISELOWER:
|
case F_RAISELOWER:
|
||||||
case F_WARPTOSCREEN:
|
case F_WARPTOSCREEN:
|
||||||
case F_WARPTO:
|
case F_WARPTO:
|
||||||
case F_WARPRING:
|
case HF_WARPRING:
|
||||||
case F_WARPNEXT:
|
|
||||||
case F_WARPPREV:
|
|
||||||
case F_COLORMAP:
|
case F_COLORMAP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1819,14 +1860,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
Bell(XkbBI_MinorError,0,tmp_win->w);
|
Bell(XkbBI_MinorError,0,tmp_win->w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_CIRCLEUP:
|
|
||||||
XCirculateSubwindowsUp(dpy, Scr->Root);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case F_CIRCLEDOWN:
|
|
||||||
XCirculateSubwindowsDown(dpy, Scr->Root);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case F_EXEC:
|
case F_EXEC:
|
||||||
PopDownMenu();
|
PopDownMenu();
|
||||||
Execute(action);
|
Execute(action);
|
||||||
@ -1897,40 +1930,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_WARPPREV:
|
|
||||||
case F_WARPNEXT:
|
|
||||||
{
|
|
||||||
TwmWindow* t;
|
|
||||||
static TwmWindow* savedwarp{nullptr};
|
|
||||||
TwmWindow *of, *l, *n;
|
|
||||||
int c{0};
|
|
||||||
|
|
||||||
#define wseq(w) (func == F_WARPNEXT ? (w)->next : (w)->prev)
|
|
||||||
#define nwin(w) ((w) && (n=wseq(w)) != NULL && n != &Scr->TwmRoot ? n : l)
|
|
||||||
#define bwin(w) (!(w)||(w)==of||!(Scr->WarpUnmapped||(w)->mapped))
|
|
||||||
|
|
||||||
of=(Scr->Focus ? Scr->Focus : &Scr->TwmRoot);
|
|
||||||
|
|
||||||
for(t=Scr->TwmRoot.next; t; t=t->next) if(!bwin(t)) break;
|
|
||||||
if(!t) break; /* no windows we can use */
|
|
||||||
|
|
||||||
if(func == F_WARPPREV) for(l=of; l->next; l=l->next) ;
|
|
||||||
else l = Scr->TwmRoot.next;
|
|
||||||
|
|
||||||
for(t=of; bwin(t) && c < 2; t=nwin(t)) if(t == of) c++;
|
|
||||||
|
|
||||||
if(bwin(t) || c >= 2) Bell(XkbBI_MinorError,0,None);
|
|
||||||
else {
|
|
||||||
if(of && of == savedwarp) {
|
|
||||||
Iconify(of, 0, 0);
|
|
||||||
savedwarp = NULL;
|
|
||||||
}
|
|
||||||
if(!t->mapped) savedwarp = t; else savedwarp = NULL;
|
|
||||||
WarpThere(t);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case F_WARPTO:
|
case F_WARPTO:
|
||||||
{
|
{
|
||||||
const size_t len{strlen(action)};
|
const size_t len{strlen(action)};
|
||||||
@ -1958,14 +1957,18 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_WARPRING:
|
case HF_WARPRING:
|
||||||
switch (action[0]) {
|
switch (action[0]) {
|
||||||
|
static int direction = True; // True means "next".
|
||||||
case 'n':
|
case 'n':
|
||||||
WarpAlongRing (&eventp->xbutton, True);
|
WarpAlongRing(&eventp->xbutton, True);
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
WarpAlongRing (&eventp->xbutton, False);
|
WarpAlongRing(&eventp->xbutton, False);
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
WarpAlongRing(&eventp->xbutton, direction);
|
||||||
|
direction = !direction;
|
||||||
default:
|
default:
|
||||||
Bell(XkbBI_MinorError,0,None);
|
Bell(XkbBI_MinorError,0,None);
|
||||||
break;
|
break;
|
||||||
|
10
src/menus.h
10
src/menus.h
@ -122,14 +122,14 @@ typedef struct MouseButton
|
|||||||
typedef struct FuncKey
|
typedef struct FuncKey
|
||||||
{
|
{
|
||||||
struct FuncKey *next; /* next in the list of function keys */
|
struct FuncKey *next; /* next in the list of function keys */
|
||||||
char *name; /* key name */
|
const char *name; /* key name */
|
||||||
KeySym keysym; /* X keysym */
|
KeySym keysym; /* X keysym */
|
||||||
KeyCode keycode; /* X keycode */
|
KeyCode keycode; /* X keycode */
|
||||||
int cont; /* context */
|
int cont; /* context */
|
||||||
int mods; /* modifiers */
|
int mods; /* modifiers */
|
||||||
int func; /* function to perform */
|
int func; /* function to perform */
|
||||||
char *win_name; /* window name (if any) */
|
const char *win_name; /* window name (if any) */
|
||||||
char *action; /* action string (if any) */
|
const char *action; /* action string (if any) */
|
||||||
} FuncKey;
|
} FuncKey;
|
||||||
|
|
||||||
extern int RootFunction;
|
extern int RootFunction;
|
||||||
@ -171,7 +171,9 @@ extern int MenuDepth;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN void InitMenus( void );
|
EXTERN void InitMenus( void );
|
||||||
EXTERN Bool AddFuncKey( char *name, int cont, int mods, int func, char *win_name, char *action );
|
EXTERN Bool AddFuncKey( const char *name, int cont, int mods, int func,
|
||||||
|
const char *win_name, const char *action );
|
||||||
|
EXTERN void HardCodeSomeKeys(int mods);
|
||||||
EXTERN int CreateTitleButton( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append );
|
EXTERN int CreateTitleButton( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append );
|
||||||
EXTERN void InitTitlebarButtons( void );
|
EXTERN void InitTitlebarButtons( void );
|
||||||
EXTERN void PaintEntry( MenuRoot *mr, MenuItem *mi, int exposure );
|
EXTERN void PaintEntry( MenuRoot *mr, MenuItem *mi, int exposure );
|
||||||
|
21
src/parse.c
21
src/parse.c
@ -155,7 +155,7 @@ static int doparse (int (*ifunc)(void),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ParseTwmrc (char *filename)
|
int ParseTwmrc(char *filename)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *home = NULL;
|
char *home = NULL;
|
||||||
@ -205,18 +205,18 @@ int ParseTwmrc (char *filename)
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (filename && cp != filename) {
|
if (filename && cp != filename) {
|
||||||
fprintf (stderr,
|
fprintf(stderr,
|
||||||
"%s: unable to open twmrc file %s, using %s instead\n",
|
"%s: unable to open twmrc file %s, using %s instead\n",
|
||||||
ProgramName, filename, cp);
|
ProgramName, filename, cp);
|
||||||
}
|
}
|
||||||
status = doparse (twmFileInput, "file", cp);
|
status = doparse(twmFileInput, "file", cp);
|
||||||
fclose (twmrc);
|
fclose(twmrc);
|
||||||
return status;
|
return status;
|
||||||
} else {
|
} else {
|
||||||
if (filename) {
|
if (filename) {
|
||||||
fprintf (stderr,
|
fprintf(stderr,
|
||||||
"%s: unable to open twmrc file %s, using built-in defaults instead\n",
|
"%s: unable to open twmrc file %s, using built-in defaults instead\n",
|
||||||
ProgramName, filename);
|
ProgramName, filename);
|
||||||
}
|
}
|
||||||
return ParseStringList (defTwmrc);
|
return ParseStringList (defTwmrc);
|
||||||
}
|
}
|
||||||
@ -392,8 +392,6 @@ static TwmKeyword keytable[] = {
|
|||||||
{ "f.autoraise", FKEYWORD, F_AUTORAISE },
|
{ "f.autoraise", FKEYWORD, F_AUTORAISE },
|
||||||
{ "f.beep", FKEYWORD, F_BEEP },
|
{ "f.beep", FKEYWORD, F_BEEP },
|
||||||
{ "f.bottomzoom", FKEYWORD, F_BOTTOMZOOM },
|
{ "f.bottomzoom", FKEYWORD, F_BOTTOMZOOM },
|
||||||
{ "f.circledown", FKEYWORD, F_CIRCLEDOWN },
|
|
||||||
{ "f.circleup", FKEYWORD, F_CIRCLEUP },
|
|
||||||
{ "f.colormap", FSKEYWORD, F_COLORMAP },
|
{ "f.colormap", FSKEYWORD, F_COLORMAP },
|
||||||
{ "f.cut", FSKEYWORD, F_CUT },
|
{ "f.cut", FSKEYWORD, F_CUT },
|
||||||
{ "f.cutfile", FKEYWORD, F_CUTFILE },
|
{ "f.cutfile", FKEYWORD, F_CUTFILE },
|
||||||
@ -437,9 +435,6 @@ static TwmKeyword keytable[] = {
|
|||||||
{ "f.version", FKEYWORD, F_VERSION },
|
{ "f.version", FKEYWORD, F_VERSION },
|
||||||
{ "f.vlzoom", FKEYWORD, F_LEFTZOOM },
|
{ "f.vlzoom", FKEYWORD, F_LEFTZOOM },
|
||||||
{ "f.vrzoom", FKEYWORD, F_RIGHTZOOM },
|
{ "f.vrzoom", FKEYWORD, F_RIGHTZOOM },
|
||||||
{ "f.warpnext", FKEYWORD, F_WARPNEXT },
|
|
||||||
{ "f.warpprev", FKEYWORD, F_WARPPREV },
|
|
||||||
{ "f.warpring", FSKEYWORD, F_WARPRING },
|
|
||||||
{ "f.warpto", FSKEYWORD, F_WARPTO },
|
{ "f.warpto", FSKEYWORD, F_WARPTO },
|
||||||
{ "f.warptoscreen", FSKEYWORD, F_WARPTOSCREEN },
|
{ "f.warptoscreen", FSKEYWORD, F_WARPTOSCREEN },
|
||||||
{ "f.winrefresh", FKEYWORD, F_WINREFRESH },
|
{ "f.winrefresh", FKEYWORD, F_WINREFRESH },
|
||||||
|
@ -114,8 +114,6 @@ extern int mods;
|
|||||||
#define F_SAVEYOURSELF 29
|
#define F_SAVEYOURSELF 29
|
||||||
#define F_VERSION 30
|
#define F_VERSION 30
|
||||||
#define F_TITLE 31
|
#define F_TITLE 31
|
||||||
#define F_CIRCLEUP 41
|
|
||||||
#define F_CIRCLEDOWN 42
|
|
||||||
#define F_CUTFILE 43
|
#define F_CUTFILE 43
|
||||||
#define F_SHOWLIST 44
|
#define F_SHOWLIST 44
|
||||||
#define F_HIDELIST 45
|
#define F_HIDELIST 45
|
||||||
@ -124,10 +122,7 @@ extern int mods;
|
|||||||
#define F_MOVE_OR_RAISE 48
|
#define F_MOVE_OR_RAISE 48
|
||||||
|
|
||||||
#define F_MENU 101 /* string */
|
#define F_MENU 101 /* string */
|
||||||
#define F_WARPNEXT 112 /* string */
|
|
||||||
#define F_WARPPREV 113 /* string */
|
|
||||||
#define F_WARPTO 102 /* string */
|
#define F_WARPTO 102 /* string */
|
||||||
#define F_WARPRING 104 /* string */
|
|
||||||
#define F_FILE 105 /* string */
|
#define F_FILE 105 /* string */
|
||||||
#define F_EXEC 106 /* string */
|
#define F_EXEC 106 /* string */
|
||||||
#define F_CUT 107 /* string */
|
#define F_CUT 107 /* string */
|
||||||
|
@ -533,6 +533,9 @@ main(int argc, char *argv[])
|
|||||||
if (!Scr->HaveFonts) CreateFonts();
|
if (!Scr->HaveFonts) CreateFonts();
|
||||||
CreateGCs();
|
CreateGCs();
|
||||||
MakeMenus();
|
MakeMenus();
|
||||||
|
// TODO: make this configurable.
|
||||||
|
const int default_key_mods = Mod4Mask;
|
||||||
|
HardCodeSomeKeys(default_key_mods);
|
||||||
|
|
||||||
Scr->TitleBarFont.y += Scr->FramePadding;
|
Scr->TitleBarFont.y += Scr->FramePadding;
|
||||||
Scr->TitleHeight = Scr->TitleBarFont.height + Scr->FramePadding * 2;
|
Scr->TitleHeight = Scr->TitleBarFont.height + Scr->FramePadding * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user