Comments (16)
Are you using an unusual keyboard layout / X11 keyboard configuration?
What happens when you try to define keybindings in ~/.config/feh/keys, do those work?
from feh.
keybindings from $XDG_CONFIG_HOME/feh/keys also do not work.
I use CAPS LOCK to switch between german and american layout.
EDIT: I accidentially closed this issue and there seems to be no way (for me) to open it again.
from feh.
Could you give me the output of xev for a few keypresses that should work with feh, and tell me if xev is reporting the right keys?
This all looks quite weird, so far you're the only one who has reported such a problem.
from feh.
http://dpaste.org/jsJY/
the output looks fine, it shows the keys I pressed.
from feh.
Ah... I forgot that X can set more keystates than just Ctrl, Shift and Mod1-Mod5... there will be a commit up shortly, would you mind checking if that fixes the issue for you?
from feh.
... And in case it doesn't work, try configuring some keybindings with Alt (mod1) like next-img 1-n 1-Right, prev-img 1-p 1-Left etc.
Because it looks like, for whatever reason, X11 always reports that your mod1 key is pressed.
from feh.
it tried version 1.11-13-g39073b4 (your bugfix), but the problem persists.
also defining a binding for 1-n did not fix it.
from feh.
it seems like my caps-lock (mod2) is set. (state 0x10)
there is no way to disable it without changing my keyboard configuration. (even pressing caps (layout toggle) or pressing shift-caps (toggles the actual caps-lock functionality) does not unset the bit.)
- state = kev->state & (ControlMask | Mod1Mask | Mod2Mask | Mod3Mask |
- Mod4Mask | Mod5Mask);
+ state = kev->state & (ControlMask | Mod1Mask | Mod3Mask |
+ Mod4Mask | Mod5Mask);
fixes the problem, but also disables one to use mod2 for keybindings
from feh.
Actually, 0x10 is NumLock/Mod2. With that, I was able to reproduce it here :)
I have now reduced the available modifiers to Control, Alt (Mod1) and Super/Windows (Mod4). I think that's still definitely enough.
from feh.
I see, NumLock makes a lot more sense.
The bug is gone in version 1.11-14-g570db2e, thanks!
from feh.
I don't understand why Shift has to be removed. As what I see
ShiftMask -> 0x01
NumLk -> 0x10
CapLk -> 0x02
With this way:
state = kev->state & (ControlMask | ShiftMask | Mod1Mask | Mod4Mask);
It shouldn't be having problem with or without either of NumLk or CapLk enabled, and I do have none after I added the Shift key back.
Did I miss something?
from feh.
Shift is removed because it changes the key code itself.
When you press s, you get XK_s, and when you press S, you get XK_S. So feh does support shift, it just checks it via the keycode and not the modifier mask.
from feh.
But feh can't distinguish between Up and Shift+Up.
Right now, after I added it back, I can have both and normal keypress like f and S-F. (The only drawback, you need to adopt the changed keycode, not using S-f, or simply F)
from feh.
Hm, right. It shouldn't be too hard to allow defining S-Up, while not requiring other Shift keys to be defined with the S- prefix.
But I'm on vacation right now, so although I respond to some bugreports I won't do anything big for the next 9 days. I'll fix it after that .Hope that's acceptable ;)
from feh.
How about this?
diff --git a/src/keyevents.c b/src/keyevents.c
index ddfe782..836e794 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -55,6 +55,9 @@ static void feh_set_parse_kb_partial(fehkey *key, int index, char *ks) {
case 'C':
mod = ControlMask;
break;
+ case 'S':
+ mod = ShiftMask;
+ break;
case '1':
mod = Mod1Mask;
break;
@@ -69,6 +72,8 @@ static void feh_set_parse_kb_partial(fehkey *key, int index, char *ks) {
}
key->keysyms[index] = XStringToKeysym(cur);
+ if (isascii(key->keysyms[index]))
+ mod &= ~ShiftMask;
key->keystates[index] = mod;
if (key->keysyms[index] == NoSymbol)
@@ -346,7 +351,9 @@ void feh_event_handle_keypress(XEvent * ev)
kev = (XKeyEvent *) ev;
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL);
- state = kev->state & (ControlMask | Mod1Mask | Mod4Mask);
+ state = kev->state & (ControlMask | ShiftMask | Mod1Mask | Mod4Mask);
+ if (isascii(keysym))
+ state &= ~ShiftMask;
/* menus are showing, so this is a menu control keypress */
if (ev->xbutton.window == menu_cover) {
Just drop ShiftMask when the keysym is ASCII?
"F" can still be used and "Up/S-Up" is distinguishable. "S-F" would be just "F" (S is dropped) and "S-f" wouldn't work since S is dropped and keysym would be XK_F, but it's easy to fix this with a conversion, however, who is going to use "S-f"?
(Sorry for interrupting your vacation, it is totally acceptable to deal this after you come back :) )
from feh.
Looks great, thanks a lot!
Patch commited in 7f2e2a3
from feh.
Related Issues (20)
- use stat for sorting by size like we do with mtime HOT 1
- use stat for sorting by size like we do with mtime HOT 1
- feh only zooms correctly in bspwm after modifying window HOT 1
- Feature request: Variable display times in slideshow mode HOT 2
- feh modifies a passed filelist HOT 4
- make appimage file or binary file
- Feh crashes with SIGBUS when rapidly changing the underliying file HOT 5
- --keep-zoom and preserving window geometry
- right click crash HOT 1
- feh does not open ppm files which use the P3 version
- Feh's signal handler is not async-signal-safe
- Add option to enable aliasing
- FEH problem -c HOT 2
- feh -c option not working HOT 1
- Heap-buffer-overflow when loading an image in imlib_load_image_with_error_return() HOT 5
- Double free in imlib_free_image_and_decache() HOT 2
- Free with invalid size in the function imlib_free_image_and_decache() HOT 2
- No handling of memory allocation of invalid size when calling init_imlib_fonts() HOT 2
- action not mapped? not called during feh session
- somewhere along the way my --cycle-once themes broke HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feh.