mirror of
https://github.com/fltk/fltk.git
synced 2026-05-09 21:06:51 +08:00
Undo recent commits intended to fix #1427 because fix is only partial.
The branch is at the same state as4f9d779after this commit. Undone commits are:0fe9b6c,88a4d74,fe4a6aa, andd2cff61.
This commit is contained in:
+2
-3
@@ -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]);*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user