diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 668e009d5..8ccda6dbb 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -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]);*/ diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 9bf6dd776..f88f6eebe 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -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 diff --git a/src/drivers/Unix/Fl_Unix_System_Driver.H b/src/drivers/Unix/Fl_Unix_System_Driver.H index 27b784820..ccd92ad79 100644 --- a/src/drivers/Unix/Fl_Unix_System_Driver.H +++ b/src/drivers/Unix/Fl_Unix_System_Driver.H @@ -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 */ diff --git a/src/drivers/Unix/Fl_Unix_System_Driver.cxx b/src/drivers/Unix/Fl_Unix_System_Driver.cxx index 3de87dca5..443838c5d 100644 --- a/src/drivers/Unix/Fl_Unix_System_Driver.cxx +++ b/src/drivers/Unix/Fl_Unix_System_Driver.cxx @@ -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; -} diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 972812e01..36764150c 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -21,7 +21,7 @@ #include #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 #include #include @@ -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;