Undo recent commits intended to fix #1427 because fix is only partial.
Build and Test / build-linux (push) Waiting to run
Build and Test / build-wayland (push) Waiting to run
Build and Test / build-macos (push) Waiting to run
Build and Test / build-windows (push) Waiting to run

The branch is at the same state as 4f9d779 after this commit.
Undone commits are: 0fe9b6c, 88a4d74, fe4a6aa, and d2cff61.
This commit is contained in:
ManoloFLTK
2026-05-08 10:00:07 +02:00
parent d2cff6107d
commit 1b83eb2a39
5 changed files with 3 additions and 47 deletions
+2 -3
View File
@@ -2150,11 +2150,10 @@ static void cocoaKeyboardHandler(NSEvent *theEvent)
NSString *sim = [theEvent charactersIgnoringModifiers];
UniChar one;
CFStringGetCharacters((CFStringRef)sim, CFRangeMake(0, 1), &one);
// charactersIgnoringModifiers doesn't ignore shift, remove it when it's on
if(one >= 'A' && one <= 'Z') one += 32;
if (one > 0 && one <= 0x7f && (sym<'0' || sym>'9') ) sym = one;
}
// sym may contain an uppercase letter, e.g. with non-latin keyboard layout and ctrl/cmd,
// replace uppercase letter by lowercase.
if (sym >= 'A' && sym <= 'Z') sym += 32;
Fl::e_keysym = Fl::e_original_keysym = sym;
/*NSLog(@"cocoaKeyboardHandler: keycode=%08x keysym=%08x mods=%08x symbol=%@ (%@)",
keyCode, sym, mods, [theEvent characters], [theEvent charactersIgnoringModifiers]);*/
-14
View File
@@ -1300,7 +1300,6 @@ static bool remove_xid_vector(Window xid) {
return false;
}
int fl_handle(const XEvent& thisevent)
{
XEvent xevent = thisevent;
@@ -1992,19 +1991,6 @@ int fl_handle(const XEvent& thisevent)
keysym = '0';
}
int keysyms_per_keycode;
KeySym *syms = XGetKeyboardMapping(fl_display, 38 /* 'A' key on US keyboard */, 1,
&keysyms_per_keycode);
// Check for non-Latin keyboard layout. Based on the assumption that the 'A' key of the keyboard
// having a non-ASCII keysym indicates a non-Latin layout.
if (syms[0] > 'z') {
int asciiSym = Fl_Unix_System_Driver::keycode_to_ascii(keycode);
if (asciiSym != 0) {
keysym = asciiSym;
}
}
XFree(syms);
// We have to get rid of the XK_KP_function keys, because they are
// not produced on Windoze and thus case statements tend not to check
// for them. There are 15 of these in the range 0xff91 ... 0xff9f
-1
View File
@@ -49,7 +49,6 @@ public:
static unsigned char *create_bmp(const unsigned char *data, int W, int H, int *return_size);
static Fl_RGB_Image *own_bmp_to_RGB(char *bmp);
static void read_int(uchar *c, int& i);
static char keycode_to_ascii(int keycode);
};
#endif /* FL_NIX_SYSTEM_DRIVER_H */
@@ -912,23 +912,3 @@ Fl_RGB_Image *Fl_Unix_System_Driver::own_bmp_to_RGB(char *bmp) {
img->alloc_array = 1;
return img;
}
/*
Used with non-Latin keyboards to get the Latin letter associated to a key,
typically useful when used with Ctrl.
Based on the assumption that Latin letters have the QWERTY layout in any
non-Latin layout. This assumption was verified true for Greek, Russian,
and Thai layouts.
Not used with keyboard layouts using Latin letters where the location
of letters varies extensively (e.g., French, Turkish).
*/
char Fl_Unix_System_Driver::keycode_to_ascii(int keycode) {
static const char row_AD[] = "qwertyuiop";
static const char row_AC[] = "asdfghjkl";
static const char row_AB[] = "zxcvbnm";
if (keycode >= 24 && keycode <= 33) return row_AD[keycode - 24];
else if (keycode >= 38 && keycode <= 46) return row_AC[keycode - 38];
else if (keycode >= 52 && keycode <= 58) return row_AB[keycode - 52];
else return 0;
}
@@ -21,7 +21,7 @@
#include <wayland-cursor.h>
#include "../../../libdecor/build/fl_libdecor.h"
#include "xdg-shell-client-protocol.h"
#include "../Unix/Fl_Unix_System_Driver.H"
#include "../Posix/Fl_Posix_System_Driver.H"
#include <FL/Fl.H>
#include <FL/Fl_Image_Surface.H>
#include <FL/platform.H>
@@ -604,14 +604,6 @@ static int process_wld_key(struct xkb_state *xkb_state, uint32_t key,
} else if (keycode == 19) {
for_key_vector = '0';
}
// Check for non-Latin keyboard layout. Based on the assumption that the 'A' key of the keyboard
// having a non-ASCII keysym indicates a non-Latin layout.
if (xkb_state_key_get_one_sym(xkb_state, 38 /* 'A' key on US keyboard */) > 'z') {
int asciiSym = Fl_Unix_System_Driver::keycode_to_ascii(keycode);
if (asciiSym != 0) {
for_key_vector = asciiSym;
}
}
if (p_keycode) *p_keycode = keycode;
if (p_sym) *p_sym = sym;
return for_key_vector;